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

172 lines
9.0 KiB
PHP

<div class="wraper responsive-width">
<main class="" id="main">
<div class="from-group">
<a href="<?= base_url(); ?>admin/subject"><button type="button" class="btn btn-success btn-sm btn-dark">Back</button></a>
</div>
<div class="admin_tempblock">
<div class="admin_tempsec">
<div class="admin_sec">
<div class="subsec_sec">
<div class="subject_r">
<div class="subject_lsec">
<div class="subject_lhead">Deleted Subject List <p id="success" style="color:green;"></p></div>
<table id="tbl" class="display">
<thead>
<tr>
<th>Sl.No</th>
<th>Subject Name</th>
<th>Subject Icon</th>
<th>Subject Syllabus</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php $i=1; foreach($subjects as $sub){ $sylab = $sub['subject_syllabus']; ?>
<tr>
<td><?= $i; ?></td>
<td><?= $sub['subject_name']; ?></td>
<td>
<div class="tableText_center table-img"><?php if($sub['subject_icon'] != '') { ?><img src="<?= base_url(); ?>assets_admin/images/icons/<?= $sub['subject_icon']; ?>">
<?php } ?>
</div>
</td>
<td><div class="tableText_center">
<?php if($sub['subject_syllabus'] != '') { ?>
<a data-toggle="modal" onclick = "subpdf('<?php echo $sub['subject_syllabus']; ?>')" href="#viewsylabus"><div>View Syllabus</div></a>
<?php } ?>
</div>
</td>
<td>
<div class="sub_tabbtnsec sub_tabbtnsec_restore">
<a data-toggle="modal" onclick = "subdel(<?php echo $sub['id']; ?>)" href="#restoreModal">
<div class="sub_editbtn"><img src="<?= base_url(); ?>assets_admin/images/icons/restore.png" class="restore-icon"></div>
</a>
<div class="sub_delbtn" >
<a data-toggle="modal" onclick = "subdel(<?php echo $sub['id']; ?>)" href="#deleteModal">
<i class="fa fa-trash" aria-hidden="true" title="Delete permanently"></i>
</a>
</div>
</div>
</td>
</tr>
<?php $i++; } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
</div>
<div class="viewDoc delete-modal-wrap">
<div class="modal fade" id="restoreModal" 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>
<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 item permanently?</p>
<div class="delete-modal-btn">
<button type="button" class="subject_addbtn subject_addbtn_red" onclick="deletedata($('#sdid').val(), 'subject');">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>
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);
}
$(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);
}
</script>
<script type="text/javascript">
function restoredata(id, table){
$('#restoreModal').modal('hide');
$.ajax({
type : 'POST',
url : "<?php echo base_url(); ?>Admin/restore_data",
data : {id : id, table : table},
success:function(resposne){
if(resposne == '1'){
// $('#success').html('Subject restored successfully.');
// setTimeout(function() {
window.location.href = "<?php echo base_url(); ?>Admin/subject_deleted";
// }, 3000);
}
}
});
}
</script>
<script type="text/javascript">
function deletedata(id, table){
$('#deleteModal').modal('hide');
$.ajax({
type : 'POST',
url : "<?php echo base_url(); ?>Admin/delete_data_permanent",
data : {id : id, table : table},
success:function(resposne){
if(resposne == '1'){
window.location.href = "<?php echo base_url(); ?>Admin/subject_deleted";
}
}
});
}
</script>