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

<?= view('partials/workspace_hero', [
    'workspaceCrumbPill'  => 'HRM',
    'workspaceCrumbCurrent' => 'New Payroll Run',
    'workspaceTitle'      => 'Create Payroll Run',
    'workspaceDesc'       => 'Select the payroll period. Employees with salary structures will be processed on calculate.',
]) ?>

<article class="enterprise-settings-card" style="max-width:480px;">
    <form action="<?= base_url('payroll/runs') ?>" method="post" novalidate data-tpin-confirm>
        <?= csrf_field() ?>
        <div class="enterprise-settings-fields enterprise-settings-fields--single">
            <div class="enterprise-field">
                <label class="enterprise-field-label">Year</label>
                <input type="number" name="period_year" class="form-control" value="<?= esc(old('period_year', $year)) ?>" required>
            </div>
            <div class="enterprise-field">
                <label class="enterprise-field-label">Month</label>
                <select name="period_month" class="form-select" required>
                    <?php for ($m = 1; $m <= 12; $m++): ?>
                        <option value="<?= $m ?>" <?= (int) old('period_month', $month) === $m ? 'selected' : '' ?>>
                            <?= date('F', mktime(0, 0, 0, $m, 1)) ?>
                        </option>
                    <?php endfor; ?>
                </select>
            </div>
        </div>
        <div class="enterprise-settings-card__footer">
            <a href="<?= base_url('payroll/runs') ?>" class="btn btn-outline-secondary">Cancel</a>
            <button type="submit" class="btn btn-primary">Create Run</button>
        </div>
    </form>
</article>
<?= view('Modules\Tpin\Views\partials\verify_modal') ?>

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