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

View file

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

View file

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

View file

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