@extends('layout')
@section('title','Détail mouvement magasin produit ')
@section('description','Détail mouvement magasin produit')
@section('content')
			<br/>
          <div class="section-body">
		  <br/>
			<div class="row">
              <div class="col-12">
			  <div class="card">
			  @php @endphp
                  <div class="card-header">
                    <h4>Recherche</h4>
                  </div>
                  <div class="card-body">
				<form  action="{{route('mouvementproduitPost')}}" method="POST">
                         {{csrf_field()}}
				  <div class="row" style="padding-top: 30px">
                     <div class="col-lg-5 col-md-12"> 
					  <div class="form-group">
                      <label>Date début <font color="red">*</font></label>
                      <input type="text" class="form-control" name="date_debut" id="champ_date" required>
					  <div id="calendarMain"></div>
                    </div>
					</div>
					<div class="col-lg-5 col-md-12"> 
					  <div class="form-group">
                      <label>Date fin <font color="red">*</font></label>
                      <input type="text" class="form-control" name="date_fin" id="champ_date2" required>
					  <div id="calendarMain2"></div>
                    </div>
					</div>
					<div class="col-lg-2 col-md-12" style="margin-top:26px;"> 
                      <button class="btn btn-icon icon-left btn-success"><i class="fas fa-search"></i> Rech</button>
					</div>
                      </div>
					<br><br>	  
				</form>
					  
					    </div>
						 
                    </div>
                <div class="card">
                  <div class="card-header">
                    <h4>Détail mouvement magasin produit du 
					@if ($date_debut == $date_fin)
						{{$date_debut}}
					@else
					{{$date_debut}} au {{$date_fin}}
					@endif
					</h4>
                  </div>
                  <div class="card-body">
                    <div class="table-responsive">
                      <table class="table table-striped" id="table-1">
                        <thead>
                          <tr>
							<th style="text-align:center;">N°</th>
							<th style="text-align:center;">Date</th>
							<th style="text-align:center;">Produit</th>
							<th style="text-align:center;">Type opération</th>
							<th style="text-align:center;">Dépôt</th>
							<th style="text-align:center;">En stock avant</th>
							<th style="text-align:center;">Quantité</th>
							<th style="text-align:center;">En stock après</th>
						</tr>
                        </thead>
                        <tbody>
	@foreach($detail as $details)
	<tr>
		<td>
        {{$loop->iteration}}
        </td>
		<td>
        {{$details->date}}
        </td>
        <td>
        {{ DB::table('produit_vendable')->where('id', $details->produit_id)->first()->desi }}
        </td>
		<td style="text-align:center;font-size:17px;">
           {{$details->type_operation}}
		</td>
		<td style="text-align:center;font-size:14px;">
           {{DB::table('depot')->where('id', $details->depot_id)->first()->nom}}
		</td>
		<td style="text-align:center;font-size:17px;">
           {{$details->en_stock}}
		</td>
		<td style="text-align:center;font-size:17px;">
           {{$details->qte}}
		</td>
		<td style="text-align:center;font-size:17px;">
           {{$details->apres}}
		</td>
    </tr>
	@endforeach
    </tbody>
                      </table>
                    </div>
                  </div>
                </div>
				<p align="center">
					<a type="button" target="_blank" href="{{route('mouvementproduitPDF')}}" class="btn btn-icon btn-warning"><i class="fas fa-print"></i> Imprimer</a>	
				</p>
              </div>
            </div>
          </div>
		<div class="modal fade bd-example-modal-sm" id="Validermodal">
			<div class="modal-dialog modal-sm">
				<div class="modal-content">
					<div class="modal-body">
						<p>Voulez-vous valider la facture ?</p>
					</div>
					<div class="modal-footer" style="background-color:#ffffff" id="valider">

					</div>
				</div>
			</div>
		</div>
        <div class="modal fade bd-example-modal-sm" id="Annulermodal">
			<div class="modal-dialog modal-sm">
				<div class="modal-content">
					<div class="modal-body">
						<p>Etes-vous sûr d'annuler cette facture ?</p>
					</div>
					<div class="modal-footer" style="background-color:#ffffff" id="annuler">

					</div>
				</div>
			</div>
		</div>
		<div class="modal fade bd-example-modal-sm" id="Supprimermodal">
			<div class="modal-dialog modal-sm">
				<div class="modal-content">
					<div class="modal-body">
						<p>Etes-vous sûr de supprimer cette facture ?</p>
					</div>
					<div class="modal-footer" style="background-color:#ffffff" id="supprimer">

					</div>
				</div>
			</div>
		</div>

@endsection