@extends('layout')
@section('title','Détails de la proforma ')
@section('content')
<br/>
		  <div class="section-body">
            <div class="row">
              <div class="col-12">
                <div class="card">
                  <div class="card-header">
                    <h4>Détails</h4>
                  </div>
                  <div class="card-body">
                    <div class="table-responsive">
                      <table class="table table-striped" id="table-1">
                        <thead>
                          <tr>
                            <th class="text-center"> N° </th>
                            <th class="text-center">Produit</th>
                            <th class="text-center">Quantité</th>
							 <th class="text-center">Prix unitaire</th>
							  <th class="text-center">Montant total</th>
							   <th class="text-center">Actions</th>
                   
                          </tr>
                        </thead>
                        <tbody>
	@foreach($detail as $details)
	<tr>
		<td>
        {{$loop->iteration}}
        </td>
        <td>
        {{ DB::table('produit_vendable')->where('id', $details->produit_id)->first()->desi }}
        </td>
        @php
		$lh = $details->pv;
		$lh1 =  number_format($lh, 0, ' ', ' ');

        $lh2 = $details->montligne;
		$lh2 =  number_format($lh2, 0, ' ', ' ');

		@endphp
        <td style="text-align:center;font-size:14px;">
               {{$details->qte}}
		</td>
        <td style="text-align:center;font-size:14px;">
           {{ $lh1 }} F
		</td>
		<td style="text-align:center;font-size:14px;">
             {{$lh2}} F
        </td>
		<td style="text-align:center">
		
		</td>
    </tr>
	@endforeach
    </tbody>
                      </table>
                    </div>
                  </div>
                </div>
              </div>
			 <a type="button" href="{{route('proforma')}}" data-toggle="tooltip"
                                            data-placement="bottom" title="Retour"
                                            class="btn btn-icon btn-warning" style="margin-left:15px;">RETOURNER</a>
            </div>
           
           
          </div>
		  
		 </div>
           
           
          </div>
		  
		     <div class="modal fade" id="Supprimermodal" >
          <div class="modal-dialog" role="document">
            <div class="modal-content">
              <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel">Suppression</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
              </div>
              <div class="modal-body">
                Voulez-vous vraiment supprimer ce détail vente ?
              </div>
              <div class="modal-footer bg-whitesmoke br" style="background-color:#ffffff" id="delete">
                
              </div>
            </div>
          </div>
        </div>
		  
		
		
		  
 @push('scripts') 
 
   <script>
        $(".data-supprimer").on('click', function () {
                var id=$(this).data('id');
                $.get(location.origin+'/es/Detailvente/'+id, function (data) {
                  var html = `
            <button type="button" class=" btn btn-danger" data-dismiss="modal">Non</button>
                      <form action="{{route('SupprimerdetailPost')}}" method="post" style="display: inline">
                        {{csrf_field()}}
                      <input type="hidden" value="`+data.detailvente.id+`" name="id" >
                      <button type="submit" class="btn btn-success">Oui</button>

            </form>`
            ;
            $('#delete').html('').append(html);
          })
          $('#Supprimermodal').modal();
        });
    </script>
	   
	  
@endpush

@endsection