<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <title>SIGEP | Reporte de Recaudaciones</title>

        <!-- Fonts -->
        {{-- <link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap" rel="stylesheet"> --}}
        <link href="{{ asset('build/assets/app.css') }}" rel="stylesheet">
    </head>
    <body>
        <div class="box">
            @include('reports.layout.vertical-header', ["title" => "Reporte de Cierre de Turnos"])
            <div class="flex flex-row border-b px-5 py-5 text-center ">
                <table class="w-full">
                    <thead>
                        <tr>
                            <td class="whitespace-nowrap">
                                <table class="table table-striped text-base">
                                    <tbody>
                                        <tr style="border-bottom: 2px solid;">
                                            <td style="padding: 6px 12px; "class="whitespace-nowrap" colspan="1">Turno:</td>
                                            <td style="padding: 6px 12px;" class="whitespace-nowrap" colspan="3"></td>
                                        </tr>
                                        <tr style="border-bottom: 1px solid;">
                                            <td style="padding: 6px 12px;" colspan="3">Ingresos en Efectivo</td>
                                            <td style="padding: 6px 12px;">{{ number_format($data->totalOnlyCash, 2) }} Bs.</td>
                                        </tr>
                                        <tr style="border-bottom: 1px solid;">
                                            <td style="padding: 6px 12px;" colspan="3">Ingresos por Punto de Venta</td>
                                            <td style="padding: 6px 12px;">{{ number_format($data->totalOnlySalesPoint, 2) }}  Bs.</td>
                                        </tr>
                                        <tr style="border-bottom: 1px solid;">
                                            <td style="padding: 6px 12px;" colspan="3">Ingresos por Transferencia / Pago Movil </td>
                                            <td style="padding: 6px 12px;">{{ number_format($data->totalOnlyBankOperation, 2) }}  Bs.</td>
                                        </tr>
                                        <tr style="border-bottom: 1px solid;">
                                            <td style="padding: 6px 12px;" colspan="3">Ingresos por Sistema Prepago </td>
                                            <td style="padding: 6px 12px;">{{ number_format($data->totalOnlyPrepaid, 2) }}  Bs.</td>
                                        </tr>
                                        <tr style="border-bottom: 1px solid;">
                                            <td style="padding: 6px 12px;" colspan="3">Ingresos por Sistema Prepago </td>
                                            <td style="padding: 6px 12px;">{{ number_format($data->totalOnlyPrepaid, 2) }}  Bs.</td>
                                        </tr>
                                        <tr style="border-bottom: 1px solid;">
                                            <td style="padding: 6px 12px;" colspan="3">Total Ingresos en sistemas </td>
                                            <td style="padding: 6px 12px;">{{ number_format($data->totalbs, 2) }} Bs.</td>
                                        </tr>
                                        <tr style="border-bottom: 1px solid;">
                                            <td style="padding: 6px 12px;"></td>
                                            <td style="padding: 6px 12px;"></td>
                                            <td style="padding: 6px 12px;"></td>
                                            <td style="padding: 6px 12px;"></td>
                                        </tr>
                                    </tbody>
                                </table>
                            </td>
                            <th class="whitespace-nowrap">
                                <table class="table table-striped text-base">
                                    <tbody>
                                        <tr class="text-right" style="margin: 40px 0;" rowspan="4">
                                            <td style="padding: 6px 12px;" class="whitespace-nowrap" colspan="1">Lider de Grupo:</td>
                                            <td style="padding: 6px 12px;" class="whitespace-nowrap" colspan="3">__________________________________</td>
                                        </tr>
                                    </tbody>
                                </table>
                            </th>
                        </tr>
                    </thead>
                </table>
            </div>
            <div class="flex flex-row border-b px-5 py-2 text-center ">
                <table class="w-full">
                    <tbody>
                        <tr style="max-width: 50%;">
                            @php
                                $cont = 0;
                            @endphp
                            @foreach($data->turns as $turn)
                                @php
                                    if($cont == 2){
                                        echo "</tr><tr>";
                                        $cont = 0;
                                    }
                                    $cont++;
                                @endphp
                                <td class="whitespace-nowrap" style="border: 1px solid;">
                                    <h1 class="text-lg"  style="margin: 10px 0;">
                                        Numero de Turno {{ $turn->turnNumber }}
                                    </h1>
                                    <div class="overflow-x-auto">
                                        <table class="table table-striped text-base">
                                            <tbody>
                                                <tr style="border-bottom: 1px solid;" class="text-center">
                                                    <td style="padding: 6px 12px;" class="whitespace-nowrap" colspan="2">Recaudador</th>
                                                    <td style="padding: 6px 12px;" class="whitespace-nowrap" colspan="2">{{ $turn->collector }}</th>
                                                </tr>
                                                <tr style="border-bottom: 1px solid;">
                                                    <td style="padding: 6px 12px;" colspan="3">Numero de Caseta</td>
                                                    <td style="padding: 6px 12px;">{{ $turn->workstation }}</td>
                                                </tr>
                                                <tr style="border-bottom: 1px solid;">
                                                    <th class="whitespace-nowrap" colspan="3">Descripción</th>
                                                    <th class="whitespace-nowrap">Bs</th>
                                                </tr>
                                                <tr style="border-bottom: 1px solid;">
                                                    <td style="padding: 6px 12px;" colspan="3">Total Bs Declarados en el Sistema</td>
                                                    <td style="padding: 6px 12px;">{{ number_format($turn->totalBs, 2) }}</td>
                                                </tr>
                                                <tr style="border-bottom: 1px solid;">
                                                    <td style="padding: 6px 12px;" colspan="3">Ingresos por Prepago </td>
                                                    <td style="padding: 6px 12px;">{{ number_format($turn->paymentMethod[6], 2) }}</td>
                                                </tr>
                                                <tr style="border-bottom: 1px solid;">
                                                    <td style="padding: 6px 12px;" colspan="3">Ingresos por Puntos de Venta </td>
                                                    <td style="padding: 6px 12px;">{{ number_format(($turn->paymentMethod[2] + $turn->paymentMethod[3]), 2) }}</td>
                                                </tr>

                                                <tr style="border-bottom: 1px solid;">
                                                    <td style="padding: 6px 12px;" colspan="3">Ingresos en Efectivo </td>
                                                    <td style="padding: 6px 12px;">{{ number_format($turn->paymentMethod[1], 2) }}</td>
                                                </tr>
                                                <tr style="border-bottom: 1px solid;">
                                                    <td style="padding: 6px 12px;" colspan="3">Ingresos en Transferencia / Pago Movil </td>
                                                    <td style="padding: 6px 12px;">{{ number_format(($turn->paymentMethod[4] + $turn->paymentMethod[5]), 2) }}</td>
                                                </tr>
                                                <tr style="border-bottom: 1px solid;">
                                                    <td style="padding: 6px 12px; font-weight: 600;" >Excedente:</td>
                                                    <td style="padding: 6px 12px;"></td>
                                                    <td style="padding: 6px 12px; font-weight: 600;">Faltante:</td>
                                                    <td style="padding: 6px 12px;"></td>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </div>
                                </td >
                            @endforeach
                        </tr>
                    </tbody>
                </table>
            </div>
            <div class="flex flex-row px-5 pt-4 text-center">
                <div id="piechart"></div>
            </div>
            {{-- <div class="px-5 sm:px-20 pb-10 sm:pb-20 flex flex-col-reverse sm:flex-row">
                <div class="text-center sm:text-left mt-10 sm:mt-0">
                    <div class="text-base text-slate-500">Bank Transfer</div>
                    <div class="text-lg text-primary font-medium mt-2">Elon Musk</div>
                    <div class="mt-1">Bank Account : 098347234832</div>
                    <div class="mt-1">Code : LFT133243</div>
                </div>
                <div class="text-center sm:text-right sm:ml-auto">
                    <div class="text-base text-slate-500">Total Amount</div>
                    <div class="text-xl text-primary font-medium mt-2">$20.600.00</div>
                    <div class="mt-1">Taxes included</div>
                </div>
            </div> --}}
        </div>
    </body>
</html>
