<?= $this->extend('client/layout/main') ?>
<?= $this->section('content') ?>
<h3 class="mb-2"><?= lang('App.welcome') ?>, <?= esc(session()->get('client_name')) ?></h3>
<p class="text-muted mb-4">إجمالي غير مدفوع: <?= number_format($unpaidTotal, 2) ?></p>

<div class="row">
    <div class="col-md-6">
        <div class="card p-3">
            <h6><?= lang('App.my_invoices') ?></h6>
            <?php foreach ($invoices as $inv): ?>
                <div class="d-flex justify-content-between border-bottom py-2 small">
                    <span><?= esc($inv['invoice_number']) ?></span>
                    <span><?= number_format($inv['amount'], 2) ?> <?= esc($inv['currency']) ?></span>
                    <span><?= lang('App.' . $inv['status']) ?></span>
                </div>
            <?php endforeach; ?>
            <?php if (empty($invoices)): ?><p class="text-muted small"><?= lang('App.no_data') ?></p><?php endif; ?>
        </div>
    </div>
    <div class="col-md-6">
        <div class="card p-3">
            <h6><?= lang('App.my_services') ?></h6>
            <?php foreach ($services as $s): ?>
                <div class="d-flex justify-content-between border-bottom py-2 small">
                    <span><?= esc($s['name']) ?></span>
                    <span><?= esc($s['renewal_date']) ?></span>
                </div>
            <?php endforeach; ?>
            <?php if (empty($services)): ?><p class="text-muted small"><?= lang('App.no_data') ?></p><?php endif; ?>
        </div>
    </div>
</div>
<?= $this->endSection() ?>
