booking/walaa_points.php

175 lines
5.5 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">
<!-- 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">
<?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">
<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="money" class="form-control clickfun" type="number" value="" required>
</div>
</div>
</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="note" row="4" class="form-control" type="text" required> </textarea>
</div>
</div>
</div>
<div class="col-lg-12">
<div id="add_pack" class="form-control"
style="background-color: #086367; color:white; text-align:center; cursor: pointer;">اضافة</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>
<?php require_once('fixed/search_for_tretment/js.php'); ?>
// for limit clicks
click = 0;
// add pack
$(function () {
$("#add_pack").click(function () {
code();
});
});
// $('.clickfun').keypress(function (e) {
// var key = e.which;
// if(key == 13) {
// code();
// }
// });
function code() {
swal.fire({
title: 'كود التفعيل',
input: 'number',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'تحقق',
cancelButtonText: 'الغاء',
showLoaderOnConfirm: true,
preConfirm: (login) => {
if (login <= 9999 && login.length == 4) {
$.post("work/order/ajax/active_sadad_code_ajax.php", {
login
}, function (get_data) {
if (get_data.status == 0) {
swalfun("حدث خطأ", "رمز التحقق غير صحيح", "error");
} else if (get_data.status == 1) {
add_money();
} else if (get_data.status == 2) {
swalfun("حدث خطأ", "لا يوجد في حسابك رمز تحقق", "error");
} else {
swalfun("حدث خطأ", "TH-213M", "error");
}
})
} else {
swalfun('يرجى التحقق', 'ادخل رمز مكون من 4 ارقام', 'info');
return false;
}
},
})
}
function add_money() {
let tretment_id = $("[name='tretment_id']").val();
if (tretment_id == undefined) {
swalfun('حدث خطأ', 'يرجى تحديد العميل', 'error');
return false;
}
let price = parseFloat($("#money").val());
if (isNaN(price) || price == undefined || price == '') {
swalfun("تنبية", "الرقم المدخل غير صحيح", "warning");
return false;
}
let note = $("#note").val();
if (click == 0) {
click++;
$.post("work/order/ajax/add_walaa_points_ajax.php", {
tretment_id,
note,
price
}, function (get_tretment) {
$("#get_data").html(get_tretment);
})
} else {
swalfun("يرجى الانتظار", "", "warning");
}
}
// get
$(function () {
$("#money").change(function () {
let show = $("#money").val();
if (isNaN(show) || show == undefined || show == '') {
swalfun("تنبية", "الرقم المدخل غير صحيح", "warning");
return false;
}
$("#true_price").html(show);
});
});
$('.clickfun').keypress(function (e) {
var key = e.which;
if (key == 13) {
let show = $("#money").val();
if (isNaN(show) || show == undefined || show == '') {
swalfun("تنبية", "الرقم المدخل غير صحيح", "warning");
return false;
}
$("#true_price").html(show);
}
});
</script>
</body>
</html>