diff options
Diffstat (limited to 'src/app/shared/confirmModal/confirm.component.ts')
-rw-r--r-- | src/app/shared/confirmModal/confirm.component.ts | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/app/shared/confirmModal/confirm.component.ts b/src/app/shared/confirmModal/confirm.component.ts index 9da7991..5fbf4b3 100644 --- a/src/app/shared/confirmModal/confirm.component.ts +++ b/src/app/shared/confirmModal/confirm.component.ts @@ -28,6 +28,8 @@ import { DialogComponent, DialogService } from 'ng2-bootstrap-modal'; export interface ConfirmModel { title: string; message: string; + cancelButtonText: string; + confirmButtonText: string; } @Component({ @@ -36,15 +38,15 @@ export interface ConfirmModel { <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> - <button type="button" class="close" (click)="close()">×</button> - <h6 class="modal-title">{{title || 'Save all changes for current action to APPC database.'}}</h6> + <h4 class="modal-title">{{title}}</h4> + <button type="button" class="close" (click)="cancel()">×</button> </div> <div class="modal-body"> - <p>{{message || 'Do you want to save the changes?'}}</p> + <p>{{message}}</p> </div> <div class="modal-footer"> - <button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent" (click)="onCancel()">No</button> - <button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" (click)="onConfirm()">Yes</button> + <button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent" (click)="confirm()">{{confirmButtonText}}</button> + <button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" (click)="cancel()">{{cancelButtonText}}</button> </div> </div> </div>` @@ -52,20 +54,22 @@ export interface ConfirmModel { export class ConfirmComponent extends DialogComponent<ConfirmModel, boolean> implements ConfirmModel { title: string; message: string; + cancelButtonText: string; + confirmButtonText: string; constructor(dialogService: DialogService) { super(dialogService); } - onConfirm() { - // we set dialog result as true on click on Yes button, + confirm() { + // we set dialog result as true on click on confirm button, // then we can get dialog result from caller code this.result = true; this.close(); } - onCancel() { - // we set dialog result as false on click on Yes button, + cancel() { + // we set dialog result as false on click on cancel/close button, // then we can get dialog result from caller code this.result = false; this.close(); |