diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index 32054b53..1df7a16e 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -880,13 +880,24 @@ $(function() { dataType: "json", success:function(result){ if (result.status) { + console.log(result) if (result.data == null){ - window.location.href = '/origami/quick_service/pending_order/' + $('#sale_id').text(); + swal({ + title: "Please Open Shift !", + text: result.status, + type: "warning", + confirmButtonColor: "#DD6B55", + confirmButtonText: "Ok", + closeOnConfirm: false + }, function () { + window.location.href = '/origami/quick_service/pending_order/' + $('#sale_id').text(); + }); + }else{ window.location.href = "/origami/sale/"+result.data["sale_id"]+"/"+type+"/payment" } } - } + } }); }); diff --git a/app/controllers/crm/customers_controller.rb b/app/controllers/crm/customers_controller.rb index eb9dc653..3082687b 100755 --- a/app/controllers/crm/customers_controller.rb +++ b/app/controllers/crm/customers_controller.rb @@ -143,7 +143,7 @@ class Crm::CustomersController < BaseCrmController :body => member_params, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10 ) @@ -269,7 +269,7 @@ end :body => member_params, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10 ) @@ -328,7 +328,7 @@ end :body => member_params, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10 ) diff --git a/app/controllers/origami/discounts_controller.rb b/app/controllers/origami/discounts_controller.rb index 59da5387..8e390015 100755 --- a/app/controllers/origami/discounts_controller.rb +++ b/app/controllers/origami/discounts_controller.rb @@ -273,7 +273,7 @@ class Origami::DiscountsController < BaseOrigamiController auth_token:auth_token}.to_json, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10) rescue HTTParty::Error response = {"status": false, "message": "Can't open membership server " } diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 8c83a356..c764b92f 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -63,9 +63,9 @@ class Origami::PaymentsController < BaseOrigamiController # get member information rebate = MembershipSetting.find_by_rebate(1) if customer.membership_id != nil && rebate - member_info = Customer.get_member_account(customer) - current_balance = SaleAudit.paymal_search(sale_id) - # current_balance = 0 + # member_info = Customer.get_member_account(customer) + # current_balance = SaleAudit.paymal_search(sale_id) + current_balance = 0 end # get printer info print_settings=PrintSetting.find_by_unique_code(unique_code) @@ -152,8 +152,10 @@ class Origami::PaymentsController < BaseOrigamiController if customer.membership_id != nil && rebate && credit_data.nil? member_info = Customer.get_member_account(customer) - rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no) - current_balance = SaleAudit.paymal_search(sale_id) + if member_info["status"] == true + rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no) + current_balance = SaleAudit.paymal_search(sale_id) + end end #for card sale data diff --git a/app/controllers/origami/request_bills_controller.rb b/app/controllers/origami/request_bills_controller.rb index 3bc08681..aa145b4f 100755 --- a/app/controllers/origami/request_bills_controller.rb +++ b/app/controllers/origami/request_bills_controller.rb @@ -8,9 +8,7 @@ class Origami::RequestBillsController < ApplicationController if !ShiftSale.current_shift.nil? order_id = params[:id] # order_id bk_order = BookingOrder.find_by_order_id(order_id) - puts params[:id] - puts bk_order - puts bk_order.booking_id + order = Order.find(order_id) check_booking = Booking.find_by_booking_id(bk_order.booking_id) if check_booking.sale_id.nil? @@ -29,6 +27,10 @@ class Origami::RequestBillsController < ApplicationController # Promotion Activation Promotion.promo_activate(@sale) + if order.source == "quick_service" + result = {:status=> @status, :data => @sale.sale_id } + render :json => result.to_json + end else @status = false @error_message = "No Current Open Shift for This Employee" diff --git a/app/controllers/origami/voucher_controller.rb b/app/controllers/origami/voucher_controller.rb index c4b3c840..25352597 100755 --- a/app/controllers/origami/voucher_controller.rb +++ b/app/controllers/origami/voucher_controller.rb @@ -54,7 +54,7 @@ class Origami::VoucherController < BaseOrigamiController }.to_json, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10 ) rescue Net::OpenTimeout diff --git a/app/models/customer.rb b/app/models/customer.rb index 7f5a7a63..934d371f 100755 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -34,7 +34,7 @@ class Customer < ApplicationRecord }.to_json, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10) rescue HTTParty::Error @@ -71,7 +71,7 @@ class Customer < ApplicationRecord }.to_json, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10 ) @@ -124,7 +124,7 @@ class Customer < ApplicationRecord :body => member_params, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }) rescue Net::OpenTimeout response = { status: false, message: "Server Time out" } @@ -201,7 +201,7 @@ class Customer < ApplicationRecord }.to_json, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10) rescue Net::OpenTimeout response = { "status": false , "message": "Connect To" } @@ -277,7 +277,7 @@ class Customer < ApplicationRecord }.to_json, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10) rescue Net::OpenTimeout response = { "status": false , "message": "Connect To" } @@ -312,7 +312,7 @@ class Customer < ApplicationRecord }.to_json, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10 ) diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index 1866a630..5809dc0f 100755 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -85,7 +85,7 @@ class SalePayment < ApplicationRecord }.to_json, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10 ) rescue Net::OpenTimeout @@ -133,7 +133,7 @@ class SalePayment < ApplicationRecord auth_token:auth_token}.to_json, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10 ) @@ -455,7 +455,7 @@ class SalePayment < ApplicationRecord }.to_json, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10) rescue Net::OpenTimeout response = { "status": false , "message": " Connection timeout" } @@ -500,7 +500,8 @@ class SalePayment < ApplicationRecord end rebate_arr.push(data) end - + Rails.logger.debug "Rebage Response" + Rails.logger.debug rebate_arr.to_json total_amount = rebate_prices - payparcost - overall_dis if credit == 1 @@ -531,7 +532,7 @@ class SalePayment < ApplicationRecord }.to_json, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10) rescue Net::OpenTimeout response = { "status": false , "message": "Connect To" } diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index e3e7adda..11d62573 100755 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -10,6 +10,7 @@ --> +<%if !request.path_info.include?('second_display') %> - +<%end%> \ No newline at end of file diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 194ac82e..8c2e58bc 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -134,7 +134,7 @@