update pagination and booking and rebate redeem

This commit is contained in:
Aung Myo
2017-11-15 12:02:02 +06:30
parent de3f2e5e90
commit 1c0a93d56d
7 changed files with 65 additions and 12 deletions

View File

@@ -64,3 +64,32 @@ select:focus {
pointer-events: none; pointer-events: none;
} }
} }
/*Pagination*/
nav.pagination {
margin:10px;
}
nav.pagination .current{
background-color:#1f91f3;
color:#fff;
padding:4px 10px;
margin-top:-4px;
}
nav.pagination .page a,.next a,.last a,.prev a,.first a{
padding:6.5px 10px;
margin-left: 3px;
}
nav.pagination .page a:hover,
a:focus {
background-color: #ccc;
text-decoration: none;
}
nav.pagination .page a:hover,
.first a:hover,.last a:hover,.prev a:hover,.next a:hover{
background-color: #ccc;
text-decoration: none;
}

View File

@@ -241,9 +241,10 @@ end
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
member_params = { name: name,phone: phone,email: email, member_params = { name: name,phone: phone,email: email,
dob: dob,address: address,nrc:nrc,card_no:card_no, dob: dob,address: address,nrc:nrc,card_no:card_no,
member_group_id: member_group_id, member_group_id: member_group_id,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json id:id,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json
# Check for paypar account exists # Check for paypar account exists
# if paypar_account_no != nil || paypar_account_no != '' # if paypar_account_no != nil || paypar_account_no != ''
@@ -252,6 +253,7 @@ end
dob: dob,address: address,nrc:nrc,card_no:card_no, dob: dob,address: address,nrc:nrc,card_no:card_no,
paypar_account_no: paypar_account_no, paypar_account_no: paypar_account_no,
member_group_id: member_group_id, member_group_id: member_group_id,
id:id,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json merchant_uid:merchant_uid,auth_token:auth_token}.to_json
end end
@@ -273,7 +275,8 @@ end
rescue SocketError rescue SocketError
response = { status: false} response = { status: false}
end end
puts "ssssssss"
puts response.to_json
customer = Customer.find(@crm_customer.customer_id) customer = Customer.find(@crm_customer.customer_id)
if response["status"] == true if response["status"] == true
@@ -299,9 +302,10 @@ end
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
member_params = { name: name,phone: phone,email: email, member_params = { name: name,phone: phone,email: email,
dob: dob,address: address,nrc:nrc,card_no:card_no, dob: dob,address: address,nrc:nrc,card_no:card_no,
member_group_id: member_group_id, member_group_id: member_group_id,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json id:id,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json
# Check for paypar account exists # Check for paypar account exists
if paypar_account_no.present? if paypar_account_no.present?
@@ -309,6 +313,7 @@ end
dob: dob,address: address,nrc:nrc,card_no:card_no, dob: dob,address: address,nrc:nrc,card_no:card_no,
paypar_account_no: paypar_account_no, paypar_account_no: paypar_account_no,
member_group_id: member_group_id, member_group_id: member_group_id,
id:id,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json merchant_uid:merchant_uid,auth_token:auth_token}.to_json
end end
@@ -331,7 +336,17 @@ end
response = { status: false} response = { status: false}
end end
puts "ssssssss"
puts response.to_json
if response["status"] == true if response["status"] == true
customer = Customer.find(@crm_customer.customer_id)
# Check membership id and bind to user
if response["membership_id"] != nil
status = customer.update_attributes(membership_id: response["membership_id"],membership_type:member_group_id )
else
status = customer.update_attributes(membership_type:member_group_id )
end
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated.' } format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated.' }
format.json { render :show, status: :ok, location: @crm_customer } format.json { render :show, status: :ok, location: @crm_customer }
else else

View File

@@ -32,6 +32,7 @@ class Ability
can :manage, Order can :manage, Order
can :manage, Booking
can :manage, Sale can :manage, Sale
@@ -84,7 +85,7 @@ class Ability
can :read, Order can :read, Order
can :update, Order can :update, Order
can :menage, Booking
can :read, Sale can :read, Sale
can :update, Sale can :update, Sale
can :get_customer, Customer can :get_customer, Customer

View File

@@ -106,7 +106,7 @@ class Customer < ApplicationRecord
# Check for paypar account exists # Check for paypar account exists
# if paypar_account_no != nil || paypar_account_no != '' # if paypar_account_no != nil || paypar_account_no != ''
if paypar_account_no.present? if customer.paypar_account_no.present?
member_params = { name: customer.name,phone: customer.contact_no, member_params = { name: customer.name,phone: customer.contact_no,
email: customer.email,dob: customer.date_of_birth, email: customer.email,dob: customer.date_of_birth,
address: customer.address,nrc:customer.nrc_no, address: customer.address,nrc:customer.nrc_no,
@@ -131,7 +131,6 @@ class Customer < ApplicationRecord
rescue SocketError rescue SocketError
response = { status: false, message: "Can't connect server"} response = { status: false, message: "Can't connect server"}
end end
if response["status"] == true if response["status"] == true
status = customer.update_attributes(membership_id: response["customer_datas"]["id"]) status = customer.update_attributes(membership_id: response["customer_datas"]["id"])
end end
@@ -165,10 +164,12 @@ class Customer < ApplicationRecord
credit = 1 credit = 1
end end
end end
# overall_dis = SaleItem.get_overall_discount(sObj.id) # overall_dis = SaleItem.get_overall_discount(sObj.id)
overall_dis = sObj.total_discount overall_dis = sObj.total_discount
total_amount = rebate_prices - payparcost - overall_dis total_amount = rebate_prices - payparcost - overall_dis
if credit == 1 if credit == 1
total_amount = 0 total_amount = 0
end end

View File

@@ -77,6 +77,11 @@
<span><%= t :transactions %></span> <span><%= t :transactions %></span>
</a> </a>
<ul class="ml-menu"> <ul class="ml-menu">
<% if can? :menage, Booking %>
<li>
<a href="<%= transactions_bookings_path %>"><%= t :bookings %></a>
</li>
<% end %>
<% if can? :menage, Order %> <% if can? :menage, Order %>
<li> <li>
<a href="<%= transactions_orders_path %>"><%= t :orders %></a> <a href="<%= transactions_orders_path %>"><%= t :orders %></a>

View File

@@ -29,6 +29,7 @@ en:
top: "Top" top: "Top"
orders: "Orders" orders: "Orders"
credit: "Credit" credit: "Credit"
bookings: "Booking"
home: "Home" home: "Home"
simple_menu_item: "Simple Menu Item" simple_menu_item: "Simple Menu Item"
set_menu_item: "Set Menu Item" set_menu_item: "Set Menu Item"

View File

@@ -28,6 +28,7 @@ mm:
hourly: "နာရီအလိုက်" hourly: "နာရီအလိုက်"
top: "အရောင်းရဆုံး" top: "အရောင်းရဆုံး"
orders: "အော်ဒါများ" orders: "အော်ဒါများ"
bookings: "အော်ဒါများ"
credit: "အကြွေး" credit: "အကြွေး"
home: "မူလစာမျက်နှာ" home: "မူလစာမျက်နှာ"
simple_menu_item: "ဟင်းလျာများ" simple_menu_item: "ဟင်းလျာများ"