IMMREX7
@extends('schools.school_layout')
@section('content')
<div class="row clearfix">
<div class="col-sm-12">
<div class="card">
<div class="header">
<h2><strong>Student Strength</strong></h2>
</div>
<div class="body table-responsive">
{!! Form::open(['method' => 'GET', 'action' => ['School\ClassPromotionController@stdStrength'], 'class' => 'form-horizontal']) !!}
<div class="row clearfix">
<div class="col-sm-1 form-control-label">
<label for="classname">Class</label>
</div>
<div class="col-sm-3">
<div class="form-group">
{!! Form::select('idClass',$classes,null,['class' => 'form-control show-tick ms select2']) !!}
</div>
<span id='classerror'></span>
</div>
<div class="col-sm-1 form-control-label">
<label for="classname">Section</label>
</div>
<div class="col-sm-3">
<div class="form-group">
<select name='idSection' id="idSection" class="form-control show-tick ms"></select>
</div>
<span id='sectionerror'></span>
</div>
<div class="col-sm-2">
{!! Form::submit('SHOW',['class' => 'btn btn-raised btn-primary btn-round waves-effect']) !!}
{!! Form::close() !!}
</div>
</div>
<table class="table table-bordered table-striped table-hover dataTable js-exportable" id="table-1">
<thead>
<tr>
<th>Class</th>
<th>Section</th>
<th>Girls</th>
<th>Boys</th>
<th>Total</th>
</tr>
</thead>
<?php $gt = 0;?>
<?php $bt = 0;?>
<?php $cn = '' ?>
<tbody>
@foreach($students as $value)
@if(strcmp($cn,$value->className)!=0)
@if($gt+$bt > 0 && $cn != '')
<tr>
<td>{{ $cn }}</td>
<th>Total:</th>
<th>{{ $gt }}</th>
<th>{{ $bt }}</th>
<th>{{ $gt+$bt }}</th>
</tr>
<?php $gt = 0;
$bt = 0; ?>
@endif
@endif
<tr>
<td>{{ $value->className }}</td>
<td>{{ $value->sectionName ?: 'not set' }} (<strong>{{ $value->studentType }}</strong>)</td>
<td>{{ $value->girls }}</td>
<td>{{ $value->boys }}</td>
<td>{{ $value->girls+$value->boys }}</td>
</tr>
<?php $gt += intval($value->girls); ?>
<?php $bt += intval($value->boys); ?>
<?php $cn = $value->className; ?>
@endforeach
@if($gt+$bt > 0 && $cn != '')
<tr>
<td>{{ $cn }}</td>
<th>Total:</th>
<th>{{ $gt }}</th>
<th>{{ $bt }}</th>
<th>{{ $gt+$bt }}</th>
</tr>
<?php $gt = 0;
$bt = 0; ?>
@endif
</tbody>
<tfoot>
<tr>
<th></th>
<th>Total Strength:</th>
<th>{{ $totals['girls'] }}</th>
<th>{{ $totals['boys'] }}</th>
<th>{{ $totals['total'] }}</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
@stop
@section('script')
<script>
$('select[name="idClass"]').on('change', function() {
var classID = $(this).val();
if(classID) {
$.ajax({
url: "{{url('/school/class') }}"+'/' +classID + "/sections",
type: "GET",
dataType: "json",
success:function(data) {
$('select[name="idSection"]').empty();
$('select[name="idSection"]').append('<option value="">--- Select ---</option>');
$.each(data, function(key, value) {
$('select[name="idSection"]').append('<option value="'+ key +'">'+ value +'</option>');
});
}
});
}else{
$('select[name="idSection"]').empty();
}
});
$(document).ready(function () {
function sortTable(){
var class_name = '';
var cur_class = '';
var first_row = '';
var rows = [];
var rwcnt=0;
var cnt = 0;
var td_rows;
$('#table-1 tbody tr').each(function(index, row){
cur_class = $('td:first',row).text();
if(class_name != cur_class) {
if(cnt > 0){
$(first_row).children().first().attr("rowspan", cnt);
rows = [];
cnt = 0;
}
class_name = cur_class;
first_row = row;
}
if(row != first_row) {
$(row).children().first().remove();
}
rows[cnt] = row;
cnt++;
});
if(cnt > 0){
$(first_row).children().first().attr("rowspan", cnt);
rows = [];
cnt = 0;
}
}
sortTable();
$(document).on("click", "ul.pagination li" , function() {
//sortTable();
});
});
</script>
@stop
Copyright © 2021 -