From 66e6b69f12472de4ce8ef69b3ff561a79c211540 Mon Sep 17 00:00:00 2001 From: phyusin Date: Fri, 17 Nov 2017 18:26:01 +0630 Subject: [PATCH 1/5] add booking for assign customer in CRM --- app/controllers/crm/dining_queues_controller.rb | 13 ++++++++++++- db/migrate/20170627085117_dining_queues.rb | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/controllers/crm/dining_queues_controller.rb b/app/controllers/crm/dining_queues_controller.rb index 480ad08e..d583bc6f 100755 --- a/app/controllers/crm/dining_queues_controller.rb +++ b/app/controllers/crm/dining_queues_controller.rb @@ -1,7 +1,7 @@ class Crm::DiningQueuesController < BaseCrmController load_and_authorize_resource before_action :set_dining_queue, only: [:show, :edit, :update, :destroy] - + # GET /crm/dining_queues # GET /crm/dining_queues.json def index @@ -86,6 +86,17 @@ class Crm::DiningQueuesController < BaseCrmController queue = DiningQueue.find(params[:id]) table_id = params[:table_id] + dining_facility = DiningFacility.find(params[:table_id]) + if dining_facility.type == "Table" + type = "TableBooking" + else + type = "RoomBooking" + end + + booking = Booking.create({:dining_facility_id => params[:table_id],:type => type, + :checkin_at => Time.now.utc,:customer_id => queue.customer_id,:booking_status => "assign" }) + booking.save! + status = queue.update_attributes(dining_facility_id: table_id,status:"Assign") # status = DiningFacility.find(table_id).update_attributes(status: "occupied") diff --git a/db/migrate/20170627085117_dining_queues.rb b/db/migrate/20170627085117_dining_queues.rb index a4977f8c..269d4316 100755 --- a/db/migrate/20170627085117_dining_queues.rb +++ b/db/migrate/20170627085117_dining_queues.rb @@ -2,6 +2,7 @@ class DiningQueues < ActiveRecord::Migration[5.1] def change create_table :dining_queues do |t| t.string :name + t.string :customer_id, :default => "CUS-000000000001" t.string :contact_no t.string :queue_no t.string :status From e95562ad20325c0d6c2337f11fbd159abc55e944 Mon Sep 17 00:00:00 2001 From: Yan Date: Fri, 17 Nov 2017 18:27:48 +0630 Subject: [PATCH 2/5] edit addorder loading to oqs_loading --- app/assets/javascripts/addorder.js | 28 ++++++++++----------- app/assets/stylesheets/addorder.scss | 11 ++++---- app/views/origami/addorders/detail.html.erb | 7 +++--- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index 34c93405..054627c7 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -1,9 +1,8 @@ -$(function(){ +$(function() { //click menu sidebar menu category $(".product").on("click", function(){ var url = $(this).attr('data-ref'); show_product_list(url); - console.log(url) }); //show menu item list when click menu category function show_product_list(url_item){ @@ -635,8 +634,9 @@ $(function(){ // Pay Discount for Payment $("#create_order").on('click', function(e){ + $(this).attr('disabled', 'disabled'); e.preventDefault(); - $("#loading_wrapper").show(); + $("#oqs_loading_wrapper").show(); var table_id = $('#table_id').text(); var booking_id = $('#booking_id').text(); if (!booking_id.length > 0) { @@ -651,32 +651,32 @@ $(function(){ var ajax_url = '../addorders/create'; - var params = {'order_source': "cashier", 'order_type': "dine_in", 'customer_id': "", 'guest_info': "", 'table_id': table_id, 'order_items': order_items }; - $.ajax({ type: "POST", url: ajax_url, data: params, dataType: "json", - success:function(result){ - $("#loading_wrapper").hide(); + success:function(result){ + $("#oqs_loading_wrapper").hide(); swal({ title: "Information !", text: 'Order has been successfully created', confirmButtonColor: "green", confirmButtonText: "Yes!", closeOnConfirm: false, - }, function () { - if(table_type == "Table"){ - window.location.href = "/origami/table/" + table_id - } - else { - window.location.href = "/origami/room/" + table_id - } + }, function (isConfirm) { + if (isConfirm) { + if(table_type == "Table"){ + window.location.href = "/origami/table/" + table_id + } + else { + window.location.href = "/origami/room/" + table_id + } + } }); } }); diff --git a/app/assets/stylesheets/addorder.scss b/app/assets/stylesheets/addorder.scss index 970532f7..8c535855 100755 --- a/app/assets/stylesheets/addorder.scss +++ b/app/assets/stylesheets/addorder.scss @@ -128,8 +128,7 @@ section.content{ /*Loading gif for payment*/ -#loading_wrapper{ - +#oqs_loading_wrapper{ position: fixed; background-color: #C8C8C8 ; height: 100%; @@ -137,9 +136,9 @@ section.content{ left: 0; opacity: 0.6; top: 0; - z-index: 9999999; + z-index: 100; } -#loading{ +#oqs_loading{ position: relative; height: 100%; width: 100%; @@ -147,9 +146,9 @@ section.content{ background-position: center center; background-repeat: no-repeat; opacity: 1; + z-index: 101; filter: alpha(opacity=100); /* ie */ - -moz-opacity: 1; /* mozilla */ - + -moz-opacity: 1; /* mozilla */ } #count ,#set_count{ diff --git a/app/views/origami/addorders/detail.html.erb b/app/views/origami/addorders/detail.html.erb index 095036fa..2a6411a4 100755 --- a/app/views/origami/addorders/detail.html.erb +++ b/app/views/origami/addorders/detail.html.erb @@ -1,8 +1,9 @@ <%= stylesheet_link_tag 'addorder', media: 'all', 'data-turbolinks-track': 'reload' %> <%= javascript_include_tag 'addorder', 'data-turbolinks-track': 'reload' %> - + +