();\nconst htmlToolbarContainer = ref('');\n\nconst symbolSelected = (symbol: string) => {\n if (!cursorPosition.value) {\n htmlMarkup.value = htmlMarkup.value + symbol;\n return;\n }\n\n htmlEditor.value?.instance?.insertText(cursorPosition.value.index, symbol, {});\n};\n\nconst openSymbolModal = () => {\n cursorPosition.value = htmlEditor.value?.instance?.getSelection();\n displayIconSelector.value = true\n};\n\nconst htmlUpdated = (updatedHtml: string) => {\n htmlMarkup.value = updatedHtml;\n};\n\nwatch(()=>props.insertTextAtCursorPosition, ()=>{\n if(props.insertTextAtCursorPosition == ''){\n return;\n }\n\n if (!cursorPosition.value) {\n htmlMarkup.value = htmlMarkup.value + props.insertTextAtCursorPosition;\n return;\n }\n\n htmlEditor.value?.instance?.insertText(cursorPosition.value.index, props.insertTextAtCursorPosition, {});\n});\n\nconst getCursorPosition = ()=>{\n cursorPosition.value = htmlEditor.value?.instance?.getSelection();\n};\n\n/* By default hitting enter will create new tags. \n * However, this leads to double lines appearing when the recipient views the email\n * The suggested workaround is to configure the underlying library Quill to use divs instead of p tags\n * https://supportcenter.devexpress.com/ticket/details/t753871/htmleditor-how-to-insert-the-br-tag-when-the-enter-key-is-pressed */\nlet Block = Quill.import('blots/block');\nBlock.tagName = 'div';\nQuill.register(Block);\n\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(_Fragment, null, [\n _createElementVNode(\"div\", _hoisted_1, [\n _createElementVNode(\"div\", _hoisted_2, [\n _createElementVNode(\"span\", _hoisted_3, _toDisplayString(props.label), 1),\n _createElementVNode(\"div\", _hoisted_4, [\n (props.displayAIModal)\n ? (_openBlock(), _createElementBlock(\"i\", {\n key: 0,\n class: \"fa-sharp fa-thin fa-microchip-ai ai-button\",\n onClick: _cache[0] || (_cache[0] = ($event: any) => (emit('aiIconClick')))\n }))\n : _createCommentVNode(\"\", true)\n ])\n ]),\n _createVNode(_unref(DxHtmlEditor), {\n ref_key: \"htmlEditor\",\n ref: htmlEditor,\n onValueChanged: getCursorPosition,\n value: htmlMarkup.value,\n \"onUpdate:value\": _cache[2] || (_cache[2] = ($event: any) => ((htmlMarkup).value = $event)),\n height: props.height,\n valueType: \"html\",\n readOnly: props.readOnly,\n onFocusIn: _cache[3] || (_cache[3] = ($event: any) => (emit('onFocused')))\n }, {\n default: _withCtx(() => [\n _createVNode(_unref(DxMediaResizing), { enabled: true }),\n _createVNode(_unref(DxImageUpload), {\n tabs: ['file', 'url'],\n \"file-upload-mode\": \"base64\"\n }),\n (!props.readOnly)\n ? (_openBlock(), _createBlock(_unref(DxToolbar), {\n key: 0,\n multiline: isMultiline.value,\n container: htmlToolbarContainer.value\n }, {\n default: _withCtx(() => [\n _createVNode(_unref(DxItem), { name: \"undo\" }),\n _createVNode(_unref(DxItem), { name: \"redo\" }),\n _createVNode(_unref(DxItem), { name: \"separator\" }),\n _createVNode(_unref(DxItem), {\n name: \"size\",\n \"accepted-values\": sizeValues,\n options: fontSizeOptions\n }),\n _createVNode(_unref(DxItem), {\n name: \"font\",\n \"accepted-values\": fontValues,\n options: fontFamilyOptions\n }),\n _createVNode(_unref(DxItem), { name: \"separator\" }),\n _createVNode(_unref(DxItem), { name: \"bold\" }),\n _createVNode(_unref(DxItem), { name: \"italic\" }),\n _createVNode(_unref(DxItem), { name: \"strike\" }),\n _createVNode(_unref(DxItem), { name: \"underline\" }),\n _createVNode(_unref(DxItem), { name: \"separator\" }),\n _createVNode(_unref(DxItem), { name: \"alignLeft\" }),\n _createVNode(_unref(DxItem), { name: \"alignCenter\" }),\n _createVNode(_unref(DxItem), { name: \"alignRight\" }),\n _createVNode(_unref(DxItem), { name: \"alignJustify\" }),\n _createVNode(_unref(DxItem), { name: \"separator\" }),\n _createVNode(_unref(DxItem), { name: \"orderedList\" }),\n _createVNode(_unref(DxItem), { name: \"bulletList\" }),\n _createVNode(_unref(DxItem), { name: \"separator\" }),\n _createVNode(_unref(DxItem), {\n name: \"header\",\n \"accepted-values\": headerValues,\n options: headerOptions\n }),\n _createVNode(_unref(DxItem), { name: \"separator\" }),\n _createVNode(_unref(DxItem), { name: \"color\" }),\n _createVNode(_unref(DxItem), { name: \"background\" }),\n _createVNode(_unref(DxItem), { name: \"separator\" }),\n _createVNode(_unref(DxItem), { name: \"link\" }),\n _createVNode(_unref(DxItem), { name: \"image\" }),\n _createVNode(_unref(DxItem), { name: \"separator\" }),\n _createVNode(_unref(DxItem), { name: \"clear\" }),\n _createVNode(_unref(DxItem), { name: \"codeBlock\" }),\n _createVNode(_unref(DxItem), { name: \"blockquote\" }),\n _createVNode(_unref(DxItem), { name: \"separator\" }),\n _createVNode(_unref(DxItem), { name: \"symbols\" }, {\n default: _withCtx(() => [\n _createElementVNode(\"div\", {\n class: \"custom-header-icon\",\n onClick: openSymbolModal,\n id: \"symbolsIcon\"\n }, \" Ω \")\n ]),\n _: 1\n }),\n _createVNode(_unref(DxItem), { name: \"html\" }, {\n default: _withCtx(() => [\n _createElementVNode(\"div\", {\n class: \"custom-header-icon\",\n onClick: _cache[1] || (_cache[1] = ($event: any) => (displayEditHtmlModal.value = true)),\n id: \"symbolsIcon\"\n }, _hoisted_6)\n ]),\n _: 1\n }),\n _createVNode(_unref(DxItem), { name: \"increaseIndent\" }),\n _createVNode(_unref(DxItem), { name: \"decreaseIndent\" }),\n _createVNode(_unref(DxItem), { name: \"subscript\" }),\n _createVNode(_unref(DxItem), { name: \"superscript\" }),\n _createVNode(_unref(DxItem), { name: \"insertTable\" }),\n _createVNode(_unref(DxItem), { name: \"deleteTable\" }),\n _createVNode(_unref(DxItem), { name: \"insertRowAbove\" }),\n _createVNode(_unref(DxItem), { name: \"insertRowBelow\" }),\n _createVNode(_unref(DxItem), { name: \"deleteRow\" }),\n _createVNode(_unref(DxItem), { name: \"insertColumnLeft\" }),\n _createVNode(_unref(DxItem), { name: \"insertColumnRight\" }),\n _createVNode(_unref(DxItem), { name: \"deleteColumn\" })\n ]),\n _: 1\n }, 8, [\"multiline\", \"container\"]))\n : _createCommentVNode(\"\", true)\n ]),\n _: 1\n }, 8, [\"value\", \"height\", \"readOnly\"]),\n (htmlToolbarContainer.value != '')\n ? (_openBlock(), _createElementBlock(\"div\", _hoisted_7))\n : _createCommentVNode(\"\", true)\n ]),\n _createVNode(EditHtmlModal, {\n modelValue: displayEditHtmlModal.value,\n \"onUpdate:modelValue\": _cache[4] || (_cache[4] = ($event: any) => ((displayEditHtmlModal).value = $event)),\n \"displayed-html\": htmlMarkup.value,\n onHtmlUpdated: htmlUpdated\n }, null, 8, [\"modelValue\", \"displayed-html\"]),\n _createVNode(SymbolSelectorModal, {\n modelValue: displayIconSelector.value,\n \"onUpdate:modelValue\": _cache[5] || (_cache[5] = ($event: any) => ((displayIconSelector).value = $event)),\n onSymbolSelected: symbolSelected\n }, null, 8, [\"modelValue\"])\n ], 64))\n}\n}\n\n})","import script from \"./html-editor.vue?vue&type=script&setup=true&lang=ts\"\nexport * from \"./html-editor.vue?vue&type=script&setup=true&lang=ts\"\n\nimport \"./html-editor.vue?vue&type=style&index=0&id=40c63033&scoped=true&lang=scss\"\n\nimport exportComponent from \"../../../node_modules/vue-loader/dist/exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['__scopeId',\"data-v-40c63033\"]])\n\nexport default __exports__","\n\n \n","import { render } from \"./support-case-icon.vue?vue&type=template&id=78aab37a\"\nconst script = {}\n\nimport exportComponent from \"../../../node_modules/vue-loader/dist/exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__","\n\n \n","import { render } from \"./utility-switch-icon.vue?vue&type=template&id=9574f702\"\nconst script = {}\n\nimport exportComponent from \"../../../node_modules/vue-loader/dist/exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__","export enum TasksNotes {\n Task = 0,\n Note = 1\n}","import { defineComponent as _defineComponent } from 'vue'\nimport { unref as _unref, createVNode as _createVNode, mergeProps as _mergeProps, createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, withCtx as _withCtx, Fragment as _Fragment, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \"vue\"\n\nconst _withScopeId = n => (_pushScopeId(\"data-v-ae7a3496\"),n=n(),_popScopeId(),n)\nconst _hoisted_1 = {\n key: 0,\n class: \"note-modal-content\"\n}\nconst _hoisted_2 = { class: \"small-field-container\" }\n\nimport { inject, ref, computed, watch } from 'vue';\nimport { AcquaintApiClient } from '@/services/AcquaintApiClient';\nimport { getErrorMessage } from 'bright-logic-core/src/errors';\nimport displayErrorMessage from '@/utils/ErrorHandling';\nimport modalBase from '../ui/modals/modal-base.vue';\nimport lookupSingleSelect from '../ui/lookup/lookup-single-select.vue';\nimport { LookupTableSource } from 'acquaint-api/constants/LookupTableSource';\nimport propertyLookup from '../ui/lookup/property-lookup.vue';\nimport contactLookup from '../ui/lookup/contact-lookup.vue';\nimport { ContactTasks } from 'acquaint-api/models/ContactTasks';\nimport { DxToolbarItem } from 'devextreme-vue/popup';\nimport { IDDescriptionPair } from \"@/types/generic/IDDescriptionPair\";\nimport switchToggle from '../ui/toggles/switch-toggle.vue';\nimport AcquaintTextbox from '@/components/ui/inputs/acquaint-textbox.vue';\nimport AcquaintTextArea from '@/components/ui/inputs/acquaint-text-area.vue';\nimport { ContactTasksValidation } from 'acquaint-api/validation/ContactTasksValidation';\nimport { ModalWidth } from '@/types/ui/modals/ModalWidth';\nimport FieldValidationFreeDateBox from '../ui/inputs/field-validation-free-date-box.vue';\nimport { TimeStamps } from '@/utils/TimeStamp';\nimport { TasksNotes } from '@/enums/TasksNotes';\nimport { ValidationCallbackParams } from '../../types/validation/ValidationCallbackParams';\nimport { useSystemConfigurationStore } from '@/stores/SystemConfigurationStore';\nimport { SystemConfiguration } from 'acquaint-api/constants/SystemConfiguration';\nimport { FieldSize } from '@/enums/system/FieldSize';\nimport { TaskTemplates } from 'acquaint-api/models/TaskTemplates'; \nimport TaskTemplatesConfigurationModal from '../contact-configuration/task-templates-configuration-modal.vue';\nimport { DxContextMenu } from 'devextreme-vue/context-menu';\nimport { ContextMenuItem } from '@/types/ui/menus/ContextMenuItem';\n\nconst systemUserId = 999999999;\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'edit-note-modal',\n props: {\n modelValue: {\n type: Boolean,\n required: true\n },\n id: {\n type: Number,\n required: true\n },\n contactId: {\n type: Number,\n default: 0\n },\n propertyID:{\n type: Number,\n default:0\n },\n certificateID:{\n type: Number,\n default:0\n }\n},\n emits: ['update:modelValue', 'saveNote'],\n setup(__props, { emit }) {\n\nconst props = __props;\n\nconst systemConfigStore = useSystemConfigurationStore();\nconst acquaintApiClient = inject('AcquaintApiClient') as AcquaintApiClient;\nconst noteDetails = ref();\nconst initalNoteDetails = ref();\nconst ownerName = ref();\nconst saving = ref(false);\nconst showCloseConfirmation = ref(false);\nconst keepingModalOpening = ref(false);\nconst focusBodyField = ref(false);\nconst resetValid = ref(false);\nconst contactRequired = ref(false);\nconst openTemplateModal = ref(false);\nconst taskTemplate = ref({\n id: 0,\n description: '',\n subject: '',\n body: '',\n taskTypeID: 0,\n inActive: 0,\n});\nconst showFunctionsMenu = ref(false);\nconst contextMenuId = ref('note-modal-functions-list');\n\n\n\nconst showNoteModal = computed({\n get: () => props.modelValue,\n set: (value: boolean) => emit('update:modelValue', value)\n});\n\n\n\nwatch(() => showNoteModal.value, async () => {\n // Avoid unnecessary api calls by only calling api when modal is shown\n if (!showNoteModal.value || keepingModalOpening.value) {\n return;\n }\n contactRequired.value = false;\n\n await populateData();\n resetValid.value = true;\n\n setTimeout(()=>{resetValid.value = false}, 100);\n await fetchOwnerName();\n});\n\n\n// Functions for fetching the data\n\nconst fetchData = async () => {\n try {\n if (props.id != 0) {\n initalNoteDetails.value = await acquaintApiClient.httpGet(`database/contacttasks/${props.id}`);\n } else {\n initalNoteDetails.value = await acquaintApiClient.httpGet('database/contacttasks/defaultmodel');\n }\n return true;\n } catch (err) {\n displayErrorMessage(getErrorMessage(err));\n return false;\n }\n};\n\nconst populateData = async ()=>{\n if(!await fetchData()){\n initalNoteDetails.value = undefined;\n noteDetails.value = undefined;\n return;\n }\n\n // Set this new Task record to be a note record.\n if (initalNoteDetails.value) {\n /* Get default note type from system config and assign it to the model\n * Note: the system config store alwayrs returns a string. \n * To maintain type safety this needs to be converted to a number */\n const defaultTaskTypeId = await systemConfigStore.getSystemConfigurationValue(SystemConfiguration.DefaultNoteType);\n initalNoteDetails.value.taskTypeID = Number(defaultTaskTypeId);\n \n initalNoteDetails.value.type = TasksNotes.Note;\n\n if(props.contactId > -1){\n initalNoteDetails.value.contactID = props.contactId;\n }\n\n if (props.propertyID > 0) {\n initalNoteDetails.value.propertyID = props.propertyID;\n }\n\n if (props.certificateID > 0) {\n initalNoteDetails.value.certificateID = props.certificateID;\n }\n\n noteDetails.value = JSON.parse(JSON.stringify(initalNoteDetails.value));\n }\n};\n\nconst fetchOwnerName = async () => {\n // Ignore system user as this will cause api to error\n if (noteDetails.value?.userID === systemUserId) {\n ownerName.value = { id: systemUserId, description: 'System User' };\n return;\n }\n\n try {\n ownerName.value = await acquaintApiClient.httpGet(`app/contacts/${noteDetails.value?.userID}/name`);\n } catch (err) {\n displayErrorMessage(getErrorMessage(err));\n }\n};\n\n// After a template has been selected, we must replace the note's subject and body with the template's subject and body\nconst fetchItemData = async (templateId:number)=>{\n try{\n taskTemplate.value = await acquaintApiClient.httpGet(`database/tasktemplates/${templateId}`);\n return true;\n } catch(err){\n taskTemplate.value = {\n id: 0,\n description: '',\n subject: '',\n body: '',\n taskTypeID: 0,\n inActive: 0,\n };\n displayErrorMessage(getErrorMessage(err));\n return false;\n }\n}; \n\nconst populateSubjectBodyFields = async (templateId:number)=>{\n if(await fetchItemData(templateId) && noteDetails.value){\n noteDetails.value.subject = taskTemplate.value.subject; \n noteDetails.value.body = taskTemplate.value.body; \n }\n};\n\n\n//Functions for saving the record\n\n/** Pushes the updated task to the api */\nconst submitData = async () => {\n try {\n if(props.id > 0){\n await acquaintApiClient.httpPut(`database/contacttasks/${props.id}`, noteDetails.value);\n } else {\n await acquaintApiClient.httpPost(`database/contacttasks`, noteDetails.value);\n }\n return true;\n } catch (err) {\n displayErrorMessage(getErrorMessage(err));\n return false;\n }\n};\n\n/** Handles the Save button click event */\nconst onSaveClick = async (e: any) => {\n contactRequired.value = true;\n const validate = e.validationGroup.validate();\n\n if (!e.validationGroup._validationInfo.result.isValid || !validate.isValid) {\n return\n }\n\n if(!noteDetails.value?.contactID && !noteDetails.value?.propertyID){\n displayErrorMessage('You must link the Note to either a Contact or Property.');\n return\n }\n\n if(!await submitData()){\n return\n }\n\n showCloseConfirmation.value = false;\n closeTaskModal();\n emit('saveNote', noteDetails.value?.contactID == props.contactId, noteDetails.value?.propertyID == props.propertyID)\n};\n\n\n// Code relating to the closure of the modal\n\n/** Closes the task modal */\nconst closeTaskModal = () => {\n showNoteModal.value = false;\n};\n\nwatch(()=>noteDetails.value, (value)=>{\n showCloseConfirmation.value = JSON.stringify(value) != JSON.stringify(initalNoteDetails.value);\n}, {deep:true});\n\n\n/** Adds a date stamp to the end of the current taskbody */\n\nconst dateStamp = async () =>{\n if (!noteDetails.value){\n return\n }\n\n noteDetails.value.body = await TimeStamps(noteDetails.value.body);\n focusBodyField.value = true;\n\n setTimeout(()=>{\n focusBodyField.value = false;\n }, 50)\n};\n\n\n// Code for validating the data before it is submitted\n\n// This function is passed down to either the body or subject field and is used in their respective custom rule tag. \n// Either has to have text in it. True is returned when text has been entered (the value is valid) otherwise, false is returned and a user error message appears.\n\nconst customValidationFunction = (params: ValidationCallbackParams) => {\n return typeof (params.value) === 'string' ? params.value.length > 0 : false;\n};\n\nconst requiredMessage = ref(\"The subject or the body field is required\");\n\n//If the subject field does have text in it, the customValidationFunction will not passed down to the body field, requiring the user to enter a value, as only one of the two fields needs to have text in it\nconst conditionalBodyValidation = computed(() => { return noteDetails.value?.subject ? undefined:{\n customValidation: customValidationFunction\n }\n});\n\n//If the body field does have text in it, the customValidationFunction will not be passed down to the subject field, requiring the user to enter a value, as only one of the two fields needs to have text in it\nconst conditionalSubjectValidation = computed(() => {return noteDetails.value?.body ? undefined:{\n customValidation: customValidationFunction\n }\n});\n\n// This code handles the actions footer menu.\nconst menuItems:ContextMenuItem[] = [\n {\n text: 'Template',\n key: 'template',\n icon:''\n },\n {\n text: 'Date Stamp',\n key: 'dateStamp',\n icon:''\n }\n];\n\nconst onMenuItemClick = (e:any) =>{\n switch(e.itemData.key){\n case 'template':\n openTemplateModal.value = true; \n break;\n case 'dateStamp':\n dateStamp();\n break;\n }\n}; \n\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(_Fragment, null, [\n _createVNode(modalBase, {\n modelValue: showNoteModal.value,\n \"onUpdate:modelValue\": _cache[10] || (_cache[10] = ($event: any) => ((showNoteModal).value = $event)),\n title: \"Note\",\n width: _unref(ModalWidth).Small,\n height: \"650px\",\n saving: saving.value,\n showCloseConfirmationPrompt: showCloseConfirmation.value,\n onModalClosed: _cache[11] || (_cache[11] = ($event: any) => (keepingModalOpening.value = false)),\n onCancelPromptDenied: _cache[12] || (_cache[12] = ($event: any) => (keepingModalOpening.value = true)),\n \"help-page\": \"notes\"\n }, {\n content: _withCtx(() => [\n (noteDetails.value)\n ? (_openBlock(), _createElementBlock(\"section\", _hoisted_1, [\n _createVNode(contactLookup, {\n label: \"Contact\",\n findNameOnIdChange: true,\n modelValue: noteDetails.value.contactID,\n \"onUpdate:modelValue\": _cache[0] || (_cache[0] = ($event: any) => ((noteDetails.value.contactID) = $event)),\n readOnly: false,\n isRequired: contactRequired.value,\n showNavigateContactIcon: false\n }, null, 8, [\"modelValue\", \"isRequired\"]),\n _createVNode(propertyLookup, {\n label: \"Property\",\n modelValue: noteDetails.value.propertyID,\n \"onUpdate:modelValue\": _cache[1] || (_cache[1] = ($event: any) => ((noteDetails.value.propertyID) = $event)),\n displayNavigateIcon: false,\n displayPeek: true\n }, null, 8, [\"modelValue\"]),\n _createVNode(AcquaintTextbox, _mergeProps({\n label: \"Subject\",\n fieldValidation: _unref(ContactTasksValidation).Subject,\n modelValue: noteDetails.value.subject,\n \"onUpdate:modelValue\": _cache[2] || (_cache[2] = ($event: any) => ((noteDetails.value.subject) = $event)),\n invalidMessage: requiredMessage.value\n }, conditionalSubjectValidation.value, { resetValid: resetValid.value }), null, 16, [\"fieldValidation\", \"modelValue\", \"invalidMessage\", \"resetValid\"]),\n _createVNode(AcquaintTextArea, _mergeProps({\n label: \"Body\",\n fieldValidation: _unref(ContactTasksValidation).Body,\n modelValue: noteDetails.value.body,\n \"onUpdate:modelValue\": _cache[3] || (_cache[3] = ($event: any) => ((noteDetails.value.body) = $event)),\n invalidMessage: requiredMessage.value\n }, conditionalBodyValidation.value, {\n focusInput: focusBodyField.value,\n resetValid: resetValid.value\n }), null, 16, [\"fieldValidation\", \"modelValue\", \"invalidMessage\", \"focusInput\", \"resetValid\"]),\n _createElementVNode(\"div\", _hoisted_2, [\n _createElementVNode(\"div\", null, [\n _createVNode(FieldValidationFreeDateBox, {\n includeTime: true,\n label: \"Date Added\",\n modelValue: noteDetails.value.addedDate,\n \"onUpdate:modelValue\": _cache[4] || (_cache[4] = ($event: any) => ((noteDetails.value.addedDate) = $event)),\n readOnly: true,\n width: _unref(FieldSize).Large\n }, null, 8, [\"modelValue\", \"width\"]),\n _createVNode(FieldValidationFreeDateBox, {\n includeTime: true,\n label: \"Date Updated\",\n modelValue: noteDetails.value.updatedDate,\n \"onUpdate:modelValue\": _cache[5] || (_cache[5] = ($event: any) => ((noteDetails.value.updatedDate) = $event)),\n readOnly: true,\n width: _unref(FieldSize).Large\n }, null, 8, [\"modelValue\", \"width\"])\n ]),\n _createElementVNode(\"div\", null, [\n _createVNode(lookupSingleSelect, {\n modelValue: noteDetails.value.taskTypeID,\n \"onUpdate:modelValue\": _cache[6] || (_cache[6] = ($event: any) => ((noteDetails.value.taskTypeID) = $event)),\n \"lookup-source\": _unref(LookupTableSource).TaskTypes,\n label: \"Type\",\n requiredInput: true,\n width: _unref(FieldSize).Large\n }, null, 8, [\"modelValue\", \"lookup-source\", \"width\"]),\n _createVNode(lookupSingleSelect, {\n modelValue: noteDetails.value.userID,\n \"onUpdate:modelValue\": _cache[7] || (_cache[7] = ($event: any) => ((noteDetails.value.userID) = $event)),\n \"lookup-source\": _unref(LookupTableSource).Users,\n label: \"Owner\",\n readOnly: true,\n updateTableSourceOnIdChange: true,\n width: _unref(FieldSize).Large\n }, null, 8, [\"modelValue\", \"lookup-source\", \"width\"])\n ])\n ]),\n _createElementVNode(\"div\", null, [\n _createVNode(switchToggle, {\n label: \"Always Show At Top\",\n modelValue: noteDetails.value.alwaysShowAtTop,\n \"onUpdate:modelValue\": _cache[8] || (_cache[8] = ($event: any) => ((noteDetails.value.alwaysShowAtTop) = $event)),\n readOnly: false\n }, null, 8, [\"modelValue\"]),\n _createVNode(switchToggle, {\n label: \"Desktop Alert\",\n modelValue: noteDetails.value.desktopAlert,\n \"onUpdate:modelValue\": _cache[9] || (_cache[9] = ($event: any) => ((noteDetails.value.desktopAlert) = $event)),\n readOnly: false\n }, null, 8, [\"modelValue\"])\n ])\n ]))\n : _createCommentVNode(\"\", true)\n ]),\n footer: _withCtx(() => [\n _createVNode(_unref(DxToolbarItem), {\n widget: \"dxButton\",\n toolbar: \"bottom\",\n location: \"after\",\n options: { elementAttr: { id: contextMenuId.value }, text: 'Actions', onClick: () => { showFunctionsMenu.value = !showFunctionsMenu.value; } }\n }, null, 8, [\"options\"]),\n _createVNode(_unref(DxToolbarItem), {\n widget: \"dxButton\",\n toolbar: \"bottom\",\n location: \"after\",\n options: { text: 'Save', onClick: onSaveClick }\n }, null, 8, [\"options\"]),\n _createVNode(_unref(DxToolbarItem), {\n widget: \"dxButton\",\n toolbar: \"bottom\",\n location: \"after\",\n options: { text: 'Cancel', onClick: () => { closeTaskModal() } }\n }, null, 8, [\"options\"])\n ]),\n _: 1\n }, 8, [\"modelValue\", \"width\", \"saving\", \"showCloseConfirmationPrompt\"]),\n _createVNode(TaskTemplatesConfigurationModal, {\n modelValue: openTemplateModal.value,\n \"onUpdate:modelValue\": _cache[13] || (_cache[13] = ($event: any) => ((openTemplateModal).value = $event)),\n onEmitSelectedDetails: populateSubjectBodyFields,\n showSelectButton: true\n }, null, 8, [\"modelValue\"]),\n _createVNode(_unref(DxContextMenu), {\n visible: showFunctionsMenu.value,\n \"onUpdate:visible\": _cache[14] || (_cache[14] = ($event: any) => ((showFunctionsMenu).value = $event)),\n \"data-source\": menuItems,\n target: `#${contextMenuId.value}`,\n position: { my: 'bottom right', at: 'top right' },\n onItemClick: onMenuItemClick\n }, null, 8, [\"visible\", \"target\"])\n ], 64))\n}\n}\n\n})","import script from \"./edit-note-modal.vue?vue&type=script&setup=true&lang=ts\"\nexport * from \"./edit-note-modal.vue?vue&type=script&setup=true&lang=ts\"\n\nimport \"./edit-note-modal.vue?vue&type=style&index=0&id=ae7a3496&scoped=true&lang=scss\"\n\nimport exportComponent from \"../../../node_modules/vue-loader/dist/exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['__scopeId',\"data-v-ae7a3496\"]])\n\nexport default __exports__","import { defineComponent as _defineComponent } from 'vue'\nimport { createVNode as _createVNode, createElementVNode as _createElementVNode, unref as _unref, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, withCtx as _withCtx, normalizeClass as _normalizeClass, toDisplayString as _toDisplayString, Fragment as _Fragment, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \"vue\"\n\nconst _withScopeId = n => (_pushScopeId(\"data-v-41c1777b\"),n=n(),_popScopeId(),n)\nconst _hoisted_1 = { class: \"main-switch-container\" }\nconst _hoisted_2 = { class: \"progress-bar-container\" }\nconst _hoisted_3 = { class: \"owner-page\" }\nconst _hoisted_4 = { class: \"wizard-page\" }\nconst _hoisted_5 = { class: \"wizard-page\" }\nconst _hoisted_6 = { class: \"tenant-switch-footer-container\" }\nconst _hoisted_7 = { class: \"button-holder\" }\nconst _hoisted_8 = { class: \"steps\" }\n\nimport { computed, inject, ref, watch } from 'vue';\nimport ModalBase from '@/components/ui/modals/modal-base.vue';\nimport { AcquaintApiClient } from '@/services/AcquaintApiClient';\nimport displayErrorMessage from '@/utils/ErrorHandling';\nimport { getErrorMessage } from 'bright-logic-core/src/errors';\nimport TenantSwitchProgress from '../switches/tenant-switch-progress.vue';\nimport { Properties } from 'acquaint-api/models/Properties';\nimport DxMultiView from 'devextreme-vue/multi-view';\nimport { QuestionsWizardData } from '@/types/wizard/question-wizard-data';\nimport ContactLookup from '../ui/lookup/contact-lookup.vue';\nimport { DxButton } from 'devextreme-vue';\nimport ContactModal from '../contacts/record/contact-modal.vue';\nimport EditAddress from '../ui/address/edit-address.vue';\nimport CurrencyInput from '../ui/inputs/currency-input.vue';\nimport BedroomsSelect from '../ui/dropdowns/bedrooms-select.vue';\nimport SystemCodeSingleSelect from '../ui/system-codes/system-code-single-select.vue';\nimport { CodeType } from 'acquaint-api/constants/CodeType';\nimport LookupSingleSelect from '../ui/lookup/lookup-single-select.vue';\nimport { LookupTableSource } from 'acquaint-api/constants/LookupTableSource';\nimport { Address } from '@/types/generic/Address';\nimport { EditAddressValidation } from '@/types/validation/EditAddressValidation';\nimport { ValidatedEvent } from 'devextreme/ui/validator';\nimport { PropertiesValidation } from 'acquaint-api/validation/PropertiesValidation';\nimport { Contacts } from 'acquaint-api/models/Contacts';\nimport { PropertyCategory } from 'acquaint-api/constants/PropertyCategory'\nimport { ContactFindResult } from '@/types/find/contacts/ContactFindResult';\nimport { PropertyStatus } from 'acquaint-api/constants/PropertyStatus';\nimport { displayQuestionAlert } from '@/alerts/questionAlert';\nimport { useContactTypeConfigurationStore } from '@/stores/ContactTypeConfigurationStore';\nimport { SystemContactTypes } from '@/enums/contacts/SystemContactTypes';\nimport { DisplayCompanyAlert } from '@/utils/DisplayCompanyAlert';\nimport SelectCompanyModal from './select-company-modal.vue';\nimport { IDDescriptionPair } from '@/types/generic/IDDescriptionPair';\nimport { AcquaintApiNextClient } from '@/services/AcquaintApiNextClient';\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'new-property-wizard',\n props: {\n modelValue: {\n type: Boolean,\n required: true,\n },\n ownerId: {\n type: Number,\n default: 0\n },\n contactLookupReadOnly: {\n type: Boolean,\n default: false,\n }\n},\n emits: ['update:modelValue', 'modalClosed'],\n setup(__props, { emit }) {\n\nconst props = __props;\n\n\n\n\n\nconst apiNextClient = inject('AcquaintApiNextClient') as AcquaintApiNextClient;\nconst apiClient = inject('AcquaintApiClient') as AcquaintApiClient;\nconst displayCancelConfirmationModal = ref(false);\nconst keepingModalOpening = ref(false);\nconst saving = ref(false);\nconst selectedIndex = ref(0);\n// These are the progress bar statuses, if a bar's status is 0, the bar is has no progress and\n// when it is 1, the bar has been 100% completed.\nconst stageTwo = ref(0);\nconst stageThree = ref(0);\nconst editableData = ref();\nconst originalData = ref();\nconst displayNewContactModal = ref(false);\nconst isContactEntered = ref(false);\nconst selectedContact = ref();\nconst ownerDetails = ref();\nconst displayCompaniesModal = ref(false);\nconst contactTypeConfigurationStore = useContactTypeConfigurationStore();\nconst companies = ref([])\nconst addressModel = ref({\n countryCode: 0,\n postCode: '',\n propertyName: '',\n street: '',\n locality: '',\n town: '',\n region: '',\n country: '',\n});\n\nconst addressValidation = ref({\n propertyName: PropertiesValidation.PropertyName,\n street: PropertiesValidation.Street,\n locality: PropertiesValidation.Locality,\n town: PropertiesValidation.Town,\n region: PropertiesValidation.Region,\n postcode: PropertiesValidation.Postcode\n});\n\n// Each page must be assigned a template name for it to appear\nconst pages = ref([\n {\n template: 'owner'\n },\n {\n template: 'address'\n },\n {\n template: 'mainDetails'\n }\n]);\n\nconst showModal = computed({\n get: () => props.modelValue,\n set: (value: boolean) => emit('update:modelValue', value),\n});\n\n\nwatch(() => selectedIndex.value, () => {\n switch (selectedIndex.value) {\n case 0: {\n stageTwo.value = 0;\n stageThree.value = 0;\n break;\n }\n case 1: {\n stageTwo.value = 1;\n stageThree.value = 0;\n break;\n }\n case 2: {\n triggerCompanyModalToOpen(editableData.value?.category ?? 0);\n stageTwo.value = 1;\n stageThree.value = 1;\n break;\n }\n }\n});\n\nwatch(() => showModal.value, async () => {\n if (!showModal.value || keepingModalOpening.value) {\n return;\n }\n\n // We must reset \n stageTwo.value = 0;\n stageThree.value = 0;\n selectedIndex.value = 0;\n isContactEntered.value = false;\n selectedContact.value = undefined;\n editableData.value = undefined;\n\n await fetchDefaultData();\n\n if (!originalData.value) {\n addressModel.value.countryCode = 0;\n addressModel.value.country = '';\n addressModel.value.propertyName = '';\n addressModel.value.street = '';\n addressModel.value.locality = '';\n addressModel.value.town = '';\n addressModel.value.region = '';\n addressModel.value.postCode = '';\n return;\n }\n\n addressModel.value.countryCode = originalData.value?.countryCode ?? 0;\n addressModel.value.country = originalData.value?.country ?? '';\n addressModel.value.propertyName = originalData.value?.propertyName ?? '';\n addressModel.value.street = originalData.value?.street ?? '';\n addressModel.value.locality = originalData.value?.locality ?? '';\n addressModel.value.town = originalData.value?.town ?? '';\n addressModel.value.region = originalData.value?.region ?? '';\n addressModel.value.postCode = originalData.value?.postcode ?? '';\n\n editableData.value = JSON.parse(JSON.stringify(originalData.value));\n\n if (!props.ownerId) {\n return;\n }\n\n if (!editableData.value) {\n return;\n }\n\n editableData.value.contactID = props.ownerId;\n\n await fetchOwnersDetails();\n\n const typeOfOwnerType = ownerDetails.value ? await contactTypeConfigurationStore.getSystemContactType(ownerDetails.value.typeID) : -1;\n\n if (typeOfOwnerType != SystemContactTypes.Vendor || (typeOfOwnerType == SystemContactTypes.Vendor && ownerHasNoHomeAddress.value)) {\n return\n }\n\n selectedIndex.value++;\n\n let alert = await displayQuestionAlert(\"Do you wish to use the Contact’s home address as the address for this property?\");\n\n if (alert.isConfirmed) {\n fillAddressFields();\n }\n});\n\nconst ownerHasNoHomeAddress = computed(() => {\n return ownerDetails.value?.homeCountry == '' && ownerDetails.value?.homeLocality == '' &&\n ownerDetails.value?.homePostcode == '' && ownerDetails.value?.homeProperty == '' &&\n ownerDetails.value?.homeRegion == '' && ownerDetails.value?.homeStreet == '' &&\n ownerDetails.value?.homeTown == '';\n});\n\nconst fetchOwnersDetails = async () => {\n try {\n ownerDetails.value = await apiClient.httpGet