From aa8c2621fc68b1a69612cf7ca3906b607a6a0285 Mon Sep 17 00:00:00 2001 From: Yan Date: Tue, 23 Jan 2018 14:40:32 +0630 Subject: [PATCH 1/6] add response in license --- app/controllers/application_controller.rb | 12 ++++++------ app/controllers/install_controller.rb | 2 +- app/models/license.rb | 2 ++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 7fafd6bd..0966a573 100755 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -36,13 +36,13 @@ class ApplicationController < ActionController::Base # redirect_to root_url(:host => request.domain) + "store_error" render :json => [{ status: false, message: 'Invalid Access!'}] end - else + 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 diff --git a/app/controllers/install_controller.rb b/app/controllers/install_controller.rb index fac74926..353509c3 100755 --- a/app/controllers/install_controller.rb +++ b/app/controllers/install_controller.rb @@ -30,7 +30,7 @@ class InstallController < BaseController # end @license = License.new(ENV["SX_PROVISION_URL"]) - response = @license.license_activate(restaurant, license_key, db_host, db_schema, db_user, db_password) + response = @license.license_activate(restaurant, license_key, db_host, db_schema, db_user, db_password) if response[:status] redirect_to root_url, notice: response["message"] else diff --git a/app/models/license.rb b/app/models/license.rb index 869abe59..7732d764 100755 --- a/app/models/license.rb +++ b/app/models/license.rb @@ -405,6 +405,8 @@ class License else response = { "status": false, "message": "Activation is success but Symmetric Sql not found. \n Please contact code2lab call center!"} end + else + response = { "status": false, "message": "Activation is success but Cannot create Sym Tables. \n Please contact code2lab call center!"} end else response = { "status": false, "message": "Activation is success but Symmetric not running. \n Please contact code2lab call center!"} From f6b92ad111a6ad61807a711a1ddea74324ba37b1 Mon Sep 17 00:00:00 2001 From: phyusin Date: Tue, 23 Jan 2018 15:02:50 +0630 Subject: [PATCH 2/6] change person item code process --- README.md | 4 ++-- app/views/api/orders/view_orders.json.jbuilder | 4 ++-- db/seeds.rb | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index aa292813..7add3b2c 100755 --- a/README.md +++ b/README.md @@ -37,8 +37,8 @@ Person and Extra Time category_code = SPL... //for menu categories special 1) must create Person in settings/accounts 2) must create Adult and Child in settings/item_attributes - 3) must be P00001 for Adult and P00002 for Child in settings/menu_categories/[cat_id]/simple_menu_items - 3) must be PI0001 for Adult and PI0002 for Child in settings/simple_menu_items/[item_id]/menu_item_instances + 3) must be PSA_[a-z/0-9] for Adult and PSC_[a-z/0-9] for Child in settings/menu_categories/[cat_id]/simple_menu_items + 3) must be PSAI_[a-z/0-9] for Adult and PSCI_[a-z/0-9] for Child in settings/simple_menu_items/[item_id]/menu_item_instances For Extra Time item_instance_code diff --git a/app/views/api/orders/view_orders.json.jbuilder b/app/views/api/orders/view_orders.json.jbuilder index a7759514..ae3fea84 100755 --- a/app/views/api/orders/view_orders.json.jbuilder +++ b/app/views/api/orders/view_orders.json.jbuilder @@ -37,11 +37,11 @@ if (@booking) json.order_items order_items do |item| # For YGN BBQ - if item.item_code == "P00001" + if item.item_code.include? ("PSA_") adult_count += item.qty adult_spent += (item.price * item.qty) end - if item.item_code == "P00002" + if item.item_code.include? ("PSC_") child_count += item.qty child_spent += (item.price * item.qty) end diff --git a/db/seeds.rb b/db/seeds.rb index 78321b72..1de300a1 100755 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -163,20 +163,20 @@ menu_pkg_options = MenuItemOption.create([{option_type: "Package", name: "Bottle # menu_item_attribute_adult = MenuItemAttribute.create({attribute_type:"person", name: "Adult", value: "adult"}) # menu_item_attribute_child = MenuItemAttribute.create({attribute_type:"person", name: "Child", value: "child"}) -# menu_category1_menu_item0 = SimpleMenuItem.create({item_code:"P00001", name: "Adult", alt_name: "",menu_category: menu_category1 , min_qty: 1, account: person, :item_attributes => "['1']", created_by: "System" }) -# menu_item0_instance = MenuItemInstance.create({item_instance_name:"",item_instance_code:"PI0001", menu_item: menu_category1_menu_item0, price:15000.00, is_on_promotion:false, is_default:true, :item_attributes => "['1']" }) +# menu_category1_menu_item0 = SimpleMenuItem.create({item_code:"PSA_00001", name: "Adult", alt_name: "",menu_category: menu_category1 , min_qty: 1, account: person, :item_attributes => "['1']", created_by: "System" }) +# menu_item0_instance = MenuItemInstance.create({item_instance_name:"",item_instance_code:"PSAI_0001", menu_item: menu_category1_menu_item0, price:15000.00, is_on_promotion:false, is_default:true, :item_attributes => "['1']" }) -# menu_category1_menu_item1 = SimpleMenuItem.create({item_code:"P00002", name: "Child", alt_name: "",menu_category: menu_category1 , min_qty: 1, account: person, :item_attributes => "['2']", created_by: "System" }) -# menu_item1_instance = MenuItemInstance.create({item_instance_name:"",item_instance_code:"PI0002", menu_item: menu_category1_menu_item1, price:10000.00, is_on_promotion:false, is_default:true, :item_attributes => "['2']" }) +# menu_category1_menu_item1 = SimpleMenuItem.create({item_code:"PSC_00002", name: "Child", alt_name: "",menu_category: menu_category1 , min_qty: 1, account: person, :item_attributes => "['2']", created_by: "System" }) +# menu_item1_instance = MenuItemInstance.create({item_instance_name:"",item_instance_code:"PSCI_0002", menu_item: menu_category1_menu_item1, price:10000.00, is_on_promotion:false, is_default:true, :item_attributes => "['2']" }) # menu_item_attribute_30_min = MenuItemAttribute.create({attribute_type:"Extra Time", name: "30 min", value: "30_min"}) # menu_item_attribute_60_min = MenuItemAttribute.create({attribute_type:"Extra Time", name: "1 hrs", value: "60_min"}) # menu_category1_menu_item2 = SimpleMenuItem.create({item_code:"Ext30", name: "30 minutes", alt_name: "",menu_category: menu_category5 , min_qty: 1, account: extra_time, :item_attributes => "['1']", created_by: "System" }) -# menu_item0_instance = MenuItemInstance.create({item_instance_name:"",item_instance_code:"Exti30", menu_item: menu_category1_menu_item2, price:15000.00, is_on_promotion:false, is_default:true, :item_attributes => "['1']" }) +# menu_item0_instance = MenuItemInstance.create({item_instance_name:"",item_instance_code:"Extim_30", menu_item: menu_category1_menu_item2, price:15000.00, is_on_promotion:false, is_default:true, :item_attributes => "['1']" }) # menu_category1_menu_item3 = SimpleMenuItem.create({item_code:"Ext60", name: "1 hour", alt_name: "",menu_category: menu_category5 , min_qty: 1, account: extra_time, :item_attributes => "['2']", created_by: "System" }) -# menu_item1_instance = MenuItemInstance.create({item_instance_name:"",item_instance_code:"Exti60", menu_item: menu_category1_menu_item3, price:10000.00, is_on_promotion:false, is_default:true, :item_attributes => "['2']" }) +# menu_item1_instance = MenuItemInstance.create({item_instance_name:"",item_instance_code:"Extim_60", menu_item: menu_category1_menu_item3, price:10000.00, is_on_promotion:false, is_default:true, :item_attributes => "['2']" }) # END From 4248e535177f35bacfbee0cb9fda7a9af839c6ab Mon Sep 17 00:00:00 2001 From: Yan Date: Tue, 23 Jan 2018 15:14:07 +0630 Subject: [PATCH 3/6] add sudo for sym run --- app/controllers/sym_control_controller.rb | 10 +++++----- app/models/license.rb | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/controllers/sym_control_controller.rb b/app/controllers/sym_control_controller.rb index 9b7a7a66..bbd4a087 100644 --- a/app/controllers/sym_control_controller.rb +++ b/app/controllers/sym_control_controller.rb @@ -4,7 +4,7 @@ class SymControlController < BaseController def run sym_path = "/home/yan/symmetric/" - check_sym_proc_str = `#{"service SymmetricDS status"}` + check_sym_proc_str = `#{"sudo service SymmetricDS status"}` # Check Sym Installed # if sym_install_status[1] == "false" # response = { "status": false, "message": "Activation is success but Symmetric service not Installed. \n Please contact code2lab call center!"} @@ -12,15 +12,15 @@ 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(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(sym_path + "bin/dbimport --engine sx " + sym_sql.to_s) - stop_sym = system("service SymmetricDS stop") - run_sym = system("service SymmetricDS start") + 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 flash[:notice] = 'Success!' end diff --git a/app/models/license.rb b/app/models/license.rb index 7732d764..8c22f478 100755 --- a/app/models/license.rb +++ b/app/models/license.rb @@ -379,7 +379,7 @@ class License # check_sym_proc_str = check_sym_proc_str.split("\n") # sym_install_status = check_sym_proc_str[0].split(": ") - check_sym_proc_str = `#{"service SymmetricDS status"}` + check_sym_proc_str = `#{"sudo service SymmetricDS status"}` # Check Sym Installed # if sym_install_status[1] == "false" @@ -390,15 +390,15 @@ 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(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(sym_path + "bin/dbimport --engine sx " + sym_sql.to_s) - stop_sym = system("service SymmetricDS stop") - run_sym = system("service SymmetricDS start") + 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 response = { "status": true, "message": "Activation is success and Configuration done..."} end From e3fdc68f9a833013db5d4d85e6edff616abdf1b9 Mon Sep 17 00:00:00 2001 From: Yan Date: Tue, 23 Jan 2018 15:15:12 +0630 Subject: [PATCH 4/6] comment licence check --- app/controllers/application_controller.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0966a573..e66d7700 100755 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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 From 73eb86ce9a5404457989d034df3c9c9d0a2a9754 Mon Sep 17 00:00:00 2001 From: phyusin Date: Tue, 23 Jan 2018 16:13:23 +0630 Subject: [PATCH 5/6] add localization for settings/lookups --- app/views/settings/accounts/index.html.erb | 2 +- app/views/settings/lookups/_form.html.erb | 19 +++-- app/views/settings/lookups/index.html.erb | 81 +++++++++++++--------- config/locales/en.yml | 2 + config/locales/mm.yml | 2 + 5 files changed, 67 insertions(+), 39 deletions(-) diff --git a/app/views/settings/accounts/index.html.erb b/app/views/settings/accounts/index.html.erb index 5ffcbff5..8d0df9b8 100755 --- a/app/views/settings/accounts/index.html.erb +++ b/app/views/settings/accounts/index.html.erb @@ -63,7 +63,7 @@

1) <%= t("views.right_panel.button.new") %> - <%= t("views.right_panel.detail.new_btn_txt") %> <%= t("views.right_panel.detail.account_txt") %>
2) <%= t("views.right_panel.button.show") %> - <%= t("views.right_panel.detail.show_btn_txt") %> <%= t("views.right_panel.detail.account_txt") %>
- 2) <%= t("views.right_panel.button.edit") %> - <%= t("views.right_panel.detail.edit_btn_txt") %> <%= t("views.right_panel.detail.account_txt") %>
+ 3) <%= t("views.right_panel.button.edit") %> - <%= t("views.right_panel.detail.edit_btn_txt") %> <%= t("views.right_panel.detail.account_txt") %>

list <%= t("views.right_panel.header.link_lists") %>

diff --git a/app/views/settings/lookups/_form.html.erb b/app/views/settings/lookups/_form.html.erb index 8196a906..1c5e549d 100755 --- a/app/views/settings/lookups/_form.html.erb +++ b/app/views/settings/lookups/_form.html.erb @@ -19,10 +19,21 @@

- Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod - tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, - quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo - consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse +
view_headline <%= t("views.right_panel.header.page_detail") %>
+

+ 1) <%= t("views.right_panel.detail.lookup") + " " + t("views.right_panel.detail.type_txt") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.lookup_txt") %>
+ 2) <%= t("views.right_panel.detail.name") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.name_txt2") %>
+ 3) <%= t("views.right_panel.detail.value") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.value_txt") %>
+

+
list <%= t("views.right_panel.header.button_lists") %>
+

+ 1) <%= t("views.right_panel.button.submit") %> - <%= t("views.right_panel.detail.submit_btn_txt") %> <%= t("views.right_panel.detail.lookup_txt") %>
+

+
list <%= t("views.right_panel.header.link_lists") %>
+

+ 1) <%= t("views.right_panel.button.home") %> - <%= t("views.right_panel.detail.home_txt") %>
+ 2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.lookup_txt") %>
+

diff --git a/app/views/settings/lookups/index.html.erb b/app/views/settings/lookups/index.html.erb index 85588d6a..174ff9d7 100755 --- a/app/views/settings/lookups/index.html.erb +++ b/app/views/settings/lookups/index.html.erb @@ -11,29 +11,29 @@
-
- <%= link_to t("views.btn.new"),new_settings_lookup_path,:class => 'btn btn-primary btn-lg float-right waves-effect"' %> -
+
+ <%= link_to t("views.btn.new"),new_settings_lookup_path,:class => 'btn btn-primary btn-lg float-right waves-effect"' %> +
- - - - - - - - - +
Lookup typeNameValueAction
+ + + + + + + + - - <% @settings_lookups.each do |settings_lookup| %> - - - - - - + <% @settings_lookups.each do |settings_lookup| %> + + + + + +
<%= t("views.right_panel.detail.lookup") +" "+ t("views.right_panel.detail.type_txt") %><%= t("views.right_panel.detail.name") %><%= t("views.right_panel.detail.value") %><%= t("views.right_panel.detail.actions") %>
<%= settings_lookup.lookup_type %><%= settings_lookup.name %><%= settings_lookup.value %> - <%= link_to t("views.btn.edit"), edit_settings_lookup_path(settings_lookup),:class => 'btn btn-primary btn-sm waves-effect' %> +
<%= settings_lookup.lookup_type %><%= settings_lookup.name %><%= settings_lookup.value %> + <%= link_to t("views.btn.edit"), edit_settings_lookup_path(settings_lookup),:class => 'btn btn-primary btn-sm waves-effect' %>