add follower

This commit is contained in:
2023-04-12 09:29:41 +08:00
parent cc3d11f617
commit 9754bd8fbe
6 changed files with 139 additions and 30 deletions

View File

@ -114,6 +114,8 @@ class Contact {
contactMobile.value = c.MobilePhone;
checkOpt.querySelector('input').checked = c.OptOut;
contactNotes.value = c.Notes;
} else {
preferences.select('0');
}
this.#refs = {
contactName,

View File

@ -10,6 +10,7 @@ import { createBox } from "./lib";
import { createPopup, showAlert, showConfirm } from "../../ui/popup";
import Grid from "../../ui/grid";
import Contact from "./contact";
import Follower from "./follower";
class NoteCol extends Grid.GridColumn {
static create() {
@ -605,7 +606,19 @@ class CustomerCommunication {
}
});
add.show(container);
*/
*/
if (typeof this.#option.onInitFollower === 'function') {
this.#option.onInitFollower().then(data => {
if (typeof data === 'string') {
showAlert(r('customerRecord', 'Customer Record'), data, 'warn');
return;
}
const add = new Follower({
followers: data
});
add.show(container);
})
}
});
setTooltip(button, r('addFollower', 'Add Follower'))
})

View File

@ -0,0 +1,57 @@
import { createElement } from "../../functions";
import Grid from "../../ui/grid";
import { createPopup } from "../../ui/popup";
import { nullOrEmpty, r } from "../../utility";
class Follower {
#option;
constructor(option = {}) {
this.#option = option;
}
async show(parent = document.body) {
const gridContainer = createElement('div', 'follower-grid');
const popup = createPopup(
r('addFollowers', 'Add Followers'),
createElement('div', 'follower-wrapper',
createElement('div', div => div.innerText = r('whoWantReceiveCustomerNotification', 'Who do you want to receive customer notifications?')),
createElement('input', search => {
search.className = 'ui-input follower-search';
search.addEventListener('input', () => {
});
}),
gridContainer
),
{ text: r('ok', 'OK'), key: 'ok' },
{ text: r('cancel', 'Cancel'), key: 'cancel' }
);
const result = await popup.show(parent);
// 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: 'Text',
caption: r('text', 'Text'),
type: Grid.ColumnTypes.Checkbox,
width: 60,
enabled: item => !nullOrEmpty(item.Mobile)
},
{
key: 'Email',
caption: r('email', 'Email'),
type: Grid.ColumnTypes.Checkbox,
width: 70,
enabled: item => !nullOrEmpty(item.ID)
}
];
grid.init();
grid.source = this.#option.followers;
return result;
}
}
export default Follower;

View File

@ -315,42 +315,53 @@
}
}
.popup-mask .grid {
height: 100%;
min-height: 120px;
overflow: hidden;
.popup-mask {
.grid {
height: 100%;
min-height: 120px;
overflow: hidden;
>.grid-body .grid-body-content>.grid-row>td {
vertical-align: top;
>.grid-body .grid-body-content>.grid-row>td {
vertical-align: top;
.col-icon {
padding: 10px 4px 10px 8px;
}
.icon-contact-type {
cursor: unset;
>svg {
fill: #333;
.col-icon {
padding: 10px 4px 10px 8px;
}
&:hover>svg {
opacity: unset;
.icon-contact-type {
cursor: unset;
>svg {
fill: #333;
}
&:hover>svg {
opacity: unset;
}
}
.contact-wrapper {
width: 100px;
padding: var(--spacing-cell);
.contact-name {
overflow: hidden;
text-overflow: ellipsis;
}
.contact-note {
color: #999;
}
}
}
}
.contact-wrapper {
width: 100px;
padding: var(--spacing-cell);
.follower-wrapper {
display: flex;
flex-direction: column;
.contact-name {
overflow: hidden;
text-overflow: ellipsis;
}
.contact-note {
color: #999;
}
>.follower-grid {
height: 380px;
}
}
}