From fbbe2c0ab94f039921e110006e5a7a29b4dd1ef0 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Thu, 22 Mar 2018 09:45:30 +0630 Subject: [PATCH 1/4] update order controlelr --- app/controllers/api/orders_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/orders_controller.rb b/app/controllers/api/orders_controller.rb index dd648bb4..383a6606 100755 --- a/app/controllers/api/orders_controller.rb +++ b/app/controllers/api/orders_controller.rb @@ -219,7 +219,7 @@ class Api::OrdersController < Api::ApiController if ENV["SERVER_MODE"] != "cloud" #no print in cloud server # print - assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code) + assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code) # order queue stations oqs = assigned_item.order_queue_station From 75a3576a77fbacfdf9f0db4dd2aaadbe5e72b0e6 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Thu, 22 Mar 2018 12:42:17 +0630 Subject: [PATCH 2/4] update check user --- .../settings/commissioners_controller.rb | 7 ++++++- .../settings/commissions_controller.rb | 7 +++++++ .../settings/order_queue_stations_controller.rb | 7 +++++++ app/controllers/settings/products_controller.rb | 7 +++++++ .../settings/promotion_products_controller.rb | 7 +++++++ app/controllers/settings/promotions_controller.rb | 7 +++++++ .../transactions/credit_notes_controller.rb | 15 +++++++++++---- app/controllers/transactions/orders_controller.rb | 8 ++++++++ app/controllers/transactions/sales_controller.rb | 7 +++++++ .../transactions/shift_sales_controller.rb | 7 +++++++ 10 files changed, 74 insertions(+), 5 deletions(-) diff --git a/app/controllers/settings/commissioners_controller.rb b/app/controllers/settings/commissioners_controller.rb index f8314bcb..fb8c1993 100755 --- a/app/controllers/settings/commissioners_controller.rb +++ b/app/controllers/settings/commissioners_controller.rb @@ -1,6 +1,7 @@ class Settings::CommissionersController < ApplicationController load_and_authorize_resource except: [:create] before_action :set_commissioner, only: [:show, :edit, :update, :destroy] + before_action :check_user # GET /commissioners # GET /commissioners.json @@ -82,7 +83,11 @@ class Settings::CommissionersController < ApplicationController end render json: @transactions end - + def check_user + if current_user.nil? + redirect_to root_path + end + end private # Use callbacks to share common setup or constraints between actions. def set_commissioner diff --git a/app/controllers/settings/commissions_controller.rb b/app/controllers/settings/commissions_controller.rb index 5a41de17..1ac6b2cc 100755 --- a/app/controllers/settings/commissions_controller.rb +++ b/app/controllers/settings/commissions_controller.rb @@ -1,6 +1,7 @@ class Settings::CommissionsController < ApplicationController load_and_authorize_resource except: [:create] before_action :set_commission, only: [:show, :edit, :update, :destroy] + before_action :check_user # GET /commissions # GET /commissions.json @@ -68,6 +69,12 @@ class Settings::CommissionsController < ApplicationController # end end + def check_user + if current_user.nil? + redirect_to root_path + end + end + private # Use callbacks to share common setup or constraints between actions. def set_commission diff --git a/app/controllers/settings/order_queue_stations_controller.rb b/app/controllers/settings/order_queue_stations_controller.rb index b6baf64d..adcbc507 100755 --- a/app/controllers/settings/order_queue_stations_controller.rb +++ b/app/controllers/settings/order_queue_stations_controller.rb @@ -1,6 +1,7 @@ class Settings::OrderQueueStationsController < ApplicationController load_and_authorize_resource except: [:create] before_action :set_settings_order_queue_station, only: [:show, :edit, :update, :destroy] + before_action :check_user # GET /settings/order_queue_stations # GET /settings/order_queue_stations.json @@ -67,6 +68,12 @@ class Settings::OrderQueueStationsController < ApplicationController # end end + def check_user + if current_user.nil? + redirect_to root_path + end + end + private # Use callbacks to share common setup or constraints between actions. def set_settings_order_queue_station diff --git a/app/controllers/settings/products_controller.rb b/app/controllers/settings/products_controller.rb index c0be149e..66e8f162 100755 --- a/app/controllers/settings/products_controller.rb +++ b/app/controllers/settings/products_controller.rb @@ -1,6 +1,7 @@ class Settings::ProductsController < ApplicationController load_and_authorize_resource except: [:create] before_action :set_settings_product, only: [:show, :edit, :update, :destroy] + before_action :check_user # GET /settings/products # GET /settings/products.json @@ -65,6 +66,12 @@ load_and_authorize_resource except: [:create] # end end + def check_user + if current_user.nil? + redirect_to root_path + end + end + private # Use callbacks to share common setup or constraints between actions. def set_settings_product diff --git a/app/controllers/settings/promotion_products_controller.rb b/app/controllers/settings/promotion_products_controller.rb index d297fb71..c66761d7 100755 --- a/app/controllers/settings/promotion_products_controller.rb +++ b/app/controllers/settings/promotion_products_controller.rb @@ -1,6 +1,7 @@ class Settings::PromotionProductsController < ApplicationController before_action :set_promotion, only: [:show, :edit, :update, :destroy,:new] before_action :set_promotion_product, only: [:show, :edit, :update, :destroy] + before_action :check_user # GET /promotion_products # GET /promotion_products.json @@ -63,6 +64,12 @@ class Settings::PromotionProductsController < ApplicationController # end end + def check_user + if current_user.nil? + redirect_to root_path + end + end + private # Use callbacks to share common setup or constraints between actions. def set_promotion diff --git a/app/controllers/settings/promotions_controller.rb b/app/controllers/settings/promotions_controller.rb index ec00c5f6..7272ab0c 100755 --- a/app/controllers/settings/promotions_controller.rb +++ b/app/controllers/settings/promotions_controller.rb @@ -1,6 +1,7 @@ class Settings::PromotionsController < ApplicationController load_and_authorize_resource except: [:create] before_action :set_promotion, only: [:show, :edit, :update, :destroy] + before_action :check_user # GET /promotions # GET /promotions.json @@ -119,6 +120,12 @@ class Settings::PromotionsController < ApplicationController render json: res end + def check_user + if current_user.nil? + redirect_to root_path + end + end + private # Use callbacks to share common setup or constraints between actions. def set_promotion diff --git a/app/controllers/transactions/credit_notes_controller.rb b/app/controllers/transactions/credit_notes_controller.rb index e35baa77..27f52f12 100755 --- a/app/controllers/transactions/credit_notes_controller.rb +++ b/app/controllers/transactions/credit_notes_controller.rb @@ -1,6 +1,7 @@ class Transactions::CreditNotesController < ApplicationController before_action :set_transactions_sale, only: [:show, :edit, :update, :destroy] + before_action :check_user # GET /transactions/sales # GET /transactions/sales.json @@ -25,12 +26,18 @@ class Transactions::CreditNotesController < ApplicationController @credit_notes = 0 end end -puts "sssssssssssss" -puts @credit_notes.to_json + respond_to do |format| format.html # index.html.erb format.json { render json: @credit_notes } end - end - end \ No newline at end of file + end + + def check_user + if current_user.nil? + redirect_to root_path + end + end + +end \ No newline at end of file diff --git a/app/controllers/transactions/orders_controller.rb b/app/controllers/transactions/orders_controller.rb index 52abf7fd..c2132ff6 100755 --- a/app/controllers/transactions/orders_controller.rb +++ b/app/controllers/transactions/orders_controller.rb @@ -1,5 +1,7 @@ class Transactions::OrdersController < ApplicationController load_and_authorize_resource except: [:create] + before_action :check_user + def index filter = params[:filter] @@ -39,4 +41,10 @@ class Transactions::OrdersController < ApplicationController end end + def check_user + if current_user.nil? + redirect_to root_path + end + end + end diff --git a/app/controllers/transactions/sales_controller.rb b/app/controllers/transactions/sales_controller.rb index fafc89f3..fa7d58f7 100755 --- a/app/controllers/transactions/sales_controller.rb +++ b/app/controllers/transactions/sales_controller.rb @@ -1,6 +1,7 @@ class Transactions::SalesController < ApplicationController load_and_authorize_resource except: [:create] before_action :set_transactions_sale, only: [:show, :edit, :update, :destroy] + before_action :check_user # GET /transactions/sales # GET /transactions/sales.json @@ -129,6 +130,12 @@ class Transactions::SalesController < ApplicationController end end + def check_user + if current_user.nil? + redirect_to root_path + end + end + private # Use callbacks to share common setup or constraints between actions. def set_transactions_sale diff --git a/app/controllers/transactions/shift_sales_controller.rb b/app/controllers/transactions/shift_sales_controller.rb index ce226d30..f3a9fc05 100644 --- a/app/controllers/transactions/shift_sales_controller.rb +++ b/app/controllers/transactions/shift_sales_controller.rb @@ -1,6 +1,7 @@ class Transactions::ShiftSalesController < ApplicationController load_and_authorize_resource except: [:create] before_action :set_transactions_shift_sale, only: [:show, :edit, :update, :destroy] + before_action :check_user def index @@ -53,6 +54,12 @@ class Transactions::ShiftSalesController < ApplicationController end end + def check_user + if current_user.nil? + redirect_to root_path + end + end + private # Use callbacks to share common setup or constraints between actions. def set_transactions_shift_sale From 3066a0ca1a20b7c5fd3792aff2b02db595d0c631 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Fri, 23 Mar 2018 10:08:33 +0630 Subject: [PATCH 3/4] update payment select --- app/views/origami/home/show.html.erb | 92 +++++++++++++++++----------- 1 file changed, 57 insertions(+), 35 deletions(-) diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 73ab8ea7..83816151 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -520,30 +520,31 @@ + @@ -735,11 +736,32 @@ }); }); + // click select option icon for add + $(document).on('click', '.payment_btn', function(event){ + active = $(this).hasClass('selected-payment'); + value = $(this).data('value'); + type = $(this).data('type'); + group = $(this).data('group'); + payments = $(".payment_btn"); + $(payments).each(function(i){ + if ($(payments[i]).attr('data-type')==type){ + $('.'+type).removeClass("selected-payment"); + } + }); + if (active) { + $(this).removeClass('selected-payment'); + }else{ + $(this).addClass('selected-payment'); + } + + }); //End selecct attribute buttom + $(".choose_payment").on('click', function () { $( "#loading_wrapper").show(); var sale_id = $('#sale_id').val(); type = $('.payment_method').val(); + console.log(type) if(parseInt(jQuery.inArray("Credit", type)) == -1){ if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1) { calculate_member_discount(sale_id,"Card"); @@ -749,21 +771,21 @@ } } var ajax_url = "/origami/sale/" + sale_id + "/first_bill"; - $.ajax({ - type: "GET", - url: ajax_url, - success: function (result) { - $( "#loading_wrapper" ).hide(); - receipt_no = ($("#receipt_no").html()).trim(); - if((receipt_no!=undefined) && (receipt_no!="")) - createReceiptNoInFirstBillData(receipt_no,type); - // For Server Print - from jade - if ($("#server_mode").val() == "cloud") { - code2lab.printFile(result.filepath, result.printer_url); - } - location.reload(); - } - }); + // $.ajax({ + // type: "GET", + // url: ajax_url, + // success: function (result) { + // $( "#loading_wrapper" ).hide(); + // receipt_no = ($("#receipt_no").html()).trim(); + // if((receipt_no!=undefined) && (receipt_no!="")) + // createReceiptNoInFirstBillData(receipt_no,type); + // // For Server Print - from jade + // if ($("#server_mode").val() == "cloud") { + // code2lab.printFile(result.filepath, result.printer_url); + // } + // location.reload(); + // } + // }); }); function calculate_member_discount(sale_id,type) { From dfb998f9e7e922cc0b1c1cb6eb17575e2309d87c Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Fri, 23 Mar 2018 13:55:07 +0630 Subject: [PATCH 4/4] update paymemt multiple ui --- app/assets/stylesheets/origami.scss | 12 ++++++ app/views/origami/home/show.html.erb | 61 +++++++++++++++------------ app/views/origami/rooms/show.html.erb | 45 +++++++++++++++----- 3 files changed, 81 insertions(+), 37 deletions(-) diff --git a/app/assets/stylesheets/origami.scss b/app/assets/stylesheets/origami.scss index 07c7428f..c417613a 100755 --- a/app/assets/stylesheets/origami.scss +++ b/app/assets/stylesheets/origami.scss @@ -198,6 +198,18 @@ select.form-control { background-color: blue !important; } +.selected-payment { + color: #fff !important; + background-color: blue !important; +} +.payment_btn { + white-space: normal !important; + margin-bottom: 15px; + margin-right: 15px; + color:#fff !important; + # background-color: green !important; +} + /* Reciept Style */ #order-charges-table td { border-top: none !important; diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 83816151..4922c1df 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -528,12 +528,12 @@