<?php
use Illuminate\Support\Facades\Auth;
?>

@extends('layouts/layoutMaster')

@section('title', 'Prima Nota')

@section('vendor-style')
@vite([
'resources/assets/vendor/libs/datatables-bs5/datatables.bootstrap5.scss',
'resources/assets/vendor/libs/datatables-responsive-bs5/responsive.bootstrap5.scss',
'resources/assets/vendor/libs/datatables-buttons-bs5/buttons.bootstrap5.scss',
'resources/assets/vendor/libs/flatpickr/flatpickr.scss',
'resources/assets/vendor/libs/@form-validation/form-validation.scss'

])
@endsection

<!-- Vendor Scripts -->
@section('vendor-script')
@vite([
'resources/assets/vendor/libs/moment/moment.js',
'resources/assets/vendor/libs/flatpickr/flatpickr.js',
'resources/assets/vendor/libs/@form-validation/popular.js',
'resources/assets/vendor/libs/@form-validation/bootstrap5.js',
'resources/assets/vendor/libs/@form-validation/auto-focus.js',
'resources/assets/vendor/libs/@form-validation/popular.js',
'resources/assets/vendor/libs/@form-validation/bootstrap5.js',
'resources/assets/vendor/libs/@form-validation/auto-focus.js',
'resources/assets/vendor/libs/datatables-bs5/datatables-bootstrap5.js'
])
@endsection

@section('pageTitle')
<div class="d-flex flex-column">
  <h4 class="mb-1"> 
    <i class="bx bxs-truck mx-2"></i><span class="text-primary fw-bold text-uppercase">{{$fornitore->nome}}</span>
</h4>
<nav aria-label="breadcrumb" style="font-size: smaller;">
            <ol class="breadcrumb breadcrumb-custom-icon m-0">

              <li class="breadcrumb-item text-muted">
                <a href="{{ route('fornitore.index') }}">Fornitori</a>
                <i class="breadcrumb-icon icon-base bx bx-chevron-right align-middle"></i>
              </li>
              <li class="breadcrumb-item active text-primary">
                <a href="{{ route('fornitore.show', ['fornitore_id' => $fornitore->id]) }}">{{ $fornitore->nome }}</a>
              </li>
            </ol>
          </nav>
</div>
@endsection

@section('content')
<style>
  div.upload button:first-child{
    display: none !important;
  }

.bx-chef-hat{
  --svg: url("data:image/svg+xml,%3csvg width='24' height='24' fill='currentColor' viewBox='0 0 24 24' transform='' xmlns='http://www.w3.org/2000/svg'%3e%3c!--Boxicons v3.0.8 https://boxicons.com %7c License https://docs.boxicons.com/free--%3e%3cpath d='M17.13 5.54C16.33 3.42 14.32 2 12 2S7.67 3.42 6.87 5.54A5.506 5.506 0 0 0 2 11c0 2.07 1.18 3.95 3 4.88V18c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-2.12c1.82-.93 3-2.81 3-4.88 0-2.82-2.13-5.15-4.87-5.46m.53 8.75c-.4.14-.67.52-.67.94v1.78H7v-1.78c0-.42-.27-.8-.67-.94-1.4-.5-2.33-1.82-2.33-3.28 0-1.93 1.57-3.5 3.42-3.5.04 0 .14.01.18.02.49 0 .9-.31 1-.78.36-1.61 1.76-2.73 3.41-2.73s3.05 1.12 3.41 2.73c.1.47.51.81 1 .78.06 0 .12 0 .09-.01 1.93 0 3.5 1.57 3.5 3.5 0 1.47-.94 2.79-2.33 3.28ZM5 20h14v2H5z'%3e%3c/path%3e%3c/svg%3e");
}
</style>

@include('_partials.status')

<div class="row justify-content-center">
  <div class="col-xxl mb-4 mt-2">
    <div class="card mb-4">
      <div class="card-body">
        <div class="row mb-2">
          <div class="col-md-4 mb-3">
            <h5 class="fw-bold mb-2 text-primary"><i class="bx bxs-user-detail"></i> Dati Fiscali</h5>
            <ul class="list-unstyled mb-0">
              <li><strong>Partita IVA:</strong> {{ $fornitore->piva ?? '-' }}</li>
              <li><strong>Codice Fiscale:</strong> {{ $fornitore->codice_fiscale ?? '-' }}</li>
            </ul>
          </div>
          <div class="col-md-4 mb-3">
            <h5 class="fw-bold mb-2 text-primary"><i class="bx bx-map"></i> Sede</h5>
            <ul class="list-unstyled mb-0">
              <li> 
                {{ $fornitore->indirizzo ?? '-' }}, <br> {{ $fornitore->citta ?? '-' }} ({{ $fornitore->provincia ?? '-' }}, {{ $fornitore->cap ?? '-' }}) - 
                <small class="text-muted">{{ $fornitore->paese ?? '-' }}</small>
              </li>
            </ul>
          </div>
          <div class="col-md-4 mb-3">
            <h5 class="fw-bold mb-2 text-primary"><i class="bx bx-phone"></i> Contatti</h5>
            <ul class="list-unstyled mb-0">
              <li><strong><i class="bx bx-envelope"></i> </strong> <a href="mailto:{{ $fornitore->email }}">{{ $fornitore->email ?? '-' }}</a></li>
              <li><strong><i class="bx bx-phone"></i> </strong> <a href="tel:{{ $fornitore->telefono }}">{{ $fornitore->telefono ?? '-' }}</a></li>
              <!-- <li><strong>Referente:</strong> {{ $fornitore->referente ?? '-' }}</li> -->
              <!-- <li><strong>Email Referente:</strong> {{ $fornitore->email_referente ?? '-' }}</li> -->
              <!-- <li><strong>Telefono Referente:</strong> {{ $fornitore->telefono_referente ?? '-' }}</li> -->
            </ul>
          </div>
        </div>
   
   
        </div>
    </div>

    <!--  -->

    <div class="card">
        <div class="card-body">
            <h5 class="fw-bold mb-2 text-primary"><i class="bx bx-receipt"></i> Movimenti</h5>
            <table class="table table-bordered table-striped table-responsive">
                <thead>
                    <tr>
                        <!-- <th></th> -->
                        <th>Data</th>
                        <th>Importo</th>
                        <th>Causale</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach($fornitore->prima_nota->sortByDesc('created_at') as $prima_nota)
                    <tr>
                        <td>{{ $prima_nota->created_at->format('d/m/Y') }}</td>
                        <!-- <td>{{ number_format($prima_nota->importo, 2, ',', '.') }}</td> -->
                        <td>{{ view('prima_nota._partials.display', ['oggetto' => $prima_nota->tipo_movimento, 'entity' => $prima_nota]) }}</td>
                        <td>{{ $prima_nota->causale }}</td>
                    </tr>
                    @endforeach
                </tbody>
            </table>
        </div>
    </div>


  </div>
</div>

<div class="modal fade" id="basicModal" tabindex="-1" aria-hidden="true">
            <div class="modal-dialog" role="document">
              <div class="modal-content">
                <div class="modal-header">
                  <h5 class="modal-title" id="exampleModalLabel1">Modal title</h5>
                  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                  <div class="row">
                    <div class="col mb-6">
                      <label for="nameBasic" class="form-label">Name</label>
                      <input type="text" id="nameBasic" class="form-control" placeholder="Enter Name">
                    </div>
                  </div>
                  <div class="row g-6">
                    <div class="col mb-0">
                      <label for="emailBasic" class="form-label">Email</label>
                      <input type="email" id="emailBasic" class="form-control" placeholder="xxxx@xxx.xx">
                    </div>
                    <div class="col mb-0">
                      <label for="dobBasic" class="form-label">DOB</label>
                      <input type="date" id="dobBasic" class="form-control">
                    </div>
                  </div>
                </div>
                <div class="modal-footer">
                  <button type="button" class="btn btn-label-secondary" data-bs-dismiss="modal">Chiudi</button>
                  <!-- <button type="button" class="btn btn-primary">Save changes</button> -->
                </div>
              </div>
            </div>
          </div>

@endsection

@section('page-script')

@endsection
