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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -111,6 +111,16 @@ export class FirebaseService implements OnDestroy {
return this.getAllUsers().filter((user) => user.initials !== 'G'); 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[] { getUserDataFromId(userId: string): User[] {
return this.getAllUsers().filter((user) => user.id === userId); return this.getAllUsers().filter((user) => user.id === userId);
} }

View file

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

View file

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