<html>
<head>
<style>
body{font-family:sans-serif,arial;font-size:10pt}
table{border-collapse:collapse;/*page-break-inside: avoid;*/}
div.table{page-break-inside: avoid;}
th,td{border:solid gray 1px;padding:5pt;vertical-align:top}
.nopagebreakinside{page-break-inside: avoid;}
div.page_break + div.page_break{
  page-break-before: always;
}
.cond8pt{font-size:9pt;}
.table-noborder{border:0}
.table-noborder>td{border:0;text-align:left;}
.table-border td{border:solid #666 1px}
/*.table-noborder td{border:solid #999 1px}*/
table{border-color:#666}
table td{border-color:#666}
table.2col50 td,table.2col50 th{width:50%}
table.3col33 td,table.3col33 th{width:33.33333%}
/*
.message h4{
    font-size:small;
    font-weight:300;
    margin-bottom:0;
}*/
.message{margin-bottom:1em;
           }
.message p{
    border:solid 1px #ddd;
    padding:0.5em;
    background-color:#ffffff;
    margin-bottom:0;
    border-radius: 5px;
}
.messages .message p{
    border:solid 1px #ddd;
    padding:0.5em;
    background-color:#FFF1C9;
    margin-bottom:0;
    border-radius: 5px;
}
.message p.mesmessages{
    background-color: #A1CCBF;
    
}
.rapport{background-color: #FFF1C9;padding:1em}
.message strong{font-weight:400}
h1{color:#666}
h2{padding:1em 0 0.5em 0;border-bottom: dotted gray 1px;margin:1em 0 0 0.25em}
.card-header{border-bottom:1px solid #ddd}
footer { position: fixed; bottom: -60px; left: 0px; right: 0px; font-size:9pt;text-align:center; height: 50px; }

</style>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">
                    <div>
                    	<div>
                    		<h1>Rapport <strong><em><?php echo e($demande->libelle); ?></em></strong></h1>
                    		<h3 class="small">Client : <em><?php echo e($demande->user->fullname); ?></em><br/>le <?php echo e($demande->created_at_date); ?> à <?php echo e($demande->created_at_time); ?> </h3>
                    	</div>
                    </div>
                </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="card-body">
                	<div class="rapport">
                    	<h2>Rapport Le Prisme</h2>
                        <?php $__currentLoopData = $demande->messages->where('rapport_flag','=','1'); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $message): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        	<div
                        		id="<?php echo e($message->id); ?>"
                        		class="message">
                        	<h4>le <?php echo e($message->created_at_date); ?> à <?php echo e($message->created_at_time); ?>

                        	<strong><?php echo e($message->user->fullname); ?></strong> a écrit :
                        	</h4><p><?php echo nl2br($message->text); ?></p>
                        	<?php if(count($message->documents)): ?>
                        	<div style="padding-top:15pt">
                        	<?php echo e(count($message->documents)); ?> fichier(s)
                        	<?php $__currentLoopData = $message->documents; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $document): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        		<?php if(in_array($document->type_mime,['png','jpeg','jpg','gif'])): ?>
                        		<img src="<?php echo e(storage_path('/app/documents/'.$document->nom_fichier)); ?>" width="200" style="margin-top:5px"/>
                        		<?php else: ?>
                        		<a href="<?php echo e(route('voirdocument',$document->id)); ?>"><i class="fas fa-image"></i><small><?php echo e($document->libelle); ?></small></a>
                        		<?php endif; ?>
                        		
                        	<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        	</div>
                        	<?php endif; ?>
                        	</div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </div>
                	<div class="messages">
                	
                    	<h2>Historique des statuts</h2>
                        <?php $__currentLoopData = $demande->statuts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $demande_statut): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        	<div
                        		id="<?php echo e($demande_statut->id); ?>"
                        		class="message">
                        	<h4>le <?php echo e($demande_statut->pivot->created_at); ?>

                        	<strong><?php echo e($demande_statut->libelle); ?></strong>
                        	</div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </div>
                 	<div class="messages">
                    	<h2>Messages</h2>
                        <?php $__currentLoopData = $demande->messages->where('rapport_flag', null); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $message): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        	<div
                        		id="<?php echo e($message->id); ?>"
                        		class="message">
                        	<h4>le <?php echo e($message->created_at_date); ?> à <?php echo e($message->created_at_time); ?>

                        	<strong><?php echo e($message->user->fullname); ?></strong> a écrit :
                        	</h4><p <?php if($message->user_id == Auth::id()): ?> class="mesmessages" <?php endif; ?>><?php echo nl2br($message->text); ?></p>
                        	<?php if(count($message->documents)): ?>
                        	<div style="padding-top:15pt">
                        	<?php echo e(count($message->documents)); ?> fichier(s)
                        	<?php $__currentLoopData = $message->documents; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $document): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        		<?php if(in_array($document->type_mime,['png','jpeg','jpg','gif'])): ?>
                        		<img src="<?php echo e(storage_path('/app/documents/'.$document->nom_fichier)); ?>" width="200" style="margin-top:5px"/>
                        		<?php else: ?>
                        		<a href="<?php echo e(route('voirdocument',$document->id)); ?>"><i class="fas fa-image"></i><small><?php echo e($document->libelle); ?></small></a>
                        		<?php endif; ?>
                        		
                        	<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        	</div>
                        	<?php endif; ?>
                        	</div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </div>
                    
					<?php if($demande->intervention): ?>
						<h2><i class="fas fa-tools"></i> Devis intervention</h2>
    					<!-- foreach($demande->interventions as $intervention) -->
    					<p><em><a href="<?php echo e(route('interventions.show',$demande->intervention->id)); ?>"><?php echo e($demande->intervention->descriptif); ?></a></em> par <a href="<?php echo e(route('users.show',$demande->intervention->user_id)); ?>"><?php echo e($demande->intervention->user->fullname); ?></a></p>
    					<?php if(Auth::user()->assistant): ?>
        					<?php if($demande->statuts->last()->id =='BPA'): ?>
        						<p class="mb-0 text-success"><i class="fas fa-check"></i>Le client a accepté le devis</p><p><a class="mt-0 btn btn-success" href="<?php echo e(route('demandes.validerbpa',$demande->id)); ?>"><i class="fas fa-check-double"></i>Valider le bon pour accord du client</a></p>
        					<?php else: ?>
        						<p><a href="<?php echo e(route('interventions.edit',$demande->intervention->id)); ?>">Modifier <?php echo e($demande->intervention->descriptif); ?></a></p>
    						<?php endif; ?>
    					<?php endif; ?>
    					<!-- endforeach -->
    					<?php if(Auth::id() == $demande->user_id && $demande->intervention && $demande->statuts()->find('PAYEE')): ?>
					<div class="devis mb-3">
               				<div class="table">
        						<table class="table">
        							<p class="small"><?php echo nl2br($demande->intervention->descriptif); ?></p>
        							<thead>
        								<tr>
        									<th class="text-left">Designation</th>
        									<th>puht</th>
        									<th>taux</th>
        									<th>tva</th>
        									<th>Montant ttc</th>
    									</tr>
        							</thead>
        							<tbody>
        								<?php $__currentLoopData = $ligne_demandes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ligne_demande): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        								<tr>
        									<td class="text-left"><?php echo e($ligne_demande['libelle']); ?></td>
        									<td><?php echo e(number_format($ligne_demande['montant_ht'],2,',',' ')); ?></td>
        									<td><?php echo e($ligne_demande['taux_tva']); ?>%</td>
        									<td><?php echo e(number_format($ligne_demande['montant_tva'],2,',',' ')); ?></td>
        									<td><?php echo e(number_format($ligne_demande['montant_ttc'],2,',',' ')); ?></td>
    									</tr>
    									<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
    									<tr>
    									<td>Total HT</td><td><?php echo e(number_format($totalDemandeHT,2,',',' ')); ?></td><td></td><td><strong>Total ttc</strong></td><td><strong><?php echo e(number_format($totalDemandeTTC,2,',',' ')); ?></strong></td>
    									</tr>
    									<tr>
    									<td>Acompte </td><td><?php echo e($demande->pcent_acompte); ?> %</td><td></td><td><strong>Acompte à régler</strong></td><td><strong><?php echo e(number_format($demande->montant_acompte,2,',',' ')); ?></strong></td>
    									</tr>
        							</tbody>
        						</table>
    						</div>
                   </div>
                 	<?php endif; ?>
						<?php endif; ?>
                </div>
            </div>
        </div>
    </div>
</div>
</table><?php /**PATH C:\xampp\htdocs\leprisme_travaux\resources\views/demandes/showRapportPDF.blade.php ENDPATH**/ ?>