Add next_due_date editing to admin task form
- Add NextDueDate field to UpdateTaskRequest DTO - Add handler logic to process next_due_date updates - Add next_due_date input field to task edit form - Update TypeScript models with next_due_date field 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -100,6 +100,7 @@ export default function EditTaskPage() {
|
||||
status_id: task.status_id,
|
||||
frequency_id: task.frequency_id,
|
||||
due_date: task.due_date,
|
||||
next_due_date: task.next_due_date,
|
||||
estimated_cost: task.estimated_cost,
|
||||
actual_cost: task.actual_cost,
|
||||
contractor_id: task.contractor_id,
|
||||
@@ -376,7 +377,7 @@ export default function EditTaskPage() {
|
||||
<CardDescription>Due date and cost information</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
<div className="grid grid-cols-3 gap-4">
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="due_date">Due Date</Label>
|
||||
<Input
|
||||
@@ -386,6 +387,17 @@ export default function EditTaskPage() {
|
||||
onChange={(e) => updateField('due_date', e.target.value || undefined)}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="next_due_date">Next Due Date</Label>
|
||||
<Input
|
||||
id="next_due_date"
|
||||
type="date"
|
||||
value={formData.next_due_date || ''}
|
||||
onChange={(e) => updateField('next_due_date', e.target.value || undefined)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="estimated_cost">Estimated Cost ($)</Label>
|
||||
<Input
|
||||
|
||||
@@ -242,6 +242,7 @@ export interface UpdateTaskRequest {
|
||||
status_id?: number;
|
||||
frequency_id?: number;
|
||||
due_date?: string;
|
||||
next_due_date?: string;
|
||||
estimated_cost?: number;
|
||||
actual_cost?: number;
|
||||
contractor_id?: number;
|
||||
|
||||
@@ -135,6 +135,7 @@ type UpdateTaskRequest struct {
|
||||
StatusID *uint `json:"status_id"`
|
||||
FrequencyID *uint `json:"frequency_id"`
|
||||
DueDate *string `json:"due_date"`
|
||||
NextDueDate *string `json:"next_due_date"`
|
||||
EstimatedCost *float64 `json:"estimated_cost"`
|
||||
ActualCost *float64 `json:"actual_cost"`
|
||||
ContractorID *uint `json:"contractor_id"`
|
||||
|
||||
@@ -221,6 +221,13 @@ func (h *AdminTaskHandler) Update(c *gin.Context) {
|
||||
updates["due_date"] = dueDate
|
||||
}
|
||||
}
|
||||
if req.NextDueDate != nil {
|
||||
if *req.NextDueDate == "" {
|
||||
updates["next_due_date"] = nil
|
||||
} else if nextDueDate, err := time.Parse("2006-01-02", *req.NextDueDate); err == nil {
|
||||
updates["next_due_date"] = nextDueDate
|
||||
}
|
||||
}
|
||||
if req.EstimatedCost != nil {
|
||||
updates["estimated_cost"] = decimal.NewFromFloat(*req.EstimatedCost)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user