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

This commit is contained in:
phyusin
2018-01-19 16:07:23 +06:30
8 changed files with 91 additions and 44 deletions

View File

@@ -70,8 +70,8 @@ For Bank Integration setting
2) settings/lookups => { type:bank_integration, name: Bank Integration, value:1 } 2) settings/lookups => { type:bank_integration, name: Bank Integration, value:1 }
For checkout time and checkout alert time For checkout time and checkout alert time
1) checkout time => { type: checkout_time, name: 9:00AM - 12:00 PM, value: 120 } 1) checkout time => { type: checkout_time, name: 9:00 AM - 12:00 PM, value: 120 }
2) checkout alert time => { type: checkout_alert_time, name: 8:00AM - 12:00 PM, value: 60 } 2) checkout alert time => { type: checkout_alert_time, name: 8:00 AM - 12:00 PM, value: 60 }
* you can add multiple record for checkout time and checkout alert time * you can add multiple record for checkout time and checkout alert time
* type must be 'checkout_time' and 'checkout_alert_time' * type must be 'checkout_time' and 'checkout_alert_time'
* you can change name and value * you can change name and value
@@ -98,12 +98,12 @@ SQL Update after rake clear:data runned
* ToDo list * ToDo list
1. Cloud Sync 1. Migration
2. Action Cable 2. Quick Service
3. Shop Setup 3. Order & Reservation
4. Payment Integation
* System dependencies
* System Dependencies
* Configuration * Configuration

View File

@@ -22,14 +22,14 @@ class SymControlController < BaseController
stop_sym = system("service SymmetricDS stop") stop_sym = system("service SymmetricDS stop")
run_sym = system("service SymmetricDS start") run_sym = system("service SymmetricDS start")
if run_sym if run_sym
render :text => "<h1>Success!</h1>" flash[:notice] = 'Success!'
end end
else else
render :text => "<h1>Sym Sql file not found!</h1>" flash[:notice] = 'Sym Sql file not found!'
end end
end end
else else
render :text => "<h1>Sym not running!</h1>" flash[:notice] = "Sym not running!"
end end
end end
@@ -37,9 +37,9 @@ class SymControlController < BaseController
license = License.new(ENV["SX_PROVISION_URL"]) license = License.new(ENV["SX_PROVISION_URL"])
status = license.get_key status = license.get_key
if status if status
render :text => "<h1>Success!</h1>" flash[:notice] = "Success!"
else else
render :text => "<h1>Not Get!</h1>" flash[:notice] = "Not Get!"
end end
end end

View File

@@ -106,7 +106,7 @@ class License
redis = Redis.new redis = Redis.new
cache_license = redis.get(cache_key) cache_license = redis.get(cache_key)
# Rails.logger.info "Cache key - " + cache_key.to_s Rails.logger.info "Cache key - " + cache_key.to_s
if cache_license.nil? if cache_license.nil?
cache = {"shop" => @activate["shop_name"], "key" => aes_key, "iv" => @activate["iv_key"], "renewable_date" => @activate["renewable_date"] } cache = {"shop" => @activate["shop_name"], "key" => aes_key, "iv" => @activate["iv_key"], "renewable_date" => @activate["renewable_date"] }
@@ -114,7 +114,7 @@ class License
redis.set(cache_key, Marshal.dump(cache)) redis.set(cache_key, Marshal.dump(cache))
end end
# Rails.logger.info "License - " + response.parsed_response.to_s Rails.logger.info "License - " + response.parsed_response.to_s
response = create_license_file(@activate) response = create_license_file(@activate)
if(response[:status]) if(response[:status])
@@ -136,9 +136,9 @@ class License
response = self.class.get("/verify", @params) response = self.class.get("/verify", @params)
@varified = response.parsed_response @varified = response.parsed_response
# Rails.logger.debug "License Remote Response - " + response.parsed_response.to_s Rails.logger.debug "License Remote Response - " + response.parsed_response.to_s
if (@varified["status"]) if (@varified["status"])
if (!check_expired(@varified["plan_next_renewal_date"])) if (!check_expired(@varified["renewable_date"]))
return true return true
end end
else else
@@ -247,10 +247,10 @@ class License
redis = Redis.new redis = Redis.new
cache_license = redis.get(cache_key) cache_license = redis.get(cache_key)
# Rails.logger.info "Cache key - " + cache_key.to_s Rails.logger.info "Cache key - " + cache_key.to_s
if cache_license.nil? if cache_license.nil?
cache = {"shop" => shop_name, "key" => @data["secret_key"], "iv" => @data["iv_key"], "renewable_date" => @data["plan_next_renewable_date"] } cache = {"shop" => shop_name, "key" => @data["secret_key"], "iv" => @data["iv_key"], "renewable_date" => @data["renewable_date"] }
redis = Redis.new redis = Redis.new
redis.set(cache_key, Marshal.dump(cache)) redis.set(cache_key, Marshal.dump(cache))
end end
@@ -358,7 +358,7 @@ class License
f.write("db.user=#{dbusername}\n") f.write("db.user=#{dbusername}\n")
f.write("db.password=#{dbpassword}\n") f.write("db.password=#{dbpassword}\n")
f.write("registration.url=http://#{db_host}:31415/sync/sx\n") f.write("registration.url=http://#{db_host}:31415/sync/sx\n")
f.write("group.id=store\n") f.write("group.id=cloud\n")
f.write("external.id=001\n") f.write("external.id=001\n")
f.write("job.routing.period.time.ms=5000\n") f.write("job.routing.period.time.ms=5000\n")
f.write("job.push.period.time.ms=10000\n") f.write("job.push.period.time.ms=10000\n")

View File

@@ -137,13 +137,13 @@ class Order < ApplicationRecord
Rails.logger.debug menu_item Rails.logger.debug menu_item
set_order_items = Array.new set_order_items = Array.new
##If menu Item set item - must add child items to order as well, where price is only take from menu_item ##If menu Item set item - must add child items to order as well, where price is only take from menu_item
# if (menu_item[:type] == "SetMenuItem") if (menu_item[:type] == "SetMenuItem")
# set_order_items = if (item.include? 'sub_items') || (item.include? :sub_items)
# end item[:sub_items].each do |si|
# Retrive instance's Price
if (item.include? 'sub_items') || (item.include? :sub_items) set_item = MenuItem.search_by_item_code(si[:item_instance_code])
item[:sub_items].each do |si| set_order_items.push({"item_instance_code"=>si[:item_instance_code], "quantity"=>si[:quantity], "price"=>set_item[:price]})
set_order_items.push({"item_instance_code"=>si[:item_instance_code], "quantity"=>si[:quantity]}) end
end end
end end

View File

@@ -98,6 +98,9 @@ class Sale < ApplicationRecord
order.order_items.each do |item| order.order_items.each do |item|
add_item(item) add_item(item)
if item.set_menu_items != "[]"
add_sub_item(item.set_menu_items)
end
end end
link_order_sale(order.id) link_order_sale(order.id)
@@ -144,6 +147,9 @@ class Sale < ApplicationRecord
items.each do |item| items.each do |item|
add_item(item) add_item(item)
if item.set_menu_items != "[]"
add_sub_item(item.set_menu_items)
end
#this will result in multiple orders belonging in multiple invoices - because of spilt invoices. #this will result in multiple orders belonging in multiple invoices - because of spilt invoices.
link_order_sale(item.order_id, taxable) link_order_sale(item.order_id, taxable)
@@ -181,6 +187,35 @@ class Sale < ApplicationRecord
self.sale_items << sale_item self.sale_items << sale_item
end end
def add_sub_item (item)
#check if the item is on promotion
JSON.parse(item).each do |item|
#save sale item
sale_item = SaleItem.new
#pull
instance = MenuItemInstance.find_by_item_instance_code(item["item_instance_code"])
menu_item = instance.menu_item
sale_item.product_code = menu_item.item_code
sale_item.item_instance_code = item["item_instance_code"]
sale_item.product_name = instance.item_instance_name
sale_item.product_alt_name = menu_item.alt_name
sale_item.account_id = menu_item.account_id
sale_item.remark = nil
sale_item.qty = item["quantity"]
sale_item.unit_price = item["price"]
sale_item.taxable_price = sale_item.qty * sale_item.unit_price
sale_item.is_taxable = menu_item.taxable
sale_item.price = sale_item.qty * sale_item.unit_price
self.sale_items << sale_item
end
end
def create_saleitem_diningcharges(chargeObj, block_count, diningprice, dining_name, dining_time) def create_saleitem_diningcharges(chargeObj, block_count, diningprice, dining_name, dining_time)
sale_item = SaleItem.new sale_item = SaleItem.new
sale_item.product_code = chargeObj.item_code sale_item.product_code = chargeObj.item_code

View File

@@ -29,9 +29,21 @@
</head> </head>
<body class="page"> <body class="page">
<% flash.each do |type, message| %>
<% if type == "notice"
color = "alert-success"
elsif type == "error"
color = "alert-danger"
else
color = "bg-black"
end %>
<p id="notify_message" class="hidden" data-placement-from="top" data-message="<%=message%>" data-placement-align="center"
data-animate-enter="" data-animate-exit="" data-color-name="<%=color%>" >
</p>
<% end %>
<div class="box"> <div class="box">
<%= yield %> <%= yield %>
</div> </div>
</body> </body>
</html> </html>

View File

@@ -1,15 +1,15 @@
iv_key: TP8dIx4nBGzr+tYyKn5+Xw== iv_key: A8Uxeyvc6mY067XO/5Umjg==
shop_name: Osaka shop_name: bitp3
email: wathonaun9@gmail.com email: devops@code2lab.com
telephone: 09979204288 telephone: 9999999
fax: 09979204288 fax: 99999999
address: Yangon address: Perl Condo
dbhost: nk57NaR38B2eSYyron3Nbw== dbhost: 1OfAgD6VvftELNwb/IXwKA==
dbschema: 3orxFaTi0uQhatBqZGiitQ== dbschema: DNhCHbEx6nj0Pq5YTjziSA==
dbusername: EtMle9Gr0/PE3NFHHfwo5A== dbusername: 4+m9wVXQJauQ4Xxd3R6TIQ==
dbpassword: 86h61/O38GGo64nekz6oeA== dbpassword: r8oU0diSouVBz0XHb9FAFA==
api_token: RZbpyAZlwOYFZfzbWmFhZgwCzRwJTBnPKIHrfM api_token: FcOPyXQiYTVEhFrYPelEDoarJEcRsTsllJmA
app_token: IoXPdqzbnQWbHsnxLAjMjimnjEJNySOeIo app_token: ujxyNlgorGQDYjscjzRZEzkUnZqtJaYy
plan_sku: PyQJ2sk5NZTudqQ2YIU16A== plan_sku: GDlJuYljNJOxTynA7Fckgg==
renewable_date: d/Fk1deU/iPbZFDOdyKsjA== renewable_date: cTHhQxIkmFMWggtkJzI58Q==
plan_name: weWOqr1tZ61Av6YKth1lDw== plan_name: RXtwhw7JUC1P0UZdoBuwYP4ECviwyfS7LL6cBHkSU2E=

View File

@@ -12,7 +12,7 @@
development: development:
secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61 secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61
sx_provision_url: 192.168.1.182:3002/api #connect.smartsales.asia/api #provision.zsai.ws/api sx_provision_url: connect.smartsales.dev/api #connect.smartsales.asia/api #provision.zsai.ws/api
server_mode: application server_mode: application
cipher_type: AES-256-CBC cipher_type: AES-256-CBC
sx_key: Wh@t1$C2L sx_key: Wh@t1$C2L