<?php $__env->startSection('morejs'); ?>
<script type="text/javascript">

function removeAdresse(adrId,adrName){
	if (document.getElementById(adrId).checked==true)
		alert("impossible de supprimer l'adresse par défaut")
	else
	if (confirm("Cette adresse sera supprimée lors de l'enregistrement. Confirmer ?")){
		document.getElementById('adr_'+adrId).innerHTML = '<span class="text-warning">'+adrName + ' à supprimer</span>';
		document.getElementById('s_'+adrId).value=adrId;
	}
}
//
</script>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('morecss'); ?>
<style>
.flex-item{width:120px}
</style>
<?php $__env->stopSection(); ?> 
<?php $__env->startSection('content'); ?>
<div class="container">
	<div class="justify-content-center">
		<div class="">
			<div class="card">
				<div class="card-header">
					<?php if(Auth::id()==$user->id): ?>
							<h1>Mon compte</h1>
							<?php else: ?>
							<h1><?php echo e($user->full_name); ?></h1>
							<?php endif; ?>
							
				</div>
				<div class="card-body">
					<?php if($user->prestataire): ?>
					<p>&Eacute;valuation moyenne : <?php echo e($scoring_calcule); ?></p>
					<?php endif; ?>
						<?php if(Auth::id()==$user->id): ?>
						<h2>Mes informations</h2>
						<?php else: ?>
						<h2>Informations</h2>
						<?php endif; ?>
						<p><?php echo e($user->fullname); ?> (<?php echo e($user->email); ?>)</p>
						<h4 class="text-secondary">Téléphone : <?php echo e($user->telephone); ?></h4>
						<?php if($user->isClient() && $user->societe): ?>
							<h2><i class="fas fa-building"></i> Mon entreprise</h2>
							<p><?php echo e($user->societe); ?></p>
							<p><?php echo e($user->siret); ?></p>
							<h2>Mes adresses</h2>
							<?php if(count($adresses) > 0): ?>
								<div class="d-flex flex-row flex-wrap align-content-around form-group row col-12">
									<?php $__currentLoopData = $adresses; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $adresse): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                	<a class="px-1 py-0 btn btn-primary" href="<?php echo e(route('adresses.edit',$adresse->id)); ?>" ><?php echo e($adresse->libelle); ?>

                                      <i class="fas fa-edit"></i></a>
									<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
								</div>
							<?php endif; ?>
						<?php endif; ?>
						<?php if(Auth::user()->isAdmin() && Auth::id()==$user->id ): ?>
						
    					<h2>Mon entreprise</h2>
							<p>Raison sociale : <?php echo e($societe->raison_sociale); ?><br/>
							Siret : <?php echo e($societe->siret); ?>

							</p>
						<?php endif; ?>
						<h3>Adresses</h4><?php $__currentLoopData = $user->adresses; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $adresse): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
						<h4 class="small font-weight-bold"><?php echo e($adresse->adresse); ?> - <?php echo e($adresse->commune->nom); ?></h4>
						<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
						<a class="btn btn-info mb-4" href="<?php echo e(route('users.edit',$user->id)); ?>">Modifier <?php echo e($user->fullname); ?></a>
						<?php if(count($demandes) >0): ?>
    						<h2>Demandes</h2>
    						<table class="table">
    				        <thead>
    				            <tr>
    				               <th>Date</th>
    				                <th>Titre</th>
    				                <th>Statut</th>
    				                <?php if(!Auth::user()->isClient()): ?>
    				                <th>Auteur</th>
    				                <?php endif; ?>
    				                <th>Messages</th>
    				        </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($demande->created_at_date); ?> à <?php echo e($demande->created_at_time); ?></td>
    			                    <td class="text-primary">
    			                    	<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>
    			                    <?php if(!Auth::user()->isClient()): ?>
    			                    <td><?php echo e($demande->user->fullname); ?></td>
    			                    <?php endif; ?> 
                        			<td>
                        			<?php if(count($demande->messages)): ?> 
                        				<a class="dropdown-toggle" data-toggle="dropdown" href="#"><?php echo e(count($demande->messages)); ?> messages dont <?php echo e(count($demande->messages->where('lu','=',null))); ?> non lus
                        				<span class="caret"></span></a>
                                		<div class="dropdown-menu messages">
                                    	<?php $__currentLoopData = $demande->messages->where('lu','=',null); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $message): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                							<a class="dropdown-item" href="<?php echo e(route('demandes.show',$demande->id)); ?>#<?php echo e($message->id); ?>">le <?php echo e($message->created_at_date); ?> à <?php echo e($message->created_at_time); ?> par <?php echo e($message->user->fullname); ?></a>
                                    	<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            	    	</div>
                                	
                                	<?php endif; ?>
                                			</td> 
            			                </tr>
            			            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
    				        </tbody>
    				    </table>
                    	
                    	<a href="<?php echo e(route('demandes.index')); ?>?user=<?php echo e($user->id); ?>">Voir toutes les demandes</a>
                    	<div>
        					<a href="<?php echo e(route('factures.index')); ?>?user=<?php echo e($user->id); ?>">
        					<i class="fas fa-file-alt"></i>
        					Factures
        					</a>
        				</div>
                				
                    	<?php endif; ?>
				</div>
				<div class="card-footer">
					<a href="javascript:history.back()" class="btn btn-info">Retour</a>
				</div>
			</div>
		</div>
	</div>
</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/users/show.blade.php ENDPATH**/ ?>