<!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">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Rapport</title>
</head>
<style>
    body {
        font-family: fantasy;
    }

    .page-break {
        page-break-after: always;
    }

    th {
        text-align: left;
    }

    td {
        text-align: center;
    }

    .page-number {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        text-align: center;
        padding: 5px;
    }

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

<body>

    <img src="img/amea2.png" style="height:auto; width:190px; float: left !important;margin-top:-3%;" alt="Logo"
        class="logo">

    {{-- <img src="img/amea2.png" style="height:auto; width:170px; float: left !important" alt="Logo" class="logo"> --}}
    <span style="float: right !important"> REFERENCE DOSSIER <span>{{ $dossier->ref ?? null }}</span> <br>
        <span> RAPPORT <span>{{ $dossier->typeexpertise->type ?? null }}</span>
            <br><span>{{ $dossier->mode->mode ?? null }}</span></span>
    </span>


    <div style="margin-top: 80px;">
        <div>
            <table style="border: 1px solid;width: 48%;border-collapse: collapse;font-size:81%;">
                <tr>
                    <th style="border: 1px solid; width: 43%;"> ASSURANCE</th>
                    <th style="border: 1px solid;">{{ $dossier->company->company ?? null }}</th>
                </tr>
                {{-- <tr>
                    <th style="border: 1px solid;">REPARATEUR</th>
                    <td style="border: 1px solid;">{{ $dossier->garage->libelle ?? null }}</td>
                </tr> --}}
                <tr>
                    <th style="border: 1px solid;">EXPERT</th>
                    <td style="border: 1px solid;">AMEA</td>
                </tr>
                <tr>
                    <th style="border: 1px solid;">Intermidiaire</th>
                    <td style="border: 1px solid;"> {{ $dossier->intermidiaire->company ?? null }}</td>
                </tr>
                <tr>
                    <th style="border: 1px solid;">Garantie</th>
                    <td style="border: 1px solid;"> {{ $dossier->guarantee->guarantee ?? null }}</td>
                </tr>
                <tr>
                    <th style="border: 1px solid;">Numero Sinistre</th>
                    <td style="border: 1px solid;">{{ $dossier->numero_sinistre ?? null }}</td>
                </tr>
            </table>
        </div>
        <div>
            <table
                style="border:1px solid; width: 48%; border-collapse:collapse;font-size:81%; float: right; margin-top: -15.6%;">
                <tr>
                    <th style="border: 1px solid; width: 43%;">DATE Réception Mission</th>
                    <td style="border: 1px solid;">{{ $dossier->date_reception ?? null }}</td>
                </tr>
                <tr>
                    <th style="border: 1px solid;">Date D'expertise</th>
                    <td style="border: 1px solid;">
                        @if ($meeting)
                            {{ $meeting->date ?? null }}
                        @endif
                    </td>
                </tr>
                <tr>
                    <th style="border: 1px solid;">Date du Sinistre</th>
                    <td style="border: 1px solid;">{{ $dossier->date_sinistre ?? null }}</td>
                </tr>
                <tr>
                    <th style="border: 1px solid;">Date réception de la facture</th>
                    <td style="border: 1px solid;">
                        @if ($facture)
                            {{ $facture->created_at->format('Y-m-d') ?? null }}
                        @endif
                    </td>
                </tr>
                <tr>
                    <th style="border: 1px solid;">Date rapport Définitif</th>
                    <td style="border: 1px solid;">{{ $dossier->onerapport->created_at->format('Y-m-d') ?? null }}
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div style="margin-top: 10px;">
        <div>
            <span style="float: left !imporant;"> VEHICULE EXPERTISER</span>
            <span style="float: right !imporant; margin-left:52%;">VEHICULE ADVERSAIRE </span>
        </div>
        <div style="margin-top: 20px;">
            <table style="border: 1px solid;width: 48%;border-collapse: collapse; font-size:81%;">
                <tr>
                    <th style="border: 1px solid; width: 43%;">NOM</th>
                    <td style="border: 1px solid;">{{ $dossier->insured->name ?? null }}</td>
                </tr>
                <tr>
                    <th style="border: 1px solid;">NUMERO POLICE</th>
                    <td style="border: 1px solid;">{{ $dossier->numero_police ?? null }}</td>
                </tr>
                <tr>
                    <th style="border: 1px solid;">IMMATRICULATION</th>
                    <td style="border: 1px solid;">{{ $dossier->matricule ?? $dossier->new_matricule }}</td>
                </tr>
                <tr>
                    <th style="border: 1px solid;">MARQUE</th>
                    <td style="border: 1px solid;">{{ $dossier->vehiculemodel->brand->brand ?? null }}</td>
                </tr>
                <tr>
                    <th style="border: 1px solid;">MODEL</th>
                    <td style="border: 1px solid;">{{ $dossier->vehiculemodel->name ?? null }}</td>
                </tr>
            </table>
        </div>
        <div>
            <table
                style="border: 1px solid;width: 48%;border-collapse: collapse;font-size:81%;float: right;margin-top: -13.2%;">
                <tr>
                    <th style="border: 1px solid; width: 43%;">NOM</th>
                    <td style="border: 1px solid;">{{ $dossier->opponent->name ?? null }}</td>

                </tr>
                <tr>
                    <th style="border: 1px solid;">COMPAGNIE</th>
                    <td style="border: 1px solid;">{{ $dossier->opponent->company->company ?? null }}</td>

                </tr>
                <tr>
                    <th style="border: 1px solid;">IMMATRICULATION</th>
                    <td style="border: 1px solid;">{{ $dossier->opponent->matricule ?? null }}</td>

                </tr>
                <tr>
                    <th style="border: 1px solid;">NUMERO POLICE</th>
                    <td style="border: 1px solid;">{{ $dossier->opponent->numero_attestation ?? null }}</td>
                </tr>
            </table>
        </div>
    </div>
    <hr>
    {{-- <span style="border:2px solid #000;">CIRCONSTANCE DE L'EXPERTISE/<span></span></span> --}}

    </div>
    <div style="margin-top: 40px">
        <table
            style="border: 1px solid;width: 48%;border-collapse: collapse;font-size:81%;float: left;margin-top: -2.2%;">
            <tr>
                <th style="border: 1px solid; width: 43%;">Numero Chassis</th>
                <td style="border: 1px solid;">{{ $dossier->numero_chassis ?? null }}</td>

            </tr>
            <tr>
                <th style="border: 1px solid;">DMC</th>
                <td style="border: 1px solid;">{{ $dossier->date_circulation ?? null }}</td>

            </tr>
            <tr>
                <th style="border: 1px solid;">Kilométrage</th>
                <td style="border: 1px solid;">{{ $dossier->kilometrage ?? null }}</td>

            </tr>
            <tr>
                <th style="border: 1px solid;">Puissance Fiscale</th>
                <td style="border: 1px solid;">{{ $dossier->puissance_fiscale ?? null }}</td>
            </tr>
            <tr>
                <th style="border: 1px solid;">Carburant</th>
                <td style="border: 1px solid;">{{ $dossier->carburant->name ?? null }}</td>
            </tr>
        </table>

        {{-- <table style="width: 48%; font-size: 81%; float: right; margin-top: -3%;">
            <tr style="margin: 10px 0 !important;">
                <th style="width: 43%;">lien de visite</th>
                <td style="border-bottom: 1px solid;"></td>
            </tr>
            <tr style="margin: 10px 0 !important;">
                <th style="">Visite en cours</th>
                <td style="border-bottom: 1px solid; text-align: center;"></td>
            </tr>
            <tr style="margin: 10px 0 !important;">
                <th style="">Visite fin de travaux</th>
                <td style="border-bottom: 1px solid; text-align: right;">Personnes présentes</td>
            </tr>
            <tr style="margin: 10px 0 !important;">
                <th style="padding-top: 5px">
                    TVA Récupérable
                    <input style="vertical-align: middle; margin-right: 5px;" type="checkbox"
                           @if ($rapport->taux) @if ($rapport->taux->tva_deductible) checked @endif @endif name="" id="">
                </th>
                <td>
                    Réforme économique
                    <input style="vertical-align: middle; margin-right: 5px;" type="checkbox"
                           @if ($dossier->mode_id == 2) checked @endif name="" id="">
                </td>
            </tr>
            <tr style="margin: 10px 0 !important;">
                <th style="">
                    Prise en charge
                    <input style="vertical-align: middle; margin-right: 5px;" type="checkbox"
                           @if ($dossier->type_expertise_id == 10) checked @endif name="" id="">
                </th>
                <td>
                    Réforme Technique
                    <input style="vertical-align: middle; margin-right: 5px;" type="checkbox"
                           @if ($dossier->mode_id == 3) checked @endif name="" id="">
                </td>
            </tr>
        </table> --}}
        <table style="width: 48%; font-size: 80%; float: right; margin-top: -2.8%;">
            <!-- ... (other table rows) ... -->
            <tr style="margin: 10px 0 !important;">
                <th style="width: 43%;">lien de visite</th>
                <td style="border-bottom: 1px solid;font-size:10px">
                    {{ Str::limit($dossier->garage->libelle ?? null, 27, '...') }}
                </td>
            </tr>
            <tr style="margin: 10px 0 !important;">
                <th style="">Visite en cours</th>
                <td style="border-bottom: 1px solid; text-align: center;">
                    @if ($encours)
                        {{ $encours->created_at->format('Y-m-d') ?? null }}
                    @endif
                </td>
            </tr>
            <tr style="margin: 10px 0 !important;">
                <th style="">Visite fin de travaux</th>
                <td style="border-bottom: 1px solid; text-align: center;">
                    @if ($apres)
                        {{ $apres->created_at->format('Y-m-d') ?? null }}
                    @endif
                </td>
            </tr>
            <tr style="margin: 10px 0 !important;">
                <th style="padding-top: 10px">
                    TVA Récupérable
                    <input style="vertical-align: middle; transform: scale(1.3);" type="checkbox"
                        @if ($rapport->taux) @if ($rapport->taux->tva_deductible) checked @endif @endif name="" id="">
                </th>
                <td>
                    Réforme économique
                    <input style="vertical-align: middle; margin-right: 5px; transform: scale(1.3);" type="checkbox"
                        @if ($dossier->mode_id == 2) checked @endif name="" id="">
                </td>
            </tr>
            <tr style="margin: 10px 0 !important;">
                <th style="">
                    Prise en charge
                    <input style="vertical-align: middle; margin-right: 5px; transform: scale(1.3);" type="checkbox"
                        @if ($dossier->type_expertise_id == 10) checked @endif name="" id="">
                </th>
                <td>
                    Réforme Technique
                    <input style="vertical-align: middle; margin-right: 5px; transform: scale(1.3);" type="checkbox"
                        @if ($dossier->mode_id == 3) checked @endif name="" id="">
                </td>
            </tr>
        </table>


    </div>

    <hr style=" margin-top:104px;">
    {{-- <img src="data:image/svg+xml;base64,'.{{$img}}.'"  width="100" height="100" />; --}}



    <div>
        <table style="width: 48%;border-collapse: collapse;font-size:81%;float: right;">
            <!--<tr>-->
            <!--    <th style="border: 1px solid; width: 50%;">DEVIS INITIAL</th>-->
            <!--    <th style="border: 1px solid; width: 50%;">-->
            <!--        @if ($devis)-->

            <!--            {{ $devis->montant_devis ?? null }}-->
            <!--            {{ $dossier->currency->symbole ?? null }}-->
            <!--        @endif-->
            <!--    </th>-->
            <!--</tr>-->
            <tr>
                <td>
                    <table style="border: 1px solid;border-collapse: collapse;font-size:90%; width: 100%;">
                        <tr>
                            <td style="border: 1px solid;" colspan="2">DEVIS INITIAL </td>
                        </tr>
                        <tr>
                            <td style="border: 1px solid;" colspan="2">PIECES RECUP HT </td>
                        </tr>
                        <tr>
                            <td style="border: 1px solid;" colspan="2">PIECES ORIGINE HT</td>
                        </tr>
                        <tr>
                            <td style="border: 1px solid;" colspan="2">PIECES Adaptable HT</td>
                        </tr>
                        <tr>
                            <td style="border: 1px solid;" colspan="2">Ingredient</td>
                        </tr>
                        <tr>
                            <td style="border: 1px solid;">TAUX</td>
                            <td style="border: 1px solid;">Prix/h</td>
                        </tr>
                        @if ($dossier->type_expertise_id == 14 || $dossier->type_expertise_id == 7)
                            <tr>
                                <td style="border: 1px solid;">MO T1</td>
                                <td style="border: 1px solid;">
                                    {{ $rapport->taux->forfait_mo_1 ?? null }}

                                    {{ $dossier->currency->symbole }}
                                </td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid;">MO T2</td>
                                <td style="border: 1px solid;"> {{ $rapport->taux->forfait_mo_2 ?? null }}
                                    {{ $dossier->currency->symbole }}</td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid;">MO T3</td>
                                <td style="border: 1px solid;"> {{ $rapport->taux->forfait_mo_3 ?? null }}
                                    {{ $dossier->currency->symbole }}</td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid;">MO Eléctricite</td>
                                <td style="border: 1px solid;"> {{ $rapport->taux->forfait_electricite ?? null }}
                                    {{ $dossier->currency->symbole }}</td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid;">MO Mecanique</td>
                                <td style="border: 1px solid;"> {{ $rapport->taux->forfait_mecanique ?? null }}
                                    {{ $dossier->currency->symbole }}</td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid;">MO Controle</td>
                                <td style="border: 1px solid;"> {{ $rapport->taux->forfait_controle ?? null }}
                                    {{ $dossier->currency->symbole }}</td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid;">MO Peinture</td>
                                <td style="border: 1px solid;"> {{ $rapport->taux->forfait_peinture ?? null }}
                                    {{ $dossier->currency->symbole }}</td>
                            </tr>
                            <tr>
                                <th colspan="2" style="border: 1px solid;">Total HT</th>
                            </tr>
                        @else
                            <tr>
                                <td style="border: 1px solid;">MO T1</td>
                                <td style="border: 1px solid;">
                                    @if ($rapport->taux)
                                        {{ $rapport->taux->taux_1 ?? null }}
                                    @endif
                                    {{ $dossier->currency->symbole }}
                                </td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid;">MO T2</td>
                                <td style="border: 1px solid;">
                                    @if ($rapport->taux)
                                        {{ $rapport->taux->taux_2 ?? null }} @endif

                                    {{ $dossier->currency->symbole }}
                                </td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid;">MO T3</td>
                                <td style="border: 1px solid;">
                                    @if ($rapport->taux)
                                        {{ $rapport->taux->taux_3 ?? null }} @endif

                                    {{ $dossier->currency->symbole }}
                                </td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid;">MO Eléctricite</td>
                                <td style="border: 1px solid;">
                                    @if ($rapport->taux)
                                        {{ $rapport->taux->taux_electricite ?? null }} @endif

                                    {{ $dossier->currency->symbole }}
                                </td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid;">MO Mecanique</td>
                                <td style="border: 1px solid;">
                                    @if ($rapport->taux)
                                        {{ $rapport->taux->taux_mecanique ?? null }} @endif

                                    {{ $dossier->currency->symbole }}
                                </td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid;">MO Controle</td>
                                <td style="border: 1px solid;">
                                    @if ($rapport->taux)
                                        {{ $rapport->taux->taux_controle ?? null }} @endif

                                    {{ $dossier->currency->symbole }}
                                </td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid;">MO Peinture</td>
                                <td style="border: 1px solid;">
                                    @if ($rapport->taux)
                                        {{ $rapport->taux->taux_mo_peinture ?? null }} @endif

                                    {{ $dossier->currency->symbole }}
                                </td>
                            </tr>

                            <tr>
                                <th colspan="2" style="border: 1px solid;">Total HT</th>
                            </tr>
                        @endif

                    </table>
                </td>
                <td>
                    <table style="border: 1px solid;border-collapse:collapse;font-size:90%;width: 100%;">

                        <tr>
                            <td style="border: 1px solid;" colspan="2">
                                @if ($devis)

                                    {{ $devis->montant_devis ?? null }}
                                    {{ $dossier->currency->symbole ?? null }}
                                @else
                                    0 {{ $dossier->currency->symbole ?? null }}
                                @endif
                            </td>
                        </tr>
                        <tr>
                            <td style="border: 1px solid;" colspan="2">{{ $recup }}</td>
                        </tr>
                        <tr>
                            <td style="border: 1px solid;" colspan="2">{{ $org }}</td>
                        </tr>
                        <tr>
                            <td style="border: 1px solid;" colspan="2">{{ $adpt }}</td>
                        </tr>
                        <tr>
                            <td style="border: 1px solid;" colspan="2">{{ $ingr }}</td>
                        </tr>
                        <tr>
                            <td style="border: 1px solid;">Nombre D'heures</td>
                            <td style="border: 1px solid;">Total</td>
                        </tr>

                        @if ($dossier->type_expertise_id != 14 && $dossier->mode_id != 7)

                            <tr>
                                <td style="border: 1px solid;">{{ $rapport->taux->t1 ?? 0 }}</td>
                                <td style="border: 1px solid;">
                                    {{ $main01 ?? 0 }}</td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid;">{{ $rapport->taux->t2 ?? 0 }}</td>
                                <td style="border: 1px solid;">
                                    {{ $main02 ?? 0 }}</td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid;">{{ $rapport->taux->t3 ?? 0 }}</td>
                                <td style="border: 1px solid;">
                                    {{ $main03 ?? 0 }} </td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid;">{{ $rapport->taux->te ?? 0 }}</td>
                                <td style="border: 1px solid;">
                                    {{ $main05 ?? 0 }}</td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid;">{{ $rapport->taux->tm ?? 0 }}</td>
                                <td style="border: 1px solid;">
                                    {{ $main07 ?? 0 }}</td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid;">{{ $rapport->taux->tc ?? 0 }}</td>
                                <td style="border: 1px solid;">
                                    {{ $main06 ?? 0 }}</td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid;">{{ $rapport->taux->tp ?? 0 }}</td>
                                <td style="border: 1px solid;">
                                    {{ $main04 ?? 0 }}
                                </td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid;" colspan="2">
                                    {{ number_format($ht, 2, '.', ',') }}
                                    {{ $dossier->currency->symbole }}
                                </td>
                            </tr>
                        @else
                            <tr>
                                <td style="border: 1px solid;"></td>
                                <td style="border: 1px solid;">
                                    {{ $rapport->taux->forfait_mo_1 ?? 0 }}</td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid;"></td>
                                <td style="border: 1px solid;">
                                    {{ $rapport->taux->forfait_mo_2 ?? 0 }}</td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid;"></td>
                                <td style="border: 1px solid;">
                                    {{ $rapport->taux->forfait_mo_3 ?? 0 }}</td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid;"> </td>
                                <td style="border: 1px solid;">
                                    {{ $rapport->taux->forfait_electricite ?? 0 }}</td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid;"></td>
                                <td style="border: 1px solid;">
                                    {{ $rapport->taux->forfait_mecanique ?? 0 }}</td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid;"></td>
                                <td style="border: 1px solid;">
                                    {{ $rapport->taux->forfait_controle ?? 0 }}</td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid;"></td>
                                <td style="border: 1px solid;">
                                    {{ $rapport->taux->forfait_peinture ?? 0 }}
                                </td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid;" colspan="2">
                                    {{ number_format($ttl - $fr - $tva, 2, '.', ',') }}
                                    {{ $dossier->currency->symbole }} </td>
                            </tr>
                        @endif

                    </table>
                </td>
            </tr>
            <tr>
                <td>
                    <table style="border: 1px solid;border-collapse:collapse;font-size:90%;width: 100%;">
                        <tr>
                            <td colspan="2" style="border: 1px solid;" colspan="2">MONTANT TVA</td>
                        </tr>
                        <tr>
                            <td colspan="2" style="border: 1px solid;" colspan="2">TOTAL TTC</td>
                        </tr>
                        <tr>
                            <td colspan="2" style="border: 1px solid;">MONTANT VETUSTE</td>
                        </tr>
                        <tr>
                            <td colspan="2" style="border: 1px solid;">FRANCHISE</td>
                        </tr>
                         <tr>
                            <td colspan="2" style="border: 1px solid;">REMISE</td>
                        </tr>
                        <tr>
                            <td colspan="2" style="border: 1px solid;">MONTANT COMPAGNIE</td>
                        </tr>
                        <tr>
                            <td colspan="2" style="border: 1px solid;">MONTANT CLIENT</td>
                        </tr>
                    </table>
                </td>
                <td>
                    <table style="border: 1px solid black;border-collapse:collapse;font-size:90%;width: 100%;">


                        <tr>
                            <td colspan="2" style="border: 1px solid; " colspan="2">
                                {{ number_format($tva, 2, '.', ',') }}
                                {{ $dossier->currency->symbole }}</td>
                        </tr>
                        <tr>
                            <td colspan="2" style="border: 1px solid;" colspan="2">
                                {{ number_format($ttl, 2, '.', ',') }}
                                {{ $dossier->currency->symbole }}</td>
                        </tr>
                        <tr>
                            <td colspan="2" style="border: 1px solid;">
                                {{ number_format($vet, 2, '.', ',') }} {{ $dossier->currency->symbole }}
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="border: 1px solid;"> {{ number_format($fr, 2, '.', ',') }}
                                {{ $dossier->currency->symbole }}

                            </td>
                        </tr>
                          <tr>
                            <td colspan="2" style="border: 1px solid;"> {{ number_format($remise, 2, '.', ',') }}
                                {{ $dossier->currency->symbole }}

                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="border: 1px solid;">
                                {{ number_format($montantcompany, 2, '.', ',') }}
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="border: 1px solid;">
                                {{ number_format($montantclient, 2, '.', ',') }}
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </div>
    {{-- @if ($sign > 0)
        <img src="img/sign.png" style="height:auto; width:150px; float:right;position: relative;top:45%; left:50%;">
    @endif --}}


    <div>
        <table style="border: 1px solid;width: 48%;border-collapse: collapse; font-size:81%;">
            <tr>
                <th style="border: 1px solid; width: 33%;">Valeurs </th>
                <td style="border: 1px solid;">HT</td>
                <td style="border: 1px solid;">TTC</td>

            </tr>
            <tr>
                <th style="border: 1px solid;">Valeur Vénale</th>
                <td style="border: 1px solid;">{{ $dossier->valeurvenale ?? 0 }} {{ $dossier->currency->symbole }}
                </td>
                <td style="border: 1px solid;">{{ $dossier->valeurvenale_ttc ?? 0 }}
                    {{ $dossier->currency->symbole }}
                </td>
            </tr>

            <tr>
                <th style="border: 1px solid;">Valeur de l'épave</th>
                <td style="border: 1px solid;">{{ $dossier->valeurepave ?? 0 }} {{ $dossier->currency->symbole }}
                </td>
                <td style="border: 1px solid;">{{ $dossier->valeurepave_ttc ?? 0 }}
                    {{ $dossier->currency->symbole }}</td>

            </tr>
            <tr>
                <th style="border: 1px solid;">Différence des valeurs</th>
                <td style="border: 1px solid;">{{ $dossier->valeuradire ?? 0 }} {{ $dossier->currency->symbole }}
                </td>
                <td style="border: 1px solid;">{{ $dossier->valeuradire_ttc ?? 0 }}
                    {{ $dossier->currency->symbole }}</td>

            </tr>
            <tr>
                <th style="border: 1px solid;">Valeur a neuf</th>
                <td style="border: 1px solid;">{{ $dossier->valeurneuf ?? 0 }} {{ $dossier->currency->symbole }}
                </td>
                <td style="border: 1px solid;">{{ $dossier->valeurneuf_ttc ?? 0 }}
                    {{ $dossier->currency->symbole }}</td>

            </tr>
            <tr>
                <th style="border: 1px solid;">Hors sinistre </th>
                <td style="border: 1px solid;">{{ $dossier->horssinistre ?? 0 }} {{ $dossier->currency->symbole }}
                </td>
                <td style="border: 1px solid;">{{ $dossier->horssinistre_ttc ?? 0 }}
                    {{ $dossier->currency->symbole }}
                </td>
            </tr>

        </table>
    </div>
    <span style="margin-top: 20px !important;">
        <b><u>
                @if ($chock)
                @if ($sign>0)
                @if ($position == 1)

                <img style="width: 300px;height:200px;margin-top:50px;margin-left:-25%"
                src="{{ Storage::disk('s3')->temporaryUrl($chock->path, now()->addMinutes(30)) }}"
                alt="">
                @else
                <img style="width: 300px;height:200px;margin-top:50px;"
                src="{{ Storage::disk('s3')->temporaryUrl($chock->path, now()->addMinutes(30)) }}"
                alt="">
                @endif
                @else
                <img style="width: 300px;height:200px;margin-top:50px;"
                src="{{ Storage::disk('s3')->temporaryUrl($chock->path, now()->addMinutes(30)) }}"
                alt="">
                @endif


                @endif

            </u></b>
        <br>
        <span style="float: left;font-size:10px;">Point :
            @foreach ($dossier->shockpoint as $point)
                {{ $point->point }},
            @endforeach
        </span>

    </span>


    <div>
        @if ($sign > 0)
            @if ($position == 1)
                <img src="img/sign.png"
                    style="height:auto;float: left; width:180px;margin-top: 92px  !important;position: absolute;bottom:0;">


                <p style="text-align: center;font-size:66%; margin-top:105px">
                    Parc Plaza Bd.Yaakoub Al Mansour lmm.G2 28800 -Mohammedia <br>
                    Tél : 052330564-Fax : 0523305672 -E-mail :amea.maroc@gmail.com <br>
                    RC:12583 -TP: 39570820-IF:14392431 -CNSS:4472213-ICE:001376800000001
                </p>
            @elseif($position == 2)
                <p style="text-align: center;font-size:66%; margin-top:130px">
                    Parc Plaza Bd.Yaakoub Al Mansour lmm.G2 28800 -Mohammedia <br>
                    Tél : 052330564-Fax : 0523305672 -E-mail :amea.maroc@gmail.com <br>
                    RC:12583 -TP: 39570820-IF:14392431 -CNSS:4472213-ICE:001376800000001
                </p>
                <div>
                    <img src="img/sign.png"
                        style="height:auto;float: right; width:180px;margin-top: 80px  !important;position: absolute;bottom:0;">
                </div>
            @endif
        @else
            <p style="text-align: center;font-size:66%; margin-top:115px">
                Parc Plaza Bd.Yaakoub Al Mansour lmm.G2 28800 -Mohammedia <br>
                Tél : 052330564-Fax : 0523305672 -E-mail :amea.maroc@gmail.com <br>
                RC:12583 -TP: 39570820-IF:14392431 -CNSS:4472213-ICE:001376800000001
            </p>

        @endif
    </div>

    <div class="page-break"></div>
    {{-- <img src="img/amea2.png" style="height:auto; width:170px; float: left !important"> --}}
    <span style="float: right !important"> REFERENCE DOSSIER <span>{{ $dossier->ref }}</span> <br>
        <span> RAPPORT <span>{{ $dossier->typeexpertise->type ?? null }}</span></span>
    </span>
    <table style="margin-top:80px; border: 1px solid;border-collapse: collapse; width: 100%;height:62%;font-size:13px">
        <tr>
            <td style="border: 1px solid; width: 23% !important;">DESINATION</td>
            <td style="border: 1px solid; width: 11% !important;">QTE</td>
            <td style="border: 1px solid; width: 15% !important;">OPERATION</td>
            <td style="border: 1px solid; width: 11% !important;">Type</td>
            <td style="border: 1px solid; width: 11% !important;">REMISE</td>
            <td style="border: 1px solid; width: 11% !important;">VETUSTE</td>
            <td style="border: 1px solid; width: 13% !important;">Prix U</td>
            <td style="border: 1px solid; width: 13% !important;">Montant</td>


        </tr>
        @if ($rapport->piece)
            @foreach ($rapport->piece as $piece)
                <tr>
                    <td style="border: 1px solid; width:  11% !important;">{{ $piece->piece ?? null }}</td>
                    <td style="border: 1px solid; width:  11% !important;">{{ $piece->pivot->qte ?? null }}</td>
                    <td style="border: 1px solid; width:  11% !important;">
                        {{ $piece->pivot->operation->operation ?? null }}
                    </td>
                    <td style="border: 1px solid; width:  11% !important;">
                        {{ $piece->pivot->typereparation->type ?? null }}
                    </td>
                    <td style="border: 1px solid; width:  11% !important;">{{ $piece->pivot->remise ?? null }} %</td>
                    <td style="border: 1px solid; width:  11% !important;">{{ $piece->pivot->vetuste ?? null }}</td>
                    <td style="border: 1px solid; width:  11% !important;">{{ $piece->pivot->prix_unitaire ?? null }}
                    <td style="border: 1px solid; width:  11% !important;">
                        @if ($piece->pivot->type_reparation_id == 1)
                            @php
                                $rem = $piece->pivot->qte * $piece->pivot->prix_unitaire * ($piece->pivot->remise / 100);
                                $montantpieces = $piece->pivot->prix_unitaire * $piece->pivot->qte -$rem;
                                $vet = $montantpieces *( $piece->pivot->vetuste/ 100) ;
                                $montantpieces = $montantpieces  -$vet;
                            @endphp
                        @else
                            @php
                                $rem = $piece->pivot->qte * $piece->pivot->prix_unitaire * ($piece->pivot->remise / 100);
                                $tvaa = ($piece->pivot->prix_unitaire * $piece->pivot->qte - $rem) * 0.2;
                                $montantpieces = $piece->pivot->prix_unitaire * $piece->pivot->qte - $rem + $tvaa;

                                if ($rapport->taux && $rapport->taux->tva_deductible) {
                                    $vet = ($piece->pivot->qte * $piece->pivot->prix_unitaire - $rem) * ($piece->pivot->vetuste / 100);
                                } else {
                                    $vet = ($piece->pivot->qte * $piece->pivot->prix_unitaire - $rem + $tvaa) * ($piece->pivot->vetuste / 100);
                                }
                                $montantpieces = $montantpieces - $vet;
                            @endphp
                        @endif
                        {{ $montantpieces }}
                    </td>
                </tr>
            @endforeach
        @endif
    </table>
    <br>
    <span style="margin-top: 50px !important;">Observations :<b><u></u></b></span>
    @foreach ($observations as $observation)
        <p>{{ $observation->observation }}</p>
    @endforeach

    <div style="margin-top: 10px;font-size:12px;">Examen Contradictoire effectué en présence de:
        <span>{{ $dossier->insured->civility ?? null }} {{ $dossier->insured->name ?? null }}</span><br>
        Vise aprés accord sur les dégats apparents constatés
    </div>
    <div style="margin-top: 10px;font-size:16px;">
        <span>L'EXPERT</span>
        <div style="display: inline-block; float: right; ">
            @if ($dossier->contradictoire)
                {{ $dossier->contradictoire->adverse->name ?? null }}
            @else
                EXPERT ADVERSE
            @endif
        </div>
    </div>
    <div style="margin-top: 10px;font-size:12px;"> POUR FAIRE VALOIR LES PRESENT DOCUMENT , IL DOIT ETRE COSIGNE DES
        DEUX PARTIES</div>
    <div style="color: red;font-size:12px;margin-bottom: 1_px;">
        CECI N'EST PAS UN BON DE PRISE EN CHARGE
        <br>
        NI UN ORDRE DE PAYMENT
    </div>

    <div>

        @if ($sign > 0)

            @if ($position == 1)
                <img src="img/sign.png"
                    style="height:auto;float: left; width:180px;margin-top: 92px  !important;position: absolute;bottom:0;">

                <p style="text-align: center;font-size:66%; margin-top:95px">
                    Parc Plaza Bd.Yaakoub Al Mansour lmm.G2 28800 -Mohammedia <br>
                    Tél : 052330564-Fax : 0523305672 -E-mail :amea.maroc@gmail.com <br>
                    RC:12583 -TP: 39570820-IF:14392431 -CNSS:4472213-ICE:001376800000001
                </p>
            @elseif ($position == 2)
                <p style="text-align: center;font-size:66%; margin-top:85px">
                    Parc Plaza Bd.Yaakoub Al Mansour lmm.G2 28800 -Mohammedia <br>
                    Tél : 052330564-Fax : 0523305672 -E-mail :amea.maroc@gmail.com <br>
                    RC:12583 -TP: 39570820-IF:14392431 -CNSS:4472213-ICE:001376800000001
                </p>
                <div>
                    <img src="img/sign.png"
                        style="height:auto;float: right; width:180px;margin-top: 25px  !important;position: absolute;bottom:0;">
                </div>

            @endif
        @else
            <p style="text-align: center;font-size:66%; margin-top:75px">
                Parc Plaza Bd.Yaakoub Al Mansour lmm.G2 28800 -Mohammedia <br>
                Tél : 052330564-Fax : 0523305672 -E-mail :amea.maroc@gmail.com <br>
                RC:12583 -TP: 39570820-IF:14392431 -CNSS:4472213-ICE:001376800000001
            </p>
        @endif

    </div>



    @if ($rapport->documents_count > 0)
        <div style="margin-top:5%">
            <table>
                @foreach ($rapport->documents as $doc)
                    <tr>
                        <td> <img src="{{ Storage::disk('s3')->temporaryUrl($doc->path, now()->addMinutes(30)) }}"
                                alt="" style="height:300px"></td>
                        <td>
                            <p style="margin:15px">

                            </p>
                        </td>
                    </tr>
                @endforeach
            </table>
        </div>

        {{-- <footer class="" style="margin-top: 95%">
            <p  style="text-align: center;font-size:66%;">
                Parc Plaza Bd.Yaakoub Al Mansour lmm.G2 28800 -Mohammedia <br>
                Tél : 052330564-Fax : 0523305672 -E-mail :amea.maroc@gmail.com <br>
                RC:12583 -TP: 39570820-IF:14392431 -CNSS:4472213-ICE:001376800000001
            </p>
        </footer> --}}


    @endif
    <script type="text/php">
        if (isset($pdf)) {
            $pageText = "{PAGE_NUM} / {PAGE_COUNT}";
            $font = null;
            $size = 12;
            $color = array(0, 0, 0);
            $wordSpace = 0.0;
            $charSpace = 0.0;
            $angle = 0.0;
            $x = 280;
            $y = 800;
            $align = 'center';
            $font = $fontMetrics->get_font("Arial", "bold");
            $pdf->page_text($x, $y, $pageText, $font, $size, $color, $wordSpace, $charSpace, $angle);
        }
    </script>
</body>

</html>
