201 lines
9.7 KiB
PHP
Executable File

<?php
require_once('fixed/config/go_con.php');
access(39);
$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");
}
}
$get_my_books_sql = mysqli_query($db,
"SELECT
`bd`.`day_date`,
`bd`.`day_time`,
`bd`.`emplyee_id`,
`bd`.`status_id`,
`bd`.`date_time`,
`bd`.`book_id`,
`bd`.`name`,
`bd`.`tr_name`,
`bd`.`tretment_id`
FROM `books_for_table` AS `bd`
WHERE `bd`.`emplyee_id`='$admin_emp_id'
AND `bd`.`status_id` IN (6, 8)
AND `bd`.`day_date` > '2024-04-30'
AND `bd`.`day_date` <= '$today'
GROUP BY `bd`.`day_time`
ORDER BY `bd`.`day_time` ASC, `bd`.`date_time`
LIMIT 1
");
$get_my_books = mysqli_fetch_assoc($get_my_books_sql)
?>
<!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">
<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">
<?php
if (mysqli_num_rows($get_my_books_sql) == 1) {
?>
<thead class="table-primary">
<tr>
<th scope="col">اسم العميل</th>
</tr>
</thead>
<tbody>
<tr>
<td><?=$get_my_books['tr_name']?></td>
</tr>
</tbody>
<thead class="table-primary">
<tr>
<th scope="col">التاريخ</th>
</tr>
</thead>
<tbody>
<tr>
<td><?=$get_my_books['day_date']?></td>
</tr>
</tbody>
<thead class="table-primary">
<tr>
<th scope="col">الوقت</th>
</tr>
</thead>
<tbody>
<tr>
<td><?=$get_my_books['day_time']?></td>
</tr>
</tbody>
<thead class="table-primary">
<tr>
<th scope="col">الخدمة</th>
</tr>
</thead>
<tbody>
<tr>
<td><?=$get_my_books['name']?></td>
</tr>
</tbody>
<thead class="table-primary">
<tr>
<th scope="col">يرجى ادخال آخر رقمين من رقم العميل للتحقق</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<input class="form-control clickfun" id="2_num" type="tel" placeholder="00" min="0" max="99" style="text-align:center;">
</td>
</tr>
<tr>
<td>
<div id="next" class="btn btn-pill btn-primary btn-air-primary" title="btn btn-pill btn-primary btn-air-primary">التالي</div>
</td>
</tr>
</tbody>
<?php
} else {
?>
<tbody>
<tr>
<th colspan="4" scope="row">لا يوجد اي عميل حاليا</th>
</tr>
</tbody>
<?php
}
?>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php require_once('fixed/footer/go.php'); ?>
</div>
</div>
<?php require_once('fixed/js/go.php'); ?>
<div id="get_data"></div>
<script>
function setInputFilter(textbox, inputFilter, errMsg) {
["input", "keydown", "keyup", "mousedown", "mouseup", "select", "contextmenu", "drop", "focusout"].forEach(function(event) {
textbox.addEventListener(event, function(e) {
if (inputFilter(this.value)) {
// Accepted value
if (["keydown","mousedown","focusout"].indexOf(e.type) >= 0){
this.classList.remove("input-error");
this.setCustomValidity("");
}
this.oldValue = this.value;
this.oldSelectionStart = this.selectionStart;
this.oldSelectionEnd = this.selectionEnd;
} else if (this.hasOwnProperty("oldValue")) {
// Rejected value - restore the previous one
this.classList.add("input-error");
this.setCustomValidity(errMsg);
this.reportValidity();
this.value = this.oldValue;
this.setSelectionRange(this.oldSelectionStart, this.oldSelectionEnd);
} else {
// Rejected value - nothing to restore
this.value = "";
}
});
});
}
setInputFilter(document.getElementById("2_num"), function(value) {return /^\d*$/.test(value) && (value === "" || parseInt(value) <= 99) && (value.length < 3) ; }, "يجب ان يكون الرقم مكون من عددين فقط");
$(function() {
$("#next").click(function() {
next();
});
});
$('.clickfun').keypress(function (e) {
var key = e.which;
if(key == 13) {
next();
}
});
function next() {
tretment_id = <?=json_encode($get_my_books['tretment_id'])?>;
num = $('#2_num').val();
if (num == '' || num > 99) {
swalfun('حدث خطأ', '', 'error');
return false;
}
$.post("work/order/ajax/two_numbers_checker_ajax.php", {
tretment_id,
num
}, function(get_data) {
$("#get_data").html(get_data);
})
}
</script>
</body>
</html>