Add bulk upgrade to system for firm tasks

This commit is contained in:
A R R R Associates
2026-09-19 15:28:45 +05:30
parent cc8691d4cd
commit 5cee4f8de4
2 changed files with 125 additions and 4 deletions
@@ -26,6 +26,8 @@
{% if request.query_params.get('imported') %}<div class="rounded-2xl border border-emerald-200 bg-emerald-50 p-4 text-sm text-emerald-800">Excel import completed: {{ request.query_params.get('created','0') }} created, {{ request.query_params.get('updated','0') }} updated.</div>{% endif %}
{% if request.query_params.get('import_error') %}<div class="rounded-2xl border border-red-200 bg-red-50 p-4 text-sm text-red-800">Excel import failed validation. No partial update was committed.</div>{% endif %}
{% if request.query_params.get('system_upgraded') %}<div class="rounded-2xl border border-emerald-200 bg-emerald-50 p-4 text-sm text-emerald-800">System update applied to the firm task. Safe unstarted tasks in open engagements were refreshed automatically.</div>{% endif %}
{% if request.query_params.get('system_bulk_upgraded') %}<div class="rounded-2xl border border-emerald-200 bg-emerald-50 p-4 text-sm text-emerald-800"><span class="font-semibold">Full system upgrade completed.</span> {{ request.query_params.get('bulk_count','0') }} firm task(s) were aligned to the latest system defaults{% if request.query_params.get('bulk_retired','0') != '0' %}, including {{ request.query_params.get('bulk_retired','0') }} retired system task(s){% endif %}. Open engagements: {{ request.query_params.get('engagement_created','0') }} task(s) added, {{ request.query_params.get('engagement_updated','0') }} pending task(s) refreshed, {{ request.query_params.get('engagement_deactivated','0') }} pending task(s) deactivated. Started/completed/reviewed history was preserved.</div>{% endif %}
{% if request.query_params.get('system_bulk_none') %}<div class="rounded-2xl border border-blue-200 bg-blue-50 p-4 text-sm text-blue-800">All firm tasks for this service are already aligned with the latest system defaults. Firm-only tasks were left unchanged.</div>{% endif %}
{% if request.query_params.get('system_kept') %}<div class="rounded-2xl border border-blue-200 bg-blue-50 p-4 text-sm text-blue-800">Firm customization retained for this system revision. You will be prompted again when the system default changes in a later revision.</div>{% endif %}
{% if request.query_params.get('sync_success') %}<div class="rounded-2xl border border-emerald-200 bg-emerald-50 p-4 text-sm text-emerald-800">System defaults synchronized: {{ request.query_params.get('created','0') }} created, {{ request.query_params.get('updated','0') }} updated, {{ request.query_params.get('custom_updates','0') }} customized task(s) awaiting review.</div>{% endif %}
@@ -61,10 +63,18 @@
<p class="text-sm text-slate-500">Create a task template for this firm and service.</p>
</div>
{% if active_default_task_count > 0 %}
<form method="post" action="/services/catalogue/{{ service.id }}/firm-tasks/sync-system-defaults">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<button class="rounded-xl border border-brand-300 px-4 py-2 text-sm font-medium text-brand-700 hover:bg-brand-50" type="submit">Sync System Defaults</button>
</form>
<div class="flex flex-wrap items-center gap-2">
<form method="post" action="/services/catalogue/{{ service.id }}/firm-tasks/sync-system-defaults">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<button class="rounded-xl border border-brand-300 px-4 py-2 text-sm font-medium text-brand-700 hover:bg-brand-50" type="submit">Sync System Defaults</button>
</form>
{% if system_update_available_count > 0 %}
<form method="post" action="/services/templates/{{ service.id }}/system-updates/upgrade-all" onsubmit="return confirm('Upgrade all {{ system_update_available_count }} firm task(s) with pending system updates to the latest System Default? Firm-only tasks will remain unchanged. Safe pending/unstarted tasks in open engagements will be synchronized; started, completed and reviewed history will be preserved.');">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<button class="rounded-xl bg-violet-700 px-4 py-2 text-sm font-semibold text-white hover:bg-violet-800" type="submit">Upgrade All to System ({{ system_update_available_count }})</button>
</form>
{% endif %}
</div>
{% endif %}
</div>
@@ -163,6 +173,21 @@
</section>
{% endif %}
{% if can_manage_tasks and system_update_available_count > 0 %}
<section class="rounded-2xl border border-violet-200 bg-violet-50 p-4">
<div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
<div>
<h3 class="text-sm font-semibold text-violet-950">System updates awaiting firm decision</h3>
<p class="mt-1 text-xs text-violet-800">{{ system_update_available_count }} customized task(s) have a newer system revision. Use <span class="font-semibold">Upgrade All to System</span> for full alignment, or continue using the existing task-by-task Upgrade / Keep controls below.</p>
</div>
<form method="post" action="/services/templates/{{ service.id }}/system-updates/upgrade-all" onsubmit="return confirm('Upgrade all {{ system_update_available_count }} firm task(s) with pending system updates to the latest System Default? Firm-only tasks will remain unchanged. Safe pending/unstarted tasks in open engagements will be synchronized; started, completed and reviewed history will be preserved.');">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<button class="whitespace-nowrap rounded-xl bg-violet-700 px-4 py-2 text-sm font-semibold text-white hover:bg-violet-800" type="submit">Upgrade All to System ({{ system_update_available_count }})</button>
</form>
</div>
</section>
{% endif %}
<section class="overflow-hidden rounded-2xl bg-white shadow-soft">
<div class="flex items-center justify-between gap-3 border-b border-slate-100 px-5 py-4">
<div>