| SANDHYA.JS | 9914458 | 2022-04-27 17:22:35 +0530 | [diff] [blame] | 1 | /* |
| 2 | Copyright 2020 TATA ELXSI |
| 3 | |
| 4 | Licensed under the Apache License, Version 2.0 (the 'License'); |
| 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | |
| 16 | Author: SANDHYA JS (sandhya.j@tataelxsi.co.in) |
| 17 | */ |
| 18 | /** |
| 19 | * @file WarningConfiguration Model |
| 20 | */ |
| 21 | import { Component, Injector, Input } from '@angular/core'; |
| 22 | import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; |
| 23 | /** |
| 24 | * Creating component |
| 25 | * @Component takes WarningComponent.html as template url |
| 26 | */ |
| 27 | @Component({ |
| 28 | selector: 'app-warning', |
| 29 | templateUrl: './WarningComponent.html', |
| 30 | styleUrls: ['./WarningComponent.scss'] |
| 31 | }) |
| 32 | /** Exporting a class @exports WarningComponent */ |
| 33 | export class WarningComponent { |
| 34 | /** To inject services @public */ |
| 35 | public injector: Injector; |
| 36 | |
| 37 | /** Instance for active modal service @public */ |
| 38 | public activeModal: NgbActiveModal; |
| 39 | |
| 40 | /** Check the loading results @public */ |
| 41 | public isLoad: Boolean = false; |
| 42 | |
| 43 | /** Contains title data @public */ |
| 44 | @Input() |
| 45 | public heading: string; |
| 46 | |
| 47 | /** Contains body data @public */ |
| 48 | @Input() |
| 49 | public confirmationMessage: string; |
| 50 | |
| 51 | /** Contains footer data @public */ |
| 52 | @Input() |
| 53 | public submitMessage: string; |
| 54 | |
| 55 | /** Give the message for the loading @public */ |
| 56 | public message: string = 'PLEASEWAIT'; |
| 57 | |
| 58 | constructor(injector: Injector) { |
| 59 | this.injector = injector; |
| 60 | this.activeModal = this.injector.get(NgbActiveModal); |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * Lifecyle Hooks the trigger before component is instantiate |
| 65 | */ |
| 66 | public ngOnInit(): void { |
| 67 | //empty |
| 68 | } |
| 69 | |
| 70 | /** Close the modal @public */ |
| 71 | public closeModal(getMessage: string): void { |
| 72 | this.activeModal.close({ message: getMessage }); |
| 73 | } |
| 74 | } |