diff --git a/Gemfile b/Gemfile
index 2e3813be..29d5201e 100644
--- a/Gemfile
+++ b/Gemfile
@@ -9,8 +9,8 @@ end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.2'
# Use mysql as the database for Active Record
-#gem 'mysql2', '>= 0.3.18', '< 0.5'
-gem 'pg'
+gem 'mysql2', '>= 0.3.18', '< 0.5'
+#gem 'pg'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
diff --git a/Gemfile.lock b/Gemfile.lock
index 4d0efb49..c89fcd45 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -96,11 +96,11 @@ GEM
mini_portile2 (2.1.0)
minitest (5.10.1)
multi_json (1.12.1)
+ mysql2 (0.4.5)
nio4r (2.0.0)
nokogiri (1.7.1)
mini_portile2 (~> 2.1.0)
pdf-core (0.7.0)
- pg (0.20.0)
prawn (2.2.2)
pdf-core (~> 0.7.0)
ttfunk (~> 1.5)
@@ -230,7 +230,7 @@ DEPENDENCIES
jbuilder (~> 2.5)
jquery-rails
listen (~> 3.0.5)
- pg
+ mysql2 (>= 0.3.18, < 0.5)
prawn
prawn-table
puma (~> 3.0)
diff --git a/app/assets/stylesheets/CRM.scss b/app/assets/stylesheets/CRM.scss
new file mode 100644
index 00000000..b0f802f1
--- /dev/null
+++ b/app/assets/stylesheets/CRM.scss
@@ -0,0 +1,9 @@
+@import "bootstrap";
+@import "font-awesome";
+@import "theme";
+
+/* Show it is fixed to the top */
+// body {
+// min-height: 75rem;
+// padding-top: 4.5rem;
+// }
diff --git a/app/assets/stylesheets/OQS.scss b/app/assets/stylesheets/OQS.scss
new file mode 100644
index 00000000..b0f802f1
--- /dev/null
+++ b/app/assets/stylesheets/OQS.scss
@@ -0,0 +1,9 @@
+@import "bootstrap";
+@import "font-awesome";
+@import "theme";
+
+/* Show it is fixed to the top */
+// body {
+// min-height: 75rem;
+// padding-top: 4.5rem;
+// }
diff --git a/app/assets/stylesheets/orgiami.scss b/app/assets/stylesheets/orgiami.scss
new file mode 100644
index 00000000..b0f802f1
--- /dev/null
+++ b/app/assets/stylesheets/orgiami.scss
@@ -0,0 +1,9 @@
+@import "bootstrap";
+@import "font-awesome";
+@import "theme";
+
+/* Show it is fixed to the top */
+// body {
+// min-height: 75rem;
+// padding-top: 4.5rem;
+// }
diff --git a/app/assets/stylesheets/waiter.scss b/app/assets/stylesheets/waiter.scss
new file mode 100644
index 00000000..b0f802f1
--- /dev/null
+++ b/app/assets/stylesheets/waiter.scss
@@ -0,0 +1,9 @@
+@import "bootstrap";
+@import "font-awesome";
+@import "theme";
+
+/* Show it is fixed to the top */
+// body {
+// min-height: 75rem;
+// padding-top: 4.5rem;
+// }
diff --git a/app/controllers/base_crm_controller.rb b/app/controllers/base_crm_controller.rb
new file mode 100644
index 00000000..a6bf7754
--- /dev/null
+++ b/app/controllers/base_crm_controller.rb
@@ -0,0 +1,9 @@
+class BaseCrmController < ActionController::Base
+ include LoginVerification
+ layout "CRM"
+
+ #before_action :check_installation
+ protect_from_forgery with: :exception
+
+
+end
diff --git a/app/controllers/concerns/login_verification.rb b/app/controllers/concerns/login_verification.rb
index 41e30855..ab5823de 100644
--- a/app/controllers/concerns/login_verification.rb
+++ b/app/controllers/concerns/login_verification.rb
@@ -3,6 +3,8 @@ module LoginVerification
included do
before_action :authenticate
+ helper_method :current_company,:current_login_employee
+
end
@@ -30,4 +32,28 @@ module LoginVerification
redirect_to root_path
end
+
+ #this is base api base controller to need to inherit.
+ #all token authentication must be done here
+ #response format must be set to JSON
+ def current_company
+ begin
+ return Company.first
+ rescue
+ return nil
+ end
+
+ end
+
+ def current_login_employee
+ @employee = Employee.find_by_token_session(session[:session_token])
+ end
+
+ private
+ def check_installation
+ if current_company.nil?
+ redirect_to install_path
+ end
+ end
+
end
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index 33fa5cd7..c3dba58b 100644
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -33,7 +33,6 @@ class HomeController < ApplicationController
def destroy
session[:session_token] = nil
redirect_to root_path
-
end
private
diff --git a/app/views/layouts/CRM.html.erb b/app/views/layouts/CRM.html.erb
new file mode 100644
index 00000000..c6cc4d99
--- /dev/null
+++ b/app/views/layouts/CRM.html.erb
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+ SmartSales : Restaurant
+ <%= csrf_meta_tags %>
+
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
+ <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
+
+
+
+ <%= render 'layouts/header' %>
+
+ <% flash.each do |type, message| %>
+
+
+ <%= message %>
+
+ <% end %>
+ <%= yield %>
+
+
+
+
diff --git a/app/views/layouts/OQS.html.erb b/app/views/layouts/OQS.html.erb
new file mode 100644
index 00000000..c6cc4d99
--- /dev/null
+++ b/app/views/layouts/OQS.html.erb
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+ SmartSales : Restaurant
+ <%= csrf_meta_tags %>
+
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
+ <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
+
+
+
+ <%= render 'layouts/header' %>
+
+ <% flash.each do |type, message| %>
+
+
+ <%= message %>
+
+ <% end %>
+ <%= yield %>
+
+
+
+
diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb
index 84dd7be6..8eb9209f 100644
--- a/app/views/layouts/_header.html.erb
+++ b/app/views/layouts/_header.html.erb
@@ -5,14 +5,8 @@
H
+
+
+ - <%= current_login_employee.name %>
+ - |
+ - <%= link_to 'Logout', logout_path, method: :delete, data: { confirm: 'Are you sure?' } %>
+
+
+
diff --git a/app/views/layouts/origami.html.erb b/app/views/layouts/origami.html.erb
new file mode 100644
index 00000000..c6cc4d99
--- /dev/null
+++ b/app/views/layouts/origami.html.erb
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+ SmartSales : Restaurant
+ <%= csrf_meta_tags %>
+
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
+ <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
+
+
+
+ <%= render 'layouts/header' %>
+
+ <% flash.each do |type, message| %>
+
+
+ <%= message %>
+
+ <% end %>
+ <%= yield %>
+
+
+
+
diff --git a/app/views/layouts/waiter.html.erb b/app/views/layouts/waiter.html.erb
new file mode 100644
index 00000000..c6cc4d99
--- /dev/null
+++ b/app/views/layouts/waiter.html.erb
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+ SmartSales : Restaurant
+ <%= csrf_meta_tags %>
+
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
+ <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
+
+
+
+ <%= render 'layouts/header' %>
+
+ <% flash.each do |type, message| %>
+
+
+ <%= message %>
+
+ <% end %>
+ <%= yield %>
+
+
+
+
diff --git a/config/routes.rb b/config/routes.rb
index 36cfb3e0..b0aa38f5 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -50,7 +50,7 @@ Rails.application.routes.draw do
resources :memberships, only:[:create]
post "payment/:payment_method" => "payment#create"
put "payment/:id" => "payment#update"
- resources :receipt, :only [:create, :show] #generate receipt, show receipt
+ resources :receipt, only: [:create, :show] #generate receipt, show receipt
end
@@ -58,13 +58,13 @@ Rails.application.routes.draw do
end
#--------- Cashier ------------#
- namespace :cashier do
- #bookings
- #orders
- #invoices
- #receipt
+ resources :origami, only: [:index, :show] do
+ resources :payment, only: [:create ] #add payment by payment_method
+ resources :discount, only: [:create ] #add discount type
+
end
+
#--------- Waiter ------------#
namespace :waiter do
#zones
diff --git a/db/order_inputs_from_emenu b/db/order_inputs_from_emenu
new file mode 100644
index 00000000..6d82c6a2
--- /dev/null
+++ b/db/order_inputs_from_emenu
@@ -0,0 +1,22 @@
+{"order_source"=>"emenu", "order_type"=>"dine_in", "booking_id"=>"",
+"customer_id"=>"", "guest_info"=>"", "table_id"=>"1",
+"order_items"=>[{"order_item_id"=>1,
+ "item_instance_code"=>"II0021",
+ "quantity"=>1,
+ "options"=>[]},
+{"order_item_id"=>2,
+"item_instance_code"=>"II0042",
+"quantity"=>1, "parent_order_item_id"=>1,
+ "options"=>[]},
+ {"order_item_id"=>3,
+ "item_instance_code"=>"II0053",
+ "quantity"=>1,
+ "parent_order_item_id"=>1,
+ "options"=>["mild spicy"]},
+ {"order_item_id"=>4,
+ "item_instance_code"=>"II0031",
+ "quantity"=>1, "options"=>[]},
+ {"order_item_id"=>5,
+ "item_instance_code"=>"II0073",
+"quantity"=>1, "parent_order_item_id"=>4, "options"=>[]}],
+"order"=>{"order_type"=>"dine_in", "customer_id"=>"", "guest_info"=>""}}