import { Component, OnInit } from '@angular/core'; import * as moment from 'moment'; import { VacationRuleServiceService } from '../service/vacation-rule-service.service'; import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; import { CommonService } from 'src/app/hmg-common/services/common/common.service'; import { LoginRequest } from 'src/app/hmg-common/services/authentication/models/login.request'; @Component({ selector: 'app-create-vacation-rule', templateUrl: './create-vacation-rule.component.html', styleUrls: ['./create-vacation-rule.component.scss'], }) export class CreateVacationRuleComponent implements OnInit { P_RESPOND_ATTRIBUTES_TBL: any; P_ITEM_TYPE_TITLE: any = ""; Notification_Title: any = ""; isDeliver: boolean = false; showForType_Y: boolean = false; Resp2_val: any; Sdate: any; // startTime: any; //endTime: any; Edate: any; msgVal: any; selEmployeeName: any; selEmployeeID: any; employeeSel: any; replacmentEmployeeInfo: any; itemType: any; notificationType: any; RespondAttributeList: any; // vacationRuleRequest: createVacationRequest; REASSIGN_val: any; schemaNotific: any; notifTypeSel: any; // pAction: any; isUpdate: boolean = false; updateData: any; forwordAtt: any = ""; SelAction: string = ""; hideForwordEmployee: any; exampleJsonObject: any; constructor(public vacationRuleService: VacationRuleServiceService, public ts: TranslatorService, public cs: CommonService) { this.Sdate = moment().format('YYYY-MM-DDTHH:mm:ssZ'); } ngOnInit() { this.getNotificationReassign(); } getNotificationReassign() { let request: LoginRequest = new LoginRequest(); this.vacationRuleService.notificationReassign(request, () => { this.getNotificationReassign(); }, this.ts.trPK('general', 'retry')).subscribe((result) => { console.log(result); if (this.cs.validResponse(result)) { console.log(result.GetNotificationReassignModeList); this.REASSIGN_val = result.GetNotificationReassignModeList;//[0].RADIO_BUTTON_ACTION; this.notifTypeSel = this.REASSIGN_val[0].RADIO_BUTTON_ACTION; this.reverseAction(); } else { this.cs.presentAlert(result.ErrorEndUserMessage); } }); } reverseAction() { if (this.updateData) { switch (this.SelAction) { case 'FORWARD': { this.notifTypeSel = "DELEGATE"; break; } case 'RESPOND': { this.notifTypeSel = "RESPOND"; break; } case 'CLOSE': { this.notifTypeSel = "CLOSE"; break; } case 'NOOP': { this.notifTypeSel = "DELIVER"; break; } case 'TRANSFER': { this.notifTypeSel = "TRANSFER"; break; } default: { this.notifTypeSel = ""; break; } } } } respondAttributes() { } }