
<?php $__env->startSection('title',  'Print Card'); ?>

<?php $__env->startSection('content'); ?>
<style>
    body {
        background: #f5f5f5;
    }
    .print-container {
        background: #fff;
        max-width: 950px;
        margin: 32px auto;
        padding: 48px 38px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    }
    .print-card-table, .print-card-table th, .print-card-table td {
        border: 1px solid #222;
        border-collapse: collapse;
        font-size: 14px;
        padding: 4px 6px;
        text-align: center;
        background: #fff;
    }
    .print-card-table th {
        background: #fff;
        font-weight: bold;
    }
    .print-card-header {
        border: 1px solid #222;
        border-bottom: none;
        padding: 10px;
        margin-bottom: 0;
        display: flex;
    }
    .print-card-logo {
        width: 120px;
        height: auto;
    }
    .print-card-section {
        border: 1px solid #222;
        border-top: none;
        margin-bottom: 0;
    }
    .print-card-footer {
        border: 1px solid #222;
        border-top: none;
        font-size: 14px;
        padding: 8px;
    }
    .no-border {
        border: none !important;
    }
    .fw-bold { font-weight: bold; }

    .print-btn {
        display: inline-block;
        margin: 16px auto 0 0;
        padding: 8px 24px;
        font-size: 16px;
        background: #222;
        color: #fff;
        border: none;
        border-radius: 4px;
        cursor: pointer;
    }

    @media print {
        body {
            background: #fff !important;
        }
        .print-container {
            margin: 0 !important;
            padding: 0 !important;
        }
        .print-card-table, .print-card-table th, .print-card-table td {
            background: #fff !important;
            color: #000 !important;
        }
        .print-btn, .no-print { display: none !important; }
    }
</style>

<!-- Print Button -->
<button class="print-btn no-print" onclick="window.print()">Print</button>

<div class="print-container">
    <!-- Header -->
    <table class="print-card-table" width="100%" style="margin-bottom:0;">
        <tr>
            <td rowspan="2" style="text-align:left; vertical-align:top;">
                <div style="display:flex; align-items:center; justify-content:space-between;">
                    <div>
                        <!--<img src="<?php echo e(asset('images/logo.png'), false); ?>" alt="Logo" class="print-card-logo mb-2"><br>-->
                        <span class="fw-bold" style="font-size:18px;">RAIYANUL AKSA INTERNATIONAL</span><br>
                        <span>HAJJ KAFFELA</span>
                    </div>
                    <div style="text-align:right; font-size:13px;">
                        CDA MARKET (4TH FLOOR),<br>
                        RIYAJUDDIN BAZAR, CHATTOGRAM.<br>
                        01818-882632, 01930-715192
                    </div>
                </div>
            </td>
            <td rowspan="2" style="text-align:center; vertical-align:top;">
                <span class="fw-bold">CONTACT DETAILS</span>
                <p><?php echo e($transaction->agent_first_name, false); ?> <?php echo e($transaction->agent_last_name, false); ?></p>
                <p><?php echo e($transaction->agent_contact_no, false); ?></p>
                <p><?php echo e($transaction->agent_address, false); ?></p>
            </td>
            <td style="text-align:left; vertical-align:top;">
                CARD NO : <span><?php echo e($transaction->invoice_no ?? '', false); ?></span>
            </td>
        </tr>
        <tr>
            <td style="text-align:left; vertical-align:top;">
                DATE : <span><?php echo e(isset($transaction->transaction_date) ? \Carbon\Carbon::parse($transaction->transaction_date)->format('d/m/Y') : '', false); ?></span>
            </td>
        </tr>
    </table>

    <!-- Passenger Table -->
    <table class="print-card-table" width="100%">
        <thead>
            <tr>
                <th width="5%">SL NO</th>
                <th width="35%">PASSENGER NAME</th>
                <th width="25%">PASSPORT NO.</th>
                <th width="15%">DATE OF BIRTH</th>
                <th width="20%">DATE OF EXPIRY</th>
            </tr>
        </thead>
        <tbody>
            <?php
                $passengers = [];
                if(!empty($transaction->passenger_data)){
                    $passengers = json_decode($transaction->passenger_data, true);
                }
            ?>
            <?php for($i=0; $i<count($passengers); $i++): ?>
                <tr>
                    <td><?php echo e(sprintf('%02d', $i+1), false); ?></td>
                    <td><?php echo e($passengers[$i]['passenger_name'] ?? '', false); ?></td>
                    <td><?php echo e($passengers[$i]['passport_no'] ?? '', false); ?></td>
                    <td><?php echo e($passengers[$i]['dob'] ?? '', false); ?></td>
                    <td><?php echo e($passengers[$i]['expiry_date'] ?? '', false); ?></td>
                </tr>
            <?php endfor; ?>
        </tbody>
    </table>

    <!-- Carrier Table -->
    <table class="print-card-table" width="100%" style="margin-top:4px;">
        <thead>
            <tr>
                <th>CARRIER</th>
                <th>FLT.NO</th>
                <th>CLASS</th>
                <th>DATE</th>
                <th>SECTOR</th>
                <th>GDS</th>
                <th>PORTAL</th>
                <th>PNR.NO.</th>
                <th>CONFIRMED.BY</th>
            </tr>
        </thead>
        <tbody>
            <?php
                $carriers = [];
                if(!empty($transaction->carrier_data)){
                    $carriers = json_decode($transaction->carrier_data, true);
                }
            ?>
            <?php for($i=0; $i<count($carriers); $i++): ?>
                <tr>
                    <td><?php echo e($carriers[$i]['carrier'] ?? '', false); ?></td>
                    <td><?php echo e($carriers[$i]['flat_no'] ?? '', false); ?></td>
                    <td><?php echo e($carriers[$i]['class'] ?? '', false); ?></td>
                    <td><?php echo e($carriers[$i]['carrier_date'] ?? '', false); ?></td>
                    <td><?php echo e($carriers[$i]['sector'] ?? '', false); ?></td>
                    <td><?php echo e($carriers[$i]['gds'] ?? '', false); ?></td>
                    <td><?php echo e($carriers[$i]['portal'] ?? '', false); ?></td>
                    <td><?php echo e($carriers[$i]['pnr_no'] ?? '', false); ?></td>
                    <td><?php echo e($carriers[$i]['confirmed_by'] ?? '', false); ?></td>
                </tr>
            <?php endfor; ?>
        </tbody>
    </table>

    <!-- Footer Section -->
    <table class="print-card-table" width="100%" style="margin-top:4px;">
        <tr>
            <td width="40%" style="vertical-align:top; text-align:left;">
                US DOLLAR :<br>
                TAX :<br>
                TOTAL FARE :<br>
                TKT NO. :
            </td>
            <td width="30%" style="vertical-align:top; text-align:left;">
                NOC/VISA NO : <?php echo e($transaction->visa_no ?? '', false); ?><br>
                VISA EXP DATE : <?php echo e($transaction->visa_expire ?? '', false); ?><br>
                TYPE OF VISA : <?php echo e($transaction->type_of_visa ?? '', false); ?><br>
                <span class="fw-bold">C/O :</span>
            </td>
            <td width="30%" style="vertical-align:top; text-align:left;">
                REMARKS
            </td>
        </tr>
    </table>

    <table class="print-card-table" width="100%" style="margin-top:16px;">
        <tr>
            <th colspan="7" style="text-align:center;">PAYMENT RECEIVED DETAILS</th>
        </tr>
        <tr>
            <th colspan="7" style="text-align:center;">Service Name</th>
        </tr>
        <?php $__currentLoopData = $details['receipt']->lines; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $line): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <tr>
                <td colspan="7" style="text-align:left;"><?php echo e($loop->iteration, false); ?>. <?php echo e($line['name'] ?? '', false); ?></td>
            </tr>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        <tr>
            <th style="border:1px solid #222;">TOTAL AMOUNT</th>
            <th style="border:1px solid #222;">RECEIVED AMOUNT</th>
            <th style="border:1px solid #222;">PAYMENT DATE</th>
            <th style="border:1px solid #222;">PAYMENT METHOD</th>
            <th style="border:1px solid #222;">DUE</th>
            <th style="border:1px solid #222;">MR./CHEQUE NO.</th>
        </tr>

        <?php
            
        ?>

        <tr>
            <td style="border:1px solid #222;"><?php echo e($details['receipt']->subtotal ?? '', false); ?></td>
            <td style="border:1px solid #222;"><?php echo e($details['receipt']->total_paid ?? '', false); ?></td>
            <td style="border:1px solid #222;">
                <?php echo e(\Carbon\Carbon::parse($details['receipt']->transaction_date)->format('Y-m-d'), false); ?>

            </td>
            <?php
                $last_payment = end($details['receipt']->payments);
            ?>

            <?php if($last_payment): ?>
                <td style="border:1px solid #222;"><?php echo e($last_payment['method'] ?? '', false); ?></td>
            <?php endif; ?>
            <td style="border:1px solid #222;"><?php echo e($details['receipt']->total_due ?? '', false); ?></td>
            
            <?php
                $last_ref = $payments->last();
            ?>

            <?php if($last_ref): ?>
                <td style="border:1px solid #222;"><?php echo e($last_ref->payment_ref_no, false); ?></td>
            <?php endif; ?>
        </tr>
    </table>

    <!-- Expenses & Credit/Debit Details Section -->
    
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/saprocom/raiyanulaksaintlhajjkaffela.com/tams/resources/views/sell/print_card.blade.php ENDPATH**/ ?>