structure adjustment
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { Grid, createElement, setTooltip, setTooltipNext, createIcon, createCheckbox, createRadiobox, createPopup, showAlert, showConfirm } from "../../ui";
|
||||
import { Grid, createElement, setTooltip, createIcon, createCheckbox, createRadiobox, createPopup, showAlert, showConfirm } from "../../ui";
|
||||
import { r, nullOrEmpty, formatUrl, isEmail, isPhone } from "../../utility";
|
||||
import { createBox } from "./lib";
|
||||
import Contact from "./contact";
|
||||
@ -90,16 +90,39 @@ class CustomerCommunication {
|
||||
element.dispatchEvent(new Event('change'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {boolean} flag
|
||||
*/
|
||||
set loading(flag) {
|
||||
if (this.#container == null) {
|
||||
return;
|
||||
}
|
||||
this.#enter.disabled = flag;
|
||||
this.#container.querySelector('.customer-name>.ui-input').disabled = flag;
|
||||
this.#container.querySelector('.button-send-message').disabled = flag;
|
||||
this.#container.querySelector('.button-edit-contacts').disabled = flag;
|
||||
this.#container.querySelector('.button-edit-followers').disabled = flag;
|
||||
}
|
||||
|
||||
get text() { return this.#enter?.value }
|
||||
set text(s) {
|
||||
const element = this.#enter;
|
||||
if (element != null) {
|
||||
element.value = s
|
||||
s = String(nullOrEmpty(s) ? 0 : val.length) + '/3000';
|
||||
s = String(nullOrEmpty(s) ? 0 : val.length) + '/' + String(this.#option.maxLength);
|
||||
this.#container.querySelector('.message-bar .prompt-count').innerText = s;
|
||||
}
|
||||
}
|
||||
|
||||
get customerName() { return this.#container.querySelector('.customer-name>.ui-input')?.value }
|
||||
set customerName(name) {
|
||||
const element = this.#container.querySelector('.customer-name>.ui-input');
|
||||
if (element == null) {
|
||||
return;
|
||||
}
|
||||
element.value = name;
|
||||
}
|
||||
|
||||
get contacts() {
|
||||
return [...this.#contacts.children].map(el => {
|
||||
const span = el.querySelector('span');
|
||||
@ -303,7 +326,10 @@ class CustomerCommunication {
|
||||
}
|
||||
const container = createBox(
|
||||
createElement('div', null,
|
||||
createElement('div', div => div.innerText = r('messages', 'Customer Communication')),
|
||||
createElement('div', div => {
|
||||
div.className = 'title-module';
|
||||
div.innerText = option.title ?? r('messages', 'Customer Communication');
|
||||
}),
|
||||
createElement('div', div => {
|
||||
div.className = 'title-company';
|
||||
if (nullOrEmpty(option.companyName)) {
|
||||
@ -323,15 +349,16 @@ class CustomerCommunication {
|
||||
// followers
|
||||
this.#followers = this.#createFollowers(container, option);
|
||||
// enter box
|
||||
const enter = createElement('textarea');
|
||||
const enter = createElement('textarea', 'ui-text');
|
||||
enter.placeholder = r('typeMessage', 'Enter Message Here');
|
||||
enter.maxLength = 3000;
|
||||
option.maxLength ??= 3000;
|
||||
enter.maxLength = option.maxLength;
|
||||
// if (readonly === true) {
|
||||
// enter.disabled = true;
|
||||
// }
|
||||
enter.addEventListener('input', () => {
|
||||
const val = this.#enter.value;
|
||||
const s = String(nullOrEmpty(val) ? 0 : val.length) + '/3000';
|
||||
const s = String(nullOrEmpty(val) ? 0 : val.length) + '/' + String(option.maxLength);
|
||||
this.#container.querySelector('.message-bar .prompt-count').innerText = s;
|
||||
});
|
||||
this.#enter = enter;
|
||||
@ -344,6 +371,15 @@ class CustomerCommunication {
|
||||
},
|
||||
enter,
|
||||
createElement('div', div => div.style.textAlign = 'right',
|
||||
createElement('div', div => {
|
||||
div.className = 'customer-name';
|
||||
if (option.customerNameVisible !== true) {
|
||||
div.style.display = 'none';
|
||||
}
|
||||
},
|
||||
createElement('span', span => span.innerText = r('nameColon', 'Name:')),
|
||||
createElement('input', 'ui-input')
|
||||
),
|
||||
createElement('div', 'prompt-count'),
|
||||
createElement('button', button => {
|
||||
button.className = 'roundbtn button-send-message';
|
||||
@ -992,10 +1028,12 @@ class CustomerCommunication {
|
||||
load(data, contacts, followers) {
|
||||
const children = [];
|
||||
if (data?.length > 0) {
|
||||
contacts ??= this.#data.contacts;
|
||||
followers ??= this.#data.allfollowers;
|
||||
for (let comm of data) {
|
||||
const div = createElement('div', 'item-div');
|
||||
let name;
|
||||
if (comm.IsReply) {
|
||||
if (comm.IsReply && contacts?.length > 0) {
|
||||
const c = isEmail(comm.Sender) ?
|
||||
contacts.find(c => c.Email === comm.Sender) :
|
||||
contacts.find(c => c.MobilePhone === comm.Sender);
|
||||
|
@ -17,7 +17,7 @@ class InternalComment {
|
||||
const element = this.#enter;
|
||||
if (element != null) {
|
||||
element.value = s
|
||||
s = String(nullOrEmpty(s) ? 0 : val.length) + '/3000';
|
||||
s = String(nullOrEmpty(s) ? 0 : val.length) + '/' + String(this.#option.maxLength);
|
||||
this.#container.querySelector('.message-bar .prompt-count').innerText = s;
|
||||
}
|
||||
}
|
||||
@ -38,17 +38,20 @@ class InternalComment {
|
||||
create() {
|
||||
const container = createBox(
|
||||
createElement('div', null,
|
||||
createElement('div', div => div.innerText = r('internalComments', 'Internal Comments'))
|
||||
createElement('div', div => {
|
||||
div.className = 'title-module';
|
||||
div.innerText = r('internalComments', 'Internal Comments');
|
||||
})
|
||||
), []
|
||||
);
|
||||
const readonly = this.#option.readonly;
|
||||
// enter box
|
||||
const enter = createElement('textarea');
|
||||
const enter = createElement('textarea', 'ui-text');
|
||||
enter.placeholder = r('typeComment', 'Enter Comment Here');
|
||||
enter.maxLength = 3000;
|
||||
enter.maxLength = this.#option.maxLength ??= 3000;
|
||||
enter.addEventListener('input', () => {
|
||||
const val = this.#enter.value;
|
||||
const s = String(nullOrEmpty(val) ? 0 : val.length) + '/3000';
|
||||
const s = String(nullOrEmpty(val) ? 0 : val.length) + '/' + String(this.#option.maxLength);
|
||||
this.#container.querySelector('.message-bar .prompt-count').innerText = s;
|
||||
});
|
||||
if (readonly === true) {
|
||||
|
@ -1,5 +1,3 @@
|
||||
@import '../../../css/variables/definition.scss';
|
||||
|
||||
.popup-mask .wrapper-edit-method {
|
||||
width: 100%;
|
||||
|
||||
@ -46,11 +44,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
&.disabled,
|
||||
&:disabled {
|
||||
fill: lightgray;
|
||||
background-color: transparent !important;
|
||||
|
||||
&:hover {
|
||||
&:hover>svg {
|
||||
opacity: unset;
|
||||
}
|
||||
}
|
||||
@ -95,7 +94,7 @@
|
||||
line-height: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 1.2em;
|
||||
font-size: var(--font-larger-size);
|
||||
|
||||
>div {
|
||||
flex: 1 1 auto;
|
||||
@ -186,7 +185,7 @@
|
||||
>span {
|
||||
// flex: 1 1 auto;
|
||||
color: var(--strong-color);
|
||||
font-size: var(--font-larger-size);
|
||||
font-size: var(--font-size);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
@ -216,6 +215,8 @@
|
||||
border: none;
|
||||
height: 70px;
|
||||
resize: none;
|
||||
font-size: var(--font-smaller-size);
|
||||
font-family: var(--font-family);
|
||||
|
||||
&:focus,
|
||||
&:focus-visible {
|
||||
@ -226,9 +227,26 @@
|
||||
>div {
|
||||
padding: 0 10px 10px;
|
||||
|
||||
>.customer-name {
|
||||
float: left;
|
||||
|
||||
>span {
|
||||
font-size: var(--font-smaller-size);
|
||||
}
|
||||
|
||||
>.ui-input {
|
||||
margin-left: 4px;
|
||||
width: 150px;
|
||||
border-top: none;
|
||||
border-left: none;
|
||||
border-right: none;
|
||||
}
|
||||
}
|
||||
|
||||
>.prompt-count {
|
||||
display: inline-block;
|
||||
color: var(--light-color);
|
||||
font-size: var(--font-smaller-size);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -246,7 +264,7 @@
|
||||
white-space: normal;
|
||||
word-break: break-word;
|
||||
overflow: hidden;
|
||||
font-size: .8125rem;
|
||||
font-size: var(--font-size);
|
||||
color: #333;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@ -257,6 +275,7 @@
|
||||
|
||||
.item-poster {
|
||||
font-weight: bold;
|
||||
font-size: var(--font-size);
|
||||
align-self: flex-start;
|
||||
|
||||
.tooltip-wrapper>.tooltip-content {
|
||||
@ -293,7 +312,7 @@
|
||||
margin-top: 3px;
|
||||
font-weight: bold;
|
||||
margin-right: -12px;
|
||||
font-size: 10px;
|
||||
font-size: .625rem;
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
@ -301,7 +320,7 @@
|
||||
.item-time {
|
||||
align-self: flex-end;
|
||||
color: #aaa;
|
||||
font-size: .7rem;
|
||||
font-size: .6875rem;
|
||||
}
|
||||
|
||||
&.item-other {
|
||||
|
Reference in New Issue
Block a user