<?php $__env->startSection('title', __('messages.general_settings')); ?>

<?php $__env->startSection('content'); ?>
<div class="d-flex align-items-center justify-content-between mb-3">
    <div>
        <h5 class="fw-bold mb-0">General ERP Preferences</h5>
        <span class="text-muted fs-xs">Date Formats, Timezone (Asia/Riyadh), Decimal Precision & Operational Feature Flags</span>
    </div>
</div>

<div class="card-erp p-3">
    <form method="POST" action="<?php echo e(route('settings.general.update')); ?>">
        <?php echo csrf_field(); ?>

        <div class="row g-3 mb-3">
            <div class="col-md-4">
                <label class="form-label small fw-semibold">Date Format</label>
                <select name="date_format" class="form-select form-select-sm" required>
                    <option value="Y-m-d" <?php echo e(old('date_format', $settings->date_format) === 'Y-m-d' ? 'selected' : ''); ?>>YYYY-MM-DD (2026-08-11)</option>
                    <option value="d-m-Y" <?php echo e(old('date_format', $settings->date_format) === 'd-m-Y' ? 'selected' : ''); ?>>DD-MM-YYYY (11-08-2026)</option>
                    <option value="d/m/Y" <?php echo e(old('date_format', $settings->date_format) === 'd/m/Y' ? 'selected' : ''); ?>>DD/MM/YYYY (11/08/2026)</option>
                </select>
            </div>
            <div class="col-md-4">
                <label class="form-label small fw-semibold">Timezone</label>
                <input type="text" name="timezone" class="form-control form-control-sm font-monospace fw-bold" value="<?php echo e(old('timezone', $settings->timezone)); ?>" readonly>
            </div>
            <div class="col-md-4">
                <label class="form-label small fw-semibold">Default Currency</label>
                <input type="text" name="currency" class="form-control form-control-sm font-monospace fw-bold" value="<?php echo e(old('currency', $settings->currency)); ?>" readonly>
            </div>
        </div>

        <h6 class="fw-bold border-bottom pb-2 mt-4 text-primary"><i class="bi bi-calculator me-1"></i> Decimal Precision Configuration</h6>
        <div class="row g-3 mb-3">
            <div class="col-md-4">
                <label class="form-label small fw-semibold">Monetary Decimal Places</label>
                <select name="monetary_decimal_places" class="form-select form-select-sm" required>
                    <option value="2" <?php echo e(old('monetary_decimal_places', $settings->monetary_decimal_places) == 2 ? 'selected' : ''); ?>>2 Decimal Places (SAR 0.00)</option>
                </select>
            </div>
            <div class="col-md-4">
                <label class="form-label small fw-semibold">Quantity Decimal Places</label>
                <select name="quantity_decimal_places" class="form-select form-select-sm" required>
                    <option value="2" <?php echo e(old('quantity_decimal_places', $settings->quantity_decimal_places) == 2 ? 'selected' : ''); ?>>2 Decimals (0.00)</option>
                    <option value="3" <?php echo e(old('quantity_decimal_places', $settings->quantity_decimal_places) == 3 ? 'selected' : ''); ?>>3 Decimals (0.000)</option>
                    <option value="4" <?php echo e(old('quantity_decimal_places', $settings->quantity_decimal_places) == 4 ? 'selected' : ''); ?>>4 Decimals (0.0000)</option>
                </select>
            </div>
            <div class="col-md-4">
                <label class="form-label small fw-semibold">Cost Price Decimal Places</label>
                <select name="cost_decimal_places" class="form-select form-select-sm" required>
                    <option value="2" <?php echo e(old('cost_decimal_places', $settings->cost_decimal_places) == 2 ? 'selected' : ''); ?>>2 Decimals (0.00)</option>
                    <option value="4" <?php echo e(old('cost_decimal_places', $settings->cost_decimal_places) == 4 ? 'selected' : ''); ?>>4 Decimals (0.0000)</option>
                </select>
            </div>
        </div>

        <h6 class="fw-bold border-bottom pb-2 mt-4 text-primary"><i class="bi bi-toggle-on me-1"></i> Operational Feature Flags</h6>
        <div class="row g-3 mb-4">
            <div class="col-md-4">
                <div class="form-check border rounded p-2 bg-light">
                    <input type="checkbox" name="enable_barcode" value="1" class="form-check-input" id="fBarcode" <?php echo e(old('enable_barcode', $settings->enable_barcode) ? 'checked' : ''); ?>>
                    <label class="form-check-label small fw-semibold" for="fBarcode">Enable Barcode Entry</label>
                </div>
            </div>
            <div class="col-md-4">
                <div class="form-check border rounded p-2 bg-light">
                    <input type="checkbox" name="enable_multiple_warehouse" value="1" class="form-check-input" id="fWh" <?php echo e(old('enable_multiple_warehouse', $settings->enable_multiple_warehouse) ? 'checked' : ''); ?>>
                    <label class="form-check-label small fw-semibold" for="fWh">Enable Multiple Warehouses</label>
                </div>
            </div>
            <div class="col-md-4">
                <div class="form-check border rounded p-2 bg-light">
                    <input type="checkbox" name="enable_van_stock" value="1" class="form-check-input" id="fVan" <?php echo e(old('enable_van_stock', $settings->enable_van_stock) ? 'checked' : ''); ?>>
                    <label class="form-check-label small fw-semibold" for="fVan">Enable Van Sales / Van Stock</label>
                </div>
            </div>
            <div class="col-md-4">
                <div class="form-check border rounded p-2 bg-light border-danger">
                    <input type="checkbox" name="allow_negative_stock" value="1" class="form-check-input" id="fNeg" <?php echo e(old('allow_negative_stock', $settings->allow_negative_stock) ? 'checked' : ''); ?>>
                    <label class="form-check-label small fw-semibold text-danger" for="fNeg">Allow Negative Stock (Default: No)</label>
                </div>
            </div>
            <div class="col-md-4">
                <label class="form-label small fw-semibold">Default Customer Billing Type</label>
                <select name="default_customer_type" class="form-select form-select-sm">
                    <option value="Cash" <?php echo e(old('default_customer_type', $settings->default_customer_type) === 'Cash' ? 'selected' : ''); ?>>Cash</option>
                    <option value="Credit" <?php echo e(old('default_customer_type', $settings->default_customer_type) === 'Credit' ? 'selected' : ''); ?>>Credit</option>
                </select>
            </div>
            <div class="col-md-4">
                <label class="form-label small fw-semibold">Default Purchase Type</label>
                <select name="default_purchase_type" class="form-select form-select-sm">
                    <option value="Cash" <?php echo e(old('default_purchase_type', $settings->default_purchase_type) === 'Cash' ? 'selected' : ''); ?>>Cash</option>
                    <option value="Credit" <?php echo e(old('default_purchase_type', $settings->default_purchase_type) === 'Credit' ? 'selected' : ''); ?>>Credit</option>
                </select>
            </div>
        </div>

        <input type="hidden" name="time_format" value="H:i">
        <input type="hidden" name="default_language" value="en">
        <input type="hidden" name="default_page_size" value="A4">
        <input type="hidden" name="default_printer_type" value="A4">

        <div class="d-flex justify-content-end gap-2">
            <button type="submit" class="btn btn-sm btn-primary"><i class="bi bi-save me-1"></i> Update General Settings</button>
        </div>
    </form>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\saudi\resources\views\settings\general.blade.php ENDPATH**/ ?>