diff --git a/app/assets/javascripts/OQS.js b/app/assets/javascripts/OQS.js index d2a22aef..72ff4733 100755 --- a/app/assets/javascripts/OQS.js +++ b/app/assets/javascripts/OQS.js @@ -404,7 +404,9 @@ $(document).on('turbolinks:load', function() { success: function(result){ // For Server Print - from jade if ($("#server_mode").val() == "cloud") { - code2lab.printFile(result.filepath.substr(6), result.printer_url); + if(typeof code2lab != 'undefined'){ + code2lab.printFile(result.filepath.substr(6), result.printer_url); + } } location.reload(); @@ -428,7 +430,9 @@ $(document).on('turbolinks:load', function() { success: function(result){ // For Server Print - from jade if ($("#server_mode").val() == "cloud") { - code2lab.printFile(result.filepath.substr(6), result.printer_url); + if(typeof code2lab != 'undefined'){ + code2lab.printFile(result.filepath.substr(6), result.printer_url); + } } location.reload(); } diff --git a/app/assets/javascripts/custom.js b/app/assets/javascripts/custom.js index f975ad07..3843f297 100644 --- a/app/assets/javascripts/custom.js +++ b/app/assets/javascripts/custom.js @@ -111,6 +111,26 @@ $(document).ready(function() { railBorderRadius: '0', touchScrollStep : 50 }); + + $('#process-reservation-slimscroll').slimScroll({ + height: height-$('#process-reservation-slimscroll').attr('data-height'), + size: '5px', + color: 'rgba(0,0,0,0.5)', + alwaysVisible: false, + borderRadius: '0', + railBorderRadius: '0', + touchScrollStep : 50 + }); + + $('#reservation-info-slimscroll').slimScroll({ + height: height-$('#reservation-info-slimscroll').attr('data-height'), + size: '5px', + color: 'rgba(0,0,0,0.5)', + alwaysVisible: false, + borderRadius: '0', + railBorderRadius: '0', + touchScrollStep : 50 + }); // $('.delete').click(function(){ // var method = $(this).attr('data-method'); // var url = $(this).attr('data-ref'); diff --git a/app/assets/javascripts/reservation.js b/app/assets/javascripts/reservation.js index e41dda14..0dea213e 100644 --- a/app/assets/javascripts/reservation.js +++ b/app/assets/javascripts/reservation.js @@ -1,6 +1,7 @@ //= require custom.js $(function(){ + $(".room_type").hide(); /*new customer UI func:*/ //Initialize tooltips $('.nav-tabs > li a[title]').tooltip(); @@ -21,6 +22,7 @@ $(function(){ nextTab($active); $('.wizard .nav-tabs li.active .connecting-line').css({"border-bottom-left-radius": 0, "border-top-left-radius": 0}); }); + $(".prev-step").click(function (e) { var $active = $('.wizard .nav-tabs li a.active'); @@ -28,6 +30,28 @@ $(function(){ }); /*new customer UI func:*/ + + $(".reservation_type").on("click", function(){ + if($(this).val() == "Dine-in"){ + $(".dining_type").show(); + $(".room_type").hide(); + }else{ + $(".dining_type").hide(); + $(".room_type").show(); + } + }); + + $(".number_limit").on("click", function(){ + if(parseInt($(this).val()) <= 0){ + if($(this).attr("data-type") == "room"){ + $("#room_count").val(1); + }else if($(this).attr("data-type") == "adult"){ + $("#adult_count").val(1); + }else{ + $("#child_count").val(1); + } + } + }); }); /*customer UI tab btn*/ diff --git a/app/controllers/origami/customers_controller.rb b/app/controllers/origami/customers_controller.rb index 0eee0400..94f4f1ea 100644 --- a/app/controllers/origami/customers_controller.rb +++ b/app/controllers/origami/customers_controller.rb @@ -76,7 +76,6 @@ class Origami::CustomersController < BaseOrigamiController filter = params[:filter] if filter.nil? - puts params[:page] @crm_customers = Customer.order("customer_id") #.page(params[:page]) #@products = Product.order("name").page(params[:page]).per(5) else diff --git a/app/controllers/origami/reservation_controller.rb b/app/controllers/origami/reservation_controller.rb index 6b1e3aa5..91ce359f 100644 --- a/app/controllers/origami/reservation_controller.rb +++ b/app/controllers/origami/reservation_controller.rb @@ -1,6 +1,45 @@ class Origami::ReservationController < BaseOrigamiController def index - + @reservations = Reservation.all end + + def show + end + + def new + end + + def edit + end + + def create + + end + + def update + + end + + # DELETE /crm/customers/1 + # DELETE /crm/customers/1.json + def destroy + @reservation.destroy + respond_to do |format| + format.html { redirect_to origami_reservation_url, notice: 'Reservation was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_origami_reservation + @reservation = Reservation.find(params[:reservation_id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def customer_params + + params.require(:reservation).permit(:reservation_id) + end end diff --git a/app/models/reservation.rb b/app/models/reservation.rb new file mode 100644 index 00000000..4e5ff37a --- /dev/null +++ b/app/models/reservation.rb @@ -0,0 +1,15 @@ +class Reservation < ApplicationRecord + self.primary_key = "reservation_id" + + #primary key - need to be unique generated for multiple shops + before_create :generate_custom_id + + has_many :reservation_items + + scope :active, -> { where("created_at BETWEEN '#{DateTime.now.utc.beginning_of_day}' AND '#{DateTime.now.utc.end_of_day}'") } + + private + def generate_custom_id + self.order_reservation_id = SeedGenerator.generate_id(self.class.name, "RS") + end +end diff --git a/app/models/reservation_item.rb b/app/models/reservation_item.rb new file mode 100644 index 00000000..19e28b82 --- /dev/null +++ b/app/models/reservation_item.rb @@ -0,0 +1,13 @@ +class ReservationItem < ApplicationRecord + self.primary_key = "reservation_items_id" + + #primary key - need to be unique + before_create :generate_custom_id + + belongs_to :reservation, autosave: true + + private + def generate_custom_id + self.reservation_items_id = SeedGenerator.generate_id(self.class.name, "RSI") + end +end diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 42ba0d65..eca1a7ef 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -958,7 +958,9 @@ // For Server Print - from jade if ($("#server_mode").val() == "cloud") { - code2lab.printFile(result.filepath.substr(6), result.printer_url); + if(typeof code2lab != 'undefined'){ + code2lab.printFile(result.filepath.substr(6), result.printer_url); + } } location.reload(); } @@ -1011,9 +1013,11 @@ if((receipt_no!=undefined) && (receipt_no!="")) createReceiptNoInFirstBillData(receipt_no,type); // For Server Print - from jade - if ($("#server_mode").val() == "cloud") { - code2lab.printFile(result.filepath.substr(6), result.printer_url); - } + if ($("#server_mode").val() == "cloud") { + if(typeof code2lab != 'undefined'){ + code2lab.printFile(result.filepath.substr(6), result.printer_url); + } + } location.reload(); } }); @@ -1214,7 +1218,9 @@ success: function (result) { // For Server Print - from jade if ($("#server_mode").val() == "cloud") { - code2lab.printFile(result.filepath.substr(6), result.printer_url); + if(typeof code2lab != 'undefined'){ + code2lab.printFile(result.filepath.substr(6), result.printer_url); + } } window.location.href = '/origami/'; } @@ -1321,7 +1327,9 @@ console.log(result) // For Server Print - from jade if ($("#server_mode").val() == "cloud") { - code2lab.printFile(result.filepath.substr(6), result.printer_url); + if(typeof code2lab != 'undefined'){ + code2lab.printFile(result.filepath.substr(6), result.printer_url); + } } window.location.href = '/origami/'; } diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index a6e878c5..4d3f430c 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -1146,7 +1146,9 @@ var trans_flag = <%= @trans_flag %>; success:function(result){ // For Server Print - from jade if ($("#server_mode").val() == "cloud") { - code2lab.printFile(result.filepath.substr(6), result.printer_url); + if(typeof code2lab != 'undefined'){ + code2lab.printFile(result.filepath.substr(6), result.printer_url); + } } if (pdf_view ==1) { @@ -1439,7 +1441,9 @@ var trans_flag = <%= @trans_flag %>; }, function () { // For Server Print - from jade if ($("#server_mode").val() == "cloud") { - code2lab.printFile(result.filepath.substr(6), result.printer_url); + if(typeof code2lab != 'undefined'){ + code2lab.printFile(result.filepath.substr(6), result.printer_url); + } } var flag = localStorage.getItem("trans_flag"); if((flag!=null) && (flag != "true")){ @@ -1482,7 +1486,9 @@ var trans_flag = <%= @trans_flag %>; customer_display_view(null,"reload"); // For Server Print - from jade if ($("#server_mode").val() == "cloud") { - code2lab.printFile(result.filepath.substr(6), result.printer_url); + if(typeof code2lab != 'undefined'){ + code2lab.printFile(result.filepath.substr(6), result.printer_url); + } } var flag = localStorage.getItem("trans_flag"); if((flag!=null) && (flag != "true")){ @@ -1522,7 +1528,9 @@ var trans_flag = <%= @trans_flag %>; // console.log(result) // For Server Print - from jade if ($("#server_mode").val() == "cloud") { - code2lab.printFile(result.filepath.substr(6), result.printer_url); + if(typeof code2lab != 'undefined'){ + code2lab.printFile(result.filepath.substr(6), result.printer_url); + } } var flag = localStorage.getItem("trans_flag"); if((flag!=null) && (flag != "true")){ diff --git a/app/views/origami/pending_order/completed_sale.html.erb b/app/views/origami/pending_order/completed_sale.html.erb index bc4719f9..f2d66b37 100644 --- a/app/views/origami/pending_order/completed_sale.html.erb +++ b/app/views/origami/pending_order/completed_sale.html.erb @@ -324,7 +324,9 @@ $(document).ready(function(){ url: ajax_url, success: function (result) { if ($("#server_mode").val() == "cloud") { - code2lab.printFile(result.filepath.substr(6), result.printer_url); + if(typeof code2lab != 'undefined'){ + code2lab.printFile(result.filepath.substr(6), result.printer_url); + } } location.reload(); } @@ -433,7 +435,9 @@ function check_emp_access_code(access_code,type) { url: ajax_url, success: function (result) { if ($("#server_mode").val() == "cloud") { - code2lab.printFile(result.filepath.substr(6), result.printer_url); + if(typeof code2lab != 'undefined'){ + code2lab.printFile(result.filepath.substr(6), result.printer_url); + } } location.reload(); } diff --git a/app/views/origami/reservation/index.html.erb b/app/views/origami/reservation/index.html.erb index 720f9d3e..1374983b 100644 --- a/app/views/origami/reservation/index.html.erb +++ b/app/views/origami/reservation/index.html.erb @@ -5,7 +5,7 @@