control for member create and member discount

This commit is contained in:
Yan
2017-07-27 18:53:41 +06:30
parent 0408c6d498
commit bf3e30c70f
7 changed files with 125 additions and 57 deletions

View File

@@ -229,6 +229,8 @@
// Read Card Reader
$("#member_acc_no").on('click', function(e){
var cardNo = "";
var customer_id = '';
var customer_name = '';
var sale_id = $("#sale_id").val() || 0;
var customer_mamber_card_no = 0;
$("#sxModal").show();
@@ -237,8 +239,18 @@
$("#sxModal").hide();
customer_mamber_card_no = $("#search").val();
if(sale_id != 0 && customer_mamber_card_no != 0){
update_sale(customer_mamber_card_no,sale_id);
if(sale_id != 0 && customer_mamber_card_no != 0){
$.ajax({
type: "POST",
url: "get_customer" ,
data: { filter : customer_mamber_card_no },
dataType: "json",
success: function(data) {
customer_id = data[0].customer_id;
customer_name = data[0].name;
update_sale(customer_id, customer_name,sale_id);
}
});
}
},100);
});
@@ -263,10 +275,11 @@
$(this).closest('tr').find('.checkbox_check').prop( "checked", true );
var sale_id = $("#sale_id").val() || 0;
var customer_id = $(this).attr('data-ref');
var customer_name = $(this).children("td:nth-child(3)").text();
if(sale_id != 0){
// var url = "/"+customer_id;
update_sale(customer_id,sale_id);
update_sale(customer_id, customer_name,sale_id);
}else{
var url = "customers/"+customer_id;
@@ -327,10 +340,15 @@
// }
})
function update_sale(customer_id,sale_id) {
function update_sale(customer_id, customer_name, sale_id) {
var customer="";
if(customer_name != ""){
customer = '(' + customer_name + ')';
}
$.confirm({
title: 'Confirm!',
content: 'Are You Sure to assign this customer!',
content: 'Are You Sure to assign this customer' + customer + '!',
buttons: {
cancel: function () {