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