import { CommonService } from 'src/app/hmg-common/services/common/common.service'; import { VacationRuleServiceService } from './../service/vacation-rule-service.service'; import { VacationRuleRequest } from './../model/VacationRuleRequest'; import { Component, OnInit } from '@angular/core'; import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; @Component({ selector: 'app-home', templateUrl: './home.component.html', styleUrls: ['./home.component.scss'], }) export class HomeComponent implements OnInit { userName: any; P_PAGE_NUM: number; P_PAGE_LIMIT: number; GetVacationRulesList: any = []; isUpdate: boolean = false; IsReachEnd: boolean = false; RespondAttributeList: any; constructor(public vacationRuleService: VacationRuleServiceService, public ts: TranslatorService, public cs: CommonService) { this.P_PAGE_NUM = 1; this.P_PAGE_LIMIT = 50; this.GetVacationRulesList = [ { "ACTION": "FORWARD", "ACTION_DISPLAY": "Forward", "BEGIN_DATE": "6/26/2019 2:50:14 PM", "END_DATE": "6/30/2019 2:50:22 PM", "FROM_ROW_NUM": 1, "FYI_FLAG": "Y", "ITEM_TYPE": "HRSSA", "ITEM_TYPE_DISPLAY_NAME": "HR", "MESSAGE": "TEst Rule", "NOTIFICATION_DISPLAY_NAME": "", "NOTIFICATION_NAME": "*", "NOTIFICATION_SUBJECT": "", "NO_OF_ROWS": 1, "REPLACEMENT_USER_NAME": "70915", "ROW_NUM": 1, "RULE_ID": 7770756, "RULE_NAME": "Delegate: Al Oulah, Mohammed", "RULE_STATUS": "Active", "RULE_TIP_MESSAGE": "", "TO_ROW_NUM": 1 }, { "ACTION": "FORWARD", "ACTION_DISPLAY": "Forward", "BEGIN_DATE": "6/26/2019 2:50:14 PM", "END_DATE": "6/30/2019 2:50:22 PM", "FROM_ROW_NUM": 1, "FYI_FLAG": "Y", "ITEM_TYPE": "HRSSA", "ITEM_TYPE_DISPLAY_NAME": "HR", "MESSAGE": "TEst Rule", "NOTIFICATION_DISPLAY_NAME": "", "NOTIFICATION_NAME": "*", "NOTIFICATION_SUBJECT": "", "NO_OF_ROWS": 1, "REPLACEMENT_USER_NAME": "70915", "ROW_NUM": 1, "RULE_ID": 7770756, "RULE_NAME": "Delegate: Al Oulah, Mohammed", "RULE_STATUS": "Active", "RULE_TIP_MESSAGE": "", "TO_ROW_NUM": 1 }, { "ACTION": "FORWARD", "ACTION_DISPLAY": "Forward", "BEGIN_DATE": "6/26/2019 2:50:14 PM", "END_DATE": "6/30/2019 2:50:22 PM", "FROM_ROW_NUM": 1, "FYI_FLAG": "Y", "ITEM_TYPE": "HRSSA", "ITEM_TYPE_DISPLAY_NAME": "HR", "MESSAGE": "TEst Rule", "NOTIFICATION_DISPLAY_NAME": "", "NOTIFICATION_NAME": "*", "NOTIFICATION_SUBJECT": "", "NO_OF_ROWS": 1, "REPLACEMENT_USER_NAME": "70915", "ROW_NUM": 1, "RULE_ID": 7770756, "RULE_NAME": "Delegate: Al Oulah, Mohammed", "RULE_STATUS": "Active", "RULE_TIP_MESSAGE": "", "TO_ROW_NUM": 1 }, { "ACTION": "FORWARD", "ACTION_DISPLAY": "Forward", "BEGIN_DATE": "6/26/2019 2:50:14 PM", "END_DATE": "6/30/2019 2:50:22 PM", "FROM_ROW_NUM": 1, "FYI_FLAG": "Y", "ITEM_TYPE": "HRSSA", "ITEM_TYPE_DISPLAY_NAME": "HR", "MESSAGE": "TEst Rule", "NOTIFICATION_DISPLAY_NAME": "", "NOTIFICATION_NAME": "*", "NOTIFICATION_SUBJECT": "", "NO_OF_ROWS": 1, "REPLACEMENT_USER_NAME": "70915", "ROW_NUM": 1, "RULE_ID": 7770756, "RULE_NAME": "Delegate: Al Oulah, Mohammed", "RULE_STATUS": "Active", "RULE_TIP_MESSAGE": "", "TO_ROW_NUM": 1 } ]; } ngOnInit() { console.log('OnInit'); this.getVacationRules(); console.log(this.GetVacationRulesList); } Vaction_Type() { } getVacationRules() { this.P_PAGE_NUM = 1; this.IsReachEnd = false; let request: VacationRuleRequest = new VacationRuleRequest(); request.P_PAGE_LIMIT = this.P_PAGE_LIMIT; request.P_PAGE_NUM = this.P_PAGE_NUM; this.vacationRuleService.getVacationRule(request, () => { this.getVacationRules(); }, this.ts.trPK('general', 'retry')).subscribe((result) => { if (this.cs.validResponse(result)) { console.log(result); console.log(JSON.stringify(result)); } else { this.cs.presentAlert(result.ErrorEndUserMessage); } }); } deleteFunc(i) { } updateFunc(i) { } }