update crm customer and bind customer and queue
This commit is contained in:
@@ -97,11 +97,18 @@
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<div class="card" >
|
||||
<div class="card-header">
|
||||
<% if @status == "order" %>
|
||||
<!-- <% if @status == "order" %>
|
||||
<div><strong id="order-title">ORDER DETAILS </strong></div>
|
||||
<% else %>
|
||||
<div><strong id="order-title">INVOICE DETAILS </strong></div>
|
||||
<% end %> -->
|
||||
|
||||
<% if @status == 'order' %>
|
||||
<div id="save_order_id" data-order="<%= @obj.order_id %>"><strong id="order-title">ORDER DETAILS </strong></div>
|
||||
<% elsif @status_sale == 'sale' %>
|
||||
<div><strong id="order-title">INVOICE DETAILS </strong></div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title row">
|
||||
@@ -118,7 +125,8 @@
|
||||
</div>
|
||||
<div class="card-title row customer_detail hide">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p>Customer : <span id="customer_name"></span></p>
|
||||
<p class="hidden customer-id"><%= @customer.customer_id %></p>
|
||||
<p>Customer : <%= @customer.name %></p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -244,22 +252,49 @@
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$(".tables").on('click', function(){
|
||||
var customer_id=$(".customer-id").text();
|
||||
show_customer_details(customer_id);
|
||||
|
||||
var dining_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/table/' + dining_id;
|
||||
})
|
||||
$(".sales").on('click',function(){
|
||||
var customer_id=$(".customer-id").text();
|
||||
show_customer_details(customer_id);
|
||||
|
||||
var sale_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/sale/' + sale_id;
|
||||
})
|
||||
$(".rooms").on('click', function(){
|
||||
var customer_id=$(".customer-id").text();
|
||||
show_customer_details(customer_id);
|
||||
|
||||
var dining_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/room/' + dining_id;
|
||||
})
|
||||
$(".orders").on('click',function(){
|
||||
var customer_id=$(".customer-id").text();
|
||||
show_customer_details(customer_id);
|
||||
|
||||
var order_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/order/' + order_id;
|
||||
})
|
||||
// bind customer to order or sale
|
||||
$("#customer").on('click', function(){
|
||||
var sale = $('#sale_id').val();
|
||||
if (sale) {
|
||||
var sale_id = sale
|
||||
}else{
|
||||
var sale_id = $('#save_order_id').attr('data-order');
|
||||
}
|
||||
var table_id = $('.tables').attr("data-id");
|
||||
|
||||
window.location.href = '/origami/'+ sale_id + "/customers"
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('#pay').on('click',function() {
|
||||
var sale_id = $('#sale_id').val();
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||
@@ -271,4 +306,40 @@ $('#move').on('click',function(){
|
||||
$('#back').on('click',function(){
|
||||
window.location.href = '/origami/';
|
||||
})
|
||||
|
||||
//show cusotmer rebate amount
|
||||
function show_customer_details(customer_id){
|
||||
|
||||
var url = '<%= @show_customer_details_path %>'
|
||||
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
$("#customer_name").text(data["customer"].name);
|
||||
if (data["response_data"]["data"].length) {
|
||||
$.each(data["response_data"]["data"], function (i) {
|
||||
if(data["response_data"]["data"][i]["accountable_type"] == "RebateAccount"){
|
||||
var balance = data["response_data"]["data"][i]["balance"];
|
||||
if (data["response_data"]["status"]==true) {
|
||||
$('.rebate_amount').removeClass('hide');
|
||||
row =
|
||||
'<td class="charges-name">' + "Rebate Balance" +'</td>'
|
||||
+'<td class="item-attr">' + balance + '</td>';
|
||||
|
||||
$(".rebate_amount").html(row);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}else{
|
||||
$('.rebate_amount').addClass('hide');
|
||||
}
|
||||
}
|
||||
});
|
||||
//End Ajax
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user