booking/drinks_status.php

198 lines
7.7 KiB
PHP
Executable File

<?php
require_once('fixed/config/go_con.php');
access(61);
$branch_id = $_SESSION['branch'];
if(isset($_GET['m'])) {
$drink_id = $_GET['drink_id'];
switch($_GET['m']) {
case "enable":
mysqli_query($db, "INSERT INTO o_branch_has_drinks(branch_id, drink_id) VALUES($branch_id, $drink_id)");
echo "<script>window.location = 'drinks_status'</script>";
break;
case "disable":
mysqli_query($db, "DELETE FROM o_branch_has_drinks WHERE branch_id = $branch_id AND drink_id = $drink_id");
break;
}
}
?>
<!DOCTYPE html>
<html lang="en" dir="rtl">
<?php require_once('fixed/head/go.php'); ?>
<body class="rtl">
<?php require_once('fixed/loader/go.php'); ?>
<!-- page-wrapper Start-->
<div class="page-wrapper" id="pageWrapper">
<?php require_once('fixed/header/go.php'); ?>
<!-- Page Body Start-->
<div class="page-body-wrapper">
<?php require_once('fixed/sidebar/go.php'); ?>
<div class="page-body">
<div class="container-fluid">
<div class="page-header">
<div class="row">
<div class="col-12">
<style>
* {
margin: 0px;
padding: 0px;
}
a {
text-decoration: none;
}
.body_css {
background-color: #024347;
}
.order_r_container {
position: relative;
width: 100%;
margin: auto;
top: 30px;
background-color: #747c7c;
border-radius: 20px;
padding: 20px;
}
.orders_table {
margin: auto;
}
.orders_table td {
margin: auto;
color: black;
background-color: #D8D8D8;
text-align: center;
padding: 5px;
font-size: 22px;
font-weight: bold;
border: solid 3px #024347;
}
.orders_table th {
background-color: white;
color: black;
padding: 10px;
font-size: 18px;
border: solid 3px #024347;
text-align: center;
}
.th_submit {
width: 100%;
padding: 10px;
font-weight: bold;
border: none;
border-radius: 10px;
color: white;
cursor: pointer;
font-size: 20px;
background-color: #24695c;
}
.o_enable {
background-color: #1fcd1f;
padding: 5px;
border: none;
border-radius: 10px;
}
.o_disable {
background-color: red;
padding: 5px;
border: none;
border-radius: 10px;
}
</style>
<!-- sound -->
<audio controls id="multiaudio5" style="display: none">
<source src="../orders/order_sound.mp3" type="audio/mpeg">
</audio>
<p id="branch" style="display: none"><?php echo $_SESSION['branch']; ?></p>
<div class="order_r_container">
<table class="orders_table" dir="rtl">
<tr>
<td>اسم المشروب</td>
<td>حالة المشروب</td>
<td>تفعيل / الغاء</td>
</tr>
<tr id="res_div">
<?php
$query = mysqli_query($db, "SELECT
`o_drinks`.`drink_id`,
`o_drinks`.`drink_name`,
`branch_id`
FROM `o_drinks`
LEFT JOIN `o_branch_has_drinks` ON `o_drinks`.`drink_id` = `o_branch_has_drinks`.`drink_id` AND `o_branch_has_drinks`.`branch_id` = $branch_id
WHERE
`branch_id` = $branch_id
OR
`o_drinks`.`drink_id` NOT IN (SELECT
drink_id
FROM o_branch_has_drinks
WHERE branch_id = $branch_id)
ORDER BY drink_id
");
while($row = mysqli_fetch_assoc($query)) {
$drink_id = $row['drink_id'];
echo "<tr>";
if($row['branch_id'] == NULL) {
echo "<form method='POST' action='?m=enable&drink_id=$drink_id'>";
echo "<th>المشروب: " . $row['drink_name'] . "</th><th>الحالة: غير مفعل</th>";
echo "<th><input type='submit' class='o_enable' value='تفعيل'></th>";
echo "</form>";
} else {
echo "<form method='POST' action='?m=disable&drink_id=$drink_id'>";
echo "<th>المشروب: " . $row['drink_name'] . "</th><th>الحالة: مفعل</th>";
echo "<th><input type='submit' class='o_disable' value='إالغاء التفعيل'></th>";
echo "</form>";
}
echo "</tr>";
}
?>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<?php require_once('fixed/footer/go.php'); ?>
</div>
</div>
<?php require_once('fixed/js/go.php'); ?>
<!-- GTranslate: https://gtranslate.io/ -->
<div id="google_translate_element" class="form-group" style="display: none;">
</div>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
</body>
</html>