This commit is contained in:
Chneemann 2024-04-09 10:42:18 +02:00
parent 27e5e71639
commit 90703611a4
4 changed files with 12 additions and 9 deletions

View file

@ -192,8 +192,8 @@
<option value="" disabled [selected]="!taskData.category">
Select task category
</option>
<option value="1">User Story</option>
<option value="2">Technical Task</option>
<option value="User Story">User Story</option>
<option value="Technical Task">Technical Task</option>
</select>
<div class="error-msg">
@if (!category.valid && category.touched) {

View file

@ -29,16 +29,15 @@ export class AddTaskComponent {
constructor(public firebaseService: FirebaseService) {}
taskData: Task = {
id: '',
title: '',
description: '',
category: '',
status: '',
status: 'todo',
priority: 'medium',
subtasksTitle: [],
subtasksDone: [],
assigned: [],
date: '',
date: this.currentDate,
};
receiveAssigned(assigned: string[]) {
@ -135,11 +134,13 @@ export class AddTaskComponent {
this.taskData.category = '';
this.taskData.assigned = [];
this.taskData.subtasksTitle = [];
this.taskData.subtasksDone = [];
}
onSubmit(ngForm: NgForm) {
if (ngForm.submitted && ngForm.form.valid) {
this.firebaseService.addNewTask(this.taskData);
const { id, ...taskWithoutId } = this.taskData;
this.firebaseService.addNewTask(taskWithoutId);
this.removeTaskData();
}
}

View file

@ -1,5 +1,5 @@
export interface Task {
id: string;
id?: string;
title: string;
description: string;
category: string;

View file

@ -8,9 +8,11 @@ export class DragDropService {
constructor() {}
startDragging(event: DragEvent, id: string) {
startDragging(event: DragEvent, id: string | undefined) {
if (id !== undefined) {
event.dataTransfer?.setData('text/plain', id);
}
}
allowDrop(event: DragEvent) {
event.preventDefault();