BBnepal-Accounts/application/views/admin/manage-course-grades.php

393 lines
13 KiB
PHP
Raw Normal View History

2024-07-10 12:43:19 +00:00
<style>
table.dataTable tfoot th {
font-weight: 600 !important;
}
.form-group .bootstrap-select>.dropdown-toggle {
padding: 9px 9px !important;
font-size: 12px !important;
border: 1px solid #c8c8c8 !important;
background: #fff !important;
}
.course_grade_details_table input[type="text"] {
font-size: 14px;
border: 1px solid #858585;
border-radius: 4px;
color: #6b6b6b;
padding: 5px;
}
.course_grade_details_table input[type="number"] {
font-size: 14px;
border: 1px solid #858585;
border-radius: 4px;
color: #6b6b6b;
padding: 5px;
width: 83px;
}
.course_grade_details_table td,
.course_grade_details_table th {
border: 0;
padding: 15px 10px;
}
.course_grade_details_table {
border: 0;
}
.course_grade_details_table td {
text-align: left;
padding: 8px 10px;
}
.course_grade_details_table th {
font-weight: 600;
font-size: 15px;
color: #888787;
border-bottom: 1px solid #ddd;
}
</style>
<div class="wraper responsive-width">
<main class="long-tbl-main" id="main">
<!-- admin template section -->
<div class="admin_tempblock">
<div class="admin_tempsec">
<div class="admin_sec">
<div class="subsec_sec" style="display:block">
<div class="subject_lsec dashboard_graph report_sec_graph">
<div class="report_sec_cover">
<div class="report_sec_left">
<?php
$currency_symbol = $school_info['currency_symbol'];
$theExportHeader = 'The Fee Revert Reports';
if (isset($school_info) && !empty($school_info)) {
$theExportHeader = $school_info['school_name'] . '\n' . $school_info['address'] . '\n Invoice Reports';
}
?>
</div>
<div class="subject_lhead">Manage Course Grades</div>
<?php
$course_id = '';
$grade_type = '';
if (count($_POST) > 0) {
$course_id = $_POST['course_id'];
$grade_type = $_POST['grade_type'];
}
//echo '<pre>'; print_r($theResult);
?>
<form action="<?= base_url(); ?>admin/manage-course-grades" method="POST" id='searchManageCourseGradesForm'>
<input type="hidden" name="clicked_id" id="clicked_id" value=''>
<input type="hidden" name="clicked_button" id="clicked_button" value='View'>
<div class="row">
<div class="col-md-3">
<div class="form-group assign_fee_toall">
<!--<label>Select Course</label>-->
<select name="course_id" id="course_id" onchange='show_hide_table("onchange")' class="form-control custom-select">
<option value="">Select Course</option>
<?php
if (isset($course) && !empty($course)) {
foreach ($course as $key => $cr) {
?>
<option value="<?php echo $cr['id']; ?>" <?php if ($cr['id'] == $course_id) { ?> selected <?php } ?>>
<?php echo $cr['course_name']; ?>
</option>
<?php
}
}
?>
</select>
<div id='err_course_id' class="text-danger cierr"></div>
</div>
</div>
<div class="col-md-3">
<div class="form-group assign_fee_toall">
<!--<label>Select Course</label>-->
<select name="grade_type" id="grade_type" onchange='show_hide_table("onchange")' class="form-control custom-select">
<option value="">Select Grade Type</option>
<option value="Grade" <?php if ($grade_type == 'Grade') { ?> selected <?php } ?>>Grade</option>
<option value="Percentage" <?php if ($grade_type == 'Percentage') { ?> selected <?php } ?>>Percentage</option>
</select>
<div id='err_grade_type' class="text-danger cierr"></div>
</div>
</div>
<div class="col-md-3">
<input type="button" name="filtersubmit" id="filter_reset1" class="btn btn-success" value="View" onclick="validate_view_here()">
<a href="<?php echo base_url() ?>admin/manage-course-grades">
<button type="button" class="subject_addbtn subject_addbtn_nobg">
<i class="fas fa-redo"></i>Reset
</button>
</a>
</div>
<div class="col-md-3">
<div class="filter-reset"></div>
</div>
</div>
<?php if (!empty($this->session->flashdata('success'))) { ?>
<div class="alert alert-success">
<a href="#" class="close" data-dismiss="alert">&times;</a>
<strong>Success!</strong> <?php echo $this->session->flashdata('success'); ?>
</div>
<?php }
unset($_SESSION['success']); ?>
<div id='theCourseGradeDetailsTable' class="row" style='display: none;'>
<div class="col-md-12">
<div id='the_error' class="text-danger cierr" style='font-size: 15px; padding-bottom: 5px;'></div>
<table style='width:100%' border='1' class="course_grade_details_table">
<tr>
<th width='10%'>Start % <span style="color:red;"> * </span></th>
<th width='10%'>Upto % <span style="color:red;"> * </span></th>
<?php if ($grade_type == 'Grade') { ?>
<th width='6%'>Grade <span style="color:red;"> * </span></th>
<th width='6%'>GP From <span style="color:red;"> * </span></th>
<th width='6%'>GP To <span style="color:red;"> * </span></th>
<th width='6%'>GPA <span style="color:red;"> * </span></th>
<?php } else if ($grade_type == 'Percentage') { ?>
<th width='20%'>Division <span style="color:red;"> * </span></th>
<?php } ?>
<th width='15%'>Remarks <span style="color:red;"> * </span></th>
<th width='20%'>School Remarks <span style="color:red;"> * </span></th>
<th width='8%'>Is Fail</th>
<th></th>
</tr>
<tr>
<td>
<input type="number" min='0' max='100' size='5px' name="sp_0" id='sp_0'>
</td>
<td>
<input type="number" min='0' max='100' size='5px' name="up_0" id='up_0'>
</td>
<?php if ($grade_type == 'Grade') { ?>
<td>
<input type="text" size='5px' name="grade_0" id='grade_0'>
</td>
<td>
<input type="text" size='5px' name="gpfrom_0" id='gpfrom_0'>
</td>
<td>
<input type="text" size='5px' name="gpto_0" id='gpto_0'>
</td>
<td>
<input type="text" size='5px' name="gpa_0" id='gpa_0'>
</td>
<?php } else if ($grade_type == 'Percentage') { ?>
<td>
<input type="text" size='15px' name="div_0" id='div_0'>
</td>
<?php } ?>
<td>
<input type="text" size='15px' name="rem_0" id='rem_0'>
</td>
<td>
<input type="text" size='15px' name="srem_0" id='srem_0'>
</td>
<td>
<input type="checkbox" size='15px' name="fail_0" id='fail_0'>
</td>
<td>
<input type="button" class="btn btn-success" style="font-size: 14px;padding: 6px 17px;" value="Save" onclick="validate_the_form_here('Save',0)">
</td>
</tr>
<?php
if (isset($theResult) && !empty($theResult)) {
foreach ($theResult as $k => $res) {
$id = $res['id'];
$isFailCkd = '';
if ($res['is_fail'] == 'Yes')
$isFailCkd = 'checked';
?>
<tr>
<td>
<input type="text" size='5px' name="sp_<?php echo $id; ?>" id='sp_<?php echo $id; ?>' value="<?php echo $res['start_perc']; ?>">
</td>
<td>
<input type="text" size='5px' name="up_<?php echo $id; ?>" id='up_<?php echo $id; ?>' value="<?php echo $res['upto_perc']; ?>">
</td>
<?php if ($grade_type == 'Grade') { ?>
<td>
<input type="text" size='5px' name="grade_<?php echo $id; ?>" id='grade_<?php echo $id; ?>' value="<?php echo $res['grade']; ?>">
</td>
<td>
<input type="text" size='5px' name="gpfrom_<?php echo $id; ?>" id='gpfrom_<?php echo $id; ?>' value="<?php echo $res['gp_from']; ?>">
</td>
<td>
<input type="text" size='5px' name="gpto_<?php echo $id; ?>" id='gpto_<?php echo $id; ?>' value="<?php echo $res['gp_to']; ?>">
</td>
<td>
<input type="text" size='5px' name="gpa_<?php echo $id; ?>" id='gpa_<?php echo $id; ?>' value="<?php echo $res['gpa']; ?>">
</td>
<?php } else if ($grade_type == 'Percentage') { ?>
<td>
<input type="text" size='15px' name="div_<?php echo $id; ?>" id='div_<?php echo $id; ?>' value="<?php echo $res['division']; ?>">
</td>
<?php } ?>
<td>
<input type="text" size='15px' name="rem_<?php echo $id; ?>" id='rem_<?php echo $id; ?>' value="<?php echo $res['remarks']; ?>">
</td>
<td>
<input type="text" size='15px' name="srem_<?php echo $id; ?>" id='srem_<?php echo $id; ?>' value="<?php echo $res['school_remarks']; ?>">
</td>
<td>
<input type="checkbox" size='15px' name="fail_<?php echo $id; ?>" id='fail_<?php echo $id; ?>' <?php echo $isFailCkd; ?>>
</td>
<td>
<button type='button' style="font-size: 14px;padding: 6px 8px; " class="subject_addbtn download_idcards" onclick="validate_the_form_here('Update',<?php echo $id; ?>)">
Update
</button>
&nbsp; &nbsp;
<button type='button' style="font-size: 14px;padding: 6px 10px; background:#ff3636; " class="subject_addbtn download_idcards" onclick="validate_the_form_here('Delete',<?php echo $id; ?>)">
Delete
</button>
</td>
</tr>
<?php
}
}
?>
</table>
</div>
</div>
</form>
<!-- tab added -->
<!-- new divs added -->
<!--<div class="tab-content">
<div class="applicnts-list-wrap ">
<div class=" ">
</div>
</div>
</div>-->
</div>
</div>
</div>
</div>
</div>
<!-- admin template section end -->
</main>
<!--End right-top side-->
</div>
<script type="text/javascript">
$(document).ready(function() {
show_hide_table('onload');
});
function show_hide_table(flagVal) {
$('#theCourseGradeDetailsTable').hide();
if (flagVal == 'onload' && $('#course_id').val() != '' && $('#grade_type').val() != '')
$('#theCourseGradeDetailsTable').show();
}
function validate_view_here() {
$errCnt = 0;
$("#err_course_id").hide();
$("#err_grade_type").hide();
if ($('#course_id').val() == '') {
$('#err_course_id').html('Please select the course.');
$('#err_course_id').show();
$errCnt++;
}
if ($('#grade_type').val() == '') {
$('#err_grade_type').html('Please select the grade type.');
$('#err_grade_type').show();
$errCnt++;
}
$('#clicked_button').val('View');
if ($errCnt == 0)
$('#searchManageCourseGradesForm').submit();
return false;
}
function validate_the_form_here(theStr, theId) {
$('#clicked_id').val(theId);
$('#clicked_button').val(theStr);
$("#the_error").hide();
var start = $('#sp_' + theId).val();
start = parseFloat(start).toFixed(2);
$('#sp_' + theId).val(start);
var upto = $('#up_' + theId).val();
upto = parseFloat(upto).toFixed(2);
$('#up_' + theId).val(upto);
var remarks = $('#rem_' + theId).val();
var sremarks = $('#srem_' + theId).val();
var grade = $('#grade_' + theId).val();
var gpa = $('#gpa_' + theId).val();
var division = $('#div_' + theId).val();
var errorArr = [];
if ($('#grade_type').val() == 'Grade') {
if (start == '' || upto == '' || remarks == '' || grade == '' || gpa == '')
errorArr.push("Required fields cannot be left blank. Please provide valid data for all the required fields.");
} else {
if (start == '' || upto == '' || remarks == '' || division == '')
errorArr.push("Required fields cannot be left blank. Please provide valid data for all the required fields.");
}
/*if(start!='')
{
var intRegEx = /^[0-9]+$/;
if(!intRegEx.test(start))
errorArr.push('Only numbers are allowed for Start %.');
}
if(upto!='')
{
var intRegEx = /^[0-9]+$/;
if(!intRegEx.test(upto))
errorArr.push('Only numbers are allowed for Upto %.');
}*/
if (errorArr.length > 0) {
var errStr = '';
$.each(errorArr, function(n, currentElem) {
errStr += '<br/>' + (n + 1) + '. ' + currentElem;
});
$('#the_error').html(errStr);
$("#the_error").show();
} else
$('#searchManageCourseGradesForm').submit();
}
</script>
</body>
</html>