From 8af68188432d213161d55d9b654b34acdf48c305 Mon Sep 17 00:00:00 2001 From: NisanurBulut Date: Thu, 13 Aug 2020 15:03:32 +0300 Subject: [PATCH] =?UTF-8?q?silme=20i=C5=9Flemi=20i=C3=A7in=20confirm=20mat?= =?UTF-8?q?erial=20yaz=C4=B1ld=C4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../contact-list/contact-list.component.ts | 19 +++++++------------ .../material-confirm-dialog.component.html | 4 ++-- .../src/app/shared/dialog.service.ts | 3 ++- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/PratikForumClient/src/app/contacts/contact-list/contact-list.component.ts b/PratikForumClient/src/app/contacts/contact-list/contact-list.component.ts index 244c55c..a9de5b4 100644 --- a/PratikForumClient/src/app/contacts/contact-list/contact-list.component.ts +++ b/PratikForumClient/src/app/contacts/contact-list/contact-list.component.ts @@ -12,9 +12,7 @@ import { DialogService } from 'src/app/shared/dialog.service'; }) export class ContactListComponent implements OnInit { - constructor(private cs: ContactService, - private mDialog: MatDialog, - private ds: DialogService) { } + constructor(private cs: ContactService, private mDialog: MatDialog, private ds: DialogService) { } listData: MatTableDataSource; displayedColumns: string[] = [ 'fullName', 'email', 'mobile', 'city', 'gender', 'isPermanent', @@ -39,7 +37,6 @@ export class ContactListComponent implements OnInit { // html içeriğin popup içerisine yerleşmesi için EntryComponent olarak ilgili modulde tanımlanmalı // html'in ekranda düzgünce görünmesi için config yapılandırması olmalı this.mDialog.open(ContactComponent, this.mConfig); - } onSearchClear(): void { this.searchKey = ''; @@ -54,14 +51,12 @@ export class ContactListComponent implements OnInit { this.mDialog.open(ContactComponent, this.mConfig); } onDelete(id: number) { - // if (confirm('Silmek istediğinizden emin misiniz ?')) { - // this.cs.deleteContact(id); - // } - // this.onViewContactList(); - this.ds.openConfirmDialog('Silmek istediğinizden emin misiniz ?') - .afterClosed().suscribe(res => { - console.log(res); - }); + this.ds.openConfirmDialog('Silmek istediğinizden emin misiniz ?').afterClosed().subscribe(res => { + console.log(res); + if (res === true) { + this.cs.deleteContact(id); + } + }); } onViewContactList() { this.cs.getContacts().subscribe( diff --git a/PratikForumClient/src/app/contacts/material-confirm-dialog/material-confirm-dialog.component.html b/PratikForumClient/src/app/contacts/material-confirm-dialog/material-confirm-dialog.component.html index 990b8ec..e719ad3 100644 --- a/PratikForumClient/src/app/contacts/material-confirm-dialog/material-confirm-dialog.component.html +++ b/PratikForumClient/src/app/contacts/material-confirm-dialog/material-confirm-dialog.component.html @@ -3,10 +3,10 @@ close {{ data.message }} - - diff --git a/PratikForumClient/src/app/shared/dialog.service.ts b/PratikForumClient/src/app/shared/dialog.service.ts index 01874b1..18f662d 100644 --- a/PratikForumClient/src/app/shared/dialog.service.ts +++ b/PratikForumClient/src/app/shared/dialog.service.ts @@ -8,10 +8,11 @@ export class DialogService { constructor(private matdialog: MatDialog) { } openConfirmDialog(msg) { - this.matdialog.open(MaterialConfirmDialogComponent, { + return this.matdialog.open(MaterialConfirmDialogComponent, { disableClose: true, width: '390px', panelClass: 'confirm-dialog-container', + position: { top: '10px' }, data: { message: msg } }); }