Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into quick_service
This commit is contained in:
@@ -38,11 +38,11 @@ class ApplicationController < 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
|
||||
|
||||
|
||||
@@ -38,15 +38,21 @@ class Origami::HomeController < BaseOrigamiController
|
||||
if !order.order_items.empty?
|
||||
if !@order_items_count.key?(booking.dining_facility_id)
|
||||
@order_items_count.store(booking.dining_facility_id, order.order_items.count)
|
||||
else
|
||||
@order_items_count[booking.dining_facility_id] += order.order_items.count
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
if sale.sale_status !='completed'
|
||||
if !@order_items_count.key?(booking.dining_facility_id)
|
||||
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
||||
if !booking.sale_id.nil?
|
||||
sale = Sale.find(booking.sale_id)
|
||||
if sale.sale_status !='completed'
|
||||
if !@order_items_count.key?(booking.dining_facility_id)
|
||||
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
||||
else
|
||||
@order_items_count[booking.dining_facility_id] += sale.sale_items.count
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -80,6 +86,9 @@ class Origami::HomeController < BaseOrigamiController
|
||||
@order_items.push(item)
|
||||
end
|
||||
accounts = @customer.tax_profiles
|
||||
puts accounts.to_json
|
||||
puts "sssssssssss"
|
||||
puts @customer.tax_profiles
|
||||
@account_arr =[]
|
||||
accounts.each do |acc|
|
||||
account = TaxProfile.find(acc)
|
||||
|
||||
@@ -24,15 +24,21 @@ class Origami::OrdersController < BaseOrigamiController
|
||||
if !order.order_items.empty?
|
||||
if !@order_items_count.key?(booking.dining_facility_id)
|
||||
@order_items_count.store(booking.dining_facility_id, order.order_items.count)
|
||||
else
|
||||
@order_items_count[booking.dining_facility_id] += order.order_items.count
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
if sale.sale_status !='completed'
|
||||
if !@order_items_count.key?(booking.dining_facility_id)
|
||||
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
||||
if !booking.sale_id.nil?
|
||||
sale = Sale.find(booking.sale_id)
|
||||
if sale.sale_status !='completed'
|
||||
if !@order_items_count.key?(booking.dining_facility_id)
|
||||
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
||||
else
|
||||
@order_items_count[booking.dining_facility_id] += sale.sale_items.count
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -34,15 +34,21 @@ class Origami::RoomsController < BaseOrigamiController
|
||||
if !order.order_items.empty?
|
||||
if !@order_items_count.key?(booking.dining_facility_id)
|
||||
@order_items_count.store(booking.dining_facility_id, order.order_items.count)
|
||||
else
|
||||
@order_items_count[booking.dining_facility_id] += order.order_items.count
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
if sale.sale_status !='completed'
|
||||
if !@order_items_count.key?(booking.dining_facility_id)
|
||||
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
||||
if !booking.sale_id.nil?
|
||||
sale = Sale.find(booking.sale_id)
|
||||
if sale.sale_status !='completed'
|
||||
if !@order_items_count.key?(booking.dining_facility_id)
|
||||
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
||||
else
|
||||
@order_items_count[booking.dining_facility_id] += sale.sale_items.count
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ class SymControlController < BaseController
|
||||
http_basic_authenticate_with name: "vip", password: "!abcABC01"
|
||||
|
||||
def run
|
||||
sym_path = "/home/yan/symmetric/"
|
||||
sym_path = File.expand_path("~/symmetric/")
|
||||
check_sym_proc_str = `#{"sudo service SymmetricDS status"}`
|
||||
# Check Sym Installed
|
||||
# if sym_install_status[1] == "false"
|
||||
@@ -12,13 +12,13 @@ class SymControlController < BaseController
|
||||
|
||||
if check_sym_proc_str.include? "Active: active (running)" || "Active: active (exited)" #"Server is already running"
|
||||
# Create Sym Table
|
||||
check_sym_table = system("sudo " + sym_path + "bin/symadmin --engine sx create-sym-tables")
|
||||
check_sym_table = system("sudo " + sym_path + "/bin/symadmin --engine sx create-sym-tables")
|
||||
if check_sym_table
|
||||
sym_sql = Rails.root + "db/sym_master.sql"
|
||||
|
||||
if File.exist? (sym_sql)
|
||||
# Import Sym Sql to db and start sym
|
||||
run_sym_sql = system("sudo " + sym_path + "bin/dbimport --engine sx " + sym_sql.to_s)
|
||||
run_sym_sql = system("sudo " + sym_path + "/bin/dbimport --engine sx " + sym_sql.to_s)
|
||||
stop_sym = system("sudo service SymmetricDS stop")
|
||||
run_sym = system("sudo service SymmetricDS start")
|
||||
if run_sym
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class License
|
||||
include HTTParty
|
||||
|
||||
base_uri "provision.zsai.ws/api"
|
||||
base_uri "connect.smartsales.dev/api"
|
||||
|
||||
attr_accessor :name, :address_1, :address_2, :township, :city, :country, :email, :phone, :fax, :logo, :subdomain,
|
||||
:plan_activation_date, :plan_next_renewal_date, :plan_max_products,:plan_max_customers, :plan_active_connections,
|
||||
@@ -118,8 +118,11 @@ class License
|
||||
|
||||
response = create_license_file(@activate)
|
||||
if(response[:status])
|
||||
sym_path = "/home/yan/symmetric/"
|
||||
#sym_path = "/home/user/symmetric/"
|
||||
sym_path = File.expand_path("~/symmetric/")
|
||||
|
||||
response = create_symmetric_config(sym_path, db_host, db_schema, db_user, db_password)
|
||||
|
||||
if(response[:status])
|
||||
response = run_symmetric(sym_path)
|
||||
end
|
||||
@@ -183,7 +186,7 @@ class License
|
||||
|
||||
if File.exist?("config/license.yml")
|
||||
File.open("config/license.yml").each do |line|
|
||||
if line.include? (key_name)
|
||||
if line.include? (key_name)
|
||||
decrypted_line_array = line.split(": ")
|
||||
decrypted_line = AESCrypt.decrypt_data(decode_str(decrypted_line_array[1]), decode_str(key), decode_str(iv), ENV['CIPHER_TYPE'])
|
||||
end
|
||||
@@ -325,7 +328,7 @@ class License
|
||||
if File.directory? (sym_location)
|
||||
begin
|
||||
# sx properties create
|
||||
f = File.open(sym_location + "engines/sx.properties", "w")
|
||||
f = File.open(sym_location + "/engines/sx.properties", "w")
|
||||
f.write("engine.name=sx\n")
|
||||
f.write("db.driver=com.mysql.jdbc.Driver\n")
|
||||
f.write("db.url=jdbc:mysql://#{db_host}/#{db_schema}?tinyInt1isBit=false\n")
|
||||
@@ -344,14 +347,15 @@ class License
|
||||
f.close
|
||||
|
||||
# read from license file
|
||||
shop_name = read_license_no_decrypt("shop_name")
|
||||
# shop_name = read_license_no_decrypt("shop_name")
|
||||
shop_name = "cloud"
|
||||
dbhost = read_license("dbhost")
|
||||
dbschema = read_license("dbschema")
|
||||
dbusername = read_license("dbusername")
|
||||
dbpassword = read_license("dbpassword")
|
||||
|
||||
# shop properties create
|
||||
f = File.open(sym_location + "engines/#{shop_name}.properties", "w")
|
||||
f = File.open(sym_location + "/engines/#{shop_name}.properties", "w")
|
||||
f.write("engine.name=#{shop_name}\n")
|
||||
f.write("db.driver=com.mysql.jdbc.Driver\n")
|
||||
f.write("db.url=jdbc:mysql://#{dbhost}/#{dbschema}?tinyInt1isBit=false\n")
|
||||
@@ -390,13 +394,13 @@ class License
|
||||
sym_run_status = check_sym_running(check_sym_proc_str, sym_path)
|
||||
if sym_run_status
|
||||
# Create Sym Table
|
||||
check_sym_table = system("sudo " + sym_path + "bin/symadmin --engine sx create-sym-tables")
|
||||
check_sym_table = system("sudo " + sym_path + "/bin/symadmin --engine sx create-sym-tables")
|
||||
if check_sym_table
|
||||
sym_sql = Rails.root + "db/sym_master.sql"
|
||||
|
||||
if File.exist? (sym_sql)
|
||||
# Import Sym Sql to db and start sym
|
||||
run_sym_sql = system("sudo " + sym_path + "bin/dbimport --engine sx " + sym_sql.to_s)
|
||||
run_sym_sql = system("sudo " + sym_path + "/bin/dbimport --engine sx " + sym_sql.to_s)
|
||||
stop_sym = system("sudo service SymmetricDS stop")
|
||||
run_sym = system("sudo service SymmetricDS start")
|
||||
if run_sym
|
||||
|
||||
@@ -70,12 +70,12 @@
|
||||
</ul>
|
||||
</li>
|
||||
<% if can? :menage, Inventory %>
|
||||
<!-- <li>
|
||||
<li>
|
||||
<a href="<%= inventory_path %>">
|
||||
<i class="material-icons">store</i>
|
||||
<span><%= t :inventory %></span>
|
||||
</a>
|
||||
</li> -->
|
||||
</li>
|
||||
<%end%>
|
||||
<li class="header"><%= t :backend %></li>
|
||||
<li>
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
iv_key: Te5NfpxT9IjB5ulefoRdoQ==
|
||||
shop_name: bitp7
|
||||
email: devops@code2lab.com
|
||||
telephone: 9999999
|
||||
fax: 99999999
|
||||
address: Perl Condo
|
||||
dbhost: AAOoOhyuwUXWkBB7cev2vg==
|
||||
dbschema: nZtG9/bJ9BoQ3y8RvSsH1w==
|
||||
dbusername: Bahz/G6Xbn0kFw5vH/fS+Q==
|
||||
dbpassword: T45gSYq8IB2BL9o9spFmIg==
|
||||
api_token: DAJQdcHsSwXjxAbcvzWYjXTARdiAskWbw
|
||||
app_token: PsVJxxAhQHKjqLFGOnWdIIsBHoLsMdPBhZLpM
|
||||
plan_sku: W1evmpMVHjjXvXBLPW+jJA==
|
||||
renewable_date: 2bDU6cDr2LRMJpeeCM9ZvQ==
|
||||
plan_name: aaVvUh6fGhIbUDWoR3awq4qkDVk3rH2Fuydc0ZuKMqA=
|
||||
@@ -1,11 +1,3 @@
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"lookup": "osaka1-7.zsai.ws",
|
||||
"value": {
|
||||
"key": "wwF9Zx9q/LfxSDqSNHYXvfu1eGsBqFEFXoXqGWrEirA=\n",
|
||||
"iv": "l1rUEZFcPNHrTHWgaODkYQ==\n"
|
||||
}
|
||||
}
|
||||
]
|
||||
"data": []
|
||||
}
|
||||
|
||||
9
db/migrate/20180213050551_add_image_path_to_employees.rb
Normal file
9
db/migrate/20180213050551_add_image_path_to_employees.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class AddImagePathToEmployees < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
add_column :employees, :image_path, :string
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :image_path
|
||||
end
|
||||
end
|
||||
9
db/migrate/20180213050631_add_image_path_to_customers.rb
Normal file
9
db/migrate/20180213050631_add_image_path_to_customers.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class AddImagePathToCustomers < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
add_column :customers, :image_path, :string
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :image_path
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
class AddImagePathToCommissioners < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
add_column :commissioners, :image_path, :string
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :image_path
|
||||
end
|
||||
end
|
||||
14
db/migrate/20180213053009_create_display_images.rb
Normal file
14
db/migrate/20180213053009_create_display_images.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
class CreateDisplayImages < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :display_images do |t|
|
||||
t.integer :shop_id
|
||||
t.binary :image
|
||||
t.string :created_by
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :display_images
|
||||
end
|
||||
end
|
||||
@@ -117,6 +117,14 @@ delete from sym_node;
|
||||
(trigger_id,source_table_name,channel_id,last_update_time,create_time)
|
||||
values('customers','customers','setting',current_timestamp,current_timestamp);
|
||||
|
||||
insert into sym_trigger
|
||||
(trigger_id,source_table_name,channel_id,last_update_time,create_time)
|
||||
values('tax_profiles','customers','setting',current_timestamp,current_timestamp);
|
||||
|
||||
insert into sym_trigger
|
||||
(trigger_id,source_table_name,channel_id,last_update_time,create_time)
|
||||
values('display_images','customers','setting',current_timestamp,current_timestamp);
|
||||
|
||||
# Create Trigger for Dining Channel
|
||||
|
||||
insert into sym_trigger
|
||||
@@ -279,6 +287,14 @@ delete from sym_node;
|
||||
(trigger_id,source_table_name,channel_id,last_update_time,create_time)
|
||||
values('surveys','surveys','sale',current_timestamp,current_timestamp);
|
||||
|
||||
insert into sym_trigger
|
||||
(trigger_id,source_table_name,channel_id,last_update_time,create_time)
|
||||
values('card_sale_trans','card_sale_trans','sale',current_timestamp,current_timestamp);
|
||||
|
||||
insert into sym_trigger
|
||||
(trigger_id,source_table_name,channel_id,last_update_time,create_time)
|
||||
values('card_settle_trans','card_settle_trans','sale',current_timestamp,current_timestamp);
|
||||
|
||||
# Create Trigger for OQS Channel
|
||||
|
||||
insert into sym_trigger
|
||||
@@ -351,6 +367,14 @@ delete from sym_node;
|
||||
(trigger_id,router_id,initial_load_order,last_update_time,create_time)
|
||||
values('customers','cloud_2_sx', 100, current_timestamp, current_timestamp);
|
||||
|
||||
insert into sym_trigger_router
|
||||
(trigger_id,router_id,initial_load_order,last_update_time,create_time)
|
||||
values('tax_profiles','cloud_2_sx', 100, current_timestamp, current_timestamp);
|
||||
|
||||
insert into sym_trigger_router
|
||||
(trigger_id,router_id,initial_load_order,last_update_time,create_time)
|
||||
values('display_images','cloud_2_sx', 100, current_timestamp, current_timestamp);
|
||||
|
||||
# Setting Channel # From Master to cloud
|
||||
insert into sym_trigger_router
|
||||
(trigger_id,router_id,initial_load_order,last_update_time,create_time)
|
||||
@@ -380,6 +404,14 @@ delete from sym_node;
|
||||
(trigger_id,router_id,initial_load_order,last_update_time,create_time)
|
||||
values('customers','sx_2_cloud', 100, current_timestamp, current_timestamp);
|
||||
|
||||
insert into sym_trigger_router
|
||||
(trigger_id,router_id,initial_load_order,last_update_time,create_time)
|
||||
values('tax_profiles','sx_2_cloud', 100, current_timestamp, current_timestamp);
|
||||
|
||||
insert into sym_trigger_router
|
||||
(trigger_id,router_id,initial_load_order,last_update_time,create_time)
|
||||
values('display_images','sx_2_cloud', 100, current_timestamp, current_timestamp);
|
||||
|
||||
#End Setting Channel
|
||||
|
||||
# Dining Channel # From cloud to SX
|
||||
@@ -661,6 +693,14 @@ delete from sym_node;
|
||||
(trigger_id,router_id,initial_load_order,last_update_time,create_time)
|
||||
values('surveys','cloud_2_sx', 200, current_timestamp, current_timestamp);
|
||||
|
||||
insert into sym_trigger_router
|
||||
(trigger_id,router_id,initial_load_order,last_update_time,create_time)
|
||||
values('card_sale_trans','cloud_2_sx', 200, current_timestamp, current_timestamp);
|
||||
|
||||
insert into sym_trigger_router
|
||||
(trigger_id,router_id,initial_load_order,last_update_time,create_time)
|
||||
values('card_settle_trans','cloud_2_sx', 200, current_timestamp, current_timestamp);
|
||||
|
||||
# Sale Channel # From SX to cloud
|
||||
insert into sym_trigger_router
|
||||
(trigger_id,router_id,initial_load_order,last_update_time,create_time)
|
||||
@@ -709,6 +749,15 @@ delete from sym_node;
|
||||
insert into sym_trigger_router
|
||||
(trigger_id,router_id,initial_load_order,last_update_time,create_time)
|
||||
values('surveys','sx_2_cloud', 200, current_timestamp, current_timestamp);
|
||||
|
||||
insert into sym_trigger_router
|
||||
(trigger_id,router_id,initial_load_order,last_update_time,create_time)
|
||||
values('card_sale_trans','sx_2_cloud', 200, current_timestamp, current_timestamp);
|
||||
|
||||
insert into sym_trigger_router
|
||||
(trigger_id,router_id,initial_load_order,last_update_time,create_time)
|
||||
values('card_settle_trans','sx_2_cloud', 200, current_timestamp, current_timestamp);
|
||||
|
||||
# End Sale Channel
|
||||
|
||||
# Oqs Channel # From cloud to Sx
|
||||
|
||||
Reference in New Issue
Block a user