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

442 lines
25 KiB
PHP

<style>
form label.error,
#secNameerr {
color: red;
}
.cierr {
font-size: 14px;
}
#tbl1 tr th {
font-weight: 600;
font-size: 12px;
}
</style>
<div class="wraper responsive-width">
<main class="long-tbl-main students_list_table" id="main">
<div class="from-group adding-class form-group_lng form_group_twobtn">
<!-- <a href=""><button type="button" class="btn btn-success btn-sm btn-dark">Back</button></a> -->
<!--a href=" "><button type="button" class="btn btn-success btn-sm">Assign students</button></a-->
</div>
<!-- admin template section -->
<div class="admin_tempblock">
<div class="admin_tempsec">
<div class="admin_sec">
<div class="subsec_sec">
<div class="subject_r subject_l_full_width">
<div class="subject_lsec">
<div class="from-group adding-class form-group_lng" style="margin:0;">
<a href="<?php echo base_url() ?>admin/add-student" style="font-size: 14px;" class="btn btn-success mr-2 ml-2">
<i class="fa fa-plus" aria-hidden="true"></i> &nbsp;Add Student
</a>
<a href="<?php echo base_url() ?>admin/viewStudentImportFile" style="font-size: 14px;" class="btn btn-outline-primary ml-2"> <i class="fa fa-upload" aria-hidden="true"></i> &nbsp;Import
</a>
<a href="<?php echo base_url() ?>admin/enable-student" style="font-size: 14px;" class="btn btn-outline-primary ml-2"> <i class="fa fa-ban" aria-hidden="true"></i> &nbsp;Disabled student
</a>
<a href="<?php echo base_url() ?>admin/multiple-edit" style="font-size: 14px;" class="btn btn-outline-primary ml-2">
<i class="fa fa-edit" aria-hidden="true"></i> &nbsp;Multiple Edit
</a>
</div>
<div class="subject_lhead">Students List</div>
<!-- tab added -->
<form method="post" action="<?php echo base_url(); ?>Admin/student" id='filter-form'>
<div class="filter_lbl">
<i class="fas fa-filter"></i>
Filter
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<label class="mb-0" style="font-size: 13px;">Batch</label>
<select id="batch" class="form-control custom-select" placeholder="Select Batch" name="filter-batch" onchange="fetchStudentOnCourseSelect(this)">
<option value=" "> Select Batch</option>
<?php if (isset($batch) || !empty($batch)) {
foreach ($batch as $row) { ?>
<option value="<?php echo $row['id'] ?>" <?= $row['id'] == $batchId ? 'selected' : '' ?>>
<?php echo $row['b_name']; ?></option>
<?php }
} ?>
</select>
<div class="text-danger cierr"><?php echo form_error('filter-batch'); ?></div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label class="mb-0" style="font-size: 13px;">Course</label>
<select id="course" class="form-control custom-select" placeholder="Select Course" name="filter-course" onchange="fetchStudentOnCourseSelect(this)">
<option value=" "> Select Course</option>
<?php if (isset($course) || !empty($course)) {
foreach ($course as $row) { ?>
<option value="<?php echo $row['id'] ?>" <?php echo set_select('filter-course', $row['id'], (!empty($courseId) ? TRUE : FALSE)); ?>>
<?php echo $row['course_name']; ?></option>
<?php }
} ?>
</select>
<div class="text-danger cierr"><?php echo form_error('filter-course'); ?></div>
</div>
</div>
<div class="col-md-3">
<div class="form-group" style="margin-top: 1.5rem;">
<input type="submit" name="filterSubmit" id="filter_reset" class="btn btn-success" value="Filter">
<a href="<?php echo base_url() ?>admin/student"><button type="button" name="reset_filter" id="reset_filter" value="reset_filter" class="subject_addbtn subject_addbtn_nobg"><i class="fas fa-redo"></i>Reset</button></a>
</div>
</div>
</div>
</form>
<?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
}
if (!empty($this->session->flashdata('error_msg'))) {
?>
<div class="alert alert-danger">
<a href="#" class="close" data-dismiss="alert">&times;</a>
<strong>Failed!</strong> <?php echo $this->session->flashdata('error_msg'); ?>
</div>
<?php } ?>
<form method="post" id="downloadAll" action="<?php echo base_url(); ?>Admin/downloadAll">
<div class="applicnts-list-wrap subject_lsec">
<div class="">
<table id="tbl1" class="display table-responsive">
<thead>
<tr>
<th><input type="checkbox" id="chkParent" /></th>
<th>Student Id</th>
<th>IEMIS No.</th>
<th>Photo</th>
<th>Name</th>
<th>Roll No</th>
<th>Contact No.</th>
<th>Course</th>
<th>Section</th>
<th>Batch</th>
<!-- <th>Registered Date</th> -->
<th>Action</th>
</tr>
</thead>
<tbody>
<?php $i = 1;
if (isset($students) && !empty($students)) {
foreach ($students as $s) {
// echo '<pre>';
// print_r($s);
$check_unsigned = $this->db->order_by('id', 'DESC')->get_where('student_batch', array('student_id' => $s['id'], 'batch_id' => $s['student_batch']))->row_array();
// if($s['classroom_batch']) {
// $check = '<input type="checkbox" name="student_id_list[]" value="'.$s['id'].'" />';
// } else {
// $check = '-';
// }
?>
<tr>
<td><?php if ($check_unsigned != '') { ?>
<input type="checkbox" name="student_id_list[]" value="<?= $s['id'] ?>" />
<?php } else {
echo " - ";
}
?>
</td>
<td><?= $s['studentId'] ?></td>
<td><?= !empty($s['iemis']) ? $s['iemis'] : '-' ?></td>
<td>
<?php
if (empty($s['photo'])) {
$profile_path = base_url() . "common_assets/user.png";
} else if (file_exists('assets_student/application/' . $s['photo'])) {
$profile_path = base_url() . "assets_student/application/" . $s['photo'];
} else {
if ($s['gender'] == 'Male' || $s['gender'] == 'male')
$profile_path = base_url() . "common_assets/male_image.jpg";
else
$profile_path = base_url() . "common_assets/female_image.jpg";
}
// $profile_path = (isset($s['photo']) && !empty($s['photo'])) ? base_url() . 'assets_student/application/' . $s['photo'] : base_url() . 'common_assets/No-Image.jpg';
?>
<img class="student_img_list img-thumbnail img-fluid border-primary p-1 rounded-circle" src="<?= $profile_path; ?>" class="" />
</td>
<td>
<div class="applicant_nme"><?= $s['name'] ?></div>
</td>
<td>
<div class="email-width">
<?php
$s_id = $s['id'];
$batch = $s['batch_id'];
$rst = $this->db->order_by('id', 'DESC')->get_where('student_batch', array('student_id' => $s_id, 'batch_id' => $batch))->row_array();
echo (isset($rst['roll_no']) && !empty($rst['roll_no'])) ? $rst['roll_no'] : '-';
?>
</div>
</td>
<td><?= $s['mobile'] ?></td>
<td>
<div class="course-width">
<?php
$course_id = (isset($s['course_id']) && !empty($s['course_id'])) ? $s['course_id'] : 0;
echo $this->db->get_where('course', array('id' => $course_id))->row()->course_name;
?>
</div>
</td>
<td> <?php
$classroomidd = (isset($check_unsigned['classroom_id']) && !empty($check_unsigned['classroom_id'])) ? $check_unsigned['classroom_id'] : 0;
if ($classroomidd != 0)
echo $this->db->query("SELECT s.section_name FROM section s JOIN classroom cl ON cl.section_id=s.id WHERE cl.id= $classroomidd")->row()->section_name;
else
echo "<span class='text-danger'> - </span>";
?> </td>
<td><?= $s['b_name'] ?></td>
<!-- <td>
<div class="applicn-date"> -->
<?php // echo $s['registered_on']
?>
<!-- </div>
</td> -->
<td>
<div class="sub_tabbtnsec stud_tabbtnsec">
<div class="sub_viewbtn">
<a href="<?php echo base_url(); ?>admin/view_student/<?php echo $s['id']; ?>" data-toggle="tooltip" title="View" target="_blank">
<i class="fa fa-eye" aria-hidden="true"></i>
</a>
<a href="<?php echo base_url(); ?>admin/view-student-payments/<?php echo $s['id']; ?>" data-toggle="tooltip" title="Payments" target="_blank">
<i class='fas fa-coins'></i>
</a>
<?php if (empty($check_unsigned)) { ?>
<a href="<?php echo base_url(); ?>admin/classroom" data-toggle="tooltip" title="Assign" target="_blank">
<i class="fa fa-share" aria-hidden="true"></i>
</a>
<?php } ?>
</div>
<a data-toggle="modal" onclick="coursedel(<?php echo $s['id'] ?>)" href="#deleteModal">
<div class="sub_delbtn">
<i class="fa fa-trash" aria-hidden="true"></i>
</div>
</a>
</div>
</td>
</tr>
<?php $i++;
}
} ?>
</tbody>
</table>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- admin template section end -->
</main>
<!--End right-top side-->
</div>
<!-- suspend student -->
<div class="viewDoc delete-modal-wrap">
<div class="modal fade" id="deleteModal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<div class="delete-modal">
<form method="POST" id="suspend_student" action="<?php echo base_url('admin/suspend-student') ?>">
<input name="student_id" type="hidden" id="crid" />
<input type="hidden" name="status" value="1" />
<h4>Reason for Disabled Student ? </h4>
<p>
<textarea class="form-control" name="reason" rows="4"></textarea>
<label id="reason-error" class="error mt-3 mb-2 text-left text-danger" for="reason"></label>
</p>
<div class="delete-modal-btn">
<button type="submit" class="subject_addbtn subject_addbtn_red">Disabled</button>
<button type="button" class="subject_addbtn subject_addbtn_cancel" data-dismiss="modal">Cancel</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<?php
$theExportHeader = 'Student List';
if (isset($school_info) && !empty($school_info)) {
$theExportHeader = $school_info['school_name'];
if (isset($_POST['filter-course'])) {
for ($a = 0; $a < count($course); $a++) {
if ($course[$a]['id'] == $_POST['filter-course']) {
// print_r('====================> ' . $course[$a]['course_name']);
$theExportHeader = 'Student List - ' . $course[$a]['course_name'];
}
}
}
}
?>
<script>
fetchStudentOnCourseSelect = function(ele) {
// document.getElementById("filter_reset").submit();
// alert(ele.value);
// $('#filter-form').submit();
};
</script>
<script>
$(document).ready(function() {
var jsTheExportHeader = '<?php echo $theExportHeader; ?>';
$('.user-drpdown').click(function() {
$('.drpdown-items').toggle();
});
//table js
$('#tbl1').DataTable({
"lengthMenu": [
[-1],
["All"]
],
dom: 'lBfrtip',
buttons: [{
extend: 'pdfHtml5',
title: 'Student List',
orientation: 'landscape',
exportOptions: {
columns: [1, 3, 4, 5, 6, 7, 8]
}
},
{
extend: 'csvHtml5',
exportOptions: {
columns: [1, 3, 4, 5, 6, 7, 8]
}
},
{
extend: 'excelHtml5',
header: true,
footer: true,
title: jsTheExportHeader,
exportOptions: {
columns: "thead th:not(.noExport)",
rows: function(indx, rowData, domElement) {
return $(domElement).css("display") != "none";
}
},
customize: function(xlsx) {
var sheet = xlsx.xl.worksheets['sheet1.xml'];
$('row c[r^="C"]', sheet).attr('s', '2');
}
}
]
});
//table js end
//multiple select js start
$('select').selectpicker();
//multiple select js end
});
$('#filter_reset').click(function() {
});
$(document).ready(function() {
$('#chkParent').click(function() {
var isChecked = $(this).prop("checked");
$('#tbl1 tr:has(td)').find('input[type="checkbox"]').prop('checked', isChecked);
});
$('#tbl1 tr:has(td)').find('input[type="checkbox"]').click(function() {
var isChecked = $(this).prop("checked");
var isHeaderChecked = $("#chkParent").prop("checked");
if (isChecked == false && isHeaderChecked)
$("#chkParent").prop('checked', isChecked);
else {
$('#tbl1 tr:has(td)').find('input[type="checkbox"]').each(function() {
if ($(this).prop("checked") == false)
isChecked = false;
});
console.log(isChecked);
$("#chkParent").prop('checked', isChecked);
}
});
});
$(document).on('click', '.download_idcards', function() {
var studentidlist = [];
console.log(studentidlist);
$.each($("input[name='student_id_list[]']:checked"), function() {
var item = $(this).data('studentid');
studentidlist.push(item);
});
if (studentidlist.length === 0) {
alert("Please Select Students");
} else {
$('#downloadAll').submit();
}
});
</script>
<script>
function coursedel(icn) {
// alert(icn);
$('#crid').val(icn);
}
$("#suspend_student").validate({
rules: {
"reason": {
required: true,
minlength: 10
}
},
submitHandler: function() {
form.submit();
} // end submitHandler
});
</script>
<script type="text/javascript">
window.onload = function() {
var mainInput = document.getElementById("end_date");
mainInput.nepaliDatePicker({
dateFormat: "DD-MM-YYYY",
language: 'english'
});
var mainInput1 = document.getElementById("start_date");
mainInput1.nepaliDatePicker({
dateFormat: "DD-MM-YYYY",
language: 'english'
});
};
</script>
</body>
</html>