office templates
This commit is contained in:
@@ -4,7 +4,8 @@ from app.api.services.base_service import BaseService
|
||||
from sqlalchemy import func, desc
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from app.extensions import db
|
||||
from app.models import MembersProducts, Products, Members, ProductsDetails, ProductsDetails, ProvisionActions, Payments
|
||||
from app.models import MembersProducts, Products, Payments, \
|
||||
ProductsTemplates, CustomTemplates
|
||||
|
||||
|
||||
class OfficeDashboardService(BaseService):
|
||||
@@ -145,3 +146,41 @@ class OfficeDashboardService(BaseService):
|
||||
}
|
||||
|
||||
return products_result
|
||||
|
||||
@staticmethod
|
||||
def get_office_product_templates(filters):
|
||||
templates = ProductsTemplates.get_template_for_office(filters)
|
||||
templates_data = []
|
||||
if templates:
|
||||
for t in templates:
|
||||
templates_data.append({
|
||||
'id': t.id,
|
||||
'uid': t.uid,
|
||||
'product_id': t.product_id,
|
||||
'provision_name': t.provision_name,
|
||||
'added': t.added.isoformat() if t.added else None,
|
||||
})
|
||||
templates_result = {
|
||||
"templates": templates_data,
|
||||
}
|
||||
|
||||
return templates_result
|
||||
|
||||
@staticmethod
|
||||
def get_office_custom_templates(filters):
|
||||
templates = CustomTemplates.get_template_for_office(filters)
|
||||
templates_data = []
|
||||
if templates:
|
||||
for t in templates:
|
||||
templates_data.append({
|
||||
'id': t.id,
|
||||
'uid': t.uid,
|
||||
'custom_id': t.custom_id,
|
||||
'provision_name': t.provision_name,
|
||||
'added': t.added.isoformat() if t.added else None,
|
||||
})
|
||||
templates_result = {
|
||||
"templates": templates_data,
|
||||
}
|
||||
|
||||
return templates_result
|
||||
|
||||
Reference in New Issue
Block a user