my product dra
This commit is contained in:
@@ -178,8 +178,6 @@ def merms_contacts():
|
||||
response = ContactService.process_request(data)
|
||||
return response
|
||||
|
||||
|
||||
|
||||
@api.route("/panel/account/products", methods=["POST"])
|
||||
@jwt_required()
|
||||
def merms_products():
|
||||
|
||||
@@ -345,7 +345,7 @@ class AccountService(BaseService):
|
||||
'option_name': t.option_name,
|
||||
'option_type': t.option_type,
|
||||
'payment_uid': t.payment_uid,
|
||||
'amount': t.amount,
|
||||
'amount': round( t.amount*0.01, 2),
|
||||
'status': t.status,
|
||||
'added': t.added
|
||||
})
|
||||
|
||||
@@ -36,17 +36,17 @@ class MyProductsService(BaseService):
|
||||
validated_data = MyProductsService.validate_data(data, MyProductSetTemplateSchema())
|
||||
token = validated_data.get('token')
|
||||
uid = validated_data.get('uid')
|
||||
template_uid = validated_data.get('template_uid')
|
||||
member_data = Members.get_member_by_uid(uid)
|
||||
member_id = member_data.id
|
||||
|
||||
response_data ={}
|
||||
product_id = validated_data.get('product_id')
|
||||
|
||||
template_data = []
|
||||
MembersProducts.set_member_product_template(member_id, product_id, template_uid)
|
||||
|
||||
response_data = {
|
||||
"product_id": product_id,
|
||||
"current_template_uid": "f7198ccc-1efc-4c40-8b79-17bc17956195",
|
||||
"templates": template_data,
|
||||
"new_template_uid": template_uid,
|
||||
"last_update": datetime.datetime.utcnow(),
|
||||
}
|
||||
|
||||
@@ -82,44 +82,23 @@ class MyProductsService(BaseService):
|
||||
member_id = member_data.id
|
||||
|
||||
product_id = validated_data.get('product_id')
|
||||
|
||||
# class MyProductSchema(Schema):
|
||||
# token = fields.Str(required=True)
|
||||
# uid = fields.Str(required=True)
|
||||
# product_id = fields.Str(required=True)
|
||||
templates = ProductsTemplates.get_template_by_product_id(product_id)
|
||||
template_data = {
|
||||
'template_16': {'title': 'Template Name-16', 'template_id': '02af24fd-2b1a-46ed-af21-87018e726408',
|
||||
'banner': 'file-icon/svg.png', 'active': '0'},
|
||||
'template_22': {'title': 'Template Name-22', 'template_id': '8b296894-42e4-4f2e-abd1-7c2a38d6e07b',
|
||||
'banner': 'file-icon/svg.png', 'active': '0'},
|
||||
'template_47': {'title': 'Template Name-47', 'template_id': 'ef2ffa1c-9272-42cd-9d33-0e614047b4f8',
|
||||
'banner': 'file-icon/svg.png', 'active': '0'},
|
||||
'template_25': {'title': 'Template Name-25', 'template_id': 'b3a7ba31-dc47-4a40-a5cc-fd1ff27d6b78',
|
||||
'banner': 'file-icon/svg.png', 'active': '1'},
|
||||
'template_49': {'title': 'Template Name-49', 'template_id': '60959c69-6672-4f69-a006-eeb7d210e605',
|
||||
'banner': 'file-icon/svg.png', 'active': '0'},
|
||||
'template_27': {'title': 'Template Name-27', 'template_id': 'e4acb98a-c584-45f2-bece-af677dcf0a1f',
|
||||
'banner': 'file-icon/svg.png', 'active': '0'},
|
||||
'template_51': {'title': 'Template Name-51', 'template_id': '975ee42e-3169-4978-92d7-d28e7e2ac014',
|
||||
'banner': 'file-icon/svg.png', 'active': '0'},
|
||||
'template_9': {'title': 'Template Name-9', 'template_id': 'fc8f0738-6500-4775-9895-2047cd275302',
|
||||
'banner': 'file-icon/svg.png', 'active': '0'},
|
||||
}
|
||||
template_data = []
|
||||
for t in templates:
|
||||
template_data.append({
|
||||
'id': t.id,
|
||||
'template_uid': t.uid,
|
||||
'title': t.name,
|
||||
'active': 1,
|
||||
'banner': 'https://qa-panel.mermsemr.com/static/media/',
|
||||
'added': t.added.isoformat() if t.added else None
|
||||
})
|
||||
memberSubscription = MembersProducts.get_member_product_by_product_member_id(member_id, product_id)
|
||||
if memberSubscription:
|
||||
templates = ProductsTemplates.get_template_by_product_id(product_id)
|
||||
for t in templates:
|
||||
template_data.append({
|
||||
'id': t.id,
|
||||
'template_uid': t.uid,
|
||||
'title': t.name,
|
||||
'active': 1,
|
||||
'banner': 'https://qa-panel.mermsemr.com/static/media/',
|
||||
'added': t.added.isoformat() if t.added else None
|
||||
})
|
||||
|
||||
response_data = {
|
||||
"product_id": product_id,
|
||||
"current_template_uid": "f7198ccc-1efc-4c40-8b79-17bc17956195",
|
||||
"current_template_uid": memberSubscription.product_template if memberSubscription else None ,
|
||||
"templates": template_data,
|
||||
"last_update": datetime.datetime.utcnow(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user