membership setting
This commit is contained in:
@@ -103,9 +103,10 @@ class Settings::PromotionsController < ApplicationController
|
|||||||
arr_inst = []
|
arr_inst = []
|
||||||
item_inst = MenuItemInstance.find_by_item_instance_code(params[:item_instance_code])
|
item_inst = MenuItemInstance.find_by_item_instance_code(params[:item_instance_code])
|
||||||
if item_inst.nil?
|
if item_inst.nil?
|
||||||
product = Product.where("item_code = ?",params[:item_instance_code]).pluck(:name,:item_code)
|
product = Product.where("item_code = ?",params[:item_instance_code])
|
||||||
res.push(product.name)
|
product.each do |pdt|
|
||||||
res.push(product.item_code)
|
res.push({pdt.item_code => pdt.name})
|
||||||
|
end
|
||||||
else
|
else
|
||||||
# menu_item = item_inst.menu_item.pluck(:name,:item_code)
|
# menu_item = item_inst.menu_item.pluck(:name,:item_code)
|
||||||
# res.push(item_inst.item_instance_name)
|
# res.push(item_inst.item_instance_name)
|
||||||
|
|||||||
@@ -18,13 +18,13 @@ class Customer < ApplicationRecord
|
|||||||
paginates_per 50
|
paginates_per 50
|
||||||
|
|
||||||
def self.get_member_account(customer)
|
def self.get_member_account(customer)
|
||||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
membership = MembershipSetting.active.find_by_membership_type("paypar_url")
|
||||||
memberaction = MembershipAction.find_by_membership_type("get_all_member_account")
|
memberaction = MembershipAction.active.find_by_membership_type("get_all_member_account")
|
||||||
merchant_uid = memberaction.merchant_account_id.to_s
|
merchant_uid = memberaction.merchant_account_id.to_s
|
||||||
auth_token = memberaction.auth_token.to_s
|
auth_token = memberaction.auth_token.to_s
|
||||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||||
# urltest =self.url_exist?(url)
|
# urltest =self.url_exist?(url)
|
||||||
|
if !membership.nil? && !memberaction.nil?
|
||||||
begin
|
begin
|
||||||
response = HTTParty.get(url, :body => {
|
response = HTTParty.get(url, :body => {
|
||||||
membership_id: customer.membership_id,
|
membership_id: customer.membership_id,
|
||||||
@@ -49,6 +49,9 @@ 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
|
||||||
|
else
|
||||||
|
response = {status: false, message: "There is no membership setting."}
|
||||||
|
end
|
||||||
Rails.logger.debug "--------Get Member Account response -------"
|
Rails.logger.debug "--------Get Member Account response -------"
|
||||||
Rails.logger.debug response.to_json
|
Rails.logger.debug response.to_json
|
||||||
return response;
|
return response;
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
class MembershipAction < ApplicationRecord
|
class MembershipAction < ApplicationRecord
|
||||||
|
scope :active, -> { where(is_active: true) }
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
class MembershipSetting < ApplicationRecord
|
class MembershipSetting < ApplicationRecord
|
||||||
|
scope :active, -> { where(is_active: true) }
|
||||||
|
|
||||||
MembershipSetting = MembershipSetting.find_by_id(1)
|
MembershipSetting = MembershipSetting.find_by_id(1)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -385,6 +385,7 @@
|
|||||||
|
|
||||||
if(result.length > 0){
|
if(result.length > 0){
|
||||||
var iteminstlists;
|
var iteminstlists;
|
||||||
|
if(arr_item_inst instanceof Array){
|
||||||
$.each(arr_item_inst,function(k2,v2al){
|
$.each(arr_item_inst,function(k2,v2al){
|
||||||
$("select#"+select_id).empty();
|
$("select#"+select_id).empty();
|
||||||
var selected = "";
|
var selected = "";
|
||||||
@@ -393,6 +394,9 @@
|
|||||||
iteminstlists += "<option value='"+k3+"' "+selected+">"+v3al+"</option>";
|
iteminstlists += "<option value='"+k3+"' "+selected+">"+v3al+"</option>";
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}else if(arr_item_inst != ""){
|
||||||
|
iteminstlists += "<option value='"+par_item_code+"' selected>"+arr_item_inst+"</option>";
|
||||||
|
}
|
||||||
$("select#"+select_id).append(iteminstlists);
|
$("select#"+select_id).append(iteminstlists);
|
||||||
|
|
||||||
$("select#"+select_id).parent().parent().siblings("div.menu_item_choose").find("select").find("option[value='"+par_item_code+"']").attr("selected","true")
|
$("select#"+select_id).parent().parent().siblings("div.menu_item_choose").find("select").find("option[value='"+par_item_code+"']").attr("selected","true")
|
||||||
|
|||||||
Reference in New Issue
Block a user