This commit is contained in:
2025-12-24 10:55:40 +08:00
parent eec9d6045c
commit 752bb23571
25 changed files with 2348 additions and 816 deletions

View File

@@ -188,10 +188,7 @@ export default class CustomerCommunication {
this._var.contacts.replaceChildren();
if (contacts?.length > 0) {
var cs = contacts.sort(function (a, b) {
if (a.Name == b.Name) {
return 0;
}
return a.Name > b.Name ? 1 : -1;
return String(a.Name).localeCompare(String(b.Name));
});
const messages = this._var.data.messages;
if (this._var.contactsUpdated !== true && messages?.length > 0) {
@@ -308,6 +305,8 @@ export default class CustomerCommunication {
*/
set companyName(name) {
this._var.option.companyName = name;
this._var.container.querySelector('.button-edit-contacts').style.display =
this._var.option.recordReadonly && nullOrEmpty(name) ? 'none' : '';
const div = this._var.container.querySelector('.title-company');
const companyCode = div.querySelector('.title-company-code');
if (companyCode != null) {
@@ -674,7 +673,7 @@ export default class CustomerCommunication {
createElement('button', button => {
button.className = 'roundbtn button-edit-contacts';
button.style.backgroundColor = 'rgb(1, 199, 172)';
if (readonly === true) {
if (readonly === true || (recordReadonly && nullOrEmpty(option.companyName))) {
button.style.display = 'none';
}
button.appendChild(createIcon('fa-solid', 'user-edit'));