Server : LiteSpeed System : Linux in-mum-web1949.main-hosting.eu 5.14.0-503.40.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Mon May 5 06:06:04 EDT 2025 x86_64 User : u595547767 ( 595547767) PHP Version : 7.4.33 Disable Function : NONE Directory : /home/u595547767/domains/nilasevasamithi.com/public_html/admin/ |
<?php
include_once('connect.php');
session_start();
// Check if the user is logged in
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
echo "<script type='text/javascript'>window.location.href = 'index.php';</script>"; // Redirect to login page
exit();
}
include_once('head.php');
?>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script type="text/javascript" language="javascript" >
$(document).ready(function() {
var dataTable = $('#impact-grid').DataTable( {
"processing": true,
"serverSide": true,
"ajax":{
url :"view_data.php", // json datasource
type: "post", // method , by default get
data: {id: 'impact'},
error: function(){ // error handling
$(".impact-grid-error").html("");
$("#impact-grid").append('<tbody class="impact-grid-error"><tr><th colspan="3">No data found in the server</th></tr></tbody>');
$("#impact-grid_processing").css("display","none");
}
}
} );
} );
</script>
</head>
<main id="main" class="main">
<div class="pagetitle">
<nav>
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="index.html">Home</a></li>
<li class="breadcrumb-item active">View Impact</li>
</ol>
</nav>
</div><!-- End Page Title -->
<section class="section">
<div class="row">
<div class="col-lg-11">
<div class="card">
<div class="card-body">
<div class="row mb-3 bord-bottom" >
<div class="col-lg-5"><h5 class="card-title">View All Impacts</h5></div>
<div class="col-lg-5"><h5 class="card-title title-right"><a href="add_impact.php" class="btn btn-secondary">Add Impact</a></h5></div>
</div>
<div class="sb2-2-1">
<div class="inn-title pt-20 ">
<h4></h4>
<p></p>
</div >
<div class="bor ">
<table id="impact-grid" cellpadding="0" cellspacing="0" border="0" class="display" width="100%">
<thead>
<tr>
<th>Sl No.</th>
<th>Impact Count</th>
<th>Impact Content</th>
<th>Impact Image</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Delete Modal HTML -->
<div id="myModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<form>
<div class="modal-header">
<h4 class="modal-title">Delete Impact</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<input type="hidden" id="id_d" name="id" class="form-control">
<p>Are you sure you want to delete these Records?</p>
<p class="text-warning"><small>This action cannot be undone.</small></p>
</div>
<div class="modal-footer">
<input type="hidden" value="delimpact" name="type">
<input type="button" class="btn btn-default" data-dismiss="modal" value="Cancel">
<button type="button" class="btn btn-danger" id="delete" name="delete">Delete</button>
</div>
</form>
</div>
</div>
</div>
<!--delete modal ends-->
</main><!-- End #main -->
<?php
include_once('footer.php');
?>
<!-- Ajax-->
<script type="text/javascript">
$(document).on("click", ".delete", function() {
var id=$(this).attr("data-id");
$('#id_d').val(id);
});
$("#delete").click(function() {
$.ajax({
url: "delete_data.php",
type: "POST",
cache: false,
data:{
type:'delimpact',
id: $("#id_d").val()
},
success: function(dataResult){
alert("Impact deleted");
$("#"+dataResult).remove();
location.reload();
}
});
});
$("#file").change(function() {
var file = this.files[0];
var fileType = file.type;
var match = ['application/pdf', 'application/msword', 'application/vnd.ms-office', 'image/jpeg', 'image/png', 'image/jpg'];
if(!((fileType == match[0]) || (fileType == match[1]) || (fileType == match[2]) || (fileType == match[3]) || (fileType == match[4]) || (fileType == match[5]))){
alert('Sorry, only PDF, DOC, JPG, JPEG, & PNG files are allowed to upload.');
$("#file").val('');
return false;
}
});
</script>
<script type="text/javascript">
function goBack() {
window.history.back();
}
</script>