

<?php $__env->startSection('content'); ?>



<!DOCTYPE html>
<html>

<head>
    <title></title>
    <style>
        body {
            font-family: Arial, sans-serif;
            font-size: 14px;
            margin: 0;
            padding: 0;
            background-color: #f8f9fa;
        }

        .container {
            width: 90%;
            margin: 0 auto;
            padding: 20px;
            background: white;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            border-radius: 5px;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 20px;
            background: white;
            border-radius: 5px;
            overflow: hidden;
        }

        th,
        td {
            padding: 10px;
            text-align: left;

        }

        td {
            padding: 5px;
            /* Reduce unnecessary space */
            vertical-align: top;
            /* Align content to the top */
        }

        ul {
            margin-top: 0;
            /* Remove extra margin */
            padding-left: 20px;
            /* Keep bullet indentation */
        }

        th {
            background-color: #525659;
            color: white;
        }

        hr {
            border: 0;
            height: 1px;
            background: #ddd;
            margin: 20px 0;
        }

        .footers {
            background-color: #007BFF;
            color: white;
            padding: 15px;
            text-align: center;
            font-size: 12px;
            border-top: 3px solid #0056b3;
            margin-top: 20px;
        }

        @page {
            size: A4;
            margin: 10px;
            scale: 0.8;
            /* Reduce size */
        }

        .button-container {
            display: flex;
            justify-content: center;
            /* Center horizontally */
            margin-top: 20px;
            /* Add some space */
        }


        <style>.report-header {
            background-color: #f8f9fa;
            border-bottom: 3px solid #0d6efd;
            padding: 20px 0;
            margin-bottom: 30px;
        }

        .test-table {
            border-collapse: collapse;
            width: 100%;
            margin-bottom: 30px;
        }

        .test-table th {
            background-color: #0d6efd;
            color: white;
            padding: 12px;
            text-align: left;
        }

        .test-table td {
            padding: 12px;
            border-bottom: 1px solid #dee2e6;
            vertical-align: top;
        }

        .test-table tr:nth-child(even) {
            background-color: #f8f9fa;
        }

        .result-flag {
            font-size: 0.9em;
            padding: 3px 8px;
            border-radius: 4px;
            margin-left: 10px;
        }

        .normal-range {
            color: #6c757d;
            font-size: 0.9em;
        }

        @media print {
            .report-header {
                border: none;
            }

            .test-table {
                page-break-inside: avoid;
            }
        }
    </style>

    </style>
</head>

<body>
    <div class="container">
        <div class="row">
            <div class="col-md-6">
                <table>
                    <tr>
                        <td colspan="2">
                            <img src="https://bluhealth.bluai.ai/admin/assets/images/logo/BluHealth_Logo.png" alt="BluHealth Logo" width="150">
                        </td>
                        <td colspan="2" style="text-align: center;">
                            <h3>Clinical Information</h3>
                        </td>
                    </tr>
                </table>
                <hr>

                <!-- Patient & Doctor Information -->
                <table>
                    <tr>
                        <th colspan="2">Patient Information</th>
                        <th colspan="2">Doctor Information</th>
                    </tr>
                    <tr>
                        <td><strong>Name:</strong></td>
                        <td><?php echo e($patient ? $patient->first_name .' ' .$patient->last_name : 'N/A'); ?></td>
                        <td><strong>Dr.:</strong></td>
                        <td><?php echo e($hcp ? $hcp->first_name .' ' .$hcp->last_name : 'N/A'); ?></td>
                    </tr>
                    <tr>
                        <td><strong>Email:</strong></td>
                        <td><?php echo e($patient ? $patient->email : 'N/A'); ?></td>
                        <td><strong>Email:</strong></td>
                        <td><?php echo e($hcp ? $hcp->email : 'N/A'); ?></td>
                    </tr>
                    <tr>
                        <td colspan="2"></td>
                        <td><strong>Address:</strong></td>
                        <td><?php echo e($hcp ? $hcp->address : 'N/A'); ?></td>
                    </tr>
                    <tr>
                        <td colspan="2"></td>
                        <td><strong>Phone:</strong></td>
                        <td><?php echo e($hcp ? $hcp->contact_phone_personal : 'N/A'); ?></td>
                    </tr>
                </table>

                <!-- Reason for Blood Work & Specialty Tests -->
                <table>
                    <tr>
                        <th>Reason for Blood Work</th>
                        <th>Specialty Tests</th>
                    </tr>
                    <tr>
                        <td>

                            <ul class="list-unstyled mb-0">
                                <?php $__currentLoopData = $reason_for_blood_work ?? []; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $reason): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <li class="d-flex align-items-center mb-1">
                                    <i class="fas fa-check-circle text-success me-2" style="font-size: 1rem;"></i>
                                    <span class="fw-medium"><?php echo e(ucfirst(str_replace('_', ' ', $reason))); ?></span>
                                </li>
                                <?php if('otherReason' == $reason): ?>
                                <div class=" text-muted small">
                                    <i class="fas fa-angle-right ms-5 me-1"></i><?php echo e(strtoupper($other_reason)); ?>

                                </div>
                                <?php endif; ?>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </ul>

                        </td>
                        <td>
                            <ul class="list-unstyled mb-0">
                                <?php $__currentLoopData = $specialty_tests ?? []; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $specialty): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <li class="d-flex align-items-center mb-1">
                                    <i class="fas fa-check-circle text-success me-2" style="font-size: 1rem;"></i>
                                    <span class="fw-medium"><?php echo e(ucfirst(str_replace('_', ' ', $specialty))); ?></span>
                                </li>
                                <?php if('cardiacMarkers' == $specialty): ?>
                                <div class="d-flex flex-column text-muted small">
                                    <?php $__currentLoopData = $cardiac_tests ?? []; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cardiac): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <div class="d-flex align-items-center">
                                        <i class="fas fa-angle-right ms-5 me-2"></i> <span><?php echo e(strtoupper($cardiac)); ?></span>
                                    </div>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </div>
                                <?php endif; ?>
                                <?php if('inflammatoryMarkers' == $specialty): ?>
                                <div class="d-flex flex-column text-muted small">
                                    <?php $__currentLoopData = $inflammatory_tests ?? []; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $inflammatory): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <div class="d-flex align-items-center">
                                        <i class="fas fa-angle-right ms-5 me-2"></i> <span><?php echo e(strtoupper($inflammatory)); ?></span>
                                    </div>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </div>
                                <?php endif; ?>
                                <?php if('hormonalStudies' == $specialty): ?>
                                <div class="d-flex flex-column text-muted small">
                                    <?php $__currentLoopData = $hormone_tests ?? []; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $hormone): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <div class="d-flex align-items-center">
                                        <i class="fas fa-angle-right ms-5 me-2"></i> <span><?php echo e(strtoupper($hormone)); ?></span>
                                    </div>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </div>
                                <?php endif; ?>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </ul>
                        </td>
                    </tr>
                </table>

                <!-- Basic Panel -->
                <table>
                    <tr>
                        <th>Basic Panel</th>
                    </tr>
                    <tr>
                        <td>
                            <ul class="list-unstyled mb-0">
                                <?php $__currentLoopData = $basic_panel ?? []; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $panel): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <li class="d-flex align-items-center mb-1">
                                    <i class="fas fa-check-circle text-success me-2" style="font-size: 1rem;"></i>
                                    <span class="fw-medium"><?php echo e(ucfirst(str_replace('_', ' ', $panel))); ?></span>
                                </li>

                                <?php if($panel == 'cbc'): ?>
                                <ul class="text-muted small ms-4">
                                    <li class="d-flex align-items-center">
                                        <i class="fas fa-angle-right me-2"></i>
                                        <span><?php echo e(strtoupper($basic_panel_options[0] ?? 'No options available')); ?></span>
                                    </li>
                                </ul>
                                <?php endif; ?>

                                <?php if($panel == 'thyroidFunctionTests'): ?>
                                <ul class="text-muted small ms-4">
                                    <?php $__currentLoopData = $thyroid_tests ?? []; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $test): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <li class="d-flex align-items-center">
                                        <i class="fas fa-angle-right me-2"></i>
                                        <span><?php echo e(strtoupper($test)); ?></span>
                                    </li>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </ul>
                                <?php endif; ?>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </ul>
                        </td>
                    </tr>
                </table>
                <hr>

                <!-- Footer -->
                <div class="footers">
                    &copy; 2025 BluHealth. All rights reserved.
                </div>
            </div>
            <div class="col-md-6">
    <?php if($reportUrl): ?>
        <?php if(Str::endsWith($reportUrl, ['.pdf'])): ?> 
    
            <iframe src="<?php echo e(asset($reportUrl)); ?>" width="100%" height="1000px"></iframe>
        <?php else: ?>
            <img src="<?php echo e(asset($reportUrl)); ?>" alt="Lab Report" width="600">
        <?php endif; ?>
        <br>
        <div class="mt-2 ">
            <a href="<?php echo e(asset($reportUrl)); ?>" class="btn btn-primary" download>Download Report</a>
            <a href="javascript:void(0)" onclick="printLabresultPage(<?php echo e($lab_id); ?>)" class="btn btn-primary">Print</a>
        </div>
    <?php else: ?>
        <p>No Report Available</p>
    <?php endif; ?>
</div>




        </div>


        <br>

        <div class="row">
           
                <?php if(!empty($test_results['complete_blood_count']) && is_array($test_results['complete_blood_count'])): ?>
                <div class="col-md-6">
                <div class="container">

                <div class="report-header p-4">
                        <!-- Logo and Customer Care Info -->
                        <div class="d-flex justify-content-between align-items-center mb-3">
                            <img src="https://bluhealth.bluai.ai/admin/assets/images/logo/BluHealth_Logo.png"
                                alt="Lab Logo"
                                style="height: 40px; width: auto;">
                            
                            <div class="text-center">

                            <img src="<?php echo e(Storage::url('uploads/labs/' . $labDetails->photo)); ?>"
                                alt="Lab Logo"
                                style="height: 40px; width: auto;">
                                <h5 class="mb-1 text-primary">Customer Care</h5>
                                <p class="mb-0"><strong>7625896635</strong></p>
                                <p class="mb-0"><strong>7625896635</strong></p>
                            </div>
                        </div>

                        <hr class="my-3 border-primary">

                        <!-- Patient and Doctor Details -->
                        <div class="row">
                            <!-- Patient Information (Left) -->
                            <div class="col-md-6">
                                <div class="p-3">
                                    <p class="mb-1"><strong>Patient Name:</strong> <?php echo e($patient ? $patient->first_name .' ' .$patient->last_name : 'N/A'); ?></p>
                                    <p class="mb-1"><strong>Age/Sex:</strong> <?php echo e($patient ? \Carbon\Carbon::parse($patient->date_of_birth)->age . ' years / ' . $patient->sex : 'N/A'); ?></p>

                                    <p class="mb-1"><strong>Refered By:</strong><?php echo e($hcp ? $hcp->first_name .' ' .$hcp->last_name : 'N/A'); ?></p>
                                    <p class="mb-1"><strong>Panel Address:</strong> <?php echo e($patient ? $patient->address : 'N/A'); ?></p> 
                                </div>
                            </div>

                            <!-- Doctor Information (Right) -->
                            <div class="col-md-6">
                                <div class="p-3">
                                   <p class="mb-1"><strong>Lab Name:</strong> <?php echo e($labDetails ? $labDetails->first_name .' ' .$labDetails->last_name : 'N/A'); ?></p>
                                    <p class="mb-1"><strong>Lab No:</strong> <?php echo e($labDetails ? $labDetails->cin : 'N/A'); ?></p>
                                    <p class="mb-1"><strong>Reg Date:</strong>  <?php echo e($labDetails ? \Carbon\Carbon::parse($labDetails->created_at)->format('d/M/Y h:i A') : 'N/A'); ?></p>
                                    <p class="mb-1"><strong>Report Date:</strong>  <?php echo e($test_results ? \Carbon\Carbon::parse($test_results->created_at)->format('d/M/Y h:i A') : 'N/A'); ?></p>

                                </div>
                            </div>
                        </div>

                        <hr>
                    </div>
 
                    <table class="test-table">
                        <thead>
                            <tr>
                                <th>Test Name</th>
                                <th>Result</th>
                                <th>Normal Range</th>
                                <th>Units</th>
                                <th>Remarks</th>
                            </tr>
                        </thead>

                        <tbody>

                            <?php if(!empty($test_results['complete_blood_count']) && is_array($test_results['complete_blood_count'])): ?>

                            <!-- Heading Row for Complete Blood Count -->
                            <tr>
                                <td colspan="5" class="text-center font-weight-bold">Complete Blood Count</td>
                            </tr>

                            <?php $__currentLoopData = $test_results['complete_blood_count']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $testResult): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr>
                                <td>
                                    <?php echo e(isset($testResult['test_name']) ? ucfirst(str_replace(['_', '-'], ' ', $testResult['test_name'])) : 'N/A'); ?>

                                </td>
                                <td>
                                    <strong><?php echo e($testResult['result'] ?? 'No Result'); ?></strong>
                                </td>
                                <td class="normal-range">
                                    <?php echo e($testResult['normal_range'] ?? 'Reference range not specified'); ?>

                                </td>
                                <td>
                                    <?php echo e($testResult['units'] ?? '-'); ?>

                                </td>
                                <td class="text-muted">
                                    <em><?php echo e($testResult['remarks'] ?? 'No remarks'); ?></em>
                                </td>
                            </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            <?php else: ?>
                            <tr>
                                <td colspan="5" class="text-center text-muted">No test results available</td>
                            </tr>
                            <?php endif; ?>

                        </tbody>
                    </table>



                  

                    <div class="footer-notes text-muted p-3">
                    <div class="d-flex justify-content-between">
                        <!-- Left Side -->
                        <div class="footer-notes text-muted">
                            <p><small><strong>Note:</strong> Reference ranges vary by age, sex, and method.</small></p>
                            <p><small><strong>Reviewed by:</strong> Dr. Jane Smith, Lab Director.</small></p>
                            <p><small><strong>Next Screening:</strong> 20-Mar-2025.</small></p>
                        </div>


                        <!-- Right Side -->
                        <div class="text-end">
                        <p><small>Dr. <?php echo e($hcp ? $hcp->first_name .' ' .$hcp->last_name : 'N/A'); ?></small></p>
                        <img src="<?php echo e(Storage::url('uploads/labs/' . $labDetails->signature)); ?>" 
                            alt="Dr. Rahul Signature" 
                            style="height: 50px; width: auto;">
                    </div>

                    </div>
                </div>
                </div>
                </div>
                <?php endif; ?>
        


      


                <?php if(!empty($test_results['lipid_profile']) && is_array($test_results['lipid_profile'])): ?>
                <br>
                <div class="col-md-6">
                <div class="container">

                <div class="report-header p-4">
                        <!-- Logo and Customer Care Info -->
                        <div class="d-flex justify-content-between align-items-center mb-3">
                            <img src="https://bluhealth.bluai.ai/admin/assets/images/logo/BluHealth_Logo.png"
                                alt="Lab Logo"
                                style="height: 40px; width: auto;">
                            
                            <div class="text-center">

                            <img src="<?php echo e(Storage::url('uploads/labs/' . $labDetails->photo)); ?>"
                                alt="Lab Logo"
                                style="height: 40px; width: auto;">
                                <h5 class="mb-1 text-primary">Customer Care</h5>
                                <p class="mb-0"><strong>7625896635</strong></p>
                                <p class="mb-0"><strong>7625896635</strong></p>
                            </div>
                        </div>

                        <hr class="my-3 border-primary">

                        <!-- Patient and Doctor Details -->
                        <div class="row">
                            <!-- Patient Information (Left) -->
                            <div class="col-md-6">
                                <div class="p-3">
                                    <p class="mb-1"><strong>Patient Name:</strong> <?php echo e($patient ? $patient->first_name .' ' .$patient->last_name : 'N/A'); ?></p>
                                    <p class="mb-1"><strong>Age/Sex:</strong> <?php echo e($patient ? \Carbon\Carbon::parse($patient->date_of_birth)->age . ' years / ' . $patient->sex : 'N/A'); ?></p>

                                    <p class="mb-1"><strong>Refered By:</strong><?php echo e($hcp ? $hcp->first_name .' ' .$hcp->last_name : 'N/A'); ?></p>
                                    <p class="mb-1"><strong>Panel Address:</strong> <?php echo e($patient ? $patient->address : 'N/A'); ?></p> 
                                </div>
                            </div>

                            <!-- Doctor Information (Right) -->
                            <div class="col-md-6">
                                <div class="p-3">
                                   <p class="mb-1"><strong>Lab Name:</strong> <?php echo e($labDetails ? $labDetails->first_name .' ' .$labDetails->last_name : 'N/A'); ?></p>
                                    <p class="mb-1"><strong>Lab No:</strong> <?php echo e($labDetails ? $labDetails->cin : 'N/A'); ?></p>
                                    <p class="mb-1"><strong>Reg Date:</strong>  <?php echo e($labDetails ? \Carbon\Carbon::parse($labDetails->created_at)->format('d/M/Y h:i A') : 'N/A'); ?></p>
                                    <p class="mb-1"><strong>Report Date:</strong>  <?php echo e($test_results ? \Carbon\Carbon::parse($test_results->created_at)->format('d/M/Y h:i A') : 'N/A'); ?></p>

                                </div>
                            </div>
                        </div>

                        <hr>
                    </div>

                    <table class="test-table">
                        <thead>
                            <tr>
                                <th>Test Name</th>
                                <th>Result</th>
                                <th>Normal Range</th>
                                <th>Units</th>
                                <th>Remarks</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php if(!empty($test_results['lipid_profile']) && is_array($test_results['lipid_profile'])): ?>
                            <tr>
                                <td colspan="5" class="text-center font-weight-bold">Lipid Profile (Lipid Panel)</td>
                            </tr>

                            <?php $__currentLoopData = $test_results['lipid_profile']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $testResult): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr>
                                <td>
                                    <?php echo e(isset($testResult['test_name']) ? ucfirst(str_replace(['_', '-'], ' ', $testResult['test_name'])) : 'N/A'); ?>

                                </td>
                                <td>
                                    <strong><?php echo e($testResult['result'] ?? 'No Result'); ?></strong>
                                </td>
                                <td class="normal-range">
                                    <?php echo e($testResult['normal_range'] ?? 'Reference range not specified'); ?>

                                </td>
                                <td>
                                    <?php echo e($testResult['units'] ?? '-'); ?>

                                </td>
                                <td class="text-muted">
                                    <em><?php echo e($testResult['remarks'] ?? 'No remarks'); ?></em>
                                </td>
                            </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            <?php else: ?>
                            <tr>
                                <td colspan="5" class="text-center text-muted">No test results available</td>
                            </tr>
                            <?php endif; ?>


                        </tbody>
                    </table>


                   

                    <div class="footer-notes text-muted p-3">
                    <div class="d-flex justify-content-between">
                        <!-- Left Side -->
                        <div class="footer-notes text-muted">
                            <p><small><strong>Note:</strong> Reference ranges vary by age, sex, and method.</small></p>
                            <p><small><strong>Reviewed by:</strong> Dr. Jane Smith, Lab Director.</small></p>
                            <p><small><strong>Next Screening:</strong> 20-Mar-2025.</small></p>
                        </div>


                        <!-- Right Side -->
                        <div class="text-end">
                        <p><small>Dr. <?php echo e($hcp ? $hcp->first_name .' ' .$hcp->last_name : 'N/A'); ?></small></p>
                        <img src="<?php echo e(Storage::url('uploads/labs/' . $labDetails->signature)); ?>" 
                            alt="Dr. Rahul Signature" 
                            style="height: 50px; width: auto;">
                    </div>

                    </div>
                </div>
                </div>
                </div>
                <?php endif; ?>
        
     
 

          

                <?php if(!empty($test_results['preoperative']) && is_array($test_results['preoperative'])): ?>
                <br>
                <div class="col-md-6">
                <div class="container">

                <div class="report-header p-4">
                        <!-- Logo and Customer Care Info -->
                        <div class="d-flex justify-content-between align-items-center mb-3">
                            <img src="https://bluhealth.bluai.ai/admin/assets/images/logo/BluHealth_Logo.png"
                                alt="Lab Logo"
                                style="height: 40px; width: auto;">
                            
                            <div class="text-center">

                            <img src="<?php echo e(Storage::url('uploads/labs/' . $labDetails->photo)); ?>"
                                alt="Lab Logo"
                                style="height: 40px; width: auto;">
                                <h5 class="mb-1 text-primary">Customer Care</h5>
                                <p class="mb-0"><strong>7625896635</strong></p>
                                <p class="mb-0"><strong>7625896635</strong></p>
                            </div>
                        </div>

                        <hr class="my-3 border-primary">

                        <!-- Patient and Doctor Details -->
                        <div class="row">
                            <!-- Patient Information (Left) -->
                            <div class="col-md-6">
                                <div class="p-3">
                                    <p class="mb-1"><strong>Patient Name:</strong> <?php echo e($patient ? $patient->first_name .' ' .$patient->last_name : 'N/A'); ?></p>
                                    <p class="mb-1"><strong>Age/Sex:</strong> <?php echo e($patient ? \Carbon\Carbon::parse($patient->date_of_birth)->age . ' years / ' . $patient->sex : 'N/A'); ?></p>

                                    <p class="mb-1"><strong>Refered By:</strong><?php echo e($hcp ? $hcp->first_name .' ' .$hcp->last_name : 'N/A'); ?></p>
                                    <p class="mb-1"><strong>Panel Address:</strong> <?php echo e($patient ? $patient->address : 'N/A'); ?></p> 
                                </div>
                            </div>

                            <!-- Doctor Information (Right) -->
                            <div class="col-md-6">
                                <div class="p-3">
                                   <p class="mb-1"><strong>Lab Name:</strong> <?php echo e($labDetails ? $labDetails->first_name .' ' .$labDetails->last_name : 'N/A'); ?></p>
                                    <p class="mb-1"><strong>Lab No:</strong> <?php echo e($labDetails ? $labDetails->cin : 'N/A'); ?></p>
                                    <p class="mb-1"><strong>Reg Date:</strong>  <?php echo e($labDetails ? \Carbon\Carbon::parse($labDetails->created_at)->format('d/M/Y h:i A') : 'N/A'); ?></p>
                                    <p class="mb-1"><strong>Report Date:</strong>  <?php echo e($test_results ? \Carbon\Carbon::parse($test_results->created_at)->format('d/M/Y h:i A') : 'N/A'); ?></p>

                                </div>
                            </div>
                        </div>

                        <hr>
                    </div>



                    <table class="test-table">
                        <thead>
                            <tr>
                                <th>Test Name</th>
                                <th>Result</th>
                                <th>Normal Range</th>
                                <th>Units</th>
                                <th>Remarks</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php if(!empty($test_results['preoperative']) && is_array($test_results['preoperative'])): ?>
                            <tr>
                                <td colspan="5" class="text-center font-weight-bold"> Preoperative (Pre-op)</td>
                            </tr>
                            <?php $__currentLoopData = $test_results['preoperative']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $testResult): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr>
                                <td>
                                    <?php echo e(isset($testResult['test_name']) ? ucfirst(str_replace(['_', '-'], ' ', $testResult['test_name'])) : 'N/A'); ?>

                                </td>
                                <td>
                                    <strong><?php echo e($testResult['result'] ?? 'No Result'); ?></strong>
                                </td>
                                <td class="normal-range">
                                    <?php echo e($testResult['normal_range'] ?? 'Reference range not specified'); ?>

                                </td>
                                <td>
                                    <?php echo e($testResult['units'] ?? '-'); ?>

                                </td>
                                <td class="text-muted">
                                    <em><?php echo e($testResult['remarks'] ?? 'No remarks'); ?></em>
                                </td>
                            </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            <?php else: ?>
                            <tr>
                                <td colspan="5" class="text-center text-muted">No test results available</td>
                            </tr>
                            <?php endif; ?>


                            <br>


                        </tbody>
                    </table>


                 

                    <div class="footer-notes text-muted p-3">
                    <div class="d-flex justify-content-between">
                        <!-- Left Side -->
                        <div class="footer-notes text-muted">
                            <p><small><strong>Note:</strong> Reference ranges vary by age, sex, and method.</small></p>
                            <p><small><strong>Reviewed by:</strong> Dr. Jane Smith, Lab Director.</small></p>
                            <p><small><strong>Next Screening:</strong> 20-Mar-2025.</small></p>
                        </div>


                        <!-- Right Side -->
                        <div class="text-end">
                        <p><small>Dr. <?php echo e($hcp ? $hcp->first_name .' ' .$hcp->last_name : 'N/A'); ?></small></p>
                        <img src="<?php echo e(Storage::url('uploads/labs/' . $labDetails->signature)); ?>" 
                            alt="Dr. Rahul Signature" 
                            style="height: 50px; width: auto;">
                    </div>

                    </div>
                </div>
                </div>
                </div>

                <?php endif; ?>

           




                <br>
                <?php if(!empty($test_results['acute_illness']) && is_array($test_results['acute_illness'])): ?>
             
                <div class="col-md-6">
                <div class="container">

                <div class="report-header p-4">
                        <!-- Logo and Customer Care Info -->
                        <div class="d-flex justify-content-between align-items-center mb-3">
                            <img src="https://bluhealth.bluai.ai/admin/assets/images/logo/BluHealth_Logo.png"
                                alt="Lab Logo"
                                style="height: 40px; width: auto;">
                            
                            <div class="text-center">

                            <img src="<?php echo e(Storage::url('uploads/labs/' . $labDetails->photo)); ?>"
                                alt="Lab Logo"
                                style="height: 40px; width: auto;">
                                <h5 class="mb-1 text-primary">Customer Care</h5>
                                <p class="mb-0"><strong>7625896635</strong></p>
                                <p class="mb-0"><strong>7625896635</strong></p>
                            </div>
                        </div>

                        <hr class="my-3 border-primary">

                        <!-- Patient and Doctor Details -->
                        <div class="row">
                            <!-- Patient Information (Left) -->
                            <div class="col-md-6">
                                <div class="p-3">
                                    <p class="mb-1"><strong>Patient Name:</strong> <?php echo e($patient ? $patient->first_name .' ' .$patient->last_name : 'N/A'); ?></p>
                                    <p class="mb-1"><strong>Age/Sex:</strong> <?php echo e($patient ? \Carbon\Carbon::parse($patient->date_of_birth)->age . ' years / ' . $patient->sex : 'N/A'); ?></p>

                                    <p class="mb-1"><strong>Refered By:</strong><?php echo e($hcp ? $hcp->first_name .' ' .$hcp->last_name : 'N/A'); ?></p>
                                    <p class="mb-1"><strong>Panel Address:</strong> <?php echo e($patient ? $patient->address : 'N/A'); ?></p> 
                                </div>
                            </div>

                            <!-- Doctor Information (Right) -->
                            <div class="col-md-6">
                                <div class="p-3">
                                   <p class="mb-1"><strong>Lab Name:</strong> <?php echo e($labDetails ? $labDetails->lab_name  : 'N/A'); ?></p>
                                    <p class="mb-1"><strong>Lab No:</strong> <?php echo e($labDetails ? $labDetails->cin : 'N/A'); ?></p>
                                    <p class="mb-1"><strong>Reg Date:</strong>  <?php echo e($labDetails ? \Carbon\Carbon::parse($labDetails->created_at)->format('d/M/Y h:i A') : 'N/A'); ?></p>
                                    <p class="mb-1"><strong>Report Date:</strong>  <?php echo e($test_results ? \Carbon\Carbon::parse($test_results->created_at)->format('d/M/Y h:i A') : 'N/A'); ?></p>

                                </div>
                            </div>
                        </div>

                        <hr>
                    </div>


                    <table class="test-table">
                        <thead>
                            <tr>
                                <th>Test Name</th>
                                <th>Result</th>
                                <th>Normal Range</th>
                                <th>Units</th>
                                <th>Remarks</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php if(!empty($test_results['acute_illness']) && is_array($test_results['acute_illness'])): ?>
                            <tr>
                                <td colspan="5" class="text-center font-weight-bold"> Acute Illness</td>
                            </tr>
                            <?php $__currentLoopData = $test_results['acute_illness']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $testResult): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr>
                                <td>
                                    <?php echo e(isset($testResult['test_name']) ? ucfirst(str_replace(['_', '-'], ' ', $testResult['test_name'])) : 'N/A'); ?>

                                </td>
                                <td>
                                    <strong><?php echo e($testResult['result'] ?? 'No Result'); ?></strong>
                                </td>
                                <td class="normal-range">
                                    <?php echo e($testResult['normal_range'] ?? 'Reference range not specified'); ?>

                                </td>
                                <td>
                                    <?php echo e($testResult['units'] ?? '-'); ?>

                                </td>
                                <td class="text-muted">
                                    <em><?php echo e($testResult['remarks'] ?? 'No remarks'); ?></em>
                                </td>
                            </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            <?php else: ?>
                            <tr>
                                <td colspan="5" class="text-center text-muted">No test results available</td>
                            </tr>
                            <?php endif; ?>

                        </tbody>
                    </table>


                    <div class="footer-notes text-muted p-3">
                    <div class="d-flex justify-content-between">
                        <!-- Left Side -->
                        <div class="footer-notes text-muted">
                            <p><small><strong>Note:</strong> Reference ranges vary by age, sex, and method.</small></p>
                            <p><small><strong>Reviewed by:</strong> Dr. Jane Smith, Lab Director.</small></p>
                            <p><small><strong>Next Screening:</strong> 20-Mar-2025.</small></p>
                        </div>


                        <!-- Right Side -->
                        <div class="text-end">
                        <p><small>Dr. <?php echo e($hcp ? $hcp->first_name .' ' .$hcp->last_name : 'N/A'); ?></small></p>
                        <img src="<?php echo e(Storage::url('uploads/labs/' . $labDetails->signature)); ?>" 
                            alt="Dr. Rahul Signature" 
                            style="height: 50px; width: auto;">
                    </div>

                    </div>
                </div>

                </div>
                </div>
                <?php endif; ?>
           
        </div>

</body>

</html>

<div class="text-center mt-3">
    <a href="<?php echo e(route('labs.labtest')); ?>" class="btn btn-sm btn-secondary">Back to Lab List</a>
</div>



<?php $__env->stopSection(); ?>;
<?php echo $__env->make('labs.layout.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/resources/views/labs/viewreport.blade.php ENDPATH**/ ?>