<?php $__env->startSection('page-title', __('Job / Pay Grades')); ?>

<?php $__env->startSection('action-button'); ?>
    <a href="#" data-url="<?php echo e(route('job-grades.create')); ?>" data-ajax-popup="true"
        data-title="<?php echo e(__('Create New Job Grade')); ?>" class="btn btn-sm btn-primary">
        <i class="ti ti-plus"></i>
        <?php echo e(__('Add Job Grade')); ?>

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

<?php $__env->startSection('content'); ?>
    <div class="row">
        <div class="col-12">
            <?php echo $__env->make('layouts.hrm_setup', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
        </div>

        <div class="col-md-12">
            <div class="card">
                <div class="card-body table-border-style">
                    <div class="table-responsive">
                        <table class="table datatable">
                            <thead>
                                <tr>
                                    <th><?php echo e(__('Grade Name')); ?></th>
                                    <th><?php echo e(__('Range Type')); ?></th>
                                    <th><?php echo e(__('Min')); ?></th>
                                    <th><?php echo e(__('Mid')); ?></th>
                                    <th><?php echo e(__('Max')); ?></th>
                                    <th><?php echo e(__('Assigned Designations')); ?></th>
                                    <th><?php echo e(__('Notes')); ?></th>
                                    <th width="200px"><?php echo e(__('Action')); ?></th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php $__empty_1 = true; $__currentLoopData = $grades; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $grade): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                                            <tr>
                                                                <td><?php echo e($grade->name); ?></td>
                                                                <td>
                                                                    <?php if($grade->range_type == 'flat'): ?>
                                                                        <span class="badge bg-success"><?php echo e(__('Flat Values')); ?></span>
                                                                    <?php else: ?>
                                                                        <span class="badge bg-info"><?php echo e(__('% of Basic')); ?></span>
                                                                    <?php endif; ?>
                                                                </td>

                                                                <?php if($grade->range_type == 'flat'): ?>
                                                                    <td><?php echo e(number_format($grade->min_salary, 2)); ?></td>
                                                                    <td><?php echo e(number_format($grade->mid_salary, 2)); ?></td>
                                                                    <td><?php echo e(number_format($grade->max_salary, 2)); ?></td>
                                                                <?php else: ?>
                                                                    <td><?php echo e($grade->min_percent); ?>%</td>
                                                                    <td><?php echo e($grade->mid_percent); ?>%</td>
                                                                    <td><?php echo e($grade->max_percent); ?>%</td>
                                                                <?php endif; ?>

                                                                <td>
                                                                    <?php if($grade->designations->count() > 0): ?>
                                                                        <?php $__currentLoopData = $grade->designations; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $des): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                                            <span class="badge bg-secondary"><?php echo e($des->name); ?></span>
                                                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                                    <?php else: ?>
                                                                        <span class="text-muted">—</span>
                                                                    <?php endif; ?>
                                                                </td>

                                                                <td><?php echo e($grade->notes ?? '—'); ?></td>

                                                                <td class="Action">
                                                                    <div class="dt-buttons">
                                                                        <span class="float-start d-flex">

                                                                            
                                                                            <div class="action-btn me-2">
                                                                                <a href="#" class="btn btn-sm bg-info"
                                                                                    data-url="<?php echo e(route('job-grades.edit', $grade->id)); ?>"
                                                                                    data-ajax-popup="true" data-title="<?php echo e(__('Edit Job Grade')); ?>"
                                                                                    data-bs-toggle="tooltip" title="<?php echo e(__('Edit')); ?>">
                                                                                    <i class="ti ti-pencil text-white"></i>
                                                                                </a>
                                                                            </div>

                                                                            
                                                                            <div class="action-btn">
                                                                                <?php echo Form::open([
                                        'method' => 'DELETE',
                                        'route' => ['job-grades.destroy', $grade->id],
                                        'id' => 'delete-form-' . $grade->id,
                                    ]); ?>

                                                                                <a href="#" class="btn btn-sm bg-danger align-items-center bs-pass-para"
                                                                                    data-bs-toggle="tooltip" title="<?php echo e(__('Delete')); ?>">
                                                                                    <i class="ti ti-trash text-white"></i>
                                                                                </a>
                                                                                <?php echo Form::close(); ?>

                                                                            </div>

                                                                        </span>
                                                                    </div>
                                                                </td>
                                                            </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                    <tr>
                                        <td colspan="8" class="text-center text-muted"><?php echo e(__('No job grades found')); ?></td>
                                    </tr>
                                <?php endif; ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.admin', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/payraty/hris/resources/views/job_grades/index.blade.php ENDPATH**/ ?>