<?php $__env->startSection('morecss'); ?>
<style>
.messages{font-size:small}
</style>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
<div class="container mt-5">
            <div class="row">
               <div class="col-lg-10 col-sm-12 col-12">
                  <div class="mendas-data">
                     <h4 class="text-center mb-5">Factures <?php if(request()->user): ?> <span class="small">de <?php echo e(\App\User::find(request()->user)->fullname); ?></span> <?php endif; ?> </h4>
					 <form action="<?php echo e(route('factures.index')); ?>" method="get">
					 <?php if(request()->user): ?> <input type="hidden" name="user" value="<?php echo e(request()->user); ?>" /><?php endif; ?>
                     <div class="row mb-5">
                        <div class="col-lg-4 col-sm-4 col-12">
                           <div class="form-group row mb-0">
                              <label class="col-3">
                                 <div class="label-text">
                                    <i class="fas fa-calendar-week mr-1"></i> DU
                                 </div>
                              </label>
                              <div class="col-9">
							  <input type="text" class="calendar form-control" value="<?php echo e(request()->datedeb); ?>" id="datedeb" name="datedeb" placeholder="date debut" aria-label="nom" aria-describedby="basic-addon2">
                                 <hr class="mt-1 mb-1">
                              </div>
                           </div>

                           <div class="form-group row mb-0">
                              <label class="col-3">
                                 <div class="label-text">
                                    <i class="fas fa-calendar-week mr-1"></i> AU
                                 </div>
                              </label>
                              <div class="col-9">
							  <input type="text" class="calendar form-control" value="<?php echo e(request()->datefin); ?>" id="datefin" name="datefin" placeholder="date fin" aria-label="nom" aria-describedby="basic-addon2">
                               </div>
                           </div>
					
                        </div>
                        <div class="col-lg-4 col-sm-4 col-12">
                           <div class="form-group row mb-0">
                              <label class="col-2">
                                 <div class="label-text">
                                    <i class="fas fa-clock"></i>
                                 </div>
                              </label>
                              <div class="col-10">
                                 <input type="checkbox"> Matin&eacute;e
                              </div>
                           </div>

                           <div class="form-group row mb-0">
                              <label class="col-2">
                                 <div class="label-text">
                                    <i class="fas fa-clock"></i>
                                 </div>
                              </label>
                              <div class="col-10">
                                 <input type="checkbox"> Apr&egrave;s-midi
                              </div>
                           </div>

                        </div>

						<div class="col-6 filter_div">
<button class="btn-color filter" type="submit"><i class="fas fa-search"></i> Filtrer</button>
<button onclick="document.getElementById('datedeb').value=document.getElementById('datefin').value='';" class="float-right btn-color cancel" type="submit"><i class="fas fa-window-close"></i> Annuler</button>
                        </div>					
</form>
                     </div>
					 <?php if(session('status')): ?> 
                    <div class="alert alert-success" role="alert">
                        <?php echo e(session('status')); ?>

                    </div>
                <?php endif; ?>
                <?php if($errors->any()): ?>
    				<ul class="alert alert-warning">
    					<?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
				<li><?php echo e($error); ?></li> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
    				</ul>
				<?php endif; ?> 
				<?php if(session()->has('message')): ?>
    				<div class="alert alertToolsBar alert-info alert-dismissible fade show }}"> 
                    <?php echo session('message'); ?>

                    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                      </button>
                    </div>
    			<?php endif; ?>

                     <div class="table-responsive">
                       <table class="table" style="width:100%">
                        <thead>
                           <tr>
                               <th><strong>DATES</strong></th>
							   <?php if(!Auth::user()->isClient()): ?>
                               <th><strong>CLIENT</strong></th>
							   <?php endif; ?>
                               <th><strong>TITRE</strong></th>
                               <th><strong>STATUT</strong></th>
                               <th><strong>Local TTC</strong></th>
                               <th><strong>MONTANT VERSE</strong></th>
                               <th><i class="fas fa-file"></i></th>
                           </tr>
                        </thead>
                        <tbody>
						<?php $__currentLoopData = $demandes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $demande): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                           <tr   <?php if($demande->current_status_id=='PAYEE' && (\Carbon\Carbon::now()->diffInDays($demande->created_at_date_object)<7)): ?> class="table-warning"
			                <?php elseif($demande->current_status_id=='PAYEE'): ?> class="table-danger" 
			                	<?php endif; ?>>
								<td><?php echo e(\Carbon\Carbon::createFromFormat('Y-m-d H:i:s',  $demande->date_facture,'UTC')->timezone('America/Martinique')->formatLocalized('%d/%m/%Y')); ?></td>
			                    <?php if(!Auth::user()->isClient()): ?>
			                    <td><?php echo e($demande->user->fullname); ?></td>
			                    <?php endif; ?> 

                               <td>	<strong><a href="<?php echo e(route('demandes.show',$demande->id)); ?>"><?php echo e($demande->libelle); ?></a></strong></td>
							   <td><?php if($demande->current_status): ?> <?php echo e($demande->current_status->libelle); ?> <?php endif; ?></td>
                               <td><?php echo e(number_format($demande->total_ttc,2,',',' ')); ?></td>
                               <td><?php echo e(number_format($demande->montant_verse,2,',',' ')); ?></td>
                               <td>
							   <?php if(Auth::user()->isAdmin() && $demande->facture): ?>
                        			<a href="<?php echo e(route('demande.voirfacture',$demande->id)); ?>">
										<i class="fas fa-download"></i></a>
										<?php endif; ?>
									</td>
                           </tr>
						   <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                         
                        </tbody>
                     </table>
					 <?php echo e($demandes->links()); ?>

					 <?php if(Auth::user()->isClient()): ?>
                    <h2><a href="<?php echo e(route('demandes.create')); ?>" class="btn btn-warning btn-lg"><i class="fas fa-comment"></i> Faire une demande d'intervention</a></h2>
                    <?php endif; ?>
                     </div>

                     <p><a href="<?php echo e(route('demandes.create')); ?>" class="text-dark"><i class="fas fa-chevron-left mr-2"></i>Retour</a></p>
                  </div>
               </div>
            </div>
            <img src="image/PersonnageMécanicien.png" class="comman-image-all0">
         </div>
	
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\HelloDjo_Source\resources\views/demandes/indexfactures.blade.php ENDPATH**/ ?>