diff --git a/Gemfile b/Gemfile index d64ba992..d42da647 100644 --- a/Gemfile +++ b/Gemfile @@ -9,8 +9,8 @@ end # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.1.0' # Use mysql as the database for Active Record -#gem 'mysql2', '>= 0.3.18', '< 0.5' -gem 'pg' +gem 'mysql2', '>= 0.3.18', '< 0.5' +#gem 'pg' # Use Puma as the app server gem 'puma', '~> 3.0' # Use SCSS for stylesheets diff --git a/Gemfile.lock b/Gemfile.lock index 3627d882..6916f408 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -96,11 +96,11 @@ GEM mini_portile2 (2.1.0) minitest (5.10.2) multi_json (1.12.1) + mysql2 (0.4.6) nio4r (2.0.0) nokogiri (1.7.2) mini_portile2 (~> 2.1.0) pdf-core (0.7.0) - pg (0.20.0) prawn (2.2.2) pdf-core (~> 0.7.0) ttfunk (~> 1.5) @@ -232,7 +232,7 @@ DEPENDENCIES jbuilder (~> 2.5) jquery-rails listen (~> 3.0.5) - pg + mysql2 (>= 0.3.18, < 0.5) prawn prawn-table puma (~> 3.0) diff --git a/app/controllers/crm/home_controller.rb b/app/controllers/crm/home_controller.rb index 6c0671c3..2a7153f8 100644 --- a/app/controllers/crm/home_controller.rb +++ b/app/controllers/crm/home_controller.rb @@ -1,16 +1,22 @@ class Crm::HomeController < BaseCrmController def index - @booking = Booking.select("bookings.id as booking_id, - bookings.checkin_at, - od.customer_id as customer, - odt.id") + # @booking = Booking.all + + @booking = Booking.select("bookings.id as booking_id, + bookings.checkin_at, + bookings.checkin_by, + bookings.dining_facility_id, + od.customer_id as customer, + od.item_count as count, + odt.id as order_item_id, + odt.item_name as item_name") .joins("join booking_orders as bko ON bko.booking_id = bookings.id") .joins("right join orders as od ON od.id = bko.order_id") .joins("right join order_items as odt ON odt.order_id=od.id") - .order("bookings.id DESC") + .order("bookings.id DESC") - + @customer = Customer.all end def show diff --git a/app/models/order_queue_item.rb b/app/models/order_queue_item.rb deleted file mode 100644 index 7f94fbec..00000000 --- a/app/models/order_queue_item.rb +++ /dev/null @@ -1,2 +0,0 @@ -class OrderQueueItem < ApplicationRecord -end diff --git a/app/views/crm/home/_booking.html.erb b/app/views/crm/home/_booking.html.erb new file mode 100644 index 00000000..cf983116 --- /dev/null +++ b/app/views/crm/home/_booking.html.erb @@ -0,0 +1,26 @@ + +
+ + <% @i = 0 %> + <% @booking.each do |booking| %> +
+
+

+ <%= @i += 1 %> . <%= booking.dining_facility.name %> + - <%= booking.item_name %> +

+

Medium, Fries, Salad +

+

+ + Order at <%= booking.checkin_at.strftime("%H,%m") %>, <%= booking.checkin_by %> + +

+
+ +
+ <% end %> + +
\ No newline at end of file diff --git a/app/views/crm/home/_customer.html.erb b/app/views/crm/home/_customer.html.erb new file mode 100644 index 00000000..ea643494 --- /dev/null +++ b/app/views/crm/home/_customer.html.erb @@ -0,0 +1,23 @@ + +
+ <% @customer.each do |customer| %> +
+
+ +

Name : <%= customer.name %>

+

Contact No : <%= customer.contact_no %>

+

Email : <%= customer.email %>

+
+
+ <% end %> + +
+
+

Card title

+

This card has supporting text below as a natural lead-in to additional content.

+

Last updated 3 mins ago

+
+
+ + +
\ No newline at end of file diff --git a/app/views/crm/home/_queue.html.erb b/app/views/crm/home/_queue.html.erb new file mode 100644 index 00000000..99c56f9e --- /dev/null +++ b/app/views/crm/home/_queue.html.erb @@ -0,0 +1,29 @@ +
+
+
+

9. Table 4 - Beef Steak [x3]

+

Well Done, Fries, Salad

+

+ Order at 12:23, Kyaw Lwin | + Printed at 12:23 | + Completed at 12:43 +

+ + +
+
+
+
+

9. Table 4 - Beef Steak [x3]

+

Well Done, Fries, Salad

+

Order at 12:23, Kyaw Lwin

+
+
+
+
+

9. Table 4 - Beef Steak [x3]

+

Well Done, Fries, Salad

+

Order at 12:23, Kyaw Lwin

+
+
+
\ No newline at end of file diff --git a/app/views/crm/home/index.html.erb b/app/views/crm/home/index.html.erb index 8a115f49..07e58652 100644 --- a/app/views/crm/home/index.html.erb +++ b/app/views/crm/home/index.html.erb @@ -8,7 +8,7 @@ Queue 2000