feat: integrate ConfirmDialogComponent into TaskOverlayComponent to confirm task deletion
This commit is contained in:
parent
7dec1bc6f6
commit
aae115a82d
5 changed files with 24 additions and 6 deletions
|
|
@ -31,9 +31,7 @@ export class ContactDetailComponent {
|
||||||
isLoading: boolean = false;
|
isLoading: boolean = false;
|
||||||
selectedUser: User | null = null;
|
selectedUser: User | null = null;
|
||||||
isMobileNavbarOpen: boolean = false;
|
isMobileNavbarOpen: boolean = false;
|
||||||
|
|
||||||
showConfirmDialog = false;
|
showConfirmDialog = false;
|
||||||
userToDeleteId: string | null = null;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private overlayService: OverlayService,
|
private overlayService: OverlayService,
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@
|
||||||
</div>
|
</div>
|
||||||
@if(task.creator === currentUserId) {
|
@if(task.creator === currentUserId) {
|
||||||
<div class="btns">
|
<div class="btns">
|
||||||
<div class="btn btn-delete" (click)="deleteTask(overlayData)">
|
<div class="btn btn-delete" (click)="toggleConfirmDialog()">
|
||||||
<img src="./../../../../../assets/img/contact/delete.svg" alt="" />
|
<img src="./../../../../../assets/img/contact/delete.svg" alt="" />
|
||||||
<p>{{ "addTask.delete" | translate }}</p>
|
<p>{{ "addTask.delete" | translate }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -145,3 +145,9 @@
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</section>
|
</section>
|
||||||
|
<app-confirm-dialog
|
||||||
|
*ngIf="showConfirmDialog"
|
||||||
|
[message]="'confirmDialogComponent.deleteTask' | translate"
|
||||||
|
(onConfirm)="deleteTask(overlayData)"
|
||||||
|
(onCancel)="toggleConfirmDialog()"
|
||||||
|
></app-confirm-dialog>
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,18 @@ import { map } from 'rxjs';
|
||||||
import { ApiService } from '../../../../services/api.service';
|
import { ApiService } from '../../../../services/api.service';
|
||||||
import { UpdateNotifierService } from '../../../../services/update-notifier.service';
|
import { UpdateNotifierService } from '../../../../services/update-notifier.service';
|
||||||
import { ToastNotificationService } from '../../../../services/toast-notification.servic';
|
import { ToastNotificationService } from '../../../../services/toast-notification.servic';
|
||||||
|
import { ConfirmDialogComponent } from '../../confirm-dialog/confirm-dialog.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-task-overlay',
|
selector: 'app-task-overlay',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [BtnCloseComponent, CommonModule, BtnBackComponent, TranslateModule],
|
imports: [
|
||||||
|
BtnCloseComponent,
|
||||||
|
CommonModule,
|
||||||
|
BtnBackComponent,
|
||||||
|
TranslateModule,
|
||||||
|
ConfirmDialogComponent,
|
||||||
|
],
|
||||||
templateUrl: './task-overlay.component.html',
|
templateUrl: './task-overlay.component.html',
|
||||||
styleUrl: './task-overlay.component.scss',
|
styleUrl: './task-overlay.component.scss',
|
||||||
})
|
})
|
||||||
|
|
@ -27,6 +34,7 @@ export class TaskOverlayComponent implements OnInit {
|
||||||
task: Task | null = null;
|
task: Task | null = null;
|
||||||
overlayMobile: boolean = false;
|
overlayMobile: boolean = false;
|
||||||
currentUserId: string = '';
|
currentUserId: string = '';
|
||||||
|
showConfirmDialog = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private overlayService: OverlayService,
|
private overlayService: OverlayService,
|
||||||
|
|
@ -159,4 +167,8 @@ export class TaskOverlayComponent implements OnInit {
|
||||||
capitalizeFirstLetter(data: string) {
|
capitalizeFirstLetter(data: string) {
|
||||||
return data.charAt(0).toUpperCase() + data.slice(1);
|
return data.charAt(0).toUpperCase() + data.slice(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toggleConfirmDialog() {
|
||||||
|
this.showConfirmDialog = !this.showConfirmDialog;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,8 @@
|
||||||
"phone": "Telefon"
|
"phone": "Telefon"
|
||||||
},
|
},
|
||||||
"confirmDialogComponent": {
|
"confirmDialogComponent": {
|
||||||
"deleteContact": "Möchten Sie den Kontakt wirklich löschen?",
|
"deleteContact": "Willst du den Kontakt wirklich löschen?",
|
||||||
|
"deleteTask": "Willst du den Task wirklich löschen?",
|
||||||
"btnCancel": "Abbrechen",
|
"btnCancel": "Abbrechen",
|
||||||
"btnConfirm": "Bestätigen"
|
"btnConfirm": "Bestätigen"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,7 @@
|
||||||
},
|
},
|
||||||
"confirmDialogComponent": {
|
"confirmDialogComponent": {
|
||||||
"deleteContact": "Do you really want to delete the contact?",
|
"deleteContact": "Do you really want to delete the contact?",
|
||||||
|
"deleteTask": "Do you really want to delete the task?",
|
||||||
"btnCancel": "Cancel",
|
"btnCancel": "Cancel",
|
||||||
"btnConfirm": "Confirm"
|
"btnConfirm": "Confirm"
|
||||||
},
|
},
|
||||||
|
|
@ -158,7 +159,7 @@
|
||||||
"contacts": {
|
"contacts": {
|
||||||
"headline": "Contacts",
|
"headline": "Contacts",
|
||||||
"headlineDescription": "Better with a team",
|
"headlineDescription": "Better with a team",
|
||||||
"notice": "Notice: Click in the circle to change the colour.",
|
"notice": "Notice: Click in the circle to change the color.",
|
||||||
"btnNew": "Add new contact",
|
"btnNew": "Add new contact",
|
||||||
"btnEdit0": "edit",
|
"btnEdit0": "edit",
|
||||||
"btnEdit1": "Edit",
|
"btnEdit1": "Edit",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue