
<?php $__env->startSection('content'); ?>
<style>
    .tab-content {
            border: 1px solid #ddd;
            border-top: none;
            padding: 20px;
            background: #fff;
        }
</style>
    <!-- begin::main content -->
    <main class="main-content">
        <div class="container">
            <!-- begin::page header -->
            <div class="page-header">
               
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="<?php echo e(asset('dashboard')); ?>"><?php echo e(__('message.dashboard')); ?></a></li>
                        <li class="breadcrumb-item active" aria-current="page"><?php echo e(__('message.list')); ?></li>
                    </ol>
                </nav>
            </div>
            <!-- end::page header -->
            <div class="card">

            <?php if (isset($component)) { $__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74 = $component; } ?>
<?php $component = $__env->getContainer()->make(App\View\Components\FlashMessage::class, []); ?>
<?php $component->withName('flashMessage'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74)): ?>
<?php $component = $__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74; ?>
<?php unset($__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74); ?>
<?php endif; ?>
                <div class="card-body">

                    <div class=" mt-4">
                        <h2>Statutory Components</h2>

                        <!-- Tabs -->
                        <ul class="nav nav-tabs" id="statutoryTabs">
                            <li class="nav-item">
                                <a class="nav-link active" data-toggle="tab" href="#epf">EPF</a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link" data-toggle="tab" href="#esi">ESI</a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link" data-toggle="tab" href="#professionalTax">Professional Tax</a>
                            </li>
                            
                        </ul>

                        <!-- Tab Content -->
                        <div class="tab-content">
                            <!-- EPF Tab -->
                            <div class="tab-pane fade show active" id="epf">
                                <h4 class="mt-3">Employees' Provident Fund</h4>
                                <form class="" action="<?php echo e(asset('hrms/add-epf-details')); ?>" method="post">
                                    <?php echo csrf_field(); ?>
                                    <input type="hidden" name="epf_id" value="<?php echo e(isset($admin_epf_rule) ? $admin_epf_rule->id : ''); ?>">
                                    <table class="table table-bordered mt-3">
                                        <tbody>
                                            <tr>
                                                <th>EPF Number</th>
                                                <td>
                                                    <input type="text" name="epf_number" class="form-control" placeholder="AA/AAA/0000000/XXX" value="<?php echo e(isset($admin_epf_rule) ? $admin_epf_rule->epf_number : ''); ?>">
                                                    <div class="px-3">
                                                        <?php if($errors->has('epf_number')): ?>
                                                            <div class="text-danger">
                                                                <p><?php echo e($errors->first('epf_number')); ?></p>
                                                            </div>
                                                        <?php endif; ?>
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>Deduction Cycle</th>
                                                <td>Monthly</td>
                                            </tr>
                                            <tr>
                                                <th>Employee & Employer Contribution Rate</th>
                                                <td>
                                                    <?php echo e(number_format($epf_rule->employee_epf_rate, 0)); ?>% of Actual PF Wage<br>
                                                    <?php echo e($epf_rule->employer_epf_rate); ?>% Employer EPF Rate<br>
                                                    <?php echo e($epf_rule->employer_eps_rate); ?>% Employer EPS Rate<br>
                                                    <?php echo e($epf_rule->edli_rate); ?>% EDLI Rate<br>
                                                    <?php echo e($epf_rule->admin_charges_rate); ?>% Admin Charges Rate<br>
                                                </td>
                                            </tr>
                                            
                                            <tr>
                                                <th>Contribution Preferences</th>
                                                <td>
                                                    
                                                    <label>
                                                        <input type="checkbox" name="edli_contribution" value="active" <?php echo e(isset($admin_epf_rule) ? ($admin_epf_rule->edli_contribution == 'active' ? 'checked' : '') : ''); ?>> EDLI contribution
                                                    </label><br>
                                                    <label>
                                                        <input type="checkbox" name="admin_charges" value="active" <?php echo e(isset($admin_epf_rule) ? ($admin_epf_rule->admin_charges == 'active' ? 'checked' : '') : ''); ?>> Admin charges
                                                    </label>
                                                    
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>Employer Contribution Rate</th>
                                                <td>
                                                    <select name="contribution_rate" class="form-control">
                                                        <option value="12" <?php echo e(isset($admin_epf_rule) ? ($admin_epf_rule->contribution_rate == 12 ? 'selected' : '') : ''); ?>>12% of Actual PF Wage</option>
                                                        <option value="15000" <?php echo e(isset($admin_epf_rule) ? ($admin_epf_rule->contribution_rate == 15000 ? 'selected' : '') : ''); ?>>Restrict Contribution to 15000 PF Wage</option>
                                                    </select>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>Eligible for ABRY Scheme Contribution Type</th>
                                                <td>
                                                    <label>
                                                        <input type="checkbox"  name="contribution_type" value="employee" <?php echo e(isset($admin_epf_rule) ? ($admin_epf_rule->contribution_type == 'employee' ? 'checked' : '') : ''); ?>> Only Employee
                                                    </label><br>
                                                    <label>
                                                        <input type="checkbox" name="contribution_type" value="both" <?php echo e(isset($admin_epf_rule) ? ($admin_epf_rule->contribution_type == 'both' ? 'checked' : '') : ''); ?>> Both Employee and Employer
                                                    </label>
                                                </td>
                                            </tr>
                                        
                                            <tr>
                                                <th>Enable EPF Rule</th>
                                                <td> 
                                                    <label class="switch">
                                                        <input type="checkbox" name="status" value="enable" <?php echo e(isset($admin_epf_rule) ? ($admin_epf_rule->status == 'enable' ? 'checked' : '') : ''); ?>>
                                                        <span class="slider round"></span> Enable
                                                    </label>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                    <button class="btn btn-primary">SAVE</button>
                                </form>                                
                            </div>

                            <!-- Other Tabs Placeholder -->
                            <div class="tab-pane fade p-4" id="esi">
                                
                                    
                                        <h5 class="mb-3">ESI Deduction Details</h5>
                                        <?php if(isset($employee_esi)): ?>
                                        <form action="<?php echo e(asset('hrms/add-employee-esi')); ?>" method="post">
                                            <?php echo csrf_field(); ?>
                                            <input type="hidden" name="esi_id" value="<?php echo e(isset($esi_id) ? $esi_id->id : ''); ?>">
                                            <div class="form-group">
                                                <label for="esiNumber">ESI Number</label>
                                                <input type="text" class="form-control" name="esi_number" value="<?php echo e(isset($esi_id) ? $esi_id->esi_number : ''); ?>" placeholder="76-87-678687-678-6787">
                                            </div>

                                            <div class="form-group">
                                                <label for="deductionCycle">Deduction Cycle <i class="fas fa-info-circle" data-toggle="tooltip" title="Monthly deduction cycle"></i></label>
                                                <select class="form-control" name="deduction_cycle" readonly id="deductionCycle">
                                                    <option value="monthly">Monthly</option>
                                                    
                                                </select>
                                            </div>

                                            <div class="form-group">
                                                <label>Employees' Contribution</label>
                                                <div class="input-group">
                                                    <input type="text" name="employee_contribution" class="form-control" value="<?php echo e($employee_esi->employee_contribution); ?>" readonly>
                                                    <div class="input-group-append">
                                                        <span class="input-group-text">of Gross Pay</span>
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="form-group">
                                                <label>Employer's Contribution</label>
                                                <div class="input-group">
                                                    <input type="text" class="form-control" name="employer_contribution" value="<?php echo e($employee_esi->employer_contribution); ?>" readonly>
                                                    <div class="input-group-append">
                                                        <span class="input-group-text">of Gross Pay</span>
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="form-group form-check">
                                                <input type="checkbox" class="form-check-input" id="includeEmployerContribution" name="salary_structure" <?php echo e(isset($esi_id) ? ($esi_id->salary_structure=="on" ? 'checked' : '') : ''); ?>>
                                                <label class="form-check-label" for="includeEmployerContribution">Include employer's contribution in employee’s salary structure.</label>
                                            </div>
                                            <div class="form-group form-check">
                                                <input type="checkbox" class="form-check-input"  name="status" <?php echo e(isset($esi_id) ? ($esi_id->status=="on" ? 'checked' : '') : ''); ?>>
                                                <label class="form-check-label" for="includeEmployerContribution">Active</label>
                                            </div>
                                            <div>
                                                <button class="btn btn-primary">SAVE</button>
                                            </div>
                                        </form>
                                        <?php else: ?>
                                            <h3>No Information about ESI contact software owner</h3>
                                        <?php endif; ?>

                                        <div class="alert alert-warning mt-3">
                                            <strong>Note:</strong> ESI deductions will be made only if the employee’s monthly salary is less than or equal to ₹21,000. If the employee gets a salary revision that increases their monthly salary above ₹21,000, they would have to continue making ESI contributions until the end of the contribution period in which the salary was revised (April-September or October-March).
                                        </div>
                                    
                                

                            </div>

                            <div class="tab-pane fade" id="professionalTax">
                            
                                    <h5 class="mb-3">Salary Tax Deduction Details</h5>
                                    <div class="row px-3">
                                        <div class="col-md-6 p-2">
                                            <form action="<?php echo e(asset('hrms/add-profession-tax')); ?>" method="post">
                                                <?php echo csrf_field(); ?>

                                                <input type="hidden" name="tds_id" id="tds_id">
                                                <label>State</label>
                                                <select class="form-control mb-3" name="state_id" id="state_id">
                                                    <?php $__currentLoopData = $states; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $state): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <option value="<?php echo e($state->id); ?>"><?php echo e($state->state_name); ?></option>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </select>

                                                <!-- <div class="form-group">
                                                    <label for="annualSalary">Annual Minimum Salary (CTC)</label>
                                                    <input type="number" class="form-control" name="min_ctc" placeholder="Enter Annual Salary" required>
                                                </div> -->
                                                <div class="form-group">
                                                    <label for="annualSalary">Annual Maximum Salary (CTC)</label>
                                                    <input type="text" class="form-control professional_max_salary" id="max_ctc" name="max_ctc" placeholder="Enter Annual Salary" required>
                                                    <?php if($errors->has('max_ctc')): ?>
                                                        <div class="error">
                                                            <?php echo e($errors->first('max_ctc')); ?>

                                                        </div>
                                                    <?php endif; ?>
                                                </div>

                                                <div class="form-group">
                                                    <label for="annualSalary">Rate (%)</label>
                                                    <input type="number" class="form-control professional_anual_rate" name="rate" id="tds_rate" placeholder="Enter rate" required>
                                                    <?php if($errors->has('rate')): ?>
                                                        <div class="error">
                                                            <?php echo e($errors->first('rate')); ?>

                                                        </div>
                                                    <?php endif; ?>
                                                </div>

                                                <div class="form-group">
                                                    <label for="deductionCycle">Deduction Cycle</label>
                                                    <select class="form-control" name="deduction_cycle" id="deduction_cycle">
                                                        <option value="monthly">Monthly</option>
                                                        <option value="quarterly">Quarterly</option>
                                                        <option value="annually">Annually</option>
                                                    </select>
                                                    <?php if($errors->has('deduction_cycle')): ?>
                                                        <div class="error">
                                                            <?php echo e($errors->first('deduction_cycle')); ?>

                                                        </div>
                                                    <?php endif; ?>
                                                </div>

                                                <div class="form-group">
                                                    <label>Income Tax Deduction (TDS as per Slabs)</label>
                                                    <div class="input-group">
                                                        <input type="text" class="form-control" id="tdsAmount"  name="tds_amount" readonly>
                                                        <div class="input-group-append">
                                                            <span class="input-group-text">₹ (Auto Calculated)</span>
                                                        </div>
                                                    </div>
                                                    <?php if($errors->has('tds_amount')): ?>
                                                        <div class="error">
                                                            <?php echo e($errors->first('tds_amount')); ?>

                                                        </div>
                                                    <?php endif; ?>
                                                </div>

                                                <div class="form-group">
                                                    <label>Status</label>
                                                    
                                                    <select class="form-control" name="status" readonly id="tds_status">
                                                        <option value="active">Active</option>
                                                        <option value="inactive">Inactive</option>
                                                    </select>
                                                    
                                                </div>

                                               
                                                <div class="alert alert-warning mt-3">
                                                    <strong>Note:</strong>
                                                    - TDS is deducted only if Annual CTC is above **₹2,50,000**, based on tax slabs.  
                                                    - Professional Tax varies **by state regulations** (e.g., ₹200 in Maharashtra).  
                                                    - Employers **do not contribute** to employee’s TDS but **deduct it from salary**.  
                                                </div>

                                                <button type="submit" class="btn btn-primary">Submit</button>
                                            </form>
                                        </div>
                                        <div class="col-md-6 px-3">
                                            <?php $__currentLoopData = $admin_tds; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$tds): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <div class="card">
                                                <div class="card-body">
                                                    <div class="d-flex  justify-content-between">
                                                        <p>CTC : <?php echo e($tds->max_ctc); ?></p>
                                                        <p>Rate : <?php echo e($tds->rate); ?> %</p>
                                                   
                                                        
                                                    </div>
                                                    <div  class="d-flex justify-content-between" >
                                                        <p>Deduction Type : <?php echo e($tds->deduction_cycle); ?></p>
                                                        <p>Amount : <?php echo e($tds->tds_amount); ?></p>
                                                         
                                                    </div>
                                                    <p>Status : <?php echo e($tds->status); ?></p>
                                                </div>
                                                <div class="card-footer">
                                                    <button class="btn btn-primary tax_edit_button" tds_data="<?php echo e($tds); ?>"><i class="ti ti-pencil"></i></button>
                                                    <button type="button" tds_id="<?php echo e($tds->id); ?>" class="btn btn-danger text-white tax_delete_button"><i class="ti ti-trash"></i></button>
                                                </div>
                                            </div>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </div>
                                    </div>

                                    

                            </div>

                            <div class="tab-pane fade" id="labourWelfareFund">
                                <h4 class="mt-3">Labour Welfare Fund</h4>
                                <p>Labour Welfare Fund settings content goes here.</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        
        <!-- Button to Open the Modal -->



    </main>
    <!-- end::main content -->
<?php $__env->stopSection(); ?>
<?php $__env->startPush('footer-script'); ?>
    <!-- begin::dataTable -->
    <script src="<?php echo e(asset('public/admin/js/examples/datatable.js')); ?>"></script>
    <!-- end::dataTable -->
    <script>
        $(document).ready(function() {
            $(".filter-company-btn").click(function(){
            
                if($(".filter-form-box").hasClass("d-none"))
                {
                    $(".filter-form-box").removeClass("d-none");
                }
                else
                {
                    $(".filter-form-box").addClass("d-none");
                }
            });

            $(".reset_password_btn").click(function(){
                var user_id = $(this).attr("user_id");
                $("#user_unique_id").val(user_id);
            });

            $("#checkAll").click(function() {
                $('input:checkbox').not(this).prop('checked', this.checked);
            });
            /*
            $('#deleteAll').click(function() {
                if (confirm("Are you sure you want to delete Users? ")) {
                    var val = [];
                    $('.deleteall:checked').each(function(i) {
                        val[i] = $(this).val();
                    });

                    if (val.length > 0) {
                        $.ajax({
                            method: "POST",
                            headers: {
                                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                            },
                            url: "<?php echo e(asset('delete-multiple-users')); ?>",
                            data: {
                                "ids": val
                            }
                        }).done(function(data) {
                            if (data) {
                                location.reload();
                            } else {
                                alert("Something went wrong!, Try again");
                            }
                        });
                    }
                }
                //alert(<?php echo e(asset('admin/delete-multiple-users')); ?>);
            });*/
            
            $(".reg-delete-btn").click(function(){
                var id = $(this).attr("reg_id");
               
                swal({
                    title: 'Are you sure?',
                    text: 'Once deleted, you will not be recover!',
                    icon: 'warning',
                    dangerMode: true,
                    buttons: ["Cancel", "Yes!"],
                }).then(function(value) {
                    if (value) {
                        $.ajaxSetup({
                            headers: {
                                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                            }
                        });
                        $.ajax({
                            type: "delete",
                            data: {
                                "id": id
                            },
                            url: "<?php echo e(asset('hrms/delete-award')); ?>",
                            dataType: "html",
                            success: function(result) 
                            {
                                swal("success!", "Successfully deleted!", "success");
                                window.location.reload();
                            },
                            error: function(error,xhr,status)
                            {
                                swal("failed!", "failed to delete!", "error");
                               window.location.reload();
                            }
                        });
                       
                    }
                });
                
            });
            $("#delete-multiple").click(function() {
                var URL = "<?php echo e(asset('notice/multidelete')); ?>";
                var parent_ids = [];
                $('.parentids:checkbox:checked').each(function() {
                    parent_ids.push($(this).val());
                });
                swal({
                    title: 'Are you sure?',
                    text: 'Once deleted, you will not be recover!',
                    icon: 'warning',
                    dangerMode: true,
                    buttons: ["Cancel", "Yes!"],
                }).then(function(value) {
                    if (value) {
                        $.ajaxSetup({
                            headers: {
                                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                            }
                        });
                        $.ajax({
                            type: "post",
                            data: {
                                "student_ids": parent_ids
                            },
                            url: URL,
                            dataType: "html",
                            success: function(result) {}
                        });
                        swal("success!", "Successfully deleted!", "success");
                        window.location.reload();
                    }
                });
            });

            $(".purpose-btn").click(function(){
                
                $("#purposeModal").modal();
            });

            $(".professional_anual_rate").on("input",function(){
                var rate = $(this).val();
                var salary = $(".professional_max_salary").val();
                var amount = parseFloat((salary*rate)/100).toFixed(2);
                $("#tdsAmount").val(amount);

            });

            $(".tax_delete_button").click(function(){
                var tds_id = $(this).attr("tds_id");
                swal({
                    title: 'Are you sure?',
                    text: 'Once deleted, you will not be recover!',
                    icon: 'warning',
                    dangerMode: true,
                    buttons: ["Cancel", "Yes!"],
                }).then(function(value) {
                    if (value) {
                        $.ajaxSetup({
                            headers: {
                                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                            }
                        });
                        $.ajax({
                            type: "post",
                            data: {
                                "id": tds_id
                            },
                            url: "<?php echo e(asset('hrms/employee-tds-delete')); ?>",
                            dataType: "html",
                            success: function(result) 
                            {
                                swal("success!", "Successfully deleted!", "success");
                                window.location.reload();
                            },
                            error: function(error,xhr,status)
                            {
                                swal("failed!", "failed to delete!", "error");
                               window.location.reload();
                            }
                        });
                       
                    }
                });
            });

            $(".tax_edit_button").click(function(){
                var allData = $(this).attr("tds_data");
                var tds_data = JSON.parse(allData);
                console.log(tds_data);
                $("#tds_id").val(tds_data.id);
                $("#state_id").val(tds_data.state_id);
                $("#max_ctc").val(tds_data.max_ctc);
                $("#tds_rate").val(tds_data.rate);
                $("#deduction_cycle").val(tds_data.deduction_cycle);
                $("#tdsAmount").val(tds_data.tds_amount);
                $("#tds_status").val(tds_data.status)

            });
            
        });
    </script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\blurb_erp\resources\views/hrms/statutory_components/list.blade.php ENDPATH**/ ?>