communication fix

This commit is contained in:
2023-04-13 17:36:42 +08:00
parent d9beb0d3b3
commit d702197a3f
11 changed files with 365 additions and 218 deletions

View File

@ -22,12 +22,26 @@ class InternalComment {
}
}
/**
* @param {boolean} flag
*/
set readonly(flag) {
this.#option.readonly = flag;
if (this.#container == null) {
return;
}
this.#enter.disabled = flag === true;
this.#container.querySelector('.button-send-message').style.display = flag === true ? 'none' : '';
this.#container.querySelector('.button-post-note').style.display = flag === true ? 'none' : '';
}
create() {
const container = createBox(
createElement('div', null,
createElement('div', div => div.innerText = r('internalComments', 'Internal Comments'))
), []
);
const readonly = this.#option.readonly;
// enter box
const enter = createElement('textarea');
enter.placeholder = r('typeComment', 'Enter Comment Here');
@ -37,6 +51,9 @@ class InternalComment {
const s = String(nullOrEmpty(val) ? 0 : val.length) + '/3000';
this.#container.querySelector('.message-bar .prompt-count').innerText = s;
});
if (readonly === true) {
enter.disabled = true;
}
this.#enter = enter;
container.appendChild(
createElement('div', 'message-bar',
@ -46,6 +63,9 @@ class InternalComment {
createElement('button', button => {
button.className = 'roundbtn button-send-message';
button.style.backgroundColor = 'rgb(19, 150, 204)';
if (readonly === true) {
button.style.display = 'none';
}
button.appendChild(createIcon('fa-solid', 'paper-plane'));
setTooltip(button, r('sendMessage', 'Send Message'));
button.addEventListener('click', () => {
@ -58,6 +78,9 @@ class InternalComment {
button.className = 'roundbtn button-post-note';
button.style.border = '1px solid rgb(19, 150, 204)';
button.style.fill = 'rgb(19, 150, 204)';
if (readonly === true) {
button.style.display = 'none';
}
button.appendChild(createIcon('fa-solid', 'comment-alt-lines'));
setTooltip(button, r('postNote', 'Post Note'));
button.addEventListener('click', () => {
@ -89,7 +112,7 @@ class InternalComment {
div.innerText = comment.UserName;
}));
const content = createElement('div', 'item-content');
content.appendChild(createElement('span', span => span.innerText = escapeHtml(comment.Comment)));
content.appendChild(createElement('span', span => span.innerHTML = escapeHtml(comment.Comment)));
if (comment.FollowUp?.length > 0) {
div.classList.add('item-sent');
const sendto = r('sendToColon', 'Send To :') + '\r\n' + comment.FollowUp.split(';').join('\r\n');