<?php $__template->layout('Layout.main'); ?>
<?php $__template->section('title'); ?>تأمينات فترة: <?= e($period->period_code) ?><?php $__template->endSection(); ?>
<?php $__template->section('page_actions'); ?><a href="/hr/insurance" class="btn btn-secondary">رجوع</a><?php $__template->endSection(); ?>
<?php $__template->section('content'); ?>
<?php if ($totals): ?>
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:12px;margin-bottom:20px;">
    <div class="card" style="padding:16px;text-align:center;"><div style="font-size:13px;color:#6B7280;">حصة الموظفين</div><div style="font-size:18px;font-weight:700;"><?= number_format((float) ($totals['total_employee_share'] ?? 0), 2) ?></div></div>
    <div class="card" style="padding:16px;text-align:center;"><div style="font-size:13px;color:#6B7280;">حصة صاحب العمل</div><div style="font-size:18px;font-weight:700;"><?= number_format((float) ($totals['total_employer_share'] ?? 0), 2) ?></div></div>
    <div class="card" style="padding:16px;text-align:center;"><div style="font-size:13px;color:#6B7280;">الإجمالي</div><div style="font-size:18px;font-weight:700;color:#2563EB;"><?= number_format(((float) ($totals['total_employee_share'] ?? 0)) + ((float) ($totals['total_employer_share'] ?? 0)), 2) ?></div></div>
</div>
<?php endif; ?>
<div class="card">
    <div class="table-responsive">
        <table class="data-table">
            <thead><tr><th>الموظف</th><th>أساسي مؤمن</th><th>متغير مؤمن</th><th>حصة الموظف</th><th>حصة صاحب العمل</th></tr></thead>
            <tbody>
                <?php foreach ($records as $r): ?>
                <tr>
                    <td><a href="/hr/insurance/employee/<?= (int) $r['employee_profile_id'] ?>"><?= e(($r['first_name_ar'] ?? '') . ' ' . ($r['last_name_ar'] ?? '')) ?></a></td>
                    <td><?= number_format((float) $r['basic_insurable_salary'], 2) ?></td>
                    <td><?= number_format((float) $r['variable_insurable_salary'], 2) ?></td>
                    <td><?= number_format((float) $r['total_employee_share'], 2) ?></td>
                    <td><?= number_format((float) $r['total_employer_share'], 2) ?></td>
                </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
    </div>
</div>
<?php $__template->endSection(); ?>
