<?php $__env->startSection('section-title', 'Expense'); ?>
<?php $__env->startSection('page-title', 'Add Expense'); ?>

<?php if(check_permission('expense.update')): ?>
    <?php $__env->startSection('action-button'); ?>
        <a href="<?php echo e(route('expense.index')); ?>" class="btn add_list_btn">
            <i class="mr-2 feather icon-list"></i>
            All Expense
        </a>
    <?php $__env->stopSection(); ?>
<?php endif; ?>

<?php $__env->startSection('content'); ?>
<div class="row justify-content-center">
    <div class="col-md-12">
        <div class="card m-b-30 card_style">
            <div class="card-body">
                <div class="">
                    <form class="row g-3 needs-validation" method="POST" action="<?php echo e(route('expense.store')); ?>" enctype="multipart/form-data">
                        <?php echo csrf_field(); ?>
                        
                        <div class="mt-2 col-md-4">
                            <label class="form-label font-weight-bold">Date *</label>
                            <input type="date" class="form-control" value="<?php echo e(date('Y-m-d')); ?>" name="date" required>
                            <div class="errors"><?php echo e(($errors->has('date'))?$errors->first('date'):''); ?></div>
                        </div>

                        
                        <div class="mt-2 col-md-4">
                            <label for="name" class="form-label fw-bold">Name *</label>
                            <input type="text" class="form-control" name="name" placeholder="Enter Expense Name">
                            <div class="errors"><?php echo e(($errors->has('name'))?$errors->first('name'):''); ?></div>
                        </div>

                        
                        <div class="mt-2 col-md-4">
                            <label for="category_id" class="form-label fw-bold">Select Category *</label>
                            <select class="select2" name="category_id">
                                <option selected value="">Select Category</option>
                                <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $category): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value=<?php echo e($category->id); ?>><?php echo e($category->name); ?></option>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </select>
                            <div class="errors"><?php echo e(($errors->has('category_id'))?$errors->first('category_id'):''); ?></div>
                        </div>

                        
                        <div class="mt-2 col-md-6">
                            <label for="bank_id" class="form-label fw-bold">Select Bank Account</label>
                            <select class="select2" name="bank_id">
                                <option selected value="">Select Bank Account</option>
                                <?php $__currentLoopData = $bank_accounts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $bank_account): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value=<?php echo e($bank_account->id); ?>><?php echo e($bank_account->bank_name); ?></option>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </select>
                            <div class="errors"><?php echo e(($errors->has('bank_id'))?$errors->first('bank_id'):''); ?></div>
                        </div>

                        
                        <div class="mt-2 col-md-6">
                            <label for="amount" class="form-label fw-bold">Amount *</label>
                            <input type="number" class="form-control" name="amount" placeholder="Enter Amount" required>
                            <div class="errors"><?php echo e(($errors->has('amount'))?$errors->first('amount'):''); ?></div>
                        </div>

                        
                        <div class="mt-2 col-md-12">
                            <label class="form-label fw-bold">Note</label>
                            <textarea class="form-control" name="note" rows="2"></textarea>
                        </div>

                        <div class="mt-3 text-center col-12">
                            <button class="btn save_btn" type="submit"> Save </button>
                        </div>

                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    function readURL(input) {
        if (input.files && input.files[0]) {
        var reader = new FileReader();
        reader.onload = function (e) {
            $('#image')
                .attr('src', e.target.result)
                .width(120)
                .height(80);
            };
            reader.readAsDataURL(input.files[0]);
        }
    }
</script>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('backend.layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH D:\laragon\www\new demo\resources\views/backend/pages/expense/create.blade.php ENDPATH**/ ?>