update crm customer and bind customer and queue
This commit is contained in:
@@ -73,6 +73,8 @@
|
||||
|
||||
<span class="patch_method"></span>
|
||||
<input type="hidden" id="sale_id" name="sale_id" value="<%= @sale_id %>" />
|
||||
<input type="hidden" id="table_id" name="table_id" value="<%= @dining_facility.id %>" />
|
||||
<input type="hidden" id="type" name="type" value="<%= @dining_facility.type %>" />
|
||||
<%= f.error_notification %>
|
||||
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
@@ -171,6 +173,7 @@
|
||||
<div class="form-group">
|
||||
<label>Select Member Group</label>
|
||||
<select class="selectpicker form-control col-md-12" name="member_group_id">
|
||||
<option value="">Select Membership Group</option>
|
||||
<% Lookup.where("lookup_type = ?", "member_group_type" ).each do |member| %>
|
||||
<option value="<%= member.value %>">
|
||||
<%= member.name %></option>
|
||||
@@ -186,9 +189,9 @@
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<br>
|
||||
<a href="<%= origami_root_path%>" class="btn btn-primary">
|
||||
<button id="back" class="btn btn-primary">
|
||||
<i class="fa fa-arrow-left fa-lg"></i> Back
|
||||
</a>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -292,8 +295,14 @@
|
||||
success: function(data) {
|
||||
if(data.status == true)
|
||||
{
|
||||
|
||||
window.location.href = '/origami'
|
||||
var id = $("#table_id").val()
|
||||
var type = $("#type").val()
|
||||
if (type=="Table") {
|
||||
window.location.href = '/origami/table/'+id
|
||||
}else{
|
||||
window.location.href = '/origami/room/'+id
|
||||
}
|
||||
|
||||
}else{
|
||||
alert('Record not found!');
|
||||
location.reload();
|
||||
@@ -307,4 +316,27 @@
|
||||
});
|
||||
}
|
||||
|
||||
$('#back').on('click',function(){
|
||||
var id = $("#table_id").val()
|
||||
var type = $("#type").val()
|
||||
if (type=="Table") {
|
||||
window.location.href = '/origami/table/'+id
|
||||
}else{
|
||||
window.location.href = '/origami/room/'+id
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
class CreateDiningQueues < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :dining_queues do |t|
|
||||
t.string :name
|
||||
t.string :contact_no
|
||||
t.string :queue_no
|
||||
t.string :status
|
||||
t.references :dining_facility, foreign_key: true
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -116,9 +116,11 @@
|
||||
<p>Date: <span id="receipt_date"><%= @date.utc.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-title row customer_detail hide">
|
||||
|
||||
<div class="card-title row">
|
||||
<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>
|
||||
@@ -276,23 +278,39 @@
|
||||
<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 sale_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/sale/' + sale_id;
|
||||
|
||||
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 order_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/order/' + order_id;
|
||||
|
||||
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
|
||||
@@ -303,8 +321,9 @@ $(document).ready(function(){
|
||||
}else{
|
||||
var sale_id = $('#save_order_id').attr('data-order');
|
||||
}
|
||||
var table_id = $('.tables').attr("data-id");
|
||||
|
||||
window.location.href = '/origami/'+ sale_id + "/customers"
|
||||
window.location.href = '/origami/'+ sale_id + "/customers"
|
||||
});
|
||||
|
||||
// Discount for Payment
|
||||
@@ -357,4 +376,39 @@ $('#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>
|
||||
|
||||
@@ -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