edit.blade.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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_structure/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_structure') }}" 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" 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 }}<br/><br/>
  37. </div>
  38. <table class="table table-bordered ">
  39. <tbody>
  40. <?php $newhead=array(); $old_amount=0;$new_amount=0;?>
  41. @foreach($single->psHead as $data)
  42. <tr>
  43. <td>{{$data->head->name}} <input type="didden" name="head[]" class="hidden" value="{{$data->head->id}}"></td>
  44. <td>
  45. <input type="text" class="form-control text-right get_amount" name="amount[]" value="{{ $data->amount }}" placeholder="Amount">
  46. </td>
  47. </tr>
  48. <?php
  49. $newhead[] = $data->head->id;
  50. $old_amount = $old_amount + $data->amount;
  51. ?>
  52. @endforeach
  53. @foreach($head as $row)
  54. @if(!in_array($row->head_id,$newhead))
  55. <tr style="background: #eee">
  56. <td>{{$row->head->name}} <input type="didden" name="head[]" class="hidden" value="{{$row->head_id}}"></td>
  57. <td>
  58. <input type="text" class="form-control text-right get_amount" name="amount[]" value="{{ $row->amount }}" placeholder="Amount">
  59. </td>
  60. </tr>
  61. @php $new_amount = $new_amount + $row->amount @endphp
  62. @endif
  63. @endforeach
  64. <tr>
  65. <th colspan="2" class="text-right"> Total Salary : <span id="total">{{ number_format($old_amount + $new_amount) }}</span> TK.</th>
  66. </tr>
  67. </tbody>
  68. </table>
  69. </div>
  70. <div class="col-md-10 col-md-offset-1" style="margin-top: 30px;">
  71. <a href="{{ url('admin/payroll_structure') }}" class="btn btn-default pull-left">
  72. <span class="btn-icon">
  73. <i class="fa fa-times"></i>
  74. </span>
  75. Cancel
  76. </a>
  77. <button type="submit" class="btn btn-inline btn-success pull-right">
  78. <span class="btn-icon">
  79. <i class="fa fa-save"></i>
  80. </span>
  81. Update
  82. </button>
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. </form>
  88. </div>
  89. </div>
  90. @stop
  91. @section('script')
  92. <script type="text/javascript">
  93. $('.get_amount').on('keyup', function(){
  94. var total = 0;
  95. // on every keyup, loop all the elements and add all the results
  96. $('.get_amount').each(function(index, element) {
  97. var val = parseFloat($(element).val());
  98. if( !isNaN( val )){
  99. total += val;
  100. }
  101. });
  102. $('#total').html(total);
  103. });
  104. </script>
  105. @if(Session::has('msg'))
  106. <div class="alert alert-success center-block msg_alt" >
  107. <a class="close" data-dismiss="alert" href="#">&times;</a>
  108. <strong><i class="fa fa-check"></i></strong>&nbsp;
  109. {{Session::get('msg')}}
  110. </div>
  111. @endif
  112. @stop