<?php $__env->startSection('title',' Organizations'); ?>
<?php $__env->startSection('content'); ?>
    <h2 class="ms-2 mb-3 card-title"><?php echo e(__('messages.leave')); ?> <?php echo e(__('messages.type') ." ". __('messages.list')); ?></h2>
    <div class="card  mt-3 m-lg-2">
        <div class="card-body table_card  mt-2">
            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('leave.create')): ?>
                <div class="add-new-button-hidden">
                    
                </div>
            <?php endif; ?>
            <table id="myTable" class="table table-bordered dt-responsive nowrap w-100">
                <thead>
                <tr>
                    <th><?php echo e(__('messages.sl')); ?></th>
                    <th><?php echo e(__('messages.leave')); ?> <?php echo e(__('messages.type')); ?></th>
                    <th><?php echo e(__('messages.quantity')); ?></th>
                    <th>
                        
                    </th>
                </tr>
                </thead>
                <tbody>
                <?php $__currentLoopData = $leaveTypes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <tr>
                        <td><?php echo e(++$key); ?></td>
                        <td><?php echo e($item->leave_type_name); ?></td>
                        <td><?php echo e(($item->leave_days) ?? 'N/A'); ?></td>
                        <td class="center">
                            
                        </td>
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </tbody>
            </table>
        </div>
    </div>

    
    <div class="modal fade" id="leave_add_modal" tabindex="-1" aria-labelledby="exampleModalLabel"
         aria-hidden="true">
        <div class="modal-dialog modal-lg modal-dialog-centered">
            <div class="modal-content p-5">
                <h4 class="card-title"><?php echo e(__('messages.leave') ." ". __('messages.information')); ?></h4>
                <div class="modal-body p-0 mt-3">
                    <form action="<?php echo e(route('leaves.store')); ?>" method="POST" role="form" id="form1"
                          enctype="multipart/form-data">
                        <?php echo csrf_field(); ?>
                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="form-label" for="leavename"><?php echo e(__('messages.name')); ?> <span
                                            class="text-danger">*</span></label>
                                    <input type="text" class="form-control <?php $__errorArgs = ['name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                                           name="name" placeholder="<?php echo e(__('messages.enter') ." ". __('messages.leave')." ". __('messages.name')); ?>" id="leavename" required/>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="form-label" for="ownername"><?php echo e(__('messages.owner')." ". __('messages.name')); ?><span
                                            class="text-danger">*</span></label>
                                    <input type="text" class="form-control <?php $__errorArgs = ['owner_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                                           name="owner_name" placeholder="<?php echo e(__('messages.enter') ." ". __('messages.owner')." ". __('messages.name')); ?>" required id="ownername"/>
                                </div>
                            </div>
                        </div>
                        </div>
                        <div class="mt-5 d-flex justify-content-end ">
                            <button type="button" class="btn  me-2" data-bs-dismiss="modal"
                                    style="background: #EAECF0;"><?php echo e(__('messages.close')); ?>

                            </button>
                            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('leave.create')): ?>
                                <button type="submit" class="btn btn-primary" >
                                    <?php echo e(__('messages.save')); ?>

                                </button>
                            <?php endif; ?>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>
<?php $__env->startPush('scripts'); ?>
    <script type="text/javascript">
        $(document).ready(function ($) {
            $(document).on('click', '#edit_btn', function () {
                let id = $(this).attr('edit-id');
                $.ajax({
                    type: "GET",
                    url: "<?php echo e(url('system/leaves')); ?>/" + id + "/edit",
                    success: function (res) {
                        $('#name').val(res.name);
                        $('#owner_name').val(res.owner_name);
                        $('#address').val(res.address);
                        $('#phone').val(res.phone);
                        $('#item_id').val(res.id);
                    },
                    error: function (response) {
                        console.log(response);
                    }
                });
            });
        });
    </script>
<?php $__env->stopPush(); ?>



<?php echo $__env->make('backend.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH D:\laragon\www\hr_and_att\resources\views/backend/hr/attend/leaveType.blade.php ENDPATH**/ ?>