Add next_due_date to admin task views
Display next_due_date field in task list table and task detail page so admins can see the effective date used for overdue calculations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -124,6 +124,14 @@ export function TaskDetailClient() {
|
|||||||
<div className="text-sm font-medium text-muted-foreground">Due Date</div>
|
<div className="text-sm font-medium text-muted-foreground">Due Date</div>
|
||||||
<div>{task.due_date ? new Date(task.due_date).toLocaleDateString() : '-'}</div>
|
<div>{task.due_date ? new Date(task.due_date).toLocaleDateString() : '-'}</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<div className="text-sm font-medium text-muted-foreground">Next Due Date</div>
|
||||||
|
<div>{task.next_due_date ? new Date(task.next_due_date).toLocaleDateString() : '-'}</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div className="text-sm font-medium text-muted-foreground">Frequency</div>
|
||||||
|
<div>{task.frequency_name || '-'}</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
@@ -67,6 +67,11 @@ const columns: ColumnDef<Task>[] = [
|
|||||||
header: 'Due Date',
|
header: 'Due Date',
|
||||||
cell: ({ row }) => row.original.due_date ? new Date(row.original.due_date).toLocaleDateString() : '-',
|
cell: ({ row }) => row.original.due_date ? new Date(row.original.due_date).toLocaleDateString() : '-',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
accessorKey: 'next_due_date',
|
||||||
|
header: 'Next Due',
|
||||||
|
cell: ({ row }) => row.original.next_due_date ? new Date(row.original.next_due_date).toLocaleDateString() : '-',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
accessorKey: 'is_cancelled',
|
accessorKey: 'is_cancelled',
|
||||||
header: 'State',
|
header: 'State',
|
||||||
|
|||||||
@@ -191,6 +191,7 @@ export interface Task {
|
|||||||
frequency_id?: number;
|
frequency_id?: number;
|
||||||
frequency_name?: string;
|
frequency_name?: string;
|
||||||
due_date?: string;
|
due_date?: string;
|
||||||
|
next_due_date?: string;
|
||||||
estimated_cost?: number;
|
estimated_cost?: number;
|
||||||
actual_cost?: number;
|
actual_cost?: number;
|
||||||
contractor_id?: number;
|
contractor_id?: number;
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ type TaskResponse struct {
|
|||||||
FrequencyID *uint `json:"frequency_id,omitempty"`
|
FrequencyID *uint `json:"frequency_id,omitempty"`
|
||||||
FrequencyName *string `json:"frequency_name,omitempty"`
|
FrequencyName *string `json:"frequency_name,omitempty"`
|
||||||
DueDate *string `json:"due_date,omitempty"`
|
DueDate *string `json:"due_date,omitempty"`
|
||||||
|
NextDueDate *string `json:"next_due_date,omitempty"`
|
||||||
EstimatedCost *float64 `json:"estimated_cost,omitempty"`
|
EstimatedCost *float64 `json:"estimated_cost,omitempty"`
|
||||||
ActualCost *float64 `json:"actual_cost,omitempty"`
|
ActualCost *float64 `json:"actual_cost,omitempty"`
|
||||||
ContractorID *uint `json:"contractor_id,omitempty"`
|
ContractorID *uint `json:"contractor_id,omitempty"`
|
||||||
|
|||||||
@@ -404,6 +404,10 @@ func (h *AdminTaskHandler) toTaskResponse(task *models.Task) dto.TaskResponse {
|
|||||||
dueDate := task.DueDate.Format("2006-01-02")
|
dueDate := task.DueDate.Format("2006-01-02")
|
||||||
response.DueDate = &dueDate
|
response.DueDate = &dueDate
|
||||||
}
|
}
|
||||||
|
if task.NextDueDate != nil {
|
||||||
|
nextDueDate := task.NextDueDate.Format("2006-01-02")
|
||||||
|
response.NextDueDate = &nextDueDate
|
||||||
|
}
|
||||||
if task.EstimatedCost != nil {
|
if task.EstimatedCost != nil {
|
||||||
cost, _ := task.EstimatedCost.Float64()
|
cost, _ := task.EstimatedCost.Float64()
|
||||||
response.EstimatedCost = &cost
|
response.EstimatedCost = &cost
|
||||||
|
|||||||
Reference in New Issue
Block a user