booking/p_mybooks.php

208 lines
11 KiB
PHP
Executable File

<?php
require_once('fixed/config/go_con.php');
access(77);
$google_translate = true;
$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");
}
}
$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));
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;
}
?>
<!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 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>
حجوزات يوم
<?= Day_ar() ?>
<br />
<?= Today_ar() ?>
</h4>
</div>
<div class="col-12 col-sm-12 col-md-3 col-lg-4 col-xl-4">
</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="my_books.php?date=<?= $Previous ?>" 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="my_books.php?date=<?= $Next ?>" 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>
<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 class="table table-bordered text-center">
<thead class="table-primary">
<tr>
<th scope="col">رقم الحجز</th>
<th scope="col">اسم العميل</th>
<th scope="col">الوقت</th>
<th scope="col">اجراءات</th>
</tr>
</thead>
<tbody>
<?php
$get_my_books_sql = mysqli_query($db,
"SELECT
`bd`.`day_time`,
`bd`.`emplyee_id`,
`bd`.`status_id`,
`bd`.`date_time`,
`bd`.`book_id`,
`bd`.`name`,
`bd`.`tr_name`
FROM `books_for_table` AS `bd`
WHERE `bd`.`day_date`='$today'
AND `bd`.`emplyee_id`='$admin_emp_id'
AND `bd`.`status_id` IN (4,6)
GROUP BY `bd`.`day_time`
ORDER BY `bd`.`day_time` DESC, `bd`.`date_time`
");
if (mysqli_num_rows($get_my_books_sql) > 0) {
while ($get_my_books = mysqli_fetch_assoc($get_my_books_sql)) {
?>
<tr>
<th scope="row"><?=$get_my_books['book_id']?></th>
<td><?=$get_my_books['tr_name']?></td>
<td><?=$get_my_books['day_time']?></td>
<td><?=$get_my_books['name']?></td>
</tr>
<?php
}
} else {
?>
<tr>
<th colspan="4" scope="row">لا يوجد اي عميل حاليا</th>
</tr>
<?php
}
?>
</tbody>
</table>
</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 = 'my_books.php?date=' + SelectedDate
});
</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();
//}, 1000); // 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();
// }
// console.log(data['val']);
// },
// error: function (request, status, error) {
// //alert(request.responseText + 'يرجى اعادة تحديث الصفحة');
// refrish();
// }
// });
//}
//});
</script>
</body>
</html>