feat(board): edit task deadlines
This commit is contained in:
@@ -151,7 +151,7 @@ public class BoardModel : PageModel
|
||||
return await ReturnBoardContentAsync();
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostCreateTaskAsync(string title, string? category)
|
||||
public async Task<IActionResult> OnPostCreateTaskAsync(string title, string? category, DateTime? dueAt)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(title))
|
||||
return BadRequest("Title is required.");
|
||||
@@ -161,6 +161,7 @@ public class BoardModel : PageModel
|
||||
Title = title.Trim(),
|
||||
Category = category,
|
||||
Status = WorkTaskStatus.Pending,
|
||||
DueAt = TaskDeadline.FromLocalInput(dueAt, TimeZoneInfo.Local),
|
||||
};
|
||||
await _taskRepo.CreateAsync(task);
|
||||
|
||||
@@ -176,7 +177,7 @@ public class BoardModel : PageModel
|
||||
}
|
||||
|
||||
// Update task fields (inline edit)
|
||||
public async Task<IActionResult> OnPutUpdateTaskAsync(int id, string? title, string? description, string? category, int? estimatedMinutes)
|
||||
public async Task<IActionResult> OnPutUpdateTaskAsync(int id, string? title, string? description, string? category, int? estimatedMinutes, DateTime? dueAt, bool clearDueAt)
|
||||
{
|
||||
var task = await _taskRepo.GetByIdAsync(id);
|
||||
if (task is null) return NotFound();
|
||||
@@ -185,6 +186,8 @@ public class BoardModel : PageModel
|
||||
if (description is not null) task.Description = description;
|
||||
if (category is not null) task.Category = category;
|
||||
if (estimatedMinutes.HasValue) task.EstimatedMinutes = estimatedMinutes;
|
||||
if (clearDueAt) task.DueAt = null;
|
||||
else if (dueAt.HasValue) task.DueAt = TaskDeadline.FromLocalInput(dueAt, TimeZoneInfo.Local);
|
||||
|
||||
await _taskRepo.UpdateAsync(task);
|
||||
return Partial("Partials/_TaskDetail", task);
|
||||
|
||||
Reference in New Issue
Block a user