booking/coupon_active.php

132 lines
5.0 KiB
PHP
Executable File

<?php
require_once('fixed/config/go_con.php');
access(9);
// 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'); ?>
<!-- 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">
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body new-user order-list">
<?php require_once('fixed/search_for_tretment/html.php'); ?>
<h6 class="mt-0 header-title">معلومات الكوبون</h6>
<div class="form-group row">
<div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6">
<label for="coupon_type" class="col-form-label text-right">نوع الكوبون</label>
<select id="coupon_type" style="font-family: system-ui;" class="form-control">
<option value="0" selected>المرجو الاختيار</option>
<option value="1" data-latter="AQ-3">الماسيين المستحقين</option>
<option value="2" data-latter="AQ-4829">أولكم</option>
<option value="3" data-latter="AQ-2211">الماجد للعود</option>
<option value="4" data-latter="AQW0">مجاني أقدام 15 النسائي</option>
<option value="5" data-latter="AQR">عملاء الراجحي</option>
</select>
</div>
<div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6">
<label for="coupon_code" class="col-form-label text-right">الكود</label>
<input id="coupon_code" class="form-control clickfun" type="text" value="">
</div>
<div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
<label for="" class="col-form-label text-right">ملاحظات</label>
<textarea id="coupon_note" row="4" class="form-control" type="text"> </textarea>
</div>
<div class="col-lg-12" style="margin-top:25px;">
<div id="add_coupon" class="form-control" style="background-color: #086367; color:white; text-align:center; cursor: pointer;">تفعيل</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php require_once('fixed/footer/go.php'); ?>
</div>
</div>
<div id="get_data"></div>
<?php require_once('fixed/js/go.php'); ?>
<script>
$(function() {
$("#coupon_type").change(function() {
var frist_latter = $("#coupon_type option:selected").attr('data-latter');
$("#coupon_code").val(frist_latter);
});
});
<?php require_once('fixed/search_for_tretment/js.php'); ?>
// for limit clicks
click = 0;
// add coupon
$(function() {
$("#add_coupon").click(function() {
add_coupon();
});
});
$('.clickfun').keypress(function (e) {
var key = e.which;
if(key == 13) {
add_coupon();
}
});
function add_coupon() {
let tretment_id = $("[name='tretment_id']").val();
if (tretment_id == undefined) {
swalfun('حدث خطأ', 'يرجى تحديد العميل', 'error');
return false;
}
let coupon_id = $("#coupon_type").val();
if (coupon_id == 0) {
swalfun('حدث خطأ', 'يرجى اختيار نوع الكوبون ', 'error');
return false;
}
let coupon_code = $("#coupon_code").val();
if (coupon_code == '') {
swalfun('حدث خطأ', 'يرجى تعبة جميع الحقول ', 'error');
return false;
}
let coupon_note = $("#coupon_note").val();
if (click == 0) {
click++;
$.post("work/order/ajax/add_active_coupon_ajax.php", {
tretment_id,
coupon_id,
coupon_code,
coupon_note
}, function(get_tretment) {
$("#get_data").html(get_tretment);
})
} else {
swalfun("يرجى الانتظار", "", "warning");
}
}
</script>
</body>
</html>