<?php $__env->startSection('title', 'Create Expense'); ?>

<?php $__env->startSection('content'); ?>
    <?php if (isset($component)) { $__componentOriginal00a2e3c817942d1565d2933416f28c6a = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal00a2e3c817942d1565d2933416f28c6a = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.page-head','data' => ['title' => 'Record Expense','subtitle' => 'Posts journal — DR expense, CR cash or AP']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('page-head'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['title' => 'Record Expense','subtitle' => 'Posts journal — DR expense, CR cash or AP']); ?>
         <?php $__env->slot('actions', null, []); ?> 
            <a href="<?php echo e(route('finance.suppliers.create')); ?>" class="btn btn-outline">Add Supplier</a>
         <?php $__env->endSlot(); ?>
     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal00a2e3c817942d1565d2933416f28c6a)): ?>
<?php $attributes = $__attributesOriginal00a2e3c817942d1565d2933416f28c6a; ?>
<?php unset($__attributesOriginal00a2e3c817942d1565d2933416f28c6a); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal00a2e3c817942d1565d2933416f28c6a)): ?>
<?php $component = $__componentOriginal00a2e3c817942d1565d2933416f28c6a; ?>
<?php unset($__componentOriginal00a2e3c817942d1565d2933416f28c6a); ?>
<?php endif; ?>

    <?php if (isset($component)) { $__componentOriginal36665f0dc0e45320e21db1e20a989acf = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal36665f0dc0e45320e21db1e20a989acf = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.panel','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('panel'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
        <form method="POST" action="<?php echo e(route('finance.expenses.store')); ?>">
            <?php echo csrf_field(); ?>
            <div style="display:grid; grid-template-columns: repeat(2, 1fr); gap:16px;">
                <div class="form-group">
                    <label class="form-label" for="supplier_id">Supplier</label>
                    <select class="input" id="supplier_id" name="supplier_id">
                        <option value="">— None —</option>
                        <?php $__currentLoopData = $suppliers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $supplier): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($supplier->id); ?>" <?php if(old('supplier_id') == $supplier->id): echo 'selected'; endif; ?>>
                                <?php echo e($supplier->code); ?> — <?php echo e($supplier->name); ?>

                            </option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>
                <div class="form-group">
                    <label class="form-label" for="account_id">Expense Account</label>
                    <select class="input" id="account_id" name="account_id" required>
                        <option value="">Select account</option>
                        <?php $__currentLoopData = $expenseAccounts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $account): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($account->id); ?>" <?php if(old('account_id') == $account->id): echo 'selected'; endif; ?>>
                                <?php echo e($account->code); ?> — <?php echo e($account->name); ?>

                            </option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>
                <div class="form-group">
                    <label class="form-label" for="amount">Amount</label>
                    <input class="input" type="number" step="0.01" min="0.01" id="amount" name="amount" value="<?php echo e(old('amount')); ?>" required>
                </div>
                <div class="form-group">
                    <label class="form-label" for="expense_date">Expense Date</label>
                    <input class="input" type="date" id="expense_date" name="expense_date" value="<?php echo e(old('expense_date', now()->toDateString())); ?>" required>
                </div>
                <div class="form-group" style="grid-column: span 2;">
                    <label class="form-label" for="description">Description</label>
                    <input class="input" type="text" id="description" name="description" value="<?php echo e(old('description')); ?>">
                </div>
                <div class="form-group">
                    <label class="form-label">
                        <input type="checkbox" name="on_credit" value="1" <?php if(old('on_credit')): echo 'checked'; endif; ?>> Pay on credit (Accounts Payable)
                    </label>
                </div>
            </div>
            <div style="display:flex; gap:10px; margin-top:16px;">
                <button type="submit" class="btn btn-primary">Post Expense</button>
                <a href="<?php echo e(route('finance.expenses.index')); ?>" class="btn btn-ghost">Cancel</a>
            </div>
        </form>
     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal36665f0dc0e45320e21db1e20a989acf)): ?>
<?php $attributes = $__attributesOriginal36665f0dc0e45320e21db1e20a989acf; ?>
<?php unset($__attributesOriginal36665f0dc0e45320e21db1e20a989acf); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal36665f0dc0e45320e21db1e20a989acf)): ?>
<?php $component = $__componentOriginal36665f0dc0e45320e21db1e20a989acf; ?>
<?php unset($__componentOriginal36665f0dc0e45320e21db1e20a989acf); ?>
<?php endif; ?>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\laragon\www\southend\resources\views\admin\expenses\create.blade.php ENDPATH**/ ?>