1424 lines
127 KiB
PHP
Executable File

<?php
require_once('fixed/config/go_con.php');
$today = date("Y-m-d");
if (!empty($_GET['date'])) {
$today = $_GET['date'];
if (DateTime::createFromFormat('Y-m-d', $today) == false) {
$today = date("Y-m-d");
}
}
$branch_id = $_SESSION['branch'];
if (!empty($_GET['branch'])) {
$branch_id = $_GET['branch'];
if (!is_numeric($branch_id)) {
$branch_id = $_SESSION['branch'];
} else {
if ($branch_id == 1) {
$branch_id = $_SESSION['branch'];
}
}
}
switch ($branch_id) {
case 2:
access(1);
//echo "<style>#branch_15_button { background-color: #c2df35 !important; color: black; }</style>";
break;
case 3:
access(2);
//echo "<style>#branch_7_button { background-color: #c2df35 !important; color: black; }</style>";
break;
case 4:
access(3);
//echo "<style>#branch_29_button { background-color: #c2df35 !important; color: black; }</style>";
break;
case 5:
access(4);
break;
}
$branch_sql = '`branch_id`='.$branch_id;
if ($branch_id == 1) {
$branch_sql = '`branch_id`<>'.$branch_id;
}
// work time
$commercial_register_sql = mysqli_query($db, "SELECT `commercial_register`.`start_work`, `commercial_register`.`start_work_fri`, `commercial_register`.`end_work`
FROM `branch`
LEFT JOIN `commercial_register` ON `branch`.`commercial_register_id` = `commercial_register`.`id`
WHERE `branch`.`id` = $branch_id"
);
$commercial_register = mysqli_fetch_assoc($commercial_register_sql);
$Next = date('Y-m-d', strtotime('+1 day', strtotime($today)));
$Previous = date('Y-m-d', strtotime('-1 day', strtotime($today)));
$Day = date('D', strtotime($today));
$Day_s = date('d', strtotime($today));
function Day_ar()
{
global $Day;
$find = array("Sat", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri");
$replace = array("السبت", "الأحد", "الإثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة");
$ar_day_format = $Day;
$Day_ar = str_replace($find, $replace, $ar_day_format);
return $Day_ar;
}
function Today_ar()
{
global $today;
$Today_ar = date('d-m-Y', strtotime($today));
return $Today_ar;
}
$tabs = $_SESSION['tab'];
if (empty($tabs)) {
$tabs = 1;
}
$not_eq = "=";
if ($tabs == 1) {
$not_eq = "<>";
}
$start_today_time_static = $commercial_register['start_work'];
if ($Day == "Fri") {
$start_today_time_static = $commercial_register['start_work_fri'];
}
$end_today_time_static = $commercial_register['end_work'];
$archives = false;
if (strtotime($today) <= strtotime(date('Y-m-d', strtotime('-1 month', strtotime(date('Y-m-d')))))) {
$archives = true;
}
if (strtotime($today) <= strtotime(date('2022-09-30'))) {
$archives = true;
}
?>
<!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'); ?>
<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="row">
<style>
.mo-home-table {
box-shadow: 3px 3px 3px 3px rgba(0, 0, 0, 0.1);
}
.mo-home-table thead th { position: sticky; top: 0; background: #f0f3f5; border:#dadada solid 1px !important;}
.mo-home-table td { border:#dadada solid 1px; min-width: 125px !important; overflow: hidden; height: 150px !important; padding: 0px !important; }
/*
width: 6.25% !important;
height: 85px !important;
padding: 5px !important;
*/
td:hover .before { display: none;}
td:hover .after { display: block; }
.modal-header h5 { font-weight: bold;}
.modal-body table { border:#eff2f4 solid 1px; width: 100%;}
span.mdi {
cursor: pointer;
}
/* for buttons */
.frame-1 button {
outline: none;
}
.frame-1 .custom-btn {
height: 40px;
padding: 10px 25px;
border: 2px solid #000;
font-family: 'Lato', sans-serif;
font-weight: 500;
background: transparent;
cursor: pointer;
transition: all 0.3s ease;
position: relative;
display: inline-block;
}
/* 7 */
.frame-1 .btn-7 {
background: #afec08;
font-weight: bold;
color: #000;
line-height: 42px;
padding: 0;
border: none;
z-index: 1;
-webkit-transition: all 0.3s linear;
transition: all 0.3s linear;
}
.frame-1 .btn-8 {
background: #000 !important;
}
.frame-1 .btn-7:hover {
background: transparent;
color: #afec08;
}
.frame-1 .btn-8:hover {
color: #f93b7a !important;
}
.frame-1 .btn-7:before,
.frame-1 .btn-7:after {
position: absolute;
content: "";
left: 0;
width: 100%;
height: 50%;
right: 0;
z-index: -1;
background: #afec08;
transition: all 0.3s ease;
}
.frame-1 .btn-8:before,
.frame-1 .btn-8:after {
background: #f93b7a !important;
}
.frame-1 .btn-7:before {
top: 0;
}
.frame-1 .btn-7:after {
bottom: 0;
}
.frame-1 .btn-7:hover:before,
.frame-1 .btn-7:hover:after {
height: 0;
background-color: #afec08;
}
.frame-1 .btn-8:hover:before,
.frame-1 .btn-8:hover:after {
background-color: #f93b7a !important;
}
</style>
<div class="col-12">
<div class="card">
<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">
<a href="book.php">
<img src="../assets/images/cp/01.png" style="width: 100%;">
</a>
</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>
حجوزات يوم
<?= Day_ar() ?>
<br />
<?= Today_ar() ?>
</h4>
</div>
<div class="col-12 col-sm-12 col-md-3 col-lg-4 col-xl-4">
<?php
if ($commercial_register_id == 2) {
?>
<a href="book.php?branch=2&date=<?=$today?>">
<button class="btn btn-primary" id="branch_15_button" type="button">15</button>
</a>
<a href="book.php?branch=3&date=<?=$today?>">
<button class="btn btn-primary" id="branch_7_button" type="button">7</button>
</a>
<a href="book.php?branch=4&date=<?=$today?>">
<button class="btn btn-primary" id="branch_29_button" type="button">29</button>
</a>
<a href="book.php?branch=6&date=<?=$today?>">
<button class="btn btn-primary" id="branch_hh_button" type="button">خ.مشيط</button>
</a>
<?php
}
?>
</div>
</div>
<div class="row">
<div class="col-12 col-sm-12 col-md-2 col-lg-3 col-xl-3">
</div>
<div class="col-2 col-sm-2 col-md-1 col-lg-1 col-xl-1">
<a class="btn btn-danger btn-round waves-effect waves-light col-12" href="book.php?date=<?= $Previous ?>&branch=<?= $branch_id ?>" style="padding: 0.375rem 0.75rem;">-</a>
</div>
<div class="col-8 col-sm-8 col-md-6 col-lg-4 col-xl-4">
<input id="Select-date" class="form-control" type="date" value="" style="text-align: center !important;">
</div>
<div class="col-2 col-sm-2 col-md-1 col-lg-1 col-xl-1">
<a class="btn btn-primary btn-round waves-effect waves-light col-12" href="book.php?date=<?= $Next ?>&branch=<?= $branch_id ?>" style="padding: 0.375rem 0.75rem;">+</a>
</div>
<div class="col-12 col-sm-12 col-md-2 col-lg-3 col-xl-3">
</div>
</div>
</div>
<?php
$type_of_services_sql = mysqli_query($db, "SELECT `id`, `name`
FROM `type_of_services`
WHERE `show_in_table_id` = 2 AND `activation_id` = 2"
);
if (mysqli_num_rows($type_of_services_sql) > 0) {
?>
<div class="card-body" style="padding: 0 30px;">
<ul class="nav nav-pills nav-justified" role="tablist">
<?php
if (mysqli_num_rows($type_of_services_sql) > 1) {
?>
<li class="nav-item waves-effect waves-light">
<a class="nav-link <?php if($tabs == 1 ) {echo "active";} ?>" data-toggle="tab" onclick="window.location='work/order/php/tabs.php?num=1'" role="tab" aria-selected="true">الكل</a>
</li>
<?php
}
?>
<?php
while ($type_of_services = mysqli_fetch_assoc($type_of_services_sql)) {
?>
<li class="nav-item waves-effect waves-light">
<a class="nav-link <?php if($tabs == $type_of_services['id'] ) {echo "active";} ?>" data-toggle="tab" onclick="window.location='work/order/php/tabs.php?num=<?=$type_of_services['id']?>'" role="tab" aria-selected="false"><?=$type_of_services['name']?></a>
</li>
<?php
}
?>
</ul>
</div>
<?php
}
?>
<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" style="zoom:0.<?=$table_size?>;">
<table style="width: 0 !important; margin: 0 auto !important;" class="table table-hover mb-3 text-center mo-home-table">
<thead class="thead-light">
<tr>
<th></th>
<?php
$start_today_time = $start_today_time_static;
$end_today_time = $end_today_time_static;
for ($start_today_time; $start_today_time <= $end_today_time; $start_today_time++) {
$restart_temp = $start_today_time;
if ($start_today_time > 23) {
$restart_temp = $start_today_time - 24;
}
if ($restart_temp < 10) {
$start_today_time_temp = "0" . $restart_temp . ":00:00";
} else {
$start_today_time_temp = $restart_temp . ":00:00";
}
$today_temp = $today;
if ($start_today_time > 23) {
$today_temp = $Next;
}
?>
<th><?=date((date("H", strtotime($start_today_time_temp)) > 11) ? 'h:i \م' : 'h:i \ص', strtotime($start_today_time_temp))?><a href="work/php/one_clock_close.php?date=<?=$today_temp?>&time=<?=$start_today_time_temp?>&branch=<?=$branch_id?>"> <span style="float: right;font-size: 15px;height: 100%;" class="mdi mdi-close-outline"></span></a></th>
<?php
}
?>
</tr>
</thead>
<tbody>
<?php
$booking_state_1 = array();
$tretment_details_state = array();
$pray_time = array('12:00:00','15:00:00');
// العمالة
$get_emplyee_sql = mysqli_query($db, "SELECT
`emplyee`.`id`,
`emplyee`.`name`,
`holi_days`.`day`,
`emplyee`.`branch_id`
FROM `occupation`
LEFT JOIN `emplyee` ON `emplyee`.`occupation_id` = `occupation`.`id`
LEFT JOIN `branch` ON `emplyee`.`branch_id` = `branch`.`id`
LEFT JOIN `holi_days` ON `emplyee`.`holi_days_id` = `holi_days`.`id`
LEFT JOIN `table_postion` ON `emplyee`.`id` = `table_postion`.`emplyee_id`
WHERE `occupation`.`show_in_table_id` = 2
AND `emplyee`.$branch_sql
AND `occupation`.`type_of_services_id` $not_eq $tabs
AND `emplyee`.`activation_id` = 2
AND `branch`.`commercial_register_id` = $commercial_register_id
ORDER BY -`table_postion`.`postion` DESC, `emplyee`.`id` ASC
");
while ($get_emplyee = mysqli_fetch_assoc($get_emplyee_sql)) {
$start_today_time = $start_today_time_static;
$end_today_time = $end_today_time_static;
$start_today_time_sql = $start_today_time . ":00:00";
$end_today_time_sql = $end_today_time . ":59:59";
$emp_id = $get_emplyee['id'];
$emp_neme = $get_emplyee['name'];
?>
<tr>
<td class="sorting_1" style ="padding: 15px !important;">
<div style="height:120px; overflow:revert">
<img class="rounded-circle" src="uploads/emplyee/user/1.png" alt="user" data-bs-toggle="modal" data-animation="bounce" data-bs-target=".emp_<?=$get_emplyee['id']?>" style="width: 90px !important;height: 90px !important;">
<div style="margin-top: 10px;">
<?= $get_emplyee['name'] ?>
</div>
</div>
</td>
<?php
$get_emplyee_time_work = mysqli_query($db, "SELECT TIME(`work_time_table`.`from_date_time`) AS fromTime,TIME(`work_time_table`.`to_date_time`) AS toTime FROM `work_time_table`
WHERE `work_time_table`.`emplyee_id` = $emp_id AND `work_time_table`.`to_date_time` > '$today' AND `work_time_table`.`from_date_time` < '$Next' AND `work_time_table`.`activation_id` = 2");
$time_work = array();
while ($get_time_work = mysqli_fetch_assoc($get_emplyee_time_work)) {
$from = $get_time_work['fromTime'][0] . $get_time_work['fromTime'][1];
$to = $get_time_work['toTime'][0] . $get_time_work['toTime'][1];
for ($from; $from <= $to; $from++) {
$push_time_work = $from . ":00:00";
array_push($time_work, $push_time_work);
}
}
if ($archives) {
include('work/files/book/archives.php');
} else {
$get_tretment_details_sql_state = mysqli_query($db,
"SELECT
`bd`.`day_date`,
`bd`.`day_time`,
`bd`.`branch_id`,
`bd`.`emplyee_id`,
`bd`.`status_id`,
`bd`.`date_time`,
`bd`.`book_id` AS `book_id`,
`bd`.`name`,
`bd`.`tretment_id`,
`bd`.`notes`,
`bd`.`user_date` AS `user_date`,
`bd`.`user_book`,
`bd`.`tr_name`,
`bd`.`number`
FROM `book_temp` AS `bd`
WHERE `bd`.`day_date`='$today'
AND (`bd`.`day_time` >= '$start_today_time_sql' AND `bd`.`day_time` <= '$end_today_time_sql')
AND `bd`.`emplyee_id`='$emp_id'
AND `bd`.$branch_sql
AND `bd`.`status_id` NOT IN (25,26)
GROUP BY `bd`.`day_time`
ORDER BY `bd`.`day_time`, `bd`.`date_time`
");
}
$tretment_details_state_temp = array();
while ($get_tretment_details_state = mysqli_fetch_assoc($get_tretment_details_sql_state)) {
array_push($tretment_details_state, $get_tretment_details_state);
array_push($tretment_details_state_temp, $get_tretment_details_state);
}
$get_table_sql_state = mysqli_query($db,
"SELECT
`user`.`id`,
`user`.`name`,
`table`.`day_date`,
`table`.`day_time`,
`table`.`notes`,
`table`.`branch_id`,
`table`.`emplyee_id`,
`table`.`status_id`,
`table`.`date_time` AS `time`
FROM `table`
LEFT JOIN `user` ON `user`.`id` = `table`.`user_id`
WHERE `table`.`day_date` = '$today'
AND (`table`.`day_time` >= '$start_today_time_sql' AND `table`.`day_time` <= '$end_today_time_sql')
AND `table`.$branch_sql AND `table`.`emplyee_id` = '$emp_id'
AND `table`.`id` IN (SELECT MAX(`tb`.`id`) FROM `table` AS `tb` WHERE `tb`.`day_date` = '$today'
AND `tb`.`emplyee_id` = '$emp_id' GROUP BY `tb`.`day_time`)
ORDER BY `table`.`day_time` ASC"
);
$open_close_temp = array();
while ($get_table_state = mysqli_fetch_assoc($get_table_sql_state)) {
array_push($open_close_temp, $get_table_state);
}
if ($end_today_time > 23) { // greter than 24 hour
$end_today_time_sql = "23:59:59";
$how_many_left = ($end_today_time - 23) - 1 . ":59:59";
if ($archives) {
include('work/files/book/archives_above_23.php');
} else {
$get_tretment_details_sql_state2 = mysqli_query($db,
"SELECT
`bd`.`day_date`,
`bd`.`day_time`,
`bd`.`branch_id`,
`bd`.`emplyee_id`,
`bd`.`status_id`,
`bd`.`date_time`,
`bd`.`book_id` AS `book_id`,
`bd`.`name`,
`bd`.`tretment_id`,
`bd`.`notes`,
`bd`.`user_date`,
`bd`.`user_book`,
`bd`.`tr_name`,
`bd`.`number`
FROM `book_temp` AS `bd`
WHERE `bd`.`day_date` = '$Next'
AND `bd`.`day_time` <= '$how_many_left'
AND `bd`.`emplyee_id`='$emp_id'
AND `bd`.$branch_sql
AND `bd`.`status_id` NOT IN (25,26)
GROUP BY `bd`.`day_time`
ORDER BY `bd`.`day_time`, `bd`.`date_time`
");
}
while ($get_tretment_details_state2 = mysqli_fetch_assoc($get_tretment_details_sql_state2)) {
array_push($tretment_details_state, $get_tretment_details_state2);
array_push($tretment_details_state_temp, $get_tretment_details_state2);
}
$get_table_sql_state2 = mysqli_query($db,
"SELECT
`user`.`id`,
`user`.`name`,
`table`.`day_date`,
`table`.`day_time`,
`table`.`notes`,
`table`.`branch_id`,
`table`.`emplyee_id`,
`table`.`status_id`,
`table`.`date_time` AS `time`
FROM `table`
LEFT JOIN `user` ON `user`.`id` = `table`.`user_id`
WHERE `table`.`day_date` = '$Next'
AND `table`.`day_time` <= '$how_many_left'
AND `table`.$branch_sql
AND `table`.`emplyee_id` = '$emp_id'
AND `table`.`id` IN (SELECT MAX(`tb`.`id`) FROM `table` AS `tb` WHERE `tb`.`day_date` = '$Next'
AND `tb`.`emplyee_id` = '$emp_id' GROUP BY `tb`.`day_time`)
ORDER BY `table`.`day_time` ASC"
);
while ($get_table_state2 = mysqli_fetch_assoc($get_table_sql_state2)) {
array_push($open_close_temp, $get_table_state2);
}
}
$branch_id = $get_emplyee['branch_id'];
$open_close_count= 0;
$temp_count = 0;
for ($start_today_time; $start_today_time <= $end_today_time; $start_today_time++) {
$restart_temp = $start_today_time;
if ($start_today_time > 23) {
$restart_temp = $start_today_time - 24;
}
if ($restart_temp < 10) {
$start_today_time_temp = "0" . $restart_temp . ":00:00";
} else {
$start_today_time_temp = $restart_temp . ":00:00";
}
$today_temp = $today;
if ($start_today_time > 23) {
$today_temp = $Next;
}
if (($tretment_details_state_temp[$temp_count]['day_time']) == ($start_today_time_temp) && $tretment_details_state_temp[$temp_count]['emplyee_id'] == $emp_id) {
switch ($tretment_details_state_temp[$temp_count]['status_id']) {
case 4: case 5:
// انتظار
?>
<td class="bg-gradient3">
<div style="display: flex !important; flex-direction: column;">
<div style="height: 25px;">
<a style="color: white !important" href="edit_booking.php?booking_id=<?= $tretment_details_state_temp[$temp_count]['book_id'] ?>">
<span style="float: left;background: green;padding: 2px;width: 21px;height: 100%;" class="mdi mdi-book-edit"></span>
</a>
<a style="color: white !important" target="_blank" href="tel:+966<?= $tretment_details_state_temp[$temp_count]['number'] ?>">
<span style="float: left;background: blue;padding: 2px;width: 21px;height: 100%;" class="mdi mdi-phone"></span>
</a>
<a style="color: white !important" target="_blank" href="https://api.whatsapp.com/send/?phone=966<?= $tretment_details_state_temp[$temp_count]['number'] ?>&text=">
<span style="float: left;background: gray;padding: 2px;width: 21px;height: 100%;" class="mdi mdi-whatsapp"></span>
</a>
<a style="color: black !important" href="active.php?booking_id=<?= $tretment_details_state_temp[$temp_count]['book_id']?>">
<span style="float: right;background: #fff700;padding: 2px;width: 21px;height: 100%;" class="mdi mdi-arrow-top-right"></span>
</a>
<a class="booking-cancel" style="color: white !important" href="work/order/php/cancel?booking_id=<?= $tretment_details_state_temp[$temp_count]['book_id']?>&lo=book">
<span style="float: right;background: red;padding: 2px;width: 21px;height: 100%;" class="mdi mdi-close"></span>
</a>
</div>
<div title="حجز بواسطة <?= $tretment_details_state_temp[$temp_count]['user_book'] ?>" data-bs-toggle="modal" data-animation="bounce" data-bs-target="#booking_<?= $tretment_details_state_temp[$temp_count]['book_id'] ?>"
style="color:black; min-height: 100px; display: flex; justify-content: center; align-items: center; flex-direction: column; border-bottom: 3px solid black;">
<div style="white-space: nowrap;">
<div><?= $tretment_details_state_temp[$temp_count]['tr_name'] ?></div>
</div>
<div style="white-space: nowrap;">
<div><?= $tretment_details_state_temp[$temp_count]['name'] ?></div>
</div>
</div>
<div style="color:black;height:30px;background:#c1c1c1;font-weight:bold;font-size:17px;cursor:pointer;" onclick="window.location='booking_detail.php?number=<?= $tretment_details_state_temp[$temp_count]['number'] ?>';">
<?= $tretment_details_state_temp[$temp_count]['number'] ?>
</div>
</div>
</td>
<?php
break;
case 6: case 7:
$for_pay_id = $tretment_details_state_temp[$temp_count]['book_id'];
$pay_sql = mysqli_query($db, "SELECT `user`.`name`, `user`.`id`, `invoices_has_book`.`date_time`
FROM `invoices_has_book`
LEFT JOIN `user` ON `user`.`id` = `invoices_has_book`.`user_id`
WHERE `book_id` = $for_pay_id
LIMIT 1");
$get_pay = mysqli_fetch_assoc($pay_sql);
?>
<td class="bg-gradient4">
<div style="display: flex !important; flex-direction: column;">
<div style="height: 25px;">
<a style="color: white !important" href="edit_booking.php?booking_id=<?= $tretment_details_state_temp[$temp_count]['book_id'] ?>">
<span style="float: left;background: green;padding: 2px;width: 21px;height: 100%;" class="mdi mdi-book-edit"></span>
</a>
<a style="color: white !important" target="_blank" href="tel:+966<?= $tretment_details_state_temp[$temp_count]['number'] ?>">
<span style="float: left;background: blue;padding: 2px;width: 21px;height: 100%;" class="mdi mdi-phone"></span>
</a>
<a style="color: white !important" target="_blank" href="https://api.whatsapp.com/send/?phone=966<?= $tretment_details_state_temp[$temp_count]['number'] ?>&text=">
<span style="float: left;background: gray;padding: 2px;width: 21px;height: 100%;" class="mdi mdi-whatsapp"></span>
</a>
<a style="color: black !important" href="print.php?book_id=<?= $tretment_details_state_temp[$temp_count]['book_id'] ?>&p=1">
<span style="float: right;background: white;padding: 2px;width: 21px;height: 100%;" class="mdi mdi-printer"></span>
</a>
<?php
if ($get_pay['id'] == $admin_id) {
?>
<a class="booking-cancel-active" style="color: white !important" href="work/order/php/cancel_active?booking_id=<?= $tretment_details_state_temp[$temp_count]['book_id']?>&lo=book">
<span style="float: right;background: red;padding: 2px;width: 21px;height: 100%;" class="mdi mdi-close active-cancel"></span>
</a>
<?php
}
?>
</div>
<div title="حجز بواسطة <?= $tretment_details_state_temp[$temp_count]['user_book'] ?> دفع بواسطة <?=$get_pay['name']?>" data-bs-toggle="modal" data-animation="bounce" data-bs-target="#booking_<?= $tretment_details_state_temp[$temp_count]['book_id'] ?>"
style="color:black; min-height: 100px; display: flex; justify-content: center; align-items: center; flex-direction: column; border-bottom: 3px solid black;">
<div style="white-space: nowrap;">
<div><?= $tretment_details_state_temp[$temp_count]['tr_name'] ?></div>
</div>
<div style="white-space: nowrap;">
<div><?= $tretment_details_state_temp[$temp_count]['name'] ?></div>
</div>
</div>
<div style="color:black;height:30px;background:#c1c1c1;font-weight:bold;font-size:17px;cursor:pointer;" onclick="window.open('booking_detail.php?number=<?= $tretment_details_state_temp[$temp_count]['number'] ?>', '_blank')">
<?= $tretment_details_state_temp[$temp_count]['number'] ?>
</div>
</div>
</td>
<?php
break;
case 8: case 9:
?>
<td class="bg-gradient1">
<div style="display: flex !important; flex-direction: column;">
<div style="height: 25px;">
<a style="color: white !important" href="edit_booking.php?booking_id=<?= $tretment_details_state_temp[$temp_count]['book_id'] ?>">
<span style="float: left;background: green;padding: 2px;width: 21px;height: 100%;" class="mdi mdi-book-edit"></span>
</a>
<a style="color: white !important" target="_blank" href="tel:+966<?= $tretment_details_state_temp[$temp_count]['number'] ?>">
<span style="float: left;background: blue;padding: 2px;width: 21px;height: 100%;" class="mdi mdi-phone"></span>
</a>
<a style="color: white !important" target="_blank" href="https://api.whatsapp.com/send/?phone=966<?= $tretment_details_state_temp[$temp_count]['number'] ?>&text=">
<span style="float: left;background: gray;padding: 2px;width: 21px;height: 100%;" class="mdi mdi-whatsapp"></span>
</a>
<a style="color: black !important" href="print.php?booking_id=<?= $tretment_details_state_temp[$temp_count]['book_id'] ?>&free=1">
<span style="float: right;background: white;padding: 2px;width: 21px;height: 100%;" class="mdi mdi-printer"></span>
</a>
<a class="booking-cancel-active" style="color: white !important" href="work/order/php/cancel_active435?booking_id=<?= $tretment_details_state_temp[$temp_count]['book_id']?>&lo=book">
<span style="float: right;background: red;padding: 2px;width: 21px;height: 100%;" class="mdi mdi-close active-cancel"></span>
</a>
</div>
<div title="حجز بواسطة <?= $tretment_details_state_temp[$temp_count]['user_book'] ?>" data-bs-toggle="modal" data-animation="bounce" data-bs-target="#booking_<?= $tretment_details_state_temp[$temp_count]['book_id'] ?>"
style="color:black; min-height: 100px; display: flex; justify-content: center; align-items: center; flex-direction: column; border-bottom: 3px solid black;">
<div style="white-space: nowrap;">
<div><?= $tretment_details_state_temp[$temp_count]['tr_name'] ?></div>
</div>
<div style="white-space: nowrap;">
<div><?= $tretment_details_state_temp[$temp_count]['name'] ?></div>
</div>
</div>
<div style="color:black;height:30px;background:#c1c1c1;font-weight:bold;font-size:17px;cursor:pointer;" onclick="window.location='booking_detail.php?number=<?= $tretment_details_state_temp[$temp_count]['number'] ?>';">
<?= $tretment_details_state_temp[$temp_count]['number'] ?>
</div>
</div>
</td>
<?php
break;
case 10:
?>
<td class="bg-gradient10">
<div style="display: flex !important; flex-direction: column;">
<div style="height: 25px;">
</div>
<div title="حجز بواسطة <?= $tretment_details_state_temp[$temp_count]['user_book'] ?>" data-bs-toggle="modal" data-animation="bounce" data-bs-target="#booking_<?= $tretment_details_state_temp[$temp_count]['book_id'] ?>"
style="color:black; min-height: 100px; display: flex; justify-content: center; align-items: center; flex-direction: column; border-bottom: 3px solid black;">
<div style="white-space: nowrap;">
<div><?= $tretment_details_state_temp[$temp_count]['tr_name'] ?></div>
</div>
<div style="white-space: nowrap;">
<div><?= $tretment_details_state_temp[$temp_count]['name'] ?></div>
</div>
</div>
<div style="color:black;height:30px;background:#c1c1c1;font-weight:bold;font-size:17px;cursor:pointer;" onclick="window.location='booking_detail.php?number=<?= $tretment_details_state_temp[$temp_count]['number'] ?>';">
<?= $tretment_details_state_temp[$temp_count]['number'] ?>
</div>
</div>
</td>
<?php
break;
case 11:
?>
<?php
break;
case 12:
$for_pay_id = $tretment_details_state_temp[$temp_count]['book_id'];
$pay_sql = mysqli_query($db, "SELECT `user`.`name`, `user`.`id`, `invoices_has_book`.`date_time`
FROM `invoices_has_book`
LEFT JOIN `user` ON `user`.`id` = `invoices_has_book`.`user_id`
WHERE `book_id` = $for_pay_id
LIMIT 1");
$get_pay = mysqli_fetch_assoc($pay_sql);
?>
<td class="bg-gradient12">
<div style="display: flex !important; flex-direction: column;">
<div style="height: 25px;">
</div>
<div title="حجز بواسطة <?= $tretment_details_state_temp[$temp_count]['user_book'] ?> دفع بواسطة <?=$get_pay['name']?>" data-bs-toggle="modal" data-animation="bounce" data-bs-target="#booking_<?= $tretment_details_state_temp[$temp_count]['book_id'] ?>"
style="color:black; min-height: 100px; display: flex; justify-content: center; align-items: center; flex-direction: column; border-bottom: 3px solid black;">
<div style="white-space: nowrap;">
<div><?= $tretment_details_state_temp[$temp_count]['tr_name'] ?></div>
</div>
<div style="white-space: nowrap;">
<div><?= $tretment_details_state_temp[$temp_count]['name'] ?></div>
</div>
</div>
<div style="color:black;height:30px;background:#c1c1c1;font-weight:bold;font-size:17px;cursor:pointer;" onclick="window.open('booking_detail.php?number=<?= $tretment_details_state_temp[$temp_count]['number'] ?>', '_blank')">
<?= $tretment_details_state_temp[$temp_count]['number'] ?>
</div>
</div>
</td>
<?php
break;
case 13:
$for_pay_id = $tretment_details_state_temp[$temp_count]['book_id'];
$pay_sql = mysqli_query($db, "SELECT `user`.`name`, `user`.`id`, `invoices_has_book`.`date_time`
FROM `invoices_has_book`
LEFT JOIN `user` ON `user`.`id` = `invoices_has_book`.`user_id`
WHERE `book_id` = $for_pay_id
LIMIT 1");
$get_pay = mysqli_fetch_assoc($pay_sql);
?>
<td class="bg-gradient12">
<div style="display: flex !important; flex-direction: column;">
<div style="height: 25px;">
</div>
<div title="حجز بواسطة <?= $tretment_details_state_temp[$temp_count]['user_book'] ?> دفع بواسطة <?=$get_pay['name']?>" data-bs-toggle="modal" data-animation="bounce" data-bs-target="#booking_<?= $tretment_details_state_temp[$temp_count]['book_id'] ?>"
style="color:black; min-height: 100px; display: flex; justify-content: center; align-items: center; flex-direction: column; border-bottom: 3px solid black;">
<div style="white-space: nowrap;">
<div><?= $tretment_details_state_temp[$temp_count]['tr_name'] ?></div>
</div>
<div style="white-space: nowrap;">
<div><?= $tretment_details_state_temp[$temp_count]['name'] ?></div>
</div>
</div>
<div style="color:black;height:30px;background:#c1c1c1;font-weight:bold;font-size:17px;cursor:pointer;" onclick="window.open('booking_detail.php?number=<?= $tretment_details_state_temp[$temp_count]['number'] ?>', '_blank')">
<?= $tretment_details_state_temp[$temp_count]['number'] ?>
</div>
</div>
</td>
<?php
break;
case 14:
$for_pay_id = $tretment_details_state_temp[$temp_count]['book_id'];
$pay_sql = mysqli_query($db, "SELECT `user`.`name`, `invoices_has_book`.`date_time`
FROM `invoices_has_book`
LEFT JOIN `user` ON `user`.`id` = `invoices_has_book`.`user_id`
WHERE `book_id` = $for_pay_id
LIMIT 1");
$get_pay = mysqli_fetch_assoc($pay_sql);
?>
<td class="bg-gradient7">
<div style="display: flex !important; flex-direction: column;">
<div style="height: 25px;">
<div class="progress sm-progress-bar">
<div class="progress-bar bg-success progress-bar-striped progress-bar-animated" role="progressbar" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<a style="color: black !important" href="print.php?book_id=<?= $tretment_details_state_temp[$temp_count]['book_id'] ?>&p=1">
<span style="float: right;background: white;padding: 2px;width: 21px;height: 100%;" class="mdi mdi-printer"></span>
</a>
</div>
<div title="حجز بواسطة <?= $tretment_details_state_temp[$temp_count]['user_book'] ?> دفع بواسطة <?=$get_pay['name']?>" data-bs-toggle="modal" data-animation="bounce" data-bs-target="#booking_<?= $tretment_details_state_temp[$temp_count]['book_id'] ?>"
style="color:black; min-height: 100px; display: flex; justify-content: center; align-items: center; flex-direction: column; border-bottom: 3px solid black;">
<div style="white-space: nowrap;">
<div><?= $tretment_details_state_temp[$temp_count]['tr_name'] ?></div>
</div>
<div style="white-space: nowrap;">
<div><?= $tretment_details_state_temp[$temp_count]['name'] ?></div>
</div>
</div>
<div style="color:black;height:30px;background:#c1c1c1;font-weight:bold;font-size:17px;cursor:pointer;" onclick="window.open('booking_detail.php?number=<?= $tretment_details_state_temp[$temp_count]['number'] ?>', '_blank')">
<?= $tretment_details_state_temp[$temp_count]['number'] ?>
</div>
</div>
</td>
<?php
break;
case 15:
$for_pay_id = $tretment_details_state_temp[$temp_count]['book_id'];
$pay_sql = mysqli_query($db, "SELECT `user`.`name`, `invoices_has_book`.`date_time`
FROM `invoices_has_book`
LEFT JOIN `user` ON `user`.`id` = `invoices_has_book`.`user_id`
WHERE `book_id` = $for_pay_id
LIMIT 1");
$get_pay = mysqli_fetch_assoc($pay_sql);
?>
<td class="bg-gradient15">
<div style="display: flex !important; flex-direction: column;">
<div style="height: 25px;">
<a style="color: black !important" href="print.php?book_id=<?= $tretment_details_state_temp[$temp_count]['book_id'] ?>&p=1">
<span style="float: right;background: white;padding: 2px;width: 21px;height: 100%;" class="mdi mdi-printer"></span>
</a>
</div>
<div title="حجز بواسطة <?= $tretment_details_state_temp[$temp_count]['user_book'] ?> دفع بواسطة <?=$get_pay['name']?>" data-bs-toggle="modal" data-animation="bounce" data-bs-target="#booking_<?= $tretment_details_state_temp[$temp_count]['book_id'] ?>"
style="color:black; min-height: 100px; display: flex; justify-content: center; align-items: center; flex-direction: column; border-bottom: 3px solid black;">
<div style="white-space: nowrap;">
<div><?= $tretment_details_state_temp[$temp_count]['tr_name'] ?></div>
</div>
<div style="white-space: nowrap;">
<div><?= $tretment_details_state_temp[$temp_count]['name'] ?></div>
</div>
</div>
<div style="color:black;height:30px;background:#c1c1c1;font-weight:bold;font-size:17px;cursor:pointer;" onclick="window.open('booking_detail.php?number=<?= $tretment_details_state_temp[$temp_count]['number'] ?>', '_blank')">
<?= $tretment_details_state_temp[$temp_count]['number'] ?>
</div>
</div>
</td>
<?php
break;
case 16:
?>
<?php
break;
case 17:
?>
<?php
break;
case 18:
?>
<?php
break;
case 19:
?>
<td class="bg-gradient19">
<div style="position: relative;">
<div style="display: flex !important; flex-direction: column;">
<div style="height: 25px;">
<a style="color: white !important" href="work/order/php/close?booking_id=<?= $tretment_details_state_temp[$temp_count]['book_id']?>&date=<?= $today_temp ?>&time=<?= $start_today_time_temp ?>&emp_id=<?= $emp_id ?>&branch=<?=$branch_id?>&lo=book">
<span style="float: right;background: red;padding: 2px;width: 21px;height: 100%;" class="mdi mdi-close"></span>
</a>
</div>
<div data-bs-toggle="modal" data-animation="bounce" data-bs-target="#booking_<?= $tretment_details_state_temp[$temp_count]['book_id'] ?>"
style="color:black; min-height: 100px; display: flex; justify-content: center; align-items: center; flex-direction: column; border-bottom: 3px solid black;">
<div style="white-space: nowrap;">
<div><?= $tretment_details_state_temp[$temp_count]['tr_name'] ?></div>
</div>
<div style="white-space: nowrap;">
<div><?= $tretment_details_state_temp[$temp_count]['name'] ?></div>
</div>
</div>
<div style="height: 30px;"></div>
</div>
<div style="display: flex;position: absolute; bottom:0; width:100%;" class="frame-1">
<button onclick="location.href = 'booking?booking_id=<?= $tretment_details_state_temp[$temp_count]['book_id']?>&emp_id=<?= $emp_id ?>&date=<?= $today_temp ?>&time=<?= $start_today_time_temp ?>&branch=<?=$branch_id?>'" style="background-color: black; width: 100%;" class="custom-btn btn-7">حجز</button>
</div>
</div>
</td>
<?php
break;
case 20:
?>
<td class="bg-gradient20">
<div style="position: relative;">
<div style="display: flex !important; flex-direction: column;">
<div style="height: 25px;">
<a style="color: white !important" href="work/order/php/close?booking_id=<?= $tretment_details_state_temp[$temp_count]['book_id']?>&date=<?= $today_temp ?>&time=<?= $start_today_time_temp ?>&emp_id=<?= $emp_id ?>&branch=<?=$branch_id?>&lo=book">
<span style="float: right;background: red;padding: 2px;width: 21px;height: 100%;" class="mdi mdi-close"></span>
</a>
</div>
<div data-bs-toggle="modal" data-animation="bounce" data-bs-target="#booking_<?= $tretment_details_state_temp[$temp_count]['book_id'] ?>"
style="color:black; min-height: 100px; display: flex; justify-content: center; align-items: center; flex-direction: column; border-bottom: 3px solid black;">
<div style="white-space: nowrap;">
<div><?= $tretment_details_state_temp[$temp_count]['tr_name'] ?></div>
</div>
<div style="white-space: nowrap;">
<div><?= $tretment_details_state_temp[$temp_count]['name'] ?></div>
</div>
</div>
<div style="height: 30px;"></div>
</div>
<div style="display: flex;position: absolute; bottom:0; width:100%;" class="frame-1">
<button onclick="location.href = 'booking?booking_id=<?= $tretment_details_state_temp[$temp_count]['book_id']?>&emp_id=<?= $emp_id ?>&date=<?= $today_temp ?>&time=<?= $start_today_time_temp ?>&branch=<?=$branch_id?>'" style="background-color: black; width: 100%;" class="custom-btn btn-7">حجز</button>
<button onclick="location.href = 'work/order/php/getback?booking_id=<?= $tretment_details_state_temp[$temp_count]['book_id']?>&lo=book'" style="background-color: black; width: 100%;" class="custom-btn btn-7 btn-8">استعادة</button>
</div>
</div>
</td>
<?php
break;
case 21:
?>
<td class="bg-gradient21">
<div style="position: relative;">
<div style="display: flex !important; flex-direction: column;">
<div style="height: 25px;">
<a style="color: black !important" href="print.php?book_id=<?= $tretment_details_state_temp[$temp_count]['book_id'] ?>&p=1">
<span style="float: right;background: white;padding: 2px;width: 21px;height: 100%;" class="mdi mdi-printer"></span>
</a>
</div>
<div data-bs-toggle="modal" data-animation="bounce" data-bs-target="#booking_<?= $tretment_details_state_temp[$temp_count]['book_id'] ?>"
style="color:black; min-height: 100px; display: flex; justify-content: center; align-items: center; flex-direction: column; border-bottom: 3px solid black;">
<div style="white-space: nowrap;">
<div><?= $tretment_details_state_temp[$temp_count]['tr_name'] ?></div>
</div>
<div style="white-space: nowrap;">
<div><?= $tretment_details_state_temp[$temp_count]['name'] ?></div>
</div>
</div>
<div style="height: 30px;"></div>
</div>
<div style="display: flex;position: absolute; bottom:0; width:100%;" class="frame-1">
<button onclick="location.href = 'booking?booking_id=<?= $tretment_details_state_temp[$temp_count]['book_id']?>&emp_id=<?= $emp_id ?>&date=<?= $today_temp ?>&time=<?= $start_today_time_temp ?>&branch=<?=$branch_id?>'" style="background-color: black; width: 100%;" class="custom-btn btn-7">حجز</button>
</div>
</div>
</td>
<?php
break;
}
?>
<?php
$temp_count = $temp_count + 1;
if (($open_close_temp[$open_close_count]['day_time']) == ($start_today_time_temp) && $open_close_temp[$open_close_count]['emplyee_id'] == $emp_id) {
$open_close_count = $open_close_count + 1;
}
} elseif (($open_close_temp[$open_close_count]['day_time']) == ($start_today_time_temp) && $open_close_temp[$open_close_count]['emplyee_id'] == $emp_id) {
switch ($open_close_temp[$open_close_count]['status_id']) {
case 1:
?>
<td class="bg-gradient5">
<div title="اغلق بواسطة <?=$open_close_temp[$open_close_count]['name']?>" style="display: flex !important; flex-direction: column;">
<div style="height: 25px;">
<a style="color: white !important" href="work/order/php/open?date=<?= $today_temp ?>&time=<?= $start_today_time_temp ?>&emp_id=<?= $emp_id ?>&branch=<?=$branch_id?>&lo=book">
<span style="float: right;background: red;padding: 2px;width: 21px;height: 100%;" class="mdi mdi-close"></span>
</a>
</div>
<div style="height: 100px; display: flex; justify-content: center; align-items: center;">
<div>مغلق بواسطة <?=$open_close_temp[$open_close_count]['name']?></div>
</div>
<div style="height: 30px;"></div>
</div>
</td>
<?php
break;
case 2:
?>
<td>
<div style="position: relative;">
<div style="display: flex !important; flex-direction: column;" title="<?= $emp_neme .' - '. $start_today_time_temp ?>">
<div style="height: 25px;">
<a style="color: white !important" href="work/order/php/close?date=<?= $today_temp ?>&time=<?= $start_today_time_temp ?>&emp_id=<?= $emp_id ?>&branch=<?=$branch_id?>&lo=book">
<span style="float: right;background: red;padding: 2px;width: 21px;height: 100%;" class="mdi mdi-close"></span>
</a>
</div>
<div style="height: 100px; display: flex; justify-content: center; align-items: center; flex-direction: column;">
<div>
<div>متاح</div>
</div>
</div>
<div style="height: 30px;"></div>
</div>
<div style="display: flex;position: absolute; bottom:0; width:100%;" class="frame-1">
<button onclick="location.href = 'booking.php?emp_id=<?= $emp_id ?>&date=<?= $today_temp ?>&time=<?= $start_today_time_temp ?>&branch=<?=$branch_id?>'" style="background-color: black; width: 100%;" class="custom-btn btn-7">حجز</button>
</div>
</div>
</td>
<?php
break;
case 3: //جاري الحجز
?>
<td class="bg-gradient6" style="position: relative;">
<div style="display: flex !important; flex-direction: column;">
<div style="height: 25px;">
<?php
if ($open_close_temp[$open_close_count]['id'] == $admin_id) {
?>
<a style="color: white !important" href="work/order/php/open?date=<?= $today_temp ?>&time=<?= $start_today_time_temp ?>&emp_id=<?= $emp_id ?>&branch=<?=$branch_id?>&lo=book">
<span style="float: right;background: red;padding: 2px;width: 21px;height: 100%;" class="mdi mdi-close"></span>
</a>
<?php
}
if ((strtotime($open_close_temp[$open_close_count]['time'])+(60*5)) < (strtotime($time))) {
$temp_day_time = $open_close_temp[$open_close_count]['day_time'];
mysqli_query($db, "INSERT INTO `table`(`day_date`, `day_time`, `notes`, `branch_id`, `emplyee_id`, `status_id`, `date_time`, `user_id`, `activation_id`)
VALUES ('$today_temp', '$temp_day_time', '', '$branch_id', '$emp_id', '2', '$date_time', '1', '2')");
}
?>
</div>
<div style="height: 100px; display: flex; justify-content: center; align-items: center;">
<div>جاري الحجز بواسطة <?=$open_close_temp[$open_close_count]['name']?></div>
</div>
<div style="display: flex;position: absolute; bottom:0; width:100%;" class="cu_timer frame-1" value="<?=date("i:s", ((strtotime($open_close_temp[$open_close_count]['time'])+(60*5)) - (strtotime($time))))?>">
<?php
if ($open_close_temp[$open_close_count]['id'] == $admin_id) {
?>
<button onclick="location.href = 'booking.php?emp_id=<?= $emp_id ?>&date=<?= $today_temp ?>&time=<?= $start_today_time_temp ?>&branch=<?=$branch_id?>'" style="background-color: black; width: 100%;" class="custom-btn btn-7">استمرار</button>
<?php
}
?>
</div>
</div>
</td>
<?php
break;
}
$open_close_count = $open_close_count + 1;
} else if ($get_emplyee['day'] == $Day && !in_array($Day_s, array(27,28,29,30,31,1,2,3,4,5))) {
?>
<td class="bg-gradient5">
<div title="اغلق بواسطة النظام" style="display: flex !important; flex-direction: column;">
<div style="height: 25px;">
<button onclick="location.href = 'booking.php?emp_id=<?= $emp_id ?>&date=<?= $today_temp ?>&time=<?= $start_today_time_temp ?>&branch=<?=$branch_id?>'" class="custom-btn btn-7">OVERTIME</button>
</div>
<div style="height: 100px; display: flex; justify-content: center; align-items: center;">
<div>اجازة</div>
</div>
<div style="height: 30px;"></div>
</div>
</td>
<?php
} else if (in_array($start_today_time, $pray_time) && in_array($start_today_time, $time_work)) {
?>
<td class="bg-gradient5">
<div title="اغلق بواسطة النظام" style="display: flex !important; flex-direction: column;">
<div style="height: 25px;">
<a style="color: white !important" href="work/order/php/open?date=<?= $today_temp ?>&time=<?= $start_today_time_temp ?>&emp_id=<?= $emp_id ?>&branch=<?=$branch_id?>&lo=book">
<span style="float: right;background: red;padding: 2px;width: 21px;height: 100%;" class="mdi mdi-close"></span>
</a>
</div>
<div style="height: 100px; display: flex; justify-content: center; align-items: center;">
<div>
غير متاح
<br />
(صلاه)
</div>
</div>
<div style="height: 30px;">
</div>
</div>
</td>
<?php
} else if (in_array($start_today_time_temp, $time_work)) {
?>
<td>
<div style="position: relative;">
<div style="display: flex !important; flex-direction: column;" title="<?= $emp_neme .' - '. $start_today_time_temp ?>">
<div style="height: 25px;">
<a style="color: white !important" href="work/order/php/close?date=<?= $today_temp ?>&time=<?= $start_today_time_temp ?>&emp_id=<?= $emp_id ?>&branch=<?=$branch_id?>&lo=book">
<span style="float: right;background: red;padding: 2px;width: 21px;height: 100%;" class="mdi mdi-close"></span>
</a>
</div>
<div style="height: 100px; display: flex; justify-content: center; align-items: center; flex-direction: column;">
<div>
<div>متاح</div>
</div>
</div>
<div style="height: 30px;"></div>
</div>
<div style="display: flex;position: absolute; bottom:0; width:100%;" class="frame-1">
<button onclick="location.href = 'booking.php?emp_id=<?= $emp_id ?>&date=<?= $today_temp ?>&time=<?= $start_today_time_temp ?>&branch=<?=$branch_id?>'" style="background-color: black; width: 100%;" class="custom-btn btn-7">حجز</button>
</div>
</div>
</td>
<?php
} else {
?>
<td class="bg-gradient5">
<div title="اغلق بواسطة النظام" style="display: flex !important; flex-direction: column;">
<div style="height: 25px;">
<button onclick="location.href = 'booking.php?emp_id=<?= $emp_id ?>&date=<?= $today_temp ?>&time=<?= $start_today_time_temp ?>&branch=<?=$branch_id?>'" class="custom-btn btn-7">OVERTIME</button>
</div>
<div style="height: 100px; display: flex; justify-content: center; align-items: center;">
<div>غير متاح</div>
</div>
<div style="height: 30px;">
</div>
</div>
</td>
<?php
}
}
}
?>
</tbody>
</table>
<!--end table-->
<?php
for ($z = 0; $z < count($tretment_details_state); $z++) {
$status_id = array(4,5,6,8,14,15);
if (in_array($tretment_details_state[$z]['status_id'], $status_id)) {
?>
<div id="booking_<?= $tretment_details_state[$z]['book_id'] ?>" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 style="line-height: 2 !important; margin-right: 35px !important;" class="modal-title">
<?= $tretment_details_state[$z]['tr_name'] ?>
-
<?= $tretment_details_state[$z]['name'] ?>
</h5>
<button class="btn-close" style="left: unset;right: 25px;" type="button" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<h5 class="modal-title mt-0" id="mySmallModalLabel">معلومات العميل</h5>
<table class=" mb-3">
<tbody>
<tr>
<td>جوال</td>
<td><?= $tretment_details_state[$z]['number'] ?></td>
</tr>
<!--<tr>
<td>العمر</td>
<td></td>
</tr>
<tr>
<td>مسجل بتاريخ</td>
<td></td>
</tr>-->
</tbody>
</table>
<?php
if ($tretment_details_state[$z]['name'] == 'خدمات مجمعة') {
?>
<h5 class="modal-title mt-0" id="mySmallModalLabel">تفاصيل الخدمات المجمعة</h5>
<table class=" mb-3">
<tbody>
<?php
$book_id_for_bundle = $tretment_details_state[$z]['book_id'];
$bundle_s = mysqli_query($db, "SELECT
`services`.`name`,
`bundle_services_has_services`.`how_many`
FROM `bundle_services_has_services`
INNER JOIN `services` ON `services`.`id` = `bundle_services_has_services`.`services_id`
WHERE `bundle_services_has_services`.`bundle_services_id` = (SELECT `bundle_services_id` FROM `book_details_has_bundle_services` WHERE `book_details_id` = (SELECT MIN(`id`) FROM `book_details` WHERE `book_id` = $book_id_for_bundle AND `status_id` = 4))");
if (mysqli_num_rows($bundle_s) > 0) {
while ($bundle_s_row = mysqli_fetch_assoc($bundle_s)) {
?>
<tr>
<td><?= $bundle_s_row['name']?></td>
<td>العدد</td>
<td><?= $bundle_s_row['how_many']?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<?php
}
?>
<h5 class="modal-title mt-0" id="mySmallModalLabel">معلومات الجلسة</h5>
<table class=" mb-3">
<tbody>
<tr>
<td colspan="2">رقم الجلسة</td>
<td colspan="2"><?= $tretment_details_state[$z]['book_id'] ?></td>
</tr>
<tr>
<td colspan="2">الجلسة</td>
<td colspan="2"><?= $tretment_details_state[$z]['name'] ?></td>
</tr>
<tr>
<td colspan="2">حجز بواسطة</td>
<td colspan="2"><?= $tretment_details_state[$z]['user_book'] ?></td>
</tr>
<tr>
<td>التاريخ</td>
<td><?= date('d-m-Y', strtotime($tretment_details_state[$z]['user_date']))?></td>
<td>الوقت</td>
<td><?= date((date("H", strtotime($tretment_details_state[$z]['user_date'])) > 11) ? 'h:i \م' : 'h:i \ص', strtotime($tretment_details_state[$z]['user_date'])) ?></td>
</tr>
</tbody>
</table>
<?php
if ($tretment_details_state[$z]['status_id'] == 6 || $tretment_details_state[$z]['status_id'] == 8 || $tretment_details_state[$z]['status_id'] == 14 || $tretment_details_state[$z]['status_id'] == 15) {
?>
<h5 class="modal-title mt-0" id="mySmallModalLabel">معلومات السداد</h5>
<table class=" mb-3">
<?php
$for_pay_id = $tretment_details_state[$z]['book_id'];
$pay_sql = mysqli_query($db, "SELECT `user`.`name`, `invoices_has_book`.`date_time`
FROM `invoices_has_book`
LEFT JOIN `user` ON `user`.`id` = `invoices_has_book`.`user_id`
WHERE `book_id` = $for_pay_id
LIMIT 1");
$get_pay = mysqli_fetch_array($pay_sql);
?>
<tbody>
<tr>
<td colspan="2">دفع بواسطة</td>
<td colspan="2"><?= $get_pay['name'] ?></td>
</tr>
<tr>
<td>التاريخ</td>
<td><?= date('d-m-Y', strtotime($get_pay['date_time']))?></td>
<td>الوقت</td>
<td><?= date((date("H", strtotime($get_pay['date_time'])) > 11) ? 'h:i \م' : 'h:i \ص', strtotime($get_pay['date_time'])) ?></td>
</tr>
</tbody>
</table>
<?php
} elseif ($tretment_details_state[$z]['status_id'] == 7) {
?>
<h5 class="modal-title mt-0" id="mySmallModalLabel">معلومات السداد</h5>
<?php
}
?>
<!--<h5 class="modal-title mt-0" id="mySmallModalLabel">ملاحظات مركز الاتصال</h5>
<table class=" mb-3">
<tbody>
<tr>
<td>العميل سيتأخر 15 دقيقة</td>
</tr>
<tr>
<td>بواسطة : </td>
</tr>
</tbody>
</table>-->
<h5 class="modal-title mt-0" id="mySmallModalLabel">ملاحظات</h5>
<table class=" mb-3">
<tbody>
<tr>
<td><?= $tretment_details_state[$z]['notes'] ?></td>
</tr>
</tbody>
</table>
<div class="form-group row">
<div class="mt-3 col-12 col-sm-12 col-md-6 col-lg-4 col-xl-4">
<a target="_blank" href="https://api.whatsapp.com/send/?phone=<?= $tretment_details_state[$z]['number'] ?>&amp;text=">
<button class="col-12 btn btn-primary align-self-center report-btn">ارسال</button>
</a>
</div>
<div class="mt-3 col-12 col-sm-12 col-md-6 col-lg-4 col-xl-4">
<a class=" col-12 btn btn-success align-self-center report-btn" href="active.php?booking_id=<?= $tretment_details_state[$z]['book_id'] ?>">
تأكيد
</a>
</div>
<div class="mt-3 col-12 col-sm-12 col-md-6 col-lg-4 col-xl-4">
<button class="col-12 btn btn-info align-self-center report-btn">رسالة تذكيرية</button>
</div>
<!--<div class="mt-3 col-12 col-sm-12 col-md-6 col-lg-4 col-xl-4">
<a class="booking-cancel" href="work/order/php/cancel?booking_id=<?= $tretment_details_state[$z]['book_id'] ?>">
<button class="col-12 btn btn-danger align-self-center report-btn">إلغاء</button>
</a>
</div>-->
</div>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
<?php
}
}
?>
</div>
<!--end /div-->
</div>
</div>
</div>
<!--end card-body-->
</div>
<!--end card-->
</div>
</div>
</div>
<!-- Container-fluid Ends-->
</div>
<?php require_once('fixed/footer/go.php'); ?>
</div>
</div>
<?php require_once('fixed/js/go.php'); ?>
<script>
$("#Select-date").change(function() {
var SelectedDate = $(this).val();
window.location = 'book.php?branch=<?= $branch_id ?>&date=' + SelectedDate
});
$('.booking-cancel').on('click', function(e) {
e.preventDefault();
const href = $(this).attr('href');
swal.fire({
title: 'هل أنت متأكد',
text: 'من إلغاء الحجز',
type: 'info',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'نعم',
cancelButtonText: 'لا'
}).then((result) => {
if (result.value) {
document.location.href = href;
}
})
})
$('.booking-cancel-active').on('click', function(e) {
e.preventDefault();
const href = $(this).attr('href');
swal.fire({
title: 'هل أنت متأكد',
text: 'من إلغاء الحجز المفعل',
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'نعم',
cancelButtonText: 'لا'
}).then((result) => {
if (result.value) {
document.location.href = href;
}
})
})
</script>
<?php
$lastid_php_sql = mysqli_query($db, "SELECT MAX(`id`) AS `id` FROM `book_details`;");
$lastid_php = mysqli_fetch_assoc($lastid_php_sql);
?>
<script>
//function refrish() {
// window.location.reload(1);
//}
//
//// Check if the entire page is already loaded
//$( document ).ready(function() {
//
// // Set the interval for the window refresh
// window.setInterval(function() {
// // get the database information
// getInfo();
// //add_data();
// }, 5000); // Check every 30 seconds (60000 milliseconds = 60 seconds = 1 minute)
//
// function getInfo() {
//
// //make the ajax call
// $.ajax({
// url: 'work/order/ajax/book_ajax.php',
// type: 'POST',
// data: {lastid : <?= json_encode($lastid_php['id']) ?>},
// success: function(data) {
// // If data is available then reflect it to the sales container
// if (data['val'] == 1) {
// refrish();
// }
// },
// error: function (request, status, error) {
// //alert(request.responseText + 'يرجى اعادة تحديث الصفحة');
// refrish();
// }
// });
// }
//
// //function add_data() {
// // $.post("work/order/ajax/add_to_book_temp_ajax.php", {})
// //}
//});
</script>
</body>
</html>