This commit is contained in:
2023-08-28 15:04:23 +08:00
parent 29209a3a00
commit 84190ed9f1
14 changed files with 1004 additions and 527 deletions

View File

@ -1,12 +1,18 @@
import { Grid, createElement, Popup } from "../../ui";
import { nullOrEmpty, r, contains } from "../../utility";
import { nullOrEmpty, r as lang, contains } from "../../utility";
class Follower {
let r = lang;
export default class Follower {
#option;
#grid;
constructor(option = {}) {
this.#option = option;
const getText = option?.getText;
if (typeof getText === 'function') {
r = getText;
}
}
async show(title, parent = document.body) {
@ -17,7 +23,7 @@ class Follower {
onMasking: this.#option.onMasking,
title,
content: createElement('div', 'follower-wrapper',
createElement('div', div => div.innerText = r('whoWantReceiveCustomerNotification', 'Who do you want to receive customer notifications?')),
createElement('div', div => div.innerText = r('P_CR_WHODOYOUWANTTORECEIVECUSTOMERNOTIFICATIONS', 'Who do you want to receive customer notifications?')),
createElement('input', search => {
search.type = 'text';
search.tabIndex = tabIndex + 3;
@ -36,7 +42,7 @@ class Follower {
),
buttons: [
{
text: r('ok', 'OK'),
text: r('P_WO_OK', 'OK'),
key: 'ok',
trigger: () => {
if (typeof this.#option.onOk === 'function') {
@ -44,7 +50,7 @@ class Follower {
}
}
},
{ text: r('cancel', 'Cancel'), key: 'cancel' }
{ text: r('P_WO_CANCEL', 'Cancel'), key: 'cancel' }
]
});
const result = await popup.show(parent);
@ -52,18 +58,18 @@ class Follower {
// grid
const grid = new Grid(gridContainer);
grid.columns = [
{ key: 'DisplayName', caption: r('contactName', 'Contact Name'), width: 240 },
{ key: 'ContactTypeName', caption: r('contactType', 'Contact Type'), width: 120 },
{ key: 'DisplayName', caption: r('P_WO_CONTACTNAME', 'Contact Name'), width: 240 },
{ key: 'ContactTypeName', caption: r('P_WO_CONTACTTYPE', 'Contact Type'), width: 120 },
{
key: 'Text',
caption: r('text', 'Text'),
caption: r('P_CR_TEXT', 'Text'),
type: Grid.ColumnTypes.Checkbox,
width: 60,
enabled: item => !nullOrEmpty(item.Mobile)
},
{
key: 'Email',
caption: r('email', 'Email'),
caption: r('P_CR_EMAIL', 'Email'),
type: Grid.ColumnTypes.Checkbox,
width: 70,
// enabled: item => !nullOrEmpty(item.ID)
@ -74,6 +80,4 @@ class Follower {
this.#grid = grid;
return result;
}
}
export default Follower;
}