<?php echo message_box('success') ?>
<?php echo message_box('error') ?>

<div class="space-y-6">
    <form action="<?php echo base_url() ?>admin/settings/save_transactions" enctype="multipart/form-data" method="post" class="space-y-6">
        <div class="rounded-2xl border border-border bg-card shadow-sm">
            <div class="flex items-center justify-between border-b border-border px-6 py-4">
                <div>
                    <h3 class="text-lg font-semibold text-foreground"><?= lang('transactions') . ' ' . lang('settings') ?></h3>
                    <p class="text-sm text-muted-foreground"><?= lang('manage') . ' ' . lang('transactions') ?></p>
                </div>
                <button type="submit" class="inline-flex items-center justify-center gap-2 rounded-lg bg-primary px-6 py-2.5 text-sm font-medium text-primary-foreground shadow-sm hover:bg-primary/90 transition-colors">
                    <i data-lucide="save" class="h-4 w-4"></i>
                    <?= lang('save_changes') ?>
                </button>
            </div>
            <div class="p-6 space-y-6">
                <input type="hidden" name="settings" value="<?= $load_setting ?>">

                <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
                    <div class="rounded-xl border border-border bg-card p-5 space-y-4">
                        <div class="flex items-center gap-2 border-b border-border pb-3">
                            <i data-lucide="arrow-down-left" class="h-5 w-5"></i>
                            <h4 class="text-base font-semibold text-foreground"><?= lang('deposit') ?></h4>
                        </div>
                        <?= form_input_group('deposit_prefix', lang('deposit_prefix'), config_item('deposit_prefix'), 'text', true, array('class' => 'max-w-xs')) ?>
                        <?= form_input_group('deposit_start_no', lang('deposit_start_no'), config_item('deposit_start_no'), 'text', true, array('class' => 'max-w-xs')) ?>
                        <div class="space-y-2">
                            <label class="text-sm font-medium text-foreground"><?= lang('deposit') . ' ' . lang('number_format') ?></label>
                            <input type="text" name="deposit_number_format" class="w-full rounded-lg border border-border bg-input px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-secondary/30 max-w-lg" value="<?php
                            if (empty(config_item('deposit_number_format'))) {
                                echo '[' . config_item('deposit_prefix') . ']' . '[yyyy][mm][dd][number]';
                            } else {
                                echo config_item('deposit_number_format');
                            }
                            ?>">
                            <p class="text-xs text-muted-foreground">ex [<?= config_item('deposit_prefix') ?>] = <?= lang('deposit_prefix') ?>,[yyyy] = 'Current Year (<?= date('Y') ?>)'[yy] ='Current Year (<?= date('y') ?>)',[mm] = 'Current Month(<?= date('M') ?>)',[m] = 'Current Month(<?= date('m') ?>)',[dd] = 'Current Date (<?= date('d') ?>)',[number] = 'Invoice Number (<?= sprintf('%04d', config_item('deposit_start_no')) ?>)'</p>
                        </div>
                    </div>

                    <div class="rounded-xl border border-border bg-card p-5 space-y-4">
                        <div class="flex items-center gap-2 border-b border-border pb-3">
                            <i data-lucide="arrow-up-right" class="h-5 w-5"></i>
                            <h4 class="text-base font-semibold text-foreground"><?= lang('expense') ?></h4>
                        </div>
                        <?= form_input_group('expense_prefix', lang('expense_prefix'), config_item('expense_prefix'), 'text', true, array('class' => 'max-w-xs')) ?>
                        <?= form_input_group('expense_start_no', lang('expense_start_no'), config_item('expense_start_no'), 'text', true, array('class' => 'max-w-xs')) ?>
                        <div class="space-y-2">
                            <label class="text-sm font-medium text-foreground"><?= lang('expense') . ' ' . lang('number_format') ?></label>
                            <input type="text" name="expense_number_format" class="w-full rounded-lg border border-border bg-input px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-secondary/30 max-w-lg" value="<?php
                            if (empty(config_item('expense_number_format'))) {
                                echo '[' . config_item('expense_prefix') . ']' . '[yyyy][mm][dd][number]';
                            } else {
                                echo config_item('expense_number_format');
                            }
                            ?>">
                            <p class="text-xs text-muted-foreground">ex [<?= config_item('expense_prefix') ?>] = <?= lang('expense_prefix') ?>,[yyyy] = 'Current Year (<?= date('Y') ?>)'[yy] ='Current Year (<?= date('y') ?>)',[mm] = 'Current Month(<?= date('M') ?>)',[m] = 'Current Month(<?= date('m') ?>)',[dd] = 'Current Date (<?= date('d') ?>)',[number] = 'Invoice Number (<?= sprintf('%04d', config_item('expense_start_no')) ?>)'</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>
