@@ -89,7 +87,7 @@
-
CARD
+
OTHERS PAYMENT
0.0
@@ -152,8 +150,8 @@
@@ -174,6 +172,7 @@ $(document).on('click', '.cashier_number', function(event){
original_value = $('#cash').text();
var input_type = $(this).attr("data-type");
+
switch (input_type) {
case 'num':
var input_value = $(this).attr("data-value");
@@ -193,6 +192,10 @@ $(document).on('click', '.cashier_number', function(event){
update_balance();
break;
+ case 'clr':
+ $('#cash').text("0.0");
+ update_balance();
+ break;
}
event.handled = true;
} else {
@@ -209,16 +212,28 @@ $( document ).ready(function() {
$('#card_payment').click(function() {
var sale_id = $('#sale_id').text();
- window.location.href = '/origami/sale/'+ sale_id + "/payment/card_payment"
+ window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment"
return false;
});
$('#pay').click(function() {
- console.log("pay")
- if($('#amount_due').text() > 0){
- console.log("greater")
+
+ if($('#balance').text() > 0){
+ alert(" Insufficient Amount!")
}else{
- console.log("less")
+ // payment
+ var cash = $('#cash').text();
+ var credit = $('#credit').text();
+ var card = $('#card').text();
+ var sale_id = $('#sale_id').text();
+ $.ajax({type: "POST",
+ url: "<%= origami_payment_process_path %>",
+ data: "cash="+ cash + "&sale_id=" + sale_id,
+ success:function(result){
+ alert("THANK YOU")
+ }
+ });
+
}
});
diff --git a/app/views/origami/paypar/index.html.erb b/app/views/origami/paypar/index.html.erb
new file mode 100644
index 00000000..859a854b
--- /dev/null
+++ b/app/views/origami/paypar/index.html.erb
@@ -0,0 +1,137 @@
+
+
+
+
+ <% if @membership_id!=0 %>
+
+ <% end %>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/settings/menu_item_options/show.html.erb b/app/views/settings/menu_item_options/show.html.erb
index fdcb9d09..611f3165 100644
--- a/app/views/settings/menu_item_options/show.html.erb
+++ b/app/views/settings/menu_item_options/show.html.erb
@@ -2,8 +2,7 @@
diff --git a/app/views/settings/set_menu_items/_form.html.erb b/app/views/settings/set_menu_items/_form.html.erb
index bdf0e97e..aeae0f5c 100644
--- a/app/views/settings/set_menu_items/_form.html.erb
+++ b/app/views/settings/set_menu_items/_form.html.erb
@@ -6,6 +6,7 @@
<%= f.input :name %>
<%= f.input :alt_name %>
<%= f.input :type %>
+ <%= f.input :account_id, :label => "Account type", :collection => Account.collection %>
<%= f.input :menu_item_id, :label => "Parent Menu Item", :collection => MenuItem.collection %>
<%= f.input :min_qty %>
diff --git a/app/views/settings/set_menu_items/show.html.erb b/app/views/settings/set_menu_items/show.html.erb
index 0082c819..ba23771f 100644
--- a/app/views/settings/set_menu_items/show.html.erb
+++ b/app/views/settings/set_menu_items/show.html.erb
@@ -19,6 +19,7 @@
Name |
Alt name |
Type |
+
Account Type |
Menu category |
Menu item |
Min qty |
@@ -35,6 +36,7 @@
<%= @settings_menu_item.name rescue "-" %> |
<%= @settings_menu_item.alt_name %> |
<%= @settings_menu_item.type %> |
+
<%= @settings_menu_item.account.title %> |
<%= @settings_menu_item.menu_category_id %> |
<%= @settings_menu_item.menu_item_id %> |
<%= @settings_menu_item.min_qty %> |
diff --git a/app/views/settings/simple_menu_items/_form.html.erb b/app/views/settings/simple_menu_items/_form.html.erb
index 885f725e..01c5b482 100644
--- a/app/views/settings/simple_menu_items/_form.html.erb
+++ b/app/views/settings/simple_menu_items/_form.html.erb
@@ -6,6 +6,7 @@
<%= f.input :name %>
<%= f.input :alt_name %>
<%= f.input :type %>
+ <%= f.input :account_id, :label => "Account type", :collection => Account.collection %>
<%= f.input :menu_item_id, :label => "Parent Menu Item", :collection => MenuItem.collection %>
<%= f.input :min_qty %>
<%= f.input :min_selectable_item %>
diff --git a/app/views/settings/simple_menu_items/show.html.erb b/app/views/settings/simple_menu_items/show.html.erb
index d2d93e0e..11620acd 100644
--- a/app/views/settings/simple_menu_items/show.html.erb
+++ b/app/views/settings/simple_menu_items/show.html.erb
@@ -21,6 +21,7 @@
Name |
Alt name |
Type |
+
Accout |
Menu category |
Menu item |
Min qty |
@@ -37,6 +38,7 @@
<%= @settings_menu_item.name rescue "-" %> |
<%= @settings_menu_item.alt_name %> |
<%= @settings_menu_item.type %> |
+
<%= @settings_menu_item.account.title %> |
<%= @settings_menu_item.menu_category_id %> |
<%= @settings_menu_item.menu_item_id %> |
<%= @settings_menu_item.min_qty %> |
diff --git a/config/routes.rb b/config/routes.rb
index 64b5feeb..f227f7e3 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -68,14 +68,25 @@ Rails.application.routes.draw do
namespace :origami do
root "home#index"
get "/:booking_id" => "home#show" do #origami/:booking_id will show
- resources :payments, only: [:index, :new, :create ] #add payment by payment_method
resources :discounts, only: [:index,:new, :create ] #add discount type
resources :customers, only: [:index,:new, :create ] #add customer type
end
- # resources :request_bills, only: [:show]
+
+ resources :request_bills, only: [:show]
get 'sale/:sale_id/payment' => 'request_bills#show'
+
+ get 'sale/:sale_id/payment' => 'payments#show'
+ post 'payment_process' => 'payments#create'
+
get 'sale/:sale_id/payment/credit_payment' => "credit_payments#index"
- get 'sale/:sale_id/payment/card_payment' => "card_payments#index"
+ get 'sale/:sale_id/payment/others_payment' => "others_payments#index"
+
+ get 'sale/:sale_id/payment' => 'payments#show'
+ post 'payment_process' => 'payments#create'
+
+ get 'sale/:sale_id/payment/credit_payment' => "credit_payments#index"
+ get 'sale/:sale_id/payment/others_payment' => "others_payments#index"
+
end
#--------- Waiter/Ordering Station ------------#
diff --git a/db/migrate/20170602101727_create_accounts.rb b/db/migrate/20170331024747_create_accounts.rb
similarity index 100%
rename from db/migrate/20170602101727_create_accounts.rb
rename to db/migrate/20170331024747_create_accounts.rb
diff --git a/db/migrate/20170331024749_create_menu_items.rb b/db/migrate/20170331024749_create_menu_items.rb
index f61a9172..81baa5ab 100644
--- a/db/migrate/20170331024749_create_menu_items.rb
+++ b/db/migrate/20170331024749_create_menu_items.rb
@@ -10,6 +10,7 @@ class CreateMenuItems < ActiveRecord::Migration[5.0]
t.string :type, :null => false, :default => "SimpleMenuItem"
t.references :menu_category, foreign_key: true
t.references :menu_item, foreign_key: true
+ t.references :account, foreign_key: true
t.integer :min_qty, :null => false, :default => 1
t.boolean :taxable, :null => false, :default => true
t.integer :min_selectable_item, :null => false, :default => 1
diff --git a/db/migrate/20170403174111_create_sale_audits.rb b/db/migrate/20170403174111_create_sale_audits.rb
index ae6ba3f4..e8197c4b 100644
--- a/db/migrate/20170403174111_create_sale_audits.rb
+++ b/db/migrate/20170403174111_create_sale_audits.rb
@@ -7,8 +7,8 @@ class CreateSaleAudits < ActiveRecord::Migration[5.0]
t.string :action, :null => false
t.datetime :action_at, :null => false
t.string :action_by, :null => false
- t.string :approved_by, :null => false
- t.datetime :approved_by, :null => false
+ t.string :approved_by, :null => true
+ t.datetime :approved_at, :null => true
t.string :remark
t.timestamps
end
diff --git a/db/seeds.rb b/db/seeds.rb
index 4d7799db..02fa39fb 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -90,6 +90,9 @@ room = Room.create({name:"Default Room", zone: zone2, status:"available", seater
#Tax Profile
tax_profiles = TaxProfile.create({id:1, name: "Commerical Tax", rate:5.0, order_by:1, created_by:"SYSTEM DEFAULT"})
+#Account for Menu Item Type (eg: Food, Beverage)
+food = Account.create({title: "Food", account_type: "0"})
+beverage = Account.create({title: "Beverage", account_type: "1"})
#Default menu
menu = Menu.create({name: "Default Menu", is_active: true, created_by: "SYSTEM DEFAULT"})
@@ -104,17 +107,17 @@ menu_category3 = MenuCategory.create({menu: menu, code:"C006", name: "Sample Men
menu_category4 = MenuCategory.create({menu: menu, code:"C006", name: "Sample Menu Category 4", alt_name: "Sample Alternate Category 4", order_by: 1, menu_category_id: menu_category3.id, created_by: "SYSTEM DEFAULT"})
#Default Menu items
-menu_category1_menu_item0 = SimpleMenuItem.create({item_code:"01001", name: "Default Menu Item Name 0", alt_name: "Alternate Menu Item Name 0",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1 })
+menu_category1_menu_item0 = SimpleMenuItem.create({item_code:"01001", name: "Default Menu Item Name 0", alt_name: "Alternate Menu Item Name 0",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1, account: food })
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"half portion",item_instance_code:"01001-1", menu_item: menu_category1_menu_item0, price:12.00, is_on_promotion:false}])
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"full portion",item_instance_code:"01001-2", menu_item: menu_category1_menu_item0, price:18.00, is_on_promotion:false}])
-menu_category1_menu_item1 = SetMenuItem.create({item_code:"I004", name: "Default Menu Item Name 1", alt_name: "Alternate Menu Item Name 1",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1 })
-menu_category1_menu_item2 = SetMenuItem.create({item_code:"I005", name: "Default Menu Item Name 2",parent: menu_category1_menu_item1, alt_name: "Alternate Menu Item Name 2", min_selectable_item: 1, max_selectable_item:1 })
-menu_category1_menu_item3 = SetMenuItem.create({item_code:"I006", name: "Default Menu Item Name 3",parent: menu_category1_menu_item1, alt_name: "Alternate Menu Item Name 3", min_selectable_item: 1, max_selectable_item:1 })
+menu_category1_menu_item1 = SetMenuItem.create({item_code:"I004", name: "Default Menu Item Name 1", alt_name: "Alternate Menu Item Name 1",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1 , account: food})
+menu_category1_menu_item2 = SetMenuItem.create({item_code:"I005", name: "Default Menu Item Name 2",parent: menu_category1_menu_item1, alt_name: "Alternate Menu Item Name 2", min_selectable_item: 1, max_selectable_item:1 , account: food})
+menu_category1_menu_item3 = SetMenuItem.create({item_code:"I006", name: "Default Menu Item Name 3",parent: menu_category1_menu_item1, alt_name: "Alternate Menu Item Name 3", min_selectable_item: 1, max_selectable_item:1 , account: food})
-menu_category2_menu_item0 = SimpleMenuItem.create({item_code:"I007", name: "Default Menu Item Name 0", alt_name: "Alternate Menu Item Name 0",menu_category: menu_category2 , min_selectable_item: 1, max_selectable_item:1, min_qty: 2 })
-menu_category2_menu_item1 = SimpleMenuItem.create({item_code:"I008", name: "Default Menu Item Name 1", alt_name: "Alternate Menu Item Name 1",menu_category: menu_category2 , min_selectable_item: 1, max_selectable_item:1, min_qty: 2 })
-menu_category2_menu_item2 = SimpleMenuItem.create({item_code:"I009", name: "Default Menu Item Name 2", alt_name: "Alternate Menu Item Name 2",menu_category: menu_category2 , min_selectable_item: 1, max_selectable_item:1, min_qty: 3 })
+menu_category2_menu_item0 = SimpleMenuItem.create({item_code:"I007", name: "Default Menu Item Name 0", alt_name: "Alternate Menu Item Name 0",menu_category: menu_category2 , min_selectable_item: 1, max_selectable_item:1, min_qty: 2 , account: food})
+menu_category2_menu_item1 = SimpleMenuItem.create({item_code:"I008", name: "Default Menu Item Name 1", alt_name: "Alternate Menu Item Name 1",menu_category: menu_category2 , min_selectable_item: 1, max_selectable_item:1, min_qty: 2 , account: food})
+menu_category2_menu_item2 = SimpleMenuItem.create({item_code:"I009", name: "Default Menu Item Name 2", alt_name: "Alternate Menu Item Name 2",menu_category: menu_category2 , min_selectable_item: 1, max_selectable_item:1, min_qty: 3 , account: food})
menu_item_attribute_size_small = MenuItemAttribute.create({attribute_type:"size", name: "Small", value: "small"})
menu_item_attribute_size_medium = MenuItemAttribute.create({attribute_type:"size",name: "Medium", value: "medium"})
@@ -133,7 +136,3 @@ 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"})
-
-#Account for Menu Item Type (eg: Food, Beverage)
-food = Account.create({title: "Food", account_type: "0"})
-beverage = Account.create({title: "Beverage", account_type: "1"})
diff --git a/dump.rdb b/dump.rdb
index 71b39e91..60850de8 100644
Binary files a/dump.rdb and b/dump.rdb differ
diff --git a/spec/controllers/api/origami/paypar_controller_spec.rb b/spec/controllers/api/origami/paypar_controller_spec.rb
new file mode 100644
index 00000000..e0003e75
--- /dev/null
+++ b/spec/controllers/api/origami/paypar_controller_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe Api::Origami::PayparController, type: :controller do
+
+end
diff --git a/spec/controllers/origami/paypar_controller_spec.rb b/spec/controllers/origami/paypar_controller_spec.rb
new file mode 100644
index 00000000..749649d4
--- /dev/null
+++ b/spec/controllers/origami/paypar_controller_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe Origami::PayparController, type: :controller do
+
+end
diff --git a/spec/helpers/api/origami/paypar_helper_spec.rb b/spec/helpers/api/origami/paypar_helper_spec.rb
new file mode 100644
index 00000000..d53d9eae
--- /dev/null
+++ b/spec/helpers/api/origami/paypar_helper_spec.rb
@@ -0,0 +1,15 @@
+require 'rails_helper'
+
+# Specs in this file have access to a helper object that includes
+# the Api::Origami::PayparHelper. For example:
+#
+# describe Api::Origami::PayparHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# expect(helper.concat_strings("this","that")).to eq("this that")
+# end
+# end
+# end
+RSpec.describe Api::Origami::PayparHelper, type: :helper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/helpers/origami/paypar_helper_spec.rb b/spec/helpers/origami/paypar_helper_spec.rb
new file mode 100644
index 00000000..4613b9e7
--- /dev/null
+++ b/spec/helpers/origami/paypar_helper_spec.rb
@@ -0,0 +1,15 @@
+require 'rails_helper'
+
+# Specs in this file have access to a helper object that includes
+# the Origami::PayparHelper. For example:
+#
+# describe Origami::PayparHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# expect(helper.concat_strings("this","that")).to eq("this that")
+# end
+# end
+# end
+RSpec.describe Origami::PayparHelper, type: :helper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end