diff --git a/app/controllers/origami/moveroom_controller.rb b/app/controllers/origami/moveroom_controller.rb
index ef1c286a..dea36463 100644
--- a/app/controllers/origami/moveroom_controller.rb
+++ b/app/controllers/origami/moveroom_controller.rb
@@ -35,5 +35,20 @@ class Origami::MoveroomController < BaseOrigamiController
end
end
end
+
+ def moving
+ change_to = params[:change_to] #new
+ change_from = params[:change_from] #original
+ bookings = Booking.where('dining_facility_id=?',change_from)
+
+ booking_array = Array.new
+ bookings.each do | booking |
+ if booking.sale_id.nil? && booking.booking_status != 'moved'
+ booking_array.push(booking)
+ end
+ end
+
+ @get_type = Booking.update_dining_facility(booking_array,change_to,change_from)
+ end
end
diff --git a/app/controllers/origami/rooms_controller.rb b/app/controllers/origami/rooms_controller.rb
index 823136b9..d7092692 100644
--- a/app/controllers/origami/rooms_controller.rb
+++ b/app/controllers/origami/rooms_controller.rb
@@ -1,36 +1,77 @@
class Origami::RoomsController < BaseOrigamiController
+ def index
+ @tables = Table.all.active.order('status desc')
+ @rooms = Room.all.active.order('status desc')
+ @complete = Sale.where("sale_status != 'new'")
+ @orders = Order.all.order('date desc')
+ # @shift = ShiftSale.current_open_shift(current_user.id)
+ end
+
def show
@tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc')
@complete = Sale.where("sale_status != 'new'")
@orders = Order.all.order('date desc')
@room = DiningFacility.find(params[:room_id])
+
+ @status = ""
@sale_array = Array.new
- @room.bookings.each do |booking|
- if booking.sale_id.nil?
+
+ @room.bookings.active.each do |booking|
+ if booking.sale_id.nil? && booking.booking_status != 'moved'
@order_items = Array.new
-
booking.booking_orders.each do |booking_order|
order = Order.find(booking_order.order_id)
- @obj = order
- @customer = order.customer
- order.order_items.each do |item|
- @order_items.push(item)
+ if (order.status == "new")
+ @obj = order
+ @customer = order.customer
+ @date = order.created_at
+ order.order_items.each do |item|
+ @order_items.push(item)
+ end
end
end
@status = 'order'
else
-
sale = Sale.find(booking.sale_id)
- if sale.sale_status != "completed"
- @sale_array.push(sale)
+ if sale.sale_status != "completed" && sale.sale_status != 'void'
+ @sale_array.push(sale)
+ if @status == 'order'
+ @status = 'sale'
+ end
+ @date = sale.created_at
@status = 'sale'
@obj = sale
@customer = sale.customer
end
end
- end
+ end
+
+ # @room.bookings.each do |booking|
+ # if booking.sale_id.nil?
+ # @order_items = Array.new
+
+ # booking.booking_orders.each do |booking_order|
+ # order = Order.find(booking_order.order_id)
+ # @obj = order
+ # @customer = order.customer
+ # order.order_items.each do |item|
+ # @order_items.push(item)
+ # end
+ # end
+ # @status = 'order'
+ # else
+
+ # sale = Sale.find(booking.sale_id)
+ # if sale.sale_status != "completed"
+ # @sale_array.push(sale)
+ # @status = 'sale'
+ # @obj = sale
+ # @customer = sale.customer
+ # end
+ # end
+ # end
end
diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb
index 27f73619..c72ded6e 100644
--- a/app/views/origami/rooms/show.html.erb
+++ b/app/views/origami/rooms/show.html.erb
@@ -207,7 +207,7 @@
<%= sub_total %> |
- <%if @obj != nil && @status_sale == 'sale' && @obj.discount_type == 'member_discount'%>
+ <%if @obj != nil && @status == 'sale' && @obj.discount_type == 'member_discount'%>
| Member Discount: |
<%else%>
Discount: |
@@ -232,52 +232,52 @@
- <%
- if @status == 'sale'
- unless @order_items.nil?
- %>
- Pending New Order
-
- <%
- count = 0
- @order_items.each do |order_item |
- count += 1
- %>
-
-
- | <%= count %>
- | <%= order_item.item_name %> |
- <%= order_item.qty %> |
- <%= order_item.qty*order_item.price %> |
-
-
- <%
- end
+ <%
+ if @status == 'sale'
+ unless @order_items.nil?
+ %>
+ Pending New Order
+
+ <%
+ count = 0
+ @order_items.each do |order_item |
+ count += 1
%>
-
-
- <% end %>
- <% if @sale_array.size > 1 %>
-
- Pending Payment
- <% end %>
- <% @sale_array.each do |sale|
- if @sale_array.size > 1
- unless sale.receipt_no == @sale_array[0].receipt_no
- %>
-
-
- | Receipt No - <%= sale.receipt_no %> |
- |
-
-
- <%
- end
- end
- end
- end
- %>
+
+ | <%= count %>
+ | <%= order_item.item_name %> |
+ <%= order_item.qty %> |
+ <%= order_item.qty*order_item.price %> |
+
+
+ <%
+ end
+ %>
+
+
+ <% end %>
+ <% if @sale_array.size > 1 %>
+
+ Pending Payment
+ <% end %>
+ <% @sale_array.each do |sale|
+ if @sale_array.size > 1
+ unless sale.receipt_no == @sale_array[0].receipt_no
+ %>
+
+
+
+ | Receipt No - <%= sale.receipt_no %> |
+ |
+
+
+ <%
+ end
+ end
+ end
+ end
+ %>