<?php echo e(Form::open(['route' => 'job-grades.store', 'method' => 'POST'])); ?>

<div class="modal-body">
    <div class="row">
        <div class="col-md-6 form-group">
            <?php echo e(Form::label('name', __('Job Grade Name'), ['class' => 'form-label'])); ?>

            <?php echo e(Form::text('name', null, ['class' => 'form-control', 'required' => true, 'placeholder' => 'e.g. Grade A'])); ?>

        </div>

        <div class="col-md-6 form-group">
            <?php echo e(Form::label('range_type', __('Range Type'), ['class' => 'form-label'])); ?>

            <?php echo e(Form::select('range_type', ['flat' => 'Flat', 'percentage' => 'Percentage'], null, ['class' => 'form-control range-toggle', 'required' => true])); ?>

        </div>

        
        <div class="flat-fields row">
            <div class="col-md-4 form-group">
                <?php echo e(Form::label('min_salary', __('Min Salary'), ['class' => 'form-label'])); ?>

                <?php echo e(Form::number('min_salary', null, ['class' => 'form-control', 'step' => '0.01'])); ?>

            </div>
            <div class="col-md-4 form-group">
                <?php echo e(Form::label('mid_salary', __('Mid Salary'), ['class' => 'form-label'])); ?>

                <?php echo e(Form::number('mid_salary', null, ['class' => 'form-control', 'step' => '0.01'])); ?>

            </div>
            <div class="col-md-4 form-group">
                <?php echo e(Form::label('max_salary', __('Max Salary'), ['class' => 'form-label'])); ?>

                <?php echo e(Form::number('max_salary', null, ['class' => 'form-control', 'step' => '0.01'])); ?>

            </div>
        </div>

        
        <div class="percent-fields d-none row">
            <div class="col-md-4 form-group">
                <?php echo e(Form::label('min_percent', __('Min % of Gross'), ['class' => 'form-label'])); ?>

                <?php echo e(Form::number('min_percent', null, ['class' => 'form-control', 'step' => '0.01'])); ?>

            </div>
            <div class="col-md-4 form-group">
                <?php echo e(Form::label('mid_percent', __('Mid % of Gross'), ['class' => 'form-label'])); ?>

                <?php echo e(Form::number('mid_percent', null, ['class' => 'form-control', 'step' => '0.01'])); ?>

            </div>
            <div class="col-md-4 form-group">
                <?php echo e(Form::label('max_percent', __('Max % of Gross'), ['class' => 'form-label'])); ?>

                <?php echo e(Form::number('max_percent', null, ['class' => 'form-control', 'step' => '0.01'])); ?>

            </div>
        </div>

        <div class="col-md-12 form-group">
            <?php echo e(Form::label('designation_ids', __('Assign Designations'), ['class' => 'form-label'])); ?>

            <?php echo e(Form::select('designation_ids[]', $designations->pluck('name', 'id'), null, ['class' => 'form-control select2', 'multiple' => true])); ?>

        </div>

        <div class="col-md-12 form-group">
            <?php echo e(Form::label('notes', __('Notes'), ['class' => 'form-label'])); ?>

            <?php echo e(Form::textarea('notes', null, ['class' => 'form-control', 'rows' => 3])); ?>

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

<div class="modal-footer">
    <button type="button" class="btn btn-light" data-bs-dismiss="modal"><?php echo e(__('Cancel')); ?></button>
    <button type="submit" class="btn btn-primary"><?php echo e(__('Save')); ?></button>
</div>
<?php echo e(Form::close()); ?>

<script>
    document.addEventListener('change', e => {
        if (e.target.classList.contains('range-toggle')) {
            const type = e.target.value;
            document.querySelector('.flat-fields').classList.toggle('d-none', type !== 'flat');
            document.querySelector('.percent-fields').classList.toggle('d-none', type !== 'percentage');
        }
    });
</script><?php /**PATH /var/www/payraty/hris/resources/views/job_grades/create.blade.php ENDPATH**/ ?>