add button to delete task
This commit is contained in:
@@ -73,6 +73,16 @@ export function TaskSettingsModal(taskViewModel: TaskViewModel) {
|
||||
<input type="time" bind:value={taskViewModel.time}></input>
|
||||
</div>
|
||||
</label>
|
||||
|
||||
<hr></hr>
|
||||
|
||||
<div class="width-input">
|
||||
{DangerousActionButton(
|
||||
translations.chatPage.task.deleteTaskButton,
|
||||
"delete_forever",
|
||||
taskViewModel.deleteTask
|
||||
)}
|
||||
</div>
|
||||
</main>
|
||||
<div class="flex-row width-100">
|
||||
<button class="flex" on:click={taskViewModel.close}>
|
||||
|
||||
@@ -170,6 +170,8 @@ const englishTranslations = {
|
||||
|
||||
taskDateLabel: "Date",
|
||||
taskTimeLabel: "Time",
|
||||
|
||||
deleteTaskButton: "Delete task",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -104,6 +104,10 @@ export default class BoardViewModel {
|
||||
this.taskViewModels.set(taskFileContent.fileId, taskViewModel);
|
||||
};
|
||||
|
||||
removeTaskFromList = (taskId: string): void => {
|
||||
this.taskViewModels.remove(taskId);
|
||||
}
|
||||
|
||||
select = (): void => {
|
||||
this.taskPageViewModel.selectBoard(this);
|
||||
};
|
||||
|
||||
@@ -43,13 +43,13 @@ export default class TaskViewModel {
|
||||
this.save();
|
||||
};
|
||||
|
||||
// storage
|
||||
// settings
|
||||
save = (): void => {
|
||||
const newTaskFileContent: TaskFileContent =
|
||||
BoardModel.createTaskFileContent(
|
||||
this.task.fileId,
|
||||
this.name.value,
|
||||
this.boardViewModel.boardInfo.fileId
|
||||
this.task.boardId
|
||||
);
|
||||
|
||||
newTaskFileContent.description = this.description.value;
|
||||
@@ -63,6 +63,12 @@ export default class TaskViewModel {
|
||||
this.boardViewModel.showTaskInList(newTaskFileContent);
|
||||
};
|
||||
|
||||
deleteTask = (): void => {
|
||||
this.close();
|
||||
this.boardModel.deleteTask(this.task.boardId, this.task.fileId);
|
||||
this.boardViewModel.removeTaskFromList(this.task.fileId);
|
||||
};
|
||||
|
||||
// load
|
||||
loadAllData = (): void => {
|
||||
this.name.value = this.task.name;
|
||||
|
||||
Reference in New Issue
Block a user