Skip to content

Commit

Permalink
silme işlemi için confirm material yazıldı
Browse files Browse the repository at this point in the history
  • Loading branch information
NisanurBulut committed Aug 13, 2020
1 parent 55acf3a commit 8af6818
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<any>;
displayedColumns: string[] = [
'fullName', 'email', 'mobile', 'city', 'gender', 'isPermanent',
Expand All @@ -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 = '';
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<mat-icon id="close-icon" (click)="onClose()">close</mat-icon>
<span class="content-span full-width">{{ data.message }}</span>
</div>
<button id="yes-button" mat-flat-button [mat-dialog-close]="false">
<button id="yes-button" mat-flat-button [mat-dialog-close]="true">
Evet
</button>
<button id="no-button" mat-flat-button [mat-dialog-close]="true">
<button id="no-button" mat-flat-button [mat-dialog-close]="false">
Hayır
</button>
</div>
3 changes: 2 additions & 1 deletion PratikForumClient/src/app/shared/dialog.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
});
}
Expand Down

0 comments on commit 8af6818

Please sign in to comment.