IMMREX7
<?php $__env->startSection('content'); ?>
<div class="row clearfix">
<div class="card">
<div class="header">
<h2><strong>Add Marks</strong></h2>
</div>
<div class="alert alert-danger" role="alert" id="msg" style="display: none;">
</div>
<div class="body">
<?php echo Form::open(['url' => 'school/marks/create','class'=>'form-horizontal']); ?>
<div class="row clearfix">
<div class="col-sm-3">
<div class="form-group">
<label for="classname"><strong>Select Exam</strong></label><br>
<?php echo Form::select('examName',$examtype,['class' => 'form-control show-tick ms select2','required'=>'required']); ?>
<?php if($errors->has('examName')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('examName')); ?></strong>
</label>
<?php endif; ?>
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<label for="classname"><strong>Select Class</strong></label><br>
<?php echo Form::select('idClass',$classes,['class' => 'form-control show-tick ms select2','required'=>'required']); ?>
<?php if($errors->has('idClass')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('idClass')); ?></strong>
</label>
<?php endif; ?>
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<label for="classname"><strong>Select Section</strong></label><br>
<?php if($isSectionAll == "Y"): ?>
<input type="checkbox" id="idSectionAll" name="idSectionAll" value="selectall" checked>
<?php else: ?> <input type="checkbox" id="idSectionAll" name="idSectionAll" value="selectall">
<?php endif; ?>
<label for="idSectionAll" style="color:green"> Select All </label><br>
<select name="sections[]" multiple="multiple" id="idSection">
<?php if(isset($sections)): ?>
<?php if(count($sections)): ?>
<?php $__currentLoopData = $sections; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($value); ?>" <?php if(in_array($value, $idSections)) echo 'selected';?>><?php echo e($key); ?></option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<?php endif; ?>
<?php endif; ?>
</select>
<?php if($errors->has('idSection')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('idSection')); ?></strong>
</label>
<?php endif; ?>
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<label for="classname"><strong>Select Subject</strong></label><br>
<?php if($isSubjectAll == "Y"): ?>
<input type="checkbox" id="idSubjectAll" name="idSubjectAll" value="selectall" checked>
<?php else: ?> <input type="checkbox" id="idSubjectAll" name="idSubjectAll" value="selectall">
<?php endif; ?>
<label for="idSubjectAll" style="color:green"> Select All </label><br>
<select name="subjects[]" multiple="multiple" id="idSubject">
<?php if(isset($subjects)): ?>
<?php if(count($subjects)): ?>
<?php $__currentLoopData = $subjects; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($value); ?>" <?php if(in_array($value, $idSubject)) echo 'selected';?>><?php echo e($key); ?></option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<?php endif; ?>
<?php endif; ?>
</select>
<?php if($errors->has('idSection')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('idSection')); ?></strong>
</label>
<?php endif; ?>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-3">
<div class="form-group">
<label for="classname"><strong>Select Student</strong></label><br>
<?php if($isStudentAll == "Y"): ?>
<input type="checkbox" id="idStudentAll" name="idStudentAll" value="selectall" checked>
<?php else: ?> <?php if(isset($students)): ?> <input type="checkbox" id="idStudentAll" name="idStudentAll" value="selectall">
<?php else: ?> <input type="checkbox" id="idStudentAll" name="idStudentAll" value="selectall" style="opacity:0">
<?php endif; ?>
<?php endif; ?>
<label for="idStudentAll" style="color:green"> Select All </label><br>
<select name="idStudent[]" multiple="multiple" id="idStudent">
<?php if(isset($students)): ?>
<?php if(count($students)): ?>
<?php $__currentLoopData = $students; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($value); ?>" <?php if(in_array($value, $idStudent)) echo 'selected';?>><?php echo e($key); ?></option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<?php endif; ?>
<?php endif; ?>
</select>
<?php if($errors->has('idStudent')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('idStudent')); ?></strong>
</label>
<?php endif; ?>
</div>
</div>
<div class="col-sm-2">
<div class="form-group">
<label for="classname" style="padding-bottom: 26px;"><strong>Entry Type</strong></label>
<?php echo Form::select('type',[''=>'--Select--','grade'=>'Enter Grade','marks'=>'Enter Marks'],['class' => 'form-control show-tick ms select2','required'=>'required']); ?>
<?php if($errors->has('type')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('idClass')); ?></strong>
</label>
<?php endif; ?>
</div>
</div>
</div>
<div class="row clearfix" style="margin-left:10px;">
<?php echo Form::submit('Generate Data',['class' => 'btn btn-raised btn-primary btn-round waves-effect' ,'style'=>'width: 150px; max-width: 254px;']); ?>
</div>
<?php echo Form::close(); ?>
</div>
</div>
<div class="card">
<div class="header">
<h2><strong>Results</strong></h2>
</div>
<?php echo Form::open(['url' => 'school/marks/add-marks','class'=>'form-horizontal','method'=>'post']); ?>
<?php if(isset($type)): ?>
<input type="hidden" value="<?php echo e($type->idType); ?>" name="idType"/>
<input type="hidden" value="<?php echo e($type->idExam); ?>" name="idExam"/>
<?php endif; ?>
<div class="body table-responsive">
<?php $sub = 0;?>
<?php if(isset($totalStudents)): ?>
<table class="table table-bordered" id="manual-marks">
<thead>
<tr>
<th>EC No.</th>
<th>Name</th>
<?php if(isset($subjects)): ?>
<?php $__currentLoopData = $subjects; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<?php if(in_array($value, $idSubject)): ?>
<?php $sub++;?>
<th><?php echo e($key); ?></th>
<th></th>
<th></th>
<th></th>
<th></th>
<?php endif; ?>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<?php endif; ?>
</tr>
</thead>
<tbody>
<?php $__currentLoopData = $totalStudents; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $student): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<?php if(in_array($student->idStudent, $idStudent)): ?>
<tr data-id="<?php echo e($student->ecNo); ?>">
<td><?php echo e($student->ecNo); ?></td>
<td><?php echo e($student->firstName); ?> <?php echo e($student->lastName); ?></td>
<?php if(isset($subjects)): ?>
<?php $__currentLoopData = $subjects; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<?php if(in_array($value, $idSubject)): ?>
<?php $dataEntry = \App\ExamSheet::where('idStudent',$student->idStudent)->where('idSubject',$value)->where('idExam',$type->idType)->first(); ?>
<?php
$totalMarks = null;
if(isset($marks[$value]))
$totalMarks = $marks[$value];
?>
<?php if($idResult == "marks"): ?>
<td style="max-width:100px;">
<input class="form-control" value="<?php echo e($student->idStudent); ?>" data-id ="<?php echo e($student->ecNo); ?>_<?php echo e($value); ?>" id="students_<?php echo e($student->ecNo); ?>_<?php echo e($value); ?>" name="data[<?php echo e($student->ecNo); ?>][<?php echo e($value); ?>][students]" type="hidden"/>
<?php if($totalMarks != null): ?>
<input class="form-control" value="<?php echo e($totalMarks['theory']); ?>" data-id ="<?php echo e($student->ecNo); ?>_<?php echo e($value); ?>" id="marks_theory_<?php echo e($student->ecNo); ?>_<?php echo e($value); ?>" name="data[<?php echo e($student->ecNo); ?>][<?php echo e($value); ?>][marks_theory]" type="hidden"/>
<input class="form-control" value="<?php echo e($totalMarks['pratical']); ?>" data-id ="<?php echo e($student->ecNo); ?>_<?php echo e($value); ?>" id="marks_pratical_<?php echo e($student->ecNo); ?>_<?php echo e($value); ?>" name="data[<?php echo e($student->ecNo); ?>][<?php echo e($value); ?>][marks_pratical]" type="hidden"/>
<?php endif; ?>
<input class="form-control" placeholder="Theory" data-id ="<?php echo e($student->ecNo); ?>_<?php echo e($value); ?>" id="theory_<?php echo e($student->ecNo); ?>_<?php echo e($value); ?>" name="data[<?php echo e($student->ecNo); ?>][<?php echo e($value); ?>][theory]" type="text" style="width:80px;" <?php if(isset($dataEntry->marks)): ?> value="<?php echo e($dataEntry->marks); ?>" <?php endif; ?>></td>
<?php if($totalMarks['pratical'] == "nil"): ?>
<td style="max-width:100px;"><input class="form-control" placeholder="Pratical" data-id ="<?php echo e($student->ecNo); ?>_<?php echo e($value); ?>" id="pratical_<?php echo e($student->ecNo); ?>_<?php echo e($value); ?>" name="data[<?php echo e($student->ecNo); ?>][<?php echo e($value); ?>][pratical]" type="text" style="width:80px;" readonly></td>
<?php else: ?>
<td style="max-width:100px;"><input class="form-control" placeholder="Pratical" data-id ="<?php echo e($student->ecNo); ?>_<?php echo e($value); ?>" id="pratical_<?php echo e($student->ecNo); ?>_<?php echo e($value); ?>" name="data[<?php echo e($student->ecNo); ?>][<?php echo e($value); ?>][pratical]" type="text" style="width:80px;" <?php if(isset($dataEntry->pratical)): ?> value="<?php echo e($dataEntry->pratical); ?>" <?php endif; ?> <?php if($totalMarks != null) { if($totalMarks['pratical'] == null) echo 'readonly';} else echo 'readonly';?> ></td>
<?php endif; ?>
<td style="max-width:100px;"><input class="form-control" placeholder="Total" id="total_<?php echo e($student->ecNo); ?>_<?php echo e($value); ?>" name="data[<?php echo e($student->ecNo); ?>][<?php echo e($value); ?>][total]" type="text" style="width:80px;" <?php if(isset($dataEntry->total)): ?> value="<?php echo e($dataEntry->total); ?>" <?php endif; ?> readonly></td>
<td style="max-width:100px;">
<select class="form-control show-tick ms select2" style="width:80px;" id="grade_<?php echo e($student->ecNo); ?>_<?php echo e($value); ?>" name="data[<?php echo e($student->ecNo); ?>][<?php echo e($value); ?>][grade]">
<?php
echo' <option value=""disabled>-Grade-</option>';
foreach(json_decode($type->grades,true) as $grade){
if(isset($dataEntry->grade)) {
if($dataEntry->grade == $grade['name'])
echo' <option value="'.$grade['name'].'" selected>'.$grade['name'].'</option>';
else
echo' <option value="'.$grade['name'].'">'.$grade['name'].'</option>';
}else
echo' <option value="'.$grade['name'].'">'.$grade['name'].'</option>';
}
?>
</select>
</td>
<td style="max-width:80px;"><select class="form-control show-tick ms select2" name="data[<?php echo e($student->ecNo); ?>][<?php echo e($value); ?>][status]"><option value="P" <?php if(isset($dataEntry->attendance)) { if($dataEntry->attendance == "P") echo 'selected'; }?>>P</option><option value="A" <?php if(isset($dataEntry->attendance)) {if($dataEntry->attendance == "A") echo 'selected'; } ?> >A</option></select></td>
<?php else: ?>
<td style="max-width:100px;">
<input class="form-control" value="<?php echo e($student->idStudent); ?>" data-id ="<?php echo e($student->ecNo); ?>_<?php echo e($value); ?>" id="students_<?php echo e($student->ecNo); ?>_<?php echo e($value); ?>" name="data[<?php echo e($student->ecNo); ?>][<?php echo e($value); ?>][students]" type="hidden"/>
<?php if($totalMarks != null): ?>
<input class="form-control" value="<?php echo e($totalMarks['theory']); ?>" data-id ="<?php echo e($student->ecNo); ?>_<?php echo e($value); ?>" id="marks_theory_<?php echo e($student->ecNo); ?>_<?php echo e($value); ?>" name="data[<?php echo e($student->ecNo); ?>][<?php echo e($value); ?>][marks_theory]" type="hidden"/>
<input class="form-control" value="<?php echo e($totalMarks['pratical']); ?>" data-id ="<?php echo e($student->ecNo); ?>_<?php echo e($value); ?>" id="marks_pratical_<?php echo e($student->ecNo); ?>_<?php echo e($value); ?>" name="data[<?php echo e($student->ecNo); ?>][<?php echo e($value); ?>][marks_pratical]" type="hidden"/>
<?php endif; ?>
<input class="form-control" placeholder="Theory" name="data[<?php echo e($student->ecNo); ?>][<?php echo e($value); ?>][theory]" type="text" style="width:80px;" readonly></td>
<td style="max-width:100px;"><input class="form-control" placeholder="Pratical" name="data[<?php echo e($student->ecNo); ?>][<?php echo e($value); ?>][pratical]" type="text" style="width:80px;" readonly></td>
<td style="max-width:100px;"><input class="form-control" placeholder="Total" name="data[<?php echo e($student->ecNo); ?>][<?php echo e($value); ?>][total]" type="text" style="width:80px;" readonly></td>
<td style="max-width:100px;">
<select class="form-control show-tick ms select2" style="width:80px;" id="grade_<?php echo e($student->ecNo); ?>_<?php echo e($value); ?>" name="data[<?php echo e($student->ecNo); ?>][<?php echo e($value); ?>][grade]">
<?php
echo' <option value=""disabled>-Grade-</option>';
foreach(json_decode($type->grades,true) as $grade){
if(isset($dataEntry->grade)) {
if($dataEntry->grade == $grade['name'])
echo' <option value="'.$grade['name'].'" selected>'.$grade['name'].'</option>';
else
echo' <option value="'.$grade['name'].'">'.$grade['name'].'</option>';
}else
echo' <option value="'.$grade['name'].'">'.$grade['name'].'</option>';
}
?>
</select>
</td>
<td style="max-width:80px;"><select class="form-control show-tick ms select2" name="data[<?php echo e($student->ecNo); ?>][<?php echo e($value); ?>][status]"><option value="present">P</option><option value="absent">A</option></select></td>
<?php endif; ?>
<?php endif; ?>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<?php endif; ?>
</tr>
<?php endif; ?>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</tbody>
</table>
<?php endif; ?>
</div>
<?php if(isset($totalStudents)): ?>
<div class="row clearfix" style="margin-left:10px;">
<?php echo Form::submit('Save Data',['class' => 'btn btn-raised btn-primary btn-round waves-effect' ,'style'=>'width: 150px; max-width: 254px;']); ?>
</div>
<?php endif; ?>
<?php echo Form::close(); ?>
</div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
<script>
$(document).ready(function() {
console.log($.fn.dataTable.isDataTable( '#manual-marks' ));
if ( $.fn.dataTable.isDataTable( '#manual-marks' ) ) {
table = $('#manual-marks').DataTable();
table.destroy();
table = $('#manual-marks').DataTable({
scrollX: true,
paging:false,
fixedColumns: {
left: 2,
}
});
}else{
<?php if($sub > 2): ?>
table = $('#manual-marks').DataTable({
scrollX: true,
paging:false,
fixedColumns: {
left: 2,
}
});
<?php else: ?>
$('#manual-marks').DataTable();
<?php endif; ?>
}
$('#idSection').multiselect({
listWidth: 200,
cssEven: false,
cssOdd: false,
});
$('#idSubject').multiselect({
listWidth: 200,
cssEven: false,
cssOdd: false,
});
$('#idStudent').multiselect({
listWidth: 200,
cssEven: false,
cssOdd: false,
});
$('select[name="idClass"]').on('change', function() {
var classID = $(this).val();
$.ajax({
url: "<?php echo e(url('/school/class')); ?>"+'/' +classID + "/sections",
type: "GET",
dataType: "json",
success:function(data) {
$('#idSectionAll').prop('checked', false);
$('#idSection_checklist ul').empty();
$.each(data, function(key, value) {
$('#idSection_checklist ul').append('<li tabindex="0" class=""><input type="checkbox" value="'+key+'" name="idSection[]" id="idSection_'+key+'"><label for="idSection_'+key+'" class="leaveRoomForCheckbox">'+value+'</label></li>');
});
}
});
$.ajax({
url: "<?php echo e(url('/school/class')); ?>"+'/' +classID + "/subjects",
type: "GET",
dataType: "json",
success:function(data) {
$('#idSubjectAll').prop('checked', false);
$('#idSubject_checklist ul').empty();
$.each(data, function(key, value) {
$('#idSubject_checklist ul').append('<li tabindex="0" class=""><input type="checkbox" value="'+key+'" name="idSubject[]" id="idSubject_'+key+'"><label for="idSubject_'+key+'" class="leaveRoomForCheckbox">'+value+'</label></li>');
});
}
});
});
$(document).on('click', '#idSection_checklist', function(){
var sectionIds = [];
$("input:checkbox[name='idSection[]']:checked").each(function () {
sectionIds.push($(this).val());
});
if (sectionIds.length > 0) {
$.ajax({
url: "<?php echo e(url('/school/sec')); ?>"+'/' +sectionIds + "/students",
type: "GET",
dataType: "json",
success:function(data) {
$('#idStudentAll').prop('checked', false);
$('#idStudent_checklist ul').empty();
$('#idStudentAll').css('opacity', 0);
$.each(data, function(key, value) {
$('#idStudentAll').css('opacity', 1);
$('#idStudent_checklist ul').append('<li tabindex="0" class=""><input type="checkbox" value="'+key+'" name="idStudent[]" id="idSubject_'+key+'"><label for="idStudent_'+key+'" class="leaveRoomForCheckbox">'+value+'</label></li>');
});
}
});
}else{
$('#idStudentAll').prop('checked', false);
$('#idStudentAll').css('opacity', 0);
$('#idStudent_checklist ul').empty();
}
});
$('#idSectionAll').change(function() {
if(this.checked) {
$("#idSection_checklist").addClass('checklistHighlighted');
$("#idSection_checklist ul").children().addClass('checked');
$("#idSection_checklist ul li input[type=checkbox]").each(function(e) {
$(this).prop('checked', true);
});
var sectionIds = [];
$("#idSection_checklist ul li input[type=checkbox]").each(function(e) {
sectionIds.push($(this).val());
});
$.ajax({
url: "<?php echo e(url('/school/sec')); ?>"+'/' +sectionIds + "/students",
type: "GET",
dataType: "json",
success:function(data) {
$('#idStudentAll').css('opacity', 0);
$('#idStudentAll').prop('checked', false);
$('#idStudent_checklist ul').empty();
$.each(data, function(key, value) {
$('#idStudentAll').css('opacity', 1);
$('#idStudent_checklist ul').append('<li tabindex="0" class=""><input type="checkbox" value="'+key+'" name="idStudent[]" id="idSubject_'+key+'"><label for="idStudent_'+key+'" class="leaveRoomForCheckbox">'+value+'</label></li>');
});
}
});
}else{
$('#idStudent_checklist ul').empty();
$('#idStudentAll').prop('checked', false);
$("#idSection_checklist").removeClass('checklistHighlighted');
$("#idSection_checklist ul").children().removeClass('checked');
$("#idSection_checklist ul li input[type=checkbox]").each(function(e) {
$(this).prop('checked', false);
});
$('#idStudentAll').css('opacity', 0);
}
});
$('#idSubjectAll').change(function() {
if(this.checked) {
$("#idSubject_checklist").addClass('checklistHighlighted');
$("#idSubject_checklist ul").children().addClass('checked');
$("#idSubject_checklist ul li input[type=checkbox]").each(function(e) {
$(this).prop('checked', true);
});
}else{
$("#idSubject_checklist").removeClass('checklistHighlighted');
$("#idSubject_checklist ul").children().removeClass('checked');
$("#idSubject_checklist ul li input[type=checkbox]").each(function(e) {
$(this).prop('checked', false);
});
}
});
$('#idStudentAll').change(function() {
if(this.checked) {
$("#idStudent_checklist").addClass('checklistHighlighted');
$("#idStudent_checklist ul").children().addClass('checked');
$("#idStudent_checklist ul li input[type=checkbox]").each(function(e) {
$(this).prop('checked', true);
});
}else{
$("#idStudent_checklist").removeClass('checklistHighlighted');
$("#idStudent_checklist ul").children().removeClass('checked');
$("#idStudent_checklist ul li input[type=checkbox]").each(function(e) {
$(this).prop('checked', false);
});
}
});
$("button[data-id=idSection]").hide();
$("button[data-id=idSubject]").hide();
$("button[data-id=idStudent]").hide();
$("#idSection_actionButtons").hide();
$("#idSubject_actionButtons").hide();
$("#idStudent_actionButtons").hide();
});
</script>
<?php if(isset($type)): ?>
<script>
(function() {
"use strict";
$("#manual-marks").on("change", "input", function() {
var row = $(this).closest("tr");
var id = $(this).data('id');
var theory = 0;
if(row.find("#marks_theory_"+id).val() != null)
theory = parseFloat(row.find("#marks_theory_"+id).val());
var extra =0;
if(row.find("#marks_pratical_"+id).val() != null)
extra = parseFloat(row.find("#marks_pratical_"+id).val());
console.log(id);
var marks = parseFloat(row.find("#theory_"+id).val());
if(theory < marks){
alert("Marks are greater than allocated marks.");
row.find("#theory_"+id).val("");
row.find("#total_"+id).val("");
}else{
var pratical = parseFloat(row.find("#pratical_"+id).val());
if(isNaN(pratical))
{
pratical = 0;
var total = marks + pratical;
row.find("#total_"+id).val(isNaN(total) ? "" : total);
}
else{
if(extra < pratical){
alert("Marks are greater than allocated marks.");
row.find("#pratical_"+id).val("");
ow.find("#total_"+id).val(marks);
}else{
var total = marks + pratical;
row.find("#total_"+id).val(isNaN(total) ? "" : total);
}
}
}
});
})();
</script>
<?php endif; ?>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('schools.school_layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
Copyright © 2021 -