From f60c145c00360eedbcf11585589179cb95816df5 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Thu, 29 Jun 2017 14:33:05 +0630 Subject: [PATCH] update queue --- app/assets/stylesheets/CRM.scss | 14 +++- .../crm/dining_queues_controller.rb | 11 +++ app/views/crm/dining_queues/index.html.erb | 75 +++++++++++++++---- config/routes.rb | 1 + 4 files changed, 84 insertions(+), 17 deletions(-) diff --git a/app/assets/stylesheets/CRM.scss b/app/assets/stylesheets/CRM.scss index 6f8d90f0..cf6782dd 100644 --- a/app/assets/stylesheets/CRM.scss +++ b/app/assets/stylesheets/CRM.scss @@ -13,7 +13,7 @@ .selected-item { color: #fff !important; - background-color: #54A5AF !important; + background-color: #7a62d3 !important; } .assign { @@ -23,6 +23,14 @@ .assign .text-muted{ color: #fff !important; } +.normal{ + color: #fff !important; + background-color: #54A5AF; +} +.cancel { + color: #fff !important; + background-color: #FF0000; +} .red{ color: #fff !important; background-color: red; @@ -39,9 +47,9 @@ } .card-columns { @include media-breakpoint-only(lg) { - column-count: 6; + column-count: 5; } @include media-breakpoint-only(xl) { - column-count: 6; + column-count: 5; } } \ No newline at end of file diff --git a/app/controllers/crm/dining_queues_controller.rb b/app/controllers/crm/dining_queues_controller.rb index b4f902fc..9c5f8b73 100644 --- a/app/controllers/crm/dining_queues_controller.rb +++ b/app/controllers/crm/dining_queues_controller.rb @@ -96,6 +96,17 @@ class Crm::DiningQueuesController < BaseCrmController end end + def cancel_queue + queue = DiningQueue.find(params[:id]) + + status = queue.update_attributes(id: params[:id],status:"Cancel") + + if status == true + render json: JSON.generate({:status => true , notice: 'Dining queue was successfully canceled .'}) + else + render json: JSON.generate({:status => false, :error_message => "Record not found"}) + end + end private # Use callbacks to share common setup or constraints between actions. diff --git a/app/views/crm/dining_queues/index.html.erb b/app/views/crm/dining_queues/index.html.erb index 4adbead9..4f39147f 100644 --- a/app/views/crm/dining_queues/index.html.erb +++ b/app/views/crm/dining_queues/index.html.erb @@ -18,19 +18,25 @@
- <% @i =0 %> + <% @dining_queues.each do |queue| %> -
" data-id="<%= queue.id %>" style="width: 17.5rem;"> + <% if queue.status == "Assign" + @bg_color = "assign" + elsif queue.status == "Cancel" + @bg_color = "cancel" + else + @bg_color = "normal" + end + %> +
- - <%= @i += 1 %> . Queue No - Seater : <%= queue.seater %> -

- <%= queue.queue_no %> -

- + Queue No : <%= queue.queue_no %> + Seater : <%= queue.seater %>
+ Name : <%= queue.name %>
+ Contact No : <%= queue.contact_no %> + Remark : <%= queue.remark %>
@@ -43,7 +49,7 @@
- +
\ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 3a8e90bd..b18f957d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -150,6 +150,7 @@ Rails.application.routes.draw do get "/dining_queues/:id/assign" =>"dining_queues#assign", :as => "assign" post "/dining_queues/assign_table" =>"dining_queues#assign_table", :as => "assign_table" + post "/dining_queues/cancel_queue" =>"dining_queues#cancel_queue", :as => "cancel_queue" end