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

176 lines
9.3 KiB
PHP

<div class="wraper responsive-width">
<main class="" id="main">
<div class="from-group adding-class form-group_lng">
<a href="<?= base_url(); ?>admin/ae-course/0"><button type="button" class="btn btn-success btn-sm">Add New Course</button></a>
</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">Courses List <p id="success" style="color:green;"></p></div>
<?php if($this->session->flashdata('success')) { ?>
<div class="alert alert-success alert-dismissible fade show" role="alert">
<p><?php echo $this->session->flashdata('success') ?></p>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php } ?>
<?php if($this->session->flashdata('failed')) { ?>
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<p><?php echo $this->session->flashdata('failed') ?></p>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php } ?>
<table id="tbl" class="display table-responsive">
<thead>
<tr>
<th>Sl.No</th>
<th>Course</th>
<th>Section Name</th>
<th>Subject Name</th>
<th>Fee Cost</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php foreach($course_names as $key => $value) {
$sectionsarr = array();
$subjectsarr = array();
?>
<tr>
<td><?php echo $key + 1 ?></td>
<td><?php echo $value['course_name'] ?></td>
<td>
<?php foreach ($result as $se_key => $se_value) {
if($se_value['course_name'] == $value['course_name']) {
if(!in_array($se_value['section_name'], $sectionsarr)) {
array_push($sectionsarr, $se_value['section_name']);
}
}
}
echo implode('<br>', $sectionsarr);
?>
</td>
<td><?php foreach ($result as $se_key => $se_value) {
if($se_value['course_name'] == $value['course_name']) {
if(!in_array($se_value['subject_name'], $subjectsarr)) {
array_push($subjectsarr, $se_value['subject_name']);
}
}
}
echo implode('<br>', $subjectsarr);
?></td>
<td>
<?php
if(!empty($value['amount']))
echo $value['amount'];
else
echo 'Course fee not assigned';
?>
</td>
<td>
<div class="sub_tabbtnsec">
<div class="sub_editbtn"><a href="<?php echo base_url() ?>admin/ae-course/<?php echo $value['id'] ?>"><i class="fas fa-pencil-alt"></i></a></div>
<a data-toggle="modal" onclick ="coursedel(<?php echo $value['id'] ?>)" href="#deleteModal">
<div class="sub_delbtn" >
<i class="fa fa-trash" aria-hidden="true"></i>
</div>
</a>
</div>
</td>
</tr>
<?php } ?>
</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 = "crid" />
<h4>Are you sure?</h4>
<p>Are you sure you want to delete this course?</p>
<div class="delete-modal-btn">
<button type="button" class="subject_addbtn subject_addbtn_red" onclick="deletedata($('#crid').val());">Delete</button>
<button type="button" class="subject_addbtn subject_addbtn_cancel" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>
</div>
</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 = "sdid" />
<h4>Are you sure?</h4>
<p>Are you sure you want to restore this subject?</p>
<div class="delete-modal-btn">
<button type="button" class="subject_addbtn subject_addbtn_red" onclick="restoredata($('#sdid').val(), 'subject');">Restore</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, -1], [25, 50, 100, "All"]]
} );
//table js end
});
</script>
<script type="text/javascript">
function coursedel(icn){
// alert(icn);
$('#crid').val(icn);
}
function deletedata(id){
window.location.href = "<?php echo base_url(); ?>Admin/delete_course/" + id;
}
</script>