finished CRM and customer

This commit is contained in:
Aung Myo
2017-06-12 14:23:20 +06:30
parent 0943808ac8
commit e90178cfdc
13 changed files with 121 additions and 62 deletions

View File

@@ -27,11 +27,8 @@ $(document).ready(function(){
control_button(order_status);
//for customer button
if(unique_id.charAt(0) == 'S'){
$("#customer").removeAttr('disabled');
}else{
$("#customer").attr('disabled','disabled');
}
var customer_id=$(this).find(".customer-id").text();
show_customer_details(customer_id);
@@ -161,13 +158,20 @@ $(document).ready(function(){
});
$('#customer').click(function() {
var sale_id=$(".selected-item").find(".orders-id").text();
var sale = $(".selected-item").find(".orders-id").text();
if (sale.substring(0, 3)=="SAL") {
var sale_id = sale
}else{
var sale_id = $(".selected-item").find(".order-cid").text();
}
alert(sale_id);
window.location.href = '/origami/'+ sale_id + "/add_customer"
return false;
});
function show_customer_details(customer_id){
$('.customer_detail').removeClass('hide');
//Start Ajax
$.ajax({
@@ -176,8 +180,20 @@ $(document).ready(function(){
data: {},
dataType: "json",
success: function(data) {
$("#customer_name").text(data.name);
$("#customer_name").text(data.name);
$("#customer_name").text(data["customer"].name);
$.each(data["response_data"]["data"], function (i) {
if(data["response_data"]["data"][i]["accountable_type"] == "RebateAccount"){
var balance = data["response_data"]["data"][i]["balance"];
console.log(balance);
if (balance) {
$("#customer_amount").text(balance);
}else{
$("#customer_amount").text('00');
}
}
});
}
});
//End Ajax