123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- @extends('layouts.master')
- @section('content')
- <div class="content">
- <div class="row" style="min-height: 500px">
- <form action="{{ url('admin/grade_structure/update') }}" enctype="multipart/form-data" method="POST" role="form">
- <div class="col-md-8 col-md-offset-2">
- <header class="panel-heading" style="height:50px;">
- <div class="pull-left">
- {{$title}}
- </div>
- <div>
- @if(\Auth::user()->utype==1)
- <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>
- @endif
- </div>
- </header>
- </div>
- <div class="col-md-8 col-md-offset-2">
- <div class="panel panel-default">
- <div class="panel-body">
- {{ csrf_field() }}
-
- <div class="col-md-10 col-md-offset-1">
- <h4>{{ $grade_id->name }} :</h4>
- <table class="table table-bordered">
- <tbody>
- <input type="hidden" name="grade_id" value="{{$grade_id->id}}" class="hidden">
- <?php $newhead=array(); $old_amount=0;$new_amount=0; ?>
- @if(!empty($single))
- @foreach($single as $row)
- <tr>
-
- <input type="hidden" name="head_id[]" value="{{$row->head_id}}" class="hidden">
- <td>{{$row->head->name}}</td>
- <td><input type="text" name="amount[]" value="{{$row->amount}}" class="form-control text-right get_amount" required=""></td>
- </tr>
- <?php
- $old_amount = $old_amount + $row->amount;
- $newhead[] = $row->head_id;
- ?>
- @endforeach
- @endif
- @foreach($heads as $head)
- @if(!in_array($head->id,$newhead))
- <tr>
- <input type="hidden" name="head_id[]" value="{{$head->id}}" class="hidden">
- <td>{{$head->name}}</td>
- <td><input type="text" name="amount[]" value="0" class="form-control text-right get_amount" required=""></td>
- </tr>
- @endif
- @endforeach
- <tr>
- <td>Total Amount:</td>
- <td class="text-right"><span class="total_amount">{{ number_format($old_amount) }}</span> TK.</td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="col-md-10 col-md-offset-1" style="margin-top: 30px;">
- <a href="{{ url('admin/grade_structure') }}" class="btn btn-default pull-left">
- <span class="btn-icon">
- <i class="fa fa-times"></i>
- </span>
- Cancel
- </a>
- <button type="submit" class="btn btn-inline btn-success pull-right">
- <span class="btn-icon">
- <i class="fa fa-save"></i>
- </span>
- Update
- </button>
- </div>
- </div>
- </div>
- </div>
- </form>
- </div>
- </div>
- @stop
- @section('script')
- <script type="text/javascript">
- $('.get_amount').on('keyup', function(){
- var total = 0;
- // on every keyup, loop all the elements and add all the results
- $('.get_amount').each(function(index, element) {
- var val = parseFloat($(element).val());
- if( !isNaN( val )){
- total += val;
- }
- });
- $('.total_amount').html(total);
- });
- </script>
- @if(Session::has('msg'))
- <div class="alert alert-success center-block msg_alt" >
- <a class="close" data-dismiss="alert" href="#">×</a>
- <strong><i class="fa fa-check"></i></strong>
- {{Session::get('msg')}}
- </div>
- @endif
- @stop
|