<?php $__env->startSection('title', 'Statutory Components'); ?>

<?php $__env->startSection('content'); ?>
<div class="container-fluid">
    <?php if(session('success')): ?>
        <div class="alert alert-success alert-dismissible fade show mb-4 border-0 shadow-sm" role="alert">
            <i class="fas fa-check-circle me-2"></i> <?php echo e(session('success')); ?>

            <button type="button" class="btn-close" data-dismiss="alert" aria-label="Close"></button>
        </div>
    <?php endif; ?>

    <div class="row">
        <div class="col-md-9">
            <div class="card card-primary card-outline">
                <div class="card-header">
                    <h3 class="card-title font-weight-bold"><i class="fas fa-balance-scale mr-1"></i> Payroll Components Master</h3>
                </div>
                <div class="card-body">
                    <div class="row">
                        <div class="col-md-6 border-right">
                            <div class="d-flex justify-content-between align-items-center mb-3">
                                <h6 class="font-weight-bold mb-0 text-primary"><i class="fas fa-plus-circle mr-1"></i>Master Additions</h6>
                                <?php if(auth()->user()->canAccess('settings.statutory')): ?>
                                <button type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#addAdditionModal">
                                    <i class="fas fa-plus"></i>
                                </button>
                                <?php endif; ?>
                            </div>
                            <div class="table-responsive">
                                <table class="table table-sm table-hover table-bordered table-striped border">
                                    <thead class="bg-light">
                                        <tr>
                                            <th>Name</th>
                                            <th class="text-end">Actions</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php $__empty_1 = true; $__currentLoopData = $additionTypes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $type): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                            <tr>
                                                <td class="align-middle">
                                                    <div class="fw-bold"><?php echo e($type->name); ?></div>
                                                    <small class="text-muted"><?php echo e($type->description ?: 'No description'); ?></small>
                                                </td>
                                                <td class="text-end align-middle">
                                                    <?php if(auth()->user()->canAccess('settings.statutory')): ?>
                                                    <form action="<?php echo e(route('addition-types.destroy', $type->id)); ?>" method="POST" class="d-inline">
                                                        <?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
                                                        <button type="submit" class="btn-crm-delete delete-btn" title="Delete Addition"><i class="fas fa-trash"></i></button>
                                                    </form>
                                                    <?php endif; ?>
                                                </td>
                                            </tr>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                            <tr><td colspan="2" class="text-center py-3 text-muted small">No additions defined</td></tr>
                                        <?php endif; ?>
                                    </tbody>
                                </table>
                            </div>
                        </div>

                        <div class="col-md-6">
                            <div class="d-flex justify-content-between align-items-center mb-3">
                                <h6 class="fw-bold mb-0 text-danger"><i class="fas fa-minus-circle me-1"></i>Master Deductions</h6>
                                <?php if(auth()->user()->canAccess('settings.statutory')): ?>
                                <button type="button" class="btn btn-danger btn-sm rounded-pill px-3" data-toggle="modal" data-target="#addDeductionModal">
                                    <i class="fas fa-plus"></i>
                                </button>
                                <?php endif; ?>
                            </div>
                            <div class="table-responsive">
                                <table class="table table-sm table-hover table-bordered table-striped border">
                                    <thead class="bg-light">
                                        <tr>
                                            <th>Name</th>
                                            <th class="text-end">Actions</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php $__empty_1 = true; $__currentLoopData = $deductionTypes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $type): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                            <tr>
                                                <td class="align-middle">
                                                    <div class="fw-bold"><?php echo e($type->name); ?></div>
                                                    <small class="text-muted"><?php echo e($type->description ?: 'No description'); ?></small>
                                                </td>
                                                <td class="text-end align-middle">
                                                    <?php if(auth()->user()->canAccess('settings.statutory')): ?>
                                                    <form action="<?php echo e(route('deduction-types.destroy', $type->id)); ?>" method="POST" class="d-inline">
                                                        <?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
                                                        <button type="submit" class="btn-crm-delete delete-btn" title="Delete Deduction"><i class="fas fa-trash"></i></button>
                                                    </form>
                                                    <?php endif; ?>
                                                </td>
                                            </tr>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                            <tr><td colspan="2" class="text-center py-3 text-muted small">No deductions defined</td></tr>
                                        <?php endif; ?>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="col-md-3">
            <div class="info-box bg-light shadow-none border">
                <span class="info-box-icon text-info"><i class="fas fa-calculator"></i></span>
                <div class="info-box-content">
                    <span class="info-box-text font-weight-bold">Payroll Rules</span>
                    <span class="info-box-number small text-muted">Manage global earnings and deductions.</span>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('modals'); ?>
<!-- Add Addition Modal -->
<div class="modal fade" id="addAdditionModal" tabindex="-1">
    <div class="modal-dialog">
        <div class="modal-content border-0 shadow">
            <div class="modal-header bg-primary text-white">
                <h5 class="modal-title fw-bold"><i class="fas fa-plus-circle me-2"></i>New Addition Master</h5>
                <button type="button" class="btn-close btn-close-white" data-dismiss="modal" aria-label="Close">
                     <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <form action="<?php echo e(route('addition-types.store')); ?>" method="POST">
                <?php echo csrf_field(); ?>
                <div class="modal-body">
                    <div class="mb-3">
                        <label class="form-label">Component Name</label>
                        <input type="text" name="name" class="form-control" placeholder="e.g., Performance Bonus" required>
                    </div>
                    <div class="mb-0">
                        <label class="form-label">Description (Optional)</label>
                        <textarea name="description" class="form-control" rows="3"></textarea>
                    </div>
                </div>
                <div class="modal-footer bg-light">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
                    <button type="submit" class="btn btn-primary px-4">Create Component</button>
                </div>
            </form>
        </div>
    </div>
</div>

<!-- Add Deduction Modal -->
<div class="modal fade" id="addDeductionModal" tabindex="-1">
    <div class="modal-dialog">
        <div class="modal-content border-0 shadow">
            <div class="modal-header bg-danger text-white">
                <h5 class="modal-title fw-bold"><i class="fas fa-minus-circle me-2"></i>New Deduction Master</h5>
                <button type="button" class="btn-close btn-close-white" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <form action="<?php echo e(route('deduction-types.store')); ?>" method="POST">
                <?php echo csrf_field(); ?>
                <div class="modal-body">
                    <div class="mb-3">
                        <label class="form-label">Component Name</label>
                        <input type="text" name="name" class="form-control" placeholder="e.g., PF Deduction" required>
                    </div>
                    <div class="mb-0">
                        <label class="form-label">Description (Optional)</label>
                        <textarea name="description" class="form-control" rows="3"></textarea>
                    </div>
                </div>
                <div class="modal-footer bg-light">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
                    <button type="submit" class="btn btn-danger px-4">Create Component</button>
                </div>
            </form>
        </div>
    </div>
</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\hrms\resources\views/admin/settings/statutory.blade.php ENDPATH**/ ?>