From 9f0bef732eb530afa2a3912a1f14b6947fb4b1db Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 13 Mar 2018 14:23:23 +0630 Subject: [PATCH 1/6] update change version v3 for api paymal --- app/controllers/crm/customers_controller.rb | 6 +++--- app/controllers/origami/discounts_controller.rb | 2 +- app/controllers/origami/payments_controller.rb | 6 +++--- app/controllers/origami/voucher_controller.rb | 2 +- app/models/customer.rb | 12 ++++++------ app/models/sale_payment.rb | 11 ++++++----- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/app/controllers/crm/customers_controller.rb b/app/controllers/crm/customers_controller.rb index 83a437a2..55eed487 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 24b2c83f..0c2fbef5 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 563decfe..a5a96e43 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) diff --git a/app/controllers/origami/voucher_controller.rb b/app/controllers/origami/voucher_controller.rb index 750189df..c0a9e96d 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 fcdd7f31..59ab8841 100755 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -31,7 +31,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 @@ -68,7 +68,7 @@ class Customer < ApplicationRecord }.to_json, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10 ) @@ -121,7 +121,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" } @@ -198,7 +198,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" } @@ -274,7 +274,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" } @@ -309,7 +309,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" } From a95fc4d07a30da09dad8c80131471f080103b922 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 13 Mar 2018 14:43:58 +0630 Subject: [PATCH 2/6] update payment controller if member --- app/controllers/origami/payments_controller.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index a5a96e43..79c084a6 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -152,8 +152,17 @@ 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) + puts member_info["status"] + if member_info["status"] == true + rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no) + current_balance = SaleAudit.paymal_search(sale_id) + else + rebate_amount = 0 + current_balance = 0 + member_info =nil + end + # rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no) + # current_balance = SaleAudit.paymal_search(sale_id) end #for card sale data From bf1b7ecb561334405c8601bdeb9206965604ea8b Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 13 Mar 2018 14:59:23 +0630 Subject: [PATCH 3/6] update payment controller if member --- app/controllers/origami/payments_controller.rb | 7 ------- 1 file changed, 7 deletions(-) diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 79c084a6..4508c582 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -152,17 +152,10 @@ class Origami::PaymentsController < BaseOrigamiController if customer.membership_id != nil && rebate && credit_data.nil? member_info = Customer.get_member_account(customer) - puts member_info["status"] if member_info["status"] == true rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no) current_balance = SaleAudit.paymal_search(sale_id) - else - rebate_amount = 0 - current_balance = 0 - member_info =nil end - # rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no) - # current_balance = SaleAudit.paymal_search(sale_id) end #for card sale data From 44389d485a4ac3ec4866e7546f523ed51b129eea Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 13 Mar 2018 17:38:25 +0630 Subject: [PATCH 4/6] update request bill reload in quick service --- app/controllers/origami/request_bills_controller.rb | 8 +++++--- app/views/origami/pending_order/show.html.erb | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/controllers/origami/request_bills_controller.rb b/app/controllers/origami/request_bills_controller.rb index 409177fe..f6dd4e14 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/views/origami/pending_order/show.html.erb b/app/views/origami/pending_order/show.html.erb index fade7ccb..d7c929f7 100644 --- a/app/views/origami/pending_order/show.html.erb +++ b/app/views/origami/pending_order/show.html.erb @@ -203,11 +203,12 @@ $(document).ready(function(){ url: ajax_url, // data: 'order_id='+ order_id, success: function (result) { + console.log(result) if (!result.status) { swal("Information!", result.error_message); } else { - location.reload(); + window.location.href = '../pending_order/'+ result.data; } } }); From cf5a85fa5c330cb57e46c27312838e39afdc8ad0 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Wed, 14 Mar 2018 13:51:31 +0630 Subject: [PATCH 5/6] update migrate for sale audit remark --- config/initializers/action_controller.rb | 10 +++++----- db/migrate/20170403174111_create_sale_audits.rb | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config/initializers/action_controller.rb b/config/initializers/action_controller.rb index 8f310dab..02e35bb8 100644 --- a/config/initializers/action_controller.rb +++ b/config/initializers/action_controller.rb @@ -20,11 +20,11 @@ class ActionController::Base end else # check for license file - if check_license - current_license(ENV["SX_PROVISION_URL"]) - else - redirect_to activate_path - end + # if check_license + # current_license(ENV["SX_PROVISION_URL"]) + # else + # redirect_to activate_path + # end end end diff --git a/db/migrate/20170403174111_create_sale_audits.rb b/db/migrate/20170403174111_create_sale_audits.rb index e1dcfffd..1cf609df 100755 --- a/db/migrate/20170403174111_create_sale_audits.rb +++ b/db/migrate/20170403174111_create_sale_audits.rb @@ -9,7 +9,7 @@ class CreateSaleAudits < ActiveRecord::Migration[5.1] t.string :action_by, :null => false t.string :approved_by, :null => true t.datetime :approved_at, :null => true - t.string :remark + t.text :remark t.timestamps end end From 6ec03e3454746a0f6f017d430c59d84699a4c8c9 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Wed, 14 Mar 2018 17:52:23 +0630 Subject: [PATCH 6/6] update today issue --- app/assets/javascripts/addorder.js | 15 +++++++++++++-- app/views/layouts/_header.html.erb | 3 ++- app/views/origami/addorders/detail.html.erb | 5 +++++ app/views/origami/dashboard/index.html.erb | 13 +++++++++++-- app/views/origami/home/show.html.erb | 8 ++++---- app/views/origami/orders/show.html.erb | 2 +- .../second_display/_second_display.html.erb | 2 +- app/views/origami/second_display/index.html.erb | 2 +- 8 files changed, 38 insertions(+), 12 deletions(-) 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/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 @@
<% @orders.each do |order| %> -
+
text-white" data-id="<%= order.order_id %>">
<% order_status = "" @@ -424,7 +424,7 @@ reply <%= t("views.btn.back") %> - Customer View + <% if @dining.status != "available" %> @@ -491,11 +491,11 @@