@extends('layout')
@section('title','Billetage ')
@section('description','Billetage')
@section('content')
			<br/>
          <div class="section-body">
		  <div class="row">
              <div class="col-12">
			  <br/>
			  @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>
			<div class="row">
              <div class="col-12">
			  <div class="card">
                  <div class="card-header">
                    <h4>Rechercher facture client pour une période</h4>
                  </div>
                  <div class="card-body">
				<form  action="{{route('billetage-recherche')}}" 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>
                <div class="card">
                  <div class="card-header">
                    <h4>Billetage</h4>
                  </div>
                  <div class="card-body">
                    <div class="table-responsive">
                      <table class="table table-striped" id="table-1">
                        <thead>
                          <tr>
                            <th>N°</th>
                            <th>Billet</th>
                            <th>Nombre</th>
                            <th>Montant total</th>
                          </tr>
                        </thead>
                        <tbody>
						@foreach($billetage as $billetage)
						@php
						$lh1 =  number_format($billetage->montligne, 0, ' ', ' ');
						@endphp
                          <tr>
							<td style="text-align:center;">{{$loop->iteration}}</td>
							<td style="text-align:center;">{{$billetage->billet}}</td>
							<td style="text-align:center;">{{$billetage->nbre}}</td>
							<td style="text-align:center;">{{$lh1}}</td>
                          </tr>
						@endforeach
                        </tbody>
						<tr>
							<td></td>
							<td></td>
							@php
							$total1 =  number_format($total, 0, ' ', ' ');
							@endphp
							<td style="text-align:center"> <b>Total<b> </td>
							<td colspan="1" style="text-align:center"> <b>{{$total1}} F</b> </td>
						</tr>
                      </table>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
          </div>
		
@endsection