@extends('layout')
@section('title','Transfert  reçus')
@section('description','Tous les transferts reçus ')
@section('content')
<div class="section-header">
            <h1>Tous les transferts reçus </h1>
            <div class="section-header-breadcrumb">
              <div class="breadcrumb-item active"><a href="{{route('nouveau_transfert')}}">Transferts</a></div>
              <div class="breadcrumb-item"><a href="#">Lignes transferts</a></div>
            </div>
          </div>
          <div class="section-body">
		    @if (session('status'))
            <div class="alert alert-warning" style="font-size: 15px; background-color: #328039; color: white">
                <i class="fa fa-check"></i> &nbsp; {{ session('status') }}
            </div>
        @endif

        @if (session('error'))
            <div class="alert alert-danger" style="font-size: 15px; background-color: #fb5757; color: white">
                <i class="ti-na"></i> {{ session('error') }}
            </div>
        @endif
        @if ($errors->any())
            <div class="alert alert-danger" style="font-size: 15px; background-color: #fb5757; color: white" >
                <ul>
                    @foreach ($errors->all() as $error)
                        <li> <i class="ti-na"></i> {{ $error }}</li>
                    @endforeach
                </ul>
            </div>
        @endif
            
          </div>
		  
		  
		   <div class="section-body">
            <div class="row">
              <div class="col-12">
			  <div class="card">
                  <div class="card-header">
                    <h4>Rechercher sur une période</h4>
                  </div>
                  <div class="card-body">
				<form  action="{{route('lignetdepotpost')}}" method="POST">
                         {{csrf_field()}}
				  <div class="row" style="padding-top: 30px">
                     <div class="col-lg-4 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-4 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"> 
                      <button class="btn btn-icon icon-left btn-success"><i class="fas fa-search"></i> Rech</button>
					</div>
                      </div>
					<br><br>	  
					</form>
					</div>	 
                    </div>
					<br/>
					<div class="col-md-12">
					<a  target="_blank"  class="btn btn-icon btn-danger pull-right" href="{{route('lignetpdf')}}"> <i class="fa fa-print"></i> Imprimer état</a>
					<br/>
					<br/>
					</div>
					<br/>
					@php
					$db= explode('-', session('date_debut'));
					$db= array_reverse($db);
					$db= implode('/', $db);
					
					$df= explode('-', session('date_fin'));
					$df= array_reverse($df);
					$df= implode('/', $df);
					@endphp
					
                <div class="card">
                  <div class="card-header">
                    <h4>Lignes de tous les transferts reçus au dépôt . Période : @php if ($db == $df){ echo $db;} else { echo $db." - ".$df; } @endphp</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">Désignation</th>
							<th class="text-center">Quantité</th>
							<th class="text-center">Etat</th>
                          </tr>
                        </thead>
                        <tbody>
						@foreach($ligne as $lignes)
                          <tr>
							<td style="text-align:center;">{{$loop->iteration}}</td>
							
							<td style="text-align:center;"> {{ DB::table('produit_vendable')->where('id', $lignes->produit_id)->first()->desi }} 
							 {{ DB::table('produit_vendable')->where('id', $lignes->produit_id)->first()->code }}  {{ DB::table('produit_vendable')->where('id', $lignes->produit_id)->first()->marque }}
							</td>
							
							<td style="text-align:center;">{{$lignes->qte}}</td>
							
							 <td class="text-center">
							    @if( $lignes->etat ==  "En cours")
									
                                  <div class="badge badge-warning badge-shadow">{{$lignes->etat}}</div>
							    @else
                                      <div class="badge badge-success badge-shadow">{{$lignes->etat}}</div>
                                @endif
								  
                            </td>
		
                          </tr>
						  @endforeach
                        </tbody>
                      </table>
                    </div>
                  </div>
                </div>
              </div>
            </div>
           
           
          </div>
		  
             
            </div>
          </div>
		  
	   @push('scripts') 
	   
	   
@endpush

@endsection