diff --git a/src/pages/team/TaskDetail.jsx b/src/pages/team/TaskDetail.jsx
index 5e5b043..d832e35 100755
--- a/src/pages/team/TaskDetail.jsx
+++ b/src/pages/team/TaskDetail.jsx
@@ -286,26 +286,41 @@ export default function TaskDetail() {
{submissions.length === 0 ? (
No request notes yet.
) : (() => {
- const latest = submissions[submissions.length - 1];
+ const currentVersion = task.current_version + 1;
+ const currentGroup = submissions.filter(s => s.version_number === currentVersion);
+ const primary = currentGroup.find(s => s.type !== 'amendment') || currentGroup[0];
+ const amendments = currentGroup.filter(s => s.type === 'amendment');
+ if (!primary) return null;
return (
<>
- {vLabel(latest.version_number - 1)}
-
+ {vLabel(primary.version_number - 1)}
+
- {latest.submitted_by_name} · {new Date(latest.submitted_at).toLocaleDateString()}
+ {primary.submitted_by_name} · {new Date(primary.submitted_at).toLocaleDateString()}
-
{latest.service_type}
-
{latest.deadline || '—'}
+
{primary.service_type}
+
{primary.deadline || '—'}
- {latest.description}
+ {primary.description}
+ {amendments.map(amendment => (
+
+
+ Amended Request
+
+
+ {amendment.submitted_by_name} · {new Date(amendment.submitted_at).toLocaleDateString()}
+
+
{amendment.description}
+
+ ))}
>
);
})()}
@@ -316,54 +331,73 @@ export default function TaskDetail() {
Version History
- {submissions.map((sub, i) => {
- const delivery = sub.delivery;
- const isCurrent = i === submissions.length - 1;
+ {Object.values(
+ submissions.reduce((groups, sub) => {
+ const key = sub.version_number;
+ if (!groups[key]) groups[key] = [];
+ groups[key].push(sub);
+ return groups;
+ }, {})
+ ).map((group, gi, all) => {
+ const primary = group.find(s => s.type !== 'amendment') || group[0];
+ const amendments = group.filter(s => s.type === 'amendment');
+ const delivery = primary.delivery;
+ const isCurrent = gi === all.length - 1;
return (
-
-
-
{vLabel(sub.version_number - 1)}
-
- {isCurrent &&
Current}
+
+
+ {vLabel(primary.version_number - 1)}
+
+ {isCurrent && Current}
- {sub.submitted_by_name} · {new Date(sub.submitted_at).toLocaleDateString()}
+ {primary.submitted_by_name} · {new Date(primary.submitted_at).toLocaleDateString()}
-
+
Service
-
{sub.service_type}
+
{primary.service_type}
Deadline
-
{sub.deadline || '—'}
+
{primary.deadline || '—'}
-
{sub.description}
+
{primary.description}
+
+ {amendments.map(amendment => (
+
+
+ Amended Request
+
+
+ {amendment.submitted_by_name} · {new Date(amendment.submitted_at).toLocaleDateString()}
+
+
{amendment.description}
+
+ ))}
{delivery ? (
-
+
✓ Delivered by {delivery.sent_by} on {new Date(delivery.sent_at).toLocaleDateString()}
{(delivery.files || []).map((file, fi) => (
-
+
📄
{file.name}
{file.size > 0 && {formatSize(file.size)}}
-
+
))}
) : (
-
+
📎 No file delivered yet for this version.
)}