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