From ce79038668e191a3b7dca221dd39744a2df599e8 Mon Sep 17 00:00:00 2001 From: Myat Zin Wai Maw Date: Fri, 13 Dec 2019 10:40:36 +0630 Subject: [PATCH] shop --- app/controllers/api/customers_controller.rb | 5 ++++ app/controllers/concerns/multi_tenancy.rb | 4 +-- app/models/printer/printer_worker.rb | 30 ++++++++++----------- config/routes.rb | 3 +++ 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/app/controllers/api/customers_controller.rb b/app/controllers/api/customers_controller.rb index 2adc7c8a..ce432b90 100755 --- a/app/controllers/api/customers_controller.rb +++ b/app/controllers/api/customers_controller.rb @@ -14,4 +14,9 @@ class Api::CustomersController < ActionController::API def get_customer_order @customer = Customer.find(params[:id]) end + + #Show customer last five order + def get_customer_last_orders + @customer = Customer.find(params[:customer_id]) + end end diff --git a/app/controllers/concerns/multi_tenancy.rb b/app/controllers/concerns/multi_tenancy.rb index 8aac68aa..b14e2d2a 100644 --- a/app/controllers/concerns/multi_tenancy.rb +++ b/app/controllers/concerns/multi_tenancy.rb @@ -13,8 +13,8 @@ module MultiTenancy shop_code = request.subdomain.partition('-').last @shop = Shop.find_by(shop_code: shop_code) else - # @shop = Shop.first - @shop = Shop.find_by(shop_code: '262') + @shop = Shop.first + # @shop = Shop.find_by(shop_code: '262') end set_current_tenant(@shop) end diff --git a/app/models/printer/printer_worker.rb b/app/models/printer/printer_worker.rb index e0d4fc85..39cbb431 100755 --- a/app/models/printer/printer_worker.rb +++ b/app/models/printer/printer_worker.rb @@ -38,20 +38,20 @@ class Printer::PrinterWorker end def print(file_path,printer_destination = nil ) - if printer_destination.nil? - printer_destination = self.printer_destination - end - - puts printer_destination - puts '........Printer Destination..........' - - copy = self.print_copies - #Print only when printer information is not null - if !self.printer_destination.nil? - (1..copy).each do - page = Cups::PrintJob.new(file_path, printer_destination) - page.print - end - end + # if printer_destination.nil? + # printer_destination = self.printer_destination + # end + # + # puts printer_destination + # puts '........Printer Destination..........' + # + # copy = self.print_copies + # #Print only when printer information is not null + # if !self.printer_destination.nil? + # (1..copy).each do + # page = Cups::PrintJob.new(file_path, printer_destination) + # page.print + # end + # end end end diff --git a/config/routes.rb b/config/routes.rb index b46b73b6..0cd05e48 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -82,6 +82,9 @@ scope "(:locale)", locale: /en|mm/ do #get customer details by order items get "customers/get_order/:id" => "customers#get_customer_order" + #get customer last five orders + get "customers/get_orders/:customer_id" => "customers#get_customer_last_orders" + #Generating Invoice and making payments - output render @sale resources :invoices, only: [:index, :show, :create, :update, :destroy] do resources :sale_items, only: [:create, :update, :destroy]