edit.blade.php 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. @extends('layouts.master')
  2. @section('content')
  3. <div class="content">
  4. <div class="row" style="min-height: 500px">
  5. <form action="{{ url('admin/payroll/update/'.$single->id) }}" enctype="multipart/form-data" method="POST" role="form">
  6. <div class="col-md-8 col-md-offset-2">
  7. <header class="panel-heading" style="height:50px;">
  8. <div class="pull-left">
  9. {{$title}}
  10. </div>
  11. <div>
  12. @if(\Auth::user()->utype==1)
  13. <a style="margin-left: 3px" href="{{ url('admin/payroll') }}" class="btn btn-sm btn-info pull-right"><i class="fa fa-arrow-left"></i> Back </a>
  14. @endif
  15. </div>
  16. </header>
  17. </div>
  18. <div class="col-md-8 col-md-offset-2">
  19. <div class="panel panel-default">
  20. <div class="panel-body">
  21. @if ($errors->any())
  22. <div class="alert alert-danger">
  23. <ol>
  24. @foreach ($errors->all() as $error)
  25. <li>{{ $error }}</li>
  26. @endforeach
  27. </ol>
  28. </div>
  29. @endif
  30. {{ csrf_field() }}
  31. <div class="col-md-10 col-md-offset-1">
  32. <div class="col-md-6 text-left" style="padding: 0px">
  33. <b>Name : </b> {{ $single->employee->name }}
  34. </div>
  35. <div class="col-md-6 text-right" style="padding: 0px">
  36. <b>Grade : </b> {{ $single->grade->name }}
  37. </div><br/><br/>
  38. <table class="table table-bordered">
  39. <tbody>
  40. @php $total=0 @endphp
  41. @foreach($single->psHead as $data)
  42. <tr>
  43. <th>{{$data->head->name}} </th>
  44. <td class="text-right"> {{ number_format($data->amount,2) }}</td>
  45. </tr>
  46. @php $total = $total + $data->amount @endphp
  47. @endforeach
  48. <tr>
  49. <th>Total Salary </th>
  50. <th class="text-right"> {{ number_format($total,2) }} TK. </th>
  51. </tr>
  52. </tbody>
  53. </table>
  54. <table class="table table-bordered">
  55. <h4>Pay Now :</h4>
  56. <tbody>
  57. @php $total_due=0 @endphp
  58. @foreach($single->payableDue as $payableDue)
  59. @if($payableDue->gross_amount > $payableDue->paid_amount)
  60. @php $due= $payableDue->gross_amount - $payableDue->paid_amount; $total_due = $total_due + $due @endphp
  61. <input type="hidden" name="prh_id[]" value="{{ $payableDue->id }}" class="hidden">
  62. <tr>
  63. <td>
  64. {{ date('d/m/Y', strtotime($payableDue->date)) }}
  65. </td>
  66. <td><input type="text" name="dues[]" id="dues" class="form-control text-right get_amount" value="{{$due}}" required></td>
  67. </tr>
  68. @endif
  69. @endforeach
  70. <tr>
  71. <th>Payable Amount</th>
  72. <th class="text-right"><span class="total_amount">{{ number_format($total_due) }}</span> TK.</th>
  73. </tr>
  74. <tr>
  75. <th>Media</th>
  76. <td>
  77. <select class="form-control" name="media" required="">
  78. <option disabled="" selected="" value="">Choice One..</option>
  79. @foreach($media as $row)
  80. <option value="{{$row->id}}"> {{$row->name}} </option>
  81. @endforeach
  82. </select>
  83. </td>
  84. </tr>
  85. <tr>
  86. <th>Description</th>
  87. <td>
  88. <textarea name="description" class="form-control" rows="3" placeholder="Description"></textarea>
  89. </td>
  90. </tr>
  91. <input type="hidden" name="emp_id" value="{{ $single->employee->id }}" class="hidden">
  92. </tbody>
  93. </table>
  94. </div>
  95. <div class="col-md-10 col-md-offset-1">
  96. {{-- <a href="{{ url('admin/payroll_structure') }}" class="btn btn-default pull-left">
  97. <span class="btn-icon">
  98. <i class="fa fa-times"></i>
  99. </span>
  100. Cancel
  101. </a> --}}
  102. <button type="submit" class="btn btn-inline btn-success pull-right">
  103. <span class="btn-icon">
  104. <i class="fa fa-credit-card"></i>
  105. </span>
  106. Pay
  107. </button>
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. </form>
  113. </div>
  114. </div>
  115. @stop
  116. @section('script')
  117. <script type="text/javascript">
  118. $('.get_amount').on('keyup', function(){
  119. var total = 0;
  120. // on every keyup, loop all the elements and add all the results
  121. $('.get_amount').each(function(index, element) {
  122. var val = parseFloat($(element).val());
  123. if( !isNaN( val )){
  124. total += val;
  125. }
  126. });
  127. $('.total_amount').html(total);
  128. });
  129. </script>
  130. @if(Session::has('msg'))
  131. <div class="alert alert-success center-block msg_alt" >
  132. <a class="close" data-dismiss="alert" href="#">&times;</a>
  133. <strong><i class="fa fa-check"></i></strong>&nbsp;
  134. {{Session::get('msg')}}
  135. </div>
  136. @endif
  137. @stop