diff --git a/app/assets/images/logo.png b/app/assets/images/logo.png new file mode 100644 index 00000000..578d16f7 Binary files /dev/null and b/app/assets/images/logo.png differ diff --git a/app/assets/javascripts/origami/addorders.coffee b/app/assets/javascripts/origami/addorders.coffee new file mode 100644 index 00000000..24f83d18 --- /dev/null +++ b/app/assets/javascripts/origami/addorders.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/stylesheets/origami.scss b/app/assets/stylesheets/origami.scss index 0139f1d0..10e2b319 100644 --- a/app/assets/stylesheets/origami.scss +++ b/app/assets/stylesheets/origami.scss @@ -268,4 +268,3 @@ tr.discount-item-row:hover { -moz-opacity: 1; /* mozilla */ } - diff --git a/app/assets/stylesheets/origami/addorders.scss b/app/assets/stylesheets/origami/addorders.scss new file mode 100644 index 00000000..f45d06f3 --- /dev/null +++ b/app/assets/stylesheets/origami/addorders.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the origami/addorders controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/api/restaurant/menu_categories.rb b/app/controllers/api/restaurant/menu_categories_controller.rb similarity index 63% rename from app/controllers/api/restaurant/menu_categories.rb rename to app/controllers/api/restaurant/menu_categories_controller.rb index fe7983ea..f1f3e6d0 100644 --- a/app/controllers/api/restaurant/menu_categories.rb +++ b/app/controllers/api/restaurant/menu_categories_controller.rb @@ -1,11 +1,11 @@ -class Api::Restaurant::MenuController < Api::ApiController - +class Api::Restaurant::MenuCategoriesController < Api::ApiController + skip_before_action :authenticate #Description # Pull the default menu details and also other available (active) menus # Input Params - order_id def index - @menus = Menu.all - @current_menu = Menu.current_menu + @menus = MenuCategory.all + @current_menu = MenuCategory.current_menu end @@ -21,10 +21,10 @@ class Api::Restaurant::MenuController < Api::ApiController def menu_detail (menu_id) if (menu_id) #Pull this menu - menu = Menu.find_by_id(menu_id) + menu = MenuCategory.find_by_id(menu_id) return menu else - Menu.current_menu + MenuCategory.current_menu end end diff --git a/app/controllers/api/restaurant/menu_controller.rb b/app/controllers/api/restaurant/menu_controller.rb index f6f2902b..b45e1189 100644 --- a/app/controllers/api/restaurant/menu_controller.rb +++ b/app/controllers/api/restaurant/menu_controller.rb @@ -1,5 +1,5 @@ class Api::Restaurant::MenuController < Api::ApiController - + skip_before_action :authenticate #Description # Pull the default menu details and also other available (active) menus # Input Params - order_id diff --git a/app/controllers/origami/addorders_controller.rb b/app/controllers/origami/addorders_controller.rb new file mode 100644 index 00000000..e65b24b7 --- /dev/null +++ b/app/controllers/origami/addorders_controller.rb @@ -0,0 +1,22 @@ +class Origami::AddordersController < BaseOrigamiController + before_action :set_dining, only: [:show] + + def index + @tables = Table.all.active.order('zone_id asc').group("zone_id") + @rooms = Room.all.active.order('zone_id asc').group("zone_id") + @all_table = Table.all.active.order('status desc') + @all_room = Room.all.active.order('status desc') + end + + def show + @menu = MenuCategory.all + @table_id = params[:id] + end + + private + + def set_dining + @dining = DiningFacility.find(params[:id]) + end + +end diff --git a/app/helpers/origami/addorders_helper.rb b/app/helpers/origami/addorders_helper.rb new file mode 100644 index 00000000..c90e5344 --- /dev/null +++ b/app/helpers/origami/addorders_helper.rb @@ -0,0 +1,2 @@ +module Origami::AddordersHelper +end diff --git a/app/views/api/restaurant/menu/_menu_item.json.jbuilder b/app/views/api/restaurant/menu/_menu_item.json.jbuilder index f0b790b7..ffad3dc2 100644 --- a/app/views/api/restaurant/menu/_menu_item.json.jbuilder +++ b/app/views/api/restaurant/menu/_menu_item.json.jbuilder @@ -38,9 +38,10 @@ json.options item.item_options # end end + #Child Menu items # if (item.children) then # json.set_items item.children.each do |item| # json.partial! 'api/restaurant/menu/menu_item', item: item # end -# end +# end \ No newline at end of file diff --git a/app/views/api/restaurant/menu_categories/show.json.jbuilder b/app/views/api/restaurant/menu_categories/show.json.jbuilder new file mode 100644 index 00000000..f48f6c77 --- /dev/null +++ b/app/views/api/restaurant/menu_categories/show.json.jbuilder @@ -0,0 +1,43 @@ +if @menu.menu_items + json.menu_items @menu.menu_items do |item| + #Menu Item Information + json.item_code item.item_code + json.name item.name + json.alt_name item.alt_name + json.type item.type + json.min_qty item.min_qty + # json.min_selectable_item item.min_selectable_item + # json.max_selectable_item item.max_selectable_item + + #Item instance + if item.menu_item_instances.count == 1 then + + item_instance = item.menu_item_instances[0] + json.price item_instance.price + json.is_available item_instance.is_available + json.is_on_promotion item_instance.is_on_promotion + json.promotion_price item_instance.promotion_price + json.item_attributes item_instance.item_attributes + + elsif item.menu_item_instances.count > 1 then + + json.item_instances item.menu_item_instances do |is| + json.item_instance_item_code is.item_instance_code + json.item_instance_name is.item_instance_name + json.price is.price + json.is_available is.is_available + json.is_on_promotion is.is_on_promotion + json.promotion_price is.promotion_price + json.item_attributes is.item_attributes + end + + end + #Child Menu items + if (item.menu_item_sets) then + json.set_items item.menu_item_sets.each do |item| + json.partial! 'api/restaurant/menu/menu_item', item: item + end + + end + end +end diff --git a/app/views/origami/addorders/index.html.erb b/app/views/origami/addorders/index.html.erb new file mode 100644 index 00000000..50e52d3e --- /dev/null +++ b/app/views/origami/addorders/index.html.erb @@ -0,0 +1,108 @@ +
+
+ +
+ +
+ <% @tables.each do |zone| %> +

Zone : <%=zone.zone.name%>

+
+ + <% @all_table.each do |table| %> + <% if zone.zone_id == table.zone_id %> +
" data-id = "<%= table.id %>"> +
+ +

<%= table.name %>

+

Seat : <%= table.seater %>

+
+
+ <% end %> <% end %> +
+ <% end %> +
+ +
+ <% @rooms.each do |zone| %> +

Zone : <%=zone.zone.name%>

+
+ + <% @all_room.each do |room| %> + <% if zone.zone_id == room.zone_id %> +
" data-id = "<%= room.id %>"> +
+ +

<%= room.name %>

+

Seat : <%= room.seater %>

+
+
+ <% end %> <% end %> +
+ <% end %> +
+ +
+
+ +
+ +
+
+ + diff --git a/app/views/origami/addorders/show.html.erb b/app/views/origami/addorders/show.html.erb new file mode 100644 index 00000000..1c400d0d --- /dev/null +++ b/app/views/origami/addorders/show.html.erb @@ -0,0 +1,323 @@ +
+
+ +
+
+ +
+ +
+
+
+ ORDER DETAILS | Table <%=@table_id%> +
+
+
+
+ + + + + + + + + + + + +
#ItemsQTYPrice
+
+ +
+
+ + + + + + + + + + diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 726194d1..c60e8917 100644 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -305,31 +305,28 @@ + <% if @dining.bookings.length >= 1 %> - - <% if @status_order == 'order' && @status_sale != 'sale' %> - - - - - - - - - - - <% else %> - - - - - - - - - - - <% end %> + + <% if @status_order == 'order' && @status_sale != 'sale' %> + + + + + + + + + <% else %> + + + + + + + + + <% end %> @@ -580,4 +577,9 @@ function show_customer_details(customer_id){ } }); + + $('#add_order').on('click',function(){ + var dining_id = "<%= @dining.id %>" + window.location.href = '/origami/addorders/'+ dining_id; + }); diff --git a/config/routes.rb b/config/routes.rb index 619295eb..9e0dfe38 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -30,7 +30,7 @@ Rails.application.routes.draw do namespace :restaurant do get 'zones' => "zones#index" resources :menu, only:[:index, :show] - resources :menu_categories, only: [:index] + resources :menu_categories, only: [:index, :show] resources :menu_items, only: [:index, :show] resources :menu_item_attributes, only: [:index] resources :menu_item_options, only: [:index] @@ -165,7 +165,10 @@ Rails.application.routes.draw do get '/:sale_id/customers', to: "customers#add_customer" get '/:customer_id/get_customer' => 'home#get_customer',:as => "show_customer_details" post '/:sale_id/update_sale' , to: "customers#update_sale_by_customer" # update customer id in sale table + post '/:sale_id/get_customer' => "customers#get_customer" + + resources :addorders end #--------- Waiter/Ordering Station ------------# diff --git a/public/image/logo.png b/public/image/logo.png new file mode 100644 index 00000000..578d16f7 Binary files /dev/null and b/public/image/logo.png differ diff --git a/spec/controllers/origami/addorders_controller_spec.rb b/spec/controllers/origami/addorders_controller_spec.rb new file mode 100644 index 00000000..9e0643ad --- /dev/null +++ b/spec/controllers/origami/addorders_controller_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Origami::AddordersController, type: :controller do + +end diff --git a/spec/helpers/origami/addorders_helper_spec.rb b/spec/helpers/origami/addorders_helper_spec.rb new file mode 100644 index 00000000..f9ea7bcf --- /dev/null +++ b/spec/helpers/origami/addorders_helper_spec.rb @@ -0,0 +1,15 @@ +require 'rails_helper' + +# Specs in this file have access to a helper object that includes +# the Origami::AddordersHelper. For example: +# +# describe Origami::AddordersHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +RSpec.describe Origami::AddordersHelper, type: :helper do + pending "add some examples to (or delete) #{__FILE__}" +end