
@extends("layouts.metor.admin")
@section("content")
@section("title","Add Salary Structures")

<div class="row">
    <div class="col-xl-12 col-lg-12">
        <div class="alert alert-success my-3" style="display:none;" id="success"></div>
        
        <div class="card">
            <div class="card-header d-flex justify-content-between align-items-center">
                <h4 class="card-title mb-0">Add Salary structures</h4>
                <a href="javascript:history.back()" class="btn btn-sm btn-light">
                    <i class="ri-arrow-left-line"></i> Back
                </a>
            </div>
            
            <div class="card-body">
                <form accept-charset="utf-8" name="add-form" id="add-form" >
                    @csrf
                    <div class="row">

<div class="mt-2 col-xs-12 col-sm-12 col-md-4 col-lg-4">        
<label class='form-label'>{{ $dbs_salary_structures['client_id_req'];}}{{ $dbs_salary_structures['client_id_title']}}: </label>
 <select name="client_id" id="add-client_id"  class="chosen-select form-control form-select">
    <option value="">{{ $dbs_salary_structures['client_id_req'];}}Select {{ $dbs_salary_structures['client_id_title'] }} </option>
    @foreach($client_id as $id => $name)
        @php
    $selected = ($id == '') ? 'selected="selected"' : '';
@endphp
        <option value="{{ $id }}"  {{ $selected }}>{{ $name }}</option>
    @endforeach
</select>
<script>
    $(function() {
        $('#add-client_id').chosen({
              width: '100%',
              search_contains: true
            });
        });
</script>
<span class='text-danger' id='add-client_idError'></span>
</div>

<div class="mt-2 col-xs-12 col-sm-12 col-md-4 col-lg-4">        
<label class='form-label'>{{ $dbs_salary_structures['employee_id_req'];}}{{ $dbs_salary_structures['employee_id_title']}}: </label>
 <select name="employee_id" id="add-employee_id"  class="chosen-select form-control form-select">
    <option value="">{{ $dbs_salary_structures['employee_id_req'];}}Select {{ $dbs_salary_structures['employee_id_title'] }} </option>
    @foreach($employee_id as $id => $name)
        @php
    $selected = ($id == '') ? 'selected="selected"' : '';
@endphp
        <option value="{{ $id }}"  {{ $selected }}>{{ $name }}</option>
    @endforeach
</select>
<script>
    $(function() {
        $('#add-employee_id').chosen({
              width: '100%',
              search_contains: true
            });
        });
</script>
<span class='text-danger' id='add-employee_idError'></span>
</div>

<div class="col-lg-4">
    <div class="mb-3">
        <label class='form-label'>{{ $dbs_salary_structures['basic_salary_req'];}}{{ $dbs_salary_structures['basic_salary_title']}}:</label>
        <input type = '{{$dbs_salary_structures['basic_salary_html5_type'] }}' name = "basic_salary" id = "add-basic_salary" data-maxlen='{{ $dbs_salary_structures['basic_salary_max'] }}' data-scale='{{ $dbs_salary_structures['basic_salary_scale'] ?? '' }}' autocomplete = 'off'   value='' @if($dbs_salary_structures['basic_salary_html5_req']!='') {{ $dbs_salary_structures['basic_salary_html5_req'] }} = {{$dbs_salary_structures['basic_salary_html5_req']}} @endif class= 'form-control'   onkeydown='validateFloatInput(event)'  oninput='validateInput(this,{{  $dbs_salary_structures['basic_salary_max'] }})' />
        <span class='text-danger' id='add-basic_salaryError'></span>
    </div>
</div>

<div class="col-lg-4">
    <div class="mb-3">
        <label class='form-label'>{{ $dbs_salary_structures['house_allowance_req'];}}{{ $dbs_salary_structures['house_allowance_title']}}:</label>
        <input type = '{{$dbs_salary_structures['house_allowance_html5_type'] }}' name = "house_allowance" id = "add-house_allowance" data-maxlen='{{ $dbs_salary_structures['house_allowance_max'] }}' data-scale='{{ $dbs_salary_structures['house_allowance_scale'] ?? '' }}' autocomplete = 'off'   value='' @if($dbs_salary_structures['house_allowance_html5_req']!='') {{ $dbs_salary_structures['house_allowance_html5_req'] }} = {{$dbs_salary_structures['house_allowance_html5_req']}} @endif class= 'form-control'   onkeydown='validateFloatInput(event)'  oninput='validateInput(this,{{  $dbs_salary_structures['house_allowance_max'] }})' />
        <span class='text-danger' id='add-house_allowanceError'></span>
    </div>
</div>

<div class="col-lg-4">
    <div class="mb-3">
        <label class='form-label'>{{ $dbs_salary_structures['medical_allowance_req'];}}{{ $dbs_salary_structures['medical_allowance_title']}}:</label>
        <input type = '{{$dbs_salary_structures['medical_allowance_html5_type'] }}' name = "medical_allowance" id = "add-medical_allowance" data-maxlen='{{ $dbs_salary_structures['medical_allowance_max'] }}' data-scale='{{ $dbs_salary_structures['medical_allowance_scale'] ?? '' }}' autocomplete = 'off'   value='' @if($dbs_salary_structures['medical_allowance_html5_req']!='') {{ $dbs_salary_structures['medical_allowance_html5_req'] }} = {{$dbs_salary_structures['medical_allowance_html5_req']}} @endif class= 'form-control'   onkeydown='validateFloatInput(event)'  oninput='validateInput(this,{{  $dbs_salary_structures['medical_allowance_max'] }})' />
        <span class='text-danger' id='add-medical_allowanceError'></span>
    </div>
</div>

<div class="col-lg-4">
    <div class="mb-3">
        <label class='form-label'>{{ $dbs_salary_structures['transport_allowance_req'];}}{{ $dbs_salary_structures['transport_allowance_title']}}:</label>
        <input type = '{{$dbs_salary_structures['transport_allowance_html5_type'] }}' name = "transport_allowance" id = "add-transport_allowance" data-maxlen='{{ $dbs_salary_structures['transport_allowance_max'] }}' data-scale='{{ $dbs_salary_structures['transport_allowance_scale'] ?? '' }}' autocomplete = 'off'   value='' @if($dbs_salary_structures['transport_allowance_html5_req']!='') {{ $dbs_salary_structures['transport_allowance_html5_req'] }} = {{$dbs_salary_structures['transport_allowance_html5_req']}} @endif class= 'form-control'   onkeydown='validateFloatInput(event)'  oninput='validateInput(this,{{  $dbs_salary_structures['transport_allowance_max'] }})' />
        <span class='text-danger' id='add-transport_allowanceError'></span>
    </div>
</div>

<div class="col-lg-4">
    <div class="mb-3">
        <label class='form-label'>{{ $dbs_salary_structures['bonus_req'];}}{{ $dbs_salary_structures['bonus_title']}}:</label>
        <input type = '{{$dbs_salary_structures['bonus_html5_type'] }}' name = "bonus" id = "add-bonus" data-maxlen='{{ $dbs_salary_structures['bonus_max'] }}' data-scale='{{ $dbs_salary_structures['bonus_scale'] ?? '' }}' autocomplete = 'off'   value='' @if($dbs_salary_structures['bonus_html5_req']!='') {{ $dbs_salary_structures['bonus_html5_req'] }} = {{$dbs_salary_structures['bonus_html5_req']}} @endif class= 'form-control'   onkeydown='validateFloatInput(event)'  oninput='validateInput(this,{{  $dbs_salary_structures['bonus_max'] }})' />
        <span class='text-danger' id='add-bonusError'></span>
    </div>
</div>

<div class="col-lg-4">
    <div class="mb-3">
        <label class='form-label'>{{ $dbs_salary_structures['tax_req'];}}{{ $dbs_salary_structures['tax_title']}}:</label>
        <input type = '{{$dbs_salary_structures['tax_html5_type'] }}' name = "tax" id = "add-tax" data-maxlen='{{ $dbs_salary_structures['tax_max'] }}' data-scale='{{ $dbs_salary_structures['tax_scale'] ?? '' }}' autocomplete = 'off'   value='' @if($dbs_salary_structures['tax_html5_req']!='') {{ $dbs_salary_structures['tax_html5_req'] }} = {{$dbs_salary_structures['tax_html5_req']}} @endif class= 'form-control'   onkeydown='validateFloatInput(event)'  oninput='validateInput(this,{{  $dbs_salary_structures['tax_max'] }})' />
        <span class='text-danger' id='add-taxError'></span>
    </div>
</div>

<div class="col-lg-4">
    <div class="mb-3">
        <label class='form-label'>{{ $dbs_salary_structures['provident_fund_req'];}}{{ $dbs_salary_structures['provident_fund_title']}}:</label>
        <input type = '{{$dbs_salary_structures['provident_fund_html5_type'] }}' name = "provident_fund" id = "add-provident_fund" data-maxlen='{{ $dbs_salary_structures['provident_fund_max'] }}' data-scale='{{ $dbs_salary_structures['provident_fund_scale'] ?? '' }}' autocomplete = 'off'   value='' @if($dbs_salary_structures['provident_fund_html5_req']!='') {{ $dbs_salary_structures['provident_fund_html5_req'] }} = {{$dbs_salary_structures['provident_fund_html5_req']}} @endif class= 'form-control'   onkeydown='validateFloatInput(event)'  oninput='validateInput(this,{{  $dbs_salary_structures['provident_fund_max'] }})' />
        <span class='text-danger' id='add-provident_fundError'></span>
    </div>
</div>

<div class="col-lg-4">
    <div class="mb-3">
        <label class='form-label'>{{ $dbs_salary_structures['other_deductions_req'];}}{{ $dbs_salary_structures['other_deductions_title']}}:</label>
        <input type = '{{$dbs_salary_structures['other_deductions_html5_type'] }}' name = "other_deductions" id = "add-other_deductions" data-maxlen='{{ $dbs_salary_structures['other_deductions_max'] }}' data-scale='{{ $dbs_salary_structures['other_deductions_scale'] ?? '' }}' autocomplete = 'off'   value='' @if($dbs_salary_structures['other_deductions_html5_req']!='') {{ $dbs_salary_structures['other_deductions_html5_req'] }} = {{$dbs_salary_structures['other_deductions_html5_req']}} @endif class= 'form-control'   onkeydown='validateFloatInput(event)'  oninput='validateInput(this,{{  $dbs_salary_structures['other_deductions_max'] }})' />
        <span class='text-danger' id='add-other_deductionsError'></span>
    </div>
</div>

<div class="col-lg-4">
    <div class="mb-3">
        <label class='form-label'>{{ $dbs_salary_structures['effective_from_req'];}}{{ $dbs_salary_structures['effective_from_title']; }}:</label>
        <input type = '{{$dbs_salary_structures['effective_from_html5_type'] }}' name = "effective_from" id = "add-effective_from" autocomplete = 'off' @if($dbs_salary_structures['effective_from_html5_req']!='') {{ $dbs_salary_structures['effective_from_html5_req'] }} = {{$dbs_salary_structures['effective_from_html5_req']}} @endif class= 'form-control dateBox' >
        <span class='text-danger' id='add-effective_fromError'></span>
        
        <script>
            $(function() {
                $( '#add-effective_from' ).datepicker({
                    changeMonth: true,
                    changeYear: true
                });
                $( '#add-effective_from' ).datepicker( 'option', 'yearRange', 'c-100:c+10' );
                $( '#add-effective_from' ).datepicker( 'option', 'dateFormat', 'yy-mm-dd' );
                $('#add-effective_from').datepicker('setDate', '{{date("y-m-d")}}' );                
            });
        </script>
    </div>
</div>

<div class="col-lg-4">
    <div class="mb-3">
        <label class='form-label'>{{ $dbs_salary_structures['status_req'];}}{{ $dbs_salary_structures['status_title']; }}:</label><br/>
        <div class="mt-2">
            @php
            $options = $dbs_salary_structures['status_array'];
            @endphp

            @foreach ($options as $key => $value)
                @php
                $checked = ($key == 'Active') ? 'checked="checked"' : '';
                @endphp

                <label class="btn btn-outline-primary">
                    <input type="radio" name="status" value="{{ $key }}" id="add-status" {{ $checked }}/> {{ $value }}
                </label>
            @endforeach
        </div>
    </div>
</div>

    
                    </div>
                    

                    <div class="p-3 mb-3 rounded">
                        <div class="row justify-content-end g-2">
                            <div class="col-lg-3">
                                <button type='submit' name='add-submit' id='add-submit' class='btn btn-outline-secondary w-100' data-args1='{{ route("salary-structures.store") }}' data-args2='admin/salary-structures' onclick='addUpdate(event, "add")'>
                                    <i class="ri-save-line"></i> Save 
                                </button>
                            </div>
                            <div class="col-lg-2">
                                <a href="{{ route('salary-structures.index') }}" class="btn btn-primary w-100">
                                    <i class="ri-close-circle-line"></i> Cancel
                                </a>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

@endsection

