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

255 lines
11 KiB
PHP

<style>
.subject-filter {
margin-right: 10px;
width: 290px;
}
button.btn.btn-success.btn-sm {
padding: 8px;
}
p.text-danger {
color: red;
}
.top-filter {
display: flex;
font-size: 15px;
margin-bottom: 35px;
align-items: flex-end;
color: red;
}
.subject_addbtn1 {
background: #032da1;
border-radius: 3px;
color: #fff;
padding: 3px 38px;
border: none;
font-size: 16px;
cursor: pointer;
}
.cierr {
font-size: 14px;
}
</style>
<div class="wraper responsive-width">
<main class="long-tbl-main" id="main">
<div class="from-group adding-class form-group_lng">
<?php $classroom_id = (!empty($classroomid)) ? $classroomid : 0; ?>
</div>
<div class="row displaydata">
<div class="col-md-6 pull-left">
<a href="<?= base_url(); ?>admin/classroom" class="pull-left"><button type="button" class="btn subject_addbtn1 bg-dark">Back</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>-->
<form method="POST" action="<?php echo base_url() . 'Admin/assignedtoclassroom' ?>" id="studentsfilterform">
<div class="filter_lbl">
<i class="fas fa-filter"></i>
Filter
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<div class="date-fil-row">
<select id="batch_filter" class="form-control batch_filter" name="batch_filter" placeholder="Select Batch">
<option value="">-- Select Batch --</option>
<?php foreach ($batch_list as $b_value) {
?>
<option value="<?php echo $b_value['id'] ?>" <?= $school_info['batch_id'] == $b_value['id'] ? 'selected' : '' ?>><?php echo $b_value['b_name']; ?></option>
<?php } ?>
</select>
</div>
<div class="text-danger cierr"><?php echo form_error('batch_filter'); ?></div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="date-fil-row">
<select class="form-control course_filter" name="course_filter" placeholder="Select Course" id="course_filter" readonly>
<option value="">-- Select Course --</option>
<?php foreach ($course_list as $c_value) {
if ($course_id == $c_value['id']) { ?>
<option value="<?php echo $c_value['id'] ?>" selected><?php echo $c_value['course_name'] ?></option>
<?php }
}
echo 'course -' . $course_id; ?>
</select>
</div>
<div class="text-danger cierr"><?php echo form_error('filter-Edate'); ?></div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<select id="section_filter" class="form-control section_filter" name="section_filter" placeholder="Select Section" onchange="reload_unsigned_students()">
<option value="">-- Select Section --</option>
</select>
<div class="text-danger cierr"><?php echo form_error('section_filter'); ?></div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<button type="submit" name="assignto" class="btn btn-success btn-sm w-70" value="assigntoclassroom">Assign To Classroom</button>
<a href="<?php echo base_url(); ?>admin/assign-to-classroom/<?php echo $back_url; ?>" class="p-0"><button type="button" name="reset_filter" id="reset_filter" value="reset_filter" class="subject_addbtn subject_addbtn_nobg p-0"><i class="fas fa-redo"></i>Reset</button></a>
<div class="text-danger cierr"><?php echo form_error('student_list[]'); ?></div>
</div>
</div>
</div>
<div id="results"></div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
</div>
<script type="text/javascript">
function autoselect_course() {
reload_unsigned_students();
var div_data = "<option value=''> -- Select Section-- </option>";
var course_id = $('#course_filter').val();
$('#section_filter').html("");
// alert(course_id);
if (course_id != '') {
$.ajax({
type: "post",
url: "<?php echo base_url('Admin/getsectionsbyCourse'); ?>",
data: {
courseid: course_id
},
dataType: "json",
success: function(response) {
console.log(response);
if (response != "") {
$.each(response, function(index, data) {
div_data += "<option value=" + data.section_id + ">" + data.section_name + "</option>";
});
}
$('#section_filter').append(div_data);
}
});
}
}
function reload_unsigned_students() {
var values = $('#studentsfilterform').serialize();
urlVal = '<?php echo base_url(); ?>Admin/ajaxstudentfilters';
$.ajax({
type: "POST",
url: urlVal,
data: values,
success: function(result) {
console.log(result);
result = result.trim();
$('#results').empty();
$('#results').html(result);
}
});
}
$(document).ready(function() {
autoselect_course();
// reload_unsigned_students();
var sectionId = 0,
sectionName = "No Sections Found";
$('#course_filter').change(function() {
reload_unsigned_students();
var div_data = "<option value=''> -- Select Section-- </option>";
var course_id = $(this).val();
$('#section_filter').html("");
// alert(course_id);
if (course_id != '') {
$.ajax({
type: "post",
url: "<?php echo base_url('Admin/getsectionsbyCourse'); ?>",
data: {
courseid: course_id
},
dataType: "json",
success: function(response) {
console.log(response);
if (response != "") {
$.each(response, function(index, data) {
div_data += "<option value=" + data.section_id + ">" + data.section_name + "</option>";
});
}
$('#section_filter').append(div_data);
}
});
}
});
$("#batch_filter").change(function() {
reload_unsigned_students();
});
});
$(document).ready(function() {
// show the alert
setTimeout(function() {
$(".alert").alert('close');
<?php unset($_SESSION['success_msg']); ?>
<?php unset($_SESSION['error_msg']); ?>
}, 15000);
});
</script>