edit.blade.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. @extends('layouts.master')
  2. @section('content')
  3. <div class="content">
  4. <div class="row" style="min-height: 500px">
  5. <form action="{{ url('admin/grade_structure/update') }}" 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/grade_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. {{ csrf_field() }}
  22. <div class="col-md-10 col-md-offset-1">
  23. <h4>{{ $grade_id->name }} :</h4>
  24. <table class="table table-bordered">
  25. <tbody>
  26. <input type="hidden" name="grade_id" value="{{$grade_id->id}}" class="hidden">
  27. <?php $newhead=array(); $old_amount=0;$new_amount=0; ?>
  28. @if(!empty($single))
  29. @foreach($single as $row)
  30. <tr>
  31. <input type="hidden" name="head_id[]" value="{{$row->head_id}}" class="hidden">
  32. <td>{{$row->head->name}}</td>
  33. <td><input type="text" name="amount[]" value="{{$row->amount}}" class="form-control text-right get_amount" required=""></td>
  34. </tr>
  35. <?php
  36. $old_amount = $old_amount + $row->amount;
  37. $newhead[] = $row->head_id;
  38. ?>
  39. @endforeach
  40. @endif
  41. @foreach($heads as $head)
  42. @if(!in_array($head->id,$newhead))
  43. <tr>
  44. <input type="hidden" name="head_id[]" value="{{$head->id}}" class="hidden">
  45. <td>{{$head->name}}</td>
  46. <td><input type="text" name="amount[]" value="0" class="form-control text-right get_amount" required=""></td>
  47. </tr>
  48. @endif
  49. @endforeach
  50. <tr>
  51. <td>Total Amount:</td>
  52. <td class="text-right"><span class="total_amount">{{ number_format($old_amount) }}</span> TK.</td>
  53. </tr>
  54. </tbody>
  55. </table>
  56. </div>
  57. <div class="col-md-10 col-md-offset-1" style="margin-top: 30px;">
  58. <a href="{{ url('admin/grade_structure') }}" class="btn btn-default pull-left">
  59. <span class="btn-icon">
  60. <i class="fa fa-times"></i>
  61. </span>
  62. Cancel
  63. </a>
  64. <button type="submit" class="btn btn-inline btn-success pull-right">
  65. <span class="btn-icon">
  66. <i class="fa fa-save"></i>
  67. </span>
  68. Update
  69. </button>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. </form>
  75. </div>
  76. </div>
  77. @stop
  78. @section('script')
  79. <script type="text/javascript">
  80. $('.get_amount').on('keyup', function(){
  81. var total = 0;
  82. // on every keyup, loop all the elements and add all the results
  83. $('.get_amount').each(function(index, element) {
  84. var val = parseFloat($(element).val());
  85. if( !isNaN( val )){
  86. total += val;
  87. }
  88. });
  89. $('.total_amount').html(total);
  90. });
  91. </script>
  92. @if(Session::has('msg'))
  93. <div class="alert alert-success center-block msg_alt" >
  94. <a class="close" data-dismiss="alert" href="#">&times;</a>
  95. <strong><i class="fa fa-check"></i></strong>&nbsp;
  96. {{Session::get('msg')}}
  97. </div>
  98. @endif
  99. @stop