sync from server

This commit is contained in:
2023-05-30 17:34:14 +08:00
parent 98a45a6f19
commit a930a2bf5b
5 changed files with 81 additions and 269 deletions

View File

@ -1,4 +1,4 @@
import { Grid, Dropdown, createElement, createCheckbox, createPopup, showAlert } from "../../ui";
import { Grid, Dropdown, createElement, createCheckbox, Popup, showAlert } from "../../ui";
import { isEmail, nullOrEmpty, r } from "../../utility";
class Contact {
@ -85,9 +85,10 @@ class Contact {
// tabIndex: tabIndex + 9
}
);
const popup = createPopup(
c == null ? r('addContact', 'Add Contact') : r('editContact', 'Edit Contact'),
createElement('div', wrapper => {
const popup = new Popup({
onMasking: this.#option.onMasking,
title: c == null ? r('addContact', 'Add Contact') : r('editContact', 'Edit Contact'),
content: createElement('div', wrapper => {
wrapper.className = 'setting-wrapper';
wrapper.style.width = '500px';
},
@ -116,8 +117,8 @@ class Contact {
contactNotes
)
),
...buttons
)
buttons
})
if (c != null) {
contactName.value = c.Name;
preferences.select(String(c.ContactPreference));
@ -194,25 +195,28 @@ class CustomerRecordContact {
}
async show(title, parent = document.body) {
const tabIndex = Math.max.apply(null, [...document.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0)) + 3;
// const tabIndex = Math.max.apply(null, [...document.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0)) + 3;
const gridContainer = createElement('div', 'selcontact-grid');
const popup = createPopup(
const popup = new Popup({
onMasking: this.#option.onMasking,
title,
createElement('div', 'selcontact-wrapper',
content: createElement('div', 'selcontact-wrapper',
gridContainer
),
{
text: r('ok', 'OK'),
key: 'ok',
trigger: () => {
if (typeof this.#option.onOk === 'function') {
return this.#option.onOk.call(this, this.#grid.source.filter(f => f.selected));
buttons: [
{
text: r('ok', 'OK'),
key: 'ok',
trigger: () => {
if (typeof this.#option.onOk === 'function') {
return this.#option.onOk.call(this, this.#grid.source.filter(f => f.selected));
}
}
}
},
{ text: r('cancel', 'Cancel'), key: 'cancel' }
);
},
{ text: r('cancel', 'Cancel'), key: 'cancel' }
]
});
const result = await popup.show(parent);
// grid
const grid = new Grid(gridContainer);