add function for member card and qr code in payment
This commit is contained in:
@@ -167,7 +167,7 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id )
|
status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id )
|
||||||
|
|
||||||
if params[:sale_id]
|
if params[:sale_id]
|
||||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created.' }
|
format.html { redirect_to '/origami/'+params[:sale_id]+'/'+params[:type]+'/customers/'+params[:page], notice: 'Customer was successfully created.' }
|
||||||
else
|
else
|
||||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created'}
|
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created'}
|
||||||
end
|
end
|
||||||
@@ -186,21 +186,21 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
if response["message"] == "Account has not exist."
|
if response["message"] == "Account has not exist."
|
||||||
customer.destroy
|
customer.destroy
|
||||||
if params[:sale_id]
|
if params[:sale_id]
|
||||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer cannot created.' + response["message"]}
|
format.html { redirect_to '/origami/'+params[:sale_id]+'/'+params[:type]+'/customers/'+params[:page], notice: 'Customer cannot created.' + response["message"]}
|
||||||
else
|
else
|
||||||
format.html { redirect_to crm_customers_path, notice: 'Customer cannot created.' + response["message"] }
|
format.html { redirect_to crm_customers_path, notice: 'Customer cannot created.' + response["message"] }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if params[:sale_id]
|
if params[:sale_id]
|
||||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created.' + response["message"]}
|
format.html { redirect_to '/origami/'+params[:sale_id]+'/'+params[:type]+'/customers/'+params[:page], notice: 'Customer was successfully created.' + response["message"]}
|
||||||
else
|
else
|
||||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created.' + response["message"] }
|
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created.' + response["message"] }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if params[:sale_id]
|
if params[:sale_id]
|
||||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created. noted'}
|
format.html { redirect_to '/origami/'+params[:sale_id]+'/'+params[:type]+'/customers/'+params[:page], notice: 'Customer was successfully created. noted'}
|
||||||
else
|
else
|
||||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created. ' }
|
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created. ' }
|
||||||
end
|
end
|
||||||
@@ -209,7 +209,7 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
|
|
||||||
if params[:sale_id]
|
if params[:sale_id]
|
||||||
flash[:errors] = @crm_customers.errors
|
flash[:errors] = @crm_customers.errors
|
||||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers'}
|
format.html { redirect_to '/origami/'+params[:sale_id]+'/'+params[:type]+'/customers/'+params[:page]}
|
||||||
format.json { render json: @crm_customers.errors, status: :unprocessable_entity }
|
format.json { render json: @crm_customers.errors, status: :unprocessable_entity }
|
||||||
else
|
else
|
||||||
flash[:errors] = @crm_customers.errors
|
flash[:errors] = @crm_customers.errors
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ class Origami::CustomersController < BaseOrigamiController
|
|||||||
|
|
||||||
@sale_id = params[:sale_id]
|
@sale_id = params[:sale_id]
|
||||||
@cashier_type = params[:type]
|
@cashier_type = params[:type]
|
||||||
|
@page = params[:page]
|
||||||
|
|
||||||
if(@sale_id[0,3] == "SAL")
|
if(@sale_id[0,3] == "SAL")
|
||||||
@booking = Booking.find_by_sale_id(@sale_id)
|
@booking = Booking.find_by_sale_id(@sale_id)
|
||||||
|
|||||||
@@ -556,12 +556,8 @@ class Sale < ApplicationRecord
|
|||||||
prefix = DateTime.now().utc
|
prefix = DateTime.now().utc
|
||||||
#self.receipt_no = prefix.to_s + "/" + self.shit_id.to_s + "/" + SeedGenerator.new_receipt_no().to_s
|
#self.receipt_no = prefix.to_s + "/" + self.shit_id.to_s + "/" + SeedGenerator.new_receipt_no().to_s
|
||||||
if !shop_details.nil?
|
if !shop_details.nil?
|
||||||
if !shop_details.client_code.nil? && shop_details.shop_code.nil?
|
if !shop_details.shop_code.nil?
|
||||||
self.receipt_no = shop_details.client_code + "-" + prefix.strftime("%Y%m%d") + "-" + SeedGenerator.new_receipt_no().to_s
|
|
||||||
elsif shop_details.client_code.nil? && !shop_details.shop_code.nil?
|
|
||||||
self.receipt_no = shop_details.shop_code + "-" + prefix.strftime("%Y%m%d") + "-" + SeedGenerator.new_receipt_no().to_s
|
self.receipt_no = shop_details.shop_code + "-" + prefix.strftime("%Y%m%d") + "-" + SeedGenerator.new_receipt_no().to_s
|
||||||
elsif !shop_details.client_code.nil? && !shop_details.shop_code.nil?
|
|
||||||
self.receipt_no = shop_details.client_code + "-" + shop_details.shop_code + "-" + prefix.strftime("%Y%m%d") + "-" + SeedGenerator.new_receipt_no().to_s
|
|
||||||
else
|
else
|
||||||
self.receipt_no = prefix.strftime("%Y%m%d") + "-" + SeedGenerator.new_receipt_no().to_s
|
self.receipt_no = prefix.strftime("%Y%m%d") + "-" + SeedGenerator.new_receipt_no().to_s
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -23,10 +23,10 @@
|
|||||||
<input type="hidden" name="type" id="type" value="">
|
<input type="hidden" name="type" id="type" value="">
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="col-lg-2 col-md-2 col-sm-2 col-xs-12"> -->
|
<!-- <div class="col-lg-2 col-md-2 col-sm-2 col-xs-12"> -->
|
||||||
<button type="submit" class="btn btn-sm bg-blue waves-effect" style="margin-right: 10px;"><%= t("views.btn.search") %></button>
|
<button type="submit" class="btn btn-sm bg-blue waves-effect" style="height: 30%;margin-right: 10px;"><%= t("views.btn.search") %></button>
|
||||||
<!-- </div> -->
|
<!-- </div> -->
|
||||||
<button type="button" id="member_acc_no" class="btn bg-green btn-sm waves-effect" style="margin-right: 10px;"><%= t("views.btn.memeber_card") %></button>
|
<button type="button" id="member_acc_no" class="btn bg-green btn-sm waves-effect" style="height: 30%;margin-right: 10px;"><%= t("views.btn.memeber_card") %></button>
|
||||||
<button type="button" id="qr_code" class="btn bg-green btn-sm waves-effect" style="margin-right: 10px;"><%= t("views.btn.qr_code") %></button>
|
<button type="button" id="qr_code" class="btn bg-green btn-sm waves-effect" style="height: 30%;margin-right: 10px;"><%= t("views.btn.qr_code") %></button>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
@@ -145,7 +145,8 @@ $(function() {
|
|||||||
$("#qr_code").on('click', function(e){
|
$("#qr_code").on('click', function(e){
|
||||||
var code = "";
|
var code = "";
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
var hi=getQRCode();
|
code=getQRCode();
|
||||||
|
setQRCode(code);
|
||||||
},100);
|
},100);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -34,12 +34,14 @@
|
|||||||
<input type="text" name="filter" style="margin-right:10px" id="search" placeholder="Search" class="form-control input-sm col-md-12">
|
<input type="text" name="filter" style="margin-right:10px" id="search" placeholder="Search" class="form-control input-sm col-md-12">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-12">
|
<!-- <div class="col-lg-2 col-md-2 col-sm-2 col-xs-12"> -->
|
||||||
<button type="submit" class="btn bg-blue waves-effect waves-effect">Search</button>
|
<button type="submit" class="btn bg-blue waves-effect waves-effect" style="height: 30%;margin-right: 10px;">Search</button>
|
||||||
</div>
|
<!-- </div> -->
|
||||||
|
|
||||||
<button type="button" id="member_acc_no" class="btn bg-green btn-sm waves-effect" style="height: 30%;margin-right: 10px;">Member Card</button>
|
<button type="button" id="member_acc_no" class="btn bg-green btn-sm waves-effect" style="height: 30%;margin-right: 10px;">Member Card</button>
|
||||||
|
|
||||||
|
<button type="button" id="qr_code" class="btn bg-green btn-sm waves-effect" style="height: 30%;margin-right: 10px;"><%= t("views.btn.qr_code") %></button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
@@ -114,6 +116,8 @@
|
|||||||
|
|
||||||
<span class="patch_method"></span>
|
<span class="patch_method"></span>
|
||||||
<input type="hidden" id="sale_id" name="sale_id" value="<%= @sale_id %>" />
|
<input type="hidden" id="sale_id" name="sale_id" value="<%= @sale_id %>" />
|
||||||
|
<input type="hidden" id="type" name="type" value="<%= @cashier_type %>" />
|
||||||
|
<input type="hidden" id="page" name="page" value="<%= @page %>" />
|
||||||
<%if !@dining_facility.nil?%>
|
<%if !@dining_facility.nil?%>
|
||||||
<input type="hidden" id="table_id" name="table_id" value="<%= @dining_facility.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 %>" />
|
<input type="hidden" id="type" name="type" value="<%= @dining_facility.type %>" />
|
||||||
@@ -262,7 +266,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var cashier_type = "<%= @cashier_type %>";
|
var cashier_type = "<%= @cashier_type %>";
|
||||||
|
var page = "<%= @page %>";
|
||||||
$(function() {
|
$(function() {
|
||||||
/*$('.datepicker').datepicker({
|
/*$('.datepicker').datepicker({
|
||||||
setDate: '12-12-1999',
|
setDate: '12-12-1999',
|
||||||
@@ -295,22 +300,23 @@
|
|||||||
getCardNo();
|
getCardNo();
|
||||||
$("#sxModal").hide();
|
$("#sxModal").hide();
|
||||||
customer_mamber_card_no = $("#search").val();
|
customer_mamber_card_no = $("#search").val();
|
||||||
|
|
||||||
if(sale_id != 0 && customer_mamber_card_no != 0){
|
if(sale_id != 0 && customer_mamber_card_no != 0){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "get_customer" ,
|
url: "/origami/"+sale_id+"/get_customer" ,
|
||||||
data: { filter : customer_mamber_card_no ,type :"card"},
|
data: { filter : customer_mamber_card_no ,type :"card"},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data[0].customer_id == false) {
|
if (data[0].customer_id == false) {
|
||||||
$.alert({
|
swal("Alert!", data[0].message, "error");
|
||||||
title: 'Alert!',
|
// $.alert({
|
||||||
content: data[0].message,
|
// title: 'Alert!',
|
||||||
type: 'red',
|
// content: data[0].message,
|
||||||
typeAnimated: true,
|
// type: 'red',
|
||||||
btnClass: 'btn-danger',
|
// typeAnimated: true,
|
||||||
});
|
// btnClass: 'btn-danger',
|
||||||
|
// });
|
||||||
}else{
|
}else{
|
||||||
customer_id = data[0].customer_id;
|
customer_id = data[0].customer_id;
|
||||||
customer_name = data[0].name;
|
customer_name = data[0].name;
|
||||||
@@ -339,13 +345,33 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// QR Code Reader
|
||||||
|
$("#qr_code").on('click', function(e){
|
||||||
|
var code = "";
|
||||||
|
setTimeout(function(){
|
||||||
|
code=getQRCode();
|
||||||
|
setQRCode(code);
|
||||||
|
},100);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Read qrcode from java
|
||||||
|
function getQRCode(){
|
||||||
|
return code2lab.readQRCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
// get QRCode from Java
|
||||||
|
function setQRCode(code){
|
||||||
|
$("#qr_code").text(code);
|
||||||
|
$("#search").val(code);
|
||||||
|
}
|
||||||
|
|
||||||
$(document).on('click',".customer_tr",function(){
|
$(document).on('click',".customer_tr",function(){
|
||||||
// if(this.checked){
|
// if(this.checked){
|
||||||
$(this).closest('tr').find('.checkbox_check').prop( "checked", true );
|
$(this).closest('tr').find('.checkbox_check').prop( "checked", true );
|
||||||
var sale_id = $("#sale_id").val() || 0;
|
var sale_id = $("#sale_id").val() || 0;
|
||||||
var customer_id = $(this).attr('data-ref');
|
var customer_id = $(this).attr('data-ref');
|
||||||
var customer_name = $(this).children("td:nth-child(3)").text();
|
var customer_name = $(this).children("td:nth-child(3)").text();
|
||||||
|
console.log(sale_id);
|
||||||
if(sale_id != 0){
|
if(sale_id != 0){
|
||||||
// var url = "/"+customer_id;
|
// var url = "/"+customer_id;
|
||||||
update_sale(customer_id, customer_name,sale_id);
|
update_sale(customer_id, customer_name,sale_id);
|
||||||
@@ -433,7 +459,7 @@
|
|||||||
}, function () {
|
}, function () {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "update_sale" ,
|
url: "/origami/"+sale_id+"/"+cashier_type+"/customers/update_sale" ,
|
||||||
data: {customer_id:customer_id,sale_id:sale_id},
|
data: {customer_id:customer_id,sale_id:sale_id},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
@@ -442,12 +468,16 @@
|
|||||||
var id = $("#table_id").val();
|
var id = $("#table_id").val();
|
||||||
var type = $("#type").val();
|
var type = $("#type").val();
|
||||||
if (cashier_type == "quick_service") {
|
if (cashier_type == "quick_service") {
|
||||||
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/customers/payment/';
|
||||||
}else{
|
}else{
|
||||||
if (type=="Table") {
|
if(page == "payment"){
|
||||||
window.location.href = '/origami/table/'+id
|
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/customers/payment/';
|
||||||
}else{
|
}else{
|
||||||
window.location.href = '/origami/room/'+id
|
if (type=="Table") {
|
||||||
|
window.location.href = '/origami/table/'+id
|
||||||
|
}else{
|
||||||
|
window.location.href = '/origami/room/'+id
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
@@ -460,17 +490,22 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$('#back').on('click',function(){
|
$('#back').on('click',function(){
|
||||||
var id = $("#table_id").val()
|
var id = $("#table_id").val();
|
||||||
var type = $("#type").val()
|
var type = $("#type").val();
|
||||||
var sale_id = $("#sale_id").val()
|
var sale_id = $("#sale_id").val();
|
||||||
if (cashier_type == "quick_service") {
|
if (cashier_type == "quick_service") {
|
||||||
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||||
}else{
|
}else{
|
||||||
if (type=="Table") {
|
if(page == "payment"){
|
||||||
window.location.href = '/origami/table/'+id
|
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||||
|
}else{
|
||||||
|
if (type=="Table") {
|
||||||
|
window.location.href = '/origami/table/'+id;
|
||||||
}else{
|
}else{
|
||||||
window.location.href = '/origami/room/'+id
|
window.location.href = '/origami/room/'+id;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -544,7 +544,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
cashier_type = "cashier"
|
var cashier_type = "cashier";
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
/* start check first bill or not*/
|
/* start check first bill or not*/
|
||||||
var receipt_no = "";
|
var receipt_no = "";
|
||||||
@@ -627,7 +627,7 @@
|
|||||||
}
|
}
|
||||||
var table_id = $('.tables').attr("data-id");
|
var table_id = $('.tables').attr("data-id");
|
||||||
|
|
||||||
window.location.href = '/origami/' + sale_id+"/"+cashier_type + "/customers"
|
window.location.href = '/origami/' + sale_id+"/"+cashier_type + "/customers/normal";
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row p-l-5 p-r-5">
|
<div class="row p-l-5 p-r-5">
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6"><strong>Customer :</strong> <%= @sale_data.customer.name%> <span class="hidden" id="membership_id"><%= @sale_data.customer.membership_id%></span>
|
<div class="col-lg-6 col-md-6 col-sm-6"><strong>Customer :</strong> <span id="customer_name"> <%= @sale_data.customer.name%></span> <span class="hidden" id="membership_id"><%= @sale_data.customer.membership_id%></span>
|
||||||
<span class="hidden" id="member_discount"><%= @member_discount%></span></div>
|
<span class="hidden" id="member_discount"><%= @member_discount%></span></div>
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6 text-left"><strong>Checkin Time : </strong> <%if !@checkin_time.nil?%><%= @checkin_time.utc.getlocal.strftime("%I:%M %p") %>
|
<div class="col-lg-6 col-md-6 col-sm-6 text-left"><strong>Checkin Time : </strong> <%if !@checkin_time.nil?%><%= @checkin_time.utc.getlocal.strftime("%I:%M %p") %>
|
||||||
<%end%></div>
|
<%end%></div>
|
||||||
@@ -424,46 +424,50 @@
|
|||||||
<div class="modal-dialog modal-md" role="document">
|
<div class="modal-dialog modal-md" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h4 class="modal-title" id="is_memberModalLabel">Is Member?</h4>
|
<h3 class="modal-title" id="is_memberModalLabel">Are you Member?</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
<div class="row text-center">
|
||||||
</div>
|
<input type="hidden" name="paypar_account_no" id="paypar_account_no" />
|
||||||
<div class="modal-footer ">
|
<input type="hidden" name="qr_code" id="qr_code" />
|
||||||
<div class="row p-r-20">
|
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
|
||||||
<div class="col-md-4">
|
<button type="button" class="btn btn-lg btn-link bg-green waves-effect btn_customer_yes">Yes</button>
|
||||||
<button type="button" class="btn btn-link bg-green waves-effect">Yes</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-4">
|
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
|
||||||
<button type="button" class="btn btn-link bg-red waves-effect" data-dismiss="modal">No</button>
|
<button type="button" class="btn btn-lg btn-link bg-red waves-effect" data-dismiss="modal">No</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-4">
|
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
|
||||||
<button type="button" class="btn btn-link bg-primary waves-effect">Member</button>
|
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_member">Member</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-4">
|
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
|
||||||
<button type="button" class="btn btn-link bg-primary waves-effect">QR</button>
|
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_qr_code">QR</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-footer"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="sxModal">
|
||||||
|
<div id="sxModal-Content"><h3>Card Tap</h3></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var cashier_type = "<%= @cashier_type %>";
|
var cashier_type = "<%= @cashier_type %>";
|
||||||
var customer_id = "<%= @customer.id %>";
|
var customer_id = "<%= @customer.id %>";
|
||||||
var customer_name = "<%= @customer.name %>";
|
var customer_name = "<%= @customer.name %>";
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
console.log(customer_name);
|
//start customer modal popup
|
||||||
console.log(customer_id);
|
if((customer_id!=undefined) && (customer_id!=null) && (customer_id!="")){
|
||||||
// if((customer_id == 'CUS-000000000001') && (customer_name == 'WALK-IN')){
|
if((customer_id == 'CUS-000000000001') && (customer_name == 'WALK-IN')){
|
||||||
// $("#is_memberModal").modal({show : true, backdrop: false, keyboard : false});
|
$("#is_memberModal").modal({show : true, backdrop: false, keyboard : false});
|
||||||
// }
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* start check first bill or not*/
|
/* start check first bill or not*/
|
||||||
var member_id = $('#membership_id').text();
|
var member_id = $('#membership_id').text();
|
||||||
var member_discount = $('#member_discount').text();
|
var member_discount = $('#member_discount').text();
|
||||||
@@ -970,4 +974,112 @@ var customer_name = "<%= @customer.name %>";
|
|||||||
window.location.href = '/origami/quick_service';
|
window.location.href = '/origami/quick_service';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(".btn_customer_yes").on('click',function(){
|
||||||
|
var sale_id = $('#sale_id').text();
|
||||||
|
window.location.href = "/origami/"+sale_id+"/"+cashier_type+"/customers/payment";
|
||||||
|
});
|
||||||
|
|
||||||
|
// Read Card Reader
|
||||||
|
$(".btn_member").on('click', function(){
|
||||||
|
var cardNo = "";
|
||||||
|
var customer_id = '';
|
||||||
|
var customer_name = '';
|
||||||
|
var membership_id = '';
|
||||||
|
var membership_type = '';
|
||||||
|
var sale_id = $("#sale_id").text() || 0;
|
||||||
|
var customer_mamber_card_no = 0;
|
||||||
|
|
||||||
|
$("#is_memberModal").hide();
|
||||||
|
$("#sxModal").show();
|
||||||
|
setTimeout(function(){
|
||||||
|
getCardNo();
|
||||||
|
$("#sxModal").hide();
|
||||||
|
customer_mamber_card_no = $("#paypar_account_no").val();
|
||||||
|
|
||||||
|
if(sale_id != 0 && customer_mamber_card_no != 0){
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/origami/"+sale_id+"/get_customer" ,
|
||||||
|
data: { filter : customer_mamber_card_no ,type :"card"},
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data) {
|
||||||
|
if (data[0].customer_id == false) {
|
||||||
|
swal("Alert!", data[0].message, "error");
|
||||||
|
}else{
|
||||||
|
customer_id = data[0].customer_id;
|
||||||
|
customer_name = data[0].name;
|
||||||
|
membership_id = data[0].membership_id;
|
||||||
|
membership_type = data[0].membership_type;
|
||||||
|
update_sale(membership_id, customer_id, customer_name,sale_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},100);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Read NFC card no from java
|
||||||
|
function getCardNo(){
|
||||||
|
code2lab.readNFC();
|
||||||
|
}
|
||||||
|
|
||||||
|
// get CardNo from Java
|
||||||
|
function setCardNo(cardNo){
|
||||||
|
if(cardNo.length == 16){
|
||||||
|
$("#paypar_account_no").val(cardNo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// QR Code Reader
|
||||||
|
$(".btn_qr_code").on('click', function(e){
|
||||||
|
$("#is_memberModal").hide();
|
||||||
|
var code = "";
|
||||||
|
setTimeout(function(){
|
||||||
|
code=getQRCode();
|
||||||
|
$("#qr_code").val(code);
|
||||||
|
},100);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Read qrcode from java
|
||||||
|
function getQRCode(){
|
||||||
|
return code2lab.readQRCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
function update_sale(membership_id, customer_id, customer_name, sale_id) {
|
||||||
|
var customer="";
|
||||||
|
if(customer_name != ""){
|
||||||
|
customer = '(' + customer_name + ')';
|
||||||
|
}
|
||||||
|
|
||||||
|
swal({
|
||||||
|
title: "Confirmation !",
|
||||||
|
text: 'Are You Sure to assign this customer' + customer + '!',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "green",
|
||||||
|
confirmButtonText: "Yes!",
|
||||||
|
cancelButtonClass: 'btn btn-danger',
|
||||||
|
closeOnConfirm: false,
|
||||||
|
}, function () {
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/origami/"+sale_id+"/"+cashier_type+"/customers/update_sale" ,
|
||||||
|
data: {customer_id:customer_id,sale_id:sale_id},
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data) {
|
||||||
|
if(data.status == true)
|
||||||
|
{
|
||||||
|
//change customer detail
|
||||||
|
$("#customer_name").html(customer_name);
|
||||||
|
$("#membership_id").html(membership_id);
|
||||||
|
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||||
|
}else{
|
||||||
|
swal("Alert!", "Record not found!", "error");
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -486,6 +486,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
|
var cashier_type = "cashier";
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
// $(".tables").on('click', function(){
|
// $(".tables").on('click', function(){
|
||||||
// var customer_id=$(".customer-id").text();
|
// var customer_id=$(".customer-id").text();
|
||||||
@@ -593,7 +594,7 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
var table_id = $('.tables').attr("data-id");
|
var table_id = $('.tables').attr("data-id");
|
||||||
|
|
||||||
window.location.href = '/origami/'+ sale_id + "/customers"
|
window.location.href = '/origami/' + sale_id+"/"+cashier_type + "/customers/normal";
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -199,9 +199,9 @@ scope "(:locale)", locale: /en|mm/ do
|
|||||||
|
|
||||||
#---------Add Customer --------------#
|
#---------Add Customer --------------#
|
||||||
#resources :customers
|
#resources :customers
|
||||||
get '/:sale_id/:type/customers', to: "customers#add_customer"
|
get '/:sale_id/:type/customers/:page', to: "customers#add_customer"
|
||||||
get '/:customer_id/get_customer' => 'home#get_customer', :as => "show_customer_details"
|
get '/:customer_id/get_customer' => 'home#get_customer', :as => "show_customer_details"
|
||||||
post '/:sale_id/:type/update_sale', to: "customers#update_sale_by_customer" # update customer id in sale table
|
post '/:sale_id/:type/customers/update_sale', to: "customers#update_sale_by_customer" # update customer id in sale table
|
||||||
|
|
||||||
post '/:sale_id/get_customer' => "customers#get_customer"
|
post '/:sale_id/get_customer' => "customers#get_customer"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user