{"version":3,"file":"app-ea750abf.d152cf98c45d962fa693.bundle.js","mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AASA;AAAA;AAPA;AACA;AACA;AACA;AACA;AAoKA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAGA;AACA;AACA;AACA;AA7KA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAIA;AAAA;AAGA;AAAA;AAGA;AAAA;AAQA;AAAA;AAGA;AAKA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AAEA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;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;AAEA;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;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAiBA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;ACnOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AASA;AAAA;AAPA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAoBA;AAAA;AAGA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AACA;AAEA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;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;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC7MA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAUA;AAAA;AARA;AACA;AACA;AACA;AACA;AACA;AACA;AAoDA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7FA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgDA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;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;AAEA;;;;;;;;;;;;;;;;;;;;;;ACnLA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAQA;AAAA;AANA;AACA;AACA;AACA;AAqEA;AACA;AAAA;AAEA;AACA;AAAA;AA4EA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAGA;AACA;AACA;AACA;AA9JA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAGA;AAAA;AAGA;AAAA;AAGA;AAAA;AAQA;AAAA;AAIA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;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;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAiBA;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;AAEA;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;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;AC3PA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAUA;AAAA;AARA;AACA;AACA;AACA;AACA;AACA;AACA;AAmFA;AACA;AAAA;AAEA;AACA;AApFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAAA;AAKA;AAAA;AAMA;AAAA;AAOA;AAAA;AAGA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;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;AAEA;AACA;AACA;AACA;AACA;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;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAEA;AACA;AACA;AAEA;;;;;;;;;;;;;;;;;;;;;;AC9OA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA;AAAA;AAJA;AACA;AACA;AA2EA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAGA;AACA;AACA;AACA;AArFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;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;AAEA;AACA;AACA;AACA;AAiBA;;;;;;;;;;;ACpGA;AACA;AACA;AACA;;;;;;;;;;;ACHA;AACA;AACA;AACA;;;;;;;;;;;ACHA;AACA;AACA;AACA;;;;;;;;;;;;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACbA;AACA;AACA;AACA;;;;;;;;;;;ACHA;AACA;AACA;AACA;;;;;;;;;;;ACHA;AACA;AACA;AACA","sources":["webpack://HRMSPortal/./src/components/myprofile/clientfeedback/clientfeedback.js","webpack://HRMSPortal/./src/components/myprofile/contactdetails/addcontact/addcontactcomponent.js","webpack://HRMSPortal/./src/components/myprofile/contactdetails/addemergencycontact/addemergencycomponent.js","webpack://HRMSPortal/./src/components/myprofile/contactdetails/contactdetails.js","webpack://HRMSPortal/./src/components/myprofile/contactdetails/editcontact/editcontactcomponent.js","webpack://HRMSPortal/./src/components/myprofile/contactdetails/editemergencycontact/editemergencycomponent.js","webpack://HRMSPortal/./src/components/myprofile/contactdetails/showemergencyhistory/showhistorycomponent.js","webpack://HRMSPortal/./src/components/myprofile/clientfeedback/clientfeedback.html","webpack://HRMSPortal/./src/components/myprofile/contactdetails/addcontact/addcontactcomponent.html","webpack://HRMSPortal/./src/components/myprofile/contactdetails/addemergencycontact/addemergencycomponent.html","webpack://HRMSPortal/./src/components/myprofile/contactdetails/contactdetails.html","webpack://HRMSPortal/./src/components/myprofile/contactdetails/editcontact/editcontactcomponent.html","webpack://HRMSPortal/./src/components/myprofile/contactdetails/editemergencycontact/editemergencycomponent.html","webpack://HRMSPortal/./src/components/myprofile/contactdetails/showemergencyhistory/showhistorycomponent.html"],"sourcesContent":["export class Clientfeedback {\r\n constructor() {\r\n this.message = 'Hello world';\r\n }\r\n}\r\n","import {inject } 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} from 'aurelia-validation';\r\nimport {LoginService} from \"../../../../shared/services/loginservice\";\r\nimport { Router } from 'aurelia-router';\r\n\r\n@inject(DialogController,ProfileService,JwtService,ValidationControllerFactory,Router,LoginService)\r\nexport class Addcontactcomponent {\r\n types = [];\r\n filteredAddressTypes = [];\r\n existingContact = [];\r\n isDragging = false;\r\n dialog;\r\n static inject = [Element];\r\n\r\n constructor(controller,ProfileService,JwtService,controllerFactory,router,loginService){\r\n this.controller = controller;\r\n this.profileService=ProfileService;\r\n this.jwtService = JwtService;\r\n this.controllerFactory = controllerFactory.createForCurrentScope();\r\n this.phoneNo = '';\r\n this.phoneNoError = [];\r\n this.mobileNo = '';\r\n this.mobileNoError = [];\r\n this.fax = '';\r\n this.faxError = [];\r\n this.pincode = '';\r\n this.pincodeError = [];\r\n this.router = router;\r\n this.loginService = loginService;\r\n this.empID = this.jwtService.getEmployeeId();\r\n\r\n ValidationRules\r\n .ensure('selectedContactType').required().withMessage(\"Contact Type is required\")\r\n .ensure('phoneNo')\r\n .required().withMessage(\"Phone number is required\")\r\n .matches(/^\\d{10}$/, { message: 'Phone number must be exactly 10 digits.' })\r\n .withMessage(\"Please enter valid phone number\")\r\n .ensure('mobileNo')\r\n .matches(/^\\d{10}$/, { message: 'Mobile number must be exactly 10 digits.' })\r\n .withMessage(\"Please enter valid mobile number\")\r\n .ensure('fax')\r\n .matches(/^\\d{10}$/, { message: 'Fax number must be exactly 10 digits.' })\r\n .withMessage(\"Please enter valid fax number\")\r\n .ensure('address1').required().withMessage(\"Address is required\")\r\n .ensure('emailId')\r\n .matches(/^[^\\s@]+@[^\\s@]+\\.(com|co|in|org|cc|net)$/)\r\n .withMessage('Please enter a valid email address.')\r\n .ensure('pincode')\r\n .displayName('Pin code')\r\n .matches(/^\\d+$/, { message: '${$displayName} must contain only numeric values.' })\r\n .withMessage('Please enter valid pin code.')\r\n .on(this);\r\n ValidationRules.customRule(\r\n 'numericPincode',\r\n (value, obj) => /^\\d+$/.test(value),\r\n 'Pin code must contain only numeric values.'\r\n );\r\n }\r\n validatePhoneNumber() {\r\n this.validationController.validate({ object: this, rules: { phoneNo: true } })\r\n .then(results => {\r\n this.phoneNoError = results.filter(result => result.propertyName === 'phoneNo');\r\n });\r\n }\r\n validateMobileNumber() {\r\n this.validationController.validate({ object: this, rules: { mobileNo: true } })\r\n .then(results => {\r\n this.mobileNoError = results.filter(result => result.propertyName === 'mobileNo');\r\n });\r\n }\r\n validateEmailFormat(emailId) {\r\n const emailRegex = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$/;\r\n if (!emailRegex.test(emailId)) {\r\n this.emailIdError = [{ error: { message: 'Invalid email format.' } }];\r\n } else {\r\n this.emailIdError = [];\r\n }\r\n }\r\n validate() {\r\n this.validationController.validate()\r\n .then(results => {\r\n this.pincodeError = results.filter(result => result.propertyName === 'pincode');\r\n });\r\n }\r\n\r\n async attached(){\r\n\r\n this.profileService.ContactTypeDropdown()\r\n .then(data => {\r\n this.types= Object.entries(data).map(([key, value])=>({value, key}));\r\n this.filterAddressTypes();\r\n });\r\n this.profileService.CountryCodesDropdown()\r\n .then(data => {\r\n this.codes= data;\r\n });\r\n this.profileService.CountryNamesDropdown()\r\n .then(data => {\r\n this.countryNames= data;\r\n });\r\n this.profileService.CountryStatesDropdown()\r\n .then(data => {\r\n this.states= data;\r\n });\r\n }\r\n async filterAddressTypes(){\r\n const contactDetails = await this.profileService.GetContactDetails(this.empID);\r\n contactDetails.map(item =>{\r\n this.existingContact.push(item.ContactType);\r\n });\r\n this.filteredAddressTypes = this.types.filter(\r\n type=> !this.existingContact.includes(type.value)\r\n );\r\n }\r\n async selectCountry(data){\r\n const states = await this.profileService.GetStatesDropdown();\r\n this.statesDropdown = states.filter(option => option.CountryID == data );\r\n }\r\n cancel() {\r\n this.controller.cancel();\r\n }\r\n saveContact(){\r\n const refreshEvent = new CustomEvent('refreshData');\r\n event.preventDefault();\r\n if (this.mobileNo === null){\r\n this.mobileNo = \"\";\r\n }\r\n if (this.fax=== null){\r\n this.fax = \"\";\r\n }\r\n this.controllerFactory.validate()\r\n .then(result => {\r\n if (result.valid) {\r\n let data = {\r\n EmployeeID: this.empID,\r\n Phone: this.phoneNo,\r\n PhoneContactID: this.PhoneContactID,\r\n PhoneCountryCode:this.phonetypeId,\r\n CountryCode: this.CountryCode,\r\n EmailID: this.emailId,\r\n Extension: this.Extension ,\r\n ContactTypeId:this.selectedContactType,\r\n ContactID:this.ContactID,\r\n Fax:this.fax,\r\n FaxContactID:this.faxcontactid,\r\n FaxCountryCode:this.FaxCountryCode,\r\n Mobile:this.mobileNo,\r\n MobileContactID:this.mobilecontactid,\r\n MobileCountryCode:this.MobileCountryCode,\r\n };\r\n this.profileService.ContactDetailsSave(data)\r\n .then(() => {\r\n this.controller.cancel();\r\n this.profileService.GetContactDetails(this.empID,)\r\n .then(data => {\r\n this.contactDetailsData = data;\r\n document.dispatchEvent(refreshEvent);\r\n });\r\n });\r\n }\r\n\r\n });\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 saveAddress(){\r\n const refreshEvent = new CustomEvent('refreshData');\r\n event.preventDefault();\r\n this.controllerFactory.validate()\r\n .then(result => {\r\n if (result.valid) {\r\n let data = {\r\n EmployeeID: this.empID,\r\n Address1: this.address1,\r\n Address2: this.address2,\r\n City: this.city,\r\n StateID: this.state,\r\n CountryID: this.country ,\r\n PinCode:this.pincode,\r\n ContactTypeId:this.selectedContactType,\r\n AddressID:this.addressID,\r\n };\r\n this.profileService.AddressDetailsSave(data)\r\n .then(() => {\r\n this.controller.cancel();\r\n this.profileService.GetContactDetails(this.empID)\r\n .then(data => {\r\n this.contactDetailsData = data;\r\n document.dispatchEvent(refreshEvent);\r\n });\r\n });\r\n }\r\n else{\r\n const errorMessages = document.querySelectorAll(\".error-messages\");\r\n if (errorMessages.length > 0) {\r\n errorMessages[0].scrollIntoView({ behavior: \"smooth\" });\r\n }\r\n }\r\n });\r\n }\r\n}\r\n","import {inject,computedFrom } 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 {validateTrigger, ValidationControllerFactory, ValidationRules} from 'aurelia-validation';\r\n//import Scrollbar from 'smooth-scrollbar';\r\nimport {LoginService} from \"../../../../shared/services/loginservice\";\r\nimport { Router } from 'aurelia-router';\r\n@inject(DialogController,ProfileService,JwtService,ValidationControllerFactory,Router,LoginService,Element)\r\nexport class AddEmergencyComponent {\r\n types = [];\r\n countryNames = [];\r\n contactnamevalidError = false;\r\n mobileNo = \"\";\r\n phoneNo = \"\";\r\n workcontact = \"\";\r\n isValidationMessageVisible = false;\r\n constructor(controller, ProfileService, JwtService,controllerFactory,router,loginService,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.phoneNo = '';\r\n this.phoneNoError = [];\r\n this.mobileNo = '';\r\n this.mobileNoError = [];\r\n this.workcontact = '';\r\n this.workcontactError = [];\r\n this.pincode = '';\r\n this.pincodeError = [];\r\n this.router = router;\r\n this.loginService = loginService;\r\n this.empID = this.jwtService.getEmployeeId();\r\n this.element = Element;\r\n\r\n ValidationRules\r\n .ensure('name').required().withMessage(\"Name is required\")\r\n .ensure('address1').required().withMessage(\"Address is required\")\r\n .ensure('phoneNo')\r\n .displayName('Phone number')\r\n .matches(/^\\d{10}$/)\r\n .withMessage('Please enter valid phone number')\r\n .ensure('mobileNo')\r\n .displayName('Mobile number')\r\n .matches(/^\\d{10}$/)\r\n .withMessage('Please enter valid mobile number')\r\n .ensure('workcontact')\r\n .displayName('Work contact number')\r\n .matches(/^\\d{10}$/)\r\n .withMessage('Please enter valid work contact number')\r\n .ensure('workextension')\r\n .maxLength(6)\r\n .withMessage('Work phone extension field maximum length is 6.')\r\n .ensure('pincode')\r\n .displayName('Pin code')\r\n .matches(/^\\d+$/, { message: '${$displayName} must contain only numeric values.' })\r\n .withMessage('Please enter valid pin code.')\r\n .on(this);\r\n ValidationRules.customRule(\r\n 'numericPincode',\r\n (value, obj) => /^\\d+$/.test(value),\r\n 'Pin code must contain only numeric values.'\r\n );\r\n }\r\n areAllContactsEmpty() {\r\n return !this.mobileNo && !this.phoneNo && !this.workcontact;\r\n }\r\n handleInput() {\r\n if (!this.areAllContactsEmpty()) {\r\n this.isValidationMessageVisible = false; // Hide the validation message\r\n }\r\n }\r\n validate() {\r\n this.validationController.validate()\r\n .then(results => {\r\n this.pincodeError = results.filter(result => result.propertyName === 'pincode');\r\n });\r\n }\r\n async bind() {\r\n setTimeout(()=>{ \r\n Scrollbar.init(document.querySelector('.contact-history-scrollbar'));\r\n },100)\r\n }\r\n attached() {\r\n this.profileService.EmployeeFamilyRelationship()\r\n .then(data => {\r\n this.options = data;\r\n });\r\n this.profileService.CountryCodesDropdown()\r\n .then(data => {\r\n this.codes = data;\r\n });\r\n this.profileService.CountryNamesDropdown()\r\n .then(data => {\r\n this.countryNames = data;\r\n });\r\n this.profileService.CountryStatesDropdown()\r\n .then(data => {\r\n this.states = data;\r\n });\r\n }\r\n cancel() {\r\n this.controller.cancel();\r\n }\r\n validateContatctName(event) {\r\n const inputElement = event.target;\r\n const inputValue = inputElement.value;\r\n const onlyCharactersRegex = /^[A-Za-z\\s]*$/;\r\n if (!onlyCharactersRegex.test(inputValue)) {\r\n this.contactnamevalidError = true;\r\n } else {\r\n this.contactnamevalidError = false;\r\n }\r\n }\r\n async selectCountry(data){\r\n const states = await this.profileService.GetStatesDropdown();\r\n this.statesDropdown = states.filter(option => option.CountryID == data );\r\n }\r\n\r\n SaveEmergencyContact() {\r\n const refreshEvent = new CustomEvent('refreshDataEmergencyContact');\r\n event.preventDefault();\r\n this.controllerFactory.validate()\r\n .then(result => {\r\n if (this.areAllContactsEmpty()) {\r\n this.isValidationMessageVisible = true;\r\n const errorMessages = document.querySelectorAll(\".error-messages\");\r\n if (errorMessages.length > 0) {\r\n //errorMessages[0].scrollIntoView({ behavior: \"smooth\" });\r\n // Scroll to the parent div with class 'errorfield' if error messages exist\r\n const errorFieldParent = document.querySelector('.common-parent');\r\n if (errorFieldParent) {\r\n errorFieldParent.scrollIntoView({ behavior: 'smooth' });\r\n }\r\n }\r\n\r\n } else {\r\n this.isValidationMessageVisible = false;\r\n if (result.valid && !this.contactnamevalidError) {\r\n let data = {\r\n EmployeeID: this.empID,\r\n Address1: this.address1,\r\n Address2: this.address2,\r\n City: this.city,\r\n StateID: this.state,\r\n CountryID: this.country,\r\n PinCode: this.pincode,\r\n AddressID: this.addressID,\r\n Name: this.name,\r\n EmployeeDependentConfigID: this.Relationship,\r\n HomeContactNo: this.phoneNo,\r\n Mobile: this.mobileNo,\r\n WorkContactNo: this.workcontact,\r\n HomeCountyCode: this.phonetypeId,\r\n MobileCountryCode: this.mobiletypeid,\r\n WorkCountryCode: this.workcontactid,\r\n HomeExtension: this.workphone,\r\n WorkExtension: this.workextension,\r\n PersonEmergencyContactID: this.PersonEmergencyContactID,\r\n };\r\n const EmergencyContactValidatecheck = {\r\n EmployeeID: this.empID,\r\n Name: this.name,\r\n PersonEmergencyContactID: this.PersonEmergencyContactID,\r\n };\r\n this.profileService.EmergencyContactAvoidDuplicate(EmergencyContactValidatecheck).then(name => {\r\n if (name === 1) {\r\n this.errorMessage = true;\r\n this.errorMessage = 'Name already exists.';\r\n const errorMessages = document.querySelectorAll(\".error-messages\");\r\n if (errorMessages.length > 0) {\r\n errorMessages[0].scrollIntoView({ behavior: \"smooth\" });\r\n // Scroll to the parent div with class 'errorfield' if error messages exist\r\n const errorFieldParent = document.querySelector('.common-parent');\r\n if (errorFieldParent) {\r\n errorFieldParent.scrollIntoView({ behavior: 'smooth' });\r\n }\r\n }\r\n setTimeout(() => {\r\n this.errorMessage = null\r\n }, 5000);\r\n }\r\n else {\r\n this.profileService.SaveEmergencyContact(data)\r\n .then(() => {\r\n this.controller.cancel();\r\n this.profileService.GetEmergencyContactDetails(this.empID)\r\n .then(data => {\r\n this.emergencycontactdata = data;\r\n document.dispatchEvent(refreshEvent);\r\n });\r\n });\r\n }\r\n });\r\n }\r\n else{\r\n const errorMessages = document.querySelectorAll(\".error-messages\");\r\n if (errorMessages.length > 0) {\r\n errorMessages[0].scrollIntoView({ behavior: \"auto\" });\r\n }\r\n }\r\n }\r\n });\r\n\r\n }\r\n}\r\n","import {inject } from 'aurelia-framework';\r\nimport {Addcontactcomponent} from \"./addcontact/addcontactcomponent\";\r\nimport {Editcontactcomponent} from \"./editcontact/editcontactcomponent\";\r\nimport {AddEmergencyComponent} from \"./addemergencycontact/addemergencycomponent\";\r\nimport {EditEmergencyComponent} from \"./editemergencycontact/editemergencycomponent\";\r\nimport {DialogService} from 'aurelia-dialog';\r\nimport {ProfileService} from \"../../../shared/services/profielservice\";\r\nimport {JwtService} from \"../../../shared/services/jwtservice\";\r\nimport {AlertpopupComponent} from \"../../alertpopup/alertpopupcomponent\";\r\nimport {ShowHistoryComponent} from \"./showemergencyhistory/showhistorycomponent\";\r\nimport Scrollbar from 'smooth-scrollbar';\r\nimport { Router } from 'aurelia-router';\r\nimport {config} from '../../../shared/services/config';\r\nimport {LoginService} from \"../../../shared/services/loginservice\";\r\n\r\n@inject(ProfileService,JwtService,DialogService,Router,LoginService)\r\nexport class Contactdetails {\r\n contactsucces = false;\r\n emergencymessage = false;\r\n deleteemergencymessage =false;\r\n deleteemployeemessage = false;\r\n pageSize = config.grid_PazeSize;\r\n topicsPageSize=10;\r\n contactPageSize = 10;\r\n\r\n constructor(ProfileService,JwtService,DialogService,router,loginService) {\r\n this.dialogService = DialogService;\r\n this.profileService = ProfileService;\r\n this.jwtService = JwtService;\r\n this.router = router;\r\n\r\n this.loginService = loginService;\r\n this.empID = this.jwtService.getEmployeeId();\r\n }\r\n\r\n activate(){\r\n this.contactDetailsData = this.FetchContactDetailsData();\r\n this.contactDetailsData = this.FetchContactDetailsDataforEdit();\r\n this.emergencycontactdata = this.FetchEmergencyContactDetailsData();\r\n this.emergencycontactdata = this.FetchEditEmergencyContactDetailsData();\r\n }\r\n async bind() {\r\n setTimeout(()=>{ \r\n Scrollbar.init(document.querySelector('.emergencycontact-scrollbar'));\r\n Scrollbar.init(document.querySelector('.contacthistory-scrollbar'));\r\n },100)\r\n }\r\n\r\n async attached(params) {\r\n this.isLoading = true;\r\n const id = this.router.currentInstruction.queryParams.id;\r\n if(id != null && id !='' && id !=undefined)\r\n {\r\n this.empID=id;\r\n }\r\n else{\r\n this.empID=this.jwtService.getEmployeeId();\r\n }\r\n\r\n document.addEventListener('refreshData', this.FetchContactDetailsData);\r\n document.addEventListener('refreshEditData', this.FetchContactDetailsDataforEdit);\r\n const contactDetails = await this.profileService.GetContactDetails(this.empID);\r\n this.contactDetailsData = contactDetails;\r\n const emergencycontacts = await this.profileService.GetEmergencyContactDetails(this.empID);\r\n this.emergencycontactdata = emergencycontacts;\r\n document.addEventListener('refreshDataEmergencyContact', this.FetchEmergencyContactDetailsData);\r\n document.addEventListener('refreshDataEditEmergencyContact', this.FetchEditEmergencyContactDetailsData);\r\n const emergencycontacthistory = await this.profileService.GetEmergencyContactHistory(this.empID);\r\n this.emergencyhistory = emergencycontacthistory;\r\n this.isLoading = false;\r\n // setTimeout(() => {\r\n // this.isLoading = false;\r\n // }, 3000);\r\n }\r\n FetchContactDetailsData = () =>{\r\n this.profileService.GetContactDetails(this.empID)\r\n .then(data => {\r\n this.contactDetailsData = data;\r\n this.sucess = \"Contact details added successfully\";\r\n this.contactsucces = true;\r\n setTimeout(() =>{\r\n this.sucess = null;\r\n },4000)\r\n });\r\n };\r\n FetchContactDetailsDataforEdit = () =>{\r\n this.profileService.GetContactDetails(this.empID)\r\n .then(data => {\r\n this.contactDetailsData = data;\r\n this.sucess = \"Contact details updated successfully\";\r\n this.contactsucces = true;\r\n this.contactUpdatemessage = false;\r\n setTimeout(() =>{\r\n this.sucess = null;\r\n },4000)\r\n });\r\n };\r\n FetchEmergencyContactDetailsData = () =>{\r\n this.profileService.GetEmergencyContactDetails(this.empID)\r\n .then(data => {\r\n this.emergencycontactdata = data;\r\n this.Eergencysucess = \"Emergency contact added successfully\";\r\n this.emergencymessage = true;\r\n setTimeout(() =>{\r\n this.Eergencysucess = null;\r\n },4000)\r\n });\r\n };\r\n FetchEditEmergencyContactDetailsData = () =>{\r\n this.profileService.GetEmergencyContactDetails(this.empID)\r\n .then(data => {\r\n this.emergencycontactdata = data;\r\n this.Eergencysucess = \"Emergency contact updated successfully\";\r\n this.emergencymessage = true;\r\n this.emergencyUpdatemessage = false;\r\n setTimeout(() =>{\r\n this.Eergencysucess = null;\r\n },4000)\r\n });\r\n };\r\n\r\n AddnewcontactPopup(data) {\r\n this.dialogService.open({viewModel: Addcontactcomponent, model: data});\r\n }\r\n EditcontactPopup(data) {\r\n this.dialogService.open({viewModel: Editcontactcomponent, model: data});\r\n }\r\n AddEmergencyContactPopup(data) {\r\n this.dialogService.open({viewModel: AddEmergencyComponent, model: data});\r\n }\r\n EditEmergencyContactPopup(data) {\r\n this.dialogService.open({viewModel: EditEmergencyComponent, model: data});\r\n }\r\n BindHistoryData(data) {\r\n this.dialogService.open({viewModel: ShowHistoryComponent, model: data});\r\n }\r\n async deleteEmployeeContact(data) {\r\n this.contactid = data.ContactTypeId;\r\n if(data.ContactTypeId === 7 ){\r\n return alert(\"The business contact is required.\")\r\n }\r\n this.personid = data.PersonId;\r\n const result = await this.dialogService.open({\r\n viewModel: AlertpopupComponent,\r\n model: \"\",\r\n }).whenClosed(response => response);\r\n if (result.wasCancelled) {\r\n return;\r\n }\r\n await this.profileService.DeleteEmployeeContact(this.contactid,this.personid,this.empID);\r\n const employeeContactData = await this.profileService.GetContactDetails(this.empID);\r\n this.contactDetailsData = employeeContactData;\r\n this.Deleteemployee = \"Contact details deleted successfully\";\r\n this.deleteemployeemessage = true;\r\n setTimeout(() =>{\r\n this.Deleteemployee = null;\r\n },4000)\r\n }\r\n async deleteEmergencyContact(data) {\r\n this.PersonEmergencyContactID = data.PersonEmergencyContactID;\r\n const result = await this.dialogService.open({\r\n viewModel: AlertpopupComponent,\r\n model: \"\",\r\n }).whenClosed(response => response);\r\n if (result.wasCancelled) {\r\n return;\r\n }\r\n await this.profileService.DeleteEmergencyContact(this.PersonEmergencyContactID,this.empID);\r\n const emergencyContactData = await this.profileService.GetEmergencyContactDetails(this.empID);\r\n this.emergencycontactdata = emergencyContactData;\r\n const emergencycontacthistory = await this.profileService.GetEmergencyContactHistory(this.empID);\r\n this.emergencyhistory = emergencycontacthistory;\r\n this.Deleteemergency = \"Emergency contact deleted successfully\";\r\n this.deleteemergencymessage = true;\r\n setTimeout(() =>{\r\n this.Deleteemergency = null;\r\n },4000)\r\n }\r\n\r\n}\r\n","import {inject } 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} from 'aurelia-validation';\r\nimport { Router } from 'aurelia-router';\r\nimport {LoginService} from \"../../../../shared/services/loginservice\";\r\n\r\n@inject(DialogController,ProfileService,JwtService,ValidationControllerFactory,Router,LoginService)\r\nexport class Editcontactcomponent {\r\n types = [];\r\n tempHide = false;\r\n isDragging = false;\r\n dialog;\r\n static inject = [Element];\r\n\r\n constructor(controller,ProfileService,JwtService,controllerFactory,router,loginService){\r\n this.controller = controller;\r\n this.profileService=ProfileService;\r\n this.jwtService = JwtService;\r\n this.controllerFactory = controllerFactory.createForCurrentScope();\r\n this.empID = this.jwtService.getEmployeeId();\r\n this.phone = '';\r\n this.phoneError = [];\r\n this.mobile = '';\r\n this.mobileError = [];\r\n this.fax = '';\r\n this.faxError = [];\r\n this.pincode = '';\r\n this.pincodeError = [];\r\n this.router = router;\r\n this.loginService = loginService;\r\n\r\n ValidationRules\r\n .ensure('selectedContactType').required().withMessage(\"Contact Type is required\")\r\n .ensure('phone').required().withMessage(\"Phone number is required\")\r\n .matches(/^\\d{10}$/, { message: 'Phone number must be exactly 10 digits.' })\r\n .withMessage(\"Please enter valid phone number\")\r\n .ensure('mobile')\r\n .matches(/^\\d{10}$/, { message: 'Mobile number must be exactly 10 digits.' })\r\n .withMessage(\"Please enter valid mobile number\")\r\n .ensure('fax')\r\n .matches(/^\\d{10}$/, { message: 'Fax number must be exactly 10 digits.' })\r\n .withMessage(\"Please enter valid fax number\")\r\n .ensure('address1').required().withMessage(\"Address is required\")\r\n .ensure('email')\r\n .matches(/^[^\\s@]+@[^\\s@]+\\.(com|co|in|org|cc|net)$/)\r\n .withMessage('Please enter a valid email address.')\r\n .ensure('pincode')\r\n .displayName('Pin code')\r\n .matches(/^\\d+$/, { message: '${$displayName} must contain only numeric values.' })\r\n .withMessage('Please enter valid pin code.')\r\n .on(this);\r\n\r\n }\r\n validatePhoneNumber() {\r\n this.validationController.validate({ object: this, rules: { phone: true } })\r\n .then(results => {\r\n this.phoneError = results.filter(result => result.propertyName === 'phone');\r\n });\r\n }\r\n validateMobileNumber() {\r\n this.validationController.validate({ object: this, rules: { mobile: true } })\r\n .then(results => {\r\n this.mobileError = results.filter(result => result.propertyName === 'mobile');\r\n });\r\n }\r\n validateEmailFormat(email) {\r\n const emailRegex = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$/;\r\n if (!emailRegex.test(email)) {\r\n this.emailError = [{ error: { message: 'Invalid email format.' } }];\r\n } else {\r\n this.emailError = [];\r\n }\r\n }\r\n validate() {\r\n this.validationController.validate()\r\n .then(results => {\r\n this.pincodeError = results.filter(result => result.propertyName === 'pincode');\r\n });\r\n }\r\n countryMatcher = (a, b) => {\r\n return a.key === b.key;\r\n };\r\n phoneCodeMatched = (a, b) => {\r\n return a.key === b.key;\r\n };\r\n async activate(data){\r\n this.ContacatTypeID =data.ContactTypeId;\r\n if(this.ContacatTypeID){\r\n this.ContactTypeName = data.ContactType;\r\n this.tempHide = false;\r\n }\r\n this.PersonContactTypeId = data.PersonContactTypeId;\r\n this.PersonId = data.PersonId;\r\n await this.profileService.EditEmployeeAddress(this.ContacatTypeID,this.PersonContactTypeId,this.PersonId)\r\n .then(data => {\r\n this.addressdata = data;\r\n this.address1 = data.Address1;\r\n this.address2 = data.Address2;\r\n this.city = data.City;\r\n this.countryID = data.CountryID;\r\n this.StateNames = data.StateID;\r\n this.pincode = data.PinCode;\r\n this.AddressID = data.AddressID;\r\n this.selectCountry(this.countryID);\r\n });\r\n await this.profileService.EditEmployeeContact(this.ContacatTypeID,this.PersonContactTypeId,this.PersonId)\r\n .then(data => {\r\n this.contactdata = data;\r\n this.phone = data.Phone;\r\n this.phoneid = data.PhoneCountryCode;\r\n this.Extension = data.Extension;\r\n this.mobile = data.Mobile;\r\n this.mobileCountryCode = data.MobileCountryCode;\r\n this.fax = data.Fax;\r\n this.faxCountryCode = data.FaxCountryCode;\r\n this.email = data.EmailID;\r\n this.PhoneContactID= data.PhoneContactID;\r\n this.FaxContactID= data.FaxContactID;\r\n this.MobileContactID= data.MobileContactID;\r\n });\r\n }\r\n async attached(){\r\n\r\n this.profileService.ContactTypeDropdown()\r\n .then(data => {\r\n this.types= Object.entries(data).map(([key, value])=>({value, key}));\r\n });\r\n this.profileService.CountryCodesDropdown()\r\n .then(data => {\r\n this.codes= data;\r\n });\r\n this.profileService.CountryNamesDropdown()\r\n .then(data => {\r\n this.countryNames= data;\r\n });\r\n this.profileService.CountryStatesDropdown()\r\n .then(data => {\r\n this.states= data;\r\n });\r\n }\r\n async selectCountry(data){\r\n const states = await this.profileService.GetStatesDropdown();\r\n const countryId = data.CountryID ? data.CountryID : data;\r\n this.statesDropdown = states.filter(option => option.CountryID === countryId );\r\n }\r\n cancel() {\r\n this.controller.cancel();\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 SaveConatactDetails(){\r\n const refreshEvent = new CustomEvent('refreshEditData');\r\n event.preventDefault();\r\n if (this.mobile === null){\r\n this.mobile = \"\";\r\n }\r\n if (this.fax=== null){\r\n this.fax = \"\";\r\n }\r\n this.controllerFactory.validate()\r\n .then(result => {\r\n if (result.valid) {\r\n let data = {\r\n EmployeeID: this.empID,\r\n Phone: this.phone,\r\n PhoneContactID: this.PhoneContactID,\r\n PhoneCountryCode:this.phonetypeId ? this.phonetypeId.CountryCodeID : this.phoneid,\r\n CountryCode: this.CountryCode,\r\n EmailID: this.email,\r\n Extension: this.Extension ,\r\n ContactTypeId:this.ContacatTypeID,\r\n ContactTypeName:this.ContactTypeName,\r\n ContactID:this.ContactID,\r\n Fax:this.fax,\r\n FaxContactID:this.FaxContactID,\r\n FaxCountryCode:this.faxCountryCodeId ? this.faxCountryCodeId.CountryCodeID : this.faxCountryCode,\r\n Mobile:this.mobile,\r\n MobileContactID:this.MobileContactID,\r\n MobileCountryCode:this.mobileCountryId ? this.mobileCountryId.CountryCodeID : this.mobileCountryCode,\r\n\r\n };\r\n this.profileService.ContactDetailsSave(data)\r\n .then(() => {\r\n this.controller.cancel();\r\n this.profileService.GetContactDetails(this.empID)\r\n .then(data => {\r\n this.contactDetailsData = data;\r\n document.dispatchEvent(refreshEvent);\r\n });\r\n });\r\n }\r\n });\r\n }\r\n SaveUpdateAddress(){\r\n const refreshEvent = new CustomEvent('refreshEditData');\r\n const State = document.getElementById('state').value;\r\n const countryid = this.selectedCountry ? this.selectedCountry.CountryID : this.countryID;\r\n event.preventDefault();\r\n this.controllerFactory.validate()\r\n .then(result => {\r\n if (result.valid) {\r\n let data = {\r\n EmployeeID: this.empID,\r\n Address1: this.address1,\r\n Address2: this.address2,\r\n City: this.city,\r\n StateID: State,\r\n CountryID: countryid ,\r\n PinCode:this.pincode,\r\n ContactTypeId:this.ContacatTypeID,\r\n AddressID:this.AddressID,\r\n };\r\n this.profileService.AddressDetailsSave(data)\r\n .then(() => {\r\n this.controller.cancel();\r\n this.profileService.GetContactDetails(this.empID)\r\n .then(data => {\r\n this.contactDetailsData = data;\r\n document.dispatchEvent(refreshEvent);\r\n });\r\n });\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 { ProfileService } from '../../../../shared/services/profielservice';\r\nimport { JwtService } from '../../../../shared/services/jwtservice';\r\nimport {ValidationControllerFactory, ValidationRules,validateTrigger} from 'aurelia-validation';\r\nimport Scrollbar from 'smooth-scrollbar';\r\nimport {LoginService} from \"../../../../shared/services/loginservice\";\r\nimport { Router } from 'aurelia-router';\r\n@inject(DialogController,ProfileService,JwtService,ValidationControllerFactory,Router,LoginService)\r\nexport class EditEmergencyComponent {\r\n types = [];\r\n contactnamevalidError = false;\r\n isAnyContactProvided = true;\r\n mobile = \"\";\r\n phone = \"\";\r\n workcontact = \"\";\r\n isValidationMessageVisible = false; \r\n\r\n constructor(controller, ProfileService,JwtService,controllerFactory,router,loginService) {\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.phone = '';\r\n this.phoneError = [];\r\n this.mobile = '';\r\n this.mobileError = [];\r\n this.workcontact = '';\r\n this.workcontactError = [];\r\n this.pincode = '';\r\n this.pincodeError = [];\r\n this.router = router;\r\n this.loginService = loginService;\r\n this.empID = this.jwtService.getEmployeeId();\r\n ValidationRules\r\n .ensure('name').required().withMessage(\"Name is required\")\r\n // .matches(/^[A-Za-z]+$/)\r\n .matches(/^[A-Za-z\\s]+$/)\r\n .withMessage('Please enter characters only.')\r\n .ensure('address1').required().withMessage(\"Address is required\")\r\n .ensure('phone')\r\n .matches(/^\\d{10}$/, { message: 'Phone number must be exactly 10 digits.' })\r\n .withMessage(\"Please enter valid phone number\")\r\n .ensure('mobile')\r\n .matches(/^\\d{10}$/)\r\n .withMessage('Please enter valid mobile number')\r\n .ensure('workcontact')\r\n .matches(/^\\d{10}$/, { message: 'Work contact number must be exactly 10 digits.' })\r\n .withMessage(\"Please enter valid work contact number\")\r\n .ensure('workectension')\r\n .maxLength(6)\r\n .withMessage('Work phone extension field maximum length is 6.')\r\n .ensure('pincode')\r\n .displayName('Pin code')\r\n .matches(/^\\d+$/, { message: '${$displayName} must contain only numeric values.' })\r\n .withMessage('Please enter valid pin code.')\r\n .on(this);\r\n }\r\n validateMobileNumber() {\r\n this.validationController.validate({ object: this, rules: { mobile: true } })\r\n .then(results => {\r\n this.mobileError = results.filter(result => result.propertyName === 'mobile');\r\n });\r\n }\r\n validatePhoneNumber() {\r\n this.validationController.validate({ object: this, rules: { phone: true } })\r\n .then(results => {\r\n this.phoneError = results.filter(result => result.propertyName === 'phone');\r\n });\r\n }\r\n validateWorkcontactNumber() {\r\n this.validationController.validate({ object: this, rules: { workcontact: true } })\r\n .then(results => {\r\n this.workcontactError = results.filter(result => result.propertyName === 'workcontact');\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 }\r\n }\r\n validate() {\r\n this.validationController.validate()\r\n .then(results => {\r\n this.pincodeError = results.filter(result => result.propertyName === 'pincode');\r\n });\r\n }\r\n areAllContactsEmpty() {\r\n return !this.mobile && !this.phone && !this.workcontact;\r\n }\r\n handleInput() {\r\n if (!this.areAllContactsEmpty()) {\r\n this.isValidationMessageVisible = false; // Hide the validation message\r\n }\r\n }\r\n countryMatcher = (a, b) => {\r\n return a.key === b.key;\r\n };\r\n stateMatcher = (a, b) => {\r\n return a.key === b.key;\r\n };\r\n async bind() {\r\n setTimeout(()=>{ \r\n Scrollbar.init(document.querySelector('.contact-history-scrollbar'));\r\n },100)\r\n }\r\n attached() {\r\n this.profileService.EmployeeFamilyRelationship()\r\n .then(data => {\r\n this.options= data;\r\n });\r\n this.profileService.CountryCodesDropdown()\r\n .then(data => {\r\n this.codes = data;\r\n this.phoneCodeMatched = (a, b) => {\r\n return a.CountryCodeID == b.key;\r\n }\r\n });\r\n this.profileService.CountryNamesDropdown()\r\n .then(data => {\r\n this.countryNames = data;\r\n });\r\n this.profileService.CountryStatesDropdown()\r\n .then(data => {\r\n this.states = data;\r\n });\r\n this.profileService.GetEmergencyContactDetails(this.empID)\r\n .then(data => {\r\n this.emergencycontactdata = data;\r\n });\r\n }\r\n cancel() {\r\n this.controller.cancel();\r\n }\r\n \r\n async activate(data){\r\n this.emergencycontactdata = data;\r\n this.address1 = data.Address1;\r\n this.address2 = data.Address2;\r\n this.name = data.Name;\r\n this.Relationship = data.EmployeeDependentConfigID;\r\n this.mobile = data.Mobile;\r\n this.mobileid = data.MobileCountryCode;\r\n this.phone = data.HomeContactNo;\r\n this.phoneid = data.HomeCountyCode;\r\n this.workcontact = data.WorkContactNo;\r\n this.workcontactid = data.WorkCountryCode;\r\n this.workectension = data.WorkExtension;\r\n this.city = data.City;\r\n this.Country = data.CountryID;\r\n this.StateNames = data.StateID;\r\n this.pincode = data.PinCode;\r\n this.AddressID = data.AddressID;\r\n this.PersonId = data.PersonId;\r\n this.PersonEmergencyContactID = data.PersonEmergencyContactID;\r\n this.HomeExtension = data.HomeExtension;\r\n await this.selectCountry(this.Country);\r\n }\r\n async selectCountry(data){\r\n const states = await this.profileService.GetStatesDropdown();\r\n const countryId = data.CountryID ? data.CountryID : data;\r\n this.statesDropdown = states.filter(option => option.CountryID === countryId );\r\n }\r\n SaveEmergencyContact(){\r\n const refreshEvent = new CustomEvent('refreshDataEditEmergencyContact');\r\n event.preventDefault();\r\n this.controllerFactory.validate()\r\n .then(result => {\r\n if (this.areAllContactsEmpty()) {\r\n this.isValidationMessageVisible = true;\r\n const errorMessages = document.querySelectorAll(\".error-messages\");\r\n if (errorMessages.length > 0) {\r\n errorMessages[0].scrollIntoView({ behavior: \"auto\" });\r\n }\r\n } else {\r\n this.isValidationMessageVisible = false;\r\n if (result.valid && !this.contactnamevalidError) {\r\n let data = {\r\n EmployeeID: this.empID,\r\n Address1: this.address1,\r\n Address2: this.address2,\r\n City: this.city,\r\n PinCode: this.pincode,\r\n AddressID: this.AddressID,\r\n PersonId: this.PersonId,\r\n PersonEmergencyContactID: this.PersonEmergencyContactID,\r\n StateID: this.selectedState ? this.selectedState.StateID : this.StateNames,\r\n CountryID: this.selectedCountry ? this.selectedCountry.CountryID : this.Country,\r\n Name: this.name,\r\n EmployeeDependentConfigID: this.Relationship,\r\n HomeContactNo: this.phone,\r\n Mobile: this.mobile,\r\n WorkContactNo: this.workcontact,\r\n HomeCountyCode: this.phoneCountryCodeId ? this.phoneCountryCodeId.CountryCodeID : this.phoneid,\r\n MobileCountryCode: this.mobileCountryCodeid ? this.mobileCountryCodeid.CountryCodeID : this.mobileid,\r\n WorkCountryCode: this.workcontactCountryCodeId ? this.workcontactCountryCodeId.CountryCodeID : this.workcontactid,\r\n HomeExtension: this.HomeExtension,\r\n WorkExtension: this.workectension,\r\n };\r\n const EmergencyContactValidatecheck = {\r\n EmployeeID: this.empID,\r\n Name: this.name,\r\n PersonEmergencyContactID: this.PersonEmergencyContactID,\r\n };\r\n this.profileService.EmergencyContactAvoidDuplicate(EmergencyContactValidatecheck).then(name => {\r\n if (name === 1) {\r\n this.errorMessage = true;\r\n this.errorMessage = 'Name already exists.';\r\n setTimeout(() => {\r\n this.errorMessage = null\r\n }, 5000);\r\n }\r\n else {\r\n this.profileService.SaveEmergencyContact(data)\r\n .then(() => {\r\n this.controller.cancel();\r\n this.profileService.GetEmergencyContactDetails(this.empID)\r\n .then(data => {\r\n this.emergencycontactdata = data;\r\n document.dispatchEvent(refreshEvent); // Trigger the custom event\r\n });\r\n });\r\n }\r\n });\r\n }\r\n else{\r\n const errorMessages = document.querySelectorAll(\".error-messages\");\r\n if (errorMessages.length > 0) {\r\n errorMessages[0].scrollIntoView({ behavior: \"auto\" });\r\n }}\r\n\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 { ProfileService } from '../../../../shared/services/profielservice';\r\nimport { JwtService } from '../../../../shared/services/jwtservice';\r\nimport Scrollbar from 'smooth-scrollbar';\r\nimport {LoginService} from \"../../../../shared/services/loginservice\";\r\nimport { Router } from 'aurelia-router';\r\n@inject(DialogController,ProfileService,JwtService,Router,LoginService)\r\nexport class ShowHistoryComponent {\r\n types = [];\r\n isDragging = false;\r\n dialog;\r\n static inject = [Element];\r\n constructor(controller, ProfileService, JwtService,router,loginService) {\r\n this.controller = controller;\r\n this.profileService = ProfileService;\r\n this.jwtService = JwtService;\r\n this.router = router;\r\n this.loginService = loginService;\r\n this.empID = this.jwtService.getEmployeeId();\r\n }\r\n async bind() {\r\n setTimeout(()=>{ \r\n Scrollbar.init(document.querySelector('.contact-history-scrollbar'));\r\n },100)\r\n }\r\n attached() {\r\n\r\n this.profileService.EmployeeFamilyRelationship()\r\n .then(data => {\r\n this.options= data;\r\n });\r\n this.profileService.CountryCodesDropdown()\r\n .then(data => {\r\n this.codes = data;\r\n });\r\n this.profileService.CountryNamesDropdown()\r\n .then(data => {\r\n this.countryNames = data;\r\n });\r\n this.profileService.CountryStatesDropdown()\r\n .then(data => {\r\n this.states = data;\r\n });\r\n this.profileService.GetEmergencyContactDetails(this.empID)\r\n .then(data => {\r\n this.emergencycontactdata = data;\r\n });\r\n }\r\n cancel() {\r\n this.controller.cancel();\r\n }\r\n activate(data){\r\n this.emergencyhistory = data;\r\n this.address1 = data.Address1;\r\n this.address2 = data.Address2;\r\n this.name = data.Name;\r\n this.Relation = data.Relationship;\r\n this.mobile = data.Mobile;\r\n this.mobilid = data.MobileCountryCode;\r\n this.phone = data.HomeContactNo;\r\n this.phoneid = data.HomeCountyCode;\r\n this.workcontact = data.WorkContactNo;\r\n this.workcontactid = data.WorkCountryCode;\r\n this.workectension = data.WorkExtension;\r\n this.city = data.City;\r\n this.Country = data.CountryID;\r\n this.StateNames = data.StateID;\r\n this.pincode = data.PinCode;\r\n this.AddressID = data.AddressID;\r\n this.PersonId = data.PersonId;\r\n this.PersonEmergencyContactID = data.PersonEmergencyContactID;\r\n this.HomeExtension = data.HomeExtension;\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\r\n\r\n\r\n","// Module\nvar code = \"\\r\\n\";\n// Exports\nexport default code;","// Module\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/loader.gif\", import.meta.url);\nvar ___HTML_LOADER_IMPORT_1___ = new URL(\"../../../images/edit.svg\", import.meta.url);\nvar ___HTML_LOADER_IMPORT_2___ = new URL(\"../../../images/x-square.svg\", import.meta.url);\nvar ___HTML_LOADER_IMPORT_3___ = new URL(\"../../../images/password-show.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 ___HTML_LOADER_REPLACEMENT_3___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_3___);\nvar code = \"\\r\\n\";\n// Exports\nexport default code;","// Module\nvar code = \"\\r\\n\";\n// Exports\nexport default code;","// Module\nvar code = \"\\r\\n\";\n// Exports\nexport default code;","// Module\nvar code = \"\\r\\n\";\n// Exports\nexport default code;"],"names":[],"sourceRoot":""}