382 lines
20 KiB
PHP
382 lines
20 KiB
PHP
|
<style>
|
||
|
.error {
|
||
|
color: red !important;
|
||
|
}
|
||
|
</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-6 pull-left" style="padding:0">
|
||
|
<!-- <a href="<?php // echo base_url();
|
||
|
?>admin/classroom" class="pull-left"><button type="button" class="btn subject_addbtn bg-dark">Back</button></a> -->
|
||
|
</div>
|
||
|
<?php
|
||
|
$search_batchid = (!empty($search_batch_id)) ? $search_batch_id : '';
|
||
|
$search_classroomid = (!empty($search_classroom_id)) ? $search_classroom_id : '';
|
||
|
|
||
|
?>
|
||
|
</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">×</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">×</a>
|
||
|
<strong>Failed!</strong> <?php echo $this->session->flashdata('error_msg'); ?>
|
||
|
</div>
|
||
|
<?php } ?>
|
||
|
<div class="bootstrap_alert">
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
<form method="post" action="<?php echo base_url(); ?>admin/assign-routes">
|
||
|
|
||
|
<div class="filter_lbl">
|
||
|
<i class="fas fa-filter"></i>
|
||
|
Filter
|
||
|
</div>
|
||
|
|
||
|
<div class="row">
|
||
|
<div class="col-md-4">
|
||
|
<div class="form-group">
|
||
|
<label class="mb-0" style="font-size: 13px;">Batch</label>
|
||
|
|
||
|
<select id="search_batch" class="form-control" placeholder="Select Batch" name="search_batch">
|
||
|
<option value=""> Select Batch</option>
|
||
|
<?php
|
||
|
if (isset($batchs) && !empty($batchs)) {
|
||
|
foreach ($batchs as $bvalue) {
|
||
|
if ($search_batchid == $bvalue['id'])
|
||
|
$bchecked = 'selected';
|
||
|
else
|
||
|
$bchecked = '';
|
||
|
?>
|
||
|
<option value="<?php echo $bvalue['id']; ?>" <?= $bchecked; ?>><?php echo $bvalue['b_name']; ?></option>
|
||
|
<?php }
|
||
|
} ?>
|
||
|
|
||
|
</select>
|
||
|
<span class="error">
|
||
|
<?php echo form_error('search_batch', '<div class="error">', '</div>'); ?>
|
||
|
</span>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="col-md-4">
|
||
|
<div class="form-group">
|
||
|
<label class="mb-0" style="font-size: 13px;">Classroom</label>
|
||
|
<?php if (!empty($search_classroom_id) && count($search_classroom_id) > 0) { ?>
|
||
|
<select placeholder="Select Classroom" name="search_classroom[]" id="search_classroom" class="form-control selectpicker" multiple>
|
||
|
<option value="" disabled> -- Select Classroom -- </option>
|
||
|
<?php
|
||
|
foreach ($classrooms as $clvalue) {
|
||
|
|
||
|
?>
|
||
|
<option value="<?= $clvalue['id'] ?>" <?php echo (in_array($clvalue['id'], $search_classroom_id)) ? "selected" : ""; ?>><?= $clvalue['classroom_name']; ?></option>
|
||
|
|
||
|
<?php } ?>
|
||
|
</select>
|
||
|
<?php } else { ?>
|
||
|
|
||
|
<select placeholder="Select Classroom" name="search_classroom[]" id="search_classroom" class="form-control selectpicker" multiple>
|
||
|
<option value="" disabled> -- Select Classroom -- </option>
|
||
|
<?php
|
||
|
if (isset($classrooms) && !empty($classrooms)) {
|
||
|
foreach ($classrooms as $clvalue) {
|
||
|
if ($search_classroomid == $clvalue['id'])
|
||
|
$clchecked = 'selected';
|
||
|
else
|
||
|
$clchecked = '';
|
||
|
?>
|
||
|
<option value="<?php echo $clvalue['id']; ?>" <?= $clchecked; ?>><?php echo $clvalue['classroom_name']; ?></option>
|
||
|
<?php }
|
||
|
} ?>
|
||
|
</select>
|
||
|
|
||
|
<?php } ?>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="col-md-4">
|
||
|
<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/assign-routes"><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>
|
||
|
|
||
|
|
||
|
<!--<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>Sl.No</th>
|
||
|
<th>Student Id</th>
|
||
|
<th>Student Name</th>
|
||
|
|
||
|
<th>Action</th>
|
||
|
|
||
|
|
||
|
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<?php
|
||
|
// dd($studentlist);
|
||
|
if (isset($studentlist) && !empty($studentlist)) {
|
||
|
$sno = 1;
|
||
|
foreach ($studentlist as $student) {
|
||
|
$studentBatch = (isset($student['batch_id']) && !empty($student['batch_id'])) ? $student['batch_id'] : 0;
|
||
|
$studentCourse = (isset($student['course']) && !empty($student['course'])) ? $student['course'] : 0;
|
||
|
|
||
|
|
||
|
|
||
|
?>
|
||
|
<tr>
|
||
|
<td><?= $sno; ?></td>
|
||
|
<td><?= $student['studentId']; ?></td>
|
||
|
<td><?= $student['name']; ?></td>
|
||
|
|
||
|
<td>
|
||
|
<?php
|
||
|
// echo '<pre>';
|
||
|
// print_r($student);
|
||
|
if (lcfirst($student['bus_facility']) == 'yes' && $student['bus_routeid'] != 0) {
|
||
|
$routes_coursefee_rst = $this->db->query('SELECT id FROM course_fees WHERE batch_id=' . $studentBatch . ' AND course_id=' . $studentCourse . ' AND fees_type=4 AND route_id=' . $student['bus_routeid'])->row_array();
|
||
|
$routes_coursefee_id = (isset($routes_coursefee_rst) && !empty($routes_coursefee_rst)) ? $routes_coursefee_rst['id'] : '';
|
||
|
// $routes_coursefee_id=$this->db->get_where('course_fees',array('batch_id'=>$studentBatch ,'course_id'=>$studentCourse,'fees_type'=>'4','route_id'=>$student['bus_routeid']))->row()->id;
|
||
|
|
||
|
// if($route_coursefee_id !=0 ){
|
||
|
// $student_installment=$this->db->get_where('students_online_payments',array('student_id'=>$student_id,'course_fee_id'=>$route_coursefee_id ))->row_array();
|
||
|
// $paymentStatus=false;
|
||
|
// if(!empty($student_installment)){
|
||
|
// $installmentArray=json_decode($student_installment['payment_details'],true);
|
||
|
|
||
|
// foreach($installmentArray as $payment_data){
|
||
|
// if($payment_data['payment_status']=='yes'){
|
||
|
// $paymentStatus=true;
|
||
|
// break;
|
||
|
// }
|
||
|
// }
|
||
|
|
||
|
// }
|
||
|
// }
|
||
|
|
||
|
?>
|
||
|
|
||
|
|
||
|
<button class="btn btn-success btn-xs route_modal" style="padding:6px !important;" data-id="<?php echo $student['id']; ?>"> <i class="fas fa-check-circle "></i> Re-Assign</button>
|
||
|
<?php } else { ?>
|
||
|
<button class="btn btn-primary btn-xs route_modal" style="padding:6px !importants;" data-id="<?php echo $student['id']; ?>">Assign</button>
|
||
|
<?php } ?>
|
||
|
</td>
|
||
|
|
||
|
</tr>
|
||
|
<?php
|
||
|
$sno++;
|
||
|
}
|
||
|
} ?>
|
||
|
</tbody>
|
||
|
|
||
|
</table>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</main>
|
||
|
</div>
|
||
|
|
||
|
<!-- modal start -->
|
||
|
<!-- Modal -->
|
||
|
<div class="modal fade " id="RouteDetailModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||
|
<div class="modal-dialog modal-lg" role="document">
|
||
|
|
||
|
<div class="modal-content">
|
||
|
|
||
|
<div class="routes_body">
|
||
|
|
||
|
|
||
|
</div>
|
||
|
<div class="modal-footer">
|
||
|
<button type="button" class="btn btn-danger" id="unassign_route_btn"> Unassign</button>
|
||
|
<button type="button" class="btn btn-primary" id="assign_route_btn"> Assign</button>
|
||
|
</div>
|
||
|
<input type="hidden" id="student_id" name="student_id" class="form-control" />
|
||
|
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<!-- modal end -->
|
||
|
<script defer src="<?php echo base_url(); ?>assets_admin/js/bootstrap-select.min.js"></script>
|
||
|
<script>
|
||
|
$(document).ready(function() {
|
||
|
$('#tbl').DataTable({
|
||
|
"lengthMenu": [
|
||
|
[25, 50, 100, 150, -1],
|
||
|
[25, 50, 100, 150, "All"]
|
||
|
]
|
||
|
});
|
||
|
});
|
||
|
|
||
|
$(".route_modal").click(function() {
|
||
|
var studentid = $(this).data('id');
|
||
|
var batchid = "<?php echo $search_batchid; ?>";
|
||
|
var divdata = '';
|
||
|
if (batchid != '') {
|
||
|
$.ajax({
|
||
|
url: "<?php echo base_url(); ?>admin/getrouteDetails",
|
||
|
method: "POST",
|
||
|
data: {
|
||
|
batch_id: batchid,
|
||
|
student_id: studentid
|
||
|
},
|
||
|
success: function(htmldata) {
|
||
|
// console.log(htmldata);
|
||
|
$('#student_id').val(studentid);
|
||
|
$(".routes_body").html(htmldata);
|
||
|
$('#RouteDetailModal').modal({
|
||
|
backdrop: 'static',
|
||
|
keyboard: false,
|
||
|
show: true
|
||
|
});
|
||
|
// let assignBtn = $('#modalStudentPayment').data('payment-status');
|
||
|
// if (assignBtn === 1) {
|
||
|
// $("#assign_route_btn").removeClass("d-none");
|
||
|
// } else {
|
||
|
// $("#assign_route_btn").removeClass("d-none");
|
||
|
// }
|
||
|
|
||
|
}
|
||
|
});
|
||
|
} else {
|
||
|
alert("Please Select Batch");
|
||
|
}
|
||
|
});
|
||
|
|
||
|
|
||
|
|
||
|
$("#assign_route_btn").click(function(e) {
|
||
|
var selectedVal = "";
|
||
|
var alertsection = '';
|
||
|
var selected = $("input[type='radio'][name='route_id']:checked");
|
||
|
var isOneWay = $("input[type='checkbox'][name='isOneWay']:checked");
|
||
|
|
||
|
if (selected.length > 0) {
|
||
|
selectedVal = selected.val();
|
||
|
|
||
|
var Selected_r = $('#stop_name_' + selectedVal + " option:selected").val();
|
||
|
|
||
|
if (Selected_r === "0") {
|
||
|
alert('Please Select Stop Name');
|
||
|
e.preventDefault();
|
||
|
} else {
|
||
|
var batchid = "<?php echo $search_batchid; ?>";
|
||
|
var studentid1 = $('#student_id').val();
|
||
|
if (studentid1 != '') {
|
||
|
$.ajax({
|
||
|
url: "<?php echo base_url(); ?>admin/routeAssignToStudent",
|
||
|
method: "POST",
|
||
|
data: {
|
||
|
route_id: selectedVal,
|
||
|
student_id: studentid1,
|
||
|
stop_id: Selected_r,
|
||
|
batch_id: batchid,
|
||
|
is_one_way: isOneWay.length > 0 ? 'yes' : 'no'
|
||
|
},
|
||
|
success: function(result) {
|
||
|
$('#RouteDetailModal').modal("hide");
|
||
|
|
||
|
if (result == 1) {
|
||
|
<?php $this->session->set_flashdata('success_msg', 'Route Assigned Successfully'); ?>
|
||
|
} else {
|
||
|
<?php $this->session->set_flashdata('error_msg', 'Route Assiging Failed'); ?>
|
||
|
}
|
||
|
location.reload();
|
||
|
}
|
||
|
});
|
||
|
} else {
|
||
|
alert("Student Id : " + studentid);
|
||
|
}
|
||
|
}
|
||
|
} else {
|
||
|
alert("Please Select Route");
|
||
|
}
|
||
|
})
|
||
|
|
||
|
$("#unassign_route_btn").click(function(e) {
|
||
|
var selectedVal = "";
|
||
|
var alertsection = '';
|
||
|
var selected = $("input[type='radio'][name='route_id']:checked");
|
||
|
var isOneWay = $("input[type='checkbox'][name='isOneWay']:checked");
|
||
|
var studentid1 = $('#student_id').val();
|
||
|
var studentCourse = $('#s_course').val();
|
||
|
|
||
|
// console.log(studentid1);
|
||
|
if (selected.length > 0) {
|
||
|
selectedVal = selected.val();
|
||
|
|
||
|
var Selected_r = $('#stop_name_' + selectedVal + " option:selected").val();
|
||
|
|
||
|
if (Selected_r === "0") {
|
||
|
alert('Please Select Stop Name');
|
||
|
e.preventDefault();
|
||
|
} else {
|
||
|
var batchid = "<?php echo $search_batchid; ?>";
|
||
|
var studentid1 = $('#student_id').val();
|
||
|
console.log(studentid1);
|
||
|
if (studentid1 != '') {
|
||
|
$.ajax({
|
||
|
url: "<?php echo base_url(); ?>admin/routeUnAssignToStudent",
|
||
|
method: "POST",
|
||
|
data: {
|
||
|
route_id: selectedVal,
|
||
|
student_id: studentid1,
|
||
|
stop_id: Selected_r,
|
||
|
batch_id: batchid,
|
||
|
s_course: studentCourse,
|
||
|
is_one_way: isOneWay.length > 0 ? 'yes' : 'no'
|
||
|
},
|
||
|
success: function(result) {
|
||
|
$('#RouteDetailModal').modal("hide");
|
||
|
|
||
|
if (result == 1) {
|
||
|
<?php $this->session->set_flashdata('success_msg', 'Route unassigned Successfully'); ?>
|
||
|
} else {
|
||
|
<?php $this->session->set_flashdata('error_msg', 'Route unassiging Failed'); ?>
|
||
|
}
|
||
|
|
||
|
// console.log(result);
|
||
|
location.reload();
|
||
|
}
|
||
|
});
|
||
|
} else {
|
||
|
alert("Student Id : " + studentid);
|
||
|
}
|
||
|
}
|
||
|
} else {
|
||
|
alert("Please Select Route");
|
||
|
}
|
||
|
})
|
||
|
</script>
|