From c22fc3e86e87ad082b3c49097e119f63e84ffb62 Mon Sep 17 00:00:00 2001 From: Yan Date: Wed, 18 Apr 2018 14:17:37 +0630 Subject: [PATCH 1/6] add pdf viewer and test doemal --- Gemfile | 1 + Gemfile.lock | 6 ++++++ app/controllers/api/api_controller.rb | 2 +- app/controllers/concerns/token_verification.rb | 4 ++-- app/views/origami/payments/show.html.erb | 7 +++++-- config/routes.rb | 2 ++ config/shops.json | 11 +++++++++-- 7 files changed, 26 insertions(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index 41682d12..6005cae2 100644 --- a/Gemfile +++ b/Gemfile @@ -52,6 +52,7 @@ gem 'rubyzip', '= 1.0.0' gem 'axlsx', '= 2.0.1' gem 'axlsx_rails' gem 'roo' +gem 'pdfjs_viewer-rails' #Reporting gem #gem 'compendium' #gem "cancan" diff --git a/Gemfile.lock b/Gemfile.lock index eee001d1..b7f4b2ca 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -125,6 +125,7 @@ GEM thor (>= 0.14, < 2.0) jquery-ui-rails (6.0.1) railties (>= 3.2.16) + json (2.1.0) kaminari (1.0.1) activesupport (>= 4.1.0) kaminari-actionview (= 1.0.1) @@ -168,6 +169,10 @@ GEM nokogiri (1.8.1) mini_portile2 (~> 2.3.0) pdf-core (0.7.0) + pdfjs_viewer-rails (0.2.0) + json (> 1.8.4) + rails (> 4.2.0) + sass-rails (~> 5.0) pg (0.21.0) prawn (2.2.2) pdf-core (~> 0.7.0) @@ -333,6 +338,7 @@ DEPENDENCIES momentjs-rails mysql2 (>= 0.3.18, < 0.5) nested_form + pdfjs_viewer-rails pg prawn prawn-table diff --git a/app/controllers/api/api_controller.rb b/app/controllers/api/api_controller.rb index 973fc159..2340abd4 100755 --- a/app/controllers/api/api_controller.rb +++ b/app/controllers/api/api_controller.rb @@ -1,7 +1,7 @@ class Api::ApiController < ActionController::API include TokenVerification - before_action :lookup_domain + # before_action :lookup_domain helper_method :current_token, :current_login_employee, :get_cashier private diff --git a/app/controllers/concerns/token_verification.rb b/app/controllers/concerns/token_verification.rb index 2c17e258..f8602ded 100755 --- a/app/controllers/concerns/token_verification.rb +++ b/app/controllers/concerns/token_verification.rb @@ -13,12 +13,12 @@ module TokenVerification authenticate_token || render_unauthorized end - def authenticate_token + def authenticate_token authenticate_with_http_token do |token, options| # Rails.logger.debug "token - " + token.to_s if(options.length !=0 && options["from"] == "DOEMAL") if(ENV["SERVER_MODE"] === "cloud") - from = request.subdomain.downcase + "." + request.domain.downcase + from = "local" #request.subdomain.downcase + "." + request.domain.downcase aes = MyAesCrypt.new return aes.checkKeyForAuth(from, token) end diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index 1f87ca65..18b7b69d 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -631,6 +631,8 @@ var customer_name = "<%= @customer.name %>"; if (credit <= 0) { calculate_member_discount(sale_id); } + + $("#pdfModal").modal({show : true, backdrop : false, keyboard : false}); $.ajax({type: "POST", url: "<%= origami_payment_cash_path %>", @@ -651,13 +653,14 @@ var customer_name = "<%= @customer.name %>"; var msg = ''; } - $("#loading_wrapper" ).hide(); + $("#loading_wrapper" ).hide(); //PDF lightbox data + var pdfPath = "/en/pdfjs/minimal?file=" + result.filename.substring(6); $("#sale_receipt_no").val(result.receipt_no); $("#filename").val(result.filename); $("#printer_name").val(result.printer_name); - $("#receipt_pdf").attr("src", result.filename.substring(6)); + $("#receipt_pdf").attr("src", pdfPath); $("#pdfModal").modal({show : true, backdrop : false, keyboard : false}); $("#pdfModalLabel").text("Sale Completed"); $("#changed_amount").text(""); diff --git a/config/routes.rb b/config/routes.rb index 444e961a..0e868e3b 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,6 +6,8 @@ scope "(:locale)", locale: /en|mm/ do root 'home#index' mount Sidekiq::Web => '/kiq' + mount PdfjsViewer::Rails::Engine => "/pdfjs", as: 'pdfjs' + # Action Cable Creation # if ENV["SERVER_MODE"] != "cloud" mount ActionCable.server => "/cable" diff --git a/config/shops.json b/config/shops.json index b3369529..65755243 100644 --- a/config/shops.json +++ b/config/shops.json @@ -3,8 +3,15 @@ { "lookup": "local", "value": { - "key": "999d675168d813d5e1c7", - "iv": "999d675168d813d5e1c7" + "key": "999d675168d813d5e1c7", + "iv": "999d675168d813d5e1c7" + } + }, + { + "lookup": "demo10.pos-myanmar.com", + "value": { + "key": "634W2ioj6QA88vafKamHBRu5aKX/BLIPdTWuuXGFBsA=\n", + "iv": "QqpO/h7o60dYTbNETRbZ4g==\n" } } ] From 5816a48d3250f3dc94c38773f4454a515c483e79 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Wed, 18 Apr 2018 14:40:53 +0630 Subject: [PATCH 2/6] update dinga and paymal --- .../origami/customers_controller.rb | 2 ++ app/controllers/origami/dinga_controller.rb | 25 ++++++------- app/controllers/origami/paymal_controller.rb | 3 +- app/models/sale_payment.rb | 21 ++++++++--- app/views/origami/dinga/index.html.erb | 36 ++++++++++--------- .../origami/order_reservation/index.html.erb | 2 +- app/views/origami/payments/show.html.erb | 19 +++++----- 7 files changed, 64 insertions(+), 44 deletions(-) diff --git a/app/controllers/origami/customers_controller.rb b/app/controllers/origami/customers_controller.rb index fefb973e..537703a1 100755 --- a/app/controllers/origami/customers_controller.rb +++ b/app/controllers/origami/customers_controller.rb @@ -169,6 +169,8 @@ class Origami::CustomersController < BaseOrigamiController sale_audit = SaleAudit.record_audit_for_edit(sale.sale_id,sale.cashier_id, action_by,remark,"PAYBYACCOUNT" ) end @out = membership_data + + render json: JSON.generate({:status => membership_data["status"], :message => membership_data["message"]}) end end end diff --git a/app/controllers/origami/dinga_controller.rb b/app/controllers/origami/dinga_controller.rb index 448b39dd..586403f9 100644 --- a/app/controllers/origami/dinga_controller.rb +++ b/app/controllers/origami/dinga_controller.rb @@ -4,32 +4,32 @@ class Origami::DingaController < BaseOrigamiController payment_method = params[:payment_method] @cashier_type = params[:type] @membership_rebate_balance=0 - sale_data = Sale.find_by_sale_id(@sale_id) - @receipt_no = sale_data.receipt_no + @sale_data = Sale.find_by_sale_id(@sale_id) + @receipt_no = @sale_data.receipt_no @shop = Shop.first # if @shop.is_rounding_adj - # new_total = Sale.get_rounding_adjustment(sale_data.grand_total) + # new_total = Sale.get_rounding_adjustment(@sale_data.grand_total) # else - # new_total = sale_data.grand_total + # new_total = @sale_data.grand_total # end - # @rounding_adj = new_total-sale_data.grand_total - @rounding_adj = sale_data.rounding_adjustment + # @rounding_adj = new_total-@sale_data.grand_total + @rounding_adj = @sale_data.rounding_adjustment @payparcount = 0 others = 0 - sale_data.sale_payments.each do |sale_payment| + @sale_data.sale_payments.each do |sale_payment| if sale_payment.payment_method == "dinga" @payparcount = @payparcount + sale_payment.payment_amount else others = others + sale_payment.payment_amount end end - @payment_prices = sale_data.grand_total - @payparcount -others + @payment_prices = @sale_data.grand_total - @payparcount -others - if sale_data - if sale_data.customer_id - customer_data= Customer.find_by_customer_id(sale_data.customer_id) + if @sale_data + if @sale_data.customer_id + customer_data= Customer.find_by_customer_id(@sale_data.customer_id) if customer_data @membership_id = customer_data.membership_id if !@membership_id.nil? @@ -73,6 +73,7 @@ def create cash = params[:payment_amount] sale_id = params[:sale_id] transaction_ref = params[:transaction_ref] + account_no = params[:account_no] if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) shop_details = Shop.first @@ -85,7 +86,7 @@ def create # saleObj = Sale.find(sale_id) sale_payment = SalePayment.new - status, @sale = sale_payment.process_payment(saleObj, @user, cash, "dinga",transaction_ref) + status, @sale = sale_payment.process_payment(saleObj, @user, cash, "dinga",account_no) if status == true @out = true, "Success!" else diff --git a/app/controllers/origami/paymal_controller.rb b/app/controllers/origami/paymal_controller.rb index 65af0c3b..499a0625 100644 --- a/app/controllers/origami/paymal_controller.rb +++ b/app/controllers/origami/paymal_controller.rb @@ -73,6 +73,7 @@ def create cash = params[:payment_amount] sale_id = params[:sale_id] transaction_ref = params[:transaction_ref] + account_no = params[:account_no] if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) shop_details = Shop.first @@ -86,7 +87,7 @@ def create # saleObj = Sale.find(sale_id) sale_payment = SalePayment.new - status, @sale = sale_payment.process_payment(saleObj, @user, cash, "paymal",transaction_ref) + status, @sale = sale_payment.process_payment(saleObj, @user, cash, "paymal",account_no) if status == true @out = true, "Success!" else diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index 201a1b57..50599f68 100755 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -214,7 +214,7 @@ class SalePayment < ApplicationRecord # Control for Paypar Cloud begin response = HTTParty.post(url, - :body => { membership_id:membership_id, + :body => { account_no:membership_id, amount:received_amount, receipt_no:sale_data.receipt_no, merchant_uid:merchant_uid, @@ -242,7 +242,7 @@ class SalePayment < ApplicationRecord response =false; end - Rails.logger.debug "Payment response" + Rails.logger.debug "Create Payment response" Rails.logger.debug response.to_json return response; @@ -391,8 +391,13 @@ class SalePayment < ApplicationRecord #Next time - validate if the vochure number is valid - within customer_data = Customer.find_by_customer_id(self.sale.customer_id) + + account_no = self.payment_reference + if account_no == 0 + account_no = customer_data.customer_id + end membership_setting = MembershipSetting.find_by_membership_type("paypar_url") - membership_data = SalePayment.create_payment(membership_setting.gateway_url,membership_setting.auth_token,customer_data.membership_id,self.received_amount,self.sale.sale_id) + membership_data = SalePayment.create_payment(membership_setting.gateway_url,membership_setting.auth_token,account_no,self.received_amount,self.sale.sale_id) #record an payment in sale-audit remark = "#{membership_data} PayMal Payment- for Customer #{self.sale.customer_id} Sale Id [#{self.sale.sale_id}]| pay amount -> #{self.received_amount} " @@ -433,9 +438,17 @@ class SalePayment < ApplicationRecord payment_status = false #Next time - validate if the vochure number is valid - within + customer_data = Customer.find_by_customer_id(self.sale.customer_id) + + account_no = self.payment_reference + if account_no == 0 + account_no = customer_data.customer_id + end + + membership_setting = MembershipSetting.find_by_membership_type("paypar_url") - membership_data = SalePayment.create_payment(membership_setting.gateway_url,membership_setting.auth_token,customer_data.membership_id,self.received_amount,self.sale.sale_id) + membership_data = SalePayment.create_payment(membership_setting.gateway_url,membership_setting.auth_token,account_no,self.received_amount,self.sale.sale_id) #record an payment in sale-audit remark = "#{membership_data} Dinga Payment- for Customer #{self.sale.customer_id} Sale Id [#{self.sale.sale_id}]| pay amount -> #{self.received_amount} " diff --git a/app/views/origami/dinga/index.html.erb b/app/views/origami/dinga/index.html.erb index 6a4fc12b..1bd18f39 100644 --- a/app/views/origami/dinga/index.html.erb +++ b/app/views/origami/dinga/index.html.erb @@ -46,6 +46,8 @@ + +
DINGA
- <% if @paymalcount != 0.0 %> + <% if @dingacount != 0.0 %>
<%= number_with_precision(@dingacount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>
<% else %>
<%= number_with_precision(0, precision: precision.to_i ) %>
From 2a26abff9ad823164ce7308f2be34e9efe2da296 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Wed, 18 Apr 2018 16:47:38 +0630 Subject: [PATCH 3/6] finished dinga and paymal payment --- app/controllers/origami/paymal_controller.rb | 1 + app/models/sale_payment.rb | 46 ++++++++++++-------- app/views/origami/dinga/index.html.erb | 24 +++++----- app/views/origami/paymal/index.html.erb | 19 +++++--- 4 files changed, 55 insertions(+), 35 deletions(-) diff --git a/app/controllers/origami/paymal_controller.rb b/app/controllers/origami/paymal_controller.rb index 499a0625..1321cf87 100644 --- a/app/controllers/origami/paymal_controller.rb +++ b/app/controllers/origami/paymal_controller.rb @@ -74,6 +74,7 @@ def create sale_id = params[:sale_id] transaction_ref = params[:transaction_ref] account_no = params[:account_no] + puts params.to_json if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) shop_details = Shop.first diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index 50599f68..29d755d7 100755 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -197,13 +197,14 @@ class SalePayment < ApplicationRecord def self.create_payment(paypar_url,token,membership_id,received_amount,sale_id) membership_actions_data = MembershipAction.find_by_membership_type("create_payment"); - + sale_data = Sale.find_by_sale_id(sale_id) + customer_data = Customer.find_by_customer_id(sale_data.customer_id) if !membership_actions_data.nil? url = paypar_url.to_s + membership_actions_data.gateway_url.to_s merchant_uid = membership_actions_data.merchant_account_id auth_token = membership_actions_data.auth_token - sale_data = Sale.find_by_sale_id(sale_id) + if sale_data others = 0 @@ -211,14 +212,27 @@ class SalePayment < ApplicationRecord others = others + sale_payment.payment_amount end payment_prices = sale_data.grand_total - others - # Control for Paypar Cloud - begin - response = HTTParty.post(url, - :body => { account_no:membership_id, + + if membership_id.to_i <= 0 + membership_id = customer_data.membership_id + params = { membership_id:membership_id, amount:received_amount, receipt_no:sale_data.receipt_no, merchant_uid:merchant_uid, - auth_token:auth_token}.to_json, + auth_token:auth_token}.to_json + else + params = { account_no:membership_id, + amount:received_amount, + receipt_no:sale_data.receipt_no, + merchant_uid:merchant_uid, + auth_token:auth_token}.to_json + end + + + # Control for Paypar Cloud + begin + response = HTTParty.post(url, + :body => params, :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json; version=3' @@ -390,12 +404,11 @@ class SalePayment < ApplicationRecord payment_status = false #Next time - validate if the vochure number is valid - within - customer_data = Customer.find_by_customer_id(self.sale.customer_id) - + # customer_data = Customer.find_by_customer_id(self.sale.customer_id) account_no = self.payment_reference - if account_no == 0 - account_no = customer_data.customer_id - end + # if account_no.to_i <= 0 + # account_no = customer_data.membership_id + # end membership_setting = MembershipSetting.find_by_membership_type("paypar_url") membership_data = SalePayment.create_payment(membership_setting.gateway_url,membership_setting.auth_token,account_no,self.received_amount,self.sale.sale_id) @@ -439,13 +452,12 @@ class SalePayment < ApplicationRecord #Next time - validate if the vochure number is valid - within - customer_data = Customer.find_by_customer_id(self.sale.customer_id) + # customer_data = Customer.find_by_customer_id(self.sale.customer_id) account_no = self.payment_reference - if account_no == 0 - account_no = customer_data.customer_id - end - + # if account_no == 0 + # account_no = customer_data.customer_id + # end membership_setting = MembershipSetting.find_by_membership_type("paypar_url") membership_data = SalePayment.create_payment(membership_setting.gateway_url,membership_setting.auth_token,account_no,self.received_amount,self.sale.sale_id) diff --git a/app/views/origami/dinga/index.html.erb b/app/views/origami/dinga/index.html.erb index 1bd18f39..e9205fbf 100644 --- a/app/views/origami/dinga/index.html.erb +++ b/app/views/origami/dinga/index.html.erb @@ -205,7 +205,7 @@ $.ajax({ type: "POST", url: "<%=origami_payment_dinga_path%>", - data: {payment_amount:payment_amount,membership_id:membership_id,sale_id:sale_id,transaction_ref:""}, + data: {payment_amount:payment_amount,membership_id:membership_id,sale_id:sale_id,transaction_ref:"",account_no:0}, success: function(result){ if(result.status == true){ swal({ @@ -244,11 +244,11 @@ var receipt_no = $("#receipt_no").text() || 0; var customer_mamber_card_no = 0; - // $("#is_paymemberModal").hide(); - // $("#sxModal").show(); - // setTimeout(function(){ - // getCardNo(); - // $("#sxModal").hide(); + $("#is_paymemberModal").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({ @@ -302,7 +302,7 @@ } }); } - // },100); + },100); }); // Read NFC card no from java @@ -320,13 +320,13 @@ // QR Code Reader $(".btn_qr_code").on('click', function(e){ $("#is_memberModal").hide(); - var code = "1011002923682533"; + var code = ""; var customer_id = ''; var customer_name = ''; var membership_id = ''; var membership_type = ''; - // setTimeout(function(){ - // code=getQRCode(); + setTimeout(function(){ + code=getQRCode(); if(sale_id != 0 && code != ""){ $.ajax({ type: "POST", @@ -341,7 +341,7 @@ $.ajax({ type: "POST", url: "<%=origami_payment_paymal_path%>", - data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no : code}, + data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no:code}, success: function(result){ if(result.status == true){ swal({ @@ -376,7 +376,7 @@ } }); } - // },100); + },100); }); // Read qrcode from java diff --git a/app/views/origami/paymal/index.html.erb b/app/views/origami/paymal/index.html.erb index d92f162a..5594eb13 100644 --- a/app/views/origami/paymal/index.html.erb +++ b/app/views/origami/paymal/index.html.erb @@ -14,6 +14,8 @@
+ +
@@ -204,7 +206,7 @@ $.ajax({ type: "POST", url: "<%=origami_payment_paymal_path%>", - data: {payment_amount:payment_amount,membership_id:membership_id,sale_id:sale_id,transaction_ref:""}, + data: {payment_amount:payment_amount,membership_id:membership_id,sale_id:sale_id,transaction_ref:"",account_no:0}, success: function(result){ if(result.status == true){ swal({ @@ -237,6 +239,7 @@ var cardNo = ""; var sale_id = $("#sale_id").text() || 0; var receipt_no = $("#receipt_no").val() || ""; + var customer_mamber_card_no = 0; var payment_amount = parseFloat($("#used_amount").text()); @@ -246,8 +249,10 @@ getCardNo(); $("#sxModal").hide(); customer_mamber_card_no = $("#paypar_account_no").val(); - - if(sale_id != 0 && customer_mamber_card_no != 0){ + if (customer_mamber_card_no == 0) { + customer_mamber_card_no = $("#membership_id").text() || 0; + } + if(sale_id != 0 && customer_mamber_card_no !=0){ $.ajax({ type: "POST", url: "/origami/"+sale_id+"/send_account" , @@ -261,7 +266,7 @@ $.ajax({ type: "POST", url: "<%=origami_payment_paymal_path%>", - data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref}, + data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no:customer_mamber_card_no}, success: function(result){ if(result.status == true){ swal({ @@ -296,8 +301,10 @@ } }); + }else{ + swal("Opp","Please Check Member","warning") } - },100); + },100); }); // Read NFC card no from java @@ -335,7 +342,7 @@ $.ajax({ type: "POST", url: "<%=origami_payment_paymal_path%>", - data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref}, + data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no:code}, success: function(result){ if(result.status == true){ swal({ From a5cb5a67f4fc5e82456c1d9b1a06f5b6853281f8 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Wed, 18 Apr 2018 17:55:32 +0630 Subject: [PATCH 4/6] update order reservation --- app/controllers/origami/order_reservation_controller.rb | 5 +++-- app/models/order_reservation.rb | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/origami/order_reservation_controller.rb b/app/controllers/origami/order_reservation_controller.rb index 562eaaed..87e8b18f 100644 --- a/app/controllers/origami/order_reservation_controller.rb +++ b/app/controllers/origami/order_reservation_controller.rb @@ -50,9 +50,10 @@ class Origami::OrderReservationController < BaseOrigamiController status = params[:status] end - response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],status) + # response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],status) - render :json => response + result = {:status=> true, :message => " accepted !" } + render :json => result.to_json end end diff --git a/app/models/order_reservation.rb b/app/models/order_reservation.rb index 2fa99cf4..21c76030 100644 --- a/app/models/order_reservation.rb +++ b/app/models/order_reservation.rb @@ -92,7 +92,7 @@ class OrderReservation < ApplicationRecord @status, @sale = Sale.request_bill(@order,current_user,current_user) #order status send to doemal - callback_response = send_status_to_ordering(order.callback_url,order.transaction_ref,SEND_TO_KITCHEN) + # callback_response = send_status_to_ordering(order.callback_url,order.transaction_ref,SEND_TO_KITCHEN) #order reservation status updated update_order_reservation(order.id, @sale.sale_id, SEND_TO_KITCHEN) @@ -123,7 +123,7 @@ class OrderReservation < ApplicationRecord sale_payment.process_payment(saleObj, current_user.name, saleObj.grand_total, "cash") #order status send to doemal - callback_response = send_status_to_ordering(order.callback_url,order.transaction_ref,DELIVERED) + # callback_response = send_status_to_ordering(order.callback_url,order.transaction_ref,DELIVERED) #order reservation status updated update_order_reservation(order.id, saleObj.sale_id, DELIVERED) From 28a79fe60fa5ff1846c15d82e4d9b91f01d90e3e Mon Sep 17 00:00:00 2001 From: Yan Date: Wed, 18 Apr 2018 18:12:01 +0630 Subject: [PATCH 5/6] pdf viewer add and menu export testing --- Main Menu.xlsx | Bin 3997 -> 0 bytes app/controllers/settings/menus_controller.rb | 5 +++-- app/models/menu.rb | 2 +- app/views/settings/menus/index.html.erb | 3 ++- public/menus/Main Menu.xlsx | Bin 0 -> 4375 bytes public/menus/Shwe Myittar.xlsx | Bin 0 -> 3942 bytes 6 files changed, 6 insertions(+), 4 deletions(-) delete mode 100644 Main Menu.xlsx create mode 100644 public/menus/Main Menu.xlsx create mode 100644 public/menus/Shwe Myittar.xlsx diff --git a/Main Menu.xlsx b/Main Menu.xlsx deleted file mode 100644 index 94c703382ba6733020ef9e02db8febb2b38c130b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3997 zcmaJ^2Q*yk79K|LEeSHXN|5Lb(WBQWA$sp^^wEP5JxB^dUUi=G{_lxazUCQlJmA-+d*9V=oix=# z`;LXw*;%Lq4WA1O0^M93hFd-gemH68x6@mn5eUK)W$(@$g5MALa8<;ar{!&+C zd!K@)PE#(4PVW2qEzdi<>c2%GaD225ieg`e3jh$JBH#_-a)EWHCCPydH+cE$*>Ux zx;kLBWw3P-Y~~gqFm$@WULn<@ABuPOFuqee9m266|BS=hFbw}4Wgr^EeWGbcZ7ca z2G*3a%jvTSJ{etsiu`mfU#ufh-UsBkO2?Sh&vsy_9Glsi5<6(|?J;D$xOX=^W>{mC zKH6!H3i+VTJ=NrFo((@Z6;URV4~g*rNvu8DNZSb2z^31Gg@xm2Q-W_}Lu~nJcOZ3z zO*4h#4`cYbii)J=*1!UVbpq&yj=o*2K8_KGKb^-^uo^d`arYs50e241iGqr_ULRHr zpxF+ln?n?jAnlPUk2AONKb|Exp}q1u5#MRn<*dxaxlA{Yll89ZkxZ2%c$F^7+eDYT zn%pT+wN>db#ujbiwm zupP=~-_bZ3bF|#?DP>kQF?x~<4n*@rARKwjq2|+j{eyfirqu5q!3D6#hZ-$ae4vs( zP;FYH_cMVnlS2H4!#9`%{0DP|Zf|BE*icLj*$2~=@GhkLFHQ&!FJII(0?*qj0o7p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#%CW)@bZMCed9_Lzugk`ZSUfb;`yL6dSxXmvk$` zMwuklJy%GpCS2ymmoRU?bE-y&6A)EYQYQ6NOYI&-b#tm$iY6-gun&ES-v*|Bwnz5) zw(IrseVD_d3=MqZetJXt77ToH&rq`0LiJ#j|KanswFX{b$_(IqvA-1w6*%JTDBG8>m=7nSi+|H=z1gR=y1X-uIU3(b% zAvOf7dG^@Lb461$Q z^Qk~k4^J{ND%;}q8zZdzy3Y5aXaS$o(3B1eai0~kuCkzgFyZ-51P2=JazX?Zoy;x; zlIJP3o)!vPmcv#aTAT^UQ54c4T+GI{BPh?`fAS_~sS$ZyqOoyXtWwFrqrSj*e{5Rb zgSa4;2A(5<+|RP>^3-Fa$7iqo`h!qPI*Z~1a%W~|kqa@_m>SmO|Ce1Jh_B|$b9FOg%dJ+s_MH5ezO zG4tjFwW_phf1%XR*RQNhj(r71=%w;cESqTt*{L>E@WV$Lw4Y|PIP#@+xrQuHow2Vg zA*k0Tspa|V;O_xp;ilgVh>>zo(j>po=%X5Ej~<7&2c-=W1;qQu4;UJwCJE?O!6_jA z6vMHdG&^3Zv1LLmF0?Y=x132cHoj#nIv#aVIAsh1(h=lFGw(QeWVhe&8O=x`K`*h|UMqDOxYYt4O5E;gNk9C-)gNIUSRBbg(e44rs%cx+3ghVgZ$fL8u- zJ7QMXu&38Lf!D>+FevZHbNiG1fQ43}ViTo(V4E*1t6YAIk zP+1m`6Lj_T%OG_Vcyr>o`ur~-I%@lE{@Z z(M|Ntj^r8*$NYc&$xS;q>-@EyXsrKQ^=}%uS=6o#%wzxQ$gd^tCirG~xCW2n{2ToL tip5QXH*@#3!En?_iTa&a-u!LwI+Lp_W1`3c0Jx}26*YbeUCo|=e*#e9v@ZYv diff --git a/app/controllers/settings/menus_controller.rb b/app/controllers/settings/menus_controller.rb index 0264084c..bc92a959 100755 --- a/app/controllers/settings/menus_controller.rb +++ b/app/controllers/settings/menus_controller.rb @@ -167,8 +167,9 @@ class Settings::MenusController < ApplicationController # end end - p.serialize("tmp/menus/" + menu.name + ".xlsx") - render :json => {status: true} + file_path = "public/menus/" + menu.name + ".xlsx" + p.serialize(file_path) + render :json => { status: true, path: file_path } end def import diff --git a/app/models/menu.rb b/app/models/menu.rb index 8bf616c9..28b23c76 100755 --- a/app/models/menu.rb +++ b/app/models/menu.rb @@ -160,7 +160,7 @@ class Menu < ApplicationRecord account = Account.create({title: row["Account"], account_type: "0"}) end - menu_itm = MenuItem.create(item_code: row["Item Code"], name: row["Item Name"], account_id: account.id, alt_name: row["Item AltName"], image_path: "", description: '', information: '', unit: '', type: "SimpleMenuItem", menu_category_id: menu_cat.id, item_attributes: "[]", item_options: "[]", account_id: account_id, is_sub_item: 0, is_available: 1, created_by: created_by) + menu_itm = MenuItem.create(item_code: row["Item Code"], name: row["Item Name"], account_id: account.id, alt_name: row["Item AltName"], image_path: "", description: '', information: '', unit: '', type: "SimpleMenuItem", menu_category_id: menu_cat.id, item_attributes: "[]", item_options: "[]", is_sub_item: 0, is_available: 1, created_by: created_by) # else # status = status + "Item Code already exists for " + row["Item Name"] + "." end diff --git a/app/views/settings/menus/index.html.erb b/app/views/settings/menus/index.html.erb index d8e37899..8eeb5269 100755 --- a/app/views/settings/menus/index.html.erb +++ b/app/views/settings/menus/index.html.erb @@ -115,7 +115,8 @@ url: "/settings/menus/" + menu_id + "/export", success: function(result){ if(result.status){ - swal("Success", "Export Success...", "success"); + location.href = result.path.substring(6); + // swal("Success", "Export Success...", "success"); } } }); diff --git a/public/menus/Main Menu.xlsx b/public/menus/Main Menu.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..a35944b08060038e4423411b423ca20df5ba36cc GIT binary patch literal 4375 zcmaJ^2{@E(_aDYivKE7^MfPPB1}|ePOU4$BDEk^RWZ$z*Lq!Z@ke%$xlAVy(*!QKe zMMRd6k&y(6``qXJ4on9~#sUBUr~s`pykBhOTt=se zD^*eefR;Gl^R#nCNQj@@OB32|y_2Mi+EUb5`hjt~L6v3Kz>|w-5I%pOs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D{IApOOZa`vDr%- zRqsLPYEVl*-OT4oOj{^Dm~y;Oi1<4zoBnF--}MmUYwd-HL-QW0P0AmxaJ$VEuOFCq zjFV+oe1eW|l0Vad&)HmGzPyaJ-zaCqy3GtD4K4AuGfL&uwdH0%0)l;8!n8-^OW&JL zsNxlj2`%=hUx(Z<9THM7@c(aGi7696tZ;zbu#=~Mw6JG^XM4Sq&;J6F5~trfzq8P@ zO#Bp@NhB=)#mmpa&vMaI_y=O*{~P`vW_lKVmJObwQ^@}pH#{rnEXO*PgQWOB8P{0> zX9>lrfLY3aEAmfzaTa{GG@pWpsQw23uR?uR;Mux)Dln4ztiaPM3ezDc8VdkW6R%su K#{V__$?9LlKY1_! literal 0 HcmV?d00001 diff --git a/public/menus/Shwe Myittar.xlsx b/public/menus/Shwe Myittar.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..5cd9d6b903be9a4a4aa41d6b779d9174911c1195 GIT binary patch literal 3942 zcmaJ^2{@E%8y>sK(qKr8gGk7}9fiW!HONx-?6Qsw*~XTALMPcqh-6S%D~z4Satt9m zjSWz?=I)0a@wHv*aVUFKa)n53Pcn#wYv|JU9F}i&Lq6eSaGr$MYL*y+Ij=G?xi@rrN&W@Du{Qwlfzc^Sb#S3bilf zL^Ve}{MLtSi3kM!QseF%?AC+E^ISa*WT z!`93>J5y!3U?}2~m!(*lFpc!wCCi#ZE1=r#sf3{o>~bNMc33e2;~qAu!HCQy3FdOr zvn0@&N+c=-Yva;IlDw@YUWJqMXj0lEpo*J9bnV62fsz24;15q`x(J**8gAf^t!91Zv5zfS zt;d@pZ+GUe5KOcfIM@0rR;8{>%diIGnyb1M+UZFBv7#z@SGEJW5vhcoRROxNjXz2= z9MNUzxmy++Gq`xKUU$s_z5SZT{O#q2UbO-3k6$V;if2^VM-gWDYm*%UT&B#?8}74h z3OcQd>2`hGv%LgeTLS0bP(t3ee{Z@+&`h`t1%x^Ym8YP@&=!43gfR+ zqtY?Jz zedNYBYmrZM1m?f#lUD_r$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_vt+6 zJGe;>-uu&DSj(C^S8t;GH1^v@$gYwfQPQp0yfuJ2idAyp%Lf=}$7^8Nky>n64Gq{T= zVzGv-ilxL^DYvnWNB&%|a(x_G4kRy#Egncb(UT2w7E!2At;-JCo$8dBTj(5VzYZE8 zJpR60B3Rv|a|_Xm5DoNNPglL~^7WapW@2rs;xChKEcenuikI_xwskw$#wAj8Q7xOp(Xu7ZLL_OkvkQP5Q z8ui+*AJHpRD1Y*2VM>uJPs(`yGPb>H=|R`w?*VdWS*Rl$=5OFMU=Ul)^?iB*&JhN& zS6?>{o%fxyfHgJ5DzDNJaMxiFJ55M#Z>TLt_mSk9J}lQ(^Gn!G01EE$f!8pIb_yOK%KHsbPwGnR8-a@HoXAa-` zU>>>(23V|qzqXTFbu~{Z(sbk@L0OH zd^RidrSQGXk)=Or&koS0)ofDryCq z|J?(TuOEP{mw;!{$6r5mM3g|v*5UZ~zkt-_>8D155=vRvoj{+ERp1|G9wnTzvN?eh zXn%nJr_P~7Q`QzIXf)mbt28L>P-g5CJNN1TYyPG*K$)IS3=kRqy^$Z26(yKb=1;&Q qjDLgwpXgH>q}1ROgNZ;&gC~k?Vn|1J761T}A0u)fNqyWz0{#VO$fpzl literal 0 HcmV?d00001 From ed8e9836fe2a9d2a5e7ee83c37460aa8928a9c7f Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Thu, 19 Apr 2018 10:16:38 +0630 Subject: [PATCH 6/6] check and update qrcode payment --- app/controllers/origami/order_reservation_controller.rb | 5 ++--- app/models/order_reservation.rb | 4 ++-- app/views/origami/dinga/index.html.erb | 8 +++++--- app/views/origami/paymal/index.html.erb | 2 ++ 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/controllers/origami/order_reservation_controller.rb b/app/controllers/origami/order_reservation_controller.rb index 87e8b18f..562eaaed 100644 --- a/app/controllers/origami/order_reservation_controller.rb +++ b/app/controllers/origami/order_reservation_controller.rb @@ -50,10 +50,9 @@ class Origami::OrderReservationController < BaseOrigamiController status = params[:status] end - # response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],status) + response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],status) - result = {:status=> true, :message => " accepted !" } - render :json => result.to_json + render :json => response end end diff --git a/app/models/order_reservation.rb b/app/models/order_reservation.rb index 21c76030..2fa99cf4 100644 --- a/app/models/order_reservation.rb +++ b/app/models/order_reservation.rb @@ -92,7 +92,7 @@ class OrderReservation < ApplicationRecord @status, @sale = Sale.request_bill(@order,current_user,current_user) #order status send to doemal - # callback_response = send_status_to_ordering(order.callback_url,order.transaction_ref,SEND_TO_KITCHEN) + callback_response = send_status_to_ordering(order.callback_url,order.transaction_ref,SEND_TO_KITCHEN) #order reservation status updated update_order_reservation(order.id, @sale.sale_id, SEND_TO_KITCHEN) @@ -123,7 +123,7 @@ class OrderReservation < ApplicationRecord sale_payment.process_payment(saleObj, current_user.name, saleObj.grand_total, "cash") #order status send to doemal - # callback_response = send_status_to_ordering(order.callback_url,order.transaction_ref,DELIVERED) + callback_response = send_status_to_ordering(order.callback_url,order.transaction_ref,DELIVERED) #order reservation status updated update_order_reservation(order.id, saleObj.sale_id, DELIVERED) diff --git a/app/views/origami/dinga/index.html.erb b/app/views/origami/dinga/index.html.erb index e9205fbf..1a7bd798 100644 --- a/app/views/origami/dinga/index.html.erb +++ b/app/views/origami/dinga/index.html.erb @@ -118,7 +118,7 @@