207 lines
8.9 KiB
PHP
207 lines
8.9 KiB
PHP
<?PHP
|
|
require_once "./db/config.php";
|
|
require_once "./includes/functions.php";
|
|
|
|
if (!isset($_SESSION["loggedAdmin"]) || empty($_SESSION["loggedAdmin"])) {
|
|
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
|
|
header("location: login.php?redirect_to=$actual_link");
|
|
}
|
|
$page = "category";
|
|
|
|
if (isset($_POST['addCategory'])) {
|
|
|
|
$name = sanitizeData($_POST['category_name']);
|
|
$status = (int)$_POST['status'];
|
|
|
|
if (isset($connection)) {
|
|
$insertCategory = $connection->query("INSERT INTO `category` (`name`, `status`) VALUES ('$name', $status)");
|
|
if ($insertCategory) {
|
|
showSweetAlert('success', 'Data Saved');
|
|
} else {
|
|
showSweetAlert('error', sanitizeData($connection->error));
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<title>Tech4Biz - Category Manage</title>
|
|
<?PHP include "./includes/links.php"; ?>
|
|
<style>
|
|
|
|
.flex-justify-column {
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<!-- loader starts-->
|
|
<?PHP include "./includes/loader.php"; ?>
|
|
<!-- loader ends-->
|
|
<!-- tap on top starts-->
|
|
<div class="tap-top"><i data-feather="chevrons-up"></i></div>
|
|
<!-- tap on tap ends-->
|
|
<!-- page-wrapper Start-->
|
|
<div class="page-wrapper compact-wrapper" id="pageWrapper">
|
|
<!-- Page Header Start-->
|
|
<?PHP include "./includes/header.php"; ?>
|
|
<!-- Page Header Ends -->
|
|
<!-- Page Body Start-->
|
|
<div class="page-body-wrapper">
|
|
<!-- Page Sidebar Start-->
|
|
<?PHP include "./includes/sidebar.php"; ?>
|
|
<!-- Page Sidebar Ends-->
|
|
<div class="page-body">
|
|
<div class="container-fluid">
|
|
<div class="page-title">
|
|
<div class="row">
|
|
<div class="col-6">
|
|
<h3>Chat App</h3>
|
|
</div>
|
|
<div class="col-6">
|
|
<ol class="breadcrumb">
|
|
<li class="breadcrumb-item"><a href="index-2.html" data-bs-original-title="" title="">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-home">
|
|
<path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path>
|
|
<polyline points="9 22 9 12 15 12 15 22"></polyline>
|
|
</svg>
|
|
</a></li>
|
|
<li class="breadcrumb-item">Chat</li>
|
|
<li class="breadcrumb-item active"> Chat App</li>
|
|
</ol>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Container-fluid starts-->
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col call-chat-sidebar col-sm-12">
|
|
<div class="card">
|
|
<div class="card-body chat-body">
|
|
<div class="chat-box">
|
|
<!-- Chat left side Start-->
|
|
<div class="chat-left-aside">
|
|
<div class="media">
|
|
<img class="rounded-circle user-image" src="assets/images/user/12.png" alt="Mark Jecno">
|
|
<div class="about">
|
|
<div class="name f-w-600">Mark Jecno</div>
|
|
<div class="status">Status...</div>
|
|
</div>
|
|
</div>
|
|
<div class="people-list" id="people-list">
|
|
<div class="search">
|
|
<form class="theme-form">
|
|
<div class="mb-3">
|
|
<input class="form-control" type="text" placeholder="Search" data-bs-original-title="" title=""><i class="fa fa-search"></i>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<style>
|
|
.user__active {
|
|
-webkit-transition: all 0.5s ease;
|
|
transition: all 0.5s ease;
|
|
position: relative;
|
|
margin-bottom: 2px;
|
|
border-radius: 10px;
|
|
padding: 5px;
|
|
background-color: #dad6ff;
|
|
}
|
|
</style>
|
|
<ul class="list">
|
|
|
|
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<!-- Chat left side Ends-->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col call-chat-body">
|
|
<div class="card">
|
|
<div class="card-body p-0">
|
|
<div class="row chat-box">
|
|
<!-- Chat right side start-->
|
|
<div class="col pe-0 chat-right-aside" id="chat__page">
|
|
<!-- chat start-->
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Container-fluid Ends-->
|
|
</div>
|
|
<!-- footer start-->
|
|
<?PHP include './includes/footer.php'; ?>
|
|
<!-- footer end-->
|
|
</div>
|
|
</div>
|
|
<?PHP include './includes/scripts.php'; ?>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js" integrity="sha512-qTXRIMyZIFb8iQcfjXWCO8+M5Tbc38Qi5WzdPOYZHIlZpzBHG3L3by84BBBOiRGiEb7KKtAOAs5qYdUiZiQNNQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
|
<!-- <script src="https://164.92.112.47:5005/socket.io/socket.io.js"></script> -->
|
|
<script src="http://localhost:5005/socket.io/socket.io.js"></script>
|
|
<script src="./assets/js/chat.js" type="text/javascript"></script>
|
|
<script>
|
|
$(document).ready(function () {
|
|
if ($("#basic-1").length > 0) {
|
|
$("#basic-1").dataTable();
|
|
}
|
|
|
|
|
|
$('.change__status').click(function () {
|
|
let id = parseInt($(this).attr('data-category'));
|
|
|
|
bootbox.confirm({
|
|
closeButton: false,
|
|
message: `Are You Sure Want To Change Category Status?`,
|
|
buttons: {
|
|
confirm: {
|
|
label: 'Yes',
|
|
className: 'btn-success'
|
|
},
|
|
cancel: {
|
|
label: 'No',
|
|
className: 'btn-danger'
|
|
}
|
|
},
|
|
callback: function (result) {
|
|
if (result === true) {
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: '../ajax.php',
|
|
data: {
|
|
category__change__status: 'category__change__status',
|
|
id: id,
|
|
},
|
|
success: function (data) {
|
|
if (data === 'TRUE') {
|
|
location.reload();
|
|
} else {
|
|
bootbox.alert({
|
|
closeButton: false,
|
|
message: "Can't handle this request now! Contact Administrator "
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|