From 9d1aff2fa2e0ab43adf0f1b7a0a470792a0f4a73 Mon Sep 17 00:00:00 2001 From: Nweni Date: Wed, 14 Jun 2017 10:49:00 +0630 Subject: [PATCH 1/5] other payment updated --- app/views/origami/jcb/index.html.erb | 2 +- app/views/origami/master/index.html.erb | 2 +- app/views/origami/mpu/index.html.erb | 2 +- app/views/origami/visa/index.html.erb | 2 +- config/routes.rb | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/origami/jcb/index.html.erb b/app/views/origami/jcb/index.html.erb index 924eeb0e..a1a5a2cd 100644 --- a/app/views/origami/jcb/index.html.erb +++ b/app/views/origami/jcb/index.html.erb @@ -123,7 +123,7 @@ $(document).on('click', '.cashier_number', function(event){ $('#jcb_pay').on('click',function(){ - var amount = $('#amount').val(); + var amount = $('#amount').text(); var sale_id = "<%= @sale_id %>"; $.ajax({type: "POST", diff --git a/app/views/origami/master/index.html.erb b/app/views/origami/master/index.html.erb index a2e31257..da481022 100644 --- a/app/views/origami/master/index.html.erb +++ b/app/views/origami/master/index.html.erb @@ -120,7 +120,7 @@ $(document).on('click', '.cashier_number', function(event){ } }); $('#master_pay').on('click',function(){ - var amount = $('#amount').val(); + var amount = $('#amount').text(); var sale_id = "<%= @sale_id %>"; $.ajax({type: "POST", diff --git a/app/views/origami/mpu/index.html.erb b/app/views/origami/mpu/index.html.erb index d6ebd1a4..10caf0b3 100644 --- a/app/views/origami/mpu/index.html.erb +++ b/app/views/origami/mpu/index.html.erb @@ -120,7 +120,7 @@ $(document).on('click', '.cashier_number', function(event){ } }); $('#mpu_pay').on('click',function(){ - var amount = $('#amount').val(); + var amount = $('#amount').text(); var sale_id = "<%= @sale_id %>"; $.ajax({type: "POST", diff --git a/app/views/origami/visa/index.html.erb b/app/views/origami/visa/index.html.erb index 37f48772..72cd94aa 100644 --- a/app/views/origami/visa/index.html.erb +++ b/app/views/origami/visa/index.html.erb @@ -120,7 +120,7 @@ $(document).on('click', '.cashier_number', function(event){ } }); $('#visa_pay').on('click',function(){ - var amount = $('#amount').val(); + var amount = $('#amount').text(); var sale_id = "<%= @sale_id %>"; $.ajax({type: "POST", diff --git a/config/routes.rb b/config/routes.rb index a0da05ae..ee9b44a0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -91,7 +91,7 @@ Rails.application.routes.draw do post 'payment/mpu' => "mpu#create" post 'payment/jcb' => "jcb#create" post 'payment/master' => "master#create" - post 'payment/visa' => "master#visa" + post 'payment/visa' => "visa#create" post 'payment/paypar' => 'paypar_payments#create' get 'sale/:sale_id/payment/credit_payment' => "credit_payments#index" From 7b2d2731c1c9edf76c54afc63d5f327e85f9b364 Mon Sep 17 00:00:00 2001 From: Nweni Date: Wed, 14 Jun 2017 11:05:15 +0630 Subject: [PATCH 2/5] auth --- app/controllers/home_controller.rb | 6 +++++- db/seeds.rb | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index c3dba58b..e84aef30 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -10,9 +10,13 @@ class HomeController < ApplicationController @login_form.emp_id = params[:login_form][:emp_id] @login_form.password = params[:login_form][:password] @employee = Employee.login(@login_form.emp_id, @login_form.password) - if @employee + puts @employee.role + if @employee.role == "administrator" session[:session_token] = @employee.token_session redirect_to dashboard_path + elsif @employee.role == "cashier" + session[:session_token] = @employee.token_session + redirect_to origami_root_path else render :index end diff --git a/db/seeds.rb b/db/seeds.rb index a7fdc416..e834c9f6 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -136,8 +136,8 @@ zone_queue_station = OrderQueueProcessByZone.create({order_queue_station: zone_o #Create Adminstrator employee -admin_employee = Employee.create({name: "Administrator", role: "Administrator", password: "99999", emp_id:"999", created_by: "SYSTEM DEFAULT"}) -admin_employee = Employee.create({name: "Waiter", role: "Waiter", password: "11111", emp_id:"111", created_by: "SYSTEM DEFAULT"}) +admin_employee = Employee.create({name: "Administrator", role: "administrator", password: "99999", emp_id:"999", created_by: "SYSTEM DEFAULT"}) +admin_employee = Employee.create({name: "Waiter", role: "waiter", password: "11111", emp_id:"111", created_by: "SYSTEM DEFAULT"}) order_station1=PrintSetting.create({name: "OrderItemPdf", unique_code: "OrderItemPdf", printer_name: "EPSON-TM-T82-S-A"}) order_station2=PrintSetting.create({name: "Order Summary", unique_code: "OrderSummaryPdf", printer_name: "EPSON-TM-T82-S-A"}) request_bill_printer=PrintSetting.create({name: "Receipt Bill", unique_code: "ReceiptBillPdf", printer_name: "EPSON-TM-T82-S-A"}) From 5cff9c891baea88a410430e1383a6d72e0218239 Mon Sep 17 00:00:00 2001 From: Phyo Date: Wed, 14 Jun 2017 12:02:52 +0630 Subject: [PATCH 3/5] Other Payment shown by type --- .../origami/payments_controller.rb | 5 ++++- app/views/origami/payments/show.html.erb | 20 +++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index a9437736..97d08547 100644 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -19,6 +19,7 @@ class Origami::PaymentsController < BaseOrigamiController if Sale.exists?(sale_id) @cash = 0.0 @other = 0.0 + @ppamount = 0.0 @sale_data = Sale.find_by_sale_id(sale_id) #get customer amount @@ -55,8 +56,10 @@ class Origami::PaymentsController < BaseOrigamiController if spay.payment_method == "cash" @cash = spay.payment_amount end - if spay.payment_method == "mpu" || spay.payment_method == "paypar" + if spay.payment_method == "mpu" @other += spay.payment_amount + elsif spay.payment_method == "paypar" + @ppamount += spay.payment_amount end end end diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index 490ec341..b9c2fdbf 100644 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -102,8 +102,24 @@
-
Others Payment
-
<%= @other %>
+
+ <% if @other != 0.0 %> +
+
MPU
+
<%= @other %>
+
+ <% elsif @ppamount != 0.0 %> +
+
Paypar
+
<%= @ppamount %>
+
+ <% else %> +
+
Others Payment
+
<%= @ppamount %>
+
+ <% end %> +

From f7451a46754cf1bd1ab83eda1101fc30321c4d9c Mon Sep 17 00:00:00 2001 From: Nweni Date: Wed, 14 Jun 2017 13:33:09 +0630 Subject: [PATCH 4/5] update --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 36be43b7..6c3703d2 100644 --- a/Gemfile +++ b/Gemfile @@ -42,7 +42,7 @@ gem 'to_xls-rails' #Reporting gem #gem 'compendium' - +#gem "cancan" # Use jquery as the JavaScript library gem 'jquery-rails' gem 'jquery-ui-rails' From af623cb474c5bf0e85db2624ea54a8ccdf468632 Mon Sep 17 00:00:00 2001 From: Phyo Date: Wed, 14 Jun 2017 15:01:36 +0630 Subject: [PATCH 5/5] Instances Name Show --- app/views/settings/set_menu_items/show.html.erb | 2 ++ app/views/settings/simple_menu_items/show.html.erb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/views/settings/set_menu_items/show.html.erb b/app/views/settings/set_menu_items/show.html.erb index ba23771f..a5762fc3 100644 --- a/app/views/settings/set_menu_items/show.html.erb +++ b/app/views/settings/set_menu_items/show.html.erb @@ -116,6 +116,7 @@ item_instance_code + item_instance_name item_attributes price is_on_promotion @@ -131,6 +132,7 @@ <%= settings_menu_item.item_instance_code %> + <%= settings_menu_item.item_instance_name %> <%= settings_menu_item.item_attributes %> <%= settings_menu_item.price %> <%= settings_menu_item.is_on_promotion %> diff --git a/app/views/settings/simple_menu_items/show.html.erb b/app/views/settings/simple_menu_items/show.html.erb index 11620acd..9bfae1b0 100644 --- a/app/views/settings/simple_menu_items/show.html.erb +++ b/app/views/settings/simple_menu_items/show.html.erb @@ -122,6 +122,7 @@ item_instance_code + Instances Name item_attributes price is_on_promotion @@ -138,6 +139,7 @@ <%= settings_menu_item.item_instance_code %> + <%= settings_menu_item.item_instance_name %> <%= settings_menu_item.item_attributes %> <%= settings_menu_item.price %> <%= settings_menu_item.is_on_promotion %>