fix filter

This commit is contained in:
CHIEFSOFT\ameye
2025-10-21 12:26:56 -04:00
parent dea390cb8b
commit 6545e5b94c
2 changed files with 40 additions and 3 deletions
+18 -1
View File
@@ -227,7 +227,22 @@ class OfficeDashboardService(BaseService):
@staticmethod
def get_office_product_templates(filters):
templates = ProductsTemplates.get_template_for_office(filters)
# Extract filters
product_id = filters.get('product_id')
provision_name = filters.get('provision_name')
# Extract pagination parameters
page = int(filters.get('page', 1))
limit = int(filters.get('limit', 20))
# Ensure page and limit are valid
if page < 1:
page = 1
if limit < 1 or limit > 100:
limit = 20
templates = ProductsTemplates.get_template_for_office(product_id, provision_name, page, limit)
templates_data = []
if templates:
for t in templates:
@@ -236,10 +251,12 @@ class OfficeDashboardService(BaseService):
'uid': t.uid,
'product_id': t.product_id,
'provision_name': t.provision_name,
'status': t.status,
'added': t.added.isoformat() if t.added else None,
})
templates_result = {
"templates": templates_data,
"product_options": []
}
return templates_result