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'
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/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/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/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 %>
+
+ <% elsif @ppamount != 0.0 %>
+
+
Paypar
+
<%= @ppamount %>
+
+ <% else %>
+
+
Others Payment
+
<%= @ppamount %>
+
+ <% end %>
+
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/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 %> |
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"
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"})