add confirm modal directive
This commit is contained in:
@@ -42,9 +42,9 @@
|
||||
<ng-container psDataGridCol="commands">
|
||||
<ng-container *psDataGridColHeader>Actions</ng-container>
|
||||
<ng-container *psDataGridCell="let model">
|
||||
<!-- <button class="btn-warning btn" psbxCommandModal [commandTitle]="'Change ' + model.name + ' name'" commandText="Update"
|
||||
[dataSource]="merchantDataSource" command="changeMerchant" [model]="model" [template]="changeName">Change</button> -->
|
||||
<button class="btn-danger btn" (click)="removeMerchant(model.id)">Remove</button>
|
||||
<button class="btn-danger btn" psbxConfirmModal [commandTitle]="'Are you sure you wnat to remove ' + model.name + '?'" commandText="Remove"
|
||||
[dataSource]="merchantDataSource" command="removeMerchant" [model]="model" >Remove</button>
|
||||
<!-- <button class="btn-danger btn" (click)="removeMerchant(model.id)">Remove</button> -->
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
|
||||
|
||||
@@ -20,29 +20,29 @@ export class PaginationDemoComponent implements OnInit {
|
||||
|
||||
pages:any;
|
||||
|
||||
removeMerchant(id:string) {
|
||||
this.confirmModalService.confirm({
|
||||
message: 'Do you want to delete this merchant?',
|
||||
yesText: 'yes delete this merchant',
|
||||
yesClass: 'danger',
|
||||
noText: 'no please dont',
|
||||
noClass: 'light'
|
||||
}).subscribe(result => {
|
||||
if(result){
|
||||
this.merchantDataSource.executeCommandByName('removeMerchant', {
|
||||
id: id
|
||||
}).subscribe(
|
||||
res => {
|
||||
this.merchantDataSource.refresh();
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
alert('failed');
|
||||
}
|
||||
);
|
||||
}
|
||||
})
|
||||
}
|
||||
// removeMerchant(id:string) {
|
||||
// this.confirmModalService.confirm({
|
||||
// message: 'Do you want to delete this merchant?',
|
||||
// yesText: 'yes delete this merchant',
|
||||
// yesClass: 'danger',
|
||||
// noText: 'no please dont',
|
||||
// noClass: 'light'
|
||||
// }).subscribe(result => {
|
||||
// if(result){
|
||||
// this.merchantDataSource.executeCommandByName('removeMerchant', {
|
||||
// id: id
|
||||
// }).subscribe(
|
||||
// res => {
|
||||
// this.merchantDataSource.refresh();
|
||||
// },
|
||||
// err => {
|
||||
// console.log(err);
|
||||
// alert('failed');
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
||||
|
||||
createDataSource(): IDataSource<IMerchant> {
|
||||
|
||||
Reference in New Issue
Block a user