<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    @php
        $dynamicVariableName = 'font_size_' . now()->timestamp;
        $$dynamicVariableName = 10;
    @endphp
    <style>
        .triangle1 {
            width: 0;
            height: 0;
            border-left: 10.24px solid transparent;
            border-right: 318.24px solid transparent;
            border-bottom: 75.5px solid #008C8C;
            position: absolute;
            top: -55.12px;
            left: -60.91px;
            transform: rotate(-12deg);
        }

        .triangle2 {
            width: 0;
            height: 0;
            border-left: 10.24px solid transparent;
            border-right: 550.24px solid transparent;
            border-bottom: 110.5px solid #19BBBB;
            position: absolute;
            top: -55.12px;
            left: -100.91px;
            transform: rotate(-20deg);
        }

        body {
            margin: 0;
            padding: 0;
            height: 100vh;
            background-color: #ffffff; /* Ganti dengan warna latar belakang yang diinginkan */
        }
        .content-<?php echo now()->timestamp; ?> {
            padding: 20px;
            text-align: left;
            font-family: 'Calibri', sans-serif;
        }

        .content-<?php echo now()->timestamp; ?> img {
            width: 15%;
            max-width: 600px; /* batasan lebar maksimum gambar */
            margin-top: 1px; /* jarak antara segitiga dan gambar */
            margin-bottom: 5px;
        }
        .corner-text-<?php echo now()->timestamp; ?> {
            font-size: {{ $$dynamicVariableName }}px;
            color: #666666;
            position: absolute;
        }

        .top-right-<?php echo now()->timestamp; ?> {
            top: 10px;
            right: 10px;
        }

        .bottom-right-<?php echo now()->timestamp; ?> {
            bottom: 10px;
            right: 10px;
            text-align: right;
        }
        .bottom-left-<?php echo now()->timestamp; ?> {
            bottom: 10px;
            left: 10px;
            text-align: left;
        }
        .title-container-<?php echo now()->timestamp; ?> {
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
            position: relative;
            margin-top: 1px;
        }

        .title-<?php echo now()->timestamp; ?> {
            font-size: 12px;
            margin-bottom: 5px;
        }

        .additional-text-<?php echo now()->timestamp; ?> {
            font-size: 11px;
        }
        .claim-info-<?php echo now()->timestamp; ?> {
            font-size: {{ $$dynamicVariableName }}px;
            /* color: #008C8C; */
            text-align: justify;
            margin: 0;
            padding: 0;
            margin-top: 10px;
            line-height: 1; /* Atur nilai line-height menjadi 1 atau 100% */
        }

        .claim-info-benefit-<?php echo now()->timestamp; ?> {
            font-size: {{ $$dynamicVariableName }}px;
            /* color: #008C8C; */
            text-align: justify;
            margin: 0;
            padding: 0;
            text-align: right;
            margin-top: 10px;
            line-height: 1; /* Atur nilai line-height menjadi 1 atau 100% */
        }


        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 1px;
        }

        table, th, td {
            /* border: 1px solid #008C8C; */
        }

        th, td {
            padding: 4px;
            text-align: left;
        }
        .hot-line-<?php echo now()->timestamp; ?> {
            background-color: #048B8C;
            text-align: center;
            align-items: center;
            font-size: {{ $$dynamicVariableName }}px;
            margin-top: 10px;
            padding: 2px;
            color: #ffffff;
        }
        .txt-tindakan-<?php echo now()->timestamp; ?> {
            margin-top: 1px;
            font-size: {{ $$dynamicVariableName }}px;
        }
        .txt-pernyataan-<?php echo now()->timestamp; ?> {
            margin-top: 5px;
            font-size: {{ $$dynamicVariableName }}px;
        }
        .title-container-page-<?php echo now()->timestamp; ?> {
            display: flex;
            flex-direction: column;
            text-align: justify;
            position: relative;
            /* border: 1px solid; Warna garis tepi dan lebar dapat disesuaikan */
            padding: 3px;
            margin-left: auto;
            margin-right: auto;
            margin-top: 5px;
        }
        .txt-syarat-<?php echo now()->timestamp; ?> {
            font-size: {{ $$dynamicVariableName }}px;
            text-align: left;
        }
        .bottom-left-ttd-<?php echo now()->timestamp; ?>  {
            color: #000000;
            bottom: 200px;
            left: 10px;
            text-align: left;
        }

        .bottom-left-ttd-1-<?php echo now()->timestamp; ?>  {
            color: #000000;
            bottom: 290px;
            left: 10px;
            text-align: left;
        }
        .bottom-right-ttd-<?php echo now()->timestamp; ?>  {
            color: #000000;
            bottom: 200px;
            right: 10px;
            text-align: left;
        }

        .bottom-right-ttd-1-<?php echo now()->timestamp; ?>  {
            color: #000000;
            bottom: 290px;
            right: 10px;
            text-align: left;
        }

        .bottom-right1-ttd-<?php echo now()->timestamp; ?>  {
            color: #000000;
            bottom: 100px;
            right: 10px;
            text-align: left;
        }
        .logo_company-<?php echo now()->timestamp; ?> {
            position: absolute;
            top: -35.12px;
            left: -35.91px;
            width: 10%;
            max-width: 40px; /* batasan lebar maksimum gambar */
            margin-top: 1px; /* jarak antara segitiga dan gambar */
            margin-bottom: 5px;
        }
        .container2-<?php echo now()->timestamp; ?>:after {
            content: "";
            display: table;
            clear: both;
        }

        .container2-<?php echo now()->timestamp; ?> > div {
            float: left; /* Membuat elemen berdampingan */
            width: 48%; /* Atur lebar elemen agar mereka tidak tumpang tindih */
            box-sizing: border-box; /* Menghitung padding dan border ke dalam lebar elemen */

        }
    </style>
</head>
<body>
    <div class="triangle2"></div>
    <div class="triangle1"></div>
    @php
        if(!empty($logoPerusahaan->path)) {
            $imgSrc = 'data:image/png;base64,' . base64_encode(file_get_contents(storage_path('app/public/' . $logoPerusahaan->path)));
            echo '<img class="logo_company-' . now()->timestamp . '" src="' . $imgSrc . '">';
        }
    @endphp
    <div class="content-<?php echo now()->timestamp; ?>">
        <div class="corner-text-<?php echo now()->timestamp; ?> top-right-<?php echo now()->timestamp; ?>">
            The Future Of Healthcare At Your Fingertips
        </div>

        <img src="data:image/png;base64,{{ base64_encode(file_get_contents( public_path('images/logo-default.png') )) }}">
        <div class="title-container-<?php echo now()->timestamp; ?>">
            <div class="title-<?php echo now()->timestamp; ?>">
                <b>SURAT JAMINAN</b>
            </div>
            <div class="additional-text-<?php echo now()->timestamp; ?>">
                <b>(SURAT JAMINAN INI HARUS DITANDATANGANI OLEH PASIEN)</b>
            </div>
        </div>
        <table class="claim-info-<?php echo now()->timestamp; ?>">
            <tr>
                <td style="width: 20%;">No. Klaim</td>
                <td style="width: 1%;">:</td>
                <td style="width: 29%;">{{ wordwrap($request_logs->code,15,"<br>\n")}}</td>
                <td style="width: 20%;">Tanggal</td>
                <td style="width: 1%;">:</td>
                <td style="width: 29%;">{{ \Carbon\Carbon::parse($request_logs->created_at)->format('d M Y') }}</td>
            </tr>
            <tr>
                <td>Kepada</td>
                <td>:</td>
                <td>{{ !empty($rumahSakit->nama_rumahsakit)  ? $rumahSakit->nama_rumahsakit : '' }}</td>
                <td>Plan Polis</td>
                <td>:</td>
                <td>{{ $dataMember->code_plan }}</td>
            </tr>
        </table>
        <div class="hot-line-<?php echo now()->timestamp; ?>">
            <b>Call Center LinkSehat : 08114123962</b>
        </div>
        <div class="txt-tindakan-<?php echo now()->timestamp; ?>">
            LinkSehat bertindak mewakili perusahaan asuransi/penanggung untuk mengeluarkan Surat Jaminan Akhir untuk peserta dibawah ini :
        </div>
        <div class="container2-<?php echo now()->timestamp; ?>">
            <div>
                <table class="claim-info-<?php echo now()->timestamp; ?>">
                    <tr>
                        <td style="width: 20%;">Jenis Surat Jaminan</td>
                        <td style="width: 1%;">:</td>
                        <td style="width: 29%;"><b>SURAT JAMINAN AKHIR</b></td>
                    </tr>
                    <tr>
                        <td>Nama Peserta</td>
                        <td>:</td>
                        <td>{{ $dataMember->name }}</td>
                    </tr>
                    <tr>
                        <td>Nama Karyawan</td>
                        <td>:</td>
                        <td>{{ $namaKaryawan }}</td>
                    </tr>
                    <tr>
                        <td>Tanggal Lahir</td>
                        <td>:</td>
                        <td>{{ \Carbon\Carbon::parse($dataMember->birth_date)->format('d M Y') }}</td>
                    </tr>
                    <tr>
                        <td>Jenis Kelamin</td>
                        <td>:</td>
                        <td>{{ $dataMember->gender == 'male' ? 'Laki-Laki' : 'Perempuan' }}</td>
                    </tr>
                    <tr>
                        <td>Member ID (BN)</td>
                        <td>:</td>
                        <td>{{ $dataMember->member_id }}</td>
                    </tr>
                    <tr>
                        <td>Identitas Peserta</td>
                        <td>:</td>
                        <td>{{ $dataMember->nric }}</td>
                    </tr>
                    <tr>
                        <td>Hak Kamar Pasien</td>
                        <td>:</td>
                        <td>{{ !empty($dataRequestLog->hak_kamar_pasien) ? $dataRequestLog->hak_kamar_pasien  : ''}}</td>
                    </tr>
                    <tr>
                        <td>Penempatan Kamar</td>
                        <td>:</td>
                        <td>{{ !empty($dataRequestLog->penempatan_kamar) ? $dataRequestLog->penempatan_kamar  : ''}}</td>
                    </tr>
                    <tr>
                        <td>No. Rekam Medis</td>
                        <td>:</td>
                        <td></td>
                    </tr>
                    <tr>
                        <td>Jenis Perawatan</td>
                        <td>:</td>
                        <td>{{ $dataMember->jenis_perwatan }}</td>
                    </tr>
                </table>
            </div>
            <div>
                <table class="claim-info-<?php echo now()->timestamp; ?>">
                    <tr>
                        <td style="width: 20%;">Penjamin</td>
                        <td style="width: 1%;">:</td>
                        <td style="width: 29%;">{{ $penjamin }}</td>
                    </tr>
                    <tr>
                        <td>Nama Perusahaan</td>
                        <td>:</td>
                        <td>{{ $dataMember->nama_perusahaan }}</td>
                    </tr>
                    <tr>
                        <td>Phone Perusahaan</td>
                        <td>:</td>
                        <td>021 – 5249537</td>
                    </tr>
                    <tr>
                        <td>No. Polis</td>
                        <td>:</td>
                        <td>{{ $dataMember->no_polis }}</td>
                    </tr>
                    <tr>
                        <td>Tipe</td>
                        <td>:</td>
                        <td>{{ $dataMember->limit_rules == '999999999' ? 'As Charge' : 'Max Amount, Rp '.number_format($dataMember->limit_rules, 2, ',', '.') }}</td>
                    </tr>
                    <tr>
                        <td>Status Polis</td>
                        <td>:</td>
                        <td>{{ $dataMember->status_polis == 'active' ? 'Aktif' : 'Tidak Aktif' }}</td>
                    </tr>
                    <tr>
                        <td>Periode Jaminan</td>
                        <td>:</td>
                        <td>{{ \Carbon\Carbon::parse($request_logs->submission_date)->format('d M Y') . ($request_logs->discharge_date ? ' - ' . \Carbon\Carbon::parse($request_logs->discharge_date)->format('d M Y') : '') }} </td>
                    </tr>
                    <tr>
                        <td>Mata Uang</td>
                        <td>:</td>
                        <td>{{ $dataMember->mata_uang }}</td>
                    </tr>
                    <tr>
                        <td>Alamat Provider</td>
                        <td>:</td>
                        <td>{{ !empty($rumahSakit->alamat_rumahsakit) ? $rumahSakit->alamat_rumahsakit : '' }}</td>
                    </tr>
                    <tr>
                        <td></td>
                        <td></td>
                        <td></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td></td>
                        <td></td>
                    </tr>
                </table>
            </div>
        </div>
        <table class="claim-info-<?php echo now()->timestamp; ?>">
            <thead>
                <tr style="background-color: #F4F6F8;">
                    <td style="width: 5%; text-align: left;"><b>No.</b></td>
                    <td style="width: 25%; text-align: left;"><b>Item Layanan</b></td>
                    <td style="width: 15%; text-align: right;"><b>Total Klaim</b></td>
                    <td style="width: 20%; text-align: right;"><b>Total Disetujui</b></td>
                    <td style="width: 20%; text-align: right;"><b>Total Selisih</b></td>
                    <td style="width: 15%; text-align: left;"><b>Keterangan</b></td>
                </tr>
            </thead>
            <tbody>
                @php
                    $No = 1;
                    $total_claim = 0;
                    $total_disetujui = 0;
                    $total_selisih = 0;
                @endphp
                @foreach($dataClaimLog as $claimLog)
                    @php
                        $total_claim += $claimLog->amount_incurred;
                        $total_disetujui += $claimLog->amount_approved;
                        $total_selisih += $claimLog->excess_paid;
                    @endphp
                    <tr>
                        <td>{{ $No++ }}</td>
                        <td>{{ $claimLog->code . '-' . $claimLog->benfit }}</td>
                        <td class="claim-info-benefit-<?php echo now()->timestamp; ?>">{{ number_format($claimLog->amount_incurred, 2, ',', '.') }}</td>
                        <td class="claim-info-benefit-<?php echo now()->timestamp; ?>">{{ number_format($claimLog->amount_approved, 2, ',', '.') }}</td>
                        <td class="claim-info-benefit-<?php echo now()->timestamp; ?>">{{ number_format($claimLog->excess_paid, 2, ',', '.') }}</td>
                        <td>{{ $claimLog->keterangan}}</td>
                    </tr>
                @endforeach
            </tbody>
            <tfoot>
                <tr>
                    <td colspan="2"><b>Total</b></td>
                    <td class="claim-info-benefit-<?php echo now()->timestamp; ?>"><b>{{ number_format($total_claim, 2, ',', '.') }}</b></td>
                    <td class="claim-info-benefit-<?php echo now()->timestamp; ?>"><b>{{ number_format($total_disetujui, 2, ',', '.') }}</b></td>
                    <td class="claim-info-benefit-<?php echo now()->timestamp; ?>"><b>{{ number_format($total_selisih, 2, ',', '.') }}</b></td>
                    <td></td>
                </tr>
            </tfoot>

        </table>
        <table class="claim-info-<?php echo now()->timestamp; ?>">
            <thead>
                <tr style="background-color: #F4F6F8;">
                    <td colspan="5" style="width: 5%; text-align: left;"><b>Diagnosis</b></td>
                </tr>
            </thead>
            <tbody>
                @php
                    if(count($dataDiagnosis))
                    {
                        foreach ($dataDiagnosis as $valDiagnosis) 
                        {
                @endphp
                    <tr>
                        <td colspan="5" style="width: 5%; text-align: left;">{{ !empty($valDiagnosis->name) ? ' - '.$valDiagnosis->code.'-'.$valDiagnosis->name  : '-'}}</td>
                    </tr>
                @php
                        }
                    }
                    else
                    {
                @endphp
                    <tr>
                        <td colspan="5" style="width: 5%; text-align: left;">-</td>
                    </tr>  
                @php
                    }
                @endphp
            </tbody>
        </table>
        <table class="claim-info-<?php echo now()->timestamp; ?>">
            <thead>
                <tr style="background-color: #F4F6F8;">
                    <td colspan="5" style="width: 5%; text-align: left;"><b>CATATAN</b></td>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td colspan="5" style="width: 5%; text-align: left;">{{ !empty($dataRequestLog->catatan) ? $dataRequestLog->catatan  : '-'}}</td>
                </tr>
            </tbody>
        </table>
        <div class="corner-text-<?php echo now()->timestamp; ?> bottom-left-<?php echo now()->timestamp; ?>">
        @php
            if (!empty($dataMember->code_perusahaan) == 'VALEIND') {
        @endphp

            <b>Alarm Center Vale MKS (LinkSehat) Office</b><br>
            <b>{{ !empty($dataMember->nama_perusahaan)  ? $dataMember->nama_perusahaan : '' }}</b><br>
            Lt. 1, Jalan Somba Opu 281, Ujung Pandang, Losari, <br> Kec. Makassar, Kota Makassar, Sulawesi Selatan 90113

        @php
            } else if(!empty($dataMember->code_perusahaan) == 'PETROLAB') {
        @endphp

            <b>Alarm Center Vale MKS (LinkSehat) Office</b><br>
            <b>{{ !empty($dataMember->nama_perusahaan)  ? $dataMember->nama_perusahaan : '' }}</b><br>
            Jalan Pisangan Lama 3 Nomor 28 Jatinegara, RT.9/RW.3, <br>Pisangan Tim., Kec. Pulo Gadung, Kota Jakarta Timur, Daerah Khusus Ibukota Jakarta 13230

        @php
            } else {
        @endphp

            <b>Alarm Center Vale MKS (LinkSehat) Office</b><br>
            <b>{{ !empty($dataMember->nama_perusahaan)  ? $dataMember->nama_perusahaan : '' }}</b><br>


        @php
            }
        @endphp
        </div>
        <div class="corner-text-<?php echo now()->timestamp; ?> bottom-right-<?php echo now()->timestamp; ?>">
            <b>PT Link Medis Sehat</b><br>
            <b>Primaya Hospital Corporate</b><br>
            Graha Cempaka Mas Blok D5-6<br>
            Jl. Let. Jend. Suprapto, Jakarta Pusat 10640, Indonesia<br>
            <b>Telp</b> (021) 4217746/47
        </div>
    </div>
</body>
</html>
