<?php
    $preview = $preview ?? null;
    $showActions = $showActions ?? true;
?>

<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($preview): ?>
    <?php
        $company = $preview['company'] ?? [];
        $employee = $preview['employee'] ?? [];
        $totals = $preview['totals'] ?? [];
        $earnings = collect($preview['earnings'] ?? []);
        $deductions = collect($preview['deductions'] ?? []);
        $lopValue = (float) ($employee['lop_days'] ?? 0);
    ?>

    <?php if (isset($component)) { $__componentOriginal53747ceb358d30c0105769f8471417f6 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal53747ceb358d30c0105769f8471417f6 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.card','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('card'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($showActions): ?>
            <div class="mb-4 flex flex-wrap items-center justify-end gap-2">
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(class_exists(\Barryvdh\DomPDF\Facade\Pdf::class)): ?>
                    <a href="<?php echo e($preview['pdf_url'] ?? '#'); ?>" target="_blank" class="rounded-lg border border-slate-300 bg-white px-3 py-1.5 text-sm font-medium text-slate-700 hover:bg-slate-50">Download PDF</a>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                <a href="<?php echo e($preview['view_url'] ?? '#'); ?>" class="rounded-lg border border-slate-300 bg-white px-3 py-1.5 text-sm font-medium text-slate-700 hover:bg-slate-50">Open Full Payslip</a>
            </div>
        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

        <div class="mx-auto max-w-5xl rounded-lg border border-slate-300 bg-white p-4 text-slate-800">
            <div class="mb-3 flex items-start justify-between gap-6">
                <div>
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(! empty($company['logo_url'])): ?>
                        <img src="<?php echo e($company['logo_url']); ?>" alt="<?php echo e($company['name'] ?? config('app.name')); ?>" class="h-12 w-auto object-contain">
                    <?php else: ?>
                        <div class="text-base font-bold tracking-tight text-cyan-700"><?php echo e($company['name'] ?? config('app.name')); ?></div>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                </div>
                <div class="text-right">
                    <div class="text-xl font-bold text-slate-800"><?php echo e($company['name'] ?? config('app.name')); ?></div>
                    <div class="text-sm text-slate-600"><?php echo e($company['address'] ?? 'N/A'); ?></div>
                    <div class="text-sm text-slate-600"><?php echo e($company['email'] ?? 'N/A'); ?></div>
                    <div class="text-sm text-slate-600"><?php echo e($company['phone'] ?? 'N/A'); ?></div>
                </div>
            </div>

            <div class="my-3 border-t-2 border-slate-500"></div>
            <h2 class="text-center text-2xl font-semibold text-slate-800">Pay Slip For Duration <?php echo e($preview['period'] ?? 'N/A'); ?></h2>
            <div class="my-3 border-t-2 border-slate-500"></div>

            <div class="border border-slate-300 p-3">
                <div class="grid grid-cols-1 gap-y-2 text-sm md:grid-cols-2 md:gap-x-8">
                    <div class="grid grid-cols-[150px_1fr]"><div class="font-semibold">Name:</div><div><?php echo e($employee['name'] ?? 'N/A'); ?></div></div>
                    <div class="grid grid-cols-[150px_1fr]"><div class="font-semibold">Employee ID:</div><div><?php echo e($employee['employee_id'] ?? 'N/A'); ?></div></div>
                    <div class="grid grid-cols-[150px_1fr]"><div class="font-semibold">Designation:</div><div><?php echo e($employee['designation'] ?? 'N/A'); ?></div></div>
                    <div class="grid grid-cols-[150px_1fr]"><div class="font-semibold">Bank Name:</div><div><?php echo e($employee['bank_name'] ?? 'N/A'); ?></div></div>
                    <div class="grid grid-cols-[150px_1fr]"><div class="font-semibold">Department:</div><div><?php echo e($employee['department'] ?? 'N/A'); ?></div></div>
                    <div class="grid grid-cols-[150px_1fr]"><div class="font-semibold">Bank Account No:</div><div><?php echo e($employee['bank_account_no'] ?? 'N/A'); ?></div></div>
                    <div class="grid grid-cols-[150px_1fr]"><div class="font-semibold">Location:</div><div><?php echo e($employee['location'] ?? 'N/A'); ?></div></div>
                    <div class="grid grid-cols-[150px_1fr]"><div class="font-semibold">IFSC Code:</div><div><?php echo e($employee['ifsc_code'] ?? 'N/A'); ?></div></div>
                    <div class="grid grid-cols-[150px_1fr]"><div class="font-semibold">Effective Work Days:</div><div><?php echo e((int) ($employee['work_days'] ?? 0)); ?></div></div>
                    <div class="grid grid-cols-[150px_1fr]"><div class="font-semibold">PAN No:</div><div><?php echo e(strtoupper($employee['pan_no'] ?? 'N/A')); ?></div></div>
                    <div class="grid grid-cols-[150px_1fr]"><div class="font-semibold">LOP:</div><div><?php echo e(rtrim(rtrim(number_format($lopValue, 2, '.', ''), '0'), '.')); ?></div></div>
                </div>
            </div>

            <div class="mt-4 overflow-hidden border border-slate-300">
                <div class="grid grid-cols-1 md:grid-cols-2">
                    <div class="md:border-r md:border-slate-300">
                        <table class="w-full">
                            <thead>
                                <tr class="border-b border-slate-300">
                                    <th class="px-4 py-2 text-left text-sm font-semibold">Earnings</th>
                                    <th class="px-4 py-2 text-right text-sm font-semibold">Amount</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__empty_1 = true; $__currentLoopData = $earnings; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $line): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                    <tr>
                                        <td class="px-4 py-1.5 text-sm"><?php echo e($line['name'] ?? 'Earning'); ?></td>
                                        <td class="px-4 py-1.5 text-right text-sm">₹<?php echo e(number_format((float) ($line['amount'] ?? 0), 2)); ?></td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                    <tr>
                                        <td colspan="2" class="px-4 py-2 text-sm text-slate-500">No earnings lines available.</td>
                                    </tr>
                                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                <tr class="font-semibold">
                                    <td class="px-4 py-2 text-sm">Total Earnings (Rs)</td>
                                    <td class="px-4 py-2 text-right text-sm">₹<?php echo e(number_format((float) ($totals['earnings'] ?? 0), 2)); ?></td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div>
                        <table class="w-full">
                            <thead>
                                <tr class="border-b border-slate-300">
                                    <th class="px-4 py-2 text-left text-sm font-semibold">Deductions</th>
                                    <th class="px-4 py-2 text-right text-sm font-semibold">Amount</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__empty_1 = true; $__currentLoopData = $deductions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $line): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                    <tr>
                                        <td class="px-4 py-1.5 text-sm"><?php echo e($line['name'] ?? 'Deduction'); ?></td>
                                        <td class="px-4 py-1.5 text-right text-sm">₹<?php echo e(number_format(abs((float) ($line['amount'] ?? 0)), 2)); ?></td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                    <tr>
                                        <td colspan="2" class="px-4 py-2 text-sm text-slate-500">No deductions lines available.</td>
                                    </tr>
                                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                <tr class="font-semibold">
                                    <td class="px-4 py-2 text-sm">Total Deductions (Rs)</td>
                                    <td class="px-4 py-2 text-right text-sm">₹<?php echo e(number_format((float) ($totals['deductions'] ?? 0), 2)); ?></td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>

            <div class="mt-4 text-lg font-semibold">Net Pay For The Month: ₹<?php echo e(number_format((float) ($totals['net'] ?? 0), 2)); ?></div>
            <div class="mt-2 text-sm text-slate-700"><?php echo e($totals['net_in_words'] ?? ''); ?></div>
            <div class="mt-4 border-t border-slate-300"></div>
            <div class="mt-2 text-center text-xs text-slate-500">This is a system generated payslip and does not require signature.</div>
        </div>
     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal53747ceb358d30c0105769f8471417f6)): ?>
<?php $attributes = $__attributesOriginal53747ceb358d30c0105769f8471417f6; ?>
<?php unset($__attributesOriginal53747ceb358d30c0105769f8471417f6); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal53747ceb358d30c0105769f8471417f6)): ?>
<?php $component = $__componentOriginal53747ceb358d30c0105769f8471417f6; ?>
<?php unset($__componentOriginal53747ceb358d30c0105769f8471417f6); ?>
<?php endif; ?>
<?php else: ?>
    <?php if (isset($component)) { $__componentOriginal53747ceb358d30c0105769f8471417f6 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal53747ceb358d30c0105769f8471417f6 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.card','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('card'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
        <div class="py-16 text-center">
            <h3 class="text-base font-semibold text-slate-800">No payslip selected</h3>
            <p class="mt-1 text-sm text-slate-500">Select a payslip from the left panel to preview it here.</p>
        </div>
     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal53747ceb358d30c0105769f8471417f6)): ?>
<?php $attributes = $__attributesOriginal53747ceb358d30c0105769f8471417f6; ?>
<?php unset($__attributesOriginal53747ceb358d30c0105769f8471417f6); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal53747ceb358d30c0105769f8471417f6)): ?>
<?php $component = $__componentOriginal53747ceb358d30c0105769f8471417f6; ?>
<?php unset($__componentOriginal53747ceb358d30c0105769f8471417f6); ?>
<?php endif; ?>
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
<?php /**PATH /var/www/html/kiyohr/v2_version/resources/views/payroll/my/partials/payslip-preview.blade.php ENDPATH**/ ?>