{"version":3,"file":"app.min.js","sources":["../../../../../../UILib/ui-lib/lib/app/communications/lib.js","../../../../../../UILib/ui-lib/lib/app/communications/contact.js","../../../../../../UILib/ui-lib/lib/app/communications/follower.js","../../../../../../UILib/ui-lib/lib/app/communications/customer.js","../../../../../../UILib/ui-lib/lib/app/communications/internal.js"],"sourcesContent":["import { createElement } from \"../../ui\";\r\n\r\nfunction createBox(title, functions) {\r\n const container = createElement('div', 'comm');\r\n const header = createElement('div', 'title-bar',\r\n title,\r\n createElement('div', 'title-functions', ...functions)\r\n );\r\n container.appendChild(header);\r\n return container;\r\n}\r\n\r\nexport {\r\n createBox\r\n}","import { Grid, Dropdown, createElement, createCheckbox, Popup, showAlert } from \"../../ui\";\r\nimport { isEmail, nullOrEmpty, r } from \"../../utility\";\r\n\r\nclass Contact {\r\n #option;\r\n #refs;\r\n\r\n constructor(option = {}) {\r\n this.#option = option;\r\n }\r\n\r\n async show(parent = document.body) {\r\n const tabIndex = Math.max.apply(null, [...document.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0)) + 3;\r\n\r\n const c = this.#option.contact;\r\n const contactName = createElement('input', input => {\r\n input.type = 'text';\r\n input.className = 'ui-input';\r\n input.tabIndex = tabIndex + 1;\r\n input.maxLength = 200;\r\n input.autocomplete = 'off';\r\n });\r\n const preferences = new Dropdown({ tabIndex: tabIndex + 2 });\r\n preferences.source = [\r\n { value: '0', text: r('text', 'Text') },\r\n { value: '1', text: r('email', 'Email') },\r\n { value: '2', text: r('phone', 'Phone') }\r\n ];\r\n const contactEmail = createElement('input', input => {\r\n input.type = 'email';\r\n input.className = 'ui-input';\r\n input.tabIndex = tabIndex + 3;\r\n input.maxLength = 100;\r\n input.autocomplete = 'off';\r\n });\r\n const contactMobile = createElement('input', input => {\r\n input.type = 'tel';\r\n input.className = 'ui-input';\r\n input.tabIndex = tabIndex + 4;\r\n input.maxLength = 50;\r\n input.autocomplete = 'off';\r\n });\r\n const checkOpt = createCheckbox({ tabIndex: tabIndex + 5 });\r\n const contactNotes = createElement('textarea', txt => {\r\n txt.className = 'ui-text';\r\n txt.tabIndex = tabIndex + 6;\r\n txt.maxLength = 2000;\r\n txt.style.height = '100px';\r\n });\r\n const buttons = [];\r\n if (this.#option.company) {\r\n buttons.push({\r\n text: c == null ? r('addContactRecord', 'Add Contact Record') : r('editContactRecord', 'Edit Contact Record'),\r\n // tabIndex: tabIndex + 7,\r\n trigger: () => {\r\n const item = this.prepare();\r\n if (item == null) {\r\n return false;\r\n }\r\n item.SaveToCustomer = 1;\r\n if (typeof this.#option.onSave === 'function') {\r\n return this.#option.onSave.call(this, item, 'customerrecord');\r\n }\r\n }\r\n });\r\n }\r\n buttons.push(\r\n {\r\n text: r('workOrderOnly', 'Work Order Only'),\r\n // tabIndex: tabIndex + 8,\r\n trigger: () => {\r\n const item = this.prepare();\r\n if (item == null) {\r\n return false;\r\n }\r\n item.Id = -1;\r\n item.SaveToCustomer = 0;\r\n if (typeof this.#option.onSave === 'function') {\r\n return this.#option.onSave.call(this, item, 'workorder');\r\n }\r\n }\r\n },\r\n {\r\n text: r('cancel', 'Cancel'),\r\n // tabIndex: tabIndex + 9\r\n }\r\n );\r\n const popup = new Popup({\r\n onMasking: this.#option.onMasking,\r\n title: c == null ? r('addContact', 'Add Contact') : r('editContact', 'Edit Contact'),\r\n content: createElement('div', wrapper => {\r\n wrapper.className = 'setting-wrapper';\r\n wrapper.style.width = '500px';\r\n },\r\n createElement('div', 'setting-item',\r\n createElement('span', 'setting-label setting-required', r('contactNameColon', 'Contact Name:')),\r\n contactName\r\n ),\r\n createElement('div', 'setting-item',\r\n createElement('span', 'setting-label', r('contactPreferencesColon', 'Contact Preferences:')),\r\n preferences.create()\r\n ),\r\n createElement('div', 'setting-item',\r\n createElement('span', 'setting-label', r('contactEmailColon', 'Email Address:')),\r\n contactEmail\r\n ),\r\n createElement('div', 'setting-item',\r\n createElement('span', 'setting-label', r('contactMobileColon', 'Mobile:')),\r\n contactMobile\r\n ),\r\n createElement('div', 'setting-item',\r\n createElement('span', 'setting-label', r('contactOptColon', 'Opt Out:')),\r\n checkOpt\r\n ),\r\n createElement('div', 'setting-item',\r\n createElement('span', 'setting-label', r('contactNotesColon', 'Notes:')),\r\n contactNotes\r\n )\r\n ),\r\n buttons\r\n })\r\n if (c != null) {\r\n contactName.value = c.Name;\r\n preferences.select(String(c.ContactPreference));\r\n contactEmail.value = c.Email;\r\n contactMobile.value = c.MobilePhone;\r\n checkOpt.querySelector('input').checked = c.OptOut;\r\n contactNotes.value = c.Notes;\r\n } else {\r\n preferences.select('0');\r\n }\r\n this.#refs = {\r\n contactName,\r\n preferences,\r\n contactEmail,\r\n contactMobile,\r\n checkOpt,\r\n contactNotes\r\n };\r\n const result = await popup.show(parent);\r\n setTimeout(() => contactName.focus());\r\n return result;\r\n }\r\n\r\n prepare() {\r\n const name = this.#refs.contactName.value;\r\n const pref = this.#refs.preferences.selected.value;\r\n const email = this.#refs.contactEmail.value;\r\n const phone = this.#refs.contactMobile.value;\r\n const opt = this.#refs.checkOpt.querySelector('input').checked;\r\n const notes = this.#refs.contactNotes.value;\r\n const title = this.#option.contact == null ? r('addContact', 'Add Contact') : r('editContact', 'Edit Contact');\r\n if (nullOrEmpty(name)) {\r\n showAlert(title, r('contactNameRequired', 'Contact Name cannot be empty.'), 'warn')\r\n .then(() => this.#refs.contactName.focus());\r\n return null;\r\n }\r\n if (nullOrEmpty(email) && nullOrEmpty(phone)) {\r\n showAlert(title, r('contactEmailPhoneRequired', 'Email and Mobile Phone cannot both be empty.'), 'warn')\r\n .then(() => nullOrEmpty(email) ?\r\n this.#refs.contactEmail.focus() :\r\n this.#refs.contactMobile.focus());\r\n return null;\r\n }\r\n if (!nullOrEmpty(email) && !isEmail(email)) {\r\n showAlert(title, r('contactEmailInvalid', 'The email address is invalid.'), 'warn')\r\n .then(() => this.#refs.contactEmail.focus());\r\n return null;\r\n }\r\n\r\n let contact = this.#option.contact;\r\n if (contact == null) {\r\n contact = {};\r\n } else if (contact.OptOut !== opt) {\r\n if (opt !== false || contact.OptOut_BC === false) {\r\n contact.selected = !opt;\r\n }\r\n }\r\n contact.Name = name;\r\n contact.ContactPreference = pref;\r\n contact.Email = email;\r\n contact.MobilePhone = phone;\r\n contact.OptOut = opt;\r\n contact.Notes = notes;\r\n return contact;\r\n }\r\n}\r\n\r\nclass CustomerRecordContact {\r\n #option;\r\n #grid;\r\n\r\n constructor(option = {}) {\r\n this.#option = option;\r\n }\r\n\r\n async show(title, parent = document.body) {\r\n // const tabIndex = Math.max.apply(null, [...document.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0)) + 3;\r\n\r\n const gridContainer = createElement('div', 'selcontact-grid');\r\n const popup = new Popup({\r\n onMasking: this.#option.onMasking,\r\n title,\r\n content: createElement('div', 'selcontact-wrapper',\r\n gridContainer\r\n ),\r\n buttons: [\r\n {\r\n text: r('ok', 'OK'),\r\n key: 'ok',\r\n trigger: () => {\r\n if (typeof this.#option.onOk === 'function') {\r\n return this.#option.onOk.call(this, this.#grid.source.filter(f => f.selected));\r\n }\r\n }\r\n },\r\n { text: r('cancel', 'Cancel'), key: 'cancel' }\r\n ]\r\n });\r\n const result = await popup.show(parent);\r\n // grid\r\n const grid = new Grid(gridContainer);\r\n grid.columns = [\r\n {\r\n key: 'selected',\r\n type: Grid.ColumnTypes.Checkbox,\r\n width: 40,\r\n // enabled: item => !nullOrEmpty(item.ID)\r\n },\r\n { key: 'Name', caption: r(\"P_CR_CONTACTNAME\", \"Contact Name\"), width: 100 },\r\n { key: 'Email', caption: r(\"P_CR_CONTACTEMAIL\", \"Contact Email\"), css: { 'width': 180, 'text-align': 'left' } },\r\n { key: 'MobilePhoneDisplayText', caption: r(\"P_CR_CONTACTMOBILE\", \"Contact Mobile\"), width: 130 },\r\n { key: 'ContactPreferenceStr', caption: r(\"P_CR_CONTACTPREFERENCES\", \"Contact Preferences\"), width: 100 },\r\n { key: 'OptOut', caption: r(\"P_CR_OPTOUT\", \"Opt Out\"), type: Grid.ColumnTypes.Checkbox, width: 70, enabled: false, align: 'center' },\r\n { key: 'Notes', caption: r(\"P_CR_NOTES\", \"Notes\"), width: 120 }\r\n ];\r\n grid.init();\r\n grid.source = this.#option.contacts.sort(function (a, b) { return ((b.Text || b.Email) ? 1 : 0) - ((a.Text || a.Email) ? 1 : 0) });\r\n this.#grid = grid;\r\n return result;\r\n }\r\n\r\n set source(contacts) {\r\n this.#option.contacts = contacts;\r\n const grid = this.#grid;\r\n if (grid != null) {\r\n this.#grid.source = contacts;\r\n }\r\n }\r\n}\r\n\r\nexport { Contact, CustomerRecordContact };","import { Grid, createElement, Popup } from \"../../ui\";\r\nimport { nullOrEmpty, r, contains } from \"../../utility\";\r\n\r\nclass Follower {\r\n #option;\r\n #grid;\r\n\r\n constructor(option = {}) {\r\n this.#option = option;\r\n }\r\n\r\n async show(title, parent = document.body) {\r\n const tabIndex = Math.max.apply(null, [...document.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0)) + 3;\r\n\r\n const gridContainer = createElement('div', 'follower-grid');\r\n const popup = new Popup({\r\n onMasking: this.#option.onMasking,\r\n title,\r\n content: createElement('div', 'follower-wrapper',\r\n createElement('div', div => div.innerText = r('whoWantReceiveCustomerNotification', 'Who do you want to receive customer notifications?')),\r\n createElement('input', search => {\r\n search.type = 'text';\r\n search.tabIndex = tabIndex + 3;\r\n search.className = 'ui-input follower-search';\r\n search.addEventListener('input', () => {\r\n const key = search.value;\r\n if (nullOrEmpty(key)) {\r\n this.#grid.source = this.#option.followers.sort(function (a, b) { return ((b.Text || b.Email) ? 1 : 0) - ((a.Text || a.Email) ? 1 : 0) });\r\n } else {\r\n this.#grid.source = this.#option.followers.filter(f => f.Text || f.Email || contains(f.DisplayName, key, true))\r\n .sort(function (a, b) { return ((b.Text || b.Email) ? 1 : 0) - ((a.Text || a.Email) ? 1 : 0) });\r\n }\r\n });\r\n }),\r\n gridContainer\r\n ),\r\n buttons: [\r\n {\r\n text: r('ok', 'OK'),\r\n key: 'ok',\r\n trigger: () => {\r\n if (typeof this.#option.onOk === 'function') {\r\n return this.#option.onOk.call(this, this.#grid.source.filter(f => f.Email || f.Text));\r\n }\r\n }\r\n },\r\n { text: r('cancel', 'Cancel'), key: 'cancel' }\r\n ]\r\n });\r\n const result = await popup.show(parent);\r\n result.querySelector('.follower-search').focus();\r\n // grid\r\n const grid = new Grid(gridContainer);\r\n grid.columns = [\r\n { key: 'DisplayName', caption: r('contactName', 'Contact Name'), width: 240 },\r\n { key: 'ContactTypeName', caption: r('contactType', 'Contact Type'), width: 120 },\r\n {\r\n key: 'Text',\r\n caption: r('text', 'Text'),\r\n type: Grid.ColumnTypes.Checkbox,\r\n width: 60,\r\n enabled: item => !nullOrEmpty(item.Mobile)\r\n },\r\n {\r\n key: 'Email',\r\n caption: r('email', 'Email'),\r\n type: Grid.ColumnTypes.Checkbox,\r\n width: 70,\r\n // enabled: item => !nullOrEmpty(item.ID)\r\n }\r\n ];\r\n grid.init();\r\n grid.source = this.#option.followers.sort(function (a, b) { return ((b.Text || b.Email) ? 1 : 0) - ((a.Text || a.Email) ? 1 : 0) });\r\n this.#grid = grid;\r\n return result;\r\n }\r\n}\r\n\r\nexport default Follower;","import { Grid, createElement, setTooltip, createIcon, createCheckbox, createRadiobox, showAlert, showConfirm, Popup } from \"../../ui\";\r\nimport { r, nullOrEmpty, formatUrl, isEmail, isPhone } from \"../../utility\";\r\nimport { createBox } from \"./lib\";\r\nimport { Contact, CustomerRecordContact } from \"./contact\";\r\nimport Follower from \"./follower\";\r\n\r\nclass NoteCol extends Grid.GridColumn {\r\n static create() {\r\n const wrapper = createElement('div', 'contact-wrapper',\r\n createElement('div', 'contact-name'),\r\n createElement('div', 'contact-note')\r\n );\r\n return wrapper;\r\n }\r\n\r\n static setValue(element, _val, item, _col, grid) {\r\n const name = element.querySelector('.contact-name');\r\n name.innerText = item.Name;\r\n if (name.scrollWidth > name.offsetWidth) {\r\n setTooltip(name, item.Name, false, grid.element);\r\n }\r\n element.querySelector('.contact-note').innerText = item.Notes;\r\n }\r\n}\r\n\r\nclass CustomerCommunication {\r\n #container;\r\n #option;\r\n #contacts;\r\n #followers;\r\n #buttonFollower;\r\n #enter;\r\n #message;\r\n #data = {};\r\n #gridContact;\r\n #gridWo;\r\n\r\n constructor(opt) {\r\n this.#option = opt ?? {};\r\n }\r\n\r\n get #autoUpdates() { return this.#container.querySelector('.check-auto-update>input') }\r\n get autoUpdatesEnabled() { return this.#autoUpdates?.disabled !== true }\r\n set autoUpdatesEnabled(flag) {\r\n const element = this.#autoUpdates;\r\n if (element == null) {\r\n return;\r\n }\r\n if (flag === false) {\r\n element.disabled = true;\r\n element.parentElement?.classList?.add('disabled');\r\n } else {\r\n element.disabled = false;\r\n element.parentElement?.classList?.remove('disabled');\r\n }\r\n }\r\n get autoUpdates() { return this.#autoUpdates?.checked }\r\n set autoUpdates(flag) {\r\n const element = this.#autoUpdates;\r\n if (element == null) {\r\n return;\r\n }\r\n element.checked = flag;\r\n element.dispatchEvent(new Event('change'));\r\n }\r\n\r\n get #statusLink() { return this.#container.querySelector('.check-status-link>input') }\r\n get statusLinkEnabled() { return this.#statusLink?.disabled !== true }\r\n set statusLinkEnabled(flag) {\r\n const element = this.#statusLink;\r\n if (element == null) {\r\n return;\r\n }\r\n if (flag === false) {\r\n element.disabled = true;\r\n element.parentElement?.classList?.add('disabled');\r\n } else {\r\n element.disabled = false;\r\n element.parentElement?.classList?.remove('disabled');\r\n }\r\n }\r\n get statusLink() { return this.#statusLink?.checked }\r\n set statusLink(flag) {\r\n const element = this.#statusLink;\r\n if (element == null) {\r\n return;\r\n }\r\n element.checked = flag;\r\n element.dispatchEvent(new Event('change'));\r\n }\r\n\r\n /**\r\n * @param {boolean} flag\r\n */\r\n set loading(flag) {\r\n if (this.#container == null) {\r\n return;\r\n }\r\n this.#enter.disabled = flag;\r\n this.#container.querySelector('.customer-name>.ui-input').disabled = flag;\r\n this.#container.querySelector('.button-send-message').disabled = flag;\r\n this.#container.querySelector('.button-edit-contacts').disabled = flag;\r\n this.#container.querySelector('.button-edit-followers').disabled = flag;\r\n }\r\n\r\n get text() { return this.#enter?.value }\r\n set text(s) {\r\n const element = this.#enter;\r\n if (element != null) {\r\n element.value = s\r\n s = String(nullOrEmpty(s) ? 0 : val.length) + '/' + String(this.#option.maxLength);\r\n this.#container.querySelector('.message-bar .prompt-count').innerText = s;\r\n }\r\n }\r\n\r\n get customerName() { return this.#container.querySelector('.customer-name>.ui-input')?.value }\r\n set customerName(name) {\r\n const element = this.#container.querySelector('.customer-name>.ui-input');\r\n if (element == null) {\r\n return;\r\n }\r\n element.value = name;\r\n }\r\n\r\n get contacts() {\r\n return [...this.#contacts.children].filter(el => {\r\n return el.querySelector('span').dataset.notsend == \"false\";\r\n }).map(el => {\r\n const span = el.querySelector('span');\r\n return { 'Key': span.dataset.to, 'Value': span.dataset.name };\r\n });\r\n }\r\n set contacts(contacts) {\r\n this.#contacts.replaceChildren();\r\n if (contacts?.length > 0) {\r\n var cs = contacts.sort(function (a, b) {\r\n if (a.Name == b.Name) return 0; return a.Name > b.Name ? 1 : -1;\r\n });\r\n for (let c of cs) {\r\n //if (c.OptOut || c.OptOut_BC || c.selected === false) {\r\n // continue;\r\n //}\r\n const mp = String(c.MobilePhoneDisplayText).trim();\r\n const email = String(c.Email).trim();\r\n const pref = String(c.ContactPreference);\r\n if ((pref !== '1') && !isPhone(mp) ||\r\n pref === '1' && !isEmail(email)) {\r\n continue;\r\n }\r\n const to = pref === '1' ? email : mp;\r\n let icon;\r\n let method;\r\n if (c.OptOut || c.OptOut_BC || c.selected === false) {\r\n icon = 'times';\r\n method = r('optedOut', 'Opted Out:');\r\n }\r\n else {\r\n switch (pref) {\r\n case '0':\r\n icon = 'comment-lines';\r\n method = r('textsToColon', 'Texts to:');\r\n break;\r\n case '2':\r\n icon = 'mobile';\r\n method = r('callsToColon', 'Calls to:');\r\n break;\r\n default:\r\n icon = 'envelope';\r\n method = r('emailsToColon', 'Emails to:');\r\n break;\r\n }\r\n }\r\n const span = createElement('span', span => {\r\n span.dataset.to = to;\r\n span.dataset.name = c.Name;\r\n span.dataset.notsend = c.OptOut || c.OptOut_BC || c.selected === false;\r\n span.innerText = c.Name;\r\n });\r\n const item = createElement('div', 'contact-item',\r\n createIcon('fa-light', icon, { 'fill': (c.OptOut || c.OptOut_BC || c.selected === false) ? 'red' : '' }),\r\n span\r\n );\r\n this.#contacts.appendChild(item);\r\n let tip = `${method} ${to}`;\r\n if (span.scrollWidth > span.offsetWidth) {\r\n tip = r('nameColon', 'Name:') + ` ${c.Name}\\n${tip}`;\r\n }\r\n setTooltip(span, tip);\r\n }\r\n this.#message.scrollTop = this.#message.scrollHeight\r\n }\r\n }\r\n\r\n /**\r\n * @param {boolean} flag\r\n */\r\n set readonly(flag) {\r\n this.#option.readonly = flag;\r\n if (this.#container == null) {\r\n return;\r\n }\r\n const link = this.#container.querySelector('.check-status-link');\r\n if (flag === true) {\r\n link.classList.add('disabled');\r\n } else {\r\n link.classList.remove('disabled');\r\n }\r\n link.querySelector('input').disabled = flag;\r\n const display = flag === true ? 'none' : '';\r\n this.#container.querySelector('.button-edit-contacts').style.display = display;\r\n this.#container.querySelector('.button-edit-followers').style.display = display;\r\n // this.#enter.disabled = flag === true;\r\n this.#container.querySelector('.message-bar').style.display = display;\r\n // this.#container.querySelector('.button-send-message').style.display = display;\r\n }\r\n\r\n /**\r\n * @param {boolean} flag\r\n */\r\n set recordReadonly(flag) {\r\n this.#option.recordReadonly = flag;\r\n if (this.#container == null) {\r\n return;\r\n }\r\n this.#container.querySelector('.button-edit-contacts').style.display = flag === true ? 'none' : '';\r\n this.#container.querySelector('.button-edit-followers').style.display = flag === true ? 'none' : '';\r\n }\r\n\r\n /**\r\n * @param {String} name\r\n */\r\n set companyName(name) {\r\n this.#option.companyName = name;\r\n const div = this.#container.querySelector('.title-company');\r\n if (nullOrEmpty(name)) {\r\n div.style.display = 'none';\r\n } else {\r\n div.innerText = name;\r\n div.style.display = '';\r\n }\r\n }\r\n /**\r\n * @param {String} code\r\n */\r\n set companyCode(code) {\r\n this.#option.companyCode = code;\r\n const div = this.#container.querySelector('.title-company');\r\n if (nullOrEmpty(this.#option.companyName)) {\r\n div.style.display = 'none';\r\n } else {\r\n div.innerText = this.#option.companyName;\r\n if (!nullOrEmpty(code))\r\n div.innerText = this.#option.companyName + \"/\" + code;\r\n div.style.display = '';\r\n }\r\n }\r\n\r\n get followers() {\r\n return [...this.#followers.children].map(el => {\r\n const span = el.querySelector('span');\r\n return { 'Email': span.dataset.email, 'MobilePhone': span.dataset.mp, 'Value': span.dataset.name };\r\n });\r\n }\r\n set followers(followers) {\r\n this.#data.followers = followers;\r\n this.#followers.replaceChildren();\r\n if (followers?.length > 0) {\r\n this.#container.querySelector('.follower-bar').style.display = '';\r\n setTooltip(this.#buttonFollower, r('editFollower', 'Edit Followers'));\r\n this.#container.querySelector('.follower-bar>.bar-list').appendChild(this.#buttonFollower);\r\n for (let f of followers) {\r\n if (f.OptOut) {\r\n continue;\r\n }\r\n const mp = String(f.MobilePhone).trim();\r\n const email = String(f.Email).trim();\r\n const tips = [];\r\n if (f.SendEmail) {\r\n tips.push(r('emailsToColon', 'Emails to:') + ` ${email}`);\r\n }\r\n if (f.SendText) {\r\n tips.push(r('textsToColon', 'Texts to:' + ` ${mp}`));\r\n }\r\n let icon;\r\n if (f.SendText && f.SendEmail) {\r\n icon = 'at';\r\n } else {\r\n icon = f.SendText ? 'comment-lines' : 'envelope';\r\n }\r\n const span = createElement('span', span => {\r\n if (f.SendEmail) {\r\n span.dataset.email = email;\r\n }\r\n if (f.SendText) {\r\n span.dataset.mp = mp;\r\n }\r\n span.dataset.name = f.Name;\r\n span.innerText = f.Name;\r\n });\r\n const item = createElement('div', 'contact-item',\r\n createIcon('fa-light', icon),\r\n span\r\n );\r\n this.#followers.appendChild(item);\r\n if (span.scrollWidth > span.offsetWidth) {\r\n tips.splice(0, 0, r('nameColon', 'Name:') + ` ${c.Name}`);\r\n }\r\n setTooltip(span, tips.join('\\n'));\r\n }\r\n } else {\r\n this.#container.querySelector('.follower-bar').style.display = 'none';\r\n setTooltip(this.#buttonFollower, r('addFollowers', 'Add Followers'));\r\n this.#container.querySelector('.button-edit-contacts').insertAdjacentElement('beforebegin', this.#buttonFollower)\r\n }\r\n this.#message.scrollTop = this.#message.scrollHeight\r\n }\r\n\r\n setData(key, data) {\r\n this.#data[key] = data;\r\n }\r\n\r\n create() {\r\n const option = this.#option;\r\n const readonly = option.readonly;\r\n // functions\r\n const checkAutoUpdate = createCheckbox({\r\n className: 'check-auto-update',\r\n checked: option.autoUpdates,\r\n checkedNode: createIcon('fa-regular', 'redo-alt'),\r\n uncheckedNode: createIcon('fa-regular', 'ban'),\r\n onchange: function () {\r\n setTooltip(checkAutoUpdate, this.checked ?\r\n r('autoUpdateEnabled', 'Auto Updates Enabled') :\r\n r('autoUpdateDisabled', 'Auto Updates Disabled'));\r\n }\r\n });\r\n if (option.autoUpdatesVisible === false) {\r\n checkAutoUpdate.style.display = 'none';\r\n }\r\n const checkLink = createCheckbox({\r\n className: 'check-status-link',\r\n enabled: !readonly,\r\n checked: option.statusLink,\r\n checkedNode: createIcon('fa-regular', 'link'),\r\n uncheckedNode: createIcon('fa-regular', 'unlink'),\r\n onchange: function () {\r\n setTooltip(checkLink, this.checked ?\r\n r('statusLinkIncluded', 'Status Link Included') :\r\n r('statusLinkExcluded', 'Status Link Excluded'));\r\n }\r\n });\r\n if (option.statusLinkVisible === false) {\r\n checkLink.style.display = 'none';\r\n }\r\n const container = createBox(\r\n createElement('div', null,\r\n createElement('div', div => {\r\n div.className = 'title-module';\r\n div.innerText = option.title ?? r('messages', 'Customer Communication');\r\n }),\r\n createElement('div', div => {\r\n div.className = 'title-company';\r\n if (nullOrEmpty(option.companyName)) {\r\n div.style.display = 'none';\r\n } else {\r\n if (nullOrEmpty(option.companyCode)) {\r\n div.innerText = option.companyName;\r\n } else {\r\n div.innerText = option.companyName + \"/\" + option.companyCode;\r\n }\r\n }\r\n })\r\n ),\r\n [\r\n setTooltip(checkAutoUpdate, r('autoUpdateEnabled', 'Auto Updates Enabled')),\r\n setTooltip(checkLink, r('statusLinkExcluded', 'Status Link Excluded'))\r\n ]\r\n );\r\n // contacts\r\n this.#contacts = this.#createContacts(container, option);\r\n // followers\r\n this.#followers = this.#createFollowers(container, option);\r\n // enter box\r\n const enter = createElement('textarea', 'ui-text');\r\n enter.placeholder = r('typeMessage', 'Enter Message Here');\r\n option.maxLength ??= 3000;\r\n enter.maxLength = option.maxLength;\r\n // if (readonly === true) {\r\n // enter.disabled = true;\r\n // }\r\n enter.addEventListener('input', () => {\r\n const val = this.#enter.value;\r\n const s = String(nullOrEmpty(val) ? 0 : val.length) + '/' + String(option.maxLength);\r\n this.#container.querySelector('.message-bar .prompt-count').innerText = s;\r\n });\r\n this.#enter = enter;\r\n container.appendChild(\r\n createElement('div', div => {\r\n div.className = 'message-bar';\r\n if (readonly === true) {\r\n div.style.display = 'none';\r\n }\r\n },\r\n enter,\r\n createElement('div', div => div.style.textAlign = 'right',\r\n createElement('div', div => {\r\n div.className = 'customer-name';\r\n if (option.customerNameVisible !== true) {\r\n div.style.display = 'none';\r\n }\r\n },\r\n createElement('span', span => span.innerText = r('nameColon', 'Name:')),\r\n createElement('input', input => {\r\n input.type = 'text';\r\n input.className = 'ui-input';\r\n })\r\n ),\r\n createElement('div', 'prompt-count'),\r\n createElement('button', button => {\r\n button.className = 'roundbtn button-send-message';\r\n button.style.backgroundColor = 'rgb(19, 150, 204)';\r\n // if (readonly === true) {\r\n // button.style.display = 'none';\r\n // }\r\n button.appendChild(createIcon('fa-solid', 'paper-plane'));\r\n setTooltip(button, r('sendMessage', 'Send Message'));\r\n button.addEventListener('click', () => {\r\n const val = this.#enter.value;\r\n if (nullOrEmpty(val?.trim())) {\r\n showAlert(r('error', 'Error'), r('messageRequired', 'Please input the message.'), 'warn');\r\n return;\r\n }\r\n if (typeof this.#option.onAddMessage === 'function') {\r\n this.#option.onAddMessage(this.#enter.value);\r\n }\r\n })\r\n })\r\n )\r\n )\r\n );\r\n\r\n const message = createElement('div', 'list-bar');\r\n this.#message = message;\r\n container.appendChild(message);\r\n return this.#container = container;\r\n }\r\n\r\n #createContacts(container, option) {\r\n const readonly = option.readonly;\r\n const recordReadonly = option.recordReadonly;\r\n const contacts = createElement('div', 'bar-list-container');\r\n container.append(\r\n createElement('div', 'contact-bar',\r\n createElement('div', 'bar-icon',\r\n createIcon('fa-solid', 'user-circle', {\r\n 'fill': 'lightgray'\r\n })\r\n ),\r\n createElement('div', 'bar-list',\r\n contacts,\r\n createElement('button', button => {\r\n button.className = 'roundbtn button-edit-contacts';\r\n button.style.backgroundColor = 'rgb(1, 199, 172)';\r\n if (readonly === true) {\r\n button.style.display = 'none';\r\n }\r\n button.appendChild(createIcon('fa-solid', 'user-edit'));\r\n setTooltip(button, r('editContacts', 'Edit Contacts'));\r\n button.addEventListener('click', () => {\r\n const pop = new Popup({\r\n onMasking: option.onMasking,\r\n title: createElement('div', div => {\r\n div.style.display = 'flex';\r\n div.style.alignItems = 'center';\r\n div.style.padding = '10px 0 6px 12px';\r\n div.append(\r\n createElement('div', div => {\r\n div.className = 'ui-popup-move';\r\n div.style.flex = '1 1 auto';\r\n },\r\n createElement('div', div => div.innerText = r('editContacts', 'Edit Contacts')),\r\n createElement('div', div => {\r\n div.className = 'title-company';\r\n if (nullOrEmpty(option.companyName)) {\r\n div.style.display = 'none';\r\n } else {\r\n if (nullOrEmpty(option.companyCode)) {\r\n div.innerText = option.companyName;\r\n } else {\r\n div.innerText = option.companyName + \"/\" + option.companyCode;\r\n }\r\n }\r\n })\r\n ),\r\n createElement('button', button => {\r\n button.style.flex = '0 0 auto';\r\n button.style.backgroundColor = 'rgb(1, 199, 172)';\r\n button.style.marginRight = '10px';\r\n button.className = 'roundbtn button-from-customer-record';\r\n if (recordReadonly) {\r\n button.style.display = 'none';\r\n }\r\n button.appendChild(createIcon('fa-solid', 'handshake', {\r\n width: '16px',\r\n height: '16px'\r\n }));\r\n button.addEventListener('click', () => {\r\n const sel = new CustomerRecordContact({\r\n // onMasking: option.onMasking,\r\n contacts: [],\r\n onOk: list => {\r\n if (typeof this.#option.onSelectCRContacts === 'function') {\r\n list?.map(c => {\r\n delete c.selected;\r\n return c;\r\n });\r\n const result = this.#option.onSelectCRContacts(list);\r\n }\r\n const r = this.#data.contacts;\r\n this.#gridContact.source = r.filter(c => c.Id >= 0).map(c => {\r\n if (c.OptOut || c.OptOut_BC) {\r\n return c;\r\n }\r\n if (typeof c.selected === 'undefined') {\r\n c.selected = true;\r\n }\r\n return c;\r\n });\r\n this.#gridWo.source = r.filter(c => c.Id < 0).map(c => {\r\n if (c.OptOut || c.OptOut_BC) {\r\n return c;\r\n }\r\n if (typeof c.selected === 'undefined') {\r\n c.selected = true;\r\n }\r\n return c;\r\n });\r\n }\r\n });\r\n var title = r('selectFromCustomerRecord', 'Select from Customer Record');\r\n sel.show(title, container);\r\n\r\n if (typeof this.#option.onOpenSelectCRContacts === 'function') {\r\n const result = this.#option.onOpenSelectCRContacts();\r\n if (typeof result?.then === 'function') {\r\n return result.then(r => {\r\n r.map(c => {\r\n for (let cc of this.#data.contacts) {\r\n if (c.Id === cc.Id) {\r\n c.selected = true;\r\n break;\r\n }\r\n }\r\n if (typeof c.selected === 'undefined') {\r\n c.selected = false;\r\n }\r\n return c;\r\n });\r\n this.#data.contacts.filter(c => c.Id >= 0).map(c => {\r\n if (c.OptOut || c.OptOut_BC) {\r\n return c;\r\n }\r\n if (typeof c.selected === 'undefined') {\r\n c.selected = true;\r\n }\r\n return c;\r\n });\r\n\r\n sel.source = r;\r\n return r;\r\n });\r\n }\r\n return false;\r\n }\r\n });\r\n setTooltip(button, r('selectFromCustomerRecord', 'Select from Customer Record'))\r\n }),\r\n createElement('button', button => {\r\n button.style.flex = '0 0 auto';\r\n button.style.backgroundColor = 'rgb(1, 199, 172)';\r\n button.style.marginRight = '10px';\r\n button.className = 'roundbtn button-add-contact';\r\n if (recordReadonly) {\r\n button.style.display = 'none';\r\n }\r\n button.appendChild(createIcon('fa-solid', 'user-plus', {\r\n width: '16px',\r\n height: '16px'\r\n }));\r\n button.addEventListener('click', () => {\r\n const add = new Contact({\r\n // onMasking: option.onMasking,\r\n company: !nullOrEmpty(this.#option.companyName),\r\n onSave: item => {\r\n const exists = this.#gridContact.source.some(s => s.Name === item.Name && s.MobilePhone === item.MobilePhone);\r\n if (exists) {\r\n showAlert(r('addContact', 'Add Contact'), r('contactUniqueRequired', 'Contact name and contact mobile must be a unique combination.'), 'warn');\r\n return false;\r\n }\r\n if (typeof option.onSave === 'function') {\r\n const result = option.onSave(item, true);\r\n if (typeof result?.then === 'function') {\r\n return result.then(r => {\r\n this.#gridContact.source = r.filter(c => c.Id >= 0).map(c => {\r\n if (c.OptOut || c.OptOut_BC) {\r\n return c;\r\n }\r\n if (typeof c.selected === 'undefined') {\r\n c.selected = true;\r\n }\r\n return c;\r\n });\r\n this.#gridWo.source = r.filter(c => c.Id < 0).map(c => {\r\n if (c.OptOut || c.OptOut_BC) {\r\n return c;\r\n }\r\n if (typeof c.selected === 'undefined') {\r\n c.selected = true;\r\n }\r\n return c;\r\n });\r\n return r;\r\n });\r\n }\r\n return false;\r\n }\r\n }\r\n });\r\n add.show(container);\r\n });\r\n setTooltip(button, r('addContact', 'Add Contact'))\r\n })\r\n )\r\n }),\r\n content: createElement('div', null,\r\n createElement('div', div => {\r\n if (nullOrEmpty(this.#option.companyName)) {\r\n div.style.display = 'none';\r\n }\r\n div.style.fontWeight = 'bold';\r\n div.innerText = r('contactFromRecord', 'Contacts from Customer Record');\r\n }),\r\n createElement('div', div => {\r\n if (nullOrEmpty(this.#option.companyName)) {\r\n div.style.display = 'none';\r\n }\r\n div.className = 'contacts-record';\r\n div.style.maxHeight = '200px';\r\n div.style.width = '675px';\r\n div.style.overflow = 'auto';\r\n }),\r\n createElement('div', div => {\r\n div.style.fontWeight = 'bold';\r\n div.innerText = r('contactFromWorkOrder', 'Contacts not on Customer Record');\r\n }),\r\n createElement('div', div => {\r\n div.className = 'contacts-wo';\r\n div.style.maxHeight = '200px';\r\n div.style.width = '675px';\r\n div.style.overflow = 'auto';\r\n })\r\n )\r\n });\r\n pop.show(container).then(() => {\r\n const selectedCol = This => {\r\n return {\r\n key: 'selected',\r\n type: Grid.ColumnTypes.Checkbox,\r\n width: 50,\r\n enabled: item => !item.OptOut && !item.OptOut_BC,\r\n onchanged: function () {\r\n if (typeof option.onChanged === 'function') {\r\n option.onChanged([...This.#gridContact.source, ...This.#gridWo.source]);\r\n }\r\n },\r\n tooltip: item => item.selected ? r('optedIn', 'Opted In') : r('optedOut', 'Opted Out')\r\n }\r\n };\r\n const iconCol = {\r\n key: 'type',\r\n type: Grid.ColumnTypes.Icon,\r\n width: 50,\r\n filter: c => {\r\n switch (String(c.ContactPreference)) {\r\n case '0': return 'comment-lines';\r\n case '2': return 'mobile';\r\n default: return 'envelope';\r\n }\r\n },\r\n className: 'icon-contact-type',\r\n iconType: 'fa-light'\r\n };\r\n const nameCol = { key: 'Name', type: NoteCol, width: 160 };\r\n const buttonCol = {\r\n type: Grid.ColumnTypes.Icon,\r\n width: 40,\r\n visible: !recordReadonly,\r\n align: 'center',\r\n iconType: 'fa-light'\r\n };\r\n const createEditCol = (This) => {\r\n return {\r\n key: 'edit',\r\n ...buttonCol,\r\n text: 'edit',\r\n tooltip: r('edit', 'Edit'),\r\n events: {\r\n onclick: function () {\r\n const edit = new Contact({\r\n // onMasking: option.onMasking,\r\n contact: this,\r\n company: !nullOrEmpty(This.#option.companyName),\r\n onSave: (item, _op) => {\r\n const exists =\r\n This.#gridContact.source.some(s => s !== this && s.Name === item.Name && s.MobilePhone === item.MobilePhone) ||\r\n This.#gridWo.source.some(s => s !== this && s.Name === item.Name && s.MobilePhone === item.MobilePhone);\r\n if (exists) {\r\n showAlert(r('editContact', 'Edit Contact'), r('contactUniqueRequired', 'Contact name and contact mobile must be a unique combination.'), 'warn');\r\n return false;\r\n }\r\n if (typeof option.onSave === 'function') {\r\n const result = option.onSave(item);\r\n if (typeof result?.then === 'function') {\r\n return result.then(r => {\r\n This.#gridContact.source = r.filter(c => c.Id >= 0).map(c => {\r\n if (c.OptOut || c.OptOut_BC) {\r\n return c;\r\n }\r\n if (typeof c.selected === 'undefined') {\r\n c.selected = true;\r\n }\r\n return c;\r\n });\r\n This.#gridWo.source = r.filter(c => c.Id < 0).map(c => {\r\n if (c.OptOut || c.OptOut_BC) {\r\n return c;\r\n }\r\n if (typeof c.selected === 'undefined') {\r\n c.selected = true;\r\n }\r\n return c;\r\n });\r\n return r;\r\n });\r\n }\r\n return false;\r\n }\r\n }\r\n });\r\n edit.show(container);\r\n }\r\n }\r\n }\r\n };\r\n // contacts from customer record\r\n const grid = new Grid();\r\n grid.height = 0;\r\n grid.allowHtml = true;\r\n grid.headerVisible = false;\r\n grid.columns = [\r\n selectedCol(this),\r\n iconCol,\r\n nameCol,\r\n { key: 'Email', width: 180 },\r\n { key: 'MobilePhoneDisplayText', width: 130 },\r\n createEditCol(this),\r\n {\r\n key: 'delete',\r\n ...buttonCol,\r\n text: 'times',\r\n tooltip: r('delete', 'Delete'),\r\n events: {\r\n onclick: function () {\r\n showConfirm(\r\n r('remoteContact', 'Remove Contact'),\r\n createElement('div', null,\r\n createElement('div', div => {\r\n div.style.paddingLeft = '16px';\r\n div.innerText = r('removeFrom', 'Remove {name} from').replace('{name}', this.Name);\r\n }),\r\n createElement('div', div => {\r\n div.style.display = 'flex';\r\n div.style.justifyContent = 'center';\r\n div.style.marginTop = '10px';\r\n },\r\n createRadiobox({\r\n name: 'remove-type',\r\n label: r('customerRecord', 'Customer Record'),\r\n checked: true,\r\n className: 'radio-customer-record'\r\n }),\r\n createRadiobox({\r\n name: 'remove-type',\r\n label: r('workOrder', 'Work Order')\r\n })\r\n )\r\n ),\r\n [\r\n { key: 'ok', text: r('ok', 'OK') },\r\n { key: 'cancel', text: r('cancel', 'Cancel') }\r\n ]\r\n ).then(result => {\r\n if (result?.key === 'ok') {\r\n const isRecord = result.popup.container.querySelector('.radio-customer-record>input').checked;\r\n if (typeof option.onDelete === 'function') {\r\n option.onDelete(result.key, this, isRecord);\r\n }\r\n const index = grid.source.indexOf(this);\r\n if (index >= 0) {\r\n const source = grid.source;\r\n source.splice(index, 1);\r\n grid.extraRows = source.filter(c => !nullOrEmpty(c.Notes)).length;\r\n grid.source = source;\r\n }\r\n }\r\n });\r\n }\r\n }\r\n }\r\n ];\r\n grid.init(pop.container.querySelector('.contacts-record'));\r\n const customerRecords = this.#data.contacts.filter(c => c.Id >= 0).map(c => {\r\n if (c.OptOut || c.OptOut_BC) {\r\n return c;\r\n }\r\n if (typeof c.selected === 'undefined') {\r\n c.selected = true;\r\n }\r\n return c;\r\n });\r\n grid.extraRows = customerRecords.filter(c => !nullOrEmpty(c.Notes)).length;\r\n grid.source = customerRecords;\r\n grid.selectedRowChanged = index => {\r\n if (index >= 0 && this.#gridWo.selectedIndexes?.length > 0) {\r\n this.#gridWo.selectedIndexes = [];\r\n }\r\n };\r\n this.#gridContact = grid;\r\n\r\n // contacts from work order only\r\n const gridWo = new Grid();\r\n gridWo.height = 0;\r\n gridWo.allowHtml = true;\r\n gridWo.headerVisible = false;\r\n gridWo.columns = [\r\n selectedCol(this),\r\n iconCol,\r\n nameCol,\r\n { key: 'Email', width: 180 },\r\n { key: 'MobilePhoneDisplayText', width: 130 },\r\n createEditCol(this),\r\n {\r\n key: 'delete',\r\n ...buttonCol,\r\n text: 'times',\r\n tooltip: r('delete', 'Delete'),\r\n events: {\r\n onclick: function () {\r\n showConfirm(r('remoteContact', 'Remove Contact'), r('removeFromWorkorder', 'You are removing {name} from work order.\\n\\nDo you want to Continue?').replace('{name}', this.Name), [\r\n { key: 'continue', text: r('continue', 'Continue') },\r\n { key: 'cancel', text: r('cancel', 'Cancel') }\r\n ]).then(result => {\r\n if (result?.key === 'continue') {\r\n if (typeof option.onDelete === 'function') {\r\n option.onDelete(result.key, this);\r\n }\r\n const index = gridWo.source.indexOf(this);\r\n if (index >= 0) {\r\n const source = gridWo.source;\r\n source.splice(index, 1);\r\n gridWo.extraRows = source.filter(c => !nullOrEmpty(c.Notes)).length;\r\n gridWo.source = source;\r\n }\r\n }\r\n });\r\n }\r\n }\r\n }\r\n ];\r\n gridWo.init(pop.container.querySelector('.contacts-wo'));\r\n const workOrderOnly = this.#data.contacts.filter(c => c.Id < 0).map(c => {\r\n if (c.OptOut || c.OptOut_BC) {\r\n return c;\r\n }\r\n if (typeof c.selected === 'undefined') {\r\n c.selected = true;\r\n }\r\n return c;\r\n });\r\n gridWo.extraRows = workOrderOnly.filter(c => !nullOrEmpty(c.Notes)).length;\r\n gridWo.source = workOrderOnly;\r\n gridWo.selectedRowChanged = index => {\r\n if (index >= 0 && this.#gridContact.selectedIndexes?.length > 0) {\r\n this.#gridContact.selectedIndexes = [];\r\n }\r\n };\r\n this.#gridWo = gridWo;\r\n });\r\n });\r\n })\r\n )\r\n )\r\n );\r\n return contacts;\r\n }\r\n\r\n #createFollowers(container, option) {\r\n const readonly = option.readonly;\r\n const recordReadonly = option.recordReadonly;\r\n const followers = createElement('div', 'bar-list-container');\r\n const buttonEditFollower = createElement('button', button => {\r\n button.className = 'roundbtn button-edit-followers';\r\n button.style.backgroundColor = 'rgb(48, 107, 255)';\r\n if (readonly === true || recordReadonly) {\r\n button.style.display = 'none';\r\n }\r\n button.appendChild(createIcon('fa-solid', 'pen'));\r\n setTooltip(button, r('editFollower', 'Edit Followers'));\r\n button.addEventListener('click', () => {\r\n if (typeof this.#option.onInitFollower === 'function') {\r\n this.#option.onInitFollower(this.#data.followers).then(data => {\r\n if (typeof data === 'string') {\r\n showAlert(r('customerRecord', 'Customer Record'), data, 'warn');\r\n return;\r\n }\r\n const add = new Follower({\r\n onMasking: option.onMasking,\r\n followers: data,\r\n onOk: list => {\r\n if (typeof this.#option.onAddFollower === 'function') {\r\n const result = this.#option.onAddFollower(list);\r\n if (typeof result?.then === 'function') {\r\n return result.then(r => {\r\n // this.followers = r;\r\n return r;\r\n });\r\n }\r\n return false;\r\n }\r\n }\r\n });\r\n var title = this.#data.followers?.length > 0 ? r('editFollowers', 'Edit Followers') : r('addFollowers', 'Add Followers');\r\n add.show(title, container);\r\n });\r\n }\r\n });\r\n });\r\n this.#buttonFollower = buttonEditFollower;\r\n container.append(\r\n createElement('div', div => {\r\n div.className = 'contact-bar follower-bar';\r\n div.style.display = 'none';\r\n },\r\n setTooltip(createElement('div', 'bar-icon',\r\n createIcon('fa-solid', 'user-tag', {\r\n 'fill': '#fff',\r\n 'background-color': 'lightgray',\r\n 'box-sizing': 'border-box',\r\n 'border-radius': '15px',\r\n 'padding': '4px'\r\n })\r\n ), r('copied', 'Copied')),\r\n createElement('div', 'bar-list',\r\n followers,\r\n buttonEditFollower\r\n )\r\n )\r\n );\r\n return followers;\r\n }\r\n\r\n load(data, contacts, followers) {\r\n const children = [];\r\n if (data?.length > 0) {\r\n contacts ??= this.#data.contacts;\r\n followers ??= this.#data.allfollowers;\r\n for (let comm of data) {\r\n const div = createElement('div', 'item-div');\r\n let name;\r\n if (comm.IsReply && contacts?.length > 0) {\r\n const c = isEmail(comm.Sender) ?\r\n contacts.find(c => c.Email === comm.Sender) :\r\n contacts.find(c => c.MobilePhone === comm.Sender);\r\n name = c?.Name;\r\n }\r\n name ??= comm.IsReply && String(comm.FormatSender) !== '' ? comm.FormatSender : comm.Sender;\r\n let sendto = '';\r\n if (!comm.IsReply && comm.OriPhoneNumbers?.length > 0) {\r\n for (let oriph of comm.OriPhoneNumbers) {\r\n let cname;\r\n const email = isEmail(oriph);\r\n if (contacts?.length > 0) {\r\n let c = email ?\r\n contacts.find(c => c.Email === oriph) :\r\n contacts.find(c => c.MobilePhone === oriph);\r\n if (c != null) {\r\n cname = `${email ? c.Email : c.MobilePhoneDisplayText} - ${c.Name}`;\r\n } else if (followers?.length > 0) {\r\n c = email ?\r\n followers.find(f => f.Email === oriph) :\r\n followers.find(f => f.MobilePhone === oriph);\r\n if (c != null) {\r\n cname = `${email ? c.Email : c.MobilePhoneDisplayText} - ${c.Name}`;\r\n }\r\n }\r\n }\r\n sendto += (cname ?? oriph) + '\\n';\r\n }\r\n }\r\n if (sendto !== '') {\r\n sendto = r('sendToColon', 'Send To :') + `\\n${sendto}`;\r\n }\r\n div.appendChild(createElement('div', div => {\r\n div.className = 'item-poster';\r\n div.innerText = name;\r\n if (!comm.IsReply && sendto?.length > 0) {\r\n setTooltip(div, sendto);\r\n }\r\n }));\r\n const content = createElement('div', 'item-content');\r\n content.appendChild(createElement('span', span => {\r\n if (/https?:\\/\\//i.test(comm.Message)) {\r\n span.innerHTML = formatUrl(comm.Message);\r\n } else {\r\n span.innerText = comm.Message;\r\n }\r\n }));\r\n if (comm.IsReply) {\r\n div.classList.add('item-other');\r\n } else {\r\n div.classList.add('item-self');\r\n const [status, statusmsg] = this.#getMessageStatus(comm);\r\n if (status !== -100) {\r\n let statustext;\r\n switch (status) {\r\n case 0:\r\n statustext = r('pending', 'Pending');\r\n content.style.backgroundColor = '#ffc107';\r\n break;\r\n case 1:\r\n statustext = r('sent', 'Sent');\r\n break;\r\n case 9:\r\n statustext = r('failed', 'Failed');\r\n content.style.backgroundColor = '#ffc107';\r\n break;\r\n case 10:\r\n statustext = r('optOut', 'Opt-Out');\r\n content.style.backgroundColor = '#ffc107';\r\n break;\r\n case 412:\r\n statustext = r('landline', 'Landline');\r\n content.style.backgroundColor = '#ffc107';\r\n break;\r\n default:\r\n statustext = r('undelivered', 'Undelivered');\r\n content.style.backgroundColor = '#ffc107';\r\n break;\r\n }\r\n const divstatus = createElement('div', div => {\r\n div.className = 'item-status';\r\n div.innerText = statustext;\r\n if (status == -10) {\r\n setTooltip(div, statusmsg);\r\n }\r\n });\r\n content.appendChild(divstatus);\r\n }\r\n }\r\n div.append(\r\n content,\r\n createElement('div', div => {\r\n div.className = 'item-time';\r\n div.innerText = comm.TimeStr;\r\n })\r\n );\r\n children.push(div);\r\n }\r\n children[0].style.marginTop = '0';\r\n }\r\n this.#message.replaceChildren(...children);\r\n this.#message.scrollTop = this.#message.scrollHeight\r\n // setTimeout(() => this.#message.scrollTop = this.#message.scrollHeight, 0);\r\n }\r\n\r\n #getMessageStatus(comm) {\r\n let status = -100; // 没有状态,页面上不显示\r\n const ls = [];\r\n let statusmsg = '';\r\n if (!comm.StatusIncorrect && comm.Participator?.length > 0) {\r\n for (let p of comm.Participator) {\r\n if (!isEmail(p.CustomerNumber)) {\r\n if (ls.indexOf(p.Status) < 0) {\r\n ls.push(p.Status);\r\n }\r\n if (statusmsg.length > 0) {\r\n statusmsg += '\\n';\r\n }\r\n statusmsg += `${p.CustomerNumber}: `;\r\n const st = ({\r\n 0: r('undelivered', 'Undelivered'),\r\n 1: r('sent', 'Sent'),\r\n 9: r('failed', 'Failed')\r\n })[p.Status];\r\n if (st != null) {\r\n statusmsg += st;\r\n }\r\n }\r\n }\r\n }\r\n if (ls.length === 1) {\r\n status = ls[0];\r\n } else if (ls.length > 1) {\r\n status = -10; // 多种状态\r\n }\r\n return [status, statusmsg];\r\n }\r\n}\r\n\r\nexport default CustomerCommunication;","import { createElement, setTooltip, createIcon } from \"../../ui\";\r\nimport { r, nullOrEmpty, escapeHtml } from \"../../utility\";\r\nimport { createBox } from \"./lib\";\r\n\r\nclass InternalComment {\r\n #container;\r\n #option;\r\n #enter;\r\n #message;\r\n\r\n constructor(opt) {\r\n this.#option = opt ?? {};\r\n }\r\n\r\n get text() { return this.#enter?.value }\r\n set text(s) {\r\n const element = this.#enter;\r\n if (element != null) {\r\n element.value = s\r\n s = String(nullOrEmpty(s) ? 0 : val.length) + '/' + String(this.#option.maxLength);\r\n this.#container.querySelector('.message-bar .prompt-count').innerText = s;\r\n }\r\n }\r\n\r\n /**\r\n * @param {boolean} flag\r\n */\r\n set readonly(flag) {\r\n this.#option.readonly = flag;\r\n if (this.#container == null) {\r\n return;\r\n }\r\n this.#enter.disabled = flag === true;\r\n this.#container.querySelector('.button-send-message').style.display = flag === true ? 'none' : '';\r\n this.#container.querySelector('.button-post-note').style.display = flag === true ? 'none' : '';\r\n }\r\n\r\n create() {\r\n const container = createBox(\r\n createElement('div', null,\r\n createElement('div', div => {\r\n div.className = 'title-module';\r\n div.innerText = r('internalComments', 'Internal Comments');\r\n })\r\n ), []\r\n );\r\n const readonly = this.#option.readonly;\r\n // enter box\r\n const enter = createElement('textarea', 'ui-text');\r\n enter.placeholder = r('typeComment', 'Enter Comment Here');\r\n enter.maxLength = this.#option.maxLength ??= 3000;\r\n enter.addEventListener('input', () => {\r\n const val = this.#enter.value;\r\n const s = String(nullOrEmpty(val) ? 0 : val.length) + '/' + String(this.#option.maxLength);\r\n this.#container.querySelector('.message-bar .prompt-count').innerText = s;\r\n });\r\n if (readonly === true) {\r\n enter.disabled = true;\r\n }\r\n this.#enter = enter;\r\n container.appendChild(\r\n createElement('div', 'message-bar',\r\n enter,\r\n createElement('div', div => div.style.textAlign = 'right',\r\n createElement('div', 'prompt-count'),\r\n createElement('button', button => {\r\n button.className = 'roundbtn button-send-message';\r\n button.style.backgroundColor = 'rgb(19, 150, 204)';\r\n if (readonly === true || this.#option.noMessage === true) {\r\n button.style.display = 'none';\r\n }\r\n button.appendChild(createIcon('fa-solid', 'paper-plane'));\r\n setTooltip(button, r('sendMessage', 'Send Message'));\r\n button.addEventListener('click', () => {\r\n if (typeof this.#option.onAddMessage === 'function') {\r\n this.#option.onAddMessage(this.#enter.value);\r\n }\r\n })\r\n }),\r\n createElement('button', button => {\r\n button.className = 'roundbtn button-post-note';\r\n button.style.border = '1px solid rgb(19, 150, 204)';\r\n button.style.fill = 'rgb(19, 150, 204)';\r\n if (readonly === true) {\r\n button.style.display = 'none';\r\n }\r\n button.appendChild(createIcon('fa-solid', 'comment-alt-lines'));\r\n setTooltip(button, r('postNote', 'Post Note'));\r\n button.addEventListener('click', () => {\r\n if (typeof this.#option.onAddComment === 'function') {\r\n this.#option.onAddComment(this.#enter.value);\r\n }\r\n })\r\n })\r\n )\r\n )\r\n );\r\n\r\n const message = createElement('div', 'list-bar');\r\n this.#message = message;\r\n container.appendChild(message);\r\n return this.#container = container;\r\n }\r\n\r\n load(data) {\r\n const children = [];\r\n if (data?.length > 0) {\r\n for (let comment of data) {\r\n const div = createElement('div', 'item-div');\r\n // if (sendto !== '') {\r\n // sendto = r('sendToColon', 'Send To :') + `\\n${sendto}`;\r\n // }\r\n div.appendChild(createElement('div', div => {\r\n div.className = 'item-poster';\r\n div.innerText = comment.UserName;\r\n }));\r\n const content = createElement('div', 'item-content');\r\n content.appendChild(createElement('span', span => span.innerHTML = escapeHtml(comment.Comment)));\r\n if (comment.FollowUp?.length > 0) {\r\n div.classList.add('item-sent');\r\n const sendto = r('sendToColon', 'Send To :') + '\\r\\n' + comment.FollowUp.split(';').join('\\r\\n');\r\n content.appendChild(createElement('div', div => {\r\n div.className = 'item-status';\r\n div.innerText = r('sent', 'Sent');\r\n setTooltip(div, sendto);\r\n }));\r\n }\r\n div.append(\r\n content,\r\n createElement('div', div => {\r\n div.className = 'item-time';\r\n div.innerText = comment.SubmitDateStr;\r\n })\r\n );\r\n children.push(div);\r\n }\r\n children[0].style.marginTop = '0';\r\n }\r\n this.#message.replaceChildren(...children);\r\n this.#message.scrollTop = this.#message.scrollHeight\r\n // setTimeout(() => this.#message.scrollTop = this.#message.scrollHeight, 0);\r\n }\r\n}\r\n\r\nexport default InternalComment;"],"names":["createElement","createBox","title","functions","container","header","Grid","isEmail","Contact","option","__privateAdd","_option","_refs","__privateSet","parent","tabIndex","e","c","__privateGet","contactName","input","preferences","Dropdown","r","contactEmail","contactMobile","checkOpt","createCheckbox","contactNotes","txt","buttons","item","popup","Popup","wrapper","result","name","pref","email","phone","opt","notes","nullOrEmpty","showAlert","contact","CustomerRecordContact","_grid","gridContainer","f","grid","a","b","contacts","Follower","div","search","key","contains","NoteCol","element","_val","_col","setTooltip","CustomerCommunication","_autoUpdates","_statusLink","_createContacts","_createFollowers","_getMessageStatus","_container","_contacts","_followers","_buttonFollower","_enter","_message","_data","_gridContact","_gridWo","_a","autoUpdates_get","flag","_b","_d","_c","statusLink_get","s","el","span","cs","mp","isPhone","to","icon","method","createIcon","tip","link","display","code","followers","tips","data","readonly","checkAutoUpdate","checkLink","__privateMethod","createContacts_fn","createFollowers_fn","enter","val","button","message","children","comm","sendto","oriph","cname","content","formatUrl","status","statusmsg","getMessageStatus_fn","statustext","divstatus","recordReadonly","pop","sel","list","cc","selectedCol","This","iconCol","nameCol","buttonCol","createEditCol","_op","showConfirm","createRadiobox","isRecord","index","source","customerRecords","gridWo","workOrderOnly","buttonEditFollower","add","ls","p","st","InternalComment","comment","escapeHtml"],"mappings":"ssBAAAA,EAAA,OAAA,QAAA,EAAA,cAEA,SAASC,GAAUC,GAAOC,EAAW,CACjC,MAAMC,EAAYJ,EAAc,MAAO,MAAM,EACvCK,EAASL,EAAc,MAAO,YAChCE,GACAF,EAAc,MAAO,kBAAmB,GAAGG,CAAS,CAC5D,EACI,OAAAC,EAAU,YAAYC,CAAM,EACrBD,CACX,CCVA,MAAAE,GAAA,OAAA,QAAA,EAAA,8JACAC,GAAA,OAAA,aAAA,EAAA,uEAEA,MAAMC,EAAQ,CAIV,YAAYC,EAAS,GAAI,CAHzBC,EAAA,KAAAC,EAAA,QACAD,EAAA,KAAAE,EAAA,QAGIC,EAAA,KAAKF,EAAUF,EAClB,CAED,MAAM,KAAKK,EAAS,SAAS,KAAM,CAC/B,MAAMC,EAAW,KAAK,IAAI,MAAM,KAAM,CAAC,GAAG,SAAS,iBAAiB,YAAY,CAAC,EAAE,IAAIC,GAAKA,EAAE,UAAY,CAAC,CAAC,EAAI,EAE1GC,EAAIC,EAAA,KAAKP,GAAQ,QACjBQ,EAAcnB,EAAc,QAASoB,GAAS,CAChDA,EAAM,KAAO,OACbA,EAAM,UAAY,WAClBA,EAAM,SAAWL,EAAW,EAC5BK,EAAM,UAAY,IAClBA,EAAM,aAAe,KACjC,CAAS,EACKC,EAAc,IAAIC,GAAS,CAAE,SAAUP,EAAW,CAAC,CAAE,EAC3DM,EA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