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,EAAKL,oBAAoBK,aACtE,EAAKV,SAASC,gBAAgBQ,eAAiB,EAAKJ,oBAAoBI,gBAK1B,MAA5C,EAAKJ,oBAAoBI,iBAC3B,EAAKT,SAASC,gBAAgBC,cAAgB,MAGhD,EAAKS,QAAQjB,aAAa,EAAKM,SAAU,EAAKY,MAChD,EACF,E,mUAvC+B,GADhC,IAAAC,eAAc,4BACF6C,E,CAAb,CAA0C,I,klBCA1C,2B,2gBACU,EAAA8B,kBAAmB,E,CA4B7B,QA7B8B,OAGtB,YAAA/F,KAAN,W,6sCAGE,GAFA,YAAMA,KAAI,WAENI,KAAKG,SAASyF,mBAAmB3D,OAAS,E,IAC5C,IAAwB,E,ySAAA,CAAAjC,KAAKG,SAASyF,oBAAkB,8BACtB,wBADvBC,EAAS,SACJC,gBACZ9F,KAAK2F,iBAAgD,QAA7BE,EAAUE,e,2YAM1C,YAAAlG,aAAA,SAAaC,GAAb,gBAAa,IAAAA,IAAAA,GAAA,GACXE,KAAKC,UAAUC,UAAU,WACvB,YAAML,aAAY,OAACC,GAEnB,EAAKgB,QAAQjB,aAAa,EAAKM,SAAU,EAAKY,MAChD,EACF,EAEA,YAAAiF,SAAA,SAAS7F,EAAU8F,GAAnB,WACEjG,KAAKC,UAAUC,UAAU,WACvBC,EAASqD,eAAiByC,EAC1B,EAAKpG,cACP,EACF,E,mUA5BmB,GADpB,IAAAmB,eAAc,aACFkF,E,CAAb,CAA8B,I","sources":["webpack://iadviser/./src/components/qce/components/debug.html","webpack://iadviser/./src/components/qce/components/decimal-format-free-text.html","webpack://iadviser/./src/components/qce/components/decimal-format.html","webpack://iadviser/./src/components/qce/components/dropdown-with-currency.html","webpack://iadviser/./src/components/qce/components/dropdown-with-dropdown.html","webpack://iadviser/./src/components/qce/components/dropdown-with-free-text.html","webpack://iadviser/./src/components/qce/components/dropdown.html","webpack://iadviser/./src/components/qce/components/decimal-format-free-text.ts","webpack://iadviser/./src/components/qce/components/decimal-format.ts","webpack://iadviser/./src/components/qce/components/decorators/calculate-source-questions.ts","webpack://iadviser/./src/components/qce/components/dropdown-with-currency.ts","webpack://iadviser/./src/components/qce/components/dropdown-with-dropdown.ts","webpack://iadviser/./src/components/qce/components/dropdown-with-free-text.ts","webpack://iadviser/./src/components/qce/components/dropdown.ts"],"sourcesContent":["// Module\nvar code = \"\";\n// Exports\nexport default code;","// Module\nvar code = \"\";\n// Exports\nexport default code;","// Module\nvar code = \"\";\n// Exports\nexport default code;","// Module\nvar code = \"\";\n// Exports\nexport default code;","// Module\nvar code = \"\";\n// Exports\nexport default code;","// Module\nvar code = \"\";\n// Exports\nexport default code;","// Module\nvar code = \"\\r\\n\";\n// Exports\nexport default code;","import { generateHtmlIdGuid } from 'resources/utilities/insecure-guid';\r\nimport { ComponentBase } from './component-base';\r\nimport { customElement } from 'aurelia-framework';\r\n\r\nconst inputMaskOptions = {\r\n alias: 'decimal',\r\n autoUnmask: true\r\n};\r\n\r\n@customElement('decimal-format-free-text')\r\nexport class DecimalFormatText extends ComponentBase {\r\n public id = generateHtmlIdGuid();\r\n public iaInput: HTMLInputElement;\r\n private inputMaskOptions = { ...inputMaskOptions };\r\n\r\n bind() {\r\n super.bind();\r\n }\r\n\r\n fieldChanged(isInput = false, type = 'freeText') { \r\n this.taskQueue.queueTask(() => { \r\n if (!this.question.currentResponse.responseValue || this.question.currentResponse.responseValue.toString().trim() === '') {\r\n // Set current workflow item to be NoResponse type\r\n this.currentWorkflowItem = this.question.questionFlow.find(f => f.responseTypeId === -1);\r\n } else {\r\n if (type === 'decimal') {\r\n // We have a user entered value, set the response type to Currency\r\n this.currentWorkflowItem = this.question.questionFlow.find(f => f.responseTypeId === 600000004);\r\n } else if (type === 'freeText') {\r\n // We have a user entered value, set the response type to FreeText\r\n this.currentWorkflowItem = this.question.questionFlow.find(f => f.responseTypeId === 600000005);\r\n }\r\n }\r\n\r\n this.question.currentResponse.responseType = this.currentWorkflowItem.responseType;\r\n this.question.currentResponse.responseTypeId = this.currentWorkflowItem.responseTypeId;\r\n\r\n this.context.fieldChanged(this.question, this.group);\r\n });\r\n }\r\n}\r\n","import { generateHtmlIdGuid } from 'resources/utilities/insecure-guid';\r\nimport { ComponentBase } from './component-base';\r\nimport { customElement } from 'aurelia-framework';\r\n\r\nconst inputMaskOptions = {\r\n alias: 'decimal',\r\n autoUnmask: true\r\n};\r\n\r\n@customElement('decimal-format')\r\nexport class DecimalFormat extends ComponentBase {\r\n public id = generateHtmlIdGuid();\r\n public iaInput: HTMLInputElement;\r\n private inputMaskOptions = { ...inputMaskOptions };\r\n\r\n bind() {\r\n super.bind();\r\n }\r\n\r\n fieldChanged(isInput = false) { \r\n this.taskQueue.queueTask(() => {\r\n super.fieldChanged(isInput);\r\n\r\n this.question.currentResponse.responseType = this.currentWorkflowItem.responseType;\r\n this.question.currentResponse.responseTypeId = this.currentWorkflowItem.responseTypeId;\r\n this.question.currentResponse.responseValue = this.iaInput.inputmask.unmaskedvalue();\r\n\r\n this.context.fieldChanged(this.question, this.group);\r\n });\r\n }\r\n}\r\n","export function calculateSourceQuestions() {\r\n return function (target: any) {\r\n target.prototype.calculateSourceQuestions = function () {\r\n // recalculate calculated questions across all groups\r\n this.context?.model?.groups.forEach((group) => {\r\n if (group && group.questions) {\r\n group.questions = group.questions.map((question) => {\r\n const allowedDecmials = [600000020, 5, 14];\r\n const allowDollarSign = [600000030, 600000031, 1, 16, 600000021, 600000020];\r\n\r\n // This is a source calculated field, there will be one or more ID's to calculate from\r\n if (question.sourceCalculatedQuestions && question.sourceCalculatedQuestions.length) {\r\n let calculatedTotal = 0;\r\n let calculatedAtLeastOnce = false;\r\n\r\n // Loop over all questions\r\n for (const id of question.sourceCalculatedQuestions) {\r\n const foundQuestion = this.context.findQuestionByIdInModel(id);\r\n\r\n // Do we have a source question, a value and it hasn't been disabled? It gets factored into the calculation\r\n if (\r\n foundQuestion &&\r\n !foundQuestion.disabledByQuestionFlowFlag &&\r\n foundQuestion.currentResponse.responseValue !== null\r\n ) {\r\n // Filter the current value of anything potentially user entered that cannot be calculated\r\n let responseValue = foundQuestion.currentResponse.responseValue\r\n .toString()\r\n .replace(/,/g, ' ')\r\n .replace(/\\s/g, '');\r\n\r\n // Strip out dollar sign\r\n if (allowDollarSign.includes(question.displayTypeId)) {\r\n responseValue = responseValue.replace('$', '');\r\n }\r\n\r\n // If the length of this equals two, it's a decimal value\r\n const splitAtCents = responseValue.split('.');\r\n\r\n // We have a value, and it's a decimal\r\n if (responseValue && splitAtCents.length > 1) {\r\n if (!allowedDecmials.includes(question.displayTypeId)) {\r\n continue;\r\n }\r\n\r\n // Decimals provided are greater than allowed two\r\n if (splitAtCents[1].length > 2) {\r\n continue;\r\n }\r\n }\r\n\r\n // Value contains non-numeric values, skip\r\n if (\r\n !responseValue.match(/^[0-9]*$/gm) &&\r\n !responseValue.includes('.') &&\r\n !responseValue.includes('-')\r\n ) {\r\n continue;\r\n }\r\n\r\n // Parse the value\r\n const possibleAmount = allowedDecmials.includes(question.displayTypeId)\r\n ? parseFloat(responseValue)\r\n : parseInt(responseValue);\r\n\r\n // Is it a number? Add it to the running total\r\n if (!isNaN(possibleAmount)) {\r\n calculatedTotal += possibleAmount;\r\n calculatedAtLeastOnce = true;\r\n }\r\n }\r\n }\r\n\r\n if (calculatedTotal === 0 && !calculatedAtLeastOnce) {\r\n question.currentResponse.responseValue = null;\r\n question.currentResponse.responsePresent = false;\r\n question.currentResponse.responseTypeId = -1;\r\n } else {\r\n question.currentResponse.responseValue = allowedDecmials.includes(question.displayTypeId)\r\n ? calculatedTotal.toFixed(2)\r\n : calculatedTotal.toFixed(0);\r\n question.currentResponse.responsePresent = true;\r\n question.currentResponse.responseTypeId = 600000001;\r\n }\r\n }\r\n\r\n return question;\r\n });\r\n }\r\n });\r\n };\r\n };\r\n}\r\n","import { ComponentBase } from './component-base';\r\nimport { customElement } from 'aurelia-framework';\r\n\r\n@customElement('dropdown-with-currency')\r\nexport class DropdownWithCurrency extends ComponentBase {\r\n // private inputMaskOptions: any = {\r\n // alias: 'currency',\r\n // digits: 0,\r\n // max: '999999999',\r\n // clearMaskOnLostFocus: true,\r\n // autoUnmask: true\r\n // };\r\n\r\n private inputMaskOptions: any = {\r\n decimalPlaces : 0,\r\n minimumValue : '-999999999999',\r\n maximumValue : '999999999999',\r\n emptyInputBehavior: 'focus'\r\n };\r\n\r\n bind() {\r\n super.bind();\r\n\r\n // Decimal\r\n if (this.question.displayTypeId === 600000031) {\r\n // this.inputMaskOptions.digits = 2;\r\n // this.inputMaskOptions.max = '999999999.99';\r\n\r\n this.inputMaskOptions.decimalPlaces = 2;\r\n this.inputMaskOptions.minimumValue = '-999999999.99'\r\n this.inputMaskOptions.maximumValue = '999999999.99'\r\n }\r\n }\r\n\r\n fieldChanged(isInput = false) {\r\n this.taskQueue.queueTask(() => {\r\n super.fieldChanged(isInput);\r\n\r\n // If it's not an input, it's a dropdown\r\n if (isInput) {\r\n // We have no currently user entered value, it's empty\r\n if (!this.questionHasValidCurrentResponse()) {\r\n // Set current workflow item to be NoResponse type\r\n this.currentWorkflowItem = this.question.questionFlow.find(f => f.responseTypeId === -1);\r\n } else {\r\n // We have a user entered value, set the response type to Currency\r\n this.currentWorkflowItem = this.question.questionFlow.find(f => f.responseTypeId === 600000002);\r\n }\r\n\r\n this.question.currentResponse.responseType = this.currentWorkflowItem.responseType;\r\n this.question.currentResponse.responseTypeId = this.currentWorkflowItem.responseTypeId;\r\n } else {\r\n if (this.question.currentResponse && this.question._selectedValue) {\r\n const answerOption = this.question.answerOptions.find(a => a.answerId === this.question._selectedValue.answerId);\r\n\r\n const responseValue = answerOption.answerText.toString()\r\n .replace(/,/g, ' ').replace('$', '').replace(/\\s/g, '');\r\n\r\n if (responseValue) {\r\n this.question.currentResponse.responseValue = responseValue;\r\n } else {\r\n this.question.currentResponse.responsePresent = false;\r\n this.question.currentResponse.responseTypeId = -1;\r\n this.question.currentResponse.responseValue = null;\r\n }\r\n } else {\r\n this.question.currentResponse.responsePresent = false;\r\n this.question.currentResponse.responseTypeId = -1;\r\n this.question.currentResponse.responseValue = null;\r\n }\r\n }\r\n\r\n if (!this.question.currentResponse.responseValue || this.question.currentResponse.responseValue.toString().trim() === '') {\r\n this.currentWorkflowItem = this.question.questionFlow.find(f => f.responseTypeId === -1);\r\n }\r\n\r\n this.calculateSourceQuestions();\r\n\r\n this.context.fieldChanged(this.question, this.group);\r\n });\r\n }\r\n}\r\n","import { ComponentBase } from './component-base';\r\nimport { customElement } from 'aurelia-framework';\r\nimport { environment } from 'environment';\r\n\r\n// DisplayTypeId 610000070\r\n\r\n@customElement('dropdown-with-dropdown')\r\nexport class DropdownWithDropdown extends ComponentBase {\r\n private isLoading = false;\r\n private regionTypes = [];\r\n private suburbTypes = [];\r\n\r\n async bind() {\r\n super.bind();\r\n\r\n const endpoint = environment.refData.externalSystemRegions;\r\n const uri = endpoint.uri();\r\n const result = await this.http.fetch(uri, { method: endpoint.method });\r\n if (result.ok) {\r\n this.regionTypes = await result.json();\r\n }\r\n\r\n if (this.question) {\r\n const currentValue = this.question.currentResponse.responseValue;\r\n\r\n if (currentValue) {\r\n const regionSuburb = currentValue.split('|');\r\n const region = regionSuburb[0];\r\n const suburb = regionSuburb[1];\r\n\r\n if(region){\r\n const regionFound = this.regionTypes.find((x) => x.externalSystemRegionName === region);\r\n this.question._selectedRegion = regionFound;\r\n\r\n if(regionFound){\r\n await this.getSuburbTypes(regionFound.externalSystemRegionId);\r\n\r\n if(this.suburbTypes.length){\r\n const foundSuburb = this.suburbTypes.find((x) => x.externalSystemSuburbName === suburb);\r\n if(foundSuburb){\r\n this.question._selectedSuburb = foundSuburb;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n async regionTypeChanged(){\r\n this.taskQueue.queueTask(async () => {\r\n this.suburbTypes = [];\r\n this.question._selectedSuburb = null;\r\n\r\n if(this.question._selectedRegion){\r\n this.isLoading = true;\r\n await this.getSuburbTypes(this.question._selectedRegion.externalSystemRegionId)\r\n this.isLoading = false;\r\n }\r\n\r\n this.fieldChanged();\r\n })\r\n }\r\n\r\n suburbTypeChanged() {\r\n this.taskQueue.queueTask(() => {\r\n\r\n if (this.question._selectedSuburb) {\r\n this.question.currentResponse.responseValue = `${this.question._selectedRegion.externalSystemRegionName}|${this.question._selectedSuburb.externalSystemSuburbName}`\r\n }\r\n\r\n this.fieldChanged();\r\n });\r\n }\r\n\r\n fieldChanged() {\r\n this.taskQueue.queueTask(() => {\r\n\r\n if (this.question._selectedSuburb) {\r\n const currentWorkflowItem = this.question.questionFlow.find(q => q.responseTypeId === 600000001);\r\n\r\n this.question.currentResponse.responsePresent = true;\r\n this.question.currentResponse = { ...this.question.currentResponse, ...currentWorkflowItem };\r\n } else {\r\n const currentWorkflowItem = this.question.questionFlow.find(q => q.responseTypeId === -1);\r\n\r\n this.question.currentResponse.responsePresent = false;\r\n this.question.currentResponse = { ...this.question.currentResponse, ...currentWorkflowItem };\r\n }\r\n\r\n this.context.fieldChanged(this.question, this.group);\r\n });\r\n }\r\n\r\n async getSuburbTypes(externalSystemRegionId){\r\n const endpoint = environment.refData.externalSystemSuburbs;\r\n const uri = endpoint.uri([externalSystemRegionId]);\r\n const result = await this.http.fetch(uri, { method: endpoint.method });\r\n if (result.ok) {\r\n this.suburbTypes = await result.json();\r\n }\r\n }\r\n}\r\n","import { ComponentBase } from './component-base';\r\nimport { customElement } from 'aurelia-framework';\r\n\r\n@customElement('dropdown-with-free-text')\r\nexport class DropdownWithCurrency extends ComponentBase {\r\n\r\n bind() {\r\n super.bind();\r\n\r\n // The current value is a dropdown selection\r\n // so we want to remove the response value (which is user entered)\r\n if (this.currentWorkflowItem && this.currentWorkflowItem.responseTypeId === 600000000) {\r\n this.question.currentResponse.responseValue = null;\r\n }\r\n }\r\n\r\n fieldChanged(isInput = false) { \r\n this.taskQueue.queueTask(() => {\r\n super.fieldChanged(isInput);\r\n\r\n // If it's not an input, it's a dropdown\r\n if (isInput) {\r\n // We have no currently user entered value, it's empty\r\n if (!this.question.currentResponse.responseValue || this.question.currentResponse.responseValue.toString().trim() === '') {\r\n // Set current workflow item to be NoResponse type\r\n this.currentWorkflowItem = this.question.questionFlow.find(f => f.responseTypeId === -1);\r\n } else {\r\n // We have a user entered value, set the response type to FreeText\r\n this.currentWorkflowItem = this.question.questionFlow.find(f => f.responseTypeId === 600000005);\r\n }\r\n\r\n this.question.currentResponse.responseType = this.currentWorkflowItem.responseType;\r\n this.question.currentResponse.responseTypeId = this.currentWorkflowItem.responseTypeId;\r\n }\r\n\r\n // The current value is a dropdown selection\r\n // so we want to remove the response value (which is user entered)\r\n if (this.currentWorkflowItem.responseTypeId === 600000000) {\r\n this.question.currentResponse.responseValue = null;\r\n }\r\n\r\n this.context.fieldChanged(this.question, this.group);\r\n });\r\n }\r\n}\r\n","import { ComponentBase } from './component-base';\r\nimport { customElement } from 'aurelia-framework';\r\n\r\n@customElement('dropdown')\r\nexport class Dropdown extends ComponentBase {\r\n private displayAsButtons = false;\r\n\r\n async bind() {\r\n super.bind();\r\n\r\n if (this.question.questionAttributes.length > 0) {\r\n for (const attribute of this.question.questionAttributes) {\r\n if (attribute.attributeName === 'Display as Buttons') {\r\n this.displayAsButtons = attribute.attributeValue === 'Yes';\r\n }\r\n }\r\n }\r\n }\r\n\r\n fieldChanged(isInput = false) {\r\n this.taskQueue.queueTask(() => {\r\n super.fieldChanged(isInput);\r\n\r\n this.context.fieldChanged(this.question, this.group);\r\n });\r\n }\r\n\r\n btnClick(question, answer) {\r\n this.taskQueue.queueTask(() => {\r\n question._selectedValue = answer;\r\n this.fieldChanged();\r\n });\r\n }\r\n}\r\n"],"names":["inputMaskOptions","alias","autoUnmask","id","bind","fieldChanged","isInput","type","this","taskQueue","queueTask","question","currentResponse","responseValue","toString","trim","currentWorkflowItem","questionFlow","find","f","responseTypeId","responseType","context","group","customElement","DecimalFormatText","iaInput","inputmask","unmaskedvalue","DecimalFormat","calculateSourceQuestions","target","prototype","model","groups","forEach","questions","map","allowedDecmials","allowDollarSign","sourceCalculatedQuestions","length","calculatedTotal","calculatedAtLeastOnce","foundQuestion","findQuestionByIdInModel","disabledByQuestionFlowFlag","replace","includes","displayTypeId","splitAtCents","split","match","possibleAmount","parseFloat","parseInt","isNaN","toFixed","responsePresent","decimalPlaces","minimumValue","maximumValue","emptyInputBehavior","questionHasValidCurrentResponse","_selectedValue","answerOptions","a","answerId","answerText","DropdownWithCurrency","isLoading","regionTypes","suburbTypes","endpoint","refData","externalSystemRegions","uri","http","fetch","method","result","ok","json","currentValue","regionSuburb","regionFound","x","externalSystemRegionName","_selectedRegion","getSuburbTypes","externalSystemRegionId","foundSuburb","externalSystemSuburbName","_selectedSuburb","regionTypeChanged","suburbTypeChanged","q","externalSystemSuburbs","DropdownWithDropdown","displayAsButtons","questionAttributes","attribute","attributeName","attributeValue","btnClick","answer","Dropdown"],"sourceRoot":""}