Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into staging

This commit is contained in:
Aung Myo
2017-07-27 14:04:40 +06:30
9 changed files with 75 additions and 38 deletions

View File

@@ -128,8 +128,15 @@ class Crm::CustomersController < BaseCrmController
end
# format.json { render :index, status: :created, location: @crm_customers }
else
customer = Customer.find(@crm_customers.customer_id)
status = customer.update_attributes(membership_type:member_group_id )
customer = Customer.find(@crm_customers.customer_id)
# Check membership id and bind to user
if response["membership_id"] != nil
status = customer.update_attributes(membership_id: response["membership_id"],membership_type:member_group_id )
else
status = customer.update_attributes(membership_type:member_group_id)
end
if params[:sale_id]
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created.' + response["message"]}
else
@@ -208,16 +215,18 @@ end
end
if response["status"] == true
customer = Customer.find(@crm_customer.customer_id)
status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id )
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated'}
else
customer = Customer.find(@crm_customer.customer_id)
status = customer.update_attributes(membership_type:member_group_id )
# Check membership id and bind to user
if response["membership_id"] != nil
status = customer.update_attributes(membership_id: response["membership_id"],membership_type:member_group_id )
else
status = customer.update_attributes(membership_type:member_group_id)
end
format.html { redirect_to crm_customers_path, notice: response["error"] }
end
@@ -255,6 +264,12 @@ end
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated.' }
format.json { render :show, status: :ok, location: @crm_customer }
else
# Check membership id and bind to user
if response["membership_id"] != nil
status = customer.update_attributes(membership_id: response["membership_id"],membership_type:member_group_id )
else
status = customer.update_attributes(membership_type:member_group_id)
end
format.html { redirect_to crm_customers_path, notice: response["message"] }
end

View File

@@ -10,7 +10,7 @@ class Customer < ApplicationRecord
validates :contact_no, uniqueness: true
validates :email, uniqueness: true
validates :card_no, uniqueness: true
# validates :paypar_account_no
validates :paypar_account_no, uniqueness: true
paginates_per 50

View File

@@ -249,7 +249,7 @@ class Sale < ApplicationRecord
if item.remark != 'void'
#compute each item and added to total
subtotal_price = subtotal_price + item.price
total_taxable = total_taxable + item.taxable_price
total_taxable = total_taxable + item.price
end
end

View File

@@ -128,10 +128,9 @@
<script type="text/javascript">
$(function() {
// Read Card Reader
$("#paypar_account_no").on('focus', function(e){
var cardNo = "";
$("#sxModal").show();
$("#paypar_account_no").on('focus', function(e){
if($(this).val() == ''){
$("#sxModal").show();
setTimeout(function(){
getCardNo();
$("#sxModal").hide();

View File

@@ -216,12 +216,14 @@
$('.datepicker').css('cursor','pointer');
// Read Card Reader
$("#paypar_account_no").on('focus', function(e){
$("#sxModal").show();
setTimeout(function(){
getCardNo();
$("#sxModal").hide();
},100);
$("#paypar_account_no").on('focus', function(e){
if($(this).val() == ''){
$("#sxModal").show();
setTimeout(function(){
getCardNo();
$("#sxModal").hide();
},100);
}
});
// Read Card Reader