@@ -242,43 +242,20 @@ <h5 class="mb-3"><i class="bi bi-diagram-3"></i> Approval History</h5>
242242 {% endfor %}
243243
244244 {% if sub_workflow_instance_stages %}
245- {# ---- Per-instance stage cards (like parent stages) ---- #}
245+ {# ---- One table per sub-workflow instance, steps as rows ---- #}
246246 {% for section in sub_workflow_instance_stages %}
247247 < h5 class ="mb-3 mt-4 "> < i class ="bi bi-list-check "> </ i > {{ section.instance.label }}</ h5 >
248- {% for stage in section.stage_groups %}
249248 < div class ="card mb-3
250- {% if stage.rejected_count > 0 %}border-danger
251- {% elif stage.approved_count == stage.total_count and stage.total_count > 0 %}border-success
252- {% elif stage.approved_count > 0 %}border-primary
249+ {% if section.instance.status == 'rejected' %}border-danger
250+ {% elif section.instance.status == 'approved' %}border-success
251+ {% elif section.instance.status == 'in_progress' %}border-primary
253252 {% else %}border-secondary{% endif %} ">
254- < div class ="card-header d-flex justify-content-between align-items-center
255- {% if stage.rejected_count > 0 %}bg-danger text-white
256- {% elif stage.approved_count == stage.total_count and stage.total_count > 0 %}bg-success text-white
257- {% elif stage.approved_count > 0 %}bg-primary text-white
258- {% else %}bg-light text-muted{% endif %} ">
259- < span >
260- < strong > Step {{ forloop.counter }}: {{ stage.name }}</ strong >
261- {% if stage.approval_logic == "all" %}
262- < span class ="badge bg-light text-dark ms-2 " style ="font-size:11px; "> All must approve</ span >
263- {% elif stage.approval_logic == "any" %}
264- < span class ="badge bg-light text-dark ms-2 " style ="font-size:11px; "> Any can approve</ span >
265- {% else %}
266- < span class ="badge bg-light text-dark ms-2 " style ="font-size:11px; "> Sequential</ span >
267- {% endif %}
268- </ span >
269- < span class ="badge bg-white
270- {% if stage.rejected_count > 0 %}text-danger
271- {% elif stage.approved_count == stage.total_count and stage.total_count > 0 %}text-success
272- {% else %}text-secondary{% endif %} ">
273- {{ stage.approved_count }}/{{ stage.total_count }} approved
274- {% if stage.rejected_count > 0 %} · {{ stage.rejected_count }} rejected{% endif %}
275- </ span >
276- </ div >
277253 < div class ="card-body p-0 ">
278254 < div class ="table-responsive ">
279- < table class ="table table-sm mb-0 ">
255+ < table class ="table table-sm table-hover mb-0 ">
280256 < thead class ="table-light ">
281257 < tr >
258+ < th > Step</ th >
282259 < th > Assigned To</ th >
283260 < th > Status</ th >
284261 < th > Completed By</ th >
@@ -287,8 +264,10 @@ <h5 class="mb-3 mt-4"><i class="bi bi-list-check"></i> {{ section.instance.label
287264 </ tr >
288265 </ thead >
289266 < tbody >
267+ {% for stage in section.stage_groups %}
290268 {% for task in stage.tasks %}
291269 < tr >
270+ < td > < strong > {{ stage.name }}</ strong > </ td >
292271 < td >
293272 {% if task.assigned_to %}
294273 {{ task.assigned_to.get_full_name|default:task.assigned_to.username }}
@@ -309,13 +288,13 @@ <h5 class="mb-3 mt-4"><i class="bi bi-list-check"></i> {{ section.instance.label
309288 < td > {{ task.comments|default:"-" }}</ td >
310289 </ tr >
311290 {% endfor %}
291+ {% endfor %}
312292 </ tbody >
313293 </ table >
314294 </ div >
315295 </ div >
316296 </ div >
317297 {% endfor %}
318- {% endfor %}
319298 {% endif %}
320299
321300 {% else %}
0 commit comments