{"version":3,"file":"app-bd64fb6c.d152cf98c45d962fa693.bundle.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAQA;AAAA;AALA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AAEA;AACA;AAGA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AClEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAGA;AACA;AAEA;AACA;AAiCA;AAAA;AAAA;AAAA;AA/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAiQA;AACA;AAAA;AAEA;AACA;AAlQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAIA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;AC5wBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAoBA;AAAA;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAsBA;AACA;AAAA;AAuVA;AACA;AACA;AACA;AA/WA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;;AAEA;AAEA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACpZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AAGA;AACA;AAEA;AACA;AAgBA;AAAA;AAAA;AAAA;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;;;ACpgBA;AACA;AAKA;AAAA;AAHA;AACA;AAUA;AACA;AACA;AACA;AAAA;AAmBA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAGA;AACA;AACA;AACA;AA1CA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAiBA;AACA;AACA;AACA;AApDA;;;;;;;;;;;;;ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACXA;AACA;AACA;AACA;;;;;;;;;;;;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACPA;AACA;AACA;AACA","sources":["webpack://HRMSPortal/./src/components/instantapproval/instantapprovalcomponent.js","webpack://HRMSPortal/./src/components/leavemanagement/applytimeoff/applytimeoffcomponent.js","webpack://HRMSPortal/./src/components/leavemanagement/approvetimeoff/approvetimeoffcomponent.js","webpack://HRMSPortal/./src/components/leavemanagement/assigntimeoff/assigntimeoffcomponent.js","webpack://HRMSPortal/./src/components/leavemanagement/cancelmodel/confirmcancelmodel.js","webpack://HRMSPortal/./src/components/instantapproval/instantapprovalcomponent.html","webpack://HRMSPortal/./src/components/leavemanagement/applytimeoff/applytimeoffcomponent.html","webpack://HRMSPortal/./src/components/leavemanagement/approvetimeoff/approvetimeoffcomponent.html","webpack://HRMSPortal/./src/components/leavemanagement/assigntimeoff/assigntimeoffcomponent.html","webpack://HRMSPortal/./src/components/leavemanagement/cancelmodel/confirmcancelmodel.html"],"sourcesContent":["import {inject } from 'aurelia-framework';\r\nimport {HttpClient, json} from 'aurelia-fetch-client';\r\nimport {Router,activationStrategy} from 'aurelia-router';\r\nimport {SharedState} from '../../shared/state/sharedstate';\r\nimport {config} from '../../shared/services/config';\r\nimport {ValidationControllerFactory, ValidationRules} from 'aurelia-validation';\r\nimport { DialogService } from 'aurelia-dialog';\r\nimport { LeavemanagementService } from '../../shared/services/leavemanagementservice';\r\nimport { App } from '../../app';\r\nimport {LoginService} from \"../../shared/services/loginservice\";\r\nimport {JwtService} from \"../../shared/services/jwtservice\";\r\n\r\n\r\n@inject(SharedState,LeavemanagementService, Router, HttpClient, ValidationControllerFactory,DialogService,App,LoginService,JwtService,Element)\r\nexport class InstantApproval {\r\n \r\n routerView = \"main-content\";\r\n InstantApprovaldetails=[];\r\n guid = '';\r\n userId = '';\r\n \r\n constructor(sharedState,LeavemanagementService, router, httpClient, controllerFactory,dialogService,App,loginservice,JwtService,element) {\r\n \r\n this.sharedState = sharedState;\r\n this.leavemanagementService = LeavemanagementService;\r\n this.router = router;\r\n this.httpClient = httpClient;\r\n this.element = element;\r\n this.dialogService = dialogService;\r\n this.controller = controllerFactory.createForCurrentScope();\r\n this.app = App;\r\n this.jwtService = JwtService;\r\n this.loginservice = loginservice;\r\n\r\n }\r\n\r\n attached() {\r\n // if(this.jwtService.getToken() === undefined){\r\n // this.loginservice.purgeAuth();\r\n // this.router.navigateToRoute('login')\r\n // }\r\n this.app.updatePropertyValue(false);\r\n document.querySelector('router-view').classList.remove(this.routerView);\r\n\r\n const url_string = window.location.href;\r\n var url = new URL(url_string);\r\n // const url = new URL(\"http://183.82.120.94:5050/instantapproval?guid=3bacb92d-0c20-476b-8701-195f0d2dd10b&UserId=507\");\r\n\r\n this.guid = url.searchParams.get('guid');\r\n this.userId = url.searchParams.get('UserId');\r\n console.log(this.guid);\r\n console.log(this.userId);\r\n\r\n if (this.guid && this.userId) {\r\n this.leavemanagementService\r\n .GetInstantApprovalDetails(this.guid, this.userId)\r\n .then(InstantApprovaldetails => {\r\n this.InstantApprovaldetails = InstantApprovaldetails;\r\n console.log(this.InstantApprovaldetails);\r\n })\r\n .catch(error => {\r\n console.error('Error fetching InstantApprovaldetails:', error);\r\n // Handle the error as needed (e.g., show an error message to the user)\r\n });\r\n }\r\n }\r\n }\r\n","import {inject,bindingMode,bindable } from 'aurelia-framework';\r\nimport flatpickr from \"flatpickr\";\r\nimport { JwtService } from '../../../shared/services/jwtservice';\r\nimport {DialogController, DialogService} from 'aurelia-dialog';\r\nimport {LeavemanagementService} from \"../../../shared/services/leavemanagementservice\";\r\nimport $, { data } from 'jquery';\r\nimport slick from 'slick-carousel';\r\nimport * as moment from \"moment\";\r\nimport {ValidationControllerFactory, ValidationRules} from 'aurelia-validation';\r\nimport {ConfirmationModal} from \"../useralertpopup/noofdaysconfirmation\";\r\nimport {ViewApplyTimeOffPopup} from \"../viewapplytimeoffpopup/viewapplytimeoffpopup\";\r\nimport {config} from \"../../../shared/services/config\";\r\nimport { ViewMyTimeoffSummaryComponent } from '../viewmytimeoffsummary/viewmytimeoffsummarycomponent';\r\nimport {SharedState} from \"../../../shared/state/sharedstate\";\r\nimport {Router} from 'aurelia-router';\r\nimport {LoginService} from \"../../../shared/services/loginservice\";\r\nimport { constants } from '../../../shared/services/constants';\r\n\r\n@inject(DialogController,JwtService,LeavemanagementService,ValidationControllerFactory,DialogService,SharedState,Router,LoginService)\r\nexport class ApplyTimeOffComponent{\r\n @bindable({\r\n defaultBindingMode: bindingMode.twoWay\r\n }) FromDate;\r\n @bindable({\r\n defaultBindingMode: bindingMode.twoWay\r\n }) ToDate;\r\n\r\n FromDate = null;\r\n ToDate = null;\r\n leavetypes=[];\r\n locations = [];\r\n leavesummery = [];\r\n selected = {};\r\n showEmpDropdown = false;\r\n LeaveTypeId = '';\r\n selectedEmployees = [];\r\n EmployeeListIDs = [];\r\n LeaveType = \"\";\r\n showDropdown = false;\r\n selectedRadio = '1';\r\n years = [];\r\n holidays = [];\r\n selectedFrom = \"full\";\r\n selectedTo = \"fullto\";\r\n pageSize = 3;\r\n contactPageSize = 10;\r\n notifyemails = [];\r\n featureholidays = [];\r\n showExperience = false;\r\n isTableEmpty = true;\r\n showToDateRadios = true;\r\n Configurl=config.img_url;\r\n FromDateError = null;\r\n ToDateErrors = null;\r\n ErrorMessageShow=false;\r\n isFormSubmitted = false;\r\n sitemapId=constants.applytimeoffSiteMapID;\r\n\r\n constructor(controller,JwtService,LeavemanagementService,controllerFactory,dialogService,sharedState,router,loginservice){\r\n this.controller = controller;\r\n this.jwtService= JwtService;\r\n this.empid = this.jwtService.getEmployeeId();\r\n this.locid = this.jwtService.getLocationId();\r\n this.leavemanagementService = LeavemanagementService;\r\n this.selectedEmployees = [];\r\n this.FromDate = null;\r\n this.ToDate = null;\r\n this.dialogService = dialogService;\r\n this.controllerFactory = controllerFactory.createForCurrentScope();\r\n this.sharedState = sharedState;\r\n this.router = router;\r\n this.loginservice = loginservice;\r\n\r\n ValidationRules\r\n .ensure('LeaveType').required().withMessage('Time off type field is required.')\r\n .ensure('FromDate').required().withMessage('From field is required.')\r\n .ensure('ToDate').required().withMessage('To field is required.')\r\n .ensure('Reasonfortimeoff').required().withMessage('Reason for time off field is required.')\r\n .minLength(5)\r\n .withMessage('Reason for time off must have at least 5 characters.')\r\n .maxLength(200)\r\n .withMessage('Reason for time off cannot exceed 200 characters.')\r\n .ensure('totaldays').required().matches(/^\\d+$/)\r\n .on(this);\r\n }\r\n validateEmails() {\r\n if (this.emails && this.emails.trim() !== '') {\r\n const emails = this.emails.split(',');\r\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.(com|co|in|org|cc|net)$/;\r\n const invalidEmails = [];\r\n for (const email of emails) {\r\n const trimmedEmail = email.trim();\r\n if (!emailRegex.test(trimmedEmail)) {\r\n invalidEmails.push(trimmedEmail);\r\n }\r\n }\r\n if (invalidEmails.length > 0 || (emails.length > 1 && this.emails.indexOf(',') === -1)) {\r\n this.specifyemailerror = 'Invalid email address and Email(s) should be separated by commas';\r\n return false;\r\n }\r\n }\r\n this.specifyemailerror = '';\r\n return true;\r\n }\r\n\r\n getCurrentRouteURL() {\r\n const currentInstruction = this.router.currentInstruction;\r\n if (currentInstruction) {\r\n const routeURL = currentInstruction.fragment;\r\n const sidebarListItem = document.querySelector('.sidebar ul li.mdi-calendar-clock');\r\n if (sidebarListItem) {\r\n const subActiveItems = document.querySelectorAll('.sidebar ul li.sub-active');\r\n subActiveItems.forEach(item => item.classList.remove('sub-active'));\r\n const activeLinkItems = document.querySelectorAll('.sidebar ul li.active-link');\r\n activeLinkItems.forEach(item => item.classList.remove('active-link'));\r\n sidebarListItem.classList.add('sub-active');\r\n }\r\n const sidebarLink = document.querySelector('.sidebar ul li.mdi-calendar-clock .sidebar-sub .apply-leave a');\r\n if (sidebarLink) {\r\n sidebarLink.classList.add('active-link');\r\n }\r\n return routeURL;\r\n }\r\n return '';\r\n }\r\n\r\n attached(){\r\n this.getCurrentRouteURL();\r\n this.empid = this.jwtService.getEmployeeId();\r\n this.FromCalendar = flatpickr(this.FromdatePicker, {\r\n closeOnSelect: true,\r\n dateFormat: 'd-m-Y',\r\n maxDate: null,\r\n defaultDate: this.FromDate,\r\n enableTime: false,\r\n enableSeconds: false,\r\n time_24hr: false,\r\n minuteIncrement: 1,\r\n hourIncrement: 1,\r\n timeFormat: 'h:i K',\r\n clickOpens:false,\r\n onClose: (selectedDates, dateStr, instance) => {\r\n this.FromDate = dateStr;\r\n // Update the minDate of the \"To\" calendar\r\n this.ToCalendar.set('minDate', dateStr);\r\n // Set the selected date of the \"To\" calendar if it's earlier than the selected date in \"From\"\r\n if (this.ToDate && new Date(this.ToDate) < new Date(dateStr)) {\r\n this.ToDate = dateStr;\r\n this.ToCalendar.setDate(dateStr);\r\n }\r\n\r\n }\r\n });\r\n this.FromcalendarIcon.addEventListener('click', () => {\r\n this.FromdatePicker._flatpickr.open();\r\n });\r\n this.ToCalendar = flatpickr(this.TodatePicker, {\r\n closeOnSelect: true,\r\n dateFormat: 'd-m-Y',\r\n minDate: this.FromDate,\r\n maxDate: null,\r\n defaultDate: this.FromDate,\r\n enableTime: false,\r\n enableSeconds: false,\r\n time_24hr: false,\r\n minuteIncrement: 1,\r\n hourIncrement: 1,\r\n timeFormat: 'h:i K',\r\n clickOpens:false,\r\n\r\n onClose: (selectedDates, dateStr, instance) => {\r\n this.ToDate = dateStr;\r\n },\r\n\r\n onReady: (selectedDates, dateStr, instance) => {\r\n if (!instance.input.value && this.FromDate) {\r\n instance.setDate(this.FromDate);\r\n }\r\n }\r\n });\r\n this.TocalendarIcon.addEventListener('click', () => {\r\n this.TodatePicker._flatpickr.open();\r\n });\r\n this.leavemanagementService.GetMyLeaveBalance(this.empid)\r\n .then(data => {\r\n this.leavesummery= data;\r\n // const filteredSummary = this.leavesummery.filter(item => item.LeaveTypeId === this.LeaveType);\r\n //const balanceLeave = filteredSummary.length > 0 ? filteredSummary[0].BalanceLeave : 0;\r\n\r\n });\r\n this.leavemanagementService.GetLeaveTypesForDropDown(this.empid)\r\n .then(data => {\r\n this.leavetypes= data;\r\n });\r\n this.leavemanagementService.LocationsForDropdown()\r\n .then(data => {\r\n this.locations= data;\r\n });\r\n this.leavemanagementService.YearsForDropdown()\r\n .then(data => {\r\n this.years= data;\r\n });\r\n const d = new Date();\r\n this.year = d.getFullYear();\r\n const selectedYear = this.year;\r\n const ID = this.locid;\r\n const timeoff = {\r\n LocationId:ID,\r\n Year:this.year,\r\n EmployeeID:this.empid,\r\n };\r\n this.leavemanagementService.GetEmployeeHolidayLists(timeoff)\r\n .then(data => {\r\n this.holidays = data;\r\n this.holidays.map((months) => {\r\n const HolidayMonth = months.Month;\r\n });\r\n const currentDate = new Date();\r\n const currentMonth = currentDate.getMonth() + 1;\r\n const currentMonthHolidays = this.holidays.filter(months => Number(months.Month) === currentMonth);\r\n const nextMonthsHolidays = this.holidays.filter(months => Number(months.Month) > currentMonth);\r\n const pastMonthsHolidays = this.holidays.filter(months => Number(months.Month) < currentMonth);\r\n pastMonthsHolidays.sort((a, b) => Number(a.Month) - Number(b.Month));\r\n this.displayedHolidays = currentMonthHolidays.concat(nextMonthsHolidays, pastMonthsHolidays);\r\n });\r\n sessionStorage.removeItem('activeTab');\r\n this.isLoading = true;\r\n setTimeout(() => {\r\n this.isLoading = false;\r\n }, 3000);\r\n setTimeout(()=>{\r\n $('.leave-slick-list').slick({\r\n dots: false,\r\n infinite: false,\r\n arrows: true,\r\n slidesToShow: 4,\r\n slidesToScroll: 1,\r\n responsive: [\r\n {\r\n breakpoint: 1366,\r\n settings: {\r\n slidesToShow: 3,\r\n }\r\n },\r\n {\r\n breakpoint: 1200,\r\n settings: {\r\n slidesToShow: 2,\r\n }\r\n },\r\n {\r\n breakpoint: 666,\r\n settings: {\r\n slidesToShow: 1,\r\n centerMode: true,\r\n centerPadding:'50px',\r\n }\r\n }\r\n ]\r\n })\r\n },5000);\r\n this.leavemanagementService.GetFeatureHoliday()\r\n .then(data => {\r\n this.featureholidays= data;\r\n \r\n this.featureholidays.map((days) =>{\r\n const Months = days.Month;\r\n });\r\n const currentDate = new Date();\r\n const currentMonth = currentDate.getMonth() + 1; // Add 1 because month index starts from 0\r\n const currentMonthFeatureHolidays = this.featureholidays.filter(days => Number(days.Month) === currentMonth);\r\n const nextMonthsFeatureHolidays = this.featureholidays.filter(days => Number(days.Month) > currentMonth);\r\n const pastMonthsFeatureHolidays = this.featureholidays.filter(days => Number(days.Month) < currentMonth);\r\n pastMonthsFeatureHolidays.sort((a, b) => Number(a.Month) - Number(b.Month));\r\n this.displayedFeatureHolidays = currentMonthFeatureHolidays.concat(nextMonthsFeatureHolidays, pastMonthsFeatureHolidays);\r\n });\r\n if (window.innerWidth >= 1280) {\r\n setTimeout(() => {\r\n $('.holiday-slick-list').slick({\r\n dots: false,\r\n infinite: false,\r\n arrows: true,\r\n slidesToShow: 3,\r\n slidesToScroll: 1,\r\n responsive: [\r\n {\r\n breakpoint: 1366,\r\n settings: {\r\n slidesToShow: 3,\r\n }\r\n },\r\n {\r\n breakpoint: 1280,\r\n settings: {\r\n arrows: false,\r\n slidesToShow: 3,\r\n }\r\n },\r\n {\r\n breakpoint: 666,\r\n settings: {\r\n slidesToShow: 1,\r\n centerMode: true,\r\n centerPadding:'50px',\r\n }\r\n }\r\n ]\r\n });\r\n }, 5000);\r\n }\r\n this.addToRecentItems();\r\n }\r\n locationMatcher = (a, b) => {\r\n return a.key === b.key;\r\n };\r\n yearMatcher = (a, b) => {\r\n return a.Year === b.year;\r\n };\r\n monthFormat(Months){\r\n const inputDate = Months;\r\n const parsedDate = moment(inputDate, 'MM');\r\n const formattedDate = parsedDate.format('MMM');\r\n return formattedDate;\r\n }\r\n calculateNoOfDays(){\r\n if (this.FromDate === this.ToDate) {\r\n this.showToDateRadios = false;\r\n } else {\r\n this.showToDateRadios = true;\r\n }\r\n const selectedtype = this.LeaveType;\r\n const leave = this.leavesummery;\r\n leave.some((item) => {\r\n const summeryID = item.LeaveTypeID;\r\n const isEqual = summeryID == selectedtype;\r\n if (isEqual) {\r\n this.balanceLeave = item.BalanceLeave;\r\n return true;\r\n }\r\n return false;\r\n });\r\n if(this.selectedFrom === 'full'){\r\n this.FromFull = true;\r\n }else{\r\n this.FromFull = false;\r\n }\r\n if(this.selectedFrom === 'half'){\r\n this.FromHalf = true;\r\n }else{\r\n this.FromHalf = false;\r\n }\r\n if(this.selectedTo === 'fullto'){\r\n this.ToFull = true;\r\n }else{\r\n this.ToFull = false;\r\n }\r\n if(this.selectedTo === 'halfto'){\r\n this.ToHalf = true;\r\n }else{\r\n this.ToHalf = false;\r\n }\r\n if (this.ToDate) {\r\n this.showExperience = true;\r\n } else {\r\n this.showExperience = false;\r\n }\r\n let totaldays = {\r\n EmployeeID : this.empid,\r\n FromDateTime : this.FromDate,\r\n ToDateTime : this.ToDate,\r\n FromFullDayIND : this.FromFull,\r\n FromHalfDayIND : this.FromHalf,\r\n ToFullDayIND : this.ToFull,\r\n ToHalfDayIND : this.ToHalf,\r\n LeaveTypeId : this.LeaveType,\r\n };\r\n this.leavemanagementService.GetNoOfDays(totaldays)\r\n .then(data => {\r\n this.noofdays = data;\r\n if (data !== null) {\r\n const result2 = data.match(/[a-zA-Z]+/g);\r\n this.stringData = result2 ? result2.join(\" \") : \"\";\r\n const result = data.match(/[\\d.]+/);\r\n this.totaldays = result ? parseFloat(result[0]) : 0;\r\n }\r\n if(this.stringData.length > 0){\r\n this.alertmessage = '';\r\n }\r\n const areAllBalanceLeavesZero = this.leavesummery.every(item => item.BalanceLeave === 0);\r\n if (this.totaldays > this.balanceLeave && !areAllBalanceLeavesZero) {\r\n const message = 'You don\\'t have sufficient leave balance in selected leave type. Do you want to auto adjust balance from other leave types ?';\r\n this.dialogService.open({\r\n viewModel: ConfirmationModal,\r\n model: message\r\n }).whenClosed(response => {\r\n if (!response.wasCancelled) {\r\n this.confirm = !response.wasCancelled;\r\n this.leaveconfirm = this.confirm;\r\n }\r\n else {\r\n this.notconfirmed = !response.wasCancelled;\r\n this.leavenotconfirm = this.notconfirmed;\r\n if (this.leavenotconfirm === false) {\r\n this.alertmessage = \"Applied time off(s) are more than balance time off(s). Do you want to proceed on loss of pay for remaining time off(s) ?\";\r\n }\r\n }\r\n });\r\n } else if (this.totaldays > this.balanceLeave && areAllBalanceLeavesZero) {\r\n this.alertmessage = \"Applied time off(s) are more than balance time off(s). Do you want to proceed on loss of pay for remaining time off(s) ?\";\r\n }\r\n });\r\n }\r\n DisplayHolidays() {\r\n const d = new Date();\r\n this.year = d.getFullYear();\r\n this.locid = this.jwtService.getLocationId();\r\n let ID = this.locid;\r\n let selectedYear = this.year;\r\n if (this.Location) {\r\n ID = this.Location.LocationId;\r\n }\r\n if (this.Year) {\r\n selectedYear = this.Year.Year;\r\n }\r\n this.leavemanagementService.GetHolidayList(ID, selectedYear, this.empid)\r\n .then(data => {\r\n this.holidays = data;\r\n this.holidays.map((months) =>{\r\n const HolidayMonth = months.Month;\r\n });\r\n const currentDate = new Date();\r\n const currentMonth = currentDate.getMonth() + 1;\r\n const currentMonthHolidays = this.holidays.filter(months => Number(months.Month) === currentMonth);\r\n const nextMonthsHolidays = this.holidays.filter(months => Number(months.Month) > currentMonth);\r\n const pastMonthsHolidays = this.holidays.filter(months => Number(months.Month) < currentMonth);\r\n pastMonthsHolidays.sort((a, b) => Number(b.Month) - Number(a.Month));\r\n this.displayedHolidays = currentMonthHolidays.concat(nextMonthsHolidays, pastMonthsHolidays);\r\n });\r\n }\r\n HolidayMonthFormat(HolidayMonth){\r\n const inputDate = HolidayMonth;\r\n const parsedDate = moment(inputDate, 'MM');\r\n const formattedDate = parsedDate.format('MMM');\r\n return formattedDate;\r\n }\r\n async toggleNotifyFields(checked) {\r\n this.showNotifyFields = checked;\r\n this. selectedRadio = '1';\r\n }\r\n onEmailSelected() {\r\n this.selectedRadio = '2';\r\n this.searchQuery = '';\r\n this.employenameerror = '';\r\n this.employenameerror = '';\r\n }\r\n async onEmployeeSelected() {\r\n this.selectedRadio = '1';\r\n this.emails = '';\r\n this.specifyemailerror = '';\r\n if (this.searchQuery) {\r\n this.showEmpDropdown = true;\r\n try {\r\n const response = await this.leavemanagementService.EmployeeNamesForDropdown(this.searchQuery);\r\n const data = await response;\r\n const filterOption = this.searchQuery.toLowerCase();\r\n this.dropdownOptions = data.filter(option => option.EmployeeName.toLowerCase().includes(filterOption));\r\n this.empid = this.jwtService.getEmployeeId(); // Assuming this.empid is a string\r\n this.dropdownOptions = this.dropdownOptions.filter(option => option.EmployeeID !== parseInt(this.empid, 10));\r\n if (this.dropdownOptions.length === 0) {\r\n const errorInfo = {\r\n error: {\r\n message: \"No records found\"\r\n }\r\n };\r\n this.NameError = [errorInfo];\r\n } else {\r\n this.NameError = [];\r\n }\r\n } catch (error) {\r\n }\r\n } else {\r\n this.showEmpDropdown = false;\r\n this.dropdownOptions = [];\r\n }\r\n }\r\n selectEmployee(EmpOption) {\r\n const modifiedOption = {\r\n ...EmpOption,\r\n ID: EmpOption.EmployeeID\r\n };\r\n this.searchQuery = modifiedOption.EmployeeName;\r\n this.showEmpDropdown = false;\r\n this.selectedEmployee = modifiedOption;\r\n return false;\r\n }\r\n addToSelectedOptions(id) {\r\n let emails = this.emails || '';\r\n if (this.selectedRadio === '1') {\r\n if (!this.searchQuery || this.searchQuery.trim() === '') {\r\n this.employenameerror = \"Employee name is required\";\r\n return;\r\n }\r\n this.leavemanagementService.GetEmployeesForAdd(id).then(data => {\r\n this.Ids = data.EmployeeID;\r\n this.empmail = data.EmailID;\r\n this.EName = data.EmployeeName;\r\n let employeeemail = {\r\n EmailIds: this.empmail,\r\n PersonID: this.Ids,\r\n EmployeeName: this.EName,\r\n };\r\n const existingEmployee = this.selectedEmployees.find(emp => emp.PersonID === id);\r\n if (existingEmployee) {\r\n this.employenameerror = \"Employee name already exists\";\r\n return;\r\n }\r\n this.EmployeeListIDs.push(employeeemail);\r\n this.selectedEmployees.push(employeeemail);\r\n this.searchQuery = '';\r\n this.employenameerror = '';\r\n });\r\n } else if (this.selectedRadio === '2') {\r\n if (this.validateEmails()) {\r\n const existingEmail = this.selectedEmployees.find(emp => emp.EmailIds === emails);\r\n if (existingEmail) {\r\n this.specifyemailerror = \"Email id already exists\";\r\n return;\r\n }\r\n if (emails.trim() !== '') {\r\n const emailEntry = {\r\n PersonID: -1,\r\n EmailIds: emails\r\n };\r\n this.newmail = emailEntry;\r\n this.notifyemails.push(this.newmail);\r\n this.EmployeeListIDs.push(...this.notifyemails);\r\n this.selectedEmployees.push(emailEntry);\r\n this.emails = '';\r\n } else {\r\n this.specifyemailerror = \"Specify email is required\";\r\n return;\r\n }\r\n this.employenameerror = '';\r\n this.specifyemailerror = '';\r\n this.validatemessage = '';\r\n }\r\n }\r\n if (this.notifyind === true && this.EmployeeListIDs.length === 0 && this.notifyemails.length === 0) {\r\n this.validatemessage = \"\";\r\n return;\r\n }\r\n }\r\n deleteEmployee(emp) {\r\n const index = this.selectedEmployees.indexOf(emp);\r\n if (index !== -1) {\r\n this.selectedEmployees.splice(index, 1);\r\n this.EmployeeListIDs.splice(index, 1);\r\n }\r\n const deletedIds = emp.EmployeeID;\r\n this.EmployeeListIDs = this.EmployeeListIDs.filter(id => id !== deletedIds);\r\n this.Ids = this.EmployeeListIDs;\r\n }\r\n handleFileSelect(files) {\r\n const file = files[0];\r\n this.file = file;\r\n let reader = new FileReader();\r\n reader.readAsDataURL(file);\r\n this.DocumentName = file.name;\r\n reader.onload = () => {\r\n this.file = reader.result;\r\n };\r\n }\r\n openFileDialog() {\r\n document.getElementById('attachments').click();\r\n }\r\n removeFile() {\r\n this.file = null;\r\n this.DocumentName = '';\r\n const fileInput = document.getElementById('attachments');\r\n if (fileInput) {\r\n fileInput.value = '';\r\n }\r\n }\r\n save() {\r\n event.preventDefault();\r\n if (this.leaveconfirm === true) {\r\n this.userconfirmation = true;\r\n }\r\n if(this.leavenotconfirm === false) {\r\n this.userconfirmation = false;\r\n }\r\n const refreshEvent = new CustomEvent('refreshCTC');\r\n this.controllerFactory.validate()\r\n .then(result => {\r\n if (result.valid) {\r\n if (this.stringData && this.stringData.length > 1) {\r\n return;\r\n }\r\n if( this.notifyind === true && this.EmployeeListIDs.length === 0 && this.notifyemails.length === 0) {\r\n this.validatemessage = \"Atleast one peer is required\";\r\n } else {\r\n this.validatemessage = \"\";\r\n this.isFormSubmitted = true;\r\n let applydata = {\r\n EmployeeID: this.empid,\r\n LoginEmployeeID: this.empid,\r\n LocationID: this.locid,\r\n LeaveTypeId: this.LeaveType,\r\n FromDateTime:this.FromDate,\r\n ToDateTime:this.ToDate,\r\n NoofDays:this.totaldays,\r\n ReasonforLeave:this.Reasonfortimeoff,\r\n FromFullDayIND:this.FromFull,\r\n FromHalfDayIND :this.FromHalf,\r\n ToFullDayIND:this.ToFull,\r\n ToHalfDayIND:this.ToHalf,\r\n DocumentPath:this.file,\r\n DocumentName:this.DocumentName,\r\n NotifyEmployeeList:this.EmployeeListIDs,\r\n NotifyPeersIND : this.notifyind,\r\n MessageToPeers : this.comments,\r\n LeaveApplicationID:this.LeaveApplicationID,\r\n Userconfirmation : this.userconfirmation,\r\n };\r\n this.leavemanagementService.IsLeaveWorkflowApproverExist(this.locid).then(data => {\r\n if (data == false) {\r\n this.ErrorMessageShow = true;\r\n this.isFormSubmitted = false;\r\n }\r\n else {\r\n this.ErrorMessageShow = false;\r\n this.isFormSubmitted = true;\r\n this.leavemanagementService.SaveApplyLeave(applydata).then((response)=>{\r\n this.leaveapplicationID = response;\r\n\r\n this.openDialogBox();\r\n if(this.FromCalendar){\r\n this.FromCalendar.clear();\r\n }\r\n if(this.ToCalendar){\r\n this.ToCalendar.clear();\r\n }\r\n this.LeaveType = '';\r\n this.FromDate = '';\r\n this.ToDate = '';\r\n this.Reasonfortimeoff = '';\r\n this.FromDate = '';\r\n this.ToDate = '';\r\n this.totaldays = '';\r\n this.FromFull = '';\r\n this.half = '';\r\n this.ToFull = '';\r\n this.halfto = '';\r\n this.file = '';\r\n this.DocumentName = '';\r\n this.EmployeeListIDs = [];\r\n this.stringData = '';\r\n this.notifyind = '';\r\n this.comments = '';\r\n this.selectedEmployees = [];\r\n this.notifyemails = [];\r\n this.searchQuery = '';\r\n this.employenameerror = '';\r\n this.specifyemailerror = '';\r\n this.showNotifyFields = false;\r\n this.showToDateRadios = true;\r\n this.selectedFrom = \"full\";\r\n this.selectedTo = \"fullto\";\r\n this.alertmessage = \"\";\r\n this.isFormSubmitted = false;\r\n })\r\n }\r\n });\r\n }\r\n }\r\n });\r\n }\r\n openDialogBox() {\r\n this.dialogService.open({\r\n title: 'Saved Data',\r\n viewModel: ViewApplyTimeOffPopup,\r\n model: this.leaveapplicationID\r\n }).then(dialogResult => {\r\n });\r\n }\r\n showPopupGrid(LeaveTypeID) {\r\n this.dialogService.open({viewModel: ViewMyTimeoffSummaryComponent, model: LeaveTypeID});\r\n }\r\n clearDatePickers() {\r\n if (this.FromdatePicker) {\r\n this.FromdatePicker._flatpickr.clear();\r\n }\r\n if (this.TodatePicker) {\r\n this.TodatePicker._flatpickr.clear();\r\n }\r\n }\r\n resetForm() {\r\n if(this.FromCalendar){\r\n this.FromCalendar.clear();\r\n }\r\n if(this.ToCalendar){\r\n this.ToCalendar.clear();\r\n }\r\n this.alertmessage = \"\";\r\n this.LeaveType = '';\r\n this.FromDate = '';\r\n this.ToDate = '';\r\n this.Reasonfortimeoff = '';\r\n this.FromDate = '';\r\n this.totaldays = '';\r\n this.FromFull = '';\r\n this.half = '';\r\n this.ToFull = '';\r\n this.file = '';\r\n this.DocumentName = '';\r\n this.EmployeeListIDs = [];\r\n this.stringData = '';\r\n this.notifyind = '';\r\n this.comments = '';\r\n this.selectedEmployees = [];\r\n this.notifyemails = [];\r\n this.searchQuery = '';\r\n this.employenameerror = '';\r\n this.specifyemailerror = '';\r\n this.LeaveTypeError = [];\r\n this.ReasonfortimeoffErrors = [];\r\n this.showNotifyFields = false;\r\n this.showToDateRadios = true;\r\n this.FromDateError = [];\r\n this.ToDateErrors = [];\r\n this.selectedFrom = \"full\";\r\n this.selectedTo = \"fullto\";\r\n }\r\n timeoffClick() {\r\n event.preventDefault();\r\n const parentDiv = event.target.parentNode;\r\n parentDiv.classList.toggle('timeoff-open');\r\n }\r\n holidayClick() {\r\n event.preventDefault();\r\n const parentDiv = event.target.parentNode;\r\n parentDiv.classList.toggle('holiday-open');\r\n $('.holiday-slick-list').slick({\r\n dots: false,\r\n infinite: false,\r\n arrows: true,\r\n slidesToShow: 3,\r\n slidesToScroll: 1,\r\n responsive: [\r\n {\r\n breakpoint: 1366,\r\n settings: {\r\n slidesToShow: 3,\r\n }\r\n },\r\n {\r\n breakpoint: 1280,\r\n settings: {\r\n arrows: false,\r\n slidesToShow: 3,\r\n }\r\n },\r\n {\r\n breakpoint: 666,\r\n settings: {\r\n slidesToShow: 1,\r\n centerMode: true,\r\n centerPadding:'50px',\r\n }\r\n }\r\n ]\r\n });\r\n }\r\n\r\n addToRecentItems(){\r\n this.leavemanagementService.AddToRecentItems(this.empid,this.sitemapId).then(data=>\r\n {\r\n\r\n });\r\n }\r\n}\r\n","import {inject } from 'aurelia-framework';\r\nimport { DialogController } from 'aurelia-dialog';\r\nimport {DialogService} from 'aurelia-dialog';\r\nimport { ProfileService } from '../../../shared/services/profielservice';\r\nimport { JwtService } from '../../../shared/services/jwtservice';\r\n//import Scrollbar from 'smooth-scrollbar';\r\nimport {LeavemanagementService} from \"../../../shared/services/leavemanagementservice\";\r\nimport {config} from \"../../../shared/services/config\";\r\nimport {ValidationControllerFactory, ValidationRules} from 'aurelia-validation';\r\nimport { constants } from '../../../shared/services/constants';\r\nimport { Confirmcancelmodel } from '../cancelmodel/confirmcancelmodel';\r\nimport {LoginService} from \"../../../shared/services/loginservice\";\r\nimport {Router} from 'aurelia-router';\r\n\r\n@inject(DialogController,ProfileService,JwtService,LeavemanagementService,ValidationControllerFactory,DialogService,LoginService,Router)\r\n\r\nexport class ApproveTimeOffComponent {\r\n static inject = [DialogController,Element];\r\n isDragging = false;\r\n dialog;\r\n pageSize = config.grid_PazeSize;\r\n topicsPageSize = config.grid_PazeSize;\r\n NotePageSize = config.grid_PazeSize;\r\n OnlineTopic = [];\r\n InputContainer = null;\r\n selectedValue = \"true\";\r\n validationMessage=false;\r\n reasonErrorMessage=false;\r\n showReasonError=false;\r\n Reason = '';\r\n savecancel=false;\r\n DisplayOnBehalfOf='';\r\n CategoryId=constants.leaveworkflowcategoryid;\r\n isFormSubmitted = false;\r\n constructor(controller, ProfileService,JwtService,LeavemanagementService,ValidationControllerFactory,DialogService, config,loginservice,router) {\r\n this.controller = controller;\r\n this.profileService = ProfileService;\r\n this.jwtService = JwtService;\r\n this.dialogService = DialogService;\r\n this.leavemanagementService = LeavemanagementService;\r\n this.empid = this.jwtService.getEmployeeId();\r\n this.config = config;\r\n this.loginservice = loginservice;\r\n this.router = router;\r\n this.controllerFactory = ValidationControllerFactory.createForCurrentScope();\r\n this.leavemanagementService.GetLeaveDaywiseSummary(this.LeaveApplicationID).then(data => {\r\n this.days = data;\r\n });\r\n ValidationRules\r\n .ensure('selectedStatus').displayName(\"select action\").required()\r\n .ensure('selectedClarifier').displayName(\"select Clarifier\").required()\r\n .ensure('Comments').required().withMessage('Comments are required.')\r\n .on(this);\r\n }\r\n statusMatcher = (a) => {\r\n return a === this.StatusCode;\r\n };\r\n activate(approveData){\r\n this.data = approveData;\r\n this.photopath = this.data.PhotoPath;\r\n this.LeaveApplicationID = this.data.selectedRecordId;\r\n this.EmployeeId = this.data.EmployeeId;\r\n this.StatusCode = this.data.StatusCode;\r\n this.Actions = this.data.actions;\r\n this.Actions.map(item => {\r\n if(item.ActionID === this.ActionID){\r\n this.HeaderName = item.ActionName;\r\n }\r\n });\r\n }\r\n selectedCancleStatus(cancleStatus){\r\n this.selectedStatus = cancleStatus.ActionID;\r\n }\r\n selecteClarifier(clarifierdata){\r\n this.SenderId = clarifierdata.SenderId\r\n }\r\n selecteClarify(selecteClarify){\r\n this.SenderId = selecteClarify.SenderId\r\n }\r\n async bind() {\r\n setTimeout(()=>{\r\n Scrollbar.init(document.querySelector('.viewtimeoff-pop-scrollbar'));\r\n },1000);\r\n this.userPhoto =config.img_url + this.photopath;\r\n }\r\n async attached(){\r\n this.specializationInput.focus();\r\n\r\n document.addEventListener('click', this.handleDocumentClick);\r\n this.leavemanagementService.GetAdditionalComments(this.LeaveApplicationID,this.CategoryId)\r\n .then(data =>{\r\n this.additionalcomments = data;\r\n this.DocPath = data.DocumentPath;\r\n });\r\n this.leavemanagementService.clarificationDropdown(this.LeaveApplicationID).then(data => {\r\n this.clarificationData = data;\r\n });\r\n this.leavemanagementService.clarifyDropdown(this.LeaveApplicationID).then(data => {\r\n this.clarifly = data;\r\n this.clariflyid=data.SenderId;\r\n });\r\n this.leavemanagementService.GetLeaveApplicationDetails(this.LeaveApplicationID).then(data=>\r\n {\r\n this.timeoffRequest=data;\r\n this.finalFromDate=this.timeoffRequest.From;\r\n this.finalToDate=this.timeoffRequest.To;\r\n const passing={\r\n EmployeeId:this.EmployeeId,\r\n Fromdate: this.finalFromDate,\r\n Todate: this.finalToDate,\r\n LeaveApplicationID: this.LeaveApplicationID,\r\n LoggedInEmployeeId:this.empid\r\n };\r\n this.leavemanagementService.GetLeaveDetailsofOtherEmployees(passing).then(data=>\r\n {\r\n this.OtherEmployees =data;\r\n });\r\n });\r\n this.leavemanagementService.GetLeaveDaywiseSummary(this.LeaveApplicationID).then(data=>\r\n {\r\n this.Days =data;\r\n const containerCheckbox = document.createElement('div');\r\n const labelCheckbox = document.createElement('label');\r\n labelCheckbox.textContent = \"Select the day: \"\r\n containerCheckbox.appendChild(labelCheckbox);\r\n const checkboxOptions = this.Days;\r\n data.forEach((option) => {\r\n const checkboxLabel = document.createElement('label');\r\n const checkboxInput = document.createElement('input');\r\n checkboxInput.type = 'checkbox';\r\n checkboxInput.name = 'checkboxOptions';\r\n checkboxInput.value = option.LeaveApplicationDayWiseSummaryID;\r\n checkboxInput.id = this.Days.Date;\r\n checkboxLabel.textContent = option.Day;\r\n checkboxLabel.appendChild(checkboxInput);\r\n containerCheckbox.appendChild(checkboxLabel);\r\n });\r\n if (this.InputContainer) {\r\n this.InputContainer.appendChild(containerCheckbox);\r\n }\r\n });\r\n const buttonContainer = document.createElement('div');\r\n buttonContainer.className = 'button-container';\r\n if (this.InputContainer) {\r\n this.InputContainer.appendChild(buttonContainer);\r\n }\r\n this.leavemanagementService.GetPastLeavesData(this.EmployeeId,this.LeaveApplicationID,).then(data=>\r\n {\r\n this.PastLeaves =data;\r\n });\r\n this.leavemanagementService.GetEmployeePeersLeaveNotifyEmails(this.LeaveApplicationID).then(data=>\r\n {\r\n this.PeersLeaveNotifyEmails=data;\r\n });\r\n this.leavemanagementService.DisplayOnBehalfOf(6,this.LeaveApplicationID,this.empid).then(data=>\r\n {\r\n this.DisplayOnBehalfOf=data;\r\n console.log(this.DisplayOnBehalfOf);\r\n });\r\n\r\n }\r\n updateSelectedValue(event) {\r\n this.selectedValue = event.target.value;\r\n this.validationMessage=false;\r\n }\r\n RefreshProfileImage(data){\r\n this.userPhotoElement = document.querySelector('.rounded-full.dropdown.inline-block');\r\n this.userPhotoElement.src = data;\r\n }\r\n\r\n nameLength(row) {\r\n return row.Type.length;\r\n }\r\n cancel(){\r\n this.controller.cancel();\r\n }\r\n openFileDialog() {\r\n document.getElementById('attachments').click();\r\n }\r\n handleFileSelect(files) {\r\n const file = files[0];\r\n const maxSize = 2.5 * 1024 * 1024; // Maximum file size in bytes (2.5 MB)\r\n if (file.size > maxSize) {\r\n this.fileMessage = 'File size should be less than 2.5 MB.';\r\n setTimeout(() => {\r\n this.fileMessage = null;\r\n }, 4000);\r\n this.removeFile();\r\n return;\r\n }\r\n else if (file.size <= maxSize) {\r\n this.file = file;\r\n let reader = new FileReader();\r\n reader.readAsDataURL(file);\r\n this.DocumentName = file.name;\r\n reader.onload = () => {\r\n this.file = reader.result;\r\n };\r\n }\r\n }\r\n removeFile() {\r\n this.file = null;\r\n this.DocumentName = '';\r\n const fileInput = document.getElementById('attachments');\r\n if (fileInput) {\r\n fileInput.value = ''; // Clear the file input value\r\n }\r\n }\r\n submit(){\r\n this.controllerFactory.validate()\r\n .then(result => {\r\n if (result.valid) {\r\n const data = {\r\n LoginEmployeeID: this.empid,\r\n EmployeeID: this.EmployeeId,\r\n LeaveApplicationID: this.LeaveApplicationID,\r\n Status: this.selectedStatus ? this.selectedStatus : this.StatusCode,\r\n Comments: this.Comment,\r\n //CommentANR:this.Common,\r\n CommentANR: this.Reason,\r\n DocumentName: this.DocumentName,\r\n DocumentPath: this.file,\r\n SenderId: this.SenderId ? this.SenderId : null,\r\n ClarifyId: this.clariflyid\r\n };\r\n const CancelList = [];\r\n console.log(data);\r\n this.Reason = this.timeoffRequest.Reason;\r\n console.log(this.Reason);\r\n if (this.Reason == null || this.Reason == \"\" || this.Reason == undefined) {\r\n this.reasonErrorMessage = true;\r\n const errorElement = document.querySelector(\".messages\");\r\n if (errorElement) {\r\n errorElement.scrollIntoView();\r\n }\r\n } else {\r\n this.reasonErrorMessage=false;\r\n if (data.Status === 'INA' && this.selectedValue == 'true' ) {\r\n const result = this.dialogService.open({\r\n viewModel: Confirmcancelmodel,\r\n model: this.Days.length,\r\n }).whenClosed(response => {\r\n if (response.wasCancelled) {\r\n return;\r\n }\r\n else {\r\n this.reasonErrorMessage=false;\r\n const displayRadiosArray = {\r\n CancelList: CancelList,\r\n EmployeeID: this.EmployeeId,\r\n LoginEmployeeID: this.empid,\r\n LeaveApplicationID: this.LeaveApplicationID,\r\n NOofdays: this.NOofdays,\r\n Comments: this.Comments,\r\n DocumentName: this.DocumentName,\r\n DocumentPath: this.file,\r\n SingleDayIND: this.SingleDayIND,\r\n Status: this.selectedStatus ? this.selectedStatus : this.StatusCode,\r\n AllDayIND: this.selectedValue\r\n };\r\n if(this.savecancel==false)\r\n {\r\n this.savecancel=true;\r\n this.leavemanagementService.CancelTimeoffRequest(displayRadiosArray).then(() => {\r\n this.controller.ok(true);\r\n \r\n });\r\n }\r\n \r\n }\r\n })\r\n }\r\n else if (data.Status === 'INA' && this.selectedValue == 'false') {\r\n const fieldValues = {};\r\n const checkboxElements = document.querySelectorAll(`input[name=\"checkboxOptions\"]:checked`);\r\n if (checkboxElements.length === 0) {\r\n this.validationMessage = true;\r\n } else {\r\n this.validationMessage = false;\r\n const result = this.dialogService.open({\r\n viewModel: Confirmcancelmodel,\r\n model:this.selectedValue,\r\n }).whenClosed(response => {\r\n if (response.wasCancelled) {\r\n return;\r\n }\r\n else {\r\n fieldValues.Option = checkboxElements ? Array.from(checkboxElements).map(checkbox => checkbox.value) : [];\r\n fieldValues.Option.forEach(response => {\r\n fieldValues.EmployeeID = this.EmployeeId;\r\n fieldValues.Value = response.Option;\r\n CancelList.push(fieldValues);\r\n const displayRadiosArray = {\r\n CancelList: CancelList,\r\n EmployeeID: this.EmployeeId,\r\n LoginEmployeeID: this.empid,\r\n LeaveApplicationID: this.LeaveApplicationID,\r\n NOofdays: this.NOofdays,\r\n Comments: this.Comments,\r\n DocumentName: this.DocumentName,\r\n DocumentPath: this.file,\r\n SingleDayIND: this.SingleDayIND,\r\n AllDayIND: this.selectedValue,\r\n Status: this.selectedStatus ? this.selectedStatus : this.StatusCode,\r\n };\r\n if(this.savecancel==false)\r\n {\r\n this.savecancel=true;\r\n this.leavemanagementService.CancelTimeoffRequest(displayRadiosArray).then(() => {\r\n this.controller.ok(true);\r\n\r\n });\r\n }\r\n });\r\n }\r\n })\r\n }\r\n }\r\n else if (data.Status === 'CLR') {\r\n this.leavemanagementService.clarifyDropdown(data).then(() => {\r\n });\r\n this.isFormSubmitted = true;\r\n this.leavemanagementService.ApproveTimeOffRequests(data).then(() => {\r\n this.controller.ok(true);\r\n\r\n });\r\n }\r\n else {\r\n this.isFormSubmitted = true;\r\n this.leavemanagementService.ApproveTimeOffRequests(data).then(() => {\r\n this.controller.ok(true);\r\n });\r\n \r\n //this.window.location.reload();\r\n \r\n }\r\n // this.router.navigateToRoute('employeetimeoffdetails');\r\n //window.location.reload();\r\n this.leavemanagementService.GetLeaveApplicationDetails(this.LeaveApplicationID).then(data=>\r\n {\r\n this.timeoffRequest=data;\r\n console.log(data);\r\n \r\n });\r\n }\r\n }});\r\n }\r\n otherleavesClick(){\r\n event.preventDefault();\r\n const parentDiv = event.target.parentNode;\r\n parentDiv.classList.toggle('open-content');\r\n }\r\n pastleaveClick(){\r\n event.preventDefault();\r\n const parentDiv = event.target.parentNode;\r\n parentDiv.classList.toggle('open-content');\r\n }\r\n peersClick(){\r\n event.preventDefault();\r\n const parentDiv = event.target.parentNode;\r\n parentDiv.classList.toggle('open-content');\r\n }\r\n additionalClick(){\r\n event.preventDefault();\r\n const parentDiv = event.target.parentNode;\r\n parentDiv.classList.toggle('open-content');\r\n }\r\n getSelectedCheckboxOptions(fieldName){\r\n const checkboxElements = this.InputContainer.querySelectorAll(`input[name='${fieldName.replace(' ', '')}']:checked`);\r\n const selectedOptions = Array.from(checkboxElements).map(element => element.value);\r\n return selectedOptions;\r\n }\r\n getDownloadLink(DocumentPath){\r\n const basePath = config.img_url+ DocumentPath;\r\n link.href=basePath;\r\n return basePath; \r\n }\r\n downloadFile(DocumentPath){\r\n const downloadfile = config.img_url +DocumentPath;\r\n const link = document.createElement('a');\r\n link.href = downloadfile;\r\n link.download = this.DocumentPath;\r\n link.target = '_blank';\r\n link.click();\r\n }\r\n detached(){\r\n document.removeEventListener('keydown', this.handleKeyPress);\r\n }\r\n detached(){\r\n document.removeEventListener('click', this.handleDocumentClick);\r\n }\r\n handleTextareaBlur(){\r\n if (!this.Reason.trim()) {\r\n this.reasonErrorMessage = true;\r\n } else {\r\n this.reasonErrorMessage = false;\r\n }\r\n }\r\n handleDocumentClick = (event) => {\r\n if (event.target == this.specializationInput) {\r\n this.reasonErrorMessage = false; // Hide the error message when clicking outside the textarea\r\n }\r\n };\r\n \r\n}\r\n","import {inject,bindingMode,bindable } from 'aurelia-framework';\r\nimport {DialogController} from 'aurelia-dialog';\r\nimport { DialogService } from 'aurelia-dialog';\r\nimport flatpickr from \"flatpickr\";\r\nimport {LeavemanagementService} from \"../../../shared/services/leavemanagementservice\";\r\nimport {JwtService} from \"../../../shared/services/jwtservice\";\r\nimport {ValidationControllerFactory, ValidationRules} from \"aurelia-validation\";\r\nimport {ConfirmationModal} from \"../../leavemanagement/useralertpopup/noofdaysconfirmation\";\r\nimport {config} from \"../../../shared/services/config\";\r\nimport {HeaderService} from \"../../../shared/services/headerservice\";\r\nimport { Router } from 'aurelia-router';\r\nimport {Viewtimeoffrequestcomponent} from \"../../leavemanagement/viewtimeoffrequest/viewtimeoffrequestcomponent\";\r\nimport {LoginService} from \"../../../shared/services/loginservice\";\r\n\r\n\r\n\r\n@inject(DialogController,JwtService,LeavemanagementService,HeaderService,ValidationControllerFactory,DialogService,Router,LoginService)\r\nexport class AssignTimeOffComponent {\r\n @bindable({\r\n defaultBindingMode: bindingMode.twoWay\r\n }) FromDate;\r\n @bindable({\r\n defaultBindingMode: bindingMode.twoWay\r\n }) ToDate;\r\n FromDate = null;\r\n ToDate = null;\r\n selectedFrom = \"full\";\r\n selectedTo = \"fullto\";\r\n selectedEmployees = [];\r\n EmployeeListIDs = [];\r\n showEmpDropdown = false;\r\n showDropdown = false;\r\n selectedRadio = '1';\r\n showToDateRadios = true;\r\n notifyemails = [];\r\n topicsPageSize = config. grid_PazeSize;\r\n pageSize=config.grid_PazeSize;\r\n showExperience = false;\r\n\r\n constructor(controller,JwtService,LeavemanagementService,headerservice,controllerFactory,dialogService,router,loginservice) {\r\n\r\n this.controller = controller;\r\n this.jwtService= JwtService;\r\n this.empid = this.jwtService.getEmployeeId();\r\n this.leavemanagementService = LeavemanagementService;\r\n this.selectedEmployees = [];\r\n this.FromDate = null;\r\n this.ToDate = null;\r\n this.headerservice = headerservice;\r\n this.dialogService = dialogService;\r\n this.controllerFactory = controllerFactory.createForCurrentScope();\r\n this.router = router;\r\n this.loginservice = loginservice;\r\n\r\n\r\n ValidationRules\r\n .ensure('Department').required().withMessage('The department field is required.')\r\n .ensure('selectedName').required().withMessage('The employee name field is required.')\r\n .ensure('LeaveType').required().withMessage('The time off type field is required.')\r\n .ensure('FromDate').required().withMessage('From date field is required.')\r\n .ensure('ToDate').required().withMessage('To date field is required.')\r\n .ensure('Reasonfortimeoff').required().withMessage('Reason for time off field is required.')\r\n .minLength(5)\r\n .withMessage('Reason for time off must have at least 5 characters.')\r\n .maxLength(200)\r\n .withMessage('Reason for time off cannot exceed 200 characters.')\r\n .ensure('totaldays').required().matches(/^\\d+$/)\r\n .on(this);\r\n }\r\n validateEmails() {\r\n if (this.emails && this.emails.trim() !== '') {\r\n const emails = this.emails.split(',');\r\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.(com|co|in|org|cc|net)$/;\r\n const invalidEmails = [];\r\n for (const email of emails) {\r\n const trimmedEmail = email.trim();\r\n if (!emailRegex.test(trimmedEmail)) {\r\n invalidEmails.push(trimmedEmail);\r\n }\r\n }\r\n if (invalidEmails.length > 0 || (emails.length > 1 && this.emails.indexOf(',') === -1)) {\r\n this.specifyemailerror = 'Invalid email address and Email(s) should be separated by commas';\r\n return false;\r\n }\r\n }\r\n this.specifyemailerror = '';\r\n return true;\r\n }\r\n attached() {\r\n // if(this.jwtService.getToken() === undefined){\r\n // this.loginservice.purgeAuth();\r\n // this.router.navigateToRoute('login')\r\n //\r\n // }\r\n this.empid = this.jwtService.getEmployeeId();\r\n flatpickr(this.FromdatePicker, {\r\n closeOnSelect: true,\r\n dateFormat: 'd-m-Y',\r\n minDate: 'today',\r\n maxDate: null,\r\n defaultDate: this.FromDate,\r\n enableTime: false,\r\n enableSeconds: false,\r\n time_24hr: false,\r\n minuteIncrement: 1,\r\n hourIncrement: 1,\r\n timeFormat: 'h:i K',\r\n clickOpens:false,\r\n onClose: function (selectedDates, dateStr, instance) {\r\n this.FromDate = dateStr;\r\n }\r\n });\r\n\r\n this.FromcalendarIcon.addEventListener('click', () => {\r\n this.FromdatePicker._flatpickr.open();\r\n });\r\n\r\n flatpickr(this.TodatePicker, {\r\n closeOnSelect: true,\r\n dateFormat: 'd-m-Y',\r\n minDate: 'today',\r\n maxDate: null,\r\n enableTime: false,\r\n enableSeconds: false,\r\n time_24hr: false,\r\n minuteIncrement: 1,\r\n hourIncrement: 1,\r\n timeFormat: 'h:i K',\r\n clickOpens:false,\r\n onClose: function (selectedDates, dateStr, instance) {\r\n this.ToDate = dateStr;\r\n }\r\n });\r\n this.TocalendarIcon.addEventListener('click', () => {\r\n this.TodatePicker._flatpickr.open();\r\n });\r\n\r\n this.headerservice.dynamicHeader(this.empid)\r\n .then(data => {\r\n this.departmentId = data.DepartmentId;\r\n this.statusVal = 'ACT';\r\n this.leavemanagementService.GetEmployeesDepartmentDropdown(this.empid,this.statusVal)\r\n .then(data => {\r\n this.departments= data;\r\n });\r\n });\r\n this.leavemanagementService.dynamicHeaderLogo(this.empid)\r\n .then(data => {\r\n this.employeedetails = data;\r\n this.dynamicLogo=config.img_url + data.LoginLogo;\r\n this.userPhoto=config.api_img_url + data.PhotoPath;\r\n this.designation = data.Designation;\r\n });\r\n }\r\n // cancel() {\r\n // this.router.navigate('leavemanagementadmin');\r\n // }\r\n selectemployee(data){\r\n this.statusVal = 'ACT';\r\n this.updateddepartmentid = data;\r\n this.leavemanagementService.GetEmployeesNameDropdown(this.empid,this.statusVal,this.updateddepartmentid)\r\n .then(data =>{\r\n this.employeeropdowns = data;\r\n });\r\n }\r\n selecteleavetype(data){\r\n const selectedname = data;\r\n this.EmpName=data;\r\n console.log(data);\r\n this.leavemanagementService.GetLeaveTypeDropdown(selectedname).then(data =>{\r\n this.assignleavetypes = data;\r\n });\r\n }\r\n handleSelectChange() {\r\n this.balanceleave(this.LeaveType);\r\n this.calculateNoOfDays();\r\n }\r\n balanceleave(data){\r\n this.typeid = data;\r\n this.leavemanagementService.GetMyLeaveBalance(this.empid)\r\n .then(data => {\r\n this.leavesummery= data;\r\n const selectedLeaveTypes = this.leavesummery.filter(item => item.LeaveTypeID == this.LeaveType);\r\n if (selectedLeaveTypes.length > 0) {\r\n const selectedLeaveType = selectedLeaveTypes[0];\r\n this.balanceLeave = selectedLeaveType.BalanceLeave;\r\n }\r\n });\r\n this.leaveapplictionID = 0;\r\n this.leavemanagementService.GetPastLeavesData(this.EmpName,this.leaveapplictionID).then(data=>{\r\n this.pastleaves = data;\r\n })\r\n }\r\n calculateNoOfDays(){\r\n this.showExperience = true;\r\n if (this.FromDate === this.ToDate) {\r\n this.showToDateRadios = false;\r\n } else {\r\n this.showToDateRadios = true;\r\n }\r\n const selectedtype = this.LeaveType;\r\n const leave = this.leavesummery;\r\n leave.some((item) => {\r\n const summeryID = item.LeaveTypeID;\r\n const isEqual = summeryID == selectedtype;\r\n if (isEqual) {\r\n this.balanceLeave = item.BalanceLeave;\r\n return true;\r\n }\r\n return false;\r\n });\r\n if(this.selectedFrom === 'full'){\r\n this.FromFull = true;\r\n }else{\r\n this.FromFull = false;\r\n }\r\n if(this.selectedFrom === 'half'){\r\n this.FromHalf = true;\r\n }else{\r\n this.FromHalf = false;\r\n }\r\n if(this.selectedTo === 'fullto'){\r\n this.ToFull = true;\r\n }else{\r\n this.ToFull = false;\r\n }\r\n if(this.selectedTo === 'halfto'){\r\n this.ToHalf = true;\r\n }else{\r\n this.ToHalf = false;\r\n }\r\n if (this.ToDate) {\r\n this.showExperience = true;\r\n } else {\r\n this.showExperience = false;\r\n }\r\n let totaldays = {\r\n EmployeeID : this.empid,\r\n FromDateTime : this.FromDate,\r\n ToDateTime : this.ToDate,\r\n FromFullDayIND : this.FromFull,\r\n FromHalfDayIND : this.FromHalf,\r\n ToFullDayIND : this.ToFull,\r\n ToHalfDayIND : this.ToHalf,\r\n LeaveTypeId : this.LeaveType,\r\n };\r\n this.leavemanagementService.GetNoOfDays(totaldays)\r\n .then(data => {\r\n this.noofdays = data;\r\n if (data !== null) {\r\n const result2 = data.match(/[a-zA-Z]+/g);\r\n this.stringData = result2 ? result2.join(\" \") : \"\";\r\n const result = data.match(/[\\d.]+/);\r\n this.totaldays = result ? parseFloat(result[0]) : 0;\r\n }\r\n if (this.totaldays > this.balanceLeave) {\r\n const message = 'you don\\'t have sufficient leave balance in selected leave type. Do you want to auto adjust balance from other leave types?';\r\n this.dialogService.open({\r\n viewModel: ConfirmationModal,\r\n model: message\r\n }).whenClosed(response => {\r\n if (!response.wasCancelled) {\r\n this.confirm = !response.wasCancelled;\r\n this.leaveconfirm = this.confirm;\r\n } else {\r\n this.notconfirmed = !response.wasCancelled;\r\n this.leavenotconfirm = this.notconfirmed;\r\n }\r\n });\r\n }\r\n });\r\n const From = this.FromDate;\r\n const TO = this.ToDate;\r\n this.applicationid = 0;\r\n // this.EmpName = this.Name;\r\n let otherleavedata = {\r\n EmployeeId : this.EmpName,\r\n DepartmentID:this.departmentId,\r\n LeaveApplicationID : this.applicationid,\r\n Fromdate : this.FromDate,\r\n Todate : this.ToDate,\r\n LoggedInEmployeeId:this.empid\r\n };\r\n this.leavemanagementService.GetOtherLeavedetails(otherleavedata).then(data=>{\r\n this.otherleaves = data;\r\n console.log( this.otherleaves);\r\n });\r\n }\r\n async toggleNotifyFields(checked) {\r\n this.showNotifyFields = checked;\r\n }\r\n onEmailSelected() {\r\n this.selectedRadio = '2';\r\n }\r\n async onEmployeeSelected() {\r\n this.selectedRadio = '1';\r\n if (this.searchQuery) {\r\n this.showEmpDropdown = true;\r\n try {\r\n const response = await this.leavemanagementService.EmployeeNamesForDropdown(this.searchQuery);\r\n const data = await response;\r\n const filterOption = this.searchQuery.toLowerCase();\r\n this.dropdownOptions = data.filter(option => option.EmployeeName.toLowerCase().includes(filterOption));\r\n this.empid = this.jwtService.getEmployeeId();\r\n this.dropdownOptions = this.dropdownOptions.filter(option => option.EmployeeID !== parseInt(this.empid, 10));\r\n if (this.dropdownOptions.length === 0) {\r\n const errorInfo = {\r\n error: {\r\n message: \"No results found\"\r\n }\r\n };\r\n this.NameError = [errorInfo];\r\n } else {\r\n this.NameError = [];\r\n }\r\n } catch (error) {\r\n console.error(error);\r\n }\r\n } else {\r\n this.showEmpDropdown = false;\r\n this.dropdownOptions = [];\r\n }\r\n }\r\n selectEmployee(EmpOption) {\r\n const modifiedOption = {\r\n ...EmpOption,\r\n ID: EmpOption.EmployeeID\r\n };\r\n this.searchQuery = modifiedOption.EmployeeName;\r\n this.showEmpDropdown = false;\r\n this.selectedEmployee = modifiedOption;\r\n return false;\r\n }\r\n addToSelectedOptions(id) {\r\n let emails = this.emails || '';\r\n if (this.selectedRadio === '1') {\r\n if (!this.searchQuery || this.searchQuery.trim() === '') {\r\n this.employenameerror = \"Employee name is required\";\r\n return;\r\n }\r\n this.leavemanagementService.GetEmployeesForAdd(id).then(data => {\r\n this.Ids = data.EmployeeID;\r\n this.empmail = data.EmailID;\r\n this.EName = data.EmployeeName;\r\n let employeeemail = {\r\n EmailIds: this.empmail,\r\n PersonID: this.Ids,\r\n EmployeeName: this.EName,\r\n };\r\n const existingEmployee = this.selectedEmployees.find(emp => emp.PersonID === id);\r\n if (existingEmployee) {\r\n this.employenameerror = \"Employee name already exists\";\r\n return;\r\n }\r\n this.EmployeeListIDs.push(employeeemail);\r\n this.selectedEmployees.push(employeeemail);\r\n this.searchQuery = '';\r\n this.employenameerror = '';\r\n });\r\n } else if (this.selectedRadio === '2') {\r\n if (this.validateEmails()) {\r\n const existingEmail = this.selectedEmployees.find(emp => emp.EmailIds === emails);\r\n if (existingEmail) {\r\n this.specifyemailerror = \"Email id already exists\";\r\n return;\r\n }\r\n if (emails.trim() !== '') {\r\n const emailEntry = {\r\n PersonID: -1,\r\n EmailIds: emails\r\n };\r\n this.newmail = emailEntry;\r\n this.notifyemails.push(this.newmail);\r\n this.EmployeeListIDs.push(...this.notifyemails);\r\n this.selectedEmployees.push(emailEntry);\r\n this.emails = '';\r\n } else {\r\n this.specifyemailerror = \"Specify email is required\";\r\n return;\r\n }\r\n this.employenameerror = '';\r\n this.specifyemailerror = '';\r\n this.validatemessage = '';\r\n }\r\n }\r\n }\r\n deleteEmployee(emp) {\r\n const index = this.selectedEmployees.indexOf(emp);\r\n if (index !== -1) {\r\n this.selectedEmployees.splice(index, 1);\r\n this.EmployeeListIDs.splice(index, 1);\r\n }\r\n const deletedIds = emp.EmployeeID;\r\n this.EmployeeListIDs = this.EmployeeListIDs.filter(id => id !== deletedIds);\r\n this.Ids = this.EmployeeListIDs;\r\n }\r\n handleFileSelect(files) {\r\n // const maxSizeInBytes = 2 * 1024 * 1024; // 2MB\r\n\r\n const file = files[0];\r\n this.file = file;\r\n let reader = new FileReader();\r\n reader.readAsDataURL(file);\r\n this.DocumentName = file.name;\r\n reader.onload = () => {\r\n this.file = reader.result;\r\n };\r\n\r\n // if (file && file.size > maxSizeInBytes) {\r\n // this.uploadErrors = [{ error: { message: 'File size exceeds 2MB limit.' } }];\r\n // // Optionally, you can reset the file input to clear the selected file\r\n // // this.upload = null;\r\n // } else {\r\n // // Clear any previous error messages\r\n // this.uploadErrors = [];\r\n // }\r\n }\r\n openFileDialog() {\r\n document.getElementById('attachments').click();\r\n }\r\n removeFile() {\r\n this.file = null;\r\n this.DocumentName = '';\r\n const fileInput = document.getElementById('attachments');\r\n if (fileInput) {\r\n fileInput.value = '';\r\n }\r\n }\r\n\r\n save() {\r\n event.preventDefault();\r\n if (this.leaveconfirm === true) {\r\n this.userconfirmation = true;\r\n }\r\n if(this.leavenotconfirm === false) {\r\n this.userconfirmation = false;\r\n }\r\n const refreshEvent = new CustomEvent('refreshCTC');\r\n this.controllerFactory.validate()\r\n .then(result => {\r\n if (result.valid) {\r\n if (this.stringData && this.stringData.length > 1) {\r\n return;\r\n }\r\n if( this.notifyind === true && this.EmployeeListIDs.length === 0 && this.notifyemails.length === 0) {\r\n this.validatemessage = \"Atleast one peer is required\";\r\n }\r\n else {\r\n this.validatemessage = \"\";\r\n let data = {\r\n EmployeeID: this.selectedName,\r\n LeaveTypeId: this.LeaveType,\r\n DepartmentID: this.Department,\r\n FromDateTime:this.FromDate,\r\n ToDateTime:this.ToDate,\r\n NoofDays:this.totaldays,\r\n ReasonforLeave:this.Reasonfortimeoff,\r\n FromFullDayIND:this.FromFull,\r\n FromHalfDayIND :this.FromHalf,\r\n ToFullDayIND:this.ToFull,\r\n ToHalfDayIND:this.ToHalf,\r\n DocumentPath:this.file,\r\n DocumentName:this.DocumentName,\r\n NotifyEmployeeList:this.EmployeeListIDs,\r\n NotifyPeersIND : this.notifyind,\r\n MessageToPeers : this.comments,\r\n LeaveApplicationID:this.LeaveApplicationID,\r\n Userconfirmation : this.userconfirmation,\r\n LoginEmployeeID: this.empid,\r\n };\r\n console.log(data);\r\n this.leavemanagementService.SaveAssignLeave(data).then((response)=>{\r\n this.assignleaveID = response;\r\n this.openDialogBox();\r\n this.selectedName = '';\r\n this.Department = '';\r\n this.LeaveType = '';\r\n this.FromDate = '';\r\n this.ToDate = '';\r\n this.Reasonfortimeoff = '';\r\n this.FromDate = '';\r\n this.ToDate = '';\r\n this.totaldays = '';\r\n this.FromFull = '';\r\n this.half = '';\r\n this.ToFull = '';\r\n this.halfto = '';\r\n this.file = '';\r\n this.DocumentName = '';\r\n this.EmployeeListIDs = [];\r\n this.stringData = '';\r\n this.notifyind = '';\r\n this.comments = '';\r\n this.selectedEmployees = [];\r\n this.notifyemails = [];\r\n this.searchQuery = '';\r\n this.balanceLeave = '';\r\n })\r\n }\r\n }\r\n });\r\n }\r\n openDialogBox() {\r\n this.dialogService.open({\r\n title: 'Saved Data',\r\n viewModel: Viewtimeoffrequestcomponent,\r\n model: {\r\n viewdata: this.assignleaveID,\r\n },\r\n }).then(dialogResult => {\r\n });\r\n }\r\n\r\n cancel(){\r\n this.router.navigateToRoute('employeetimeoffdetails');\r\n }\r\n}","import { DialogController } from 'aurelia-dialog';\r\nexport class Confirmcancelmodel {\r\n static inject = [DialogController,Element];\r\n isDragging = false;\r\n dialog;\r\n\r\n constructor(controller) {\r\n this.controller = controller;\r\n document.addEventListener('keydown', this.handleKeyPress);\r\n }\r\n activate(data) {\r\n this.AllDays=data;\r\n }\r\n handleKeyPress = (event) => {\r\n if (event.key === 'Enter') {\r\n this.controller.cancel();\r\n }\r\n };\r\n cancel() {\r\n this.controller.cancel();\r\n }\r\n ok() {\r\n this.controller.ok();\r\n }\r\n startDragging(event) {\r\n if (event.button === 0) {\r\n this.isDragging = true;\r\n this.offsetX = event.clientX - this.dialogElement.getBoundingClientRect().left;\r\n this.offsetY = event.clientY - this.dialogElement.getBoundingClientRect().top;\r\n\r\n window.addEventListener('mousemove', this.drag);\r\n window.addEventListener('mouseup', this.stopDragging);\r\n }\r\n }\r\n\r\n drag = (event) => {\r\n if (this.isDragging) {\r\n const x = event.clientX - this.offsetX;\r\n const y = event.clientY - this.offsetY;\r\n\r\n this.dialogElement.style.left = `${x}px`;\r\n this.dialogElement.style.top = `${y}px`;\r\n }\r\n }\r\n\r\n stopDragging = () => {\r\n this.isDragging = false;\r\n window.removeEventListener('mousemove', this.drag);\r\n window.removeEventListener('mouseup', this.stopDragging);\r\n }\r\n detached() {\r\n document.removeEventListener('keydown', this.handleKeyPress);\r\n }\r\n}\r\n","// Imports\nimport ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___ from \"../../../node_modules/html-loader/dist/runtime/getUrl.js\";\nvar ___HTML_LOADER_IMPORT_0___ = new URL(\"../../images/leaveadmin-banner.jpg\", import.meta.url);\n// Module\nvar ___HTML_LOADER_REPLACEMENT_0___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___);\nvar code = \"\";\n// Exports\nexport default code;","// Imports\nimport ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___ from \"../../../../node_modules/html-loader/dist/runtime/getUrl.js\";\nvar ___HTML_LOADER_IMPORT_0___ = new URL(\"../../../images/loader.gif\", import.meta.url);\nvar ___HTML_LOADER_IMPORT_1___ = new URL(\"../../../images/palmtree.svg\", import.meta.url);\nvar ___HTML_LOADER_IMPORT_2___ = new URL(\"../../../images/leave-calendar-days.svg\", import.meta.url);\n// Module\nvar ___HTML_LOADER_REPLACEMENT_0___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___);\nvar ___HTML_LOADER_REPLACEMENT_1___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_1___);\nvar ___HTML_LOADER_REPLACEMENT_2___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_2___);\nvar code = \"Applied time off(s) are more than balance time off(s). Do you want to proceed on loss of pay for remaining time off(s) ?\\r\\n\";\n// Exports\nexport default code;","// Module\nvar code = \"\\r\\n\";\n// Exports\nexport default code;","// Imports\nimport ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___ from \"../../../../node_modules/html-loader/dist/runtime/getUrl.js\";\nvar ___HTML_LOADER_IMPORT_0___ = new URL(\"../../../images/leave-calendar-days.svg\", import.meta.url);\n// Module\nvar ___HTML_LOADER_REPLACEMENT_0___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___);\nvar code = \"\\r\\n\";\n// Exports\nexport default code;","// Module\nvar code = \"\\r\\n\";\n// Exports\nexport default code;"],"names":[],"sourceRoot":""}