diff --git a/Gemfile b/Gemfile index 3d31db9c..e5a86c8e 100644 --- a/Gemfile +++ b/Gemfile @@ -17,6 +17,8 @@ gem 'pg' # redis server for cable gem 'redis', '~> 3.0' +gem 'mysql2', '>= 0.3.18', '< 0.5' + # Use Puma as the app server gem 'puma', '~> 3.0' # Use SCSS for stylesheets diff --git a/Gemfile.lock b/Gemfile.lock index 9d85889c..99c59b3b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -96,11 +96,15 @@ GEM mini_portile2 (2.1.0) minitest (5.10.2) multi_json (1.12.1) +<<<<<<< HEAD nio4r (2.1.0) +======= + mysql2 (0.4.6) + nio4r (2.0.0) +>>>>>>> f036274f5e32e3447277b99e21bc166a621a9dcf 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 +236,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 ee29270a..2a7153f8 100644 --- a/app/controllers/crm/home_controller.rb +++ b/app/controllers/crm/home_controller.rb @@ -1,5 +1,23 @@ class Crm::HomeController < BaseCrmController def index + + # @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") + + @customer = Customer.all + end def show end diff --git a/app/controllers/oqs/home_controller.rb b/app/controllers/oqs/home_controller.rb index 356508c4..0f73d20d 100644 --- a/app/controllers/oqs/home_controller.rb +++ b/app/controllers/oqs/home_controller.rb @@ -11,20 +11,16 @@ class Oqs::HomeController < BaseOqsController # .joins("right join order_items as odt ON odt.item_code = order_queue_items.item_code") # .order("odt.item_name DESC") - # puts @queue_items_details - # @queue_stations.each do |que| - # zone_id = OrderQueueProcessByZone.where('order_queue_station_id=#{que.id}').select(:zone_id).take - # type = DiningFacility.find_by_zone_id(zone_id).select(:type).take - # end - # @queue_items_details = { :queue_id, :zone_id, :item_code, :item_name, :item_options, :price, :qty, :order_by, :order_at } - # @queue_stations.each do |que| - # # Contact.find(:all, :joins => ['left join sales s on s.customer_id = contacts.id'], :conditions => ["contact_type = 'Customer' AND name IS NOT NULL"],:group => ["contacts.id"]) - # assigned_items=AssignedOrderItem.find(:all, :conditions=>["order_queue_station_id = #{que.id}"], :group => ["order_queue_station_id"]) - # assigned_items.each do |ass_items| - # order_item_details=OrderItems.joins('left join order').where("item_code = #{ ass_items.item_code } AND order_item_status = 1") - # end - # # AssignedOrderItem.where("order_queue_station_id = :que_id", {:que_id => que_id}).get - # end + + + # Order.select("orders.id as order_id,sum(order_items.qty*order_items.price) as total_price, + # order_items.id as order_items_id,dining_facilities.name as table_name") + # .joins("left join booking_orders on booking_orders.order_id = orders.id + # left join bookings on bookings.id = booking_orders.id + # left join dining_facilities on dining_facilities.id = bookings.dining_facility_id + # left join order_items on order_items.order_id = orders.id") + # .where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,"dine_in",true) + # .group("orders.id") end def show 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 c094b4a0..07e58652 100644 --- a/app/views/crm/home/index.html.erb +++ b/app/views/crm/home/index.html.erb @@ -8,7 +8,7 @@ Queue 2000