@extends('layouts.app')
@section('morecss')
<style>
.highlight{background:rgba(255,125 ,125,0.2); padding:0.5em;border:solid rgba(255,125 ,125,0.2) 1px}
.highlight{background:rgba(255,125 ,125,0.2); padding:0.5em;border:solid rgba(255,125 ,125,0.2) 1px}
.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:#ff9966;
    margin-bottom:0;
    border-radius:0 5px 10px 5px;
    box-shadow: 3px 3px 5px 1px rgba(100,100,100, .2);
}
.message p.mesmessages{
    background-color: #ffcc66;
}
.message p.admrapport{background-color:red;color:white}

.message strong{font-weight:400}
.form-control-file{border-bottom:1px solid #ddd;padding-bottom:0.5em;margin-bottom:0.5em}
.reponse{padding:0.5em;background-color:#efefef;background-image: linear-gradient(to top left, #ffcc66 20%, #f1f1f1 100%);
border-radius:0 5px 10px 5px;
    box-shadow: 1px 2px 7px 5px rgba(100,100,100, .2);margin-bottom:2em}
.devis{background:#FBE3FF;margin:-1.25rem -1.25rem 0 -1.25rem;padding:1.25rem}
.devis .table{background-color:#fff}
.devis .table p{padding: .75rem;}
.devis .table th, .devis .table td{text-align:right}
#scoring i{color:#ddd;}
.txt-center {
    text-align: -webkit-center;
}
#scoring p{padding:0;margin:1em 0 0 0;font-size:small;font-weight:600;color:#999}
</style>
{{--<link rel="stylesheet" href="{{asset('signature_pad-master/docs/css/signature-pad.css')}}">--}}
<link href="{{asset('signature-pad-master-smooth/assets/jquery.signaturepad.css')}}" rel="stylesheet">
<style>
.sigPad{width:300px;height:200px}
.sigPad input{width:300px;}

.sigWrapper{height:157px}
canvas, .sigPad, .sigWrapper{border-radius:0.25em}
.debug a{font-size:small;color:red;font-weight:600;margin:0;padding:0;display:block}
</style>
@endsection

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-10">
            <div class="card">
                <div class="card-header">
                    <div class="@if ($demande->current_status_id=='LIVREE' || $demande->current_status_id=='SOLDEE') row @endif">
                    	<div class="@if ($demande->current_status_id=='LIVREE' || $demande->current_status_id=='SOLDEE') col-8 @endif">
                    		<h1>Devis {{$demande->user->fullname}}</h1>
                    		<h2 class="small">Demande lancée par <em>{{$demande->user->fullname}}</em> le {{$demande->created_at_date}} à {{$demande->created_at_time}} </h2>
                    	</div>
                    	
                    </div>
                    
                </div>
				@if (session('status'))
                    <div class="alert alert-success" role="alert">
                        {{ session('status') }}
                    </div>
                @endif
                @if ($errors->any())
    				<ul class="alert alert-warning">
    					@foreach ($errors->all() as $error)
    					<li>{{$error}}</li> @endforeach
    				</ul>
    				@endif 
    				@if(session()->has('message'))
    				<div class="alert alertToolsBar alert-info alert-dismissible fade show }}"> 
                    {!! session('message') !!}
                    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                      </button>
                    </div>
    			@endif
						
                <div class="card-body">
                 	<div id="devis" class="devis mb-3">
               			@if ($demande->statuts()->find('EN_PAIEMENT'))
    						<p>Le paiement n'a pas abouti.
    						</p>
    						@endif
    						<div class="table">
        						<table class="table">
        							<p class="small">{!!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>
        								@foreach ($ligne_demandes as $ligne_demande)
        								<tr>
        									<td class="text-left">{{$ligne_demande['libelle']}}</td>
        									<td>{{number_format($ligne_demande['montant_ht'],2,',',' ')}}</td>
        									<td>{{$ligne_demande['taux_tva']}}%</td>
        									<td>{{number_format($ligne_demande['montant_tva'],2,',',' ')}}</td>
        									<td>{{number_format($ligne_demande['montant_ttc'],2,',',' ')}}</td>
    									</tr>
    									@endforeach
    									<tr>
    									<td>Total HT</td><td>{{number_format($totalDemandeHT,2,',',' ')}}</td><td></td><td><strong>Total TTC</strong></td><td><strong>{{number_format($totalDemandeTTC,2,',',' ')}}</strong></td>
    									</tr>
    									<tr>
    									<td>Acompte </td><td>{{$demande->pcent_acompte}} %</td><td></td><td><strong>Acompte à régler</strong></td><td><strong>{{number_format($demande->montant_acompte,2,',',' ')}}</strong></td>
    									</tr>
        							</tbody>
        						</table>
    						</div>
    						
                   </div>
            </div>
            <div class="card-footer">
				<a href="javascript:history.back()" class="btn btn-info">Retour</a>
			</div>
        </div>
    </div>
</div>
@endsection