From 2d55ea0dab7556f28f81b5a3df8d96bb6dc4296a Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Fri, 7 Jul 2017 09:56:18 +0630 Subject: [PATCH] update add order --- .../javascripts/origami/addorders.coffee | 3 + app/assets/stylesheets/origami.scss | 1 + app/assets/stylesheets/origami/addorders.scss | 3 + .../origami/addorders_controller.rb | 21 ++++ app/helpers/origami/addorders_helper.rb | 2 + app/views/origami/addorders/index.html.erb | 108 ++++++++++++++++++ app/views/origami/addorders/show.html.erb | 30 +++++ app/views/origami/home/show.html.erb | 8 +- config/routes.rb | 2 + .../origami/addorders_controller_spec.rb | 5 + spec/helpers/origami/addorders_helper_spec.rb | 15 +++ 11 files changed, 196 insertions(+), 2 deletions(-) create mode 100644 app/assets/javascripts/origami/addorders.coffee create mode 100644 app/assets/stylesheets/origami/addorders.scss create mode 100644 app/controllers/origami/addorders_controller.rb create mode 100644 app/helpers/origami/addorders_helper.rb create mode 100644 app/views/origami/addorders/index.html.erb create mode 100644 app/views/origami/addorders/show.html.erb create mode 100644 spec/controllers/origami/addorders_controller_spec.rb create mode 100644 spec/helpers/origami/addorders_helper_spec.rb 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 7935b50e..1f195ba5 100644 --- a/app/assets/stylesheets/origami.scss +++ b/app/assets/stylesheets/origami.scss @@ -211,3 +211,4 @@ tr.discount-item-row:hover { margin-left:-40px !important; margin-top:-40px !important; } + 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/origami/addorders_controller.rb b/app/controllers/origami/addorders_controller.rb new file mode 100644 index 00000000..68a15c71 --- /dev/null +++ b/app/controllers/origami/addorders_controller.rb @@ -0,0 +1,21 @@ +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 + 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/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..1a2e7b8b --- /dev/null +++ b/app/views/origami/addorders/show.html.erb @@ -0,0 +1,30 @@ +
+
+
+ +
+
+
+
+ +
+
+ +
+
+ +
+ +
+
+ + diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 8b613409..cb18971c 100644 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -302,7 +302,7 @@ <% if @status_order == 'order' && @status_sale != 'sale' %> - + @@ -312,7 +312,7 @@ <% else %> - + @@ -555,4 +555,8 @@ function show_customer_details(customer_id){ } }); + + $('#add_order').on('click',function(){ + window.location.href = '/origami/addorders'; + }); diff --git a/config/routes.rb b/config/routes.rb index 2b7db5eb..b04bed33 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -156,6 +156,8 @@ 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 + + resources :addorders end #--------- Waiter/Ordering Station ------------# 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