This commit is contained in:
2026-07-10 16:41:22 +09:00
parent bbda38a013
commit 50d75fcfcd
47 changed files with 6309 additions and 350 deletions
+10 -19
View File
@@ -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");
});
}