booking/managers_orders.php

208 lines
13 KiB
PHP
Executable File

<?php
require_once('fixed/config/go_con.php');
access(28);
?>
<!DOCTYPE html>
<html lang="en" dir="rtl">
<?php require_once('fixed/head/go.php'); ?>
<body class="rtl">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/@mdi/font@6.5.95/css/materialdesignicons.min.css">
<?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">
<!-- Container-fluid starts-->
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body new-user order-list">
<div class="table-responsive">
<table class="table table-bordered text-center" style="vertical-align: middle;">
<thead class="table-primary">
<tr>
<th scope="col">#</th>
<th scope="col">اسم العميل</th>
<th scope="col">جوال العميل</th>
<th scope="col">الحالة</th>
<th scope="col">اكمال الطلب</th>
<th scope="col">اجراءات</th>
</tr>
</thead>
<tbody>
<?php
$count = 1;
$get_book_cancel_sql = mysqli_query($db,
"SELECT
`tretment`.`name`,
`tretment`.`number`,
`tretment_has_free_service`.`done_id`,
`tretment_id`, `table_id`
FROM `tretment_has_free_service`
INNER JOIN `tretment` ON `tretment`.`id` = `tretment_has_free_service`.`tretment_id`
WHERE `tretment_has_free_service`.`done_id` = 5
AND `tretment_has_free_service`.`user_id` = $admin_id
AND `tretment_has_free_service`.`activation_id` = 2
AND `tretment_has_free_service`.`db_tables_id` = 14
GROUP BY `tretment_id`, `table_id`"
);
if (mysqli_num_rows($get_book_cancel_sql) > 0) {
while ($get_book_cancel = mysqli_fetch_assoc($get_book_cancel_sql)) {
?>
<tr>
<th scope="row"><?=$count?></th>
<td><?=$get_book_cancel['name']?></td>
<td><?=$get_book_cancel['number']?></td>
<td>انتظار</td>
<td>
<div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
<h4 class="mt-0 header-title">الكود</h4>
<div class="form-group row">
<div class="col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6">
<label for="" class="col-form-label text-right">ارسال الكود</label>
<div class="input-group">
<?php
$user_has_rolls_sql = mysqli_query($db, "SELECT `emplyee`.`id`, `emplyee`.`name`
FROM `user_has_rolls`
INNER JOIN `user` ON `user`.`id` = `user_has_rolls`.`user_id`
INNER JOIN `emplyee` ON `emplyee`.`id` = `user`.`emplyee_id`
WHERE `user_has_rolls`.`rolls_id` = 69
");
?>
<?php
$move = 0;
if (mysqli_num_rows($user_has_rolls_sql) > 0) {
while ($user_has_rolls_row = mysqli_fetch_assoc($user_has_rolls_sql)) {
if($move == 0) {
?>
<select id="user_to_<?=$get_book_cancel['table_id']?>" style="font-family: system-ui;" class="form-control">
<option value="0" selected>يرجى الاختيار</option>
<?php
}
?>
<option value="<?=$user_has_rolls_row['id']?>" data-free-id="<?=$get_book_cancel['table_id']?>"><?=$user_has_rolls_row['name']?></option>
<?php
$move++;
}
}
?>
</select>
<span style="padding:0;" class="input-group-text"><div class="btn btn-outline-primary" onclick="sendCode(<?=$get_book_cancel['table_id']?>)">ارسال</div></span>
</div>
</div>
<div class="col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6">
<div class="col-12">
<label for="free_code_<?=$get_book_cancel['table_id']?>" class="col-form-label text-right">الكود المجاني</label>
<input id="free_code_<?=$get_book_cancel['table_id']?>" class="form-control" type="number" value="">
</div>
</div>
<div class="col-lg-12">
<div class="form-control" style="background-color: #086367; color:white; text-align:center; cursor: pointer;margin-top: 10px;" onclick="add_free(<?=$get_book_cancel['table_id']?>)">إضافة</div>
</div>
</div>
</div>
</td>
<td>
<button type="button" id="order_cancel" onclick="order_cancel(<?=$get_book_cancel['table_id']?>)" class="btn btn-danger btn-sm">الغاء الطلب</button>
</td>
</tr>
<?php
}
} else {
?>
<tr>
<td colspan="5">لا يتوفر اي طلب</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="get_data"></div>
<?php require_once('fixed/footer/go.php'); ?>
</div>
</div>
<?php require_once('fixed/js/go.php'); ?>
<script>
click = 0;
click2 = 0;
click3 = 0;
function sendCode(x) {
let user_to = $("#user_to_"+x).val();
if (user_to == 0) {
swalfun('حدث خطأ', 'يرجى اختيار شخص ', 'error');
return false;
}
let free = $('#user_to_'+x).find(":selected").attr('data-free-id');
if (click == 0) {
click++;
$.post("work/order/ajax/send_free_s_code_ajax.php", {
user_to,
free
}, function(get_tretment) {
$("#get_data").html(get_tretment);
})
} else {
swalfun("يرجى الانتظار", "", "warning");
}
}
function add_free(id) {
if (id == 0) {
swalfun('SQ-2370', '', 'error');
return false;
}
free_code = $("#free_code_"+id).val();
if (click2 == 0) {
click2++;
$.post("work/order/ajax/active_free_s_immediately_ajax.php", {
id,
free_code
}, function(get_tretment) {
$("#get_data").html(get_tretment);
})
} else {
swalfun("يرجى الانتظار", "", "warning");
}
}
function order_cancel(id) {
if (id == 0) {
swalfun('SQ-2360R', '', 'error');
return false;
}
if (click3 == 0) {
click3++;
$.post("work/order/ajax/remove_free_order_ajax.php", {
id,
}, function(get_tretment) {
$("#get_data").html(get_tretment);
})
} else {
swalfun("يرجى الانتظار", "", "warning");
}
}
</script>
</body>
</html>