260710_0
This commit is contained in:
@@ -2,6 +2,7 @@ import { ui_locales, currentLanguageIndex } from "@ui/ui_template_locale";
|
||||
import {
|
||||
createButton,
|
||||
createInputField,
|
||||
createSelectField,
|
||||
showToast,
|
||||
showLoadingOverlay,
|
||||
hideLoadingOverlay,
|
||||
@@ -181,27 +182,17 @@ export function openEditUserModal(user: DashboardUser, target: Member | Dashboar
|
||||
}
|
||||
|
||||
export function openChangeRoleModal(target: Member | DashboardUser): void {
|
||||
const select = document.createElement("select");
|
||||
select.className = "ui-input-field__input";
|
||||
|
||||
const roles = ["USER", "ADMIN"];
|
||||
roles.forEach((r) => {
|
||||
const opt = document.createElement("option");
|
||||
opt.value = r;
|
||||
opt.textContent = r;
|
||||
opt.selected = target.role === r;
|
||||
select.append(opt);
|
||||
const roleField = createSelectField({
|
||||
label: L("B01_Dashboard_Table_Role"),
|
||||
options: [
|
||||
{ value: "USER", text: "USER" },
|
||||
{ value: "ADMIN", text: "ADMIN" },
|
||||
],
|
||||
value: target.role,
|
||||
});
|
||||
|
||||
const wrap = document.createElement("div");
|
||||
wrap.className = "ui-input-field";
|
||||
const label = document.createElement("label");
|
||||
label.className = "ui-input-field__label";
|
||||
label.textContent = L("B01_Dashboard_Table_Role");
|
||||
wrap.append(label, select);
|
||||
|
||||
openModal(L("B01_Dashboard_ChangeRole"), [wrap], async () => {
|
||||
await changeUserRole(target.id, select.value);
|
||||
openModal(L("B01_Dashboard_ChangeRole"), [roleField.root], async () => {
|
||||
await changeUserRole(target.id, roleField.select.value);
|
||||
showToast(L("B01_Dashboard_Saved"), "success");
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user