This commit is contained in:
Chneemann 2024-05-19 11:16:37 +02:00
parent d301df0580
commit 013b1f9931
9 changed files with 66 additions and 22 deletions

View file

@ -85,13 +85,14 @@
placeholder="{{ 'addTask.assignedFormField' | translate }}"
type="text"
[(ngModel)]="searchValue"
(input)="searchTask()"
(input)="searchTask(taskData.creator)"
autocomplete="off"
(click)="toggleAssignedMenu()"
/>
@if (isAssignedOpen) {
<app-assigned
[filteredUsers]="filteredUsers"
[taskCreator]="taskData.creator"
[searchInput]="searchInput"
(assignedChange)="receiveAssigned($event)"
>
@ -301,9 +302,11 @@
[img]="'close'"
[ngStyle]="{
display:
overlayData !== '' || overlayType === 'addTaskOverlay'
? 'none'
: 'block'
overlayType === 'addTaskOverlay' ||
overlayType === 'newTaskOverlay' ||
overlayType === ''
? 'block'
: 'none'
}"
(click)="removeTaskData()"
></app-form-btn>
@ -313,7 +316,9 @@
[value]="'addTask.delete' | translate"
[ngStyle]="{
display:
overlayData !== '' && overlayType !== 'addTaskOverlay'
overlayData !== '' &&
overlayType !== 'addTaskOverlay' &&
overlayType !== 'newTaskOverlay'
? 'block'
: 'none'
}"
@ -324,8 +329,15 @@
[img]="'check'"
[imgFilter]="'none'"
[value]="
(overlayData.toString() !== '' ? 'addTask.update' : 'addTask.create')
| translate
(overlayData.toString() !== '' &&
overlayData.toString() !== 'none' &&
overlayData.toString() !== 'todo' &&
overlayData.toString() !== 'inprogress' &&
overlayData.toString() !== 'awaitfeedback' &&
overlayData.toString() !== 'done'
? 'addTask.update'
: 'addTask.create'
) | translate
"
[disabled]="
title.invalid ||

View file

@ -24,8 +24,7 @@ section {
}
.edit-task-overlay-content {
max-height: calc(700px - 148px);
height: fit-content;
height: calc(700px - 148px);
padding: 0 6px;
overflow-y: auto;
}

View file

@ -7,7 +7,7 @@ import { FirebaseService } from '../../services/firebase.service';
import { Task } from '../../interfaces/task.interface';
import { OverlayService } from '../../services/overlay.service';
import { FormBtnComponent } from '../../shared/components/buttons/form-btn/form-btn.component';
import { ActivatedRoute } from '@angular/router';
import { ActivatedRoute, Route, Router } from '@angular/router';
import { TranslateModule } from '@ngx-translate/core';
@Component({
@ -42,7 +42,8 @@ export class AddTaskComponent implements OnInit {
constructor(
public firebaseService: FirebaseService,
private overlayService: OverlayService,
private route: ActivatedRoute
private route: ActivatedRoute,
private router: Router
) {}
taskData: Task = {
@ -65,7 +66,13 @@ export class AddTaskComponent implements OnInit {
}
loadEditTaskData() {
if (this.overlayData !== '') {
if (
this.overlayData !== '' &&
this.overlayData !== 'todo' &&
this.overlayData !== 'inprogress' &&
this.overlayData !== 'awaitfeedback' &&
this.overlayData !== 'done'
) {
const taskData = this.getTaskData(this.overlayData)[0];
Object.assign(this.taskData, taskData);
} else if (this.overlayType === 'newTaskOverlay') {
@ -127,10 +134,10 @@ export class AddTaskComponent implements OnInit {
}
}
searchTask(): void {
searchTask(taskCreator: string): void {
this.updateSearchInput();
this.filteredUsers = this.firebaseService
.getAllUserWithoutGuest()
.getAllUserWithoutGuestCurrentUserAndCreator(taskCreator)
.filter(
(user) =>
user.firstName.toLowerCase().includes(this.searchValue) ||
@ -213,10 +220,18 @@ export class AddTaskComponent implements OnInit {
onSubmit(ngForm: NgForm, overlayData: string) {
if (ngForm.submitted && ngForm.form.valid) {
if (overlayData === '') {
if (
overlayData === '' ||
overlayData === 'none' ||
overlayData === 'todo' ||
overlayData === 'inprogress' ||
overlayData === 'awaitfeedback' ||
overlayData === 'done'
) {
const { id, ...taskWithoutId } = this.taskData;
this.firebaseService.addNewTask(taskWithoutId);
this.removeTaskData();
this.closeOverlay();
} else {
if (this.getTaskData(overlayData).length > 0) {
const { id, ...taskWithoutId } = this.taskData;
@ -224,6 +239,7 @@ export class AddTaskComponent implements OnInit {
this.closeOverlay();
}
}
this.router.navigate(['/board']);
}
}

View file

@ -1,11 +1,11 @@
section {
position: absolute;
top: 70px;
top: 75px;
left: 0;
right: 0;
width: 100%;
height: auto;
max-height: 150px;
max-height: 125px;
padding-top: 12px;
border-radius: 0px 0px 20px 20px;
border: 1px solid var(--light-gray);

View file

@ -3,6 +3,7 @@ import { FirebaseService } from '../../../services/firebase.service';
import { CommonModule } from '@angular/common';
import { User } from '../../../interfaces/user.interface';
import { AddTaskComponent } from '../add-task.component';
import { SharedService } from '../../../services/shared.service';
@Component({
selector: 'app-assigned',
@ -14,11 +15,15 @@ import { AddTaskComponent } from '../add-task.component';
export class AssignedComponent {
@Input() filteredUsers: User[] = [];
@Input() searchInput: boolean = false;
@Input() taskCreator: string = '';
@Output() assignedChange = new EventEmitter<string[]>();
assigned: string[] = [];
constructor(public firebaseService: FirebaseService) {
constructor(
public firebaseService: FirebaseService,
private sharedService: SharedService
) {
this.loadTaskAssigedData();
}
@ -59,7 +64,9 @@ export class AssignedComponent {
if (this.searchInput) {
return this.filteredUsers;
} else {
return this.firebaseService.getAllUserWithoutGuest();
return this.firebaseService.getAllUserWithoutGuestCurrentUserAndCreator(
this.taskCreator
);
}
}
}

View file

@ -100,7 +100,7 @@
: ('contactDialogForm.phone' | translate)
}}"
[(ngModel)]="contactData.phone"
pattern="[\d\+\-\(\)\/]{7,15}"
pattern="[\d\+\-\(\)\/]{10,15}"
autocomplete="off"
required
/>

View file

@ -111,6 +111,16 @@ export class FirebaseService implements OnDestroy {
return this.getAllUsers().filter((user) => user.initials !== 'G');
}
getAllUserWithoutGuestCurrentUserAndCreator(taskCreator: string): User[] {
const currentUser = this.getCurrentUserId();
const usersWithoutGuestAndCurrent = this.getAllUsers().filter(
(user) => user.initials !== 'G' && user.id !== currentUser
);
return usersWithoutGuestAndCurrent.filter(
(user) => user.id !== taskCreator
);
}
getUserDataFromId(userId: string): User[] {
return this.getAllUsers().filter((user) => user.id === userId);
}

View file

@ -150,7 +150,7 @@
"lastName": "Nachname",
"email": "E-Mail",
"phone": "Telefon",
"you": "du"
"you": "(du)"
},
"help": {
"header": "Hilfe",

View file

@ -150,7 +150,7 @@
"lastName": "Last name",
"email": "Email",
"phone": "Phone",
"you": "you"
"you": "(you)"
},
"help": {
"header": "Help",