
<div class="modal fade" id="md_update_payroll_detail" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  {{ Form::open(array('route' => 'payroll_detail.update', 'class' => 'cls_form', 'id' => 'form_update_payroll_detail')) }}
  <div class="modal-dialog modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Update Payroll Detail</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true"></span>
        </button>
      </div>
      <div class="modal-body ">
        <div class = "card">
          <div class ="card-body form-fieldset">
        @foreach($contract_list as $rows)
          <div class="row">
         
          <div class="col-md-4">

            <b>Name of Employee: </b> {{$rows->user->name}}
              </div>
                <div class="col-md-4">
           
            <b>Department: </b> 
              </div>
             <div class="col-md-4">

            <b>Designation: </b> {{$rows->contract->designation->title}}
          </div>
           </div>
           <div class = "row">

            <div class="col-md-4">

            <b> Scale: </b> {{$rows->contract->designation->title}}
              </div>
                <div class="col-md-4">

            <b>Joining Date: </b> {{EF::dateFormat($rows->contract->start_date)}}
              </div>
             <div class="col-md-4">

            <b> Fixed Salary: </b>  {{EF::numberFormat($rows->contract->basic_salary)}}
              </div>
            </div>

             <div class = "row">

            <div class="col-md-4">

            <b> Month: </b> {{$curr_month}} {{$curr_year}}
              </div>
    
             <div class="col-md-4">

            <b> No. of Days: </b>
              </div>
            <div class="col-md-4">

            <b> Issue Date: </b>
              </div>
            </div>

    
        
     
  
          </div>
        </div> 

                  <div class ="card-body form-fieldset">
            <h6><center>BASIC SALARY</center></h6>
            <table style =" width:100%;">
              <thead>
                <tr style = "text-align:center;">
                  <th>Sr.</th>
                  <th>Description</th>
                  <th>Amount</th>
                </tr>
              </thead>
             <tbody>

              <tr style = "text-align: center;">
                <td>{{$loop->iteration}}</td>
                  <td style = "width:50%;">Basic Salary</td>
                   <td style = "width:50%;"><input class = "form-control form-control-sm basic_salary" readonly = "true" type = "number" name = "basic_salary" value = "{{$rows->amount}}"/></td>
              </tr>
              @endforeach
             </tbody>

            </table>

   
        </div> 

        @if(@count($contract_detail_list) >0)   
          <div class ="card-body form-fieldset">
            <h6><center>ALLOWANCES</center></h6>
            <table style =" width:100%;">
              <thead>
                <tr style = "text-align:center;">
                  <th>Sr.</th>
                  <th>Description</th>
                  <th>Amount</th>
                </tr>
              </thead>
             <tbody>
              @foreach($contract_detail_list as $rows)
              <tr>
                <td  style = "text-align: center;">{{$loop->iteration}}</td>
                <input type = "hidden" name = "allowances[]" value = "{{Crypt::encrypt($rows->contract_detail_id)}}" />

                  <td style = "text-align: center; width:50%;">{{$rows->getAllowanceName($rows->contract_detail_id)}}</td>
                          
                   <td style = "text-align: center;  width:50%;"><input class = "form-control form-control-sm allowance_{{$unique_id}} type = "number" name = "allowance_amount[]"  onkeyup = "calculateGross(event,'{{$unique_id}}'); getCurrentAllowance(event,this)" value = "{{$rows->amount}}"/>
                   <small class="form-errors pull-right req" value="">{{ $errors->first('allowance_amount[]',":message") }}</small></td>
             
              </tr>
              @endforeach

             </tbody>
             

            </table>
   
        </div>
        @endif

            <div class ="card-body form-fieldset">
            <h6><center>DEDUCTIONS</center></h6>
                           <small  style = "margin-bottom:2%;" class="float-right btn btn-sm btn-primary" onclick="showDeductionModal('form_add_deduction','md_add_deduction','{{Crypt::encrypt($user_id)}}','{{Crypt::encrypt($minute_id)}}')" >Add Deduction</small> &nbsp;&nbsp;

            <table style =" width:100%;">
              <thead>
                <tr style = "text-align:center;">
                  <th>Sr.</th>
                  <th>Description</th>
                  <th>Amount</th>
                </tr>
              </thead>
             <tbody>
              @if(@count($deduction_list)> 0)
              @foreach($deduction_list as $rows)


              <tr style = "text-align: center;">
                <td>{{$loop->iteration}}</td>
                 <input type = "hidden" name = "deductions[]" value = "{{Crypt::encrypt($rows->deduction_id)}}" />
                  <td style = "width:50%;">{{$rows->deduction->title}}</td>
                   
                   <td style = "width:50%;"><input class = "form-control form-control-sm deduction_{{$unique_id}}" type = "text" name = "deduction_amount[]"  onkeyup = "calculateGross(event,'{{$unique_id}}');getCurrentDeduction(event,this);" value = "{{$rows->amount}}"/>
                    <small class="form-errors pull-right req" value="">{{ $errors->first('deduction_amount[]',":message") }}</small>
                   </td>
              </tr>

              @endforeach
              @else
              <tr style = "text-align: center;">
                <td colspan = "3">
                  No Deduction found
                </td>
              </tr>
              @endif 

   
             </tbody>

            </table>
   
        </div> 

              <div class ="card-body form-fieldset">
 
          <div class="row">

            <div class="col-md-4">
           
            <b>Allowance Sum: </b>  <input name ="taxable_amount" class = "form-control form-control-sm allowance_sum" value= "{{$allowance_sum}}" placeholder="Taxable Amount" readonly="true" type = "text"  />
              </div>

                <div class="col-md-4">
           
            <b>Deduction Sum: </b>  <input name ="taxable_amount" class = "form-control form-control-sm deduction_sum" value= "{{$deduction_sum}}" placeholder="Taxable Amount" readonly="true" type = "text"  />
              </div>
         
          <div class="col-md-4">
  
            <b>Gross Salary: </b> <input name ="gross_salary" class = "form-control form-control-sm gross_salary"  value= "{{$gross_salary}}" readonly="true" type = "text"  onkeyup = "calculateGross(event,'{{$unique_id}}')"   />
            <small class="form-errors pull-right req" value="">{{ $errors->first('gross_salary',":message") }}</small>
              </div>
         {{--

           <div class="col-md-4">
           
            <b>Taxable Amount: </b>  <input name ="taxable_amount" class = "form-control form-control-sm" value= "{{$taxable_amount}}" placeholder="Taxable Amount" readonly="true" type = "text"  />
              </div>
             <div class="col-md-4">

            <b>Net Salary </b> <input name ="net_salary" class = "form-control form-control-sm" placeholder="Net Salary" value= "{{$net_salary}}" readonly="true" type = "text"  />
          </div>

          --}}      
           </div>

          </div>


      </div>
      <input type = "hidden" name = "user_id" class = "user_id">

     <input type = "hidden" name = "minute_id" class = "minute_id">

      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
      <button type="submit" class="btn btn-primary " onclick="updatePayrollDetail(event,this);"content="update payroll detail">Update</button>
      </div>
    </div>
  </div>
  {{ Form::close() }}
</div>