BBnepal-Accounts/application/views/admin/subject.php

194 lines
10 KiB
PHP
Raw Normal View History

2024-07-10 12:43:19 +00:00
<div class="wraper responsive-width">
<main class="" id="main">
<div class="from-group adding-class form-group_lng">
<a href="<?= base_url(); ?>admin/assign-additional-subjects">
<input type="button" class="subject_addbtn" value="Assign Additional Subjects">
</a>
&nbsp;&nbsp;&nbsp;&nbsp;
<a href="<?= base_url(); ?>admin/assign-optional-subjects">
<input type="button" class="subject_addbtn" value="Assign Optional Subjects">
</a>
&nbsp;&nbsp;&nbsp;&nbsp;
<a href="<?= base_url(); ?>admin/ae-subject/0"><button type="button" class="btn btn-success btn-sm">Add New Subject</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">Subjects List <p id="success" style="color:green;"></p>
</div>
<?php
if (!empty($this->session->flashdata('successsubject'))) { ?>
<div class="alert alert-success">
<a href="#" class="close" data-dismiss="alert">&times;</a>
<strong>Success!</strong> <?php echo $this->session->flashdata('successsubject'); ?>
</div>
<?php
}
if (!empty($this->session->flashdata('errorsubject'))) {
?>
<div class="alert alert-danger">
<a href="#" class="close" data-dismiss="alert">&times;</a>
<strong>Failed!</strong> <?php echo $this->session->flashdata('errorsubject'); ?>
</div>
<?php } ?>
<div id="msgs">
</div>
<!--<div class="view_del-subjects"><a href="<?php //echo base_url();
?>Admin/subject_deleted">View Deleted Items</a></div>-->
<table id="tbl" class="display table-responsive">
<thead>
<tr>
<th>Sl.No</th>
<th>Subject Name</th>
<th>Subject Code</th>
<th>Subject Icon</th>
<th>Is Optional?</th>
<th>Credit Hours</th>
<th>Is Additional?</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$subjects_count = (isset($subjects) && !empty($subjects)) ? count($subjects) : 0;
if ($subjects_count > 0) { ?>
<?php $i = 1;
foreach ($subjects as $sub) {
$subject_id = (isset($sub['id']) && !empty($sub['id'])) ? $sub['id'] : 0;
$subject_name = (isset($sub['subject_name']) && !empty($sub['subject_name'])) ? $sub['subject_name'] : '';
$subject_code = (isset($sub['subject_code']) && !empty($sub['subject_code'])) ? $sub['subject_code'] : '';
$subject_icon = (isset($sub['subject_icon']) && !empty($sub['subject_icon'])) ? $sub['subject_icon'] : '';
$is_active = (isset($sub['is_active']) && !empty($sub['is_active'])) ? $sub['is_active'] : '';
?>
<tr>
<td><?= $i; ?></td>
<td><?= $subject_name; ?></td>
<td>
<?= $subject_code; ?>
</td>
<td>
<div class="tableText_center table-img">
<?php if ($subject_icon != '') { ?>
<img src="<?= base_url(); ?>assets_admin/images/icons/<?= $subject_icon; ?>">
<?php } ?>
</div>
</td>
<td><?php echo $sub['is_optional'];?></td>
<td><?php echo $sub['credit_hours'];?></td>
<td><?php echo $sub['is_additional'];?></td>
<td>
<?php
echo $status = ($is_active == 'yes') ? 'Yes' : 'No';
?>
</td>
<td>
<div class="sub_tabbtnsec">
<a href="<?php echo base_url(); ?>admin/ae-subject/<?php echo $subject_id; ?>">
<div class="sub_editbtn" data-toggle="tooltip" title="Edit"><i class="fas fa-pencil-alt text-primary"></i></div>
</a>
<a data-toggle="modal" onclick="subdel(<?php echo $subject_id; ?>)" href="#deleteModal">
<div class="sub_delbtn" data-toggle="tooltip" title="Delete">
<i class="fa fa-trash" aria-hidden="true"></i>
</div>
<div><a href="<?php echo base_url(); ?>admin/assign-syllabus/<?= $subject_id; ?>" data-toggle="tooltip" title="Assign Syllabus"><i class="fa fa-share"></i></a></div>
</a>
</div>
</td>
</tr>
<?php $i++;
} ?>
<?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="sdid" />
<h4>Are you sure?</h4>
<p>Are you sure you want to delete this subject ?</p>
<div class="delete-modal-btn">
<button type="button" class="subject_addbtn subject_addbtn_red" onclick="deletedata($('#sdid').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="view-doc">
<div class="modal fade" id="viewsylabus" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<div id="pdfview" class="document-view-wrap">
</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 subdel(icn) {
// alert(icn);
$('#sdid').val(icn);
}
function subpdf(pdf) {
console.log("pdf : " + pdf);
// var con = '<img src="<?= base_url(); ?>assets_admin/subject-sylabus/'+pdf+'"/>';
var con = '<embed src="<?= base_url(); ?>assets_admin/subject-sylabus/' + pdf + '" height="700px" width="500">';
// console.log(con);
$('#pdfview').html(con);
}
</script>
<script type="text/javascript">
function deletedata(id) {
// alert(id);
window.location.replace('<?php echo base_url() ?>' + 'admin/delete_subject/' + id);
}
$(document).ready(function() {
// show the alert
setTimeout(function() {
$(".alert").alert('close');
<?php unset($_SESSION['successsubject']); ?>
<?php unset($_SESSION['errorsubject']); ?>
}, 50000);
});
</script>