Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public update(): void {
- if (this.isCompany) {
- let promise = this.companyService.update(new CompanyUpdateModel(this.tokenDataService.getTokenData()['CLIENT'], this.getformCompany(this.htmlNames['COMPANY_EDIT']).value['name']));
- promise.then(data => {
- this.noticeService.openNotice(1.5, data.getContentNoKey(), f => {
- window.location.reload();
- });
- });
- promise.catch(e => {
- console.log(e);
- this.noticeService.openNotice(2.5, environment.ERROR.GENERAL);
- });
- } else {
- let forename: string = this.getformEmployee(this.htmlNames['EMPLOYEE_EDIT']).value['forename'];
- let surname: string = this.getformEmployee(this.htmlNames['EMPLOYEE_EDIT']).value['surname'];
- let document: number = Number(this.getformEmployee(this.htmlNames['EMPLOYEE_EDIT']).value['document']);
- if (document == 0){
- document = -1;
- }else{
- if(!this.validationService.validateDocument(document)){
- console.log(this.validationService.validateDocument(document))
- this.noticeService.openNotice(1.5 , environment.ERROR.EMPLOYEE.DOCUMENT_INVALID)
- return;
- }
- }
- let promise = this.employeeService.update(new EmployeeUpdateModel(this.tokenDataService.getTokenData()['CLIENT'], forename, surname, document));
- promise.then(data => {
- this.noticeService.openNotice(1.5, data.getContentNoKey(), f => {
- window.location.reload();
- });
- });
- promise.catch(e => {
- console.log(e);
- this.noticeService.openNotice(2.5, environment.ERROR.GENERAL);
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement