IMMREX7
@extends('schools.school_layout')
@section('content')
<div class="row clearfix">
<div class="col-sm-12">
<div class="card">
<div class="header">
<h2><strong>Edit </strong> Fee Header</h2>
</div>
<div class="body">
{!! Form::model($feehead, ['method' => 'PATCH', 'action' => ['School\NorthFeeHeaderController@update', $feehead->idFeehead], 'class' => 'form-horizontal']) !!}
<input type="hidden" name="demand_pv" value="{{$feehead->idFeehead}}"/>
<div class="row clearfix">
<div class="col-sm-2 form-control-label required">
<label for="classname">Select Class</label>
</div>
<div class="col-sm-3">
<div class="form-group">
{!! Form::select('idClass',$classes,null,['class' => 'form-control show-tick ms','disabled'=>'disabled']) !!}
@if ($errors->has('idClass'))
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong>{{ $errors->first('idClass') }}</strong>
</label>
@endif
<span id='classerror'></span>
</div>
</div>
<div class="col-sm-2 form-control-label required">
<label for="classname">Select Section</label>
</div>
<div class="col-sm-3">
<div class="form-group">
{!! Form::select('idSection',$sections,null,['class' => 'form-control show-tick ms']) !!}
@if ($errors->has('idSection'))
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong>{{ $errors->first('idSection') }}</strong>
</label>
@endif
<span id='sectionerror'></span>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-2 form-control-label required">
<label for="classname">Demand Name</label>
</div>
<div class="col-sm-3">
<div class="form-group">
{!! Form::text('demandName',null,['class' => 'form-control']) !!}
<span id='feeheaderror'></span>
</div>
</div>
<div class="col-sm-2 form-control-label required">
<label for="classname">Student Category</label>
</div>
<div class="col-sm-3">
<div class="form-group">
<div class="checkbox-inline" style="padding-left:10px;"><input type="checkbox" name="studentCategory" value="{{$feehead->studentCategory}}" class="categoryclass" checked disabled>
<label> {{$feehead->studentCategory}} </label>
</div>
@if ($errors->has('studentCategory'))
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong>{{ $errors->first('studentCategory') }}</strong>
</label>
@endif
<span id='categoryerror'></span>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-2 form-control-label required">
<label for="classname">From Date</label>
</div>
<div class="col-sm-3">
<div class="form-group">
{!! Form::text('fromDate',null,['class' => 'form-control datepicker']) !!}
@if ($errors->has('fromDate'))
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong>{{ $errors->first('fromDate') }}</strong>
</label>
@endif
<span id='fdate_error'></span>
</div>
</div>
<div class="col-sm-2 form-control-label required">
<label for="classname">To Date</label>
</div>
<div class="col-sm-3">
<div class="form-group">
{!! Form::text('toDate',null,['class' => 'form-control datepicker']) !!}
@if ($errors->has('toDate'))
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong>{{ $errors->first('toDate') }}</strong>
</label>
@endif
<span id='todate_error'></span>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-2 form-control-label required">
<label for="classname">Amount</label>
</div>
<div class="col-sm-3">
<div class="form-group">
{!! Form::text('amount',null,['class' => 'form-control','onkeypress'=>'return onlyNumbersandSpecialChar(event)','readonly'=>'readonly']) !!}
@if ($errors->has('amount'))
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong>{{ $errors->first('amount') }}</strong>
</label>
@endif
<span id='amounterror'></span>
</div>
</div>
<div class="col-sm-2 form-control-label required">
<label for="finename">Select Fine</label>
</div>
<div class="col-sm-3">
<div class="form-group">
{!! Form::select('idFine',['flat'=>'Flat Fine','per'=>'Fine Per Day'],null,['class' => 'form-control show-tick ms select2']) !!}
@if ($errors->has('idFine'))
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong>{{ $errors->first('idFine') }}</strong>
</label>
@endif
<span id='fineerror'></span>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-2 form-control-label">
<label for="classname">Add EC No.</label>
</div>
<div class="col-sm-4">
<div class="form-group">
<div id="idStudent" style="border:1px solid #ccc; width:320px; height: 340px; overflow-y: scroll;">
@foreach($student as $key=>$value)
<?php
$ecNo= explode("(", $value);
$seach_str=substr($ecNo[1],0,8);
?>
<div class="checkbox-inline" style="padding-left:10px;"><input type="checkbox" name="students[]" value="{{$key}}" class="stdallselect" @if(in_array($seach_str,$description)) disabled @endif><label>{{$value}}</label></div>
@endforeach
</div>
</div>
@if ($errors->has('ecNO'))
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong>{{ $errors->first('ecNO') }}</strong>
</label>
@endif
</div>
<div class="row clearfix">
<div class="col-sm-2 form-control-label">
<label for="classname">EC No.</label>
</div>
<div class="col-sm-4">
<div class="form-group">
<div id="idSelectStudent" style="border:1px solid #ccc; width:320px; height: 340px; overflow-y: scroll;">
@foreach($students as $key=>$value)
<div class="checkbox-inline" style="padding-left:10px;"><input type="checkbox" name="students[]" value="{{$key}}" class="stdallselect" checked disabled><label>{{$value}}</label></div>
@endforeach
</div>
@if ($errors->has('ecNO'))
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong>{{ $errors->first('ecNO') }}</strong>
</label>
@endif
</div>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-2 form-control-label required">
<label for="classname">Description</label>
</div>
<div class="col-sm-8">
<table class="table" id="header_table">
<thead>
<tr>
<th></th>
<th>Header Name</th>
<th>Amount</th>
<th></th>
</tr>
</thead>
<tbody id="optional_list">
<?php $i =1;?>
@foreach($childheads as $headers)
<tr>
<input type="hidden" name="header[<?php echo $i;?>][prevName]" value="{{$headers->idHeader}}"/>
<td class="sno">{{$i}}</td>
<td>
{!! Form::select('header['.$i.'][idHeader]',$heads,$headers->idHeader,['class' => 'form-control show-tick ms']) !!}
</td>
<td>
<input class="form-control" type="number" name="header[<?php echo $i;?>][amountName]" required="required" value="{{$headers->amount}}" id="amount_<?php echo $i;?>"/>
<span id="amounterror1"></span>
</td>
<td style="text-align:right;vertical-align: middle;"><input type="submit" class="btn btn-sm btn-danger" value="Delete" data-id="{{$headers->idFeehead}}" id="remove_header"></td>
</tr>
<?php $i++ ; ?>
@endforeach
</tbody>
<tr>
<td colspan="4" style="text-align: right"><input type="button" class="add-row btn btn-sm btn-success" value="Add Row"></td>
</tr>
</table>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-8 offset-sm-2">
@if(isset($feehead))
{!! Form::submit('UPDATE',['class' => 'btn btn-raised btn-primary btn-round waves-effect disabled']) !!}
@else
{!! Form::submit('SAVE',['class' => 'btn btn-raised btn-primary btn-round waves-effect disabled','id'=>'submit-btn']) !!}
@endif
{!! Form::close() !!}
</div>
</div>
</div>
</div>
</div>
</div>
@stop
@section('script')
@include('schools.feeheads.feehead_script')
<script>
$(document).ready(function() {
var i = $('.sno:last').text();
$(".add-row").click(function(){
i++;
var markup = '<tr><td class="sno">'+i+'</td>\
<td><select name="header['+i+'][idHeader]" class = "form-control show-tick ms">@foreach($heads as $key=>$value)<option value="{{$key}}">{{$value}}</option>@endforeach</select><span id="headererror'+i+'"></span></td>\n\
<td><input class="form-control" type="number" name="header['+i+'][amountName]" required="required" id="amount_'+i+'"><span id="amounterror'+i+'"></span></td>\n\
<td style="text-align:right;vertical-align: middle;"><input type="button" class="btn btn-sm btn-danger" value="Delete" id="remove_row"></td></tr>';
$("#optional_list").append(markup);
});
$('#optional_list').on('click', 'input[type="button"]', function () {
$(this).closest('tr').remove();
i = $('.sno:last').text();
var totalAmount=0;
$("#optional_list tr").each(function() {
// Within tr we find the last td child element and get content
$(this).find("td").find("input").each(function() {
if(this.value !='Delete' && this.id !='' && this.value!='')
totalAmount=parseInt(totalAmount)+parseInt(this.value);
});
});
$( "input[name='amount']" ).val(totalAmount);
});
$("tbody").on("change", "input", function () {
if(this.id !=''){
var totalAmount=0;
$("#optional_list tr").each(function() {
// Within tr we find the last td child element and get content
$(this).find("td").find("input").each(function() {
if(this.value !='Delete' && this.id !='' && this.value!='')
totalAmount=parseInt(totalAmount)+parseInt(this.value);
});
});
$( "input[name='amount']" ).val(totalAmount);
}
});
});
$(document).on('click', '#remove_header', function (e) {
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
e.preventDefault();
var id = $(this).data('id');
var row_index = $(this).closest('tr');
swal({
title: "Are you sure?",
text: "Are You sure you want to delete this feeheader!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, delete it!",
closeOnConfirm: true
},
function() {
// console.log('here');
$.ajax({
type: "DELETE",
url: "{{url('/school/north/feeheads/')}}" +"/"+id,
data: {id:id}
})
.done(function(data) {
swal({
title: "Deleted",
text: "Feehead has been successfully deleted",
type: "success"
},function() {
row_index.remove();
var totalAmount=0;
$("#optional_list tr").each(function() {
// Within tr we find the last td child element and get content
$(this).find("td").find("input").each(function() {
if(this.value !='Delete' && this.id !='' && this.value!='')
totalAmount=parseInt(totalAmount)+parseInt(this.value);
});
});
$( "input[name='amount']" ).val(totalAmount);
});
})
.error(function(data) {
swal("Oops", "We couldn't connect to the server!", "error");
});
return false;
});
});
</script>
@stop
Copyright © 2021 -