From b99c503afa6ae5c1d43c725691d2d90b4e52a8db Mon Sep 17 00:00:00 2001 From: Nweni Date: Fri, 25 Aug 2017 09:40:59 +0630 Subject: [PATCH] inventory --- app/controllers/base_inventory_controller.rb | 17 ++++++++++ .../inventory/inventory_controller.rb | 6 ++++ .../inventory_definitions_controller.rb | 2 +- .../inventory_definitions_helper.rb | 0 .../stock_check_items_helper.rb | 0 .../{inventory => }/stock_checks_helper.rb | 0 .../{inventory => }/stock_journals_helper.rb | 0 app/views/home/dashboard.html.erb | 12 ++++++- app/views/inventory/inventory/index.html.erb | 17 ++++++++++ app/views/layouts/inventory.html.erb | 34 +++++++++++++++++++ config/routes.rb | 1 + 11 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 app/controllers/base_inventory_controller.rb create mode 100644 app/controllers/inventory/inventory_controller.rb rename app/helpers/{inventory => }/inventory_definitions_helper.rb (100%) rename app/helpers/{inventory => }/stock_check_items_helper.rb (100%) rename app/helpers/{inventory => }/stock_checks_helper.rb (100%) rename app/helpers/{inventory => }/stock_journals_helper.rb (100%) create mode 100644 app/views/inventory/inventory/index.html.erb create mode 100644 app/views/layouts/inventory.html.erb diff --git a/app/controllers/base_inventory_controller.rb b/app/controllers/base_inventory_controller.rb new file mode 100644 index 00000000..4059ac25 --- /dev/null +++ b/app/controllers/base_inventory_controller.rb @@ -0,0 +1,17 @@ +class BaseInventoryController < ActionController::Base + include LoginVerification + layout "inventory" + + #before_action :check_installation + protect_from_forgery with: :exception + + rescue_from CanCan::AccessDenied do |exception| + flash[:warning] = exception.message + redirect_to root_path + end + + def current_user + @current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token] + end + +end diff --git a/app/controllers/inventory/inventory_controller.rb b/app/controllers/inventory/inventory_controller.rb new file mode 100644 index 00000000..525f0277 --- /dev/null +++ b/app/controllers/inventory/inventory_controller.rb @@ -0,0 +1,6 @@ +class Inventory::InventoryController < BaseInventoryController + + def index + + end +end diff --git a/app/controllers/inventory/inventory_definitions_controller.rb b/app/controllers/inventory/inventory_definitions_controller.rb index 7c7288df..8a3f3a40 100644 --- a/app/controllers/inventory/inventory_definitions_controller.rb +++ b/app/controllers/inventory/inventory_definitions_controller.rb @@ -1,4 +1,4 @@ -class InventoryDefinitionsController < ApplicationController +class Inventory::InventoryDefinitionsController < BaseInventoryController before_action :set_inventory_definition, only: [:show, :edit, :update, :destroy] # GET /inventory_definitions diff --git a/app/helpers/inventory/inventory_definitions_helper.rb b/app/helpers/inventory_definitions_helper.rb similarity index 100% rename from app/helpers/inventory/inventory_definitions_helper.rb rename to app/helpers/inventory_definitions_helper.rb diff --git a/app/helpers/inventory/stock_check_items_helper.rb b/app/helpers/stock_check_items_helper.rb similarity index 100% rename from app/helpers/inventory/stock_check_items_helper.rb rename to app/helpers/stock_check_items_helper.rb diff --git a/app/helpers/inventory/stock_checks_helper.rb b/app/helpers/stock_checks_helper.rb similarity index 100% rename from app/helpers/inventory/stock_checks_helper.rb rename to app/helpers/stock_checks_helper.rb diff --git a/app/helpers/inventory/stock_journals_helper.rb b/app/helpers/stock_journals_helper.rb similarity index 100% rename from app/helpers/inventory/stock_journals_helper.rb rename to app/helpers/stock_journals_helper.rb diff --git a/app/views/home/dashboard.html.erb b/app/views/home/dashboard.html.erb index 08991091..8a922573 100644 --- a/app/views/home/dashboard.html.erb +++ b/app/views/home/dashboard.html.erb @@ -55,6 +55,17 @@ + +
+
+
+
+ Inventory +
+
+
+
+
@@ -274,4 +285,3 @@ } - diff --git a/app/views/inventory/inventory/index.html.erb b/app/views/inventory/inventory/index.html.erb new file mode 100644 index 00000000..e8826240 --- /dev/null +++ b/app/views/inventory/inventory/index.html.erb @@ -0,0 +1,17 @@ +# Hello Inventory +
+
+ +
+
+ + + + + <%if current_login_employee.role == "administrator" || current_login_employee.role == "manager" %> + + <%end%> + +
+
diff --git a/app/views/layouts/inventory.html.erb b/app/views/layouts/inventory.html.erb new file mode 100644 index 00000000..5bcf7e0a --- /dev/null +++ b/app/views/layouts/inventory.html.erb @@ -0,0 +1,34 @@ + + + + + + + + + SmartSales : Restaurant + <%= csrf_meta_tags %> + + <%= stylesheet_link_tag 'inventory', media: 'all', 'data-turbolinks-track': 'reload' %> + <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> + <%= stylesheet_link_tag 'jquery-confirm', media: 'all', 'data-turbolinks-track': 'reload' %> + <%= javascript_include_tag 'jquery-confirm', 'data-turbolinks-track': 'reload' %> + + + + <%= render 'layouts/header_orgiami' %> +
+ <% flash.each do |type, message| %> + <% if !flash["errors"]%> +
+ + <%=message%> +
+ <% end %> + + <% end %> + <%= yield %> + +
+ + diff --git a/config/routes.rb b/config/routes.rb index 69d3096c..8dfae73f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -318,6 +318,7 @@ Rails.application.routes.draw do # ----------- Inventory --------------------------- namespace :inventory do + get 'inventory' => 'inventory#index' resources :stock_check_items resources :stock_checks resources :stock_journals