<?php
session_start();

require_once __DIR__ . '/../../../includes/helpers.php';
require_once __DIR__ . '/../../../includes/layout.php';
require_once __DIR__ . '/../../../includes/expense_shell.php';

if (!isset($_SESSION['authenticated'])) {
    redirect(page_url('signin'));
}

$rows = range(1, 5);

render_expense_shell_start('Bulk Add Expenses | Expense', 'dashboard-page expense-page', 'expenses');
?>
<div class="page-surface page-surface--white">
    <header class="expense-subnav">
        <nav class="expense-tabs" aria-label="Expense tabs">
            <a class="expense-tab" href="<?= e(route_url('expenses/new/')) ?>">
                <i class="fa-regular fa-square-plus"></i>
                <span>Add Expense</span>
            </a>
            <a class="expense-tab is-active" href="<?= e(route_url('expenses/new/bulkadd/')) ?>">
                <i class="fa-regular fa-table-cells-large"></i>
                <span>Bulk Add Expenses</span>
            </a>
            <a class="expense-tab" href="<?= e(route_url('expenses/new/transactions/')) ?>">
                <i class="fa-regular fa-credit-card"></i>
                <span>From Cards</span>
            </a>
        </nav>
        <a class="page-close-button" href="<?= e(page_url('dashboard')) ?>" aria-label="Close">
            <i class="fa-solid fa-xmark" aria-hidden="true"></i>
        </a>
    </header>

    <section class="bulk-expense-panel">
        <label class="expense-field expense-field--report">
            <span>Report</span>
            <select>
                <option>Select</option>
            </select>
        </label>

        <div class="bulk-grid-wrap">
            <div class="bulk-grid-head">
                <span></span>
                <span></span>
                <span>EXPENSE DATE *</span>
                <span>MERCHANT</span>
                <span>CATEGORY *</span>
                <span>AMOUNT *</span>
                <span>TAX</span>
                <span>TAX INCLUSIVE</span>
                <span>REIMBURSABLE</span>
                <span>REFERENCE#</span>
            </div>

            <?php foreach ($rows as $row): ?>
                <div class="bulk-grid-row">
                    <span class="bulk-row-index"><?= $row ?></span>
                    <button type="button" class="bulk-row-add">+</button>
                    <input type="text" placeholder="eg: 31/01/2025">
                    <input type="text" placeholder="Select or type to add">
                    <select>
                        <option>Select</option>
                    </select>
                    <div class="bulk-amount-cell">
                        <select>
                            <option>INR</option>
                        </select>
                        <input type="text" value="0.00">
                    </div>
                    <select><option>Select</option></select>
                    <label class="bulk-check"><input type="checkbox"></label>
                    <label class="bulk-check bulk-check--active"><input type="checkbox" checked></label>
                    <input type="text">
                </div>
            <?php endforeach; ?>
        </div>

        <a class="bulk-add-more" href="#">
            <i class="fa-solid fa-circle-plus"></i>
            <span>Add More Expenses</span>
        </a>

        <footer class="expense-actions expense-actions--left">
            <a class="expense-primary" href="<?= e(page_url('dashboard')) ?>">Save</a>
            <a class="expense-ghost" href="<?= e(page_url('dashboard')) ?>">Cancel</a>
        </footer>
    </section>
</div>
<?php render_expense_shell_end(); ?>
