booking/coupons.php

139 lines
4.4 KiB
PHP
Executable File

<?php
require_once('fixed/config/go_con.php');
access(10);
// if come with number
$number = $_GET['number'];
// if come with number end
?>
<!DOCTYPE html>
<html lang="en" dir="rtl">
<?php require_once('fixed/head/go.php'); ?>
<body class="rtl">
<style>
.header-title {
color: #086367 !important;
font-weight: bold !important;
}
</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="row">
<div class="col-12">
<div class="card">
<div class="card-body new-user order-list">
<h6 class="mt-0 header-title">البحث</h6>
<div class="form-group row">
<div class="col-8 col-sm-6 col-lg-3 p-r-0">
<label for="" class="col-form-label text-right">رقم الجوال</label>
<input id="number" class="form-control clickfun1" type="number" value="" required>
</div>
<div class="col-4 col-sm-6 col-lg-1 p-l-0">
<label style="visibility: hidden;" for="" class="col-form-label text-right">..</label>
<div class="form-control" style="background-color: #086367; color:white; text-align:center; cursor: pointer;" id="search_tretment">بحث</div>
</div>
</div>
<div id="get_tretment">
</div>
<hr>
<div class="form-group row">
<div class="col-lg-12">
<div class="form-control" style="background-color: #086367; color:white; text-align:center; cursor: pointer;" id="add_coupon">إضافة</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php require_once('fixed/footer/go.php'); ?>
</div>
</div>
<?php require_once('fixed/js/go.php'); ?>
<script>
// for limit clicks
searchClick = 0;
click = 0;
// if come with number
<?php
if (!empty($number)) {
?>
$("#number").val(<?=json_encode($number);?>);
search_tretment();
<?php
}
?>
// search for tretment
$(function() {
$("#search_tretment").click(function() {
search_tretment();
});
});
$('.clickfun1').keypress(function (e) {
var key = e.which;
if(key == 13) {
search_tretment();
}
});
function search_tretment() {
if ($("#number").val().length !== 9) {
swalfun('حدث خطأ', 'رقم الجوال يجب أن يتكون من 9 أرقام وبدون 0 في البداية', 'error');
return false;
}
var tretmentNumber = $("#number").val();
if (searchClick == 0) {
searchClick++;
$.post("work/order/ajax/get_tretment_ajax.php", {
tretmentNumber,
}, function(get_tretment) {
$("#get_tretment").html(get_tretment);
})
} else {
swalfun("يرجى الانتظار","", "warning");
}
}
// add booking
$(function() {
$("#add_coupon").click(function() {
add_coupon();
});
});
$('.clickfun2').keypress(function (e) {
var key = e.which;
if(key == 13) {
add_coupon();
}
});
function add_coupon() {
tretment_id = $("[name='tretment_id']").val();
if (tretment_id == undefined) {
swalfun('حدث خطأ', 'يرجى تحديد العميل', 'error');
return false;
}
if (click == 0) {
click++;
$.post("work/order/ajax/add_coupon_ajaxxx.php", {
tretment_id
}, function(get_tretment) {
$("#get_tretment").html(get_tretment);
})
} else {
swalfun("يرجى الانتظار", "", "warning");
}
}
</script>
</body>
</html>