feat: Add optional max wait display to task rows and tables

This commit is contained in:
Chop
2025-07-17 22:39:54 +02:00
parent b5120657a9
commit 490994d323

View File

@@ -250,7 +250,7 @@ export default function ProjectTasksList() {
if (days > 3) return "warning";
return "high";
};
const TaskRow = ({ task, showTimeLeft = false }) => (
const TaskRow = ({ task, showTimeLeft = false, showMaxWait = true }) => (
<tr className="hover:bg-gray-50 border-b border-gray-200">
<td className="px-4 py-3">
<div className="flex items-center gap-2">
@@ -273,16 +273,6 @@ export default function ProjectTasksList() {
<td className="px-4 py-3 text-sm text-gray-600">
{task.address || "N/A"}
</td>
<td className="px-4 py-3 text-sm text-gray-600">
{task.created_by_name ? (
<div>
<div className="font-medium">{task.created_by_name}</div>
<div className="text-xs text-gray-500">{task.created_by_email}</div>
</div>
) : (
"N/A"
)}
</td>
<td className="px-4 py-3 text-sm text-gray-600">
{task.assigned_to_name ? (
<div>
@@ -368,9 +358,11 @@ export default function ProjectTasksList() {
})()
)}
</td>
{showMaxWait && (
<td className="px-4 py-3 text-sm text-gray-500">
{task.max_wait_days} days
</td>
)}
<td className="px-4 py-3">
<TaskStatusDropdownSimple
task={task}
@@ -380,10 +372,10 @@ export default function ProjectTasksList() {
</td>
</tr>
);
const TaskTable = ({ tasks, showGrouped = false, showTimeLeft = false }) => {
const TaskTable = ({ tasks, showGrouped = false, showTimeLeft = false, showMaxWait = true }) => {
const filteredTasks = filterTasks(tasks);
const groupedTasks = groupTasksByName(filteredTasks);
const colSpan = showTimeLeft ? "10" : "9";
const colSpan = showTimeLeft && showMaxWait ? "9" : showTimeLeft || showMaxWait ? "8" : "7";
return (
<div className="overflow-x-auto">
@@ -402,9 +394,6 @@ export default function ProjectTasksList() {
<th className="px-4 py-3 text-left text-sm font-medium text-gray-700">
Address
</th>
<th className="px-4 py-3 text-left text-sm font-medium text-gray-700">
Created By
</th>
<th className="px-4 py-3 text-left text-sm font-medium text-gray-700">
Assigned To
</th>
@@ -416,9 +405,11 @@ export default function ProjectTasksList() {
<th className="px-4 py-3 text-left text-sm font-medium text-gray-700">
Date Info
</th>
{showMaxWait && (
<th className="px-4 py-3 text-left text-sm font-medium text-gray-700">
Max Wait
</th>{" "}
</th>
)}{" "}
<th className="px-4 py-3 text-left text-sm font-medium text-gray-700">
Actions
</th>
@@ -442,6 +433,7 @@ export default function ProjectTasksList() {
key={task.id}
task={task}
showTimeLeft={showTimeLeft}
showMaxWait={showMaxWait}
/>
))}
</Fragment>
@@ -544,6 +536,7 @@ export default function ProjectTasksList() {
tasks={taskGroups.pending}
showGrouped={groupBy === "task_name"}
showTimeLeft={false}
showMaxWait={true}
/>
</div>
@@ -564,6 +557,7 @@ export default function ProjectTasksList() {
tasks={taskGroups.in_progress}
showGrouped={groupBy === "task_name"}
showTimeLeft={true}
showMaxWait={false}
/>
</div>
@@ -584,6 +578,7 @@ export default function ProjectTasksList() {
tasks={taskGroups.completed}
showGrouped={groupBy === "task_name"}
showTimeLeft={false}
showMaxWait={false}
/>
</div>
</div>