<?= $this->extend('layouts/enterprise') ?>

<?= $this->section('content') ?>

<?= view('partials/workspace_hero', [
    'workspaceCrumbPill'    => 'Accounting',
    'workspaceCrumbCurrent' => 'Edit Receipt Voucher',
    'workspaceTitle'        => 'Update Receipt Voucher',
    'workspaceDesc'         => 'Revise receipt voucher details before posting.',
]) ?>

<article class="enterprise-settings-card" style="max-width:960px;">
    <div class="enterprise-settings-card__head">
        <i class="fa-solid fa-receipt"></i>
        <h2 class="enterprise-settings-card__title">Receipt Voucher Details</h2>
    </div>

    <?php if (! empty($voucher['number'])): ?>
        <p class="text-muted small mb-3">Receipt voucher <code><?= esc($voucher['number']) ?></code></p>
    <?php endif; ?>

    <?php if (session()->getFlashdata('errors')): ?>
        <div class="alert alert-danger py-2 small">
            <ul class="mb-0 ps-3">
                <?php foreach ((array) session()->getFlashdata('errors') as $err): ?>
                    <li><?= esc(is_array($err) ? implode(', ', $err) : $err) ?></li>
                <?php endforeach; ?>
            </ul>
        </div>
    <?php endif; ?>

    <form action="<?= base_url('accounting/receipt-vouchers/' . $voucher['id']) ?>" method="post" novalidate>
        <?= csrf_field() ?>
        <?= $this->include('Modules\Accounting\Views\receipt_vouchers\_form') ?>
        <div class="enterprise-settings-card__footer">
            <a href="<?= base_url('accounting/receipt-vouchers/' . $voucher['id']) ?>" class="btn btn-outline-secondary">Cancel</a>
            <button type="submit" class="btn btn-primary">Save Changes</button>
        </div>
    </form>
</article>

<?= $this->endSection() ?>
