| /******************************************************************************** |
| * Copyright (c) 2020 Contributors to the Eclipse Foundation |
| * |
| * See the NOTICE file(s) distributed with this work for additional |
| * information regarding copyright ownership. |
| * |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License v. 2.0 which is available at |
| * http://www.eclipse.org/legal/epl-2.0. |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| ********************************************************************************/ |
| import { InternalPersonDetailsSandBox } from '@app/pages/persons/internal-person/internal-person-details/internal-person-details.sandbox'; |
| import { Component, OnInit } from '@angular/core'; |
| import { InternalPerson } from '@app/shared/models'; |
| import { SalutationsSandbox } from '@app/pages/admin/salutations/salutations.sandbox'; |
| |
| @Component({ |
| selector: 'app-internal-person-details', |
| templateUrl: './internal-person-details.component.html', |
| styleUrls: ['./internal-person-details.component.scss'] |
| }) |
| export class InternalPersonDetailsComponent implements OnInit { |
| |
| constructor( |
| public internalPersonSandBox: InternalPersonDetailsSandBox, |
| private salutationsSandbox: SalutationsSandbox, |
| ) { } |
| |
| ngOnInit() { |
| this.salutationsSandbox.loadSalutations(); |
| } |
| |
| public save() { |
| this.internalPersonSandBox.updatingState(); |
| if (this.internalPersonSandBox.currentFormState.isValid) { |
| const newInternalPerson = new InternalPerson(this.internalPersonSandBox.currentFormState.value); |
| this.internalPersonSandBox.persistInternalPerson(newInternalPerson); |
| } else { |
| this.internalPersonSandBox.utilService.displayNotification( |
| 'MandatoryFieldsNotFilled', |
| 'error' |
| ); |
| } |
| } |
| } |