{"version":3,"file":"app-04f977a4.d152cf98c45d962fa693.bundle.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAIA;AACA;AAEA;AACA;AAEA;AACA;AAWA;;AAWA;AAAA;AAAA;AAAA;AAAA;AApBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA0SA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAGA;AACA;AACA;AACA;AAnTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAGA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AAGA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;;AAGA;AAYA;AACA;AAIA;AAEA;AACA;AAMA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;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;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;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;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;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;;AAEA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAtZA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;;;AC5CA;AAEA;AAKA;AAAA;AAHA;AACA;AA6BA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAGA;AACA;AACA;AACA;AAvCA;AACA;AAEA;AAEA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAiBA;AA9CA;;;;;;;;;;;;;;;;;;;;;;;;;;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAOA;AAAA;AAJA;AACA;AACA;AAgDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1EA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AAEA;AACA;AAGA;AAEA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAcA;AACA;AACA;AACA;AACA;AACA;AAeA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC3HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAKA;AACA;AAEA;AACA;AAEA;AACA;AAcA;;AASA;AAAA;AAAA;AAAA;AAAA;AArBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA+EA;AACA;AAAA;AAGA;AACA;AAAA;AAGA;AACA;AAAA;AAGA;AACA;AAAA;AAGA;AACA;AAAA;AA6TA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAGA;AACA;AACA;AACA;AAvaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAGA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AAGA;AAGA;AACA;AACA;AACA;AACA;AACA;AAIA;AAYA;AACA;AAGA;AAsBA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;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;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;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;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AACA;AAEA;AACA;AAEA;AAEA;AACA;AAEA;AAEA;AACA;AAEA;AAEA;AACA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;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;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAGA;AACA;AAAA;AAAA;AAAA;AAEA;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;AAEA;AACA;AACA;AACA;AAmBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;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;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AA7eA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;;;ACjDA;AAEA;AAKA;AAAA;AAHA;AACA;AA6BA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAGA;AACA;AACA;AACA;AAvCA;AACA;AAEA;AAEA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAiBA;AA9CA;;;;;;;;;;;;;;;;;;;;;;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAOA;AAAA;AAJA;AACA;AACA;AAiEA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAGA;AACA;AACA;AACA;AA3EA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAiBA;;;;;;;;;;;;;AC7FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACPA;AACA;AACA;AACA;;;;;;;;;;;;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACPA;AACA;AACA;AACA;;;;;;;;;;;ACHA;AACA;AACA;AACA","sources":["webpack://HRMSPortal/./src/components/myprofile/documents/adddocument/adddocument.js","webpack://HRMSPortal/./src/components/myprofile/documents/deletefile/confirmdelete.js","webpack://HRMSPortal/./src/components/myprofile/documents/documents.js","webpack://HRMSPortal/./src/components/myprofile/documents/editdocument/editdocument.js","webpack://HRMSPortal/./src/components/myprofile/documents/physicalcopypopup/physicalcopypopup.js","webpack://HRMSPortal/./src/components/myprofile/documents/viewdocument/viewdocument.js","webpack://HRMSPortal/./src/components/myprofile/documents/adddocument/adddocument.html","webpack://HRMSPortal/./src/components/myprofile/documents/deletefile/confirmdelete.html","webpack://HRMSPortal/./src/components/myprofile/documents/documents.html","webpack://HRMSPortal/./src/components/myprofile/documents/editdocument/editdocument.html","webpack://HRMSPortal/./src/components/myprofile/documents/physicalcopypopup/physicalcopypopup.html","webpack://HRMSPortal/./src/components/myprofile/documents/viewdocument/viewdocument.html"],"sourcesContent":["import {inject,bindingMode,bindable} from 'aurelia-framework';\r\nimport { DialogController } from 'aurelia-dialog';\r\nimport { Physicalcopypopup } from '../physicalcopypopup/physicalcopypopup';\r\nimport {DialogService} from 'aurelia-dialog';\r\nimport { ProfileService } from '../../../../shared/services/profielservice';\r\nimport { JwtService } from '../../../../shared/services/jwtservice';\r\nimport 'flatpickr/dist/flatpickr.min.css';\r\nimport flatpickr from 'flatpickr';\r\nimport {ValidationControllerFactory, ValidationRules,validateTrigger} 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\r\n@inject(DialogController, DialogService, ProfileService, JwtService, ValidationControllerFactory,Router,LoginService)\r\nexport class Adddocument {\r\n\r\n @bindable({\r\n defaultBindingMode: bindingMode.twoWay\r\n }) DOIdate;\r\n @bindable({\r\n defaultBindingMode: bindingMode.twoWay\r\n }) Expirydate;\r\n @bindable({\r\n defaultBindingMode: bindingMode.twoWay\r\n }) returndate;\r\n\r\n notifyFields = false;\r\n showOtherFields = false;\r\n showPhysicalCopy = false;\r\n physicalNotifyDays = false;\r\n isDisabled = true;\r\n documentTypesDropdown = [];\r\n countryDropdown = [];\r\n file;\r\n fileValidatorRule = false;\r\n selectedDocType = null; //aurelia select\r\n selectedCountry = null;\r\n selectedState = null;\r\n selectedNotifyFreq = null;\r\n selectedNotifyTypes = null;\r\n uploadedFiles = [];\r\n isSubmitClicked = false;\r\n isDragging = false;\r\n dialog;\r\n static inject = [Element];\r\n\r\n constructor(DialogController, dialogService, ProfileService, JwtService, controllerFactory,router,loginService) {\r\n this.controller = DialogController;\r\n this.dialogService = dialogService;\r\n this.profileService = ProfileService;\r\n this.jwtService = JwtService;\r\n this.controllerFactory = controllerFactory.createForCurrentScope();\r\n this.router = router;\r\n this.loginService = loginService;\r\n this.empID = this.jwtService.getEmployeeId();\r\n\r\n ValidationRules.customRule(\r\n 'validEmails',\r\n (value, obj) => {\r\n if (typeof value !== 'string') {\r\n return false;\r\n }\r\n const emails = value.split(',');\r\n\r\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.(com|co|in|org|cc|net)$/;\r\n const invalidEmails = [];\r\n for (const email of emails) {\r\n const trimmedEmail = email.trim();\r\n if (!emailRegex.test(trimmedEmail)) {\r\n invalidEmails.push(trimmedEmail);\r\n }\r\n }\r\n // Check if any emails are invalid\r\n if (invalidEmails.length > 0) {\r\n obj.emailsErrors = ['Invalid email address(es)'];\r\n return false;\r\n }\r\n // Check if emails are separated by commas\r\n if (emails.length > 1 && value.indexOf(',') === -1) {\r\n obj.emailsErrors = ['Email(s) should be separated by commas'];\r\n return false;\r\n }\r\n obj.emailsErrors = [];\r\n return true;\r\n },\r\n '${$displayName} is invalid.',\r\n (obj) => ({\r\n obj\r\n })\r\n );\r\n\r\n ValidationRules.customRule(\r\n 'file',\r\n () =>{\r\n if(this.fileValidatorRule === true){\r\n return false;\r\n }else{\r\n return true;\r\n }\r\n },\r\n //'${$displayName} is required'\r\n );\r\n\r\n ValidationRules\r\n .ensure('selectedDocType').required().withMessage('Document type is required')\r\n .ensure('Subject').required().withMessage('Document name is required')\r\n .ensure('DocIssuedDate').required().withMessage('Date of issuance is required')\r\n .ensure('NotifyDays').required().withMessage('Notify before expiry day is required.')\r\n .ensure('upload').required().withMessage('Upload document is required.')\r\n .satisfiesRule('file')\r\n .ensure('NotifyOtherEmailIDs').required().withMessage('Email id(s) field is required').then()\r\n .satisfiesRule('validEmails').withMessage(\"Invalid email address and Email(s) should be separated by commas\")\r\n .ensure('NotifyEmpInd')\r\n .displayName('Employee')\r\n .satisfies(() => {\r\n return this.NotifyEmpInd || this.NotifyHRInd || this.NotifyRMInd || this.NotifyOtherInd;\r\n })\r\n .withMessage('Please select at least one notified.')\r\n .on(this);\r\n\r\n }\r\n\r\n get notifyCheckboxes() {\r\n return [\r\n this.NotifyEmpInd,\r\n this.NotifyHRInd,\r\n this.NotifyRMInd,\r\n this.NotifyOtherInd,\r\n ];\r\n }\r\n\r\n async bind() {\r\n setTimeout(()=>{\r\n Scrollbar.init(document.querySelector('.adddocument-scrollbar'));\r\n },100)\r\n }\r\n\r\n async attached() {\r\n this.specializationInput.focus();\r\n\r\n flatpickr(this.DOIPicker, {\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.DOIdate, // 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 clickOpens:false,\r\n onClose: function (selectedDates, dateStr, instance) {\r\n this.FromDate = dateStr;\r\n }\r\n });\r\n this.DOIcalendarIcon.addEventListener('click', () => {\r\n this.DOIPicker._flatpickr.open();\r\n });\r\n flatpickr(this.ExpiryPicker, {\r\n closeOnSelect: true,\r\n dateFormat: 'd-m-Y', // the date format (default is 'Y-m-d')\r\n minDate: 'today', // the minimum selectable date in the calendar (default is null, which means no limit)\r\n maxDate: null, // the maximum selectable date in the calendar (default is null, which means no limit)\r\n defaultDate: this.Expirydate, // 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 clickOpens:false,\r\n onClose: function (selectedDates, dateStr, instance) { // a function that will be called when the calendar is closed\r\n this.FromDate = dateStr;\r\n }\r\n });\r\n this.ExpirycalendarIcon.addEventListener('click', () => {\r\n this.ExpiryPicker._flatpickr.open();\r\n });\r\n const notificationFreq = await this.profileService.GetNotificationFrequenciesDropdown();\r\n this.notificationFreqDropdown = notificationFreq;\r\n this.notificationFreqDropdown = Object.entries(notificationFreq).map(([key, value]) => ({\r\n value,\r\n key\r\n }));\r\n this.notificationFreqDropdown.reverse();\r\n const documentTypes = await this.profileService.GetDocumentTypesDropdown();\r\n this.documentTypesDropdown = documentTypes;\r\n this.documentTypesDropdown = Object.entries(documentTypes).map(([key, value]) => ({\r\n value,\r\n key\r\n }));\r\n const country = await this.profileService.GetCountryDropdown();\r\n this.countryDropdown = country;\r\n const notificationTypes = await this.profileService.GetNotificationTypesDropdown();\r\n this.notificationTypesDropdown = notificationTypes;\r\n this.notificationTypesDropdown = Object.entries(notificationTypes).map(([key, value]) => ({\r\n value,\r\n key\r\n }));\r\n\r\n this.fileValidator();\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.CountryID);\r\n }\r\n\r\n notify(checked) {\r\n this.notifyFields = checked;\r\n }\r\n\r\n toggleOtherFields(checked) {\r\n this.showOtherFields = checked;\r\n }\r\n\r\n async physicalCopy(checked) {\r\n const result = await this.dialogService.open({\r\n viewModel: Physicalcopypopup,\r\n model: \"\",\r\n }).whenClosed(response => response);\r\n if (result.wasCancelled) {\r\n return;\r\n }\r\n this.showPhysicalCopy = checked;\r\n flatpickr(this.returnPicker, {\r\n closeOnSelect: true,\r\n dateFormat: 'd-m-Y', // the date format (default is 'Y-m-d')\r\n minDate: 'today', // the minimum selectable date in the calendar (default is null, which means no limit)\r\n maxDate: null, // the maximum selectable date in the calendar (default is null, which means no limit)\r\n defaultDate: this.returndate, // 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 clickOpens:false,\r\n onClose: function (selectedDates, dateStr, instance) {\r\n this.FromDate = dateStr;\r\n }\r\n });\r\n this.returncalendarIcon.addEventListener('click', () => {\r\n this.returnPicker._flatpickr.open();\r\n });\r\n }\r\n\r\n physicalnotify(checked) {\r\n this.physicalNotifyDays = checked;\r\n }\r\n\r\n returnDateSelected() {\r\n this.isDisabled = false;\r\n }\r\n\r\n fileValidator(){\r\n const fileInput = document.querySelector('input[type=\"file\"]');\r\n const allowedTypes = ['image/jpeg', 'image/png','application/msword','application/pdf'];\r\n fileInput.addEventListener('change', (event) => {\r\n const file = event.target.files[0];\r\n const fileType = file.type;\r\n if (!allowedTypes.includes(fileType)) {\r\n this.fileMessage=\"Only JPEG, PNG, PDF and DOC files are allowed.\";\r\n this.fileValidatorRule = true;\r\n } else {\r\n this.fileMessage=null;\r\n this.fileValidatorRule = false;\r\n }\r\n });\r\n }\r\n\r\n openFileDialog() {\r\n document.getElementById('attachments').click();\r\n }\r\n\r\n handleFileSelect(files) {\r\n this.fileError = '';\r\n for (let i = 0; i < files.length; i++) {\r\n const file = files[i];\r\n const allowedFormats = ['.jpg', '.png', '.doc', '.pdf'];\r\n const fileExtension = file.name.substring(file.name.lastIndexOf('.')).toLowerCase();\r\n \r\n if (allowedFormats.includes(fileExtension)) {\r\n const reader = new FileReader();\r\n reader.onload = (event) => {\r\n const dataURL = event.target.result;\r\n const fileObject = {\r\n Name: file.name,\r\n Path: dataURL\r\n };\r\n // Push the file object to the uploadedFiles array\r\n this.uploadedFiles.push(fileObject);\r\n };\r\n reader.readAsDataURL(file);\r\n } else {\r\n this.uploadErrors = [{ error: { message: '' } }];\r\n \r\n }\r\n }\r\n }\r\n\r\n get isFieldRequired() {\r\n return this.isSubmitClicked && this.uploadedFiles.length === 0;\r\n }\r\n \r\n\r\n removeFile(file) {\r\n const index = this.uploadedFiles.findIndex((uploadedFile) => uploadedFile.Name === file.Name);\r\n if (index > -1) {\r\n this.uploadedFiles.splice(index, 1);\r\n }\r\n if (this.uploadedFiles.length === 0) {\r\n this.uploadErrors = [{ error: { message: 'Please upload the document.' } }];\r\n }else{\r\n this.uploadErrors = [{ error: { message: '' } }];\r\n }\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 saveEmployeeDocument() {\r\n this.errors = null;\r\n event.preventDefault();\r\n this.isSubmitClicked = true;\r\n const refreshEvent = new CustomEvent('refreshData');\r\n const countryid = this.selectedCountry ? this.selectedCountry.CountryID : null;\r\n const stateid = this.selectedState ? this.selectedState.StateID : null;\r\n const notifyFreq = this.selectedNotifyFreq ? this.selectedNotifyFreq.key : null;\r\n const notifyTypes = this.selectedNotifyTypes ? this.selectedNotifyTypes.key : null;\r\n const expectedReturnDate = this.ExpectedReturnDate ? this.ExpectedReturnDate : null;\r\n this.controllerFactory.validate()\r\n .then(result => {\r\n if (result.valid) {\r\n if (this.uploadedFiles.length === 0) {\r\n this.fileError = 'Upload document is required.';\r\n const errorMessages = document.querySelectorAll(\".adddocument-scrollbar\");\r\n if (errorMessages.length > 0) {\r\n errorMessages[0].scrollIntoView({ behavior: \"smooth\" });\r\n }\r\n return false;\r\n }\r\n const documentData = {\r\n EmployeeID: this.empID, //done\r\n Paths: this.uploadedFiles,\r\n DocumentName: '', //done\r\n DocumentType: this.selectedDocType.key, //done\r\n ExpiryDate: this.DocExpiryDate, //done\r\n NotifyExpiryDtIND: this.NotifyExpiryDtIND, //done\r\n NotifyDays: this.NotifyDays, //done\r\n DocIssuedDate: this.DocIssuedDate,\r\n DocExpiryDate: this.DocExpiryDate, //done\r\n CountryID: countryid, //done\r\n StateID: stateid, //done\r\n IssuingAuthority: this.IssuingAuthority, //done\r\n NotifyEmpInd: this.NotifyEmpInd, //done\r\n NotifyHRInd: this.NotifyHRInd, //done\r\n NotifyRMInd: this.NotifyRMInd, //done\r\n NotifyOtherInd: this.NotifyOtherInd, //done\r\n NotifyOtherEmailIDs: this.NotifyOtherEmailIDs, //done\r\n PhysicalCopyIND: this.PhysicalCopyIND,\r\n PhysicalCopyComments: this.PhysicalCopyComments, //done\r\n NotificationFrequencyType: notifyFreq, //done\r\n NotificationSubFrequencyType: notifyTypes, //done\r\n RetunNotifiIND: this.RetunNotifiIND, //done\r\n // ExpectedReturnDate: this.ExpectedReturnDate,\r\n ExpectedReturnDate: expectedReturnDate, //done\r\n ReturnNotifiDays: this.ReturnNotifiDays, //done\r\n CustodianReturnDate: expectedReturnDate,\r\n Comments: this.Comments, //done\r\n Subject: this.Subject, //done\r\n TypeID: this.selectedDocType.key, //done\r\n EmployeeDocumentID:this.EmployeeDocumentID,\r\n //Body : this.selectedDocType\r\n };\r\n const DocumentValidatecheck={\r\n EmployeeID: this.empID,\r\n Subject: this.Subject, \r\n EmployeeDocumentID:this.EmployeeDocumentID,\r\n };\r\n this.profileService.DocumentAvoidDuplicate(DocumentValidatecheck).then(documentName => {\r\n if(documentName === 1)\r\n {\r\n document.getElementById('docNameError').classList.add(\"doc-Error\");\r\n const errorMessages = document.querySelectorAll(\".doc-Error\");\r\n if (errorMessages.length > 0) {\r\n errorMessages[0].scrollIntoView({ behavior: \"smooth\" });\r\n }\r\n this.errorMessage=true;\r\n this.errorMessage = 'Document name already exists.';\r\n\r\n //setTimeout(()=>{this.errorMessage=null},5000);\r\n }\r\n else{\r\n this.profileService.SaveDocument(documentData).then((response) => {\r\n this.controller.cancel();\r\n this.profileService.GetEmployeeDocuments(this.empID)\r\n .then(() => {\r\n document.dispatchEvent(refreshEvent); // Trigger the custom event\r\n });\r\n });\r\n }\r\n });\r\n }else{\r\n const errorMessages = document.querySelectorAll(\".adddocument-scrollbar\");\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 cancel() {\r\n this.controller.cancel();\r\n }\r\n}\r\n","import { DialogController } from 'aurelia-dialog';\r\n\r\nexport class Confirmdelete {\r\n static inject = [DialogController,Element];\r\n isDragging = false;\r\n dialog;\r\n\r\n constructor(dialogController) {\r\n this.dialogController = dialogController;\r\n this.message = \"Are You Sure Want To Delete Record?\";\r\n\r\n }\r\n\r\n activate(data) {}\r\n\r\n cancel() {\r\n this.dialogController.cancel();\r\n }\r\n\r\n ok() {\r\n this.dialogController.ok(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","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 { Adddocument } from './adddocument/adddocument';\r\nimport { Editdocument } from './editdocument/editdocument';\r\nimport { Viewdocument } from './viewdocument/viewdocument';\r\nimport { AlertpopupComponent } from '../../alertpopup/alertpopupcomponent';\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 Documents {\r\n\r\n pageSize = config.grid_PazeSize;\r\n DeleteDeletmessage = false;\r\n DocumentSuccessmessage = false;\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.EmployeeDocuments = this.RefreshEditDocument();\r\n this.EmployeeDocuments = this.RefreshEditDocument();\r\n }\r\n\r\n async bind() {\r\n setTimeout(()=>{\r\n Scrollbar.init(document.querySelector('.document-scrollbar'));\r\n },100)\r\n }\r\n\r\n async attached(params) {\r\n\r\n this.empID = this.jwtService.getEmployeeId();\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\r\n this.empID=this.jwtService.getEmployeeId();\r\n \r\n }\r\n\r\n document.addEventListener('EditRefreshData', this.RefreshEditDocument);\r\n document.addEventListener('refreshData', this.RefreshDocument);\r\n const employeeDocuments = await this.profileService.GetEmployeeDocuments(this.empID);\r\n this.EmployeeDocuments = employeeDocuments;\r\n }\r\n\r\n addDocument() {\r\n this.dialogService.open({\r\n viewModel: Adddocument\r\n })\r\n }\r\n\r\n RefreshDocument = () => {\r\n this.profileService.GetEmployeeDocuments(this.empID).then(data => {\r\n this.EmployeeDocuments = data;\r\n this.Docmessage = \"Document added successfully\";\r\n this.DocumentSuccessmessage = true;\r\n this.DocumentUpdatemessage = false;\r\n setTimeout(() => {\r\n this.Docmessage = null\r\n }, 3000);\r\n })\r\n }\r\n\r\n editDocument(editData) {\r\n this.dialogService.open({\r\n viewModel: Editdocument,\r\n model: editData\r\n });\r\n }\r\n\r\n RefreshEditDocument = () => {\r\n // Call the API or refresh the data in GridComponent\r\n this.profileService.GetEmployeeDocuments(this.empID).then(data => {\r\n this.EmployeeDocuments = data\r\n this.Docmessage = \"Document updated successfully\";\r\n this.DocumentSuccessmessage = true;\r\n this.DocumentUpdatemessage = false;\r\n setTimeout(() => {\r\n this.Docmessage = null\r\n }, 3000);\r\n })\r\n }\r\n\r\n viewDocument(viewData) {\r\n this.dialogService.open({\r\n viewModel: Viewdocument,\r\n model: viewData\r\n });\r\n }\r\n\r\n async deleteDocument(data) {\r\n const DocID = data.EmployeeDocumentID;\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.DeleteEmployeeDocument(DocID, this.empID);\r\n const employeeDocuments = await this.profileService.GetEmployeeDocuments(this.empID);\r\n this.docDeletmessage = \" Document deleted successfully\";\r\n this.DeleteDeletmessage = true;\r\n setTimeout(() => {\r\n this.docDeletmessage = null\r\n }, 3000);\r\n this.EmployeeDocuments = employeeDocuments;\r\n }\r\n\r\n}\r\n","import {inject,bindingMode,bindable,customAttribute } from 'aurelia-framework';\r\nimport { DialogController } from 'aurelia-dialog';\r\nimport {DialogService} from 'aurelia-dialog';\r\nimport { ProfileService } from '../../../../shared/services/profielservice';\r\nimport { JwtService } from '../../../../shared/services/jwtservice';\r\nimport {ValidationControllerFactory, ValidationRules} from 'aurelia-validation';\r\nimport { Physicalcopypopup } from '../physicalcopypopup/physicalcopypopup';\r\nimport { Confirmdelete } from '../deletefile/confirmdelete';\r\nimport { config } from '../../../../shared/services/config';\r\nimport flatpickr from 'flatpickr';\r\nimport 'flatpickr/dist/flatpickr.min.css';\r\nimport Scrollbar from 'smooth-scrollbar';\r\nimport {LoginService} from \"../../../../shared/services/loginservice\";\r\nimport { Router } from 'aurelia-router';\r\n\r\n@customAttribute('custom-file-input')\r\n@inject(DialogController, ProfileService, JwtService, ValidationControllerFactory, DialogService, Router,LoginService,Element)\r\nexport class Editdocument {\r\n\r\n @bindable({\r\n defaultBindingMode: bindingMode.twoWay\r\n }) DOIdate;\r\n @bindable({\r\n defaultBindingMode: bindingMode.twoWay\r\n }) Expirydate;\r\n @bindable({\r\n defaultBindingMode: bindingMode.twoWay\r\n }) returndate;\r\n\r\n notifyFields = false;\r\n showOtherFields = false;\r\n showPhysicalCopy = false;\r\n physicalNotifyDays = false;\r\n isDisabled = true;\r\n documentTypesDropdown = [];\r\n countryDropdown = [];\r\n file;\r\n uploadedFiles = [];\r\n combinedFiles = [];\r\n viewFile = true;\r\n subfreq = true;\r\n selectedDocType = null; //aurelia select\r\n selectedCountry = null;\r\n selectedState = null;\r\n selectedNotifyFreq = null;\r\n selectedNotifyTypes = null;\r\n URL=config.img_url;\r\n isDragging = false;\r\n dialog;\r\n static inject = [Element];\r\n constructor(controller, profileService, JwtService, controllerFactory, dialogService, 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.dialogService = dialogService;\r\n this.element = element;\r\n this.router = router;\r\n this.loginService = loginService;\r\n this.empID = this.JwtService.getEmployeeId();\r\n\r\n ValidationRules.customRule(\r\n 'validEmails',\r\n (value, obj) => {\r\n if (typeof value !== 'string') {\r\n return false;\r\n }\r\n const emails = value.split(',');\r\n\r\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.(com|co|in|org|cc|net)$/;\r\n const invalidEmails = [];\r\n for (const email of emails) {\r\n const trimmedEmail = email.trim();\r\n if (!emailRegex.test(trimmedEmail)) {\r\n invalidEmails.push(trimmedEmail);\r\n }\r\n }\r\n // Check if any emails are invalid\r\n if (invalidEmails.length > 0) {\r\n obj.emailsErrors = ['Invalid email address(es)'];\r\n return false;\r\n }\r\n // Check if emails are separated by commas\r\n if (emails.length > 1 && value.indexOf(',') === -1) {\r\n obj.emailsErrors = ['Email(s) should be separated by commas'];\r\n return false;\r\n }\r\n obj.emailsErrors = [];\r\n return true;\r\n },\r\n '${$displayName} is invalid.',\r\n (obj) => ({\r\n obj\r\n })\r\n );\r\n\r\n ValidationRules.customRule(\r\n 'file',\r\n () =>{\r\n if(this.fileValidatorRule === true){\r\n return false;\r\n }else{\r\n return true;\r\n }\r\n },\r\n '${$displayName} is required'\r\n );\r\n\r\n ValidationRules\r\n .ensure('selectedDocType').required().withMessage('Document type is required')\r\n .ensure('Subject').required().withMessage('Document name is required')\r\n .ensure('DocIssuedDate').required().withMessage('Issue date is required')\r\n .ensure('NotifyDays').required().withMessage('Notify before expiry day is required.')\r\n .ensure('upload').required()\r\n .satisfiesRule('file')\r\n .ensure('NotifyOtherEmailIDs').required().withMessage('Email id(s) field is required').then()\r\n .satisfiesRule('validEmails').withMessage(\"Invalid email address and Email(s) should be separated by commas\")\r\n .ensure('NotifyEmpInd')\r\n .displayName('Employee')\r\n .satisfies(() => {\r\n return this.NotifyEmpInd || this.NotifyHRInd || this.NotifyRMInd || this.NotifyOtherInd;\r\n })\r\n .withMessage('Please select at least one notified.')\r\n .on(this);\r\n }\r\n\r\n docTypeMatcher = (a, b) => {\r\n return a.key === b.key;\r\n }\r\n\r\n countryMatcher = (a, b) => {\r\n return a.key === b.key;\r\n }\r\n\r\n stateMatcher = (a, b) => {\r\n return a.key === b.key;\r\n }\r\n\r\n selectedNotifyFreqMatcher = (a, b) => {\r\n return a.key === b.key;\r\n }\r\n\r\n selectedNotifyTypesMatcher = (a, b) => {\r\n return a.key === b.key;\r\n }\r\n\r\n async bind() {\r\n setTimeout(()=>{\r\n Scrollbar.init(document.querySelector('.editdocument-scrollbar'));\r\n },100)\r\n }\r\n\r\n async activate(documentData) {\r\n console.log(documentData);\r\n this.EmployeeDocumentID = documentData.EmployeeDocumentID;\r\n this.DocumentName = documentData.DocumentName;\r\n this.DocumentType = documentData.DocumentType;\r\n this.editFiles = documentData.MultiplePaths;\r\n this.upload = this.editFiles;\r\n this.NotifyExpiryDtIND = documentData.NotifyExpiryDtIND;\r\n if (this.NotifyExpiryDtIND === true) {\r\n this.notifyFields = true;\r\n }\r\n this.NotifyDays = documentData.NotifyDays;\r\n this.DocIssuedDate = documentData.DocIssuedDate;\r\n this.DocExpiryDate = documentData.DocExpiryDate;\r\n this.CountryID = documentData.CountryID;\r\n this.StateID = documentData.StateID;\r\n this.IssuingAuthority = documentData.IssuingAuthority;\r\n this.NotifyEmpInd = documentData.NotifyEmpInd;\r\n this.NotifyHRInd = documentData.NotifyHRInd;\r\n this.NotifyRMInd = documentData.NotifyRMInd;\r\n this.NotifyOtherInd = documentData.NotifyOtherInd;\r\n if (this.NotifyOtherInd === true) {\r\n this.showOtherFields = true;\r\n }\r\n this.NotifyOtherEmailIDs = documentData.NotifyOtherEmailIDs;\r\n this.PhysicalCopyIND = documentData.PhysicalCopyIND;\r\n if (this.PhysicalCopyIND === true) {\r\n this.showPhysicalCopy = true;\r\n }\r\n this.PhysicalCopyComments = documentData.PhysicalCopyComments;\r\n this.NotificationFrequencyType = documentData.NotificationFrequencyType;\r\n if(this.NotificationFrequencyType == \"1\"){\r\n this.subFreq = false;\r\n }\r\n else if(this.NotificationFrequencyType == \"2\"){\r\n this.subFreq = true;\r\n }else{\r\n this.subFreq = false;\r\n }\r\n this.NotificationSubFrequencyType = documentData.NotificationSubFrequencyType;\r\n this.RetunNotifiIND = documentData.RetunNotifiIND;\r\n this.ExpectedReturnDate = documentData.ExpectedReturnDate;\r\n this.ReturnNotifiDays = documentData.ReturnNotifiDays;\r\n this.Comments = documentData.Comments;\r\n this.Subject = documentData.Subject;\r\n await this.selectCountry(this.CountryID);\r\n }\r\n\r\n mailFreq(data){\r\n if(data.key == '2'){\r\n this.subFreq = true;\r\n }else if(data.key == '1'){\r\n this.subFreq = false;\r\n }\r\n }\r\n\r\n async attached() {\r\n this.specializationInput.focus();\r\n\r\n if (this.RetunNotifiIND === true) {\r\n this.physicalNotifyDays = true;\r\n this.expectedReturnDate();\r\n }\r\n flatpickr(this.DOIPicker, {\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: null, // the maximum selectable date in the calendar (default is null, which means no limit)\r\n defaultDate: this.DOIdate, // 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 clickOpens:false,\r\n onClose: function (selectedDates, dateStr, instance) {\r\n this.FromDate = dateStr;\r\n }\r\n });\r\n this.DOIcalendarIcon.addEventListener('click', () => {\r\n this.DOIPicker._flatpickr.open();\r\n });\r\n flatpickr(this.ExpiryPicker, {\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:null, // the maximum selectable date in the calendar (default is null, which means no limit)\r\n defaultDate: this.Expirydate, // 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 clickOpens:false,\r\n onClose: function (selectedDates, dateStr, instance) { // a function that will be called when the calendar is closed\r\n this.FromDate = dateStr;\r\n }\r\n });\r\n this.ExpirycalendarIcon.addEventListener('click', () => {\r\n this.ExpiryPicker._flatpickr.open();\r\n });\r\n const notificationFreq = await this.profileService.GetNotificationFrequenciesDropdown();\r\n this.notificationFreqDropdown = notificationFreq;\r\n this.notificationFreqDropdown = Object.entries(notificationFreq).map(([key, value]) => ({\r\n value,\r\n key\r\n }));\r\n this.notificationFreqDropdown.reverse();\r\n const documentTypes = await this.profileService.GetDocumentTypesDropdown();\r\n this.documentTypesDropdown = documentTypes;\r\n this.documentTypesDropdown = Object.entries(documentTypes).map(([key, value]) => ({\r\n value,\r\n key\r\n }));\r\n const country = await this.profileService.GetCountryDropdown();\r\n this.countryDropdown = country;\r\n const notificationTypes = await this.profileService.GetNotificationTypesDropdown();\r\n this.notificationTypesDropdown = notificationTypes;\r\n this.notificationTypesDropdown = Object.entries(notificationTypes).map(([key, value]) => ({\r\n value,\r\n key\r\n }));\r\n this.selectedDocType = this.documentTypesDropdown.find(\r\n (document) => {\r\n document.key === this.DocumentType\r\n }\r\n );\r\n this.selectedCountry = this.countryDropdown.find(\r\n (country) => {\r\n country.CountryID === this.CountryID\r\n }\r\n );\r\n this.selectedState = this.statesDropdown.find(\r\n (state) => {\r\n state.StateID === this.StateID\r\n }\r\n );\r\n this.selectedNotifyFreq = this.notificationFreqDropdown.find(\r\n (notifreq) => {\r\n notifreq.key === this.NotificationFrequencyType\r\n }\r\n );\r\n this.selectedNotifyTypes = this.notificationTypesDropdown.find(\r\n (notitypes) => {\r\n notitypes.key === this.NotificationSubFrequencyType\r\n }\r\n );\r\n this.fileValidator();\r\n this.specializationInput.focus();\r\n this.handleFileSelect();\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\r\n\r\n notify(checked) {\r\n this.notifyFields = checked;\r\n }\r\n\r\n toggleOtherFields(checked) {\r\n this.showOtherFields = checked;\r\n }\r\n\r\n async physicalCopy(checked) {\r\n const result = await this.dialogService.open({\r\n viewModel: Physicalcopypopup,\r\n model: \"\",\r\n }).whenClosed(response => response);\r\n if (result.wasCancelled) {\r\n return;\r\n }\r\n this.showPhysicalCopy = checked;\r\n this.expectedReturnDate();\r\n }\r\n\r\n expectedReturnDate() {\r\n flatpickr(this.returnPicker, {\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' , //new Date().toISOString().split(\"T\")[0]\r\n defaultDate: this.returndate, // 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 clickOpens:false,\r\n onClose: function (selectedDates, dateStr, instance) {\r\n this.FromDate = dateStr;\r\n }\r\n });\r\n this.returncalendarIcon.addEventListener('click', () => {\r\n this.returnPicker._flatpickr.open();\r\n });\r\n }\r\n\r\n physicalnotify(checked) {\r\n this.physicalNotifyDays = checked;\r\n }\r\n\r\n returnDateSelected() {\r\n this.isDisabled = false;\r\n }\r\n\r\n fileValidator(){\r\n const fileInput = document.querySelector('input[type=\"file\"]');\r\n const allowedTypes = ['image/jpeg', 'image/png','application/msword','application/pdf'];\r\n fileInput.addEventListener('change', (event) => {\r\n const file = event.target.files[0];\r\n const fileType = file.type;\r\n if (!allowedTypes.includes(fileType)) {\r\n this.fileMessage=\"Only JPEG, PNG, PDF and DOC files are allowed.\";\r\n this.fileValidatorRule = true;\r\n } else {\r\n this.fileMessage=null;\r\n this.fileValidatorRule = false;\r\n }\r\n });\r\n }\r\n\r\nopenFileDialog() {\r\n document.getElementById('attachments').click();\r\n}\r\n\r\nhandleFileSelect(files) {\r\n this.viewFile = false;\r\n const allowedFormats = ['.jpg', '.png', '.doc', '.pdf'];\r\n const uploadedFiles = [];\r\n for (let i = 0; i < files.length; i++) {\r\n const file = files[i];\r\n const fileExtension = file.name.substring(file.name.lastIndexOf('.')).toLowerCase();\r\n if (allowedFormats.includes(fileExtension)) {\r\n const reader = new FileReader();\r\n reader.onload = (event) => {\r\n const dataURL = event.target.result;\r\n const fileObject = {\r\n EmployeeDocumentPathID: '',\r\n Path: dataURL,\r\n Name: file.name,\r\n LastUpdatedName: ''\r\n };\r\n // Add the file object to the uploadedFiles array\r\n uploadedFiles.push(fileObject);\r\n };\r\n reader.readAsDataURL(file);\r\n } else {\r\n // Handle invalid file format here (e.g., display an error message)\r\n this.uploadErrors.push({ error: { message: 'Invalid file format: ' + file.name } });\r\n }\r\n }\r\n // If you want to combine this.uploadedFiles with this.editFiles after uploading, do it after the loop\r\n uploadedFiles.push(...this.editFiles);\r\n this.editFiles = uploadedFiles;\r\n}\r\n\r\nget isFieldRequired() {\r\n return this.isSubmitClicked && this.uploadedFiles.length === 0;\r\n}\r\n\r\n\r\nremoveFile(fileName) {\r\n this.dialogService.open({ viewModel: Confirmdelete, model: \"\"})\r\n .whenClosed(response =>{\r\n if (response.wasCancelled) {\r\n return;\r\n }else{\r\n const index = this.editFiles.findIndex(file => file.Name === fileName);\r\n if (index === -1) { \r\n this.editFiles.splice(index, 1);\r\n const removeButtons = document.querySelectorAll(\".remove-button\"); \r\n removeButtons.forEach(function(button) {\r\n button.addEventListener(\"click\", function() {\r\n var parentElement = button.parentNode;\r\n parentElement.parentNode.removeChild(parentElement);\r\n });\r\n });\r\n }\r\n }\r\n });\r\n}\r\n\r\ndownloadFile(viewPath) {\r\n const downloadUrl = this.URL + viewPath;\r\n const link = document.createElement('a');\r\n link.href = downloadUrl;\r\n link.target = '_blank';\r\n link.download = downloadUrl;\r\n link.click();\r\n}\r\n 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 EditEmployeeDocument() {\r\n const refreshEvent = new CustomEvent('EditRefreshData');\r\n //this.errors = null;\r\n const docTypeKey = this.selectedDocType ? this.selectedDocType.key : this.DocumentType;\r\n const countryid = this.selectedCountry ? this.selectedCountry.CountryID : this.CountryID;\r\n const stateid = this.selectedState ? this.selectedState.StateID : this.StateID;\r\n const notifyFreq = this.selectedNotifyFreq ? this.selectedNotifyFreq.key : this.NotificationFrequencyType;\r\n const notifyTypes = this.selectedNotifyTypes ? this.selectedNotifyTypes.key : this.NotificationSubFrequencyType;\r\n if (this.editFiles.length === 0) {\r\n this.uploadErrors = [{ error: { message: 'Upload document is required.' } }];\r\n }else{\r\n this.uploadErrors = [{ error: { message: '' } }];\r\n //}\r\n this.controllerFactory.validate()\r\n .then(result => {\r\n if (result.valid) {\r\n const Editdata = {\r\n EmployeeID: this.empID,\r\n EmployeeDocumentID: this.EmployeeDocumentID,\r\n Paths: this.editFiles,\r\n DocumentName: '',\r\n DocumentType: docTypeKey,\r\n ExpiryDate: this.DocExpiryDate,\r\n NotifyExpiryDtIND: this.NotifyExpiryDtIND,\r\n NotifyDays: this.NotifyDays,\r\n DocIssuedDate: this.DocIssuedDate,\r\n DocExpiryDate: this.DocExpiryDate,\r\n CountryID: countryid,\r\n StateID: stateid,\r\n IssuingAuthority: this.IssuingAuthority,\r\n NotifyEmpInd: this.NotifyEmpInd,\r\n NotifyHRInd: this.NotifyHRInd,\r\n NotifyRMInd: this.NotifyRMInd,\r\n NotifyOtherInd: this.NotifyOtherInd,\r\n NotifyOtherEmailIDs: this.NotifyOtherEmailIDs,\r\n PhysicalCopyIND: this.PhysicalCopyIND,\r\n PhysicalCopyComments: this.PhysicalCopyComments,\r\n NotificationFrequencyType: notifyFreq,\r\n NotificationSubFrequencyType: notifyTypes,\r\n RetunNotifiIND: this.RetunNotifiIND,\r\n ReturnNotifiDays: this.ReturnNotifiDays,\r\n ExpectedReturnDate: this.ExpectedReturnDate,\r\n Comments: this.Comments,\r\n Subject: this.Subject,\r\n //Body : this.selectedDocType\r\n }\r\n this.profileService.SaveDocument(Editdata).then(() => {\r\n this.controller.cancel();\r\n this.profileService.GetEmployeeDocuments(this.empID).then(() => {\r\n document.dispatchEvent(refreshEvent);\r\n });\r\n });\r\n }else{\r\n console.log(this.errors);\r\n }\r\n });\r\n\r\n }\r\n }\r\n\r\n cancel() {\r\n //window.location.reload();\r\n window.location.reload();\r\n this.controller.cancel();\r\n }\r\n}\r\n","import { DialogController } from 'aurelia-dialog';\r\n\r\nexport class Physicalcopypopup {\r\n static inject = [DialogController,Element];\r\n isDragging = false;\r\n dialog;\r\n\r\n constructor(dialogController) {\r\n this.dialogController = dialogController;\r\n this.message = \"Are You Sure Want To Delete Record?\";\r\n\r\n }\r\n\r\n activate(data) {}\r\n\r\n cancel() {\r\n this.dialogController.cancel();\r\n }\r\n\r\n ok() {\r\n this.dialogController.ok();\r\n }\r\n startDragging(event) {\r\n if (event.button === 0) {\r\n this.isDragging = true;\r\n this.offsetX = event.clientX - this.dialogElement.getBoundingClientRect().left;\r\n this.offsetY = event.clientY - this.dialogElement.getBoundingClientRect().top;\r\n\r\n window.addEventListener('mousemove', this.drag);\r\n window.addEventListener('mouseup', this.stopDragging);\r\n }\r\n }\r\n\r\n drag = (event) => {\r\n if (this.isDragging) {\r\n const x = event.clientX - this.offsetX;\r\n const y = event.clientY - this.offsetY;\r\n\r\n this.dialogElement.style.left = `${x}px`;\r\n this.dialogElement.style.top = `${y}px`;\r\n }\r\n }\r\n\r\n stopDragging = () => {\r\n this.isDragging = false;\r\n window.removeEventListener('mousemove', this.drag);\r\n window.removeEventListener('mouseup', this.stopDragging);\r\n }\r\n}\r\n","import {inject} from 'aurelia-framework';\r\nimport { DialogController } from 'aurelia-dialog';\r\nimport { JwtService } from '../../../../shared/services/jwtservice';\r\nimport { ProfileService } from '../../../../shared/services/profielservice';\r\nimport { config } from '../../../../shared/services/config';\r\nimport Scrollbar from 'smooth-scrollbar';\r\nimport {LoginService} from \"../../../../shared/services/loginservice\";\r\nimport { Router } from 'aurelia-router';\r\n\r\n@inject(DialogController, JwtService, ProfileService,Router,LoginService)\r\nexport class Viewdocument {\r\n static inject = [Element];\r\n isDragging = false;\r\n dialog;\r\n pageSize = 10;\r\n\r\n constructor(DialogController, JwtService, ProfileService,router,loginService) {\r\n this.controller = DialogController;\r\n this.jwtService = JwtService;\r\n this.profileService = ProfileService;\r\n this.router = router;\r\n this.loginService = loginService;\r\n }\r\n\r\n async bind() {\r\n setTimeout(()=>{\r\n Scrollbar.init(document.querySelector('.viewdocument-scrollbar'));\r\n },100)\r\n }\r\n\r\n activate(viewData) {\r\n this.EmployeeDocumentID = viewData.EmployeeDocumentID\r\n this.DocumentType = viewData.DocumentTypeText;\r\n this.DocumentName = viewData.Subject;//DocumentNameDisplay\r\n this.DocumentNumber = '';\r\n this.DocIssueDate = viewData.DocIssuedDate;\r\n this.ExpiryDate = viewData.DocExpiryDate;\r\n this.IssueAuthority = viewData.IssuingAuthority;\r\n this.Comments = viewData.Comments;\r\n this.Files = viewData.Path; //LastUpdatedName\r\n this.Displayfiles = viewData.MultiplePaths;\r\n }\r\n\r\n async attached() {\r\n\r\n this.empID = this.jwtService.getEmployeeId();\r\n\r\n const DocumentHistory = await this.profileService.GetDocumentHistory(this.EmployeeDocumentID);\r\n this.EmployeeDocumentsHistory = DocumentHistory;\r\n\r\n const tempId = 8098;\r\n const DocumentFieldHistoryData = await this.profileService.GetDocumentFieldHistory(this.empID);\r\n this.documentFieldHistory = await DocumentFieldHistoryData;\r\n }\r\n\r\n downloadFile(path) {\r\n const downloadUrl = config.img_url + path;\r\n const link = document.createElement('a');\r\n link.href = downloadUrl;\r\n link.target = '_blank';\r\n link.download = downloadUrl;\r\n link.click();\r\n }\r\n\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}\r\n","// Imports\nimport ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___ from \"../../../../../node_modules/html-loader/dist/runtime/getUrl.js\";\nvar ___HTML_LOADER_IMPORT_0___ = new URL(\"../../../../images/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;","// 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/edit.svg\", import.meta.url);\nvar ___HTML_LOADER_IMPORT_1___ = new URL(\"../../../images/x-square.svg\", import.meta.url);\nvar ___HTML_LOADER_IMPORT_2___ = 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 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;","// Module\nvar code = \"\\r\\n\";\n// Exports\nexport default code;","// Module\nvar code = \"\\r\\n\";\n// Exports\nexport default code;"],"names":[],"sourceRoot":""}