diff --git a/Gemfile b/Gemfile
index 8081f3b5..145cd5c1 100644
--- a/Gemfile
+++ b/Gemfile
@@ -13,7 +13,7 @@ gem 'rails', '~> 5.1.0'
# gem 'mysql2', '>= 0.3.18', '< 0.5'
#Use PosgreSQL
-#gem 'pg'
+gem 'pg'
# redis server for cable
# gem 'redis', '~> 3.0'
diff --git a/app/controllers/origami/others_payments_controller.rb b/app/controllers/origami/others_payments_controller.rb
index 1542734a..fa50f6a3 100644
--- a/app/controllers/origami/others_payments_controller.rb
+++ b/app/controllers/origami/others_payments_controller.rb
@@ -3,7 +3,10 @@ class Origami::OthersPaymentsController < BaseOrigamiController
def index
@membership_rebate_balance = 0
- @membership_id = 0
+ @sale_id = params[:sale_id]
+ sale_data = Sale.find_by_sale_id(@sale_id)
+ customer_data= Customer.find_by_customer_id(sale_data.customer_id)
+ @membership_id = customer_data.membership_id
if !@membership_id.nil?
membership_setting = MembershipSetting.find_by_membership_type("smartpay_url")
membership_data = SalePayment.get_paypar_account(membership_setting.gateway_url,membership_setting.auth_token,@membership_id)
@@ -19,6 +22,7 @@ class Origami::OthersPaymentsController < BaseOrigamiController
else
@membership_rebate_balance = 0
end
+ end
end
def create
diff --git a/app/controllers/origami/paypar_controller.rb b/app/controllers/origami/paypar_controller.rb
index 428cbc87..06be6434 100644
--- a/app/controllers/origami/paypar_controller.rb
+++ b/app/controllers/origami/paypar_controller.rb
@@ -1,3 +1,4 @@
class Origami::PayparController < ApplicationController
-
+ def create
+ end
end
diff --git a/app/models/order.rb b/app/models/order.rb
index 4ddad631..04c9645e 100644
--- a/app/models/order.rb
+++ b/app/models/order.rb
@@ -271,7 +271,6 @@ class Order < ApplicationRecord
left join sale_orders on sale_orders.order_id = orders.order_id
left join sales on sales.sale_id = sale_orders.sale_id")
.where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
-
.group("orders.order_id,order_items.order_items_id,dining_facilities.name,sales.receipt_no,bookings.booking_id,sales.sale_id")
end
diff --git a/app/views/origami/others_payments/index.html.erb b/app/views/origami/others_payments/index.html.erb
index 859a854b..6a72fc2d 100644
--- a/app/views/origami/others_payments/index.html.erb
+++ b/app/views/origami/others_payments/index.html.erb
@@ -4,7 +4,7 @@
<% if @membership_id!=0 %>
-
Redim Amount
+
Redim Amount
<% end %>
@@ -86,7 +86,7 @@
@@ -123,6 +123,9 @@ $(document).on('click', '.cashier_number', function(event){
$('#used_amount').html(amount);
break;
+ case 'clr':
+ $('#used_amount').html("0.0");
+ break;
}
event.handled = true;
@@ -131,7 +134,23 @@ $(document).on('click', '.cashier_number', function(event){
}
});
- $("#redim").click(function(){
+$("#redeem_account").click(function(){
$('.rebate-form').removeAttr("hidden");
- })
+});
+
+$("#redeem").click(function(){
+ valid_amount = $("#valid_amount").val();
+ sale_id = $(this).attr("data-value")
+ membership_id = $(this).attr("data-member-value");
+ used_amount = parseInt($("#used_amount").text());
+ if(used_amount<=0){
+ alert(" Insufficient Amount!")
+ }else if(valid_amount< used_amount){
+ alert("Please type valid amount");
+ }else{
+ $.ajax({
+
+ })
+ }
+});
\ No newline at end of file
diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb
index ccd9fd77..fcdee809 100644
--- a/app/views/origami/payments/show.html.erb
+++ b/app/views/origami/payments/show.html.erb
@@ -218,21 +218,21 @@ $( document ).ready(function() {
$('#pay').click(function() {
- if($('#balance').text() > 0){
- alert(" Insufficient Amount!")
- }else{
+ if($('#balance').text() > 0){
+ alert(" Insufficient Amount!")
+ }else{
// 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")
- }
- });
+ 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_payment/index.html.erb
similarity index 100%
rename from app/views/origami/paypar/index.html.erb
rename to app/views/origami/paypar_payment/index.html.erb
diff --git a/db/migrate/20170531024747_create_accounts.rb b/db/migrate/2017031024747_create_accounts.rb
similarity index 100%
rename from db/migrate/20170531024747_create_accounts.rb
rename to db/migrate/2017031024747_create_accounts.rb
diff --git a/db/seeds.rb b/db/seeds.rb
index 78d927a4..0d5d2804 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -141,9 +141,9 @@ admin_employee = Employee.create({name: "Administrator", role: "Administrator",
food = Account.create({title: "Food", account_type: "0"})
beverage = Account.create({title: "Beverage", account_type: "1"})
-shop = Shop.create(
- {name: "Beauty In The Pot", address: "address", township: "Yangon", city: "Yangon", state: "Yangon",
- country: "Myanmar", phone_no: "09123456789", reservation_no: "bip000001", license: "license",
- activated_at: "2017-06-06", license_data: "license_data", base_currency: "Ks", id_prefix: "abc"}
- )
+# shop = Shop.create(
+# {name: "Beauty In The Pot", address: "address", township: "Yangon", city: "Yangon", state: "Yangon",
+# country: "Myanmar", phone_no: "09123456789", reservation_no: "bip000001", license: "license",
+# activated_at: "2017-06-06", license_data: "license_data", base_currency: "Ks", id_prefix: "abc"}
+# )
diff --git a/dump.rdb b/dump.rdb
index 61ec8a21..b2fb1709 100644
Binary files a/dump.rdb and b/dump.rdb differ