This commit is contained in:
2023-05-30 09:13:02 +08:00
parent 8dafc1c5f4
commit 98a45a6f19
6 changed files with 289 additions and 39 deletions

View File

@ -9,12 +9,12 @@ class Follower {
this.#option = option;
}
async show(parent = document.body) {
async show(title, parent = document.body) {
const tabIndex = Math.max.apply(null, [...document.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0)) + 3;
const gridContainer = createElement('div', 'follower-grid');
const popup = createPopup(
r('addFollowers', 'Add Followers'),
title,
createElement('div', 'follower-wrapper',
createElement('div', div => div.innerText = r('whoWantReceiveCustomerNotification', 'Who do you want to receive customer notifications?')),
createElement('input', search => {
@ -24,9 +24,10 @@ class Follower {
search.addEventListener('input', () => {
const key = search.value;
if (nullOrEmpty(key)) {
this.#grid.source = this.#option.followers;
this.#grid.source = this.#option.followers.sort(function (a, b) { return ((b.Text || b.Email) ? 1 : 0) - ((a.Text || a.Email) ? 1 : 0) });
} else {
this.#grid.source = this.#option.followers.filter(f => f.Text || f.Email || contains(f.DisplayName, key, true));
this.#grid.source = this.#option.followers.filter(f => f.Text || f.Email || contains(f.DisplayName, key, true))
.sort(function (a, b) { return ((b.Text || b.Email) ? 1 : 0) - ((a.Text || a.Email) ? 1 : 0) });
}
});
}),
@ -66,7 +67,7 @@ class Follower {
}
];
grid.init();
grid.source = this.#option.followers;
grid.source = this.#option.followers.sort(function (a, b) { return ((b.Text || b.Email) ? 1 : 0) - ((a.Text || a.Email) ? 1 : 0) });
this.#grid = grid;
return result;
}