mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-22 17:10:10 +00:00
referrals: show data on enable referral for user modal
profiles and invites are properly shown.
This commit is contained in:
parent
9c2f27bcdb
commit
c2f835c897
@ -924,7 +924,6 @@ export class accountsList {
|
|||||||
|
|
||||||
// const words = query.split(" ");
|
// const words = query.split(" ");
|
||||||
let words: string[] = [];
|
let words: string[] = [];
|
||||||
// FIXME: SPLIT BY SPACE, UNLESS IN QUOTES
|
|
||||||
|
|
||||||
let quoteSymbol = ``;
|
let quoteSymbol = ``;
|
||||||
let queryStart = -1;
|
let queryStart = -1;
|
||||||
@ -990,7 +989,6 @@ export class accountsList {
|
|||||||
boolState = false;
|
boolState = false;
|
||||||
}
|
}
|
||||||
if (isBool) {
|
if (isBool) {
|
||||||
// FIXME: Generate filter card for each filter class
|
|
||||||
const filterCard = document.createElement("span");
|
const filterCard = document.createElement("span");
|
||||||
filterCard.ariaLabel = window.lang.strings("clickToRemoveFilter");
|
filterCard.ariaLabel = window.lang.strings("clickToRemoveFilter");
|
||||||
filterCard.classList.add("button", "~" + (boolState ? "positive" : "critical"), "@high", "center", "mx-2", "h-full");
|
filterCard.classList.add("button", "~" + (boolState ? "positive" : "critical"), "@high", "center", "mx-2", "h-full");
|
||||||
@ -1678,21 +1676,42 @@ export class accountsList {
|
|||||||
const modalHeader = document.getElementById("header-enable-referrals-user");
|
const modalHeader = document.getElementById("header-enable-referrals-user");
|
||||||
modalHeader.textContent = window.lang.quantity("enableReferralsFor", this._collectUsers().length)
|
modalHeader.textContent = window.lang.quantity("enableReferralsFor", this._collectUsers().length)
|
||||||
let list = this._collectUsers();
|
let list = this._collectUsers();
|
||||||
// FIXME: Collect Profiles, Invite
|
|
||||||
(() => {
|
(() => {
|
||||||
let innerHTML = "";
|
_get("/invites", null, (req: XMLHttpRequest) => {
|
||||||
for (const profile of window.availableProfiles) {
|
if (req.readyState != 4 || req.status != 200) return;
|
||||||
innerHTML += `<option value="${profile}">${profile}</option>`;
|
|
||||||
}
|
// 1. Invites
|
||||||
this._referralsProfileSelect.innerHTML = innerHTML;
|
|
||||||
|
let innerHTML = "";
|
||||||
|
let invites = req.response["invites"] as Array<Invite>;
|
||||||
|
window.availableProfiles = req.response["profiles"];
|
||||||
|
if (invites) {
|
||||||
|
for (let inv of invites) {
|
||||||
|
let name = inv.code;
|
||||||
|
if (inv.label) {
|
||||||
|
name = `${inv.label} (${inv.code})`;
|
||||||
|
}
|
||||||
|
innerHTML += `<option value="${inv.code}">${name}</option>`;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this._enableReferralsInvite.checked = false;
|
||||||
|
this._enableReferralsProfile.checked = true;
|
||||||
|
innerHTML += `<option>${window.lang.strings("inviteNoInvites")}</option>`;
|
||||||
|
}
|
||||||
|
this._referralsInviteSelect.innerHTML = innerHTML;
|
||||||
|
|
||||||
|
// 2. Profiles
|
||||||
|
|
||||||
|
innerHTML = "";
|
||||||
|
for (const profile of window.availableProfiles) {
|
||||||
|
innerHTML += `<option value="${profile}">${profile}</option>`;
|
||||||
|
}
|
||||||
|
this._referralsProfileSelect.innerHTML = innerHTML;
|
||||||
|
});
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
// FIXME: Collect Profiles, Invite
|
||||||
(() => {
|
(() => {
|
||||||
let innerHTML = "";
|
|
||||||
// for (let id in this._users) {
|
|
||||||
// innerHTML += `<option value="${id}">${this._users[id].name}</option>`;
|
|
||||||
// }
|
|
||||||
this._referralsInviteSelect.innerHTML = innerHTML;
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
const form = document.getElementById("form-enable-referrals-user") as HTMLFormElement;
|
const form = document.getElementById("form-enable-referrals-user") as HTMLFormElement;
|
||||||
@ -1861,9 +1880,9 @@ export class accountsList {
|
|||||||
|
|
||||||
if (window.referralsEnabled) {
|
if (window.referralsEnabled) {
|
||||||
this._enableReferrals.onclick = this.enableReferrals;
|
this._enableReferrals.onclick = this.enableReferrals;
|
||||||
|
const profileSpan = this._enableReferralsProfile.nextElementSibling as HTMLSpanElement;
|
||||||
|
const inviteSpan = this._enableReferralsInvite.nextElementSibling as HTMLSpanElement;
|
||||||
const checkReferralSource = () => {
|
const checkReferralSource = () => {
|
||||||
const profileSpan = this._enableReferralsProfile.nextElementSibling as HTMLSpanElement;
|
|
||||||
const inviteSpan = this._enableReferralsInvite.nextElementSibling as HTMLSpanElement;
|
|
||||||
if (this._enableReferralsProfile.checked) {
|
if (this._enableReferralsProfile.checked) {
|
||||||
this._referralsInviteSelect.parentElement.classList.add("unfocused");
|
this._referralsInviteSelect.parentElement.classList.add("unfocused");
|
||||||
this._referralsProfileSelect.parentElement.classList.remove("unfocused")
|
this._referralsProfileSelect.parentElement.classList.remove("unfocused")
|
||||||
@ -1882,6 +1901,7 @@ export class accountsList {
|
|||||||
};
|
};
|
||||||
this._enableReferralsProfile.onchange = checkReferralSource;
|
this._enableReferralsProfile.onchange = checkReferralSource;
|
||||||
this._enableReferralsInvite.onchange = checkReferralSource;
|
this._enableReferralsInvite.onchange = checkReferralSource;
|
||||||
|
checkReferralSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
this._deleteUser.onclick = this.deleteUsers;
|
this._deleteUser.onclick = this.deleteUsers;
|
||||||
|
Loading…
Reference in New Issue
Block a user