order id
This commit is contained in:
@@ -1,70 +1,75 @@
|
|||||||
from symtable import Class
|
from symtable import Class
|
||||||
|
|
||||||
|
|
||||||
class SettingsItemsData:
|
class SettingsItemsData:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_site_settings_data():
|
def get_site_settings_data():
|
||||||
data = {
|
data = {
|
||||||
"site_title": { "name": 'Title', "controls": 'TEXT', "active": True },
|
"site_title": {"name": 'Title', "controls": 'TEXT', "active": True, "list_order": 0},
|
||||||
"site_description": { "name": 'Description', "controls": 'TEXTAREA', "active": True },
|
"site_description": {"name": 'Description', "controls": 'TEXTAREA', "active": True, "list_order": 1},
|
||||||
"site_logo_text": { "name": 'Logo Text', "controls": 'TEXT', "active": True },
|
"site_logo_text": {"name": 'Logo Text', "controls": 'TEXT', "active": True, "list_order": 2},
|
||||||
"site_contact_email": { "name": 'Email', "controls": 'TEXT', "active": True },
|
"site_contact_email": {"name": 'Email', "controls": 'TEXT', "active": True, "list_order": 3},
|
||||||
"site_contact_phone": { "name": 'Phone', "controls": 'TEXT', "active": True },
|
"site_contact_phone": {"name": 'Phone', "controls": 'TEXT', "active": True, "list_order": 4},
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_site_social_settings_data():
|
def get_site_social_settings_data():
|
||||||
data = {
|
data = {
|
||||||
"facebook": { "name": 'Facebook', "controls": 'TEXT', "active": True },
|
"facebook": {"name": 'Facebook', "controls": 'TEXT', "active": True, "list_order": 0},
|
||||||
"twitter": { "name": 'Twitter', "controls": 'TEXT', "active": True },
|
"twitter": {"name": 'Twitter', "controls": 'TEXT', "active": True, "list_order": 1},
|
||||||
"youtube": { "name": 'Youtube', "controls": 'TEXT', "active": True },
|
"youtube": {"name": 'Youtube', "controls": 'TEXT', "active": True, "list_order": 2},
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_site_home_settings():
|
def get_site_home_settings():
|
||||||
data = {
|
data = {
|
||||||
"banner_text": { "name": 'Banner Text', "controls": 'TEXT', "active": True },
|
"banner_text": {"name": 'Banner Text', "controls": 'TEXT', "active": True, "list_order": 0},
|
||||||
"banner_description": { "name": 'Banner Description', "controls": 'TEXTAREA', "active": True },
|
"banner_description": {"name": 'Banner Description', "controls": 'TEXTAREA', "active": True,
|
||||||
|
"list_order": 1},
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_site_footer_settings():
|
def get_site_footer_settings():
|
||||||
data = {
|
data = {
|
||||||
"footer_description": { "name": 'Footer Description', "controls": 'TEXTAREA', "active": True },
|
"footer_description": {"name": 'Footer Description', "controls": 'TEXTAREA', "active": True,
|
||||||
"boolean_footer_show_email": { "name": 'Show email in footer', "controls": 'SELECT_NO_YES', "active": True },
|
"list_order": 0},
|
||||||
"boolean_footer_show_made_by": { "name": 'Show made by in footer', "controls": 'SELECT_NO_YES', "active": True },
|
"boolean_footer_show_email": {"name": 'Show email in footer', "controls": 'SELECT_NO_YES', "active": True,
|
||||||
"boolean_footer_show_socials": { "name": 'Show social in footer', "controls": 'SELECT_NO_YES', "active": True },
|
"list_order": 1},
|
||||||
|
"boolean_footer_show_made_by": {"name": 'Show made by in footer', "controls": 'SELECT_NO_YES',
|
||||||
|
"active": True, "list_order": 2},
|
||||||
|
"boolean_footer_show_socials": {"name": 'Show social in footer', "controls": 'SELECT_NO_YES',
|
||||||
|
"active": True, "list_order": 3},
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_site_testimonial_settings():
|
def get_site_testimonial_settings():
|
||||||
data = {
|
data = {
|
||||||
"boolean_testimonial_show": {"name": 'Show testimonial section', "controls": 'SELECT_NO_YES', "active": True},
|
"boolean_testimonial_show": {"name": 'Show testimonial section', "controls": 'SELECT_NO_YES',
|
||||||
"testimonial_description": { "name": 'Description', "controls": 'TEXT', "active": True },
|
"active": True, "list_order": 0},
|
||||||
|
"testimonial_description": {"name": 'Description', "controls": 'TEXT', "active": True, "list_order": 1},
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_site_about_items():
|
def get_site_about_items():
|
||||||
data = {
|
data = {
|
||||||
"about_title": { "name": 'About Title', "controls": 'TEXT', "active": True },
|
"about_title": {"name": 'About Title', "controls": 'TEXT', "active": True, "list_order": 0},
|
||||||
"about_description": { "name": 'About Details', "controls": 'TEXTAREA', "active": True },
|
"about_description": {"name": 'About Details', "controls": 'TEXTAREA', "active": True, "list_order": 1},
|
||||||
"about_extra_1": { "name": 'Extra About us', "controls": 'TEXTAREA', "active": True },
|
"about_extra_1": {"name": 'Extra About us', "controls": 'TEXTAREA', "active": True, "list_order": 2},
|
||||||
"about_extra_2": { "name": 'More About us', "controls": 'TEXTAREA', "active": True },
|
"about_extra_2": {"name": 'More About us', "controls": 'TEXTAREA', "active": True, "list_order": 3},
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_site_contact_items():
|
def get_site_contact_items():
|
||||||
data = {
|
data = {
|
||||||
"contact_title" : { "name": 'Contact Title', "controls": 'TEXT', "active": True },
|
"contact_title": {"name": 'Contact Title', "controls": 'TEXT', "active": True, "list_order": 0},
|
||||||
"contact_introduction": { "name": 'Extra Introduction', "controls": 'TEXTAREA', "active": True },
|
"contact_introduction": {"name": 'Extra Introduction', "controls": 'TEXTAREA', "active": True,
|
||||||
|
"list_order": 1},
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class MyProductsService(BaseService):
|
|||||||
template_uid = validated_data.get('template_uid')
|
template_uid = validated_data.get('template_uid')
|
||||||
member_data = Members.get_member_by_uid(uid)
|
member_data = Members.get_member_by_uid(uid)
|
||||||
member_id = member_data.id
|
member_id = member_data.id
|
||||||
response_data ={}
|
response_data = {}
|
||||||
product_id = validated_data.get('product_id')
|
product_id = validated_data.get('product_id')
|
||||||
|
|
||||||
MembersProducts.set_member_product_template(member_id, product_id, template_uid)
|
MembersProducts.set_member_product_template(member_id, product_id, template_uid)
|
||||||
@@ -69,7 +69,6 @@ class MyProductsService(BaseService):
|
|||||||
db.session.rollback()
|
db.session.rollback()
|
||||||
return ResponseHelper.internal_server_error()
|
return ResponseHelper.internal_server_error()
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def mpproduct_template_data(data):
|
def mpproduct_template_data(data):
|
||||||
try:
|
try:
|
||||||
@@ -83,7 +82,7 @@ class MyProductsService(BaseService):
|
|||||||
|
|
||||||
product_id = validated_data.get('product_id')
|
product_id = validated_data.get('product_id')
|
||||||
template_data = []
|
template_data = []
|
||||||
memberSubscription = MembersProducts.get_member_product_by_product_member_id(member_id, product_id)
|
memberSubscription = MembersProducts.get_member_product_by_product_member_id(member_id, product_id)
|
||||||
if memberSubscription:
|
if memberSubscription:
|
||||||
templates = ProductsTemplates.get_template_by_product_id(product_id)
|
templates = ProductsTemplates.get_template_by_product_id(product_id)
|
||||||
for t in templates:
|
for t in templates:
|
||||||
@@ -98,7 +97,7 @@ class MyProductsService(BaseService):
|
|||||||
|
|
||||||
response_data = {
|
response_data = {
|
||||||
"product_id": product_id,
|
"product_id": product_id,
|
||||||
"current_template_uid": memberSubscription.product_template if memberSubscription else None ,
|
"current_template_uid": memberSubscription.product_template if memberSubscription else None,
|
||||||
"templates": template_data,
|
"templates": template_data,
|
||||||
"last_update": datetime.datetime.utcnow(),
|
"last_update": datetime.datetime.utcnow(),
|
||||||
}
|
}
|
||||||
@@ -135,12 +134,13 @@ class MyProductsService(BaseService):
|
|||||||
|
|
||||||
product_id = validated_data.get('product_id')
|
product_id = validated_data.get('product_id')
|
||||||
product_data = Products.get_product_by_product_id(product_id)
|
product_data = Products.get_product_by_product_id(product_id)
|
||||||
|
# logger.error(f"Product with ID {product_id} does not exist.")
|
||||||
if not product_data:
|
if not product_data:
|
||||||
return {
|
return {
|
||||||
"message": "Please provide product_id",
|
"message": "Please provide valid product_id",
|
||||||
|
"error_message": "Error - Please select a valid product to view",
|
||||||
"data": None,
|
"data": None,
|
||||||
"error": "Bad request"
|
"error": f"Product with ID {product_id} does not exist."
|
||||||
}, 400
|
}, 400
|
||||||
|
|
||||||
logger.info(f"GET HERE ******************************** : {data}", exc_info=True)
|
logger.info(f"GET HERE ******************************** : {data}", exc_info=True)
|
||||||
@@ -197,11 +197,13 @@ class MyProductsService(BaseService):
|
|||||||
product_data = Products.get_product_by_product_id(product_id)
|
product_data = Products.get_product_by_product_id(product_id)
|
||||||
|
|
||||||
if not product_data:
|
if not product_data:
|
||||||
return {
|
if not product_data:
|
||||||
"message": "Please provide product_id",
|
return {
|
||||||
"data": None,
|
"message": "Please provide valid product_id",
|
||||||
"error": "Bad request"
|
"error_message": "Error - Please select a valid product to view",
|
||||||
}, 400
|
"data": None,
|
||||||
|
"error": f"Product with ID {product_id} does not exist."
|
||||||
|
}, 4000
|
||||||
|
|
||||||
logger.info(f"GET HERE ******************************** : {data}", exc_info=True)
|
logger.info(f"GET HERE ******************************** : {data}", exc_info=True)
|
||||||
mumberSub = MembersProducts.get_member_product_by_product_member_id(member_id, product_id)
|
mumberSub = MembersProducts.get_member_product_by_product_member_id(member_id, product_id)
|
||||||
@@ -330,6 +332,14 @@ class MyProductsService(BaseService):
|
|||||||
product_subscription_external_url = ''
|
product_subscription_external_url = ''
|
||||||
product_subscription_internal_url = ''
|
product_subscription_internal_url = ''
|
||||||
product_data = Products.get_product_by_product_id(product_id)
|
product_data = Products.get_product_by_product_id(product_id)
|
||||||
|
if not product_data:
|
||||||
|
return {
|
||||||
|
"message": "Please provide valid product_id",
|
||||||
|
"error_message": "Error - Please select a valid product to view",
|
||||||
|
"data": None,
|
||||||
|
"error": f"Product with ID {product_id} does not exist."
|
||||||
|
}, 400
|
||||||
|
|
||||||
product_description = ProductsDetails.get_product_details_with_product_id(product_id)
|
product_description = ProductsDetails.get_product_details_with_product_id(product_id)
|
||||||
productDataStatus = product_data.status
|
productDataStatus = product_data.status
|
||||||
|
|
||||||
@@ -401,6 +411,14 @@ class MyProductsService(BaseService):
|
|||||||
|
|
||||||
product_subscription_uid = ''
|
product_subscription_uid = ''
|
||||||
product_data = Products.get_product_by_product_id(product_id)
|
product_data = Products.get_product_by_product_id(product_id)
|
||||||
|
if not product_data:
|
||||||
|
return {
|
||||||
|
"message": "Please provide valid product_id",
|
||||||
|
"error_message": "Error - Please select a valid product to view",
|
||||||
|
"data": None,
|
||||||
|
"error": f"Product with ID {product_id} does not exist."
|
||||||
|
}, 400
|
||||||
|
|
||||||
product_description = ProductsDetails.get_product_details_with_product_id(product_id)
|
product_description = ProductsDetails.get_product_details_with_product_id(product_id)
|
||||||
productDataStatus = product_data.status
|
productDataStatus = product_data.status
|
||||||
|
|
||||||
@@ -456,6 +474,14 @@ class MyProductsService(BaseService):
|
|||||||
|
|
||||||
product_subscription_uid = ''
|
product_subscription_uid = ''
|
||||||
product_data = Products.get_product_by_product_id(product_id)
|
product_data = Products.get_product_by_product_id(product_id)
|
||||||
|
if not product_data:
|
||||||
|
return {
|
||||||
|
"message": "Please provide valid product_id",
|
||||||
|
"error_message": "Error - Please select a valid product to view",
|
||||||
|
"data": None,
|
||||||
|
"error": f"Product with ID {product_id} does not exist."
|
||||||
|
}, 400
|
||||||
|
|
||||||
product_description = ProductsDetails.get_product_details_with_product_id(product_id)
|
product_description = ProductsDetails.get_product_details_with_product_id(product_id)
|
||||||
productDataStatus = product_data.status
|
productDataStatus = product_data.status
|
||||||
|
|
||||||
@@ -473,18 +499,19 @@ class MyProductsService(BaseService):
|
|||||||
aboutFields = SettingsItemsData.get_site_about_items()
|
aboutFields = SettingsItemsData.get_site_about_items()
|
||||||
testimonialFields = SettingsItemsData.get_site_testimonial_settings()
|
testimonialFields = SettingsItemsData.get_site_testimonial_settings()
|
||||||
|
|
||||||
settings_items ={}
|
settings_items = {}
|
||||||
if product_id == "A000001":
|
if product_id == "A000001":
|
||||||
settings_items = {
|
settings_items = {
|
||||||
"settings": {"title": 'Settings', "controls": 'settings', "active": 'active show',
|
"settings": {"title": 'Settings', "controls": 'settings', "active": 'active show',
|
||||||
"custom": False, "data": settingsFields, "list_order": 0 },
|
"custom": False, "data": settingsFields, "list_order": 0},
|
||||||
"home_tab": {"title": 'Home Page', "controls": 'home', "active": '', "custom": False,
|
"home_tab": {"title": 'Home Page', "controls": 'home', "active": '', "custom": False,
|
||||||
"data": homeFields, "list_order": 1},
|
"data": homeFields, "list_order": 1},
|
||||||
"footer_tab": {"title": 'Footer', "controls": 'footer', "active": '', "custom": False,
|
"footer_tab": {"title": 'Footer', "controls": 'footer', "active": '', "custom": False,
|
||||||
"data": footerFields, "list_order": 2},
|
"data": footerFields, "list_order": 2},
|
||||||
"about_tab": {"title": 'About Page', "controls": 'about', "active": '', "custom": False,
|
"about_tab": {"title": 'About Page', "controls": 'about', "active": '', "custom": False,
|
||||||
"data": aboutFields, "list_order": 3},
|
"data": aboutFields, "list_order": 3},
|
||||||
"contact_tab": {"title": 'Contact Page', "controls": 'contact', "active": '', "custom": False,
|
"contact_tab": {"title": 'Contact Page', "controls": 'contact', "active": '',
|
||||||
|
"custom": False,
|
||||||
"data": contactFields, "list_order": 4},
|
"data": contactFields, "list_order": 4},
|
||||||
"social_tab": {"title": 'Socials', "controls": 'social', "active": '', "custom": False,
|
"social_tab": {"title": 'Socials', "controls": 'social', "active": '', "custom": False,
|
||||||
"data": socialFields, "list_order": 5},
|
"data": socialFields, "list_order": 5},
|
||||||
@@ -495,27 +522,28 @@ class MyProductsService(BaseService):
|
|||||||
}
|
}
|
||||||
|
|
||||||
if product_id == "A000002":
|
if product_id == "A000002":
|
||||||
settings_items = {
|
settings_items = {
|
||||||
"settings": {"title": 'Settings', "controls": 'settings', "active": 'active show',
|
"settings": {"title": 'Settings', "controls": 'settings', "active": 'active show',
|
||||||
"custom": False, "data": settingsFields, "list_order": 0},
|
"custom": False, "data": settingsFields, "list_order": 0},
|
||||||
"home_tab": {"title": 'Home Page', "controls": 'home', "active": '', "custom": False,
|
"home_tab": {"title": 'Home Page', "controls": 'home', "active": '', "custom": False,
|
||||||
"data": homeFields, "list_order": 1},
|
"data": homeFields, "list_order": 1},
|
||||||
"footer_tab": {"title": 'Footer', "controls": 'footer', "active": '', "custom": False,
|
"footer_tab": {"title": 'Footer', "controls": 'footer', "active": '', "custom": False,
|
||||||
"data": footerFields, "list_order": 2},
|
"data": footerFields, "list_order": 2},
|
||||||
"about_tab": {"title": 'About Page', "controls": 'about', "active": '', "custom": False,
|
"about_tab": {"title": 'About Page', "controls": 'about', "active": '', "custom": False,
|
||||||
"data": aboutFields, "list_order": 3},
|
"data": aboutFields, "list_order": 3},
|
||||||
"contact_tab": {"title": 'Contact Page', "controls": 'contact', "active": '',
|
"contact_tab": {"title": 'Contact Page', "controls": 'contact', "active": '',
|
||||||
"custom": False,
|
"custom": False,
|
||||||
"data": contactFields, "list_order": 4},
|
"data": contactFields, "list_order": 4},
|
||||||
"testimonial_tab": {"title": 'Testimonials', "controls": 'testimonial', "active": '', "custom": False,
|
"testimonial_tab": {"title": 'Testimonials', "controls": 'testimonial', "active": '',
|
||||||
"data": testimonialFields, "list_order": 5},
|
"custom": False,
|
||||||
"social_tab": {"title": 'Socials', "controls": 'social', "active": '', "custom": False,
|
"data": testimonialFields, "list_order": 5},
|
||||||
"data": socialFields, "list_order": 6},
|
"social_tab": {"title": 'Socials', "controls": 'social', "active": '', "custom": False,
|
||||||
"template_tab": {"title": 'Template', "controls": 'template', "active": '', "custom": True,
|
"data": socialFields, "list_order": 6},
|
||||||
"data": templateData, "list_order": 7},
|
"template_tab": {"title": 'Template', "controls": 'template', "active": '', "custom": True,
|
||||||
"color_scheme_tab": {"title": 'Color Scheme', "controls": 'color-scheme', "active": '',
|
"data": templateData, "list_order": 7},
|
||||||
"custom": True, "data": {}, "list_order": 8}
|
"color_scheme_tab": {"title": 'Color Scheme', "controls": 'color-scheme', "active": '',
|
||||||
}
|
"custom": True, "data": {}, "list_order": 8}
|
||||||
|
}
|
||||||
#
|
#
|
||||||
|
|
||||||
# Simulate processing
|
# Simulate processing
|
||||||
|
|||||||
@@ -98,7 +98,9 @@ class Products(db.Model):
|
|||||||
"""
|
"""
|
||||||
productItem = cls.query.filter_by(product_id = product_id).first()
|
productItem = cls.query.filter_by(product_id = product_id).first()
|
||||||
if not productItem:
|
if not productItem:
|
||||||
raise ValueError(f"pProduct with ID {product_id} does not exist.")
|
# raise ValueError(f"pProduct with ID {product_id} does not exist.")
|
||||||
|
logger.error(f"Product with ID {product_id} does not exist.")
|
||||||
|
return None
|
||||||
return productItem
|
return productItem
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class ProductsDetails(db.Model):
|
|||||||
"""
|
"""
|
||||||
productItem = cls.query.filter_by(product_id = product_id).first()
|
productItem = cls.query.filter_by(product_id = product_id).first()
|
||||||
if not productItem:
|
if not productItem:
|
||||||
raise ValueError(f"pProduct with ID {product_id} does not exist.")
|
raise ValueError(f"Product with ID {product_id} does not exist.")
|
||||||
return productItem
|
return productItem
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user