Fix engagement period validation for non periodic services

This commit is contained in:
A R R R Associates
2026-09-03 15:44:47 +05:30
parent eef9a01365
commit 40047c0a7f
2 changed files with 2 additions and 1 deletions
+1
View File
@@ -1321,6 +1321,7 @@ def subscription_edit_page(request: Request, subscription_id: int):
selected_client_id=row.client_id,
financial_year=row.financial_year,
period_choices=period_choices_for_service(row.financial_year, getattr(row.catalogue, "recurrence_type", None)),
period_required=recurrence_requires_period(getattr(row.catalogue, "recurrence_type", None)),
)
finally:
db.close()
@@ -52,7 +52,7 @@
<div id="engagement-period-field">
<label class="mb-2 block text-sm font-medium text-slate-700">Return / Engagement Period</label>
{% if mode == 'edit' %}
<select name="period_label" required class="w-full rounded-xl border border-slate-300 px-4 py-2 text-sm">
<select name="period_label" {% if period_required %}required{% endif %} class="w-full rounded-xl border border-slate-300 px-4 py-2 text-sm">
{% for value, label in period_choices %}<option value="{{ value }}" {% if subscription and subscription.period_label == value %}selected{% endif %}>{{ label }}</option>{% endfor %}
</select>
{% else %}