From 4d73c7c60809dc52c6894824dead08e66eae2941 Mon Sep 17 00:00:00 2001 From: Yubing325 <35515298+Yubing325@users.noreply.github.com> Date: Fri, 12 Jun 2020 14:33:50 -0500 Subject: [PATCH] change & delete for command modal --- .../command-modal/command-modal.component.ts | 1 - .../directives/command-modal.directive.ts | 9 ++++++- .../form-group-command-modal.component.html | 2 +- .../form-group-command-modal.component.ts | 1 - .../command-modal-demo.module.ts | 5 ++-- .../command-modal-demo.component.html | 18 ++++++++----- .../command-modal-demo.component.ts | 27 +++++++++++++------ .../services/IChangeMerchantNameCommand.ts | 7 ++--- src/app/data/services/merchant.service.ts | 15 ++++++----- .../form-group-modal-demo.module.ts | 5 ++-- .../form-group-modal-demo.component.html | 22 +++++++++++---- .../form-group-modal-demo.component.ts | 10 +++++-- .../pagination-demo/pagination-demo.module.ts | 4 +-- 13 files changed, 85 insertions(+), 41 deletions(-) diff --git a/projects/poweredsoft/ngx-bootstrap/src/lib/command-modal/command-modal/command-modal.component.ts b/projects/poweredsoft/ngx-bootstrap/src/lib/command-modal/command-modal/command-modal.component.ts index 4ef50b3..84c892e 100644 --- a/projects/poweredsoft/ngx-bootstrap/src/lib/command-modal/command-modal/command-modal.component.ts +++ b/projects/poweredsoft/ngx-bootstrap/src/lib/command-modal/command-modal/command-modal.component.ts @@ -42,7 +42,6 @@ export class CommandModalComponent implements OnInit, OnDestroy { } attemptSave() { - debugger; this.loading = true; this.dataSource.executeCommandByName(this.command, this.commandModel) .pipe( diff --git a/projects/poweredsoft/ngx-bootstrap/src/lib/command-modal/directives/command-modal.directive.ts b/projects/poweredsoft/ngx-bootstrap/src/lib/command-modal/directives/command-modal.directive.ts index 78149f5..4fccfe5 100644 --- a/projects/poweredsoft/ngx-bootstrap/src/lib/command-modal/directives/command-modal.directive.ts +++ b/projects/poweredsoft/ngx-bootstrap/src/lib/command-modal/directives/command-modal.directive.ts @@ -20,13 +20,14 @@ export class CommandModalDirective { @Input() commandText: string; @Input() cancelText: string; @Input() animated: boolean; + @Input() isConfirmModal: boolean; @HostListener('click') wasClicked() { this.dataSource.resolveCommandModelByName({ command: this.command, model: this.model - }).subscribe(commandModel => { + }).subscribe(commandModel => { const initialState = { dataSource: this.dataSource, command: this.command, @@ -37,6 +38,12 @@ export class CommandModalDirective { commandText: this.commandText || 'OK', cancelText: this.cancelText || 'Cancel' }; + if(this.isConfirmModal){ + this.modalService.show(CommandModalComponent, { + animated: this.animated === undefined ? true : this.animated, + initialState + }); + } this.modalService.show(CommandModalComponent, { animated: this.animated === undefined ? true : this.animated, initialState diff --git a/projects/poweredsoft/ngx-bootstrap/src/lib/form-group-command-modal/form-group-command-modal/form-group-command-modal.component.html b/projects/poweredsoft/ngx-bootstrap/src/lib/form-group-command-modal/form-group-command-modal/form-group-command-modal.component.html index a509523..4642185 100644 --- a/projects/poweredsoft/ngx-bootstrap/src/lib/form-group-command-modal/form-group-command-modal/form-group-command-modal.component.html +++ b/projects/poweredsoft/ngx-bootstrap/src/lib/form-group-command-modal/form-group-command-modal/form-group-command-modal.component.html @@ -21,7 +21,7 @@