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

200 lines
10 KiB
PHP

<style>
.displaydata {
width: 100% !important;
}
.subject_addbtn {
background: #032da1;
border-radius: 3px;
color: #fff;
padding: 3px 38px;
border: none;
font-size: 16px;
cursor: pointer;
}
</style>
<div class="wraper responsive-width">
<main class="long-tbl-main" id="main">
<div class="displaydata pt-5 form-group_lng" style="display:flex">
<div class="col-md-5 pull-left" style="padding:0">
<a href="<?= base_url(); ?>admin/classroom" class="pull-left"><button type="button" class="btn subject_addbtn bg-dark">Back</button></a>
</div>
<div class="col-md-7 pull-right text-right" style="padding:0">
<?php $classroom_id = (!empty($classroomid)) ? $classroomid : 0;
$cls_id = urlsafe_b64encode($classroomid . '-qqcksbvlwierhwjerw');
?>
<a href="<?= base_url(); ?>admin/symbol-number/<?php echo $cls_id ?>" class="pull-right btn btn-outline-primary btn-sm">Symbol Number</a>
<a href="<?= base_url(); ?>admin/registration-number/<?php echo $cls_id ?>" class="pull-right btn btn-outline-primary btn-sm">Registration Number</a>
<a href="<?= base_url(); ?>admin/roll-change/<?php echo $cls_id ?>" class="pull-right"><button type="button" class="btn btn-outline-primary btn-sm">Roll Number</button></a>
<a href="<?= base_url(); ?>admin/assign-to-classroom/<?php echo $cls_id ?>" class="pull-right"><button type="button" class="btn btn-outline-primary btn-sm">Assign to classroom</button></a>
</div>
</div>
<div class="admin_tempblock">
<div class="admin_tempsec">
<div class="admin_sec">
<div class="subsec_sec">
<div class="subject_r subject_r_lng">
<div class="subject_lsec">
<div class="subject_lhead"><?php echo $title; ?> <p id="success" style="color:green;"></p>
</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
}
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 } ?>
<!--<div class="view_del-subjects"><a href="<?= base_url(); ?>admin/classroom_deleted">View Deleted Items</a></div>-->
<table id="tbl" class="display table-responsive">
<thead>
<tr>
<th>S.No.</th>
<th>Roll No.</th>
<th>Student Id</th>
<th>Photo</th>
<th>Name</th>
<th>Email</th>
<th>Contact</th>
<th>Course</th>
<th>Batch</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$sno = 1;
// echo "<pre>";
// print_r($student_list);
// die();
foreach ($student_list as $student) {
if (empty($student['photo'])) {
$profile_path = base_url() . "common_assets/user.png";
} else if (file_exists('assets_student/application/' . $student['photo'])) {
$profile_path = base_url() . "assets_student/application/" . $student['photo'];
} else {
if ($student['gender'] == 'Male' || $student['gender'] == 'male')
$profile_path = base_url() . "common_assets/male_image.jpg";
else
$profile_path = base_url() . "common_assets/female_image.jpg";
}
?>
<tr>
<td><?= $sno; ?></td>
<td><?= $student['roll_no']; ?></td>
<td class="text-left"><?= $student['studentId']; ?></td>
<td> <img src="<?= $profile_path; ?>" class="student_img_list" /></td>
<td class="text-left"><?= $student['name']; ?></td>
<td class="text-left"><?= $student['email']; ?></td>
<td class="text-left"><?= $student['mobile']; ?></td>
<td>
<?php
$course_name = $this->db->get_where('course', array('id' => $student['course']))->row()->course_name;
echo (!empty($course_name)) ? $course_name : ''; ?>
</td>
<td>
<?php
$batch = $this->db->get_where('batch', array('id' => $student['student_batch']))->row_array();
echo $batch['b_name'];
?>
</td>
<td>
<a href="<?php echo base_url(); ?>admin/view_student/<?php echo $student['id']; ?>" class="p-1" data-toggle="tooltip" title="view Profile">
<i class="fa fa-eye fa-lg" aria-hidden="true"></i>
</a>
<span class="text-danger" data-toggle="tooltip" onclick="removestudent(<?php echo $student['id']; ?>,<?= $student['batch_id']; ?>,<?= $classroom_id; ?>)" title="Remove from Classroom">
<i class="fa fa-times fa-lg" aria-hidden="true"></i>
</span>
</td>
</tr>
<?php $sno++;
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
</div>
<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">
<i class="far fa-times-circle"></i>
<input type="hidden" id="student_id" />
<input type="hidden" id="batch_id" />
<input type="hidden" id="classroom_id" />
<h4>Are you sure?</h4>
<p>Are you sure you want to delete this item?</p>
<div class="delete-modal-btn">
<button type="button" class="subject_addbtn subject_addbtn_red" onclick="deletedata($('#student_id').val(),$('#batch_id').val(),$('#classroom_id').val());">Delete</button>
<button type="button" class="subject_addbtn subject_addbtn_cancel" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
//table js
$('#tbl').DataTable({
"lengthMenu": [
[25, 50, 100, 150, -1],
[25, 50, 100, 150, "All"]
]
});
//table js end
});
function removestudent(stud_id, batch_id, classroom_id) {
$('#student_id').val(stud_id);
$('#batch_id').val(batch_id);
$('#classroom_id').val(classroom_id);
$('#deleteModal').modal('show');
}
function deletedata(student_id, btach_id, classroom_id) {
window.location.href = "<?php echo base_url(); ?>Admin/remove_classroom_student/" + student_id + "/" + btach_id + "/" + classroom_id;
}
</script>
<script type="text/javascript">
$(document).ready(function() {
// show the alert
setTimeout(function() {
$(".alert").alert('close');
<?php unset($_SESSION['success_msg']); ?>
<?php unset($_SESSION['error_msg']); ?>
}, 15000);
});
</script>