<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
</head>

<body>
    <style>
    *{
        font-size:14px;
    }
    table{
        border:1px solid gray;
    }
        .page-break {
            page-break-after: always;
        }

        .logo {
            position: fixed;
        }
    </style>

    <img src="img/amea2.png" alt="" alt="Logo" class="logo"
        style="height: auto; width: 150px;margin-top:-40px">
    <div style="margin-top:34px">
        <table style="width: 100%;">
            <tbody>
                <tr>
                    <th colspan="6" style="background: rgb(184, 223, 245); font-size:18px;">
                        FICHE DE FIN TRAVAUX
                    </th>
                </tr>
                <tr>
                    <td style="width: 16,66%">
                        Date de publication:
                    </td>
                    <td style="width: 16,66%">
                        {{ date('d-m-Y', strtotime($now)) }}
                    </td>
                    <td style="width: 16,66%">
                        Garagiste :
                    </td>
                    <td style="width: 16,66%">
                        {{ $dossier->garage->libelle ?? null }}
                    </td>
                    <td style="width: 16,66%">
                        Expert :
                    </td>
                    <td style="width: 16,66%">
                        AMEA
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
    <div style="margin-top:10px;">
        <table style="width:100%;">
            <thead>
                <tr>
                    <th colspan="6" style="background: rgb(184, 223, 245) ; text-align: left;font-size:16px;">
                        PARTIE ASSURE
                    </th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td style="width: 18%">
                        Nom :
                    </td>
                    <td style="width: 20%">
                        {{ $dossier->insured->name ?? null }}
                    </td>
                    <td style="width: 18%">
                        Souscripteur :
                    </td>
                    <td style="width: 20%">
                        {{ $dossier->company->company ?? null }}
                    </td>
                    <td style="width: 18%">
                        Police :
                    </td>
                    <td style="width: 20%">
                        {{ $dossier->numero_police }}
                    </td>
                </tr>
                <tr>
                    <td style="width: 18%">
                        Intermidiaire :
                    </td>
                    <td style="width: 20%">
                        {{ $dossier->intermidiaire->company ?? null }}
                    </td>
                    <td style="width: 18%">
                        Matricule :
                    </td>
                    <td style="width: 20%">
                        {{ $dossier->matricule ?? $dossier->new_matricule }}

                    </td>
                  
                     <td style="width: 18%">
                        Ville :
                    </td>
                    <td style="width: 20%">
                        {{ $dossier->city->city ?? null }}
                    </td>
                </tr>
                <tr>
                    <td style="width: 18%">
                        Date du sinistre:
                    </td>
                    <td style="width: 20%">
                        {{ $dossier->date_sinistre ?? null }}
                    </td>
                    <td style="width: 18%">
                        Date MEC :
                    </td>
                    <td style="width: 20%">
                        {{ $dossier->date_circulation ?? null }}

                    </td>
                    <td style="width: 18%">
                        Valeur à neuf:
                    </td>
                    <td style="width: 20%">
                        {{ $dossier->valeurneuf ?? null }}

                    </td>
                </tr>
                <tr>
                    {{-- --}}
                   
                    <td style="width: 18%">
                        Numero chassis :
                    </td>
                    <td style="width: 20%">
                        {{ $dossier->numero_chassis ?? null }}

                    </td>
                       <td style="width: 18%">
                       
                    </td>
                    <td style="width: 20%">

                    </td>
                    <td style="width: 18%">
                        Véhicule :
                    </td>
                    <td style="width: 20%">
                        {{ $dossier->vehiculemodel->brand->brand ?? null }}/
                        {{ $dossier->vehiculemodel->name ?? null }}

                    </td>
                </tr>
            </tbody>
        </table>
    </div>
    <div style="margin-top:10px;">
        <table style="width:100%;">
            <thead>
                <tr>
                    <th colspan="6" style="background: rgb(184, 223, 245) ; text-align: left;font-size:16px;">
                        PARTIE ADVERSAIRE
                    </th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td style="width: 25%">
                        Adversaire :
                    </td>
                    <td style="width: 25%">
                        {{ $dossier->opponent->civility ?? null }}
                        {{ $dossier->opponent->name ?? null }}
                    </td>
                    <td style="width: 25%">
                        Companie adversaire :
                    </td>
                    <td style="width: 25%">
                        {{ $dossier->opponent->company->company ?? null }}

                    </td>

                </tr>
                <tr>
                    <td style="width: 25%">
                        Matricule :
                    </td>
                    <td style="width: 25%">
                        {{ $dossier->opponent->matricule ?? null }}

                    </td>
                    <td style="width: 25%">
                        Police adversaire :
                    </td>
                    <td style="width: 25%">
                        {{ $dossier->opponent->numero_attestation ?? null }}

                    </td>

                </tr>
            </tbody>
        </table>
    </div>
    <div style="margin-top:10px;">
        <table style="width:100%;">
            <thead>
                <tr>
                    <th colspan="6" style="background: rgb(184, 223, 245) ; text-align: left;font-size:16px;">
                        INFORMATION
                    </th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td style="width: 18%">
                        Type dossier :
                    </td>
                    <td style="width: 20%">
                        {{ $dossier->typeexpertise->type ?? null }}

                    </td>
                    <td style="width: 18%">
                        Procédure :
                    </td>
                    <td style="width: 20%">
                        {{ $dossier->mode->mode ?? null }}

                    </td>
                    <td style="width: 18%">
                        N° sinistre :
                    </td>
                    <td style="width: 20%">
                        {{ $dossier->numero_sinistre ?? null }}
                    </td>
                </tr>
                <tr>

                    <td style="width: 18%">
                        Garanties :
                    </td>
                    <td style="width: 20%">
                        {{ $dossier->guarantee->guarantee ?? null }}

                    </td>
                    <td style="width: 18%">
                        Taux RP :
                    </td>
                    <td style="width: 20%">
                        {{ $dossier->guarantee->tauxRP ?? null }}
                    </td>
                    <!--<td style="width: 18%">-->
                    <!--    Calcule HT :-->
                    <!--</td>-->
                    <!--<td style="width: 20%">-->
                    <!--        {{ number_format($ttl-$tva, 2, '.', ',') }} {{ $dossier->currency->symbole ?? null }}-->

                    <!--</td>-->
                </tr>

            </tbody>
        </table>
    </div>
    <div style="margin-top:10px;">
        <table style="width:100%;">
            <thead>
                <tr>
                    <th colspan="6" style="background: rgb(184, 223, 245) ; text-align: left;font-size:16px;">
                        GARAGISTE
                    </th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td style="width: 25%">
                        Garage :
                    </td>
                    <td style="width: 25%">
                        {{ $dossier->garage->libelle ?? null }}

                    </td>
                    <td style="width: 25%">
                        N° de mission :
                    </td>
                    <td style="width: 25%">
                        {{ $dossier->ref ?? null }}
                    </td>

                </tr>
                <tr>
                    <td style="width: 25%">
                        Date de publication facture :
                    </td>
                    <td style="width: 25%">
                        {{ $now ?? null }}
                    </td>
                    <td style="width: 25%">
                        Montant facture TTc :
                    </td>
                    <td style="width: 25%">
                        {{ $facture->montant_facture ?? null }} {{ $dossier->currency->symbole ?? null }}

                    </td>
                    {{-- <td style="width: 16,66%">
                        Date de dépot de véhicule :
                    </td>
                    <td style="width: 16,66%">

                    </td> --}}
                </tr>
            </tbody>
        </table>
    </div>
    <div style="margin-top:10px;">
        <table style="width:100%;">
            <thead>
                <tr>
                    <th colspan="6" style="background: rgb(184, 223, 245) ; text-align: left;font-size:16px;">
                        EXPERT
                    </th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td style="width: 16,66%">
                        Expert :
                    </td>
                    <td style="width: 16,66%">
                        AMEA
                    </td>
                    <td style="width: 16,66%">
                        validation facture TTC :
                    </td>
                    <td style="width: 20,66%">

                    </td>
                    <td style="width: 16,66%">
                        Date fin des traveaux :
                    </td>
                    <td style="width: 20,66%">
                        {{ date('d-m-Y', strtotime($now)) }}
                    </td>
                </tr>
                <tr>
                    <td style="width: 16,66%">
                        Date accord sur facture :
                    </td>
                    <td style="width: 16,66%">
                        @foreach ($facture->facturestatus as $f)
                            @if ($f->devis_status_id == 2)
                                {{ date('d-m-Y', strtotime($f->created_at)) }}
                            @endif
                        @endforeach
                    </td>
                    <td style="width: 16,66%">
                        Vétusté :
                    </td>
                    <td style="width: 16,66%">
                        {{ $vet }} {{ $dossier->currency->symbole ?? null }}
                    </td>

                </tr>
            </tbody>
        </table>
    </div>
    <div style="width: 100%;">
        <div style=" !important; display: inline-block; width:50%;">
            <table style="width: 100%;">
                <thead>
                    <tr>
                        <th colspan="2" style="background: rgb(184, 223, 245) ; text-align: left;font-size:16px;">
                            PLAFOND & FRANCHISE
                        </th>
                    </tr>
                </thead>
                <tbody>
                     <tr>
                        <td>
                             .
                        </td>
                        <td>

                        </td>
                    </tr>
                    <tr>
                        <td>
                            Plafond garantie
                        </td>
                        <td>

                        </td>
                    </tr>
                    <tr>
                        <td>
                            Min franchise
                        </td>
                        <td>
                            {{ $rapport->taux->franchise }} {{ $dossier->currency->symbole ?? null }}

                        </td>
                    </tr>
                    <tr>
                        <td>
                            Taux de franchise
                        </td>
                        <td>
                            {{ $rapport->taux->franchise_fix }} {{ $dossier->currency->symbole ?? null }}

                        </td>
                    </tr>
                    {{-- <tr>
                        <td>
                            Base de calcule de franchise
                        </td>
                        <td>

                        </td>
                    </tr>
                    <tr>
                        <td>
                            Type de franchise
                        </td>
                        <td>

                        </td>
                    </tr> --}}
                    <tr>
                        <td>
                            Calcule de la franchise
                        </td>
                        <td>
                            {{ number_format($fr, 2, '.', ',') }} {{ $dossier->currency->symbole ?? null }}
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div style="width:48%; display: inline-block; margin-top:6% !important;">
            <table style="width: 100%;">
                <thead>
                    <tr>
                        <th colspan="2" style="background: rgb(184, 223, 245) ; text-align: left;font-size:16px;">
                            DETAIL DE LA REPARATION
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td style="width: 16,66%">
                            TOTAL Main d'oeuvre HT
                        </td>
                        <td style="width: 16,66%">
                            {{ number_format($taux, 2, '.', ',') }} {{ $dossier->currency->symbole ?? null }}
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 16,66%">
                            TOTAL Fournitures HT
                        </td>
                        <td style="width: 16,66%">
                            {{ number_format($tING + $montantpieces, 2, '.', ',') }}
                            {{ $dossier->currency->symbole ?? null }}

                        </td>
                    </tr>
                    <tr>
                        <td style="width: 16,66%">
                            TOTAL Facture HT
                        </td>
                        <td style="width: 16,66%">
                            {{ number_format($ttl-$tva, 2, '.', ',') }} {{ $dossier->currency->symbole ?? null }}
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 16,66%">
                            TVA
                        </td>
                        <td style="width: 16,66%">
                            {{ number_format($tva, 2, '.', ',') }} {{ $dossier->currency->symbole ?? null }}
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 16,66%">
                            TOTAL Facture TTC
                        </td>
                        <td style="width: 16,66%">
                            {{ number_format($ttl, 2, '.', ',') }}
                            {{ $dossier->currency->symbole ?? null }}


                        </td>
                    </tr>

                </tbody>
            </table>
        </div>
    </div>
    <div style="width: 100%;">
        <div style="display: inline-block; width:50%; margin-top:10px !important; ">
            <table style="width: 100%;">
                <thead>
                    <tr>
                        <th colspan="2" style="background: rgb(184, 223, 245) ; text-align: left;font-size:16px;">
                            PART ASSURE
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>
                            Désignation
                        </td>
                        <td>
                            Montant
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Franchise
                        </td>
                        <td>
                            {{ number_format($fr, 2, '.', ',') }} {{ $dossier->currency->symbole ?? null }}

                        </td>
                    </tr>
                    <tr>
                        <td>
                            Vétusté
                        </td>
                        <td>
                            {{ number_format($vet, 2, '.', ',') }} {{ $dossier->currency->symbole ?? null }}


                        </td>
                    </tr>
                    <tr>
                        <td>
                            TOTAL
                        </td>
                        <td>
                            {{ number_format($montantclient, 2, '.', ',') }} {{ $dossier->currency->symbole ?? null }}

                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div style="width:48%; display: inline-block;margin-top:-18px !important; ">
            <table style="width: 100%;">
                <thead>
                    <tr>
                        <th colspan="3" style="background: rgb(184, 223, 245) ; text-align: left;font-size:16px;">
                            PART COMPANIE
                        </th>
                    </tr>
                </thead>
                <tbody>
                      <tr>
                        <td style="width: 33%">
                            .
                        </td>
                        <td style="width: 33%">
                            
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 33%">
                            Garantie
                        </td>
                        <td style="width: 33%">
                            %PEC
                        </td>
                    </tr>

                    <tr>
                        <td style="width: 33%">
                            {{ $dossier->guarantee->guarantee }}
                        </td>
                        <td style="width: 33%">
                            {{ $dossier->guarantee->taux_RP }}

                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" style="width: 33%">
                            TOTAL
                        </td>
                        <td style="width: 33%">
                            {{ number_format($montantcompany, 2, '.', ',') }} {{ $dossier->currency->symbole ?? null }}
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
    <span>
        
    
    
    <p style="margin-top:-10px !important "> En foi de quoi la présente fiche est établie pour servir et valoir ce que de droit Fait à Mohamedia Le {{ date('d-m-Y', strtotime($now)) }}</p>
    </span>
    <div style="width: 100%;margin-top:15px">
        <div style="display: inline-block; width:33%; margin-top:1% !important; ">
        <table style="width: 100%;">
             <thead>
                    <tr>
                        <th colspan="2" style="background: rgb(184, 223, 245) ; text-align: center;font-size:16px;">
                             {{$dossier->insured->name ?? null}}
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td colspan="2" style="height:65px;">
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
            
       <div style="width:33%; display: inline-block;margin-top:-14px !important; ">
        <table style="width: 100%;">
             <thead>
                    <tr>
                        <th colspan="2" style="background: rgb(184, 223, 245) ; text-align: center;font-size:16px;">
                            {{$dossier->garage->libelle ?? null}}
                        </th>
                    </tr>
                </thead>
                 <tbody>
                    <tr>
                        <td colspan="2" style="height:65px;">
                        </td>
                    </tr>
                </tbody>
                
            
            </table>
        </div>
        <div style="width:33%; display: inline-block;margin-top:-14px !important; ">
        <table style="width: 100%;">
             <thead>
                    <tr>
                        <th colspan="2" style="background: rgb(184, 223, 245) ; text-align: center;font-size:16px;">
                            Expert
                        </th>
                    </tr>
                </thead>
                 <tbody>
                    <tr>
                        <td colspan="2" style="height:65px;">
                                <img src="img/sign.png" alt="" style="height: 55px; width: auto; margin-top:-15px !important ">

                        </td>
                    </tr>
                </tbody>
                
            
            </table>
        </div>
       
      </div>


</body>

</html>
