BBnepal-Accounts/application/views/admin/multiple-student-edit.php
Sampanna Rimal 9cd05ef3cb commitall
2024-07-10 18:28:19 +05:45

698 lines
37 KiB
PHP

<style>
.upload-doc-btn-wrap {
position: relative;
}
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: 13px;
border: 1px solid #858585;
border-radius: 4px;
color: #6b6b6b;
padding: 5px;
}
.course_grade_details_table input[type="number"] {
font-size: 13px;
border: 1px solid #858585;
border-radius: 4px;
color: #6b6b6b;
padding: 5px;
width: 90px;
}
.course_grade_details_table td,
.course_grade_details_table th {
border: 0;
padding: 15px 10px;
font-size: 12px !important;
}
.course_grade_details_table {
border: 1px solid #eee;
}
.course_grade_details_table td {
text-align: left;
padding: 8px 10px;
}
.course_grade_details_table th {
font-weight: 300;
font-size: 12px;
color: black;
border-bottom: 2px solid #032da1;
}
.scrollable_table thead {
display: table;
width: 100%;
}
.scrollable_table tbody {
display: block;
overflow-y: scroll;
max-height: 400px;
}
.scrollable_table th,
.scrollable_table td {
width: 130px;
font-size: 12px;
}
.scrollable_table tr {
display: table;
width: 100%;
box-sizing: border-box;
}
.scrollable_table th:nth-child(1),
.scrollable_table td:nth-child(1) {
width: 42px;
}
span.margin-t {
margin-top: 5px;
display: block;
}
</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"></div>
<div class="subject_lhead">Multiple Record Update</div>
<?php
$showTable = 'No';
// $totalSubjects
if (isset($theStudents) && !empty($theStudents))
$showTable = 'Yes';
$batch_id = $selected_batch;
$course_id = '';
$sectionIds = '';
if (count($_POST) > 0) {
$batch_id = $_POST['batch_id'];
$course_id = $_POST['course_id'];
// $sectionIds = $_POST['section_id'];
}
$search_section = (isset($_POST['section_id']) && !empty($_POST['section_id'])) ? $_POST['section_id'] : '';
//echo '<pre>'; print_r($theResult);
?>
<form action="<?= base_url(); ?>admin/multiple-edit" method="POST" id='recordsUpdateForm' enctype="multipart/form-data">
<input type="hidden" name="the_student_id" id="the_student_id" value=''>
<input type="hidden" name="clicked_button" id="clicked_button" value='View'>
<input type="hidden" name="the_delete_subject_id" id="the_delete_subject_id" value=''>
<div class="row">
<div class="col-md-3 pr-0">
<div class="subject-filter">
<div class="form-group assign_fee_toall">
<label>Batch <span style="color:red;"> * </span></label>
<select name="batch_id" id="batch_id" onchange='show_hide_table("onchange")' class="form-control">
<option value="">Select Batch</option>
<?php
if (isset($batch) && !empty($batch)) {
foreach ($batch as $key => $b) {
?>
<option value="<?php echo $b['id']; ?>" <?php if ($b['id'] == $batch_id) { ?> selected <?php } ?>>
<?php echo $b['b_name']; ?>
</option>
<?php
}
}
?>
</select>
<div id='err_batch_id' class="text-danger cierr"></div>
</div>
</div>
</div>
<div class="col-md-3 pr-0">
<div class="subject-filter">
<div class="form-group assign_fee_toall">
<label>Course <span style="color:red;"> * </span></label>
<select name="course_id" id="course_id" class="form-control">
<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>
<div class="col-md-3 pr-0">
<div class="subject-filter">
<div class="form-group assign_fee_toall">
<label>Section <span style="color:red;"> * </span></label>
<!-- <select name="section_id[]" id="section_id" onchange='show_hide_table("onchange")' class="form-control selectpicker" multiple>
<option value="">Select Section</option>
</select>
<div id='err_section_id' class="text-danger cierr"></div> -->
<?php if ($course_id != '' && $course_id > 0) {
$sql = "SELECT s.id as section_id,s.section_name FROM course_sections cs JOIN section s ON s.id=cs.section_id WHERE cs.course_id='$course_id' ORDER BY s.id DESC";
$section_list = $this->Admin_model->get_query_result($sql);
?>
<select id="section_id" name="section_id[]" class=" form-control selectpicker" multiple>
<option value="" disabled>Select Section</option>
<?php
if (isset($section_list) && !empty($section_list)) {
foreach ($section_list as $se_val) { ?>
<option value="<?php echo $se_val['section_id'] ?>" <?php if (isset($search_section) && !empty($search_section)) {
echo (in_array($se_val['section_id'], $search_section)) ? 'selected' : '';
} ?>><?php echo $se_val['section_name'] ?></option>
<?php }
} ?>
</select>
<?php } else { ?>
<select id="section_id" id="section_id" name="section_id[]" class=" form-control selectpicker" multiple>
<option value="" disabled>Select Section</option>
</select>
<?php } ?>
</div>
</div>
</div>
<div class="col-md-3">
<div class="subject-filter">
<div class="form-group assign_fee_toall">
<label></label>
<div>
<input type="button" class="btn btn-success" value="View" onclick="validate_view_here()">
<a href="<?php echo base_url() ?>admin/multiple-edit">
<button type="button" class="subject_addbtn subject_addbtn_nobg">
<i class="fas fa-redo"></i>Reset
</button>
</a>
</div>
</div>
</div>
</div>
</div>
<?php if (!empty($this->session->flashdata('success_msg'))) { ?>
<div class="alert alert-success">
<a href="#" class="close" data-dismiss="alert">&times;</a>
<strong>Success!</strong> <?php echo $this->session->flashdata('success_msg'); ?>
</div>
<?php }
unset($_SESSION['success']); ?>
<?php if (!empty($this->session->flashdata('error_msg'))) { ?>
<div class="alert alert-danger">
<a href="#" class="close" data-dismiss="alert">&times;</a>
<strong>Error!</strong> <?php echo $this->session->flashdata('error_msg'); ?>
</div>
<?php }
unset($_SESSION['danger']); ?>
<?php
if (isset($theStudents) && !empty($theStudents)) {
?>
<div class="col-md-12">
<div id='the_error' class="text-danger cierr" style='font-size: 15px; padding-bottom: 5px;'></div>
<table id="tbl1" class=" table-bordered course_grade_details_table text-center">
<thead>
<tr>
<th class="text-center sort border-left border-right"> S.No. </th>
<th width="100px" class="text-center border-right"> Student Details </th>
<th valign="center" style="background-image: none;" class="border-right p-0 m-0 text-small">
Section
</th>
<th valign="center" width="150px" style="background-image: none;" class="border-right p-0 m-0 text-small">
Name
</th>
<th valign="center" width="150px" style="background-image: none;" class="border-right p-0 m-0">
Email
</th>
<th valign="center" width="120px" style="background-image: none;" class="border-right p-0 m-0">
DOB
</th>
<th valign="center" width="100px" style="background-image: none;" class="border-right p-0 m-0">
Contact No.
</th>
<th valign="center" width="150px" style="background-image: none;" class="border-right p-0 m-0">
Father's Name
</th>
<th valign="center" width="150px" style="background-image: none;" class="border-right p-0 m-0">
Mother's Name
</th>
<th valign="center" width="150px" style="background-image: none;" class="border-right p-0 m-0">
Emergency Contact No.
</th>
<th valign="center" width="150px" style="background-image: none;" class="border-right p-0 m-0">
Address
</th>
<th valign="center" width="150px" style="background-image: none;" class="border-right p-0 m-0">
State
</th>
<th valign="center" width="150px" style="background-image: none;" class="border-right p-0 m-0">
Country
</th>
<th valign="center" width="70px" style="background-image: none;" class="border-right p-0 m-0">
Student Photo
</th>
<th valign="center" width="70px" style="background-image: none;" class="border-right p-0 m-0">
IEMIS
</th>
<!-- <th style="background-image: none;" width="70px" class="border-right border-left">
</th> -->
</tr>
</thead>
<tbody>
<?php
$a = 0;
if (isset($theStudents) && !empty($theStudents)) {
// echo '<pre>';
// var_dump($theStudents);
$slNo = 1;
foreach ($theStudents as $sk => $std) {
// echo '<pre>';
// print_r($ta_value);
?>
<tr>
<td valign="center" class="border-right border-bottom text-center"><?php echo $slNo; ?></td>
<td valign="center" class="text-left border-right border-bottom">
<input type="hidden" name="studentId[<?php echo $std["id"]; ?>]" id="studentId[<?php echo $std["id"]; ?>]" value="<?php echo $std['studentId']; ?>" />
<?php
echo ucwords($std['name']) . '<br>';
echo '<small class="font-weight-bold">' . $std['studentId'] . '</small><br>';
echo '<small>Roll No : ' . $std['roll_no'] . '</small><br>';
?>
<!-- <input type="number" min="0" placeholder="Pr Days" name='present_days[<?php echo $std["student_id"]; ?>]' value="<?php echo $thePrDays != null ? (int) $thePrDays : ''; ?>"> -->
</td>
<td valign="center" class="border-right border-bottom text-center">
<?php echo $std['section_name']; ?>
</td>
<td valign="center" class="border-right border-bottom">
<input type="text" placeholder="Name" name='name[<?php echo $std["id"]; ?>]' value="<?php echo $std['name']; ?>">
</td>
<td valign="center" class="border-right border-bottom">
<input type="text" placeholder="Email Address" name='email[<?php echo $std["id"]; ?>]' value="<?php echo $std['email']; ?>">
</td>
<td valign="center" class="border-right border-bottom">
<input type="text" name="sdob[<?php echo $std["id"]; ?>]" id='dob[<?php echo $std["id"]; ?>]' class="nepal-date sdob form-control" placeholder="Date Of Birth" value="<?php echo $std['dob']; ?>">
</td>
<td valign="center" class="border-right border-bottom">
<input type="text" placeholder="Contact No." name='mobile[<?php echo $std["id"]; ?>]' value="<?php echo $std['mobile']; ?>">
</td>
<td valign="center" class="border-right border-bottom">
<input type="text" placeholder="Father Name" name='fathername[<?php echo $std["id"]; ?>]' value="<?php echo $std['father_name']; ?>">
</td>
<td valign="center" class="border-right border-bottom">
<input type="text" placeholder="Mother Name" name='mother_name[<?php echo $std["id"]; ?>]' value="<?php echo $std['mother_name']; ?>">
</td>
<td valign="center" class="border-right border-bottom">
<input type="text" placeholder="Emergency Contact No." name='emergency_contact_number[<?php echo $std["id"]; ?>]' value="<?php echo $std['emergency_contact_number']; ?>">
</td>
<td valign="center" class="border-right border-bottom">
<input type="text" placeholder="Address" name='address[<?php echo $std["id"]; ?>]' value="<?php echo $std['address1']; ?>">
</td>
<td valign="center" class="border-right border-bottom">
<input type="text" placeholder="State" name='state[<?php echo $std["id"]; ?>]' value="<?php echo $std['state']; ?>">
</td>
<td valign="center" class="border-right border-bottom">
<input type="text" placeholder="Country" name='country[<?php echo $std["id"]; ?>]' value="<?php echo $std['country']; ?>">
</td>
<td valign="center" class="border-right border-bottom">
<div class="upload-doc mb-0">
<input type="hidden" name="user_photo[<?php echo $std["id"]; ?>]" id="user_photo[<?php echo $std["id"]; ?>]" value="<?php echo $std['photo']; ?>" />
<div class="">
<input type="file" name="photo[<?php echo $std["id"]; ?>]" id="photo[<?php echo $std["id"]; ?>]" multiple />
<!-- <label for="photo" class="upload-btn" id="uploadBtn1">Upload</label> -->
<!-- <label for="photo" class="upload-btn re-upload-btn" id="uploadBtn2">Upload</label> -->
</div>
</div>
</td>
<td valign="center" class="border-right border-bottom">
<input style="width:90px !important" type="text" placeholder="IEMIS No." name='iemis[<?php echo $std["id"]; ?>]' value="<?php echo $std['iemis']; ?>">
</td>
<!-- <td class="border-right border-bottom">
<input type="button" id="row-save-<?php echo $std['id']; ?>" class="btn btn-success" style="font-size: 14px;padding: 6px 17px; margin-left:8px" value="Save" onclick="validate_the_form_here('Save', <?php echo $std['id']; ?>)">
<div id="row-save-loading-<?php echo $std['id']; ?>" class="form-group" style="font-size:13px; display:none;">
<i class="fa-solid fa-loader"></i>Loading....
</div>
</td> -->
</tr>
<?php $slNo++;
}
}
?>
</tbody>
</table>
<div class="col-md-12" style="align-content: right;">
<div id='tbl-save-all-btn' class="form-group">
<input type="button" name="assignSubmit" onclick="validate_the_form_here('Save All',0)" class="btn btn-success" value="Save All">
</div>
<div id='tbl-loading-btn' class="form-group" style='display:none;'>
<i class="fa-solid fa-loader"></i>Loading.... Please wait
</div>
</div>
</div>
<?php } ?>
</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>
<div class="modal fade" id="confirmDeleteSubjectColumnModal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<div class="delete-modal">
<i class="far fa-times-circle"></i>
<!--<input type="text" id="del_batch_id" id="del_batch_id" />-->
<h4>Are you sure?</h4>
<p>you want to delete the records for this subject?</p>
<div class="delete-modal-btn">
<button type="button" class="subject_addbtn subject_addbtn_red" onclick="delete_subject_column_records();">Delete</button>
<button type="button" class="subject_addbtn subject_addbtn_cancel" onclick="cancel_delete_subject_column_records()">Cancel</button>
</div>
</div>
</div>
</div>
</div>
<script defer src="<?php echo base_url(); ?>assets_admin/js/bootstrap-select.min.js"></script>
<script type="text/javascript">
var jsShowTable = '<?php echo $showTable; ?>';
var jsSeldSections = "<?php echo $sectionIds; ?>";
function confirm_delete_subject_column_records(subjectId) {
$('#clicked_button').val('Delete Subject Records');
$('#the_delete_subject_id').val(subjectId);
$('#confirmDeleteSubjectColumnModal').modal('show');
}
function cancel_delete_subject_column_records() {
$('#clicked_button').val('');
$('#the_delete_subject_id').val('');
$('#confirmDeleteSubjectColumnModal').modal('hide');
}
function delete_subject_column_records() {
$('#recordsUpdateForm').submit();
}
$('input').on("keydown", function(e) {
/* ENTER PRESSED*/
console.log(e.keyCode);
if (e.keyCode == 13) {
/* FOCUS ELEMENT */
var inputs = $(this).parents("form").eq(0).find(":input[type='text']:not([readonly])");
var idx = inputs.index(this);
console.log('====================>' + inputs.prop);
if (idx == inputs.length - 1) {
inputs[0].select()
} else {
inputs[idx + 11].focus(); // handles submit buttons
inputs[idx + 11].select();
}
e.preventDefault();
return false;
} else {
return true;
// e.preventDefault();
}
});
$(document).ready(function() {
$('#tbl1').DataTable({
scrollY: "500px",
scrollX: true,
scrollCollapse: true,
paging: false,
fixedColumns: {
left: 3,
right: 1
},
"lengthMenu": [
[100, -1],
[100, "All"]
],
"dom": 'lBfrtip',
"buttons": []
});
sessionStorage.clear();
// fetch_sections_of_course('onload');
show_hide_table('onload');
});
function absent_clicked(stdId, subId) {
sessionStorage.setItem('#row_th_obt_pORa_' + stdId + '_' + subId, $('#row_th_obt_' + stdId + '_' + subId).val());
sessionStorage.setItem('#row_pr_obt_pORa_' + stdId + '_' + subId, $('#row_pr_obt_' + stdId + '_' + subId).val());
$('#row_th_obt_' + stdId + '_' + subId).val(0);
$('#row_pr_obt_' + stdId + '_' + subId).val(0);
}
function present_clicked(stdId, subId) {
let storedPresentThObtMarks = sessionStorage.getItem('#row_th_obt_pORa_' + stdId + '_' + subId);
if (storedPresentThObtMarks) {
$('#row_th_obt_' + stdId + '_' + subId).val(storedPresentThObtMarks);
} else {
$('#row_th_obt_' + stdId + '_' + subId).val(0);
}
let storedPresentPrObtMarks = sessionStorage.getItem('#row_pr_obt_pORa_' + stdId + '_' + subId);
if (storedPresentPrObtMarks) {
$('#row_pr_obt_' + stdId + '_' + subId).val(storedPresentPrObtMarks);
} else {
$('#row_pr_obt_' + stdId + '_' + subId).val(0);
}
}
// function fetch_sections_of_course(calledOn) {
// if (calledOn == 'onchange')
// $('#theOfflineExamMarksEntryTable').hide();
// //$('#section_id').empty().selectpicker("refresh");
// $('#section_id').empty();
// var divData = "<option value=''> Select Section </option>";
// if ($('#course_id').val() != '') {
// // alert('A');
// $.ajax({
// url: "<?php echo base_url(); ?>Admin/get_section_by_course",
// method: "POST",
// data: {
// course_id: $('#course_id').val()
// },
// dataType: "json",
// success: function(response) {
// //divData += "<option value='' disabled> Select Section </option>";
// if (response.sections != '') {
// var ssArr = [];
// if (jsSeldSections != '')
// ssArr = jsSeldSections.split(",");
// $.each(response.sections, function(i, sectiondata) {
// console.log(sectiondata);
// if (ssArr.includes(sectiondata.section_id))
// divData += "<option value='" + sectiondata.section_id + "' selected >" + sectiondata.section_name + "</option>";
// else
// divData += "<option value='" + sectiondata.section_id + "'>" + sectiondata.section_name + "</option>";
// });
// } else
// divData += "<option value=''> -- No Section's Found --</option>";
// //$('#section_id').append(divData).selectpicker("refresh");
// $('#section_id').append(divData);
// }
// });
// } else
// $('#section_id').append(divData);
// }
$('#course_id').change(function() {
var course = $('#course_id option:selected').val();
// alert(course);
var divData = '';
if (course != '' && course != 0) {
$.ajax({
url: "<?php echo base_url(); ?>Admin/get_section_by_course",
method: "POST",
data: {
course_id: course
},
dataType: "json",
success: function(response) {
console.log(response);
// section options code and start from here
divData += "<option value='' disabled> Select Section </option>";
if (response.sections != '') {
$.each(response.sections, function(i, sectiondata) {
divData += "<option value='" + sectiondata.section_id + "'>" + sectiondata.section_name + "</option>";
});
}
// $('#course_error_msg').text();
else {
divData += "<option value=''> -- No Section's Found --</option>";
}
$('#section_id').empty().append(divData).selectpicker("refresh");
// section options code here End from here
}
});
} else {
divData = "<option value=''> -- Select Section -- </option>";
$('#f_section').empty().append(divData);
}
});
function show_hide_table(flagVal) {
$('#theOfflineExamMarksEntryTable').hide();
//&& $('#section_id').val()!=''
if (flagVal == 'onload' && $('#batch_id').val() != '' && $('#course_id').val() != '' && jsShowTable == 'Yes')
$('#theOfflineExamMarksEntryTable').show();
}
function validate_view_here() {
$errCnt = 0;
$("#err_batch_id").hide();
$("#err_course_id").hide();
$("#err_section_id").hide();
if ($('#batch_id').val() == '') {
$('#err_batch_id').html('Please select the batch.');
$('#err_batch_id').show();
$errCnt++;
}
if ($('#course_id').val() == '') {
$('#err_course_id').html('Please select the course.');
$('#err_course_id').show();
$errCnt++;
}
$('#clicked_button').val('View');
if ($errCnt == 0)
$('#recordsUpdateForm').submit();
return false;
}
function validate_the_form_here(theFunction, theStudentId) {
$('#the_student_id').val(theStudentId);
$('#clicked_button').val(theFunction);
$('#recordsUpdateForm').submit();
if (theStudentId > 0) {
$('#row-save-' + theStudentId).hide();
$('#row-save-loading-' + theStudentId).show();
}
$('#tbl-save-all-btn').hide();
$('#tbl-loading-btn').show();
}
</script>