{"version":3,"file":"app-82f76c9b.d152cf98c45d962fa693.bundle.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAgBA;AAAA;AAAA;AAAA;AAVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAGA;AACA;AACA;AAEA;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;AAIA;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;AAEA;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;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AAEA;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;AAEA;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;AAEA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;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;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AAhZA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAGA;AACA;AAEA;AACA;AAkBA;AAAA;AAAA;AAAA;AAjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAkFA;AACA;AAEA;AACA;AAAA;AACA;AACA;AA4JA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAGA;AACA;AACA;AACA;AA9PA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAIA;AAOA;AAEA;AACA;AAEA;AACA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;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;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;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;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAkBA;AACA;AAEA;AACA;AACA;AACA;;AACA;AAMA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AArTA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAGA;AACA;AAEA;AACA;AAKA;;AAeA;AAAA;AAAA;AAAA;AAnBA;AACA;AACA;AAEA;AAEA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAsMA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAGA;AACA;AACA;AACA;AAjNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AAGA;AACA;AACA;AACA;AACA;AACA;AAKA;AAMA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;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;AACA;AAEA;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;AAEA;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;AAEA;AACA;AACA;AACA;AAiBA;AACA;AAEA;AACA;AACA;;AACA;AAMA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AAtQA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;AClCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAQA;AAAA;AALA;AACA;AACA;AACA;AAsCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAAA;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AApEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAgBA;AACA;AACA;AACA;AACA;AACA;AAiBA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;;;;;;;;;;;AChHA;AACA;AACA;AACA;;;;;;;;;;;;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sources":["webpack://HRMSPortal/./src/components/myprofile/userdefinedfields/userdefined.js","webpack://HRMSPortal/./src/components/myprofile/workexperience/addworkexperience/addworkexperience.js","webpack://HRMSPortal/./src/components/myprofile/workexperience/editworkexperience/editworkexperience.js","webpack://HRMSPortal/./src/components/myprofile/workexperience/workexperience.js","webpack://HRMSPortal/./src/components/myprofile/userdefinedfields/userdefined.html","webpack://HRMSPortal/./src/components/myprofile/workexperience/addworkexperience/addworkexperience.html","webpack://HRMSPortal/./src/components/myprofile/workexperience/editworkexperience/editworkexperience.html","webpack://HRMSPortal/./src/components/myprofile/workexperience/workexperience.html"],"sourcesContent":["import {inject,bindingMode,bindable,customAttribute,Aurelia } from 'aurelia-framework';\r\nimport { ProfileService } from '../../../shared/services/profielservice';\r\nimport { JwtService } from '../../../shared/services/jwtservice';\r\nimport { ValidationControllerFactory, ValidationRules } from 'aurelia-validation';\r\nimport { DOM } from 'aurelia-framework';\r\nimport flatpickr from 'flatpickr';\r\nimport { Router } from 'aurelia-router';\r\nimport {LoginService} from \"../../../shared/services/loginservice\";\r\n\r\n@inject(JwtService, ProfileService, ValidationControllerFactory, Aurelia,Router,LoginService)\r\nexport class Userdefined {\r\n\r\n @bindable dateValue = '';\r\n @bindable name = '';\r\n\r\n inputFields = [];\r\n selectedType = null;\r\n textareas = [];\r\n InputContainer = null;\r\n fieldsFetched = 0;\r\n selectedDate = '';\r\n UserDefinedFormErrors = [];\r\n FieldSuccessmessage = false;\r\n FieldDeletmessage = false;\r\n\r\n constructor(JwtService, ProfileService, ValidationControllerFactory, aurelia,router,loginService) {\r\n this.jwtService = JwtService;\r\n this.profileService = ProfileService;\r\n this.aurelia = aurelia;\r\n this.validationController = ValidationControllerFactory.createForCurrentScope();\r\n this.router = router;\r\n this.loginService = loginService;\r\n this.Employeeid = this.jwtService.getEmployeeId();\r\n }\r\n\r\n async attached(params) {\r\n\r\n\r\n const id = this.router.currentInstruction.queryParams.id;\r\n console.log(id);\r\n if(id != null && id !='' && id !=undefined)\r\n {\r\n this.Employeeid=id;\r\n }\r\n else{\r\n this.Employeeid=this.jwtService.getEmployeeId(); \r\n }\r\n\r\n console.log(this.selectedDate);\r\n const UserDefinedFieldsData = await this.profileService.GetUserDefinedFields(this.Employeeid);\r\n this.userDefiedData = await UserDefinedFieldsData;\r\n this.userDefiedData.filter(response => {\r\n console.log(response);\r\n switch (response.FieldTypeText) {\r\n case \"text\":\r\n const containerDiv = document.createElement('div');\r\n const label = document.createElement('label');\r\n label.textContent = response.FieldName;\r\n if (response.IsMandatory) {\r\n ValidationRules.ensure(response.FieldName).required().on(this.userDefiedData);\r\n const mandatorySymbol = document.createElement('span');\r\n mandatorySymbol.textContent = '*';\r\n mandatorySymbol.style.color = 'red';\r\n label.appendChild(mandatorySymbol);\r\n // Add validation message span element\r\n const validationMessage = document.createElement('span');\r\n validationMessage.className = 'validation-message';\r\n containerDiv.appendChild(validationMessage);\r\n // Add validation rule for the field\r\n this.validationController.addObject(this.userDefiedData, validationRules => {\r\n validationRules.ensure(response.FieldName)\r\n .displayName(response.FieldName)\r\n .required()\r\n .withMessage(`${response.FieldName} is required.`);\r\n });\r\n }\r\n containerDiv.appendChild(label);\r\n const Textinput = document.createElement('input');\r\n Textinput.type = 'text';\r\n Textinput.id = response.ReferenceUDFID;\r\n //Textinput.placeholder = '';\r\n Textinput.value = response.Value;\r\n this.textValue = response.Value;\r\n Textinput.addEventListener('change', (event) => {\r\n this.textValue = event.target.value;\r\n console.log(`Field ${response.FieldTypeID} value: ${this.textValue}`);\r\n // You can store or process the value here\r\n });\r\n containerDiv.appendChild(Textinput);\r\n this.InputContainer.appendChild(containerDiv);\r\n break;\r\n case \"textarea\":\r\n const containerTextarea = document.createElement('div');\r\n const areaLabel = document.createElement('label');\r\n areaLabel.textContent = response.FieldName;\r\n\r\n if (response.IsMandatory) {\r\n ValidationRules.ensure(response.FieldName).required().on(this.userDefiedData);\r\n const mandatorySymbol = document.createElement('span');\r\n mandatorySymbol.textContent = '*';\r\n mandatorySymbol.style.color = 'red';\r\n areaLabel.appendChild(mandatorySymbol);\r\n }\r\n containerTextarea.appendChild(areaLabel);\r\n const textInput = document.createElement('textarea');\r\n textInput.rows = 5;\r\n textInput.cols = 20;\r\n textInput.id = response.ReferenceUDFID;\r\n //textInput.placeholder = 'Enter comments';\r\n textInput.value = response.Value;\r\n this.areaValue = response.Value;\r\n textInput.ref = response.FieldName.replace(' ', '');\r\n textInput.addEventListener('change', (event) => {\r\n this.areaValue = event.target.value;\r\n console.log(`Field ${response.FieldTypeID} value: ${this.areaValue}`);\r\n // You can store or process the value here\r\n });\r\n containerTextarea.appendChild(textInput);\r\n this.InputContainer.appendChild(containerTextarea);\r\n this.textareas.push(textInput);\r\n break;\r\n case \"date\":\r\n const containerDate = document.createElement('div');\r\n const labelDate = document.createElement('label');\r\n labelDate.textContent = response.FieldName;\r\n if (response.IsMandatory) {\r\n ValidationRules.ensure(response.FieldName).required().on(this.userDefiedData);\r\n const mandatorySymbol = document.createElement('span');\r\n mandatorySymbol.textContent = '*';\r\n mandatorySymbol.style.color = 'red';\r\n labelDate.appendChild(mandatorySymbol);\r\n }\r\n containerDate.appendChild(labelDate);\r\n const dateInput = document.createElement('input');\r\n dateInput.type = 'text';\r\n dateInput.id = response.ReferenceUDFID;\r\n dateInput.value = response.Value;\r\n this.selectedDate = response.Value;\r\n //dateInput.placeholder = 'Select date';\r\n dateInput.ref = response.FieldName.replace(' ', '');\r\n containerDate.appendChild(dateInput);\r\n this.InputContainer.appendChild(containerDate);\r\n //flatpickr(dateInput);\r\n const datePicker = flatpickr(dateInput, {\r\n closeOnSelect: true,\r\n dateFormat: 'd-m-Y',\r\n minDate: null,\r\n maxDate: null,\r\n defaultDate: '',\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 onClose: function (selectedDates, dateStr, instance) {\r\n this.selectedDate = dateStr;\r\n //console.log(this.selectedDate);\r\n }\r\n });\r\n dateInput.addEventListener('change', (event) => {\r\n this.selectedDate = event.target.value;\r\n });\r\n break;\r\n\r\n case \"select\":\r\n const containerSelect = document.createElement('div');\r\n const labelSelect = document.createElement('label');\r\n labelSelect.textContent = response.FieldName;\r\n\r\n if (response.IsMandatory) {\r\n ValidationRules.ensure(response.FieldName).required().on(this.userDefiedData);\r\n const mandatorySymbol = document.createElement('span');\r\n mandatorySymbol.textContent = '*';\r\n mandatorySymbol.style.color = 'red';\r\n labelSelect.appendChild(mandatorySymbol);\r\n }\r\n\r\n containerSelect.appendChild(labelSelect);\r\n const selectInput = document.createElement('select');\r\n selectInput.id = response.ReferenceUDFID;\r\n const selectOptions = response.OptionList;\r\n selectOptions.forEach((option) => {\r\n const optionElement = document.createElement('option');\r\n optionElement.value = option.UDFOptionID;\r\n optionElement.text = option.Option;\r\n selectInput.appendChild(optionElement);\r\n if (response.Value == option.UDFOptionID) {\r\n optionElement.selected = option.Option;\r\n }\r\n });\r\n containerSelect.appendChild(selectInput);\r\n this.InputContainer.appendChild(containerSelect);\r\n\r\n const selectElement = containerSelect.querySelector('select');\r\n selectElement.addEventListener('change', () => {\r\n // Get the selected value\r\n const selectedValue = selectElement.value;\r\n this.SelectValue = selectedValue;\r\n console.log(`Field ${response.FieldTypeID} value: ${selectedValue}`);\r\n // You can store or process the value here\r\n });\r\n break;\r\n\r\n case \"radio\":\r\n const containerRadio = document.createElement('div');\r\n const labelRadio = document.createElement('label');\r\n labelRadio.textContent = response.FieldName;\r\n\r\n if (response.IsMandatory) {\r\n ValidationRules.ensure(response.FieldName).required().on(this.userDefiedData);\r\n const mandatorySymbol = document.createElement('span');\r\n mandatorySymbol.textContent = '*';\r\n mandatorySymbol.style.color = 'red';\r\n labelRadio.appendChild(mandatorySymbol);\r\n }\r\n\r\n containerRadio.appendChild(labelRadio);\r\n const radioOptions = response.OptionList;\r\n radioOptions.forEach((option) => {\r\n const radioLabel = document.createElement('label');\r\n const radioInput = document.createElement('input');\r\n radioInput.type = 'radio';\r\n radioInput.name = 'radioOptions';\r\n radioInput.value = option.UDFOptionID;\r\n radioInput.id = response.ReferenceUDFID;\r\n radioLabel.textContent = option.Option;\r\n radioLabel.appendChild(radioInput);\r\n if (response.Value == option.UDFOptionID) {\r\n //optionElement.selected = option.Option;\r\n radioInput.checked = true;\r\n }\r\n containerRadio.appendChild(radioLabel);\r\n });\r\n this.InputContainer.appendChild(containerRadio);\r\n break;\r\n\r\n case \"checkbox\":\r\n const containerCheckbox = document.createElement('div');\r\n const labelCheckbox = document.createElement('label');\r\n labelCheckbox.textContent = response.FieldName;\r\n\r\n if (response.IsMandatory) {\r\n ValidationRules.ensure(response.FieldName).required().on(this.userDefiedData);\r\n const mandatorySymbol = document.createElement('span');\r\n mandatorySymbol.textContent = '*';\r\n mandatorySymbol.style.color = 'red';\r\n labelCheckbox.appendChild(mandatorySymbol);\r\n }\r\n\r\n containerCheckbox.appendChild(labelCheckbox);\r\n const checkboxOptions = response.OptionList;\r\n checkboxOptions.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.UDFOptionID;\r\n checkboxInput.id = response.ReferenceUDFID;\r\n checkboxLabel.textContent = option.Option;\r\n checkboxLabel.appendChild(checkboxInput);\r\n if (option.IsSelected) {\r\n checkboxInput.checked = true;\r\n }\r\n containerCheckbox.appendChild(checkboxLabel);\r\n });\r\n this.InputContainer.appendChild(containerCheckbox);\r\n break;\r\n\r\n default:\r\n console.log(\"Invalid FieldTypeText\");\r\n break;\r\n }\r\n });\r\n // Create a button container\r\n const buttonContainer = document.createElement('div');\r\n buttonContainer.className = 'button-container';\r\n this.InputContainer.appendChild(buttonContainer);\r\n\r\n // Create a submit button\r\n const submitButton = document.createElement('button');\r\n submitButton.textContent = 'Save';\r\n submitButton.type = 'submit';\r\n buttonContainer.appendChild(submitButton);\r\n\r\n const cancelButton = document.createElement('button');\r\n cancelButton.textContent = 'Cancel';\r\n cancelButton.type = 'button';\r\n buttonContainer.appendChild(cancelButton);\r\n\r\n cancelButton.addEventListener('click', async () => {\r\n const UserDefinedFieldsData = await this.profileService.GetUserDefinedFields(this.Employeeid);\r\n this.userDefiedData = await UserDefinedFieldsData;\r\n });\r\n\r\n const formElement = document.querySelector('.user-defined');\r\n formElement.addEventListener('submit', event => {\r\n event.preventDefault();\r\n\r\n const userDefinedList = [];\r\n this.isFormValid = true; // Flag to track form validity\r\n\r\n // Loop through all dynamically generated fields\r\n this.userDefiedData.forEach(response => {\r\n const fieldValues = {};\r\n switch (response.FieldTypeText) {\r\n case \"text\": \r\n this.textError = 'User defined field(s) are required.';\r\n fieldValues.EmployeeID = this.Employeeid;\r\n fieldValues.FieldTypeID = response.FieldTypeID;\r\n fieldValues.Value = this.textValue;\r\n fieldValues.ReferenceUDFID = response.ReferenceUDFID;\r\n fieldValues.Value = response.IsMandatory === true && (this.textValue == null || this.textValue == '') ? this.isFormValid = false : this.textValue;\r\n userDefinedList.push(fieldValues);\r\n break;\r\n case \"textarea\":\r\n fieldValues.EmployeeID = this.Employeeid;\r\n fieldValues.FieldTypeID = response.FieldTypeID;\r\n //fieldValues.Value = this.areaValue;\r\n fieldValues.ReferenceUDFID = response.ReferenceUDFID;\r\n //fieldValues.Value = response.IsMandatory === true && (this.areaValue == null || this.areaValue == '') ? console.log(\"area Error\") : (response.IsMandatory === false && this.areaValue ? this.areaValue : this.areaValue);\r\n fieldValues.Value = response.IsMandatory === true && (this.areaValue == null || this.areaValue == '') ? this.isFormValid = false : this.areaValue;\r\n userDefinedList.push(fieldValues);\r\n break;\r\n case \"date\":\r\n fieldValues.EmployeeID = this.Employeeid;\r\n fieldValues.FieldTypeID = response.FieldTypeID;\r\n //fieldValues.Value = ''; // Use the selectedDate value\r\n //fieldValues.Value = response.IsMandatory === true && this.selectedDate == null ? console.log(\"area Error\") : (response.IsMandatory === false && this.selectedDate ? this.selectedDate : this.selectedDate);\r\n fieldValues.Value = response.IsMandatory === true && (this.selectedDate == null || this.selectedDate == '') ? this.isFormValid = false : this.selectedDate;\r\n fieldValues.ReferenceUDFID = response.ReferenceUDFID;\r\n userDefinedList.push(fieldValues);\r\n break;\r\n case \"select\":\r\n fieldValues.EmployeeID = this.Employeeid;\r\n fieldValues.FieldTypeID = response.FieldTypeID;\r\n //fieldValues.Value = this.SelectValue;\r\n //fieldValues.Value = response.IsMandatory === true && this.SelectValue == null ? console.log(\"Select Error\") : (response.IsMandatory === false && this.SelectValue ? this.SelectValue : this.SelectValue);\r\n fieldValues.Value = response.IsMandatory === true && (this.SelectValue == null || this.SelectValue == '') ? this.isFormValid = false : this.SelectValue;\r\n fieldValues.ReferenceUDFID = response.ReferenceUDFID;\r\n userDefinedList.push(fieldValues);\r\n break;\r\n case \"radio\":\r\n const radioElement = document.querySelector(`input[name=\"radioOptions\"]:checked`);\r\n fieldValues.EmployeeID = this.Employeeid;\r\n fieldValues.FieldTypeID = response.FieldTypeID;\r\n fieldValues.Value = radioElement ? radioElement.value : null;\r\n //fieldValues.Value = response.IsMandatory === true && !radioElement ? console.log('radio error') :(response.IsMandatory === false && radioElement ? radioElement.value : radioElement.value);\r\n //fieldValues.Value = this.getSelectedRadioOption(response.FieldName); // Call helper method to get selected radio option\r\n fieldValues.ReferenceUDFID = response.ReferenceUDFID;\r\n userDefinedList.push(fieldValues);\r\n break;\r\n case \"checkbox\":\r\n const checkboxElements = document.querySelectorAll(`input[name=\"checkboxOptions\"]:checked`);\r\n fieldValues.EmployeeID = this.Employeeid;\r\n fieldValues.FieldTypeID = response.FieldTypeID;\r\n fieldValues.Option = checkboxElements ? Array.from(checkboxElements).map(checkbox => checkbox.value) : [];\r\n //fieldValues.Option = response.IsMandatory && checkboxElements ? Array.from(checkboxElements).map(checkbox => checkbox.value) :console.log('Check errors');\r\n //fieldValues.Value = this.getSelectedCheckboxOptions(response.FieldName); // Call helper method to get selected checkbox options\r\n fieldValues.ReferenceUDFID = response.ReferenceUDFID;\r\n userDefinedList.push(fieldValues);\r\n break;\r\n default:\r\n console.log(\"Invalid FieldTypeText\");\r\n break;\r\n }\r\n });\r\n if (this.isFormValid) {\r\n const userdefinedmodel = {\r\n UserDefinedList: userDefinedList,\r\n EmployeeID: this.Employeeid,\r\n };\r\n console.log(userdefinedmodel);\r\n this.profileService.SaveUserDefinedFields(userdefinedmodel).then(response => {\r\n console.log(response);\r\n this.Fieldmessage = \"User defined fields updated successfully\";\r\n //this.Fieldmessage = this.textError;\r\n this.FieldSuccessmessage = true;\r\n setTimeout(() => {\r\n this.Fieldmessage = null\r\n }, 3000);\r\n });\r\n }else {\r\n this.FieldErrormessage = 'User defined field(s) are required.';\r\n this.FieldDeletmessage = true;\r\n setTimeout(() => {\r\n this.FieldErrormessage = null\r\n }, 3000);\r\n console.log('Form has empty mandatory fields. Please fill them.');\r\n }\r\n });\r\n }\r\n\r\n getSelectedOption(fieldName) {\r\n const selectElement = this.InputContainer.querySelector(`select[name='${fieldName.replace(' ', '')}']`);\r\n return selectElement.value;\r\n }\r\n\r\n getSelectedRadioOption(fieldName) {\r\n const radioElement = this.InputContainer.querySelector(`input[name='${fieldName.replace(' ', '')}']:checked`);\r\n if (radioElement) {\r\n return radioElement.value;\r\n }\r\n return null;\r\n }\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\r\n}\r\n","import {inject,bindingMode,bindable } from 'aurelia-framework';\r\nimport { DialogController } from 'aurelia-dialog';\r\nimport { ProfileService } from '../../../../shared/services/profielservice';\r\nimport { JwtService } from '../../../../shared/services/jwtservice';\r\nimport {ValidationControllerFactory, ValidationRules,validateTrigger} from 'aurelia-validation';\r\nimport flatpickr from 'flatpickr';\r\nimport 'flatpickr/dist/flatpickr.min.css';\r\nimport { data, event } from 'jquery';\r\nimport Scrollbar from 'smooth-scrollbar';\r\nimport numeral from 'numeral';\r\nimport { Router } from 'aurelia-router';\r\n\r\n@inject(DialogController, ProfileService, JwtService, ValidationControllerFactory,Router)\r\nexport class Addworkexperience {\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 dateDifference = null;\r\n DateDifference = false;\r\n showExperience = false;\r\n differenceError = false;\r\n inputValue = '';\r\n isEmployerDisabled = false;\r\n fromerrorMessage = false;\r\n symbole='';\r\n getCurrencysymbol=[];\r\n startctcCode = '1';\r\n endctcCode = '1';\r\n static inject = [Element];\r\n isDragging = false;\r\n dialog;\r\n\r\n constructor(controller, profileService, JwtService, controllerFactory,router) {\r\n this.controller = controller;\r\n this.profileService = profileService;\r\n this.JwtService = JwtService;\r\n this.controllerFactory = controllerFactory.createForCurrentScope();\r\n this.controllerFactory.validateTrigger = validateTrigger.change;\r\n this.FromDate = null;\r\n this.ToDate = null;\r\n this.dateDifference = '';\r\n this.router = router;\r\n this.LocationId = this.JwtService.getLocationId();\r\n this.EmployeeID = this.JwtService.getEmployeeId();\r\n console.log(this.EmployeeID);\r\n ValidationRules.customRule(\r\n 'dateError',\r\n () =>{\r\n if(this.differenceError === true){\r\n return false;\r\n }else{\r\n return true;\r\n }\r\n },\r\n 'From date should be less than to date.'\r\n );\r\n\r\n ValidationRules\r\n .ensure('employerValue').required().withMessage('Employer is required')\r\n .ensure('JobTitle').required().withMessage('Job title is required')\r\n .ensure('ToDate')\r\n .satisfiesRule('dateError')\r\n .on(this);\r\n\r\n }\r\n\r\n attached() {\r\n this.specializationInput.focus();\r\n\r\n Scrollbar.init(document.querySelector('.smooth-scrollbar'));\r\n flatpickr(this.FromdatePicker, {\r\n closeOnSelect: true,//new Date().toISOString().split(\"T\")[0]\r\n dateFormat: 'd-m-Y', // the date format (default is 'Y-m-d')\r\n minDate: null, // the minimum selectable date in the calendar (default is null, which means no limit)\r\n maxDate: 'today', // the maximum selectable date in the calendar (default is null, which means no limit)\r\n defaultDate: this.FromDate, // the initial date that should be shown in the calendar (default is null, which means today's date)\r\n enableTime: false, // whether to allow selecting time in addition to date\r\n enableSeconds: false, // whether to allow selecting seconds in addition to time\r\n time_24hr: false, // whether to use a 24-hour clock for time input\r\n minuteIncrement: 1, // the increment for minutes in the time input\r\n hourIncrement: 1, // the increment for hours in the time input\r\n timeFormat: 'h:i K', // the format for the time input (default is 'h:i K' for 12-hour clock and 'H:i' for 24-hour clock)\r\n onClose: function (selectedDates, dateStr, instance) {\r\n this.FromDate = dateStr;\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', // the date format (default is 'Y-m-d')\r\n minDate: null, // the minimum selectable date in the calendar (default is null, which means no limit)\r\n maxDate:'today', // the maximum selectable date in the calendar (default is null, which means no limit)\r\n defaultDate: this.ToDate, // the initial date that should be shown in the calendar (default is null, which means today's date)\r\n enableTime: false, // whether to allow selecting time in addition to date\r\n enableSeconds: false, // whether to allow selecting seconds in addition to time\r\n time_24hr: false, // whether to use a 24-hour clock for time input\r\n minuteIncrement: 1, // the increment for minutes in the time input\r\n hourIncrement: 1, // the increment for hours in the time input\r\n timeFormat: 'h:i K', // the format for the time input (default is 'h:i K' for 12-hour clock and 'H:i' for 24-hour clock)\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 const currencysymbol= this.profileService.GetCurrencysymbol();\r\n }\r\n\r\n organization = false;\r\n isEmployerActive = false;\r\n experience = {\r\n Employer: 'Kensium Solutions Pvt Ltd'\r\n };\r\n Employer = '';\r\n _employerValue = '';\r\n\r\n get employerValue() {\r\n return this.isEmployerActive ? this.experience.Employer : this.Employer;\r\n }\r\n set employerValue(value) {\r\n this._employerValue = value;\r\n if (this.isEmployerActive) {\r\n this.experience.Employer = value;\r\n } else {\r\n this.Employer = value;\r\n }\r\n }\r\n\r\n // toggleEmployer() {\r\n // this.isEmployerActive = this.organization;\r\n // this.isEmployerDisabled = true;\r\n // }\r\n\r\n toggleEmployer() {\r\n this.isEmployerActive = this.organization;\r\n if (this.organization == true) {\r\n this.employerValue = this.experience.Employer;\r\n this.isEmployerDisabled = true;\r\n } else if (this.organization == false) {\r\n this.employerValue = '';\r\n this.isEmployerDisabled = false;\r\n }\r\n }\r\n\r\n calculateWorkexperience(fromdate,todate){\r\n this.profileService.GetExperience(fromdate,todate).then(data => {\r\n this.displayYears = data.Years;\r\n this.displayMonth = data.Months;\r\n this.displayDays = data.Days;\r\n this.dateDifference = this.displayYears + ' ' + 'Years(s)' + ' ' + this.displayMonth + ' ' + 'Months(s)' + ' ' + this.displayDays + ' ' + 'Day(s)';\r\n })\r\n }\r\n\r\n calculateDateDifference() {\r\n this.showExperience = true;\r\n if (this.FromDate && this.ToDate) {\r\n const fromParts = this.FromDate.split('-');\r\n const toParts = this.ToDate.split('-');\r\n this.calculateWorkexperience(this.FromDate,this.ToDate);\r\n // Create Date objects using the date parts\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 const differenceInTime = toDate.getTime() - fromDate.getTime();\r\n const differenceInDays = Math.ceil(differenceInTime / (1000 * 3600 * 24));\r\n if(fromDate >= toDate){\r\n this.differenceError = true;\r\n this.showExperience = false;\r\n }else if(fromDate < toDate){\r\n this.differenceError = false;\r\n const CheckpreviousExperience = {\r\n EmployeeID : this.EmployeeID,\r\n StartDate : this.FromDate,\r\n EndDate : this.ToDate,\r\n PersonWorkExperienceID : 0,\r\n };\r\n this.profileService.GetPreviousWorkExperience(CheckpreviousExperience)\r\n .then(data => {\r\n if (data >= 1){\r\n this.overlappingMessage = \"From and to dates are overlapping . Do you want to save work experience ?\";\r\n //setTimeout(() => {this.overlappingMessage = null}, 5000);\r\n }else{\r\n this.overlappingMessage = '';\r\n }\r\n });\r\n }\r\n else{\r\n this.differenceError = false;\r\n }\r\n }else {\r\n this.dateDifference = null;\r\n }\r\n}\r\n\r\n parseDate(dateString) {\r\n const dateParts = dateString.split('-');\r\n if (dateParts.length !== 3) {\r\n return null; // Invalid date format\r\n }\r\n const day = parseInt(dateParts[0], 10);\r\n const month = parseInt(dateParts[1], 10) - 1; // Months are 0-indexed\r\n const year = parseInt(dateParts[2], 10);\r\n const date = new Date(year, month, day);\r\n return date;\r\n}\r\n\r\ncalculateWorkExperience() {\r\n // Parse the selected dates\r\n const startDateObject = new Date(this.FromDate );\r\n const endDateObject = new Date(this.ToDate);\r\n\r\n // Check if both dates are valid\r\n if (isNaN(startDateObject) || isNaN(endDateObject)) {\r\n alert('Please enter valid dates.');\r\n return;\r\n }\r\n\r\n // Check if endDate is greater than startDate\r\n if (endDateObject < startDateObject) {\r\n alert('End date should be after start date.');\r\n return;\r\n }\r\n\r\n // Calculate the difference in milliseconds between the two dates\r\n const timeDifference = endDateObject - startDateObject;\r\n\r\n // Calculate the number of milliseconds in one year (assuming 365 days)\r\n const millisecondsInOneYear = 365 * 24 * 60 * 60 * 1000;\r\n\r\n // Calculate the work experience in years\r\n this.workExperienceInYears = timeDifference / millisecondsInOneYear;\r\n}\r\n\r\n formatStartingCTC() {\r\n const number = parseFloat(this.StartingCTC);\r\n\r\n // Check if the input is a valid number\r\n if (!isNaN(number)) {\r\n this.StartingCTC = numeral(number).format('0,0.00');\r\n }\r\n }\r\n\r\n formatEndingCTC() {\r\n const number = parseFloat(this.EndCTC);\r\n\r\n // Check if the input is a valid number\r\n if (!isNaN(number)) {\r\n this.EndCTC = numeral(number).format('0,0.00');\r\n }\r\n }\r\n\r\n handleKeyDown(event) {\r\n if (event.key === 'Enter') {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n return false;\r\n }\r\n return true;\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 \r\n validateField(data){\r\n if(data)\r\n {\r\n console.log(\"Hello\");\r\n this.controllerFactory.clear();\r\n //return;\r\n }\r\n ValidationRules\r\n .ensure('employerValue').required().withMessage('Employer is required')\r\n .ensure('JobTitle').required().withMessage('Job title is required')\r\n .ensure('ToDate')\r\n .satisfiesRule('dateError')\r\n .on(this.controllerFactory);\r\n }\r\n\r\n saveExperience() {\r\n const refreshEvent = new CustomEvent('refreshData');\r\n this.errors = null;\r\n this.controllerFactory.validate()\r\n .then(result => {\r\n if (result.valid) {\r\n const experienceData = {\r\n EmployeeID: this.EmployeeID,\r\n Employer: this.employerValue,\r\n FromDate: this.FromDate,\r\n ToDate: this.ToDate,\r\n JobTitle: this.JobTitle,\r\n Joblocation: this.Joblocation,\r\n StartingCTC: this.StartingCTC,\r\n EndCTC: this.EndCTC,\r\n Comments: this.Comments,\r\n CurrencyCode : this.startctcCode ? this.startctcCode : this.startctcCode,\r\n }\r\n this.profileService.SaveWorkExperience(experienceData).then(() => {\r\n this.controller.cancel();\r\n \r\n this.profileService.GetWorkExperience(this.EmployeeID)\r\n .then(() => {\r\n document.dispatchEvent(refreshEvent); // Trigger the custom event\r\n });\r\n });\r\n }\r\n });\r\n }\r\n\r\n cancel() {\r\n this.controller.cancel();\r\n }\r\n}\r\n","import {inject,bindingMode,bindable } from 'aurelia-framework';\r\nimport { DialogController } from 'aurelia-dialog';\r\nimport { ProfileService } from '../../../../shared/services/profielservice';\r\nimport { JwtService } from '../../../../shared/services/jwtservice';\r\nimport {ValidationControllerFactory, ValidationRules,validateTrigger} from 'aurelia-validation';\r\nimport flatpickr from 'flatpickr';\r\nimport 'flatpickr/dist/flatpickr.min.css';\r\nimport Scrollbar from 'smooth-scrollbar';\r\nimport numeral from 'numeral';\r\n\r\n@inject(DialogController, ProfileService, JwtService, ValidationControllerFactory, Element)\r\nexport class Editworkexperience {\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 dateDifference = null;\r\n\r\n organization = false; // set the default value of the checkbox to unchecked\r\n experience = {\r\n Employer: 'Kensium Solutions Pvt Ltd' // sample default value\r\n };\r\n Employer = '';\r\n PersonWorkExperienceID;\r\n isEmployerDisabled = false;\r\n fromerrorMessage = false;\r\n differenceError = false;\r\n overlap = false;\r\n startctcCode = '1';\r\n endctcCode = '1';\r\n static inject = [Element];\r\n isDragging = false;\r\n dialog;\r\n constructor(controller, profileService, JwtService, controllerFactory, element) {\r\n this.controller = controller;\r\n this.profileService = profileService;\r\n this.JwtService = JwtService;\r\n this.controllerFactory = controllerFactory.createForCurrentScope();\r\n this.controllerFactory.validateTrigger = validateTrigger.change; \r\n this.element = element;\r\n this.FromDate = null;\r\n this.ToDate = null;\r\n this.dateDifference = '';\r\n\r\n this.EmployeeID = this.JwtService.getEmployeeId();\r\n\r\n this.LocationId = this.JwtService.getLocationId();\r\n\r\n ValidationRules.customRule(\r\n 'dateError',\r\n () =>{\r\n if(this.differenceError === true){\r\n return false;\r\n }else{\r\n return true;\r\n }\r\n },\r\n 'From date should be less than to date.'\r\n );\r\n\r\n\r\n ValidationRules\r\n .ensure('employerValue').required().withMessage('Employer is required')\r\n .ensure('JobTitle').required().withMessage('Job title is required')\r\n .ensure('ToDate')\r\n .satisfiesRule('dateError')\r\n .on(this);\r\n }\r\n\r\n\r\n activate(experience) {\r\n this.PersonWorkExperienceID = experience.PersonWorkExperienceID;\r\n this.employerValue = experience.Employer;\r\n if (this.employerValue == this.experience.Employer) {\r\n this.organization = true;\r\n this.isEmployerDisabled = true;\r\n }\r\n this.FromDate = experience.FromDate;\r\n this.ToDate = experience.ToDate;\r\n this.JobTitle = experience.JobTitle;\r\n this.Joblocation = experience.Joblocation;\r\n this.StartingCTC = experience.StartingCTC;\r\n this.EndCTC = experience.EndCTC;\r\n this.Comments = experience.Comments;\r\n this.startctcCode = experience.CurrencyCode;\r\n this.StartDate = experience.StartDate;\r\n this.EndDate = experience.EndDate;\r\n }\r\n\r\n attached() {\r\n this.specializationInput.focus();\r\n Scrollbar.init(document.querySelector('.smooth-scrollbar'));\r\n flatpickr(this.FromdatePicker, {\r\n closeOnSelect: true,\r\n dateFormat: 'd-m-Y', // the date format (default is 'Y-m-d')\r\n minDate: null, // the minimum selectable date in the calendar (default is null, which means no limit)\r\n maxDate:'today', // the maximum selectable date in the calendar (default is null, which means no limit)\r\n defaultDate: this.FromDate, // the initial date that should be shown in the calendar (default is null, which means today's date)\r\n enableTime: false, // whether to allow selecting time in addition to date\r\n enableSeconds: false, // whether to allow selecting seconds in addition to time\r\n time_24hr: false, // whether to use a 24-hour clock for time input\r\n minuteIncrement: 1, // the increment for minutes in the time input\r\n hourIncrement: 1, // the increment for hours in the time input\r\n timeFormat: 'h:i K', // the format for the time input (default is 'h:i K' for 12-hour clock and 'H:i' for 24-hour clock)\r\n onClose: function (selectedDates, dateStr, instance) {\r\n this.FromDate = dateStr;\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', // the date format (default is 'Y-m-d')\r\n minDate: null, // the minimum selectable date in the calendar (default is null, which means no limit)\r\n maxDate:'today', // the maximum selectable date in the calendar (default is null, which means no limit)\r\n defaultDate: this.ToDate, // the initial date that should be shown in the calendar (default is null, which means today's date)\r\n enableTime: false, // whether to allow selecting time in addition to date\r\n enableSeconds: false, // whether to allow selecting seconds in addition to time\r\n time_24hr: false, // whether to use a 24-hour clock for time input\r\n minuteIncrement: 1, // the increment for minutes in the time input\r\n hourIncrement: 1, // the increment for hours in the time input\r\n timeFormat: 'h:i K', // the format for the time input (default is 'h:i K' for 12-hour clock and 'H:i' for 24-hour clock)\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 this.calculateDateDifference();\r\n }\r\n\r\n toggleEmployer() {\r\n this.isEmployerActive = this.organization;\r\n if (this.organization == true) {\r\n this.employerValue = this.experience.Employer;\r\n this.isEmployerDisabled = true;\r\n } else if (this.organization == false) {\r\n this.employerValue = '';\r\n this.isEmployerDisabled = false;\r\n }\r\n }\r\n\r\n calculateWorkexperience(fromdate,todate){\r\n this.profileService.GetExperience(fromdate,todate).then(data => {\r\n this.displayYears = data.Years;\r\n this.displayMonth = data.Months;\r\n this.displayDays = data.Days;\r\n this.dateDifference = this.displayYears + ' ' + 'Years(s)' + ' ' + this.displayMonth + ' ' + 'Months(s)' + ' ' + this.displayDays + ' ' + 'Day(s)';\r\n })\r\n }\r\n\r\ncalculateDateDifference() {\r\n this.showExperience = true;\r\n if (this.FromDate && this.ToDate) {\r\n const fromParts = this.FromDate.split('-');\r\n const toParts = this.ToDate.split('-');\r\n this.calculateWorkexperience(this.FromDate,this.ToDate);\r\n // Create Date objects using the date parts\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 const differenceInTime = toDate.getTime() - fromDate.getTime();\r\n const differenceInDays = Math.ceil(differenceInTime / (1000 * 3600 * 24));\r\n if(fromDate >= toDate){\r\n this.differenceError = true;\r\n this.showExperience = false;\r\n }else if(fromDate < toDate){\r\n const CheckpreviousExperience = {\r\n EmployeeID : this.EmployeeID,\r\n StartDate : this.FromDate,\r\n EndDate : this.ToDate,\r\n PersonWorkExperienceID : 0,\r\n };\r\n this.differenceError = false;\r\n this.profileService.GetPreviousWorkExperience(CheckpreviousExperience)\r\n .then(data => {\r\n if (data >= 1){\r\n this.overlappingMessage = \"From and to dates are overlapping . Do you want to save work experience ?\";\r\n //setTimeout(() => {this.overlappingMessage = null}, 5000);\r\n }else{\r\n this.overlappingMessage = '';\r\n }\r\n });\r\n }\r\n else{\r\n this.differenceError = false;\r\n }\r\n}else {\r\n this.dateDifference = null;\r\n }\r\n}\r\n\r\nformatStartingCTC() {\r\n const number = parseFloat(this.StartingCTC);\r\n // Check if the input is a valid number\r\n if (!isNaN(number)) {\r\n this.StartingCTC = numeral(number).format('0,0.00');\r\n }\r\n}\r\n\r\nformatEndingCTC() {\r\n const number = parseFloat(this.EndCTC);\r\n // Check if the input is a valid number\r\n if (!isNaN(number)) {\r\n this.EndCTC = numeral(number).format('0,0.00');\r\n }\r\n}\r\n\r\n handleKeyDown(event) {\r\n if (event.key === 'Enter') {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n return false;\r\n }\r\n return true;\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 validateField(data){\r\n if(data)\r\n {\r\n this.controllerFactory.clear();\r\n //return;\r\n }\r\n ValidationRules\r\n .ensure('employerValue').required().withMessage('Employer is required')\r\n .ensure('JobTitle').required().withMessage('Job title is required')\r\n .ensure('ToDate')\r\n .satisfiesRule('dateError')\r\n .on(this.controllerFactory);\r\n }\r\n saveExperience() {\r\n const refreshEvent = new CustomEvent('refreshEditData');\r\n this.errors = null;\r\n this.controllerFactory.validate()\r\n .then(result => {\r\n if (result.valid) {\r\n const experienceEditData = {\r\n PersonWorkExperienceID: this.PersonWorkExperienceID,\r\n EmployeeID: this.EmployeeID,\r\n Employer: this.employerValue,\r\n FromDate: this.FromDate,\r\n ToDate: this.ToDate,\r\n JobTitle: this.JobTitle,\r\n Joblocation: this.Joblocation,\r\n StartingCTC: this.StartingCTC,\r\n EndCTC: this.EndCTC,\r\n Comments: this.Comments,\r\n CurrencyCode : this.startctcCode,\r\n }\r\n this.fromerrorMessage = false;\r\n this.profileService.SaveWorkExperience(experienceEditData).then(() => {\r\n this.controller.cancel();\r\n \r\n this.profileService.GetWorkExperience(this.EmployeeID)\r\n .then(() => {\r\n document.dispatchEvent(refreshEvent); // Trigger the custom event\r\n });\r\n });\r\n }\r\n }); \r\n }\r\n\r\n cancel() {\r\n this.controller.cancel();\r\n }\r\n}\r\n","import {inject } from 'aurelia-framework';\r\nimport { ProfileService } from '../../../shared/services/profielservice';\r\nimport { JwtService } from '../../../shared/services/jwtservice';\r\nimport {DialogService} from 'aurelia-dialog';\r\nimport { Addworkexperience } from './addworkexperience/addworkexperience';\r\nimport { Editworkexperience } from './editworkexperience/editworkexperience';\r\nimport { AlertpopupComponent } from '../../alertpopup/alertpopupcomponent';\r\nimport Scrollbar from 'smooth-scrollbar';\r\nimport {config} from '../../../shared/services/config';\r\nimport { Router } from 'aurelia-router';\r\nimport {LoginService} from \"../../../shared/services/loginservice\";\r\n@inject(ProfileService, JwtService, DialogService,Router,LoginService)\r\nexport class Workexperience {\r\n\r\n ExperienceSuccessmessage = false;\r\n ExperienceDeletmessage = false;\r\n ExperienceUpdatemessage = false;\r\n pageSize = config.grid_PazeSize;\r\n\r\n constructor(ProfileService, JwtService, DialogService,router,loginService) {\r\n this.profileService = ProfileService;\r\n this.jwtService = JwtService;\r\n this.dialogService = DialogService;\r\n this.router = router;\r\n this.loginService = loginService;\r\n }\r\n\r\n activate() {\r\n this.workExperience = this.RefreshExperience();\r\n this.workExperience = this.RefreshEditExperience(); \r\n }\r\n\r\n async bind() {\r\n setTimeout(() => {\r\n Scrollbar.init(document.querySelector('.experience-scrollbar'));\r\n }, 100)\r\n }\r\n\r\n async attached() {\r\n\r\n const empid = this.jwtService.getEmployeeId();\r\n document.addEventListener('refreshData', this.RefreshExperience);\r\n document.addEventListener('refreshEditData', this.RefreshEditExperience);\r\n\r\n const WorkExperienceData = await this.profileService.GetWorkExperience(empid);\r\n this.workExperience = WorkExperienceData;\r\n }\r\n\r\n addWorkExperience() {\r\n this.dialogService.open({\r\n viewModel: Addworkexperience\r\n });\r\n }\r\n\r\n RefreshExperience = () => {\r\n const empid = this.jwtService.getEmployeeId();\r\n // Call the API or refresh the data in GridComponent\r\n this.profileService.GetWorkExperience(empid).then(data => {\r\n this.workExperience = data;\r\n this.Expmessage = \"Work experience added successfully\";\r\n this.ExperienceSuccessmessage = true;\r\n this.ExperienceUpdatemessage = false;\r\n setTimeout(() => {\r\n this.Expmessage = null\r\n }, 3000);\r\n })\r\n\r\n };\r\n editWorkExperience(editData) {\r\n this.dialogService.open({\r\n viewModel: Editworkexperience,\r\n model: editData\r\n });\r\n }\r\n\r\n RefreshEditExperience = () => {\r\n const empid = this.jwtService.getEmployeeId();\r\n // Call the API or refresh the data in GridComponent\r\n this.profileService.GetWorkExperience(empid).then(data => {\r\n this.workExperience = data;\r\n this.ExpUpdatemessage = \"Work experience updated successfully\";\r\n this.ExperienceUpdatemessage = true;\r\n this.ExperienceSuccessmessage = false;\r\n setTimeout(() => {\r\n this.ExpUpdatemessage = null\r\n }, 3000);\r\n })\r\n\r\n };\r\n\r\n async deleteWorkExperience(data) {\r\n const empid = this.jwtService.getEmployeeId();\r\n const ExperienceID = data.PersonWorkExperienceID;\r\n\r\n const result = await this.dialogService.open({\r\n viewModel: AlertpopupComponent,\r\n model: \"\",\r\n }).whenClosed(response => response);\r\n\r\n if (result.wasCancelled) {\r\n return;\r\n }\r\n await this.profileService.DeleteWorkExperience(ExperienceID, empid);\r\n const employeeExperience = await this.profileService.GetWorkExperience(empid);\r\n this.ExpDeletmessage = \"Work experience deleted successfully\";\r\n this.ExperienceDeletmessage = true;\r\n setTimeout(() => {\r\n this.ExpDeletmessage = null\r\n }, 3000);\r\n this.workExperience = employeeExperience;\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/datepicker.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;","// 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/datepicker.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;","// 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/edit.svg\", import.meta.url);\nvar ___HTML_LOADER_IMPORT_1___ = new URL(\"../../../images/x-square.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 code = \"\\r\\n\";\n// Exports\nexport default code;"],"names":[],"sourceRoot":""}