booking/royality_tretment.php

194 lines
10 KiB
PHP
Executable File

<?php
require_once('fixed/config/go_con.php');
//access(76);
?>
<!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">
<style>
a.active {
background-color: #e6edef;
}
h1 {
background: #24695c;
padding-right: 10px;
color: white;
margin-left: 10px;
font-weight: bold;
}
</style>
<?php require_once('fixed/loader/go.php'); ?>
<div class="page-wrapper" id="pageWrapper">
<?php require_once('fixed/header/go.php'); ?>
<div class="page-body-wrapper">
<?php require_once('fixed/sidebar/go.php'); ?>
<div class="page-body">
<div class="container-fluid">
<div class="email-wrap bookmark-wrap">
<div class="row">
<div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
<div class="card">
<div class="tab-content" id="profile-tabContent">
<div class="tab-pane fade show active" id="all">
<div class="card-body new-user order-list text-center">
<div class="row">
<div class="col-12 col-sm-12 col-md-3 col-lg-4 col-xl-4">
</div>
<div class="page-title mb-3 col-12 col-sm-12 col-md-6 col-lg-4 col-xl-4">
<i class="mdi mdi-monitor mr-2">
</i>
<h4>
الماسيين المستحقين
<br/>
</h4>
</div>
<div class="col-12 col-sm-12 col-md-3 col-lg-4 col-xl-4">
</div>
</div>
</div>
<div class="tab-content">
<div class="tab-pane p-3 active" id="tab<?=$tabs?>" role="tabpanel">
<div class="card-body new-user order-list">
<div class="table-responsive">
<table id="employee_data" class="table table-bordered text-center" style="vertical-align: middle;">
<thead class="table-primary" style="vertical-align: middle;">
<tr>
<th scope="col">#</th>
<th scope="col">اسم العميل</th>
<th scope="col">رقم العميل</th>
<th scope="col">اجراءات</th>
</tr>
</thead>
<tbody>
<?php
$total = 0;
$get_book_details_sql = mysqli_query($db,
"SELECT
`tretment`.`id`,
`tretment`.`name`,
`tretment`.`number`,
(SELECT `tretment_has_free_3_serv_coupon`.`status` FROM `tretment_has_free_3_serv_coupon` WHERE `tretment_has_free_3_serv_coupon`.`tretment_id` = `tretment`.`id` ORDER BY `tretment_has_free_3_serv_coupon`.`id` DESC LIMIT 1) AS `status`,
SUM((`services`.`price`)+((`services`.`price`*15)/100)) AS `total_pays`,
COUNT(`book_id`) AS `total_pay_books`
FROM `tretment`
LEFT JOIN `book` ON `book`.`tretment_id` = `tretment`.`id`
LEFT JOIN `book_details` AS `dd` ON `book`.`id` = `dd`.`book_id`
LEFT JOIN `services` ON `dd`.`services_id` = `services`.`id`
WHERE `tretment`.`id` IN (SELECT `tretment_id` FROM `total_points` WHERE `point` > 5000)
AND `dd`.`id` IN (SELECT MAX(`book_details`.`id`) FROM `book_details` WHERE `book_id` = `dd`.`book_id` GROUP BY `book_details`.`book_id`)
AND `dd`.`status_id` IN (6,8,12,13,14)
GROUP BY `tretment`.`id`
HAVING `total_pay_books` > 5 AND `total_pays` > 5000
ORDER BY `status` ASC, `tretment`.`date_time` ASC
-- LIMIT 15
");
$count = 1;
while ($get_book_details = mysqli_fetch_assoc($get_book_details_sql)) {
?>
<tr style="<?php switch ($get_book_details['status']) {
case '1':
echo 'background: #09f509;';
break;
case '2':
echo 'background: #fdfd58;';
break;
case '3':
echo 'background: #ff5252;';
break;
}?>">
<th scope="row"><?=$count?></th>
<td><?=$get_book_details['name']?></td>
<td><?=$get_book_details['number']?></td>
<td>
<?php
switch ($get_book_details['status']) {
case '1':
?>
تم ارسال الكود
<?php
break;
case '2':
?>
<div class="btn btn-primary" onclick="sendCode(<?=$get_book_details['id']?>,1)">ارسال</div>
<div class="btn btn-warning" onclick="sendCode(<?=$get_book_details['id']?>,2)">لم يرد</div>
<div class="btn btn-danger" onclick="sendCode(<?=$get_book_details['id']?>,3)">مغلق</div>
<?php
break;
case '3':
?>
<?php
if ($admin_id == 27 || $admin_id == 143 || $admin_id == 1) {
?>
<div class="btn btn-primary" onclick="sendCode(<?=$get_book_details['id']?>,4)">فتح</div>
<?php
} else {
echo 'مغلق';
}
?>
<?php
break;
default:
?>
<div class="btn btn-primary" onclick="sendCode(<?=$get_book_details['id']?>,1)">ارسال</div>
<div class="btn btn-warning" onclick="sendCode(<?=$get_book_details['id']?>,2)">لم يرد</div>
<div class="btn btn-danger" onclick="sendCode(<?=$get_book_details['id']?>,3)">مغلق</div>
<?php
break;
}
?>
</td>
</tr>
<?php
$count++;
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</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;
function sendCode(x,status) {
user_to = x;
status = status;
if (user_to == 0) {
swalfun('حدث خطأ', '', 'error');
return false;
}
if (click == 0) {
click++;
$.post("work/order/ajax/send_3_serv_free_code_ajax.php", {
user_to,
status
}, function(get_tretment) {
$("#get_data").html(get_tretment);
})
} else {
swalfun("يرجى الانتظار", "", "warning");
}
}
</script>
</body>
</html>