user role scoped layout and controller
This commit is contained in:
4
Gemfile
4
Gemfile
@@ -9,8 +9,8 @@ end
|
|||||||
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
||||||
gem 'rails', '~> 5.0.2'
|
gem 'rails', '~> 5.0.2'
|
||||||
# Use mysql as the database for Active Record
|
# Use mysql as the database for Active Record
|
||||||
#gem 'mysql2', '>= 0.3.18', '< 0.5'
|
gem 'mysql2', '>= 0.3.18', '< 0.5'
|
||||||
gem 'pg'
|
#gem 'pg'
|
||||||
# Use Puma as the app server
|
# Use Puma as the app server
|
||||||
gem 'puma', '~> 3.0'
|
gem 'puma', '~> 3.0'
|
||||||
# Use SCSS for stylesheets
|
# Use SCSS for stylesheets
|
||||||
|
|||||||
@@ -96,11 +96,11 @@ GEM
|
|||||||
mini_portile2 (2.1.0)
|
mini_portile2 (2.1.0)
|
||||||
minitest (5.10.1)
|
minitest (5.10.1)
|
||||||
multi_json (1.12.1)
|
multi_json (1.12.1)
|
||||||
|
mysql2 (0.4.5)
|
||||||
nio4r (2.0.0)
|
nio4r (2.0.0)
|
||||||
nokogiri (1.7.1)
|
nokogiri (1.7.1)
|
||||||
mini_portile2 (~> 2.1.0)
|
mini_portile2 (~> 2.1.0)
|
||||||
pdf-core (0.7.0)
|
pdf-core (0.7.0)
|
||||||
pg (0.20.0)
|
|
||||||
prawn (2.2.2)
|
prawn (2.2.2)
|
||||||
pdf-core (~> 0.7.0)
|
pdf-core (~> 0.7.0)
|
||||||
ttfunk (~> 1.5)
|
ttfunk (~> 1.5)
|
||||||
@@ -230,7 +230,7 @@ DEPENDENCIES
|
|||||||
jbuilder (~> 2.5)
|
jbuilder (~> 2.5)
|
||||||
jquery-rails
|
jquery-rails
|
||||||
listen (~> 3.0.5)
|
listen (~> 3.0.5)
|
||||||
pg
|
mysql2 (>= 0.3.18, < 0.5)
|
||||||
prawn
|
prawn
|
||||||
prawn-table
|
prawn-table
|
||||||
puma (~> 3.0)
|
puma (~> 3.0)
|
||||||
|
|||||||
9
app/assets/stylesheets/CRM.scss
Normal file
9
app/assets/stylesheets/CRM.scss
Normal file
@@ -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;
|
||||||
|
// }
|
||||||
9
app/assets/stylesheets/OQS.scss
Normal file
9
app/assets/stylesheets/OQS.scss
Normal file
@@ -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;
|
||||||
|
// }
|
||||||
9
app/assets/stylesheets/orgiami.scss
Normal file
9
app/assets/stylesheets/orgiami.scss
Normal file
@@ -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;
|
||||||
|
// }
|
||||||
9
app/assets/stylesheets/waiter.scss
Normal file
9
app/assets/stylesheets/waiter.scss
Normal file
@@ -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;
|
||||||
|
// }
|
||||||
9
app/controllers/base_crm_controller.rb
Normal file
9
app/controllers/base_crm_controller.rb
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
class BaseCrmController < ActionController::Base
|
||||||
|
include LoginVerification
|
||||||
|
layout "CRM"
|
||||||
|
|
||||||
|
#before_action :check_installation
|
||||||
|
protect_from_forgery with: :exception
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
@@ -3,6 +3,8 @@ module LoginVerification
|
|||||||
|
|
||||||
included do
|
included do
|
||||||
before_action :authenticate
|
before_action :authenticate
|
||||||
|
helper_method :current_company,:current_login_employee
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -30,4 +32,28 @@ module LoginVerification
|
|||||||
redirect_to root_path
|
redirect_to root_path
|
||||||
end
|
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
|
end
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ class HomeController < ApplicationController
|
|||||||
def destroy
|
def destroy
|
||||||
session[:session_token] = nil
|
session[:session_token] = nil
|
||||||
redirect_to root_path
|
redirect_to root_path
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
29
app/views/layouts/CRM.html.erb
Normal file
29
app/views/layouts/CRM.html.erb
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8"/>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
|
||||||
|
<meta name="description" content=""/>
|
||||||
|
<meta name="author" content=""/>
|
||||||
|
|
||||||
|
<title>SmartSales : Restaurant</title>
|
||||||
|
<%= csrf_meta_tags %>
|
||||||
|
|
||||||
|
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||||
|
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<%= render 'layouts/header' %>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<% flash.each do |type, message| %>
|
||||||
|
<div class="alert fade in">
|
||||||
|
<button class="close" aria-hidden="true" data-dismiss="alert" type="button">×</button>
|
||||||
|
<%= message %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<%= yield %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
29
app/views/layouts/OQS.html.erb
Normal file
29
app/views/layouts/OQS.html.erb
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8"/>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
|
||||||
|
<meta name="description" content=""/>
|
||||||
|
<meta name="author" content=""/>
|
||||||
|
|
||||||
|
<title>SmartSales : Restaurant</title>
|
||||||
|
<%= csrf_meta_tags %>
|
||||||
|
|
||||||
|
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||||
|
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<%= render 'layouts/header' %>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<% flash.each do |type, message| %>
|
||||||
|
<div class="alert fade in">
|
||||||
|
<button class="close" aria-hidden="true" data-dismiss="alert" type="button">×</button>
|
||||||
|
<%= message %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<%= yield %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -5,14 +5,8 @@
|
|||||||
<a class="navbar-brand" href="#">H</a>
|
<a class="navbar-brand" href="#">H</a>
|
||||||
<div class="collapse navbar-collapse" id="navbarCollapse">
|
<div class="collapse navbar-collapse" id="navbarCollapse">
|
||||||
<ul class="navbar-nav mr-auto">
|
<ul class="navbar-nav mr-auto">
|
||||||
<li class="nav-item active">
|
<li class="navbar-nav mr-auto dropdown">
|
||||||
<a class="nav-link" href="/">Home <span class="sr-only">(current)</span></a>
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Settings</a>
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="#">Link</a>
|
|
||||||
</li>
|
|
||||||
<li class="dropdown">
|
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Settings<span class="caret"></span></a>
|
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><%= link_to "Menus ", settings_menus_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Menus ", settings_menus_path, :tabindex =>"-1" %></li>
|
||||||
<li><%= link_to "Menu Categories", settings_menu_categories_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Menu Categories", settings_menu_categories_path, :tabindex =>"-1" %></li>
|
||||||
@@ -27,7 +21,16 @@
|
|||||||
<li><%= link_to "Tax Profile", settings_tax_profiles_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Tax Profile", settings_tax_profiles_path, :tabindex =>"-1" %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="right">
|
||||||
|
<ul class="navbar-nav mr-auto">
|
||||||
|
<li><%= current_login_employee.name %> </li>
|
||||||
|
<li style="padding-right:10px;padding-left:10px"> | </li>
|
||||||
|
<li ><%= link_to 'Logout', logout_path, method: :delete, data: { confirm: 'Are you sure?' } %>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
29
app/views/layouts/origami.html.erb
Normal file
29
app/views/layouts/origami.html.erb
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8"/>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
|
||||||
|
<meta name="description" content=""/>
|
||||||
|
<meta name="author" content=""/>
|
||||||
|
|
||||||
|
<title>SmartSales : Restaurant</title>
|
||||||
|
<%= csrf_meta_tags %>
|
||||||
|
|
||||||
|
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||||
|
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<%= render 'layouts/header' %>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<% flash.each do |type, message| %>
|
||||||
|
<div class="alert fade in">
|
||||||
|
<button class="close" aria-hidden="true" data-dismiss="alert" type="button">×</button>
|
||||||
|
<%= message %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<%= yield %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
29
app/views/layouts/waiter.html.erb
Normal file
29
app/views/layouts/waiter.html.erb
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8"/>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
|
||||||
|
<meta name="description" content=""/>
|
||||||
|
<meta name="author" content=""/>
|
||||||
|
|
||||||
|
<title>SmartSales : Restaurant</title>
|
||||||
|
<%= csrf_meta_tags %>
|
||||||
|
|
||||||
|
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||||
|
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<%= render 'layouts/header' %>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<% flash.each do |type, message| %>
|
||||||
|
<div class="alert fade in">
|
||||||
|
<button class="close" aria-hidden="true" data-dismiss="alert" type="button">×</button>
|
||||||
|
<%= message %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<%= yield %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -50,7 +50,7 @@ Rails.application.routes.draw do
|
|||||||
resources :memberships, only:[:create]
|
resources :memberships, only:[:create]
|
||||||
post "payment/:payment_method" => "payment#create"
|
post "payment/:payment_method" => "payment#create"
|
||||||
put "payment/:id" => "payment#update"
|
put "payment/:id" => "payment#update"
|
||||||
resources :receipt, :only [:create, :show] #generate receipt, show receipt
|
resources :receipt, only: [:create, :show] #generate receipt, show receipt
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -58,13 +58,13 @@ Rails.application.routes.draw do
|
|||||||
end
|
end
|
||||||
|
|
||||||
#--------- Cashier ------------#
|
#--------- Cashier ------------#
|
||||||
namespace :cashier do
|
resources :origami, only: [:index, :show] do
|
||||||
#bookings
|
resources :payment, only: [:create ] #add payment by payment_method
|
||||||
#orders
|
resources :discount, only: [:create ] #add discount type
|
||||||
#invoices
|
|
||||||
#receipt
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
#--------- Waiter ------------#
|
#--------- Waiter ------------#
|
||||||
namespace :waiter do
|
namespace :waiter do
|
||||||
#zones
|
#zones
|
||||||
|
|||||||
22
db/order_inputs_from_emenu
Normal file
22
db/order_inputs_from_emenu
Normal file
@@ -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"=>""}}
|
||||||
Reference in New Issue
Block a user