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

This commit is contained in:
Aung Myo
2018-04-19 10:17:29 +06:30
13 changed files with 32 additions and 11 deletions

View File

@@ -52,6 +52,7 @@ gem 'rubyzip', '= 1.0.0'
gem 'axlsx', '= 2.0.1' gem 'axlsx', '= 2.0.1'
gem 'axlsx_rails' gem 'axlsx_rails'
gem 'roo' gem 'roo'
gem 'pdfjs_viewer-rails'
#Reporting gem #Reporting gem
#gem 'compendium' #gem 'compendium'
#gem "cancan" #gem "cancan"

View File

@@ -125,6 +125,7 @@ GEM
thor (>= 0.14, < 2.0) thor (>= 0.14, < 2.0)
jquery-ui-rails (6.0.1) jquery-ui-rails (6.0.1)
railties (>= 3.2.16) railties (>= 3.2.16)
json (2.1.0)
kaminari (1.0.1) kaminari (1.0.1)
activesupport (>= 4.1.0) activesupport (>= 4.1.0)
kaminari-actionview (= 1.0.1) kaminari-actionview (= 1.0.1)
@@ -168,6 +169,10 @@ GEM
nokogiri (1.8.1) nokogiri (1.8.1)
mini_portile2 (~> 2.3.0) mini_portile2 (~> 2.3.0)
pdf-core (0.7.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) pg (0.21.0)
prawn (2.2.2) prawn (2.2.2)
pdf-core (~> 0.7.0) pdf-core (~> 0.7.0)
@@ -333,6 +338,7 @@ DEPENDENCIES
momentjs-rails momentjs-rails
mysql2 (>= 0.3.18, < 0.5) mysql2 (>= 0.3.18, < 0.5)
nested_form nested_form
pdfjs_viewer-rails
pg pg
prawn prawn
prawn-table prawn-table

Binary file not shown.

View File

@@ -1,7 +1,7 @@
class Api::ApiController < ActionController::API class Api::ApiController < ActionController::API
include TokenVerification include TokenVerification
before_action :lookup_domain # before_action :lookup_domain
helper_method :current_token, :current_login_employee, :get_cashier helper_method :current_token, :current_login_employee, :get_cashier
private private

View File

@@ -18,7 +18,7 @@ module TokenVerification
# Rails.logger.debug "token - " + token.to_s # Rails.logger.debug "token - " + token.to_s
if(options.length !=0 && options["from"] == "DOEMAL") if(options.length !=0 && options["from"] == "DOEMAL")
if(ENV["SERVER_MODE"] === "cloud") if(ENV["SERVER_MODE"] === "cloud")
from = request.subdomain.downcase + "." + request.domain.downcase from = "local" #request.subdomain.downcase + "." + request.domain.downcase
aes = MyAesCrypt.new aes = MyAesCrypt.new
return aes.checkKeyForAuth(from, token) return aes.checkKeyForAuth(from, token)
end end

View File

@@ -167,8 +167,9 @@ class Settings::MenusController < ApplicationController
# end # end
end end
p.serialize("tmp/menus/" + menu.name + ".xlsx") file_path = "public/menus/" + menu.name + ".xlsx"
render :json => {status: true} p.serialize(file_path)
render :json => { status: true, path: file_path }
end end
def import def import

View File

@@ -160,7 +160,7 @@ class Menu < ApplicationRecord
account = Account.create({title: row["Account"], account_type: "0"}) account = Account.create({title: row["Account"], account_type: "0"})
end 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 # else
# status = status + "Item Code already exists for " + row["Item Name"] + "." # status = status + "Item Code already exists for " + row["Item Name"] + "."
end end

View File

@@ -633,6 +633,8 @@ var customer_name = "<%= @customer.name %>";
calculate_member_discount(sale_id); calculate_member_discount(sale_id);
} }
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
$.ajax({type: "POST", $.ajax({type: "POST",
url: "<%= origami_payment_cash_path %>", url: "<%= origami_payment_cash_path %>",
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type, data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type,
@@ -655,10 +657,11 @@ var customer_name = "<%= @customer.name %>";
$("#loading_wrapper" ).hide(); $("#loading_wrapper" ).hide();
//PDF lightbox data //PDF lightbox data
var pdfPath = "/en/pdfjs/minimal?file=" + result.filename.substring(6);
$("#sale_receipt_no").val(result.receipt_no); $("#sale_receipt_no").val(result.receipt_no);
$("#filename").val(result.filename); $("#filename").val(result.filename);
$("#printer_name").val(result.printer_name); $("#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}); $("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
$("#pdfModalLabel").text("Sale Completed"); $("#pdfModalLabel").text("Sale Completed");
$("#changed_amount").text(""); $("#changed_amount").text("");

View File

@@ -115,7 +115,8 @@
url: "/settings/menus/" + menu_id + "/export", url: "/settings/menus/" + menu_id + "/export",
success: function(result){ success: function(result){
if(result.status){ if(result.status){
swal("Success", "Export Success...", "success"); location.href = result.path.substring(6);
// swal("Success", "Export Success...", "success");
} }
} }
}); });

View File

@@ -6,6 +6,8 @@ scope "(:locale)", locale: /en|mm/ do
root 'home#index' root 'home#index'
mount Sidekiq::Web => '/kiq' mount Sidekiq::Web => '/kiq'
mount PdfjsViewer::Rails::Engine => "/pdfjs", as: 'pdfjs'
# Action Cable Creation # Action Cable Creation
# if ENV["SERVER_MODE"] != "cloud" # if ENV["SERVER_MODE"] != "cloud"
mount ActionCable.server => "/cable" mount ActionCable.server => "/cable"

View File

@@ -6,6 +6,13 @@
"key": "999d675168d813d5e1c7", "key": "999d675168d813d5e1c7",
"iv": "999d675168d813d5e1c7" "iv": "999d675168d813d5e1c7"
} }
},
{
"lookup": "demo10.pos-myanmar.com",
"value": {
"key": "634W2ioj6QA88vafKamHBRu5aKX/BLIPdTWuuXGFBsA=\n",
"iv": "QqpO/h7o60dYTbNETRbZ4g==\n"
}
} }
] ]
} }

BIN
public/menus/Main Menu.xlsx Normal file

Binary file not shown.

Binary file not shown.