{"version":3,"file":"app-666f3de0.d152cf98c45d962fa693.bundle.js","mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAYA;AAAA;AATA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;AC3HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAWA;AAAA;AATA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAYA;AATA;AACA;AACA;AACA;AACA;AAGA;AAKA;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;AAEA;AACA;AAGA;AACA;AACA;AAEA;AACA;AAEA;AAAA;AAGA;AAEA;AACA;AAIA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;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;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAEA;AAEA;AACA;AACA;AACA;AACA;AAGA;;;;;;;;;;;;;;;;;;;;;;AC9LA;AACA;AACA;AACA;AACA;AACA;AAEA;AAIA;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;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AClDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAkBA;AAAA;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAyJA;AACA;AACA;AACA;AACA;AAAA;AAoEA;AACA;AACA;AACA;AAAA;AAhOA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;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;AAEA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;;AAEA;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;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAYA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA;AACA;AACA;AACA;AAEA;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;AAGA;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;AAEA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AAAA;AAEA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAEA;AACA;AAGA;AACA;AAEA;AAEA;AACA;AAEA;AAAA;AAGA;AAMA;;;;;;;;;;;AC/ZA;AACA;AACA;AACA;;;;;;;;;;;;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACXA;AACA;AACA;AACA;;;;;;;;;;;;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sources":["webpack://HRMSPortal/./src/components/organization/organizationchart/orgchartcomponent.js","webpack://HRMSPortal/./src/components/organization/organizationcomponent.js","webpack://HRMSPortal/./src/components/organization/orgchartpage/chartpage.js","webpack://HRMSPortal/./src/components/organization/ptoannouncement/ptoannouncementcomponent.js","webpack://HRMSPortal/./src/components/organization/organizationchart/orgchartcomponent.html","webpack://HRMSPortal/./src/components/organization/organizationcomponent.html","webpack://HRMSPortal/./src/components/organization/orgchartpage/chartpage.html","webpack://HRMSPortal/./src/components/organization/ptoannouncement/ptoannouncementcomponent.html"],"sourcesContent":["import { inject } from 'aurelia-framework';\r\nimport {App} from \"../../../app\";\r\nimport {Router} from 'aurelia-router';\r\nimport {OrganizationService} from \"../../../shared/services/organizationservice\";\r\nimport {DialogController} from \"aurelia-dialog\";\r\nimport {JwtService} from \"../../../shared/services/jwtservice\";\r\nimport {LoginService} from \"../../../shared/services/loginservice\";\r\n\r\n@inject(App,Router,OrganizationService,DialogController,JwtService,LoginService)\r\n\r\nexport class OrgChartPage{\r\n formData={};\r\n treeChart = [];\r\n managerChild = [];\r\n ManagerId = '';\r\n employeeChildTree = [];\r\n filteredResults = [];\r\n employeeTree = [];\r\n alldata = [];\r\n routerView = \"main-content\";\r\n constructor(App,router,organizationService,DialogController,jwtService,loginService) {\r\n this.app=App;\r\n this.router = router;\r\n this.organizationService = organizationService;\r\n this.controller = DialogController;\r\n this.ManagerId = 637;\r\n this.jwtService = jwtService;\r\n this.loginService = loginService;\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.organizationService.GetEmployeemasterDetails().then(data => {\r\n this.alldata = data;\r\n const filteredItems = this.alldata.filter(item => item.ReportingManagerID === this.ManagerId);\r\n const list = document.createElement('ul');\r\n filteredItems.forEach((itemData, index) => {\r\n const item = document.createElement('li');\r\n item.classList.add(`dynamic-li-${index}`);\r\n const container = document.createElement('div');\r\n const image = document.createElement('img');\r\n image.src = itemData.PhotoPath;\r\n image.alt = itemData.EmployeeName;\r\n image.width = '20';\r\n image.height = '20';\r\n container.appendChild(image);\r\n const name = document.createTextNode(itemData.EmployeeName);\r\n container.appendChild(name);\r\n item.appendChild(container);\r\n container.addEventListener('click', () => {\r\n item.classList.toggle('ui-state-active');\r\n const clickedEmployee = item.textContent;\r\n const filteredID = this.alldata.filter(item => item.EmployeeName === clickedEmployee);\r\n try{\r\n const EmpID = filteredID[0].EmployeeID;\r\n const currentEmpName = filteredID[0].EmployeeName;\r\n const filtered = {id:EmpID,name:currentEmpName};\r\n this.showChild(filtered);\r\n }catch(error){\r\n\r\n }\r\n });\r\n list.appendChild(item);\r\n });\r\n const ulClass = `dynamic-ul-${Date.now()}`;\r\n list.classList.add(ulClass);\r\n const container = document.querySelector('#list-container');\r\n container.innerHTML = '';\r\n container.appendChild(list);\r\n });\r\n }\r\n async showChild(emp) {\r\n let nestedCounter = 0;\r\n const childTree = this.alldata.filter(item => item.ReportingManagerID === emp.id);\r\n const nestedList = document.createElement('ul');\r\n const nestedListClass = `nested-list-${emp.id}`;\r\n nestedList.classList.add(nestedListClass);\r\n childTree.forEach((itemData, index) => {\r\n const item = document.createElement('li');\r\n const liClass = `nested-li-${emp.id}-${index}`;\r\n item.classList.add(liClass);\r\n const container = document.createElement('div');\r\n const image = document.createElement('img');\r\n image.src = itemData.PhotoPath;\r\n image.alt = itemData.EmployeeName;\r\n image.width = '20';\r\n image.height = '20';\r\n container.appendChild(image);\r\n const name = document.createTextNode(itemData.EmployeeName);\r\n container.appendChild(name);\r\n item.appendChild(container);\r\n container.addEventListener('click', () => {\r\n item.classList.toggle('ui-state-active');\r\n const clickedEmployee = item.textContent;\r\n const filteredID = this.alldata.filter(item => item.EmployeeName === clickedEmployee);\r\n try {\r\n const EmpID = filteredID[0].EmployeeID;\r\n const currentEmpName = filteredID[0].EmployeeName;\r\n const filtered = { id: EmpID, name: currentEmpName };\r\n this.showChild(filtered);\r\n } catch (error) {\r\n\r\n }\r\n });\r\n nestedList.appendChild(item);\r\n });\r\n const listItems = document.querySelectorAll('li');\r\n let container;\r\n listItems.forEach(listItem => {\r\n if (listItem.textContent === emp.name) {\r\n container = listItem;\r\n }\r\n });\r\n container.appendChild(nestedList);\r\n }\r\n cancel() {\r\n this.controller.cancel();\r\n }\r\n goBack(){\r\n this.router.navigateToRoute('organization');\r\n }\r\n}\r\n","import {inject} from 'aurelia-framework';\r\nimport {Router} from 'aurelia-router';\r\nimport {DialogService} from 'aurelia-dialog';\r\nimport { OrganizationService } from '../../shared/services/organizationservice';\r\nimport { config } from '../../shared/services/config';\r\nimport {OrgChartPage} from \"./organizationchart/orgchartcomponent\";\r\nimport { JwtService } from '../../shared/services/jwtservice';\r\nimport { constants } from '../../shared/services/constants';\r\nimport {LoginService} from \"../../shared/services/loginservice\";\r\n\r\n@inject(OrganizationService,DialogService,Router,JwtService,LoginService)\r\nexport class OrganizationComponent {\r\n pageSize = config.grid_PazeSize;\r\n policiesdata = [];\r\n $displayData = [];\r\n originalData = [];\r\n showNoRecordsFound = false;\r\n announcements = [];\r\n AnnouncementsSiteMapId=constants.announcementsSitemapId;\r\n PoliciesSiteMapId=constants.policiessitemapId;\r\n\r\n constructor(OrganizationService,DialogService,router,jwtService,loginservice){\r\n this.organizationService = OrganizationService;\r\n this.dialogService = DialogService;\r\n this.router = router;\r\n this.jwtService = jwtService;\r\n this.loginservice = loginservice;\r\n\r\n\r\n }\r\n\r\n empid= window.localStorage['EmployeeID'];\r\n searchText = \"\";\r\n\r\n async activate() {\r\n try {\r\n const data = await this.organizationService.GetPoliciesData(this.empid);\r\n this.policiesdata = data;\r\n this.originalData = data.slice();\r\n this.applySearchFilter();\r\n } catch (error) {\r\n console.error(\"Error fetching policies data:\", error);\r\n }\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.organization');\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.organization .sidebar-sub .announcement 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 const searchInput = document.querySelector('input[name=\"Find Employee\"]');\r\n searchInput.addEventListener('input', () => {\r\n this.searchTextChanged();\r\n });\r\n this.organizationService.GetPoliciesData(this.empid).then(data => {\r\n this.policiesdata = data;\r\n this.applySearchFilter();\r\n this.Files = this.policiesdata.map(option => option.Path);\r\n if ( this.policiesdata.map(option => option.Path)) {\r\n this.file = this.policiesdata.map(option => option.Path);\r\n this.DocumentName = this.policiesdata.map(option => option.Path);\r\n }\r\n });\r\n this.organizationService.GetEventTypeDropdown().then(data => {\r\n this.eventTypes = data;\r\n });\r\n this.EventID = 0;\r\n this.organizationService.GetAnnouncementsData(this.EventID)\r\n .then(data => {\r\n this.announcements = data;\r\n })\r\n\r\n\r\n this.addToRecentItems();\r\n this.PoliciesaddToRecentItems();\r\n }\r\n\r\n addToRecentItems(){ \r\n this.organizationService.AddToRecentItems(this.empid,this.AnnouncementsSiteMapId).then(data=>\r\n {\r\n // window.location.reload();\r\n \r\n });\r\n }\r\n\r\n PoliciesaddToRecentItems(){ \r\n this.organizationService.AddToRecentItems(this.empid,this.PoliciesSiteMapId).then(data=>\r\n {\r\n \r\n });\r\n }\r\n\r\n getFileNameFromPath(filePath) {\r\n const lastIndex = filePath.lastIndexOf('/');\r\n const fileName = filePath.substring(lastIndex + 1);\r\n return fileName;\r\n }\r\n downloadNewFile(filePath) {\r\n fetch(filePath)\r\n .then(response => response.blob())\r\n .then(blob => {\r\n const url = window.URL.createObjectURL(blob);\r\n const link = document.createElement('a');\r\n const downloadUrl = config.img_url + filePath;\r\n link.href = downloadUrl;\r\n link.download = downloadUrl;\r\n link.target = '_blank';\r\n link.click();\r\n window.URL.revokeObjectURL(url);\r\n })\r\n .catch(error => {\r\n console.error('Error downloading file:', error);\r\n });\r\n }\r\n applySearchFilter() {\r\n if (!this.searchText) {\r\n this.$displayData = this.originalData.slice();\r\n this.pageSize = config.grid_PazeSize;\r\n } else {\r\n this.$displayData = this.policiesdata.filter((policy) => {\r\n return policy.PolicyName.toLowerCase().includes(this.searchText.toLowerCase());\r\n });\r\n }\r\n this.showNoRecordsFound = this.$displayData.length === 0;\r\n }\r\n searchTextChanged() {\r\n this.applySearchFilter();\r\n if(this.searchText.length === 0){\r\n this.pageSize = config.grid_PazeSize;\r\n this.attached();\r\n }\r\n }\r\n downloadFile(path) {\r\n if(path){\r\n const downloadUrl = config.img_url + path;\r\n const link = document.createElement('a');\r\n link.href = downloadUrl;\r\n link.target = '_blank';\r\n link.download = downloadUrl;\r\n link.click();\r\n\r\n } else {\r\n this.validationmessage = 'Path is empty. Cannot download file.';\r\n console.log(this.validationmessage)\r\n }\r\n }\r\n filterAnnouncements(eventid) {\r\n const updatedid = eventid;\r\n if(eventid === 'Select'){\r\n this.EventID = 0;\r\n this.organizationService.GetAnnouncementsData(this.EventID)\r\n .then(data => {\r\n this.announcements = data;\r\n })\r\n }\r\n this.organizationService.GetAnnouncementsData(eventid)\r\n .then(data => {\r\n this.announcements = data;\r\n })\r\n }\r\n openOrgModal(){\r\n this.dialogService.open({viewModel:OrgChartPage,lock: false})\r\n .whenClosed((feedback) => {\r\n if(!feedback.wasCancelled){\r\n }else{\r\n this.searchTerm = '';\r\n this.employeeTree = [];\r\n }\r\n });\r\n }\r\n\r\n \r\n}\r\n","import { inject } from 'aurelia-framework';\r\nimport OrgChart from '@balkangraph/orgchart.js';\r\nimport {App} from \"../../../app\";\r\nimport {Router} from 'aurelia-router';\r\nimport {JwtService} from \"../../../shared/services/jwtservice\";\r\nimport {LoginService} from \"../../../shared/services/loginservice\";\r\n\r\n@inject(App,Router,JwtService,LoginService)\r\n\r\nexport class ChartPage{\r\n formData={}\r\n constructor(App,router,jwtService,loginService) {\r\n this.app=App;\r\n this.router = router;\r\n this.jwtService = jwtService;\r\n this.loginService = loginService;\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 const chartData = JSON.parse(localStorage.getItem('chartData'));\r\n let chart = new OrgChart(document.getElementById(\"orgChart\"), {\r\n pan: false,\r\n draggable: false,\r\n zoom: false,\r\n levelSeparation: 60,\r\n siblingSeparation: 20,\r\n nodeSpacing: 10,\r\n nodeBinding: {\r\n field_0: \"name\",\r\n field_1:\"departmentName\",\r\n field_2:\"positionLevel\",\r\n img_0: \"img\",\r\n\r\n },\r\n nodes: chartData,\r\n css: {\r\n \"node\": {\r\n \"padding\": \"10px\",\r\n \"line-height\": \"1.5\"\r\n }\r\n }\r\n });\r\n }\r\n goBack(){\r\n this.router.navigateToRoute('organizationchart');\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 } from 'aurelia-dialog';\r\nimport {DialogService} from 'aurelia-dialog';\r\nimport {LeavemanagementService} from \"../../../shared/services/leavemanagementservice\";\r\nimport * as XLSX from 'xlsx';\r\nimport {config} from '../../../shared/services/config';\r\nimport { constants } from '../../../shared/services/constants';\r\nimport Scrollbar from 'smooth-scrollbar';\r\nimport {LoginService} from \"../../../shared/services/loginservice\";\r\nimport {Router} from 'aurelia-router';\r\nimport ExcelJS from 'exceljs';\r\nimport saveAs from 'file-saver';\r\nimport {ValidationControllerFactory,ValidationRules} from \"aurelia-validation\";\r\nimport { autoinject, observable } from 'aurelia-framework';\r\nimport {DashboardService} from \"../../../shared/services/dashboardservice\";\r\n\r\n\r\n@inject(DialogController,JwtService,LeavemanagementService,DialogService,Router,LoginService,ValidationControllerFactory,DashboardService,Element)\r\nexport class PTOAnnouncement{\r\n pageSize = config.grid_PazeSize;\r\n searchTerm = '';\r\n search = '';\r\n showTable = false;\r\n FromDate = null;\r\n ToDate = null;\r\n isLoading = false;\r\n showEmployeeDropdown = false;\r\n FavoritesExist = false;\r\n Successmessages=false;\r\n dateDifferenceError = false;\r\n sitemapId=constants.ptoannouncementsitemapid;\r\n showDropdown = false;\r\n filteredEmployeesSummery = [];\r\n \r\n\r\n constructor(controller,JwtService,LeavemanagementService,DialogService,loginservice,router,controllerFactory,DashboardService,element){\r\n this.controller = controller;\r\n this.controllerFactory = controllerFactory.createForCurrentScope();\r\n\r\n this.jwtService= JwtService;\r\n this.dialogService = DialogService;\r\n this.empid = this.jwtService.getEmployeeId();\r\n this.leavemanagementService = LeavemanagementService;\r\n this.router = router;\r\n this.loginservice = loginservice;\r\n this.dashboardService = DashboardService;\r\n\r\n\r\n\r\n }\r\n active(){\r\n const searchButton = document.getElementById('search-button');\r\n searchButton.addEventListener('click', this.handleSearch);\r\n }\r\n async attached(){\r\n document.addEventListener('click', this.handleDocumentClick);\r\n const windowWidth = window.innerWidth;\r\n if (windowWidth <= 1280) {\r\n Scrollbar.init(document.querySelector('.disable-desktop-scroll'));\r\n }\r\n function formatDateWithLeadingZero(date) {\r\n const day = date.getDate();\r\n const month = date.getMonth() + 1; // Adding 1 because getMonth() returns zero-based month index\r\n const year = date.getFullYear();\r\n const formattedDay = day.toString().padStart(2, '0');\r\n const formattedMonth = month.toString().padStart(2, '0');\r\n return `${formattedDay}-${formattedMonth}-${year}`;\r\n }\r\n // Fetch the server's current date\r\n // Fetch the server's current date\r\n this.dashboardService.GetServerCurrentDate(this.empid)\r\n .then(data => {\r\n const apiDatetimeStr = data.CurrentDate;\r\n this.apiDatetime = new Date(apiDatetimeStr);\r\n\r\n // Use the API server's date as the From date\r\n const fromDate = new Date(apiDatetimeStr);\r\n\r\n flatpickr(this.datePicker, {\r\n closeOnSelect: true,\r\n dateFormat: 'd-m-Y',\r\n minDate: null,\r\n maxDate: null,\r\n defaultDate: fromDate, // Set default date to API server's date\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.From = dateStr; // Update the From date when selected\r\n }\r\n\r\n });\r\n this.calendarIcon.addEventListener('click', () => {\r\n this.datePicker._flatpickr.open();\r\n });\r\n\r\n this.FDate = formatDateWithLeadingZero(fromDate);\r\n this.From = this.FDate;\r\n })\r\n .catch(error => {\r\n console.error(\"Error fetching server current date:\", error);\r\n // Handle error if necessary\r\n });\r\n\r\n const toDate = new Date();\r\n toDate.setDate(toDate.getDate()+7);\r\n\r\n this.TDate = formatDateWithLeadingZero(toDate);\r\n this.To = this.TDate;\r\n // flatpickr(this.datePicker, {\r\n // closeOnSelect: true,\r\n // dateFormat: 'd-m-Y',\r\n // minDate: null,\r\n // maxDate: null,\r\n // defaultDate: 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 // this.calendarIcon.addEventListener('click', () => {\r\n // this.datePicker._flatpickr.open();\r\n // });\r\n flatpickr(this.datePickerss, {\r\n closeOnSelect: true,\r\n dateFormat: 'd-m-Y',\r\n minDate: null,\r\n maxDate: null,\r\n defaultDate: toDate,\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.calendarIconEnd.addEventListener('click', () => {\r\n this.datePickerss._flatpickr.open();\r\n });\r\n this.leavemanagementService.DepartmentsForDropdown()\r\n .then(response => {\r\n this.departments = response;\r\n return false;\r\n });\r\n this.allEmployees =await this.leavemanagementService.GetEmployeemasterDetails();\r\n\r\n const timeoff= {\r\n //EmployeeId:this.empid,\r\n From:this.From,\r\n To:this.To\r\n };\r\n this.isLoading = true;\r\n this.leavemanagementService.GetEmployeePTOAnnouncemnt(timeoff).then(data=>\r\n {\r\n this.filteredEmployeesSummery=data.List;\r\n this.isLoading = false;\r\n });\r\n \r\n this.leavemanagementService.GetPersonFavoriteItems(this.empid,this.sitemapId)\r\n .then(data=>{\r\n this.FavoritesExist=data;\r\n });\r\n this.addToRecentItems();\r\n }\r\n detached() {\r\n document.removeEventListener('click', this.handleDocumentClick);\r\n }\r\n\r\n\r\n\r\n handleDocumentClick = (event) => {\r\n const dropdownContainer = this.dropdownContainer;\r\n if (dropdownContainer && !dropdownContainer.contains(event.target)) {\r\n this.showDropdown = false;\r\n }\r\n }\r\n\r\n\r\n async departmentSelected() {\r\n if (this.selectedDepartment !== \"Select\") {\r\n \r\n this.allEmployees = await this.leavemanagementService.GetEmployeeNamesByDepartmentID(this.selectedDepartment);\r\n } else {\r\n \r\n this.allEmployees = [];\r\n }\r\n }\r\n dateSort(a, b, sortOrder) {\r\n let date1 = new Date(a.registered);\r\n let date2 = new Date(b.registered);\r\n if (date1 === date2) {\r\n return 0;\r\n }\r\n if (date1 > date2) {\r\n return 1 * sortOrder;\r\n }\r\n return -1 * sortOrder;\r\n }\r\n nameLength(row) {\r\n return row.Type.length;\r\n }\r\n\r\n popupViewTimeOffRequest(leaveAppId,PhotoPath){\r\n const approveData = {\r\n selectedRecordId : leaveAppId,\r\n PhotoPath:PhotoPath,\r\n };\r\n this.dialogService.open({viewModel: Viewtimeoffrequestcomponent, model:approveData})\r\n }\r\n\r\n async handleSearch() {\r\n if (!this.searchTerm) {\r\n this.filteredResults = [];\r\n this.selectedEmployee = \"\";\r\n return;\r\n }\r\n this.filteredResults = this.allEmployees.filter(employee =>\r\n employee.EmployeeName.toLowerCase().includes(this.searchTerm.toLowerCase())\r\n );\r\n // Check if filteredResults is empty\r\n if (this.filteredResults.length === 0) {\r\n this.selectedEmployee = \"\";\r\n const errorInfo = {\r\n error: {\r\n message: \"Employee not found\"\r\n }\r\n };\r\n this.showNoResultsMessage = [errorInfo];\r\n //this.showNoResultsMessage = true; // Set the flag to display the message\r\n } else {\r\n this.showNoResultsMessage = []; // Reset the flag\r\n }\r\n this.showDropdown = true;\r\n\r\n }\r\n async handleSelection(employee) {\r\n //this.showTree = false;\r\n this.searchTerm = employee.EmployeeName;\r\n this.selectedEmployee = employee;\r\n this.EmployeeError = '';\r\n this.showDropdown = false; // Close the dropdown after selection\r\n }\r\n handleDocumentClick = (event) => {\r\n const dropdownContainer = this.dropdownContainer;\r\n if (dropdownContainer && !dropdownContainer.contains(event.target)) {\r\n this.showDropdown = false;\r\n } };\r\n\r\n\r\n\r\n Search() {\r\n this.showTable = true;\r\n this.errors = null;\r\n this.controllerFactory.validate()\r\n .then(result => {\r\n if (result.valid) {\r\n if (this.From && this.To) {\r\n const fromParts = this.From.split('-');\r\n const toParts = this.To.split('-');\r\n const fromDate = new Date(fromParts[2], fromParts[1] - 1, fromParts[0]);\r\n const toDate = new Date(toParts[2], toParts[1] - 1, toParts[0]);\r\n\r\n const today = new Date(); // Get today's date\r\n const differenceInTime = toDate.getTime() - fromDate.getTime();\r\n const differenceInDays = Math.ceil(differenceInTime / (1000 * 3600 * 24));\r\n if (fromDate > toDate) {\r\n this.dateDifferenceError = \"From date should be less than to date.\";\r\n } else {\r\n this.dateDifferenceError = \"\";\r\n }\r\n }\r\n if(!this.dateDifferenceError) {\r\n this.dateDifferenceError = null;\r\n if (this.selectedEmployee && this.selectedEmployee.EmployeeID) {\r\n const timeoff = {\r\n Fromdate: this.From,\r\n Todate: this.To,\r\n DepartmentID: this.selectedDepartment,\r\n EmployeeId: this.selectedEmployee.EmployeeID\r\n };\r\n this.isLoading = true;\r\n this.leavemanagementService.GetEmployeePTOAnnouncemnt(timeoff).then(data => {\r\n this.filteredEmployeesSummery = data.List;\r\n this.isLoading = false;\r\n this.showNoResultsMessage = [];\r\n this.dateDifferenceError = null;\r\n }).catch(error => {\r\n console.error(\"Error fetching data for selected employee:\", error);\r\n this.isLoading = false;\r\n });\r\n } else {\r\n const timeoff = {\r\n Fromdate: this.From,\r\n Todate: this.To,\r\n DepartmentID: this.selectedDepartment\r\n };\r\n this.isLoading = true;\r\n this.leavemanagementService.GetEmployeePTOAnnouncemnt(timeoff).then(data => {\r\n this.filteredEmployeesSummery = data.List;\r\n this.isLoading = false;\r\n this.showNoResultsMessage = [];\r\n this.dateDifferenceError = null;\r\n }).catch(error => {\r\n console.error(\"Error fetching data:\", error);\r\n this.isLoading = false;\r\n });\r\n }\r\n }\r\n }\r\n }).catch(error => {\r\n console.error(\"Validation error:\", error);\r\n });\r\n }\r\n\r\n\r\n Reset(){\r\n this.selectedDepartment =\"\";\r\n this.searchTerm = ''; \r\n this.selectedEmployee = [];\r\n this.selectedEmployee =\"\";\r\n this.showNoResultsMessage = [];\r\n this.dateDifferenceError = false;\r\n this.attached();\r\n this.FromError=\"\";\r\n this.errors = null; // Clear any validation errors here\r\n // Reset validation state\r\n this.ToError = null; // Reset ToError property as well\r\n }\r\n exportData() {\r\n const data = this.filteredEmployeesSummery;\r\n const filename = 'PTOAnnouncement';\r\n this.exportToExcel(data, filename);\r\n }\r\n exportToExcel(data, filename) {\r\n const headers = {\r\n Employee: 'Employee',\r\n Department: 'Department',\r\n Fromdate: 'From date',\r\n Todate: 'To date',\r\n Amount: 'Amount (in days)',\r\n \r\n };\r\n const filteredData = data.map(employee => {\r\n return {\r\n Employee: employee.EmployeeName,\r\n Department:employee.DepartmentName,\r\n Fromdate: employee.From,\r\n Todate: employee.To,\r\n Amount: employee.Amount\r\n };\r\n });\r\n\r\n const workbook = new ExcelJS.Workbook();\r\n const worksheet = workbook.addWorksheet('Sheet 1');\r\n const headerStyle = {\r\n font: { bold: true, color: { argb: 'FFFFFF' } },\r\n fill: { type: 'pattern', pattern: 'solid', fgColor: { argb: 'FFA07A' } }\r\n };\r\n\r\n const headerRow = worksheet.addRow(Object.values(headers));\r\n headerRow.eachCell(cell => {\r\n cell.font = headerStyle.font;\r\n cell.fill = headerStyle.fill;\r\n });\r\n \r\n filteredData.forEach(employee => {\r\n const dataRow = worksheet.addRow(Object.values(employee));\r\n\r\n });\r\n worksheet.views = [\r\n { showGridLines: true }\r\n ];\r\n workbook.xlsx.writeBuffer().then(buffer => {\r\n const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });\r\n saveAs(blob, `${filename}.xlsx`);\r\n });\r\n }\r\n\r\n addToFavourites(){\r\n this.leavemanagementService.AddToFavourites(this.empid,this.sitemapId).then(data=>\r\n {\r\n\r\n window.location.reload();\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 // window.location.reload();\r\n\r\n });\r\n }\r\n\r\n \r\n \r\n \r\n \r\n}\r\n","// 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/organization-icon.svg\", import.meta.url);\nvar ___HTML_LOADER_IMPORT_1___ = new URL(\"../../images/no-announcement.svg\", import.meta.url);\nvar ___HTML_LOADER_IMPORT_2___ = new URL(\"../../images/preview-open.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 = \"\\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/organization-icon.svg\", import.meta.url);\nvar ___HTML_LOADER_IMPORT_1___ = new URL(\"../../../images/favourite.svg\", import.meta.url);\nvar ___HTML_LOADER_IMPORT_2___ = new URL(\"../../../images/datepicker.svg\", import.meta.url);\nvar ___HTML_LOADER_IMPORT_3___ = new URL(\"../../../images/loader.gif\", 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 ___HTML_LOADER_REPLACEMENT_3___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_3___);\nvar code = \"\\r\\n\\r\\n\";\n// Exports\nexport default code;"],"names":[],"sourceRoot":""}