pvistant | Admin - Add New Investor
identity_platform
Identity
Facilities
| Üretim Tesisi |
Tüketim Tesisi |
Kurulu Güç |
Abone / Tarife Grubu |
Actions |
| No facilities added yet. |
Showing 0 of 0 units
manage_accounts
Account Status
warning
Danger Zone
Delete this investor
Permanently remove this investor and all associated data. This action cannot be undone.
| User |
Role |
Status |
Last Active |
Actions |
| No users assigned yet. Save investor first, then add users. |
factory
Add Production Facility
Fill in the details for this facility
Consumption Units
check_circle
Changes saved successfully.
warning
Eksik / Gecersiz Bilgi
(function () {
const nativeSubmit = HTMLFormElement.prototype.submit;
const paginationScrollKey = "pvistant:pagination-scroll";
function lockPostForm(form) {
if (!(form instanceof HTMLFormElement)) return false;
const method = (form.getAttribute("method") || form.method || "get").toLowerCase();
if (method !== "post") return false;
if (form.dataset.submitting === "1") return true;
form.dataset.submitting = "1";
form.querySelectorAll('button[type="submit"], input[type="submit"]').forEach((el) => {
el.disabled = true;
});
return false;
}
function isPaginationUrl(urlText) {
if (!urlText) return false;
try {
const url = new URL(urlText, window.location.href);
if (url.origin !== window.location.origin) return false;
return url.searchParams.has("page") || url.searchParams.has("page_size");
} catch (_) {
return false;
}
}
function savePaginationScrollPosition() {
try {
const payload = {
path: window.location.pathname,
y: window.scrollY || 0,
ts: Date.now(),
};
sessionStorage.setItem(paginationScrollKey, JSON.stringify(payload));
} catch (_) {
// no-op
}
}
function restorePaginationScrollPosition() {
try {
const raw = sessionStorage.getItem(paginationScrollKey);
if (!raw) return;
const payload = JSON.parse(raw);
if (!payload || payload.path !== window.location.pathname) return;
const ageMs = Date.now() - Number(payload.ts || 0);
if (!Number.isFinite(ageMs) || ageMs > 20000) {
sessionStorage.removeItem(paginationScrollKey);
return;
}
if (!window.location.search.includes("page=") && !window.location.search.includes("page_size=")) return;
const y = Number(payload.y || 0);
requestAnimationFrame(() => {
requestAnimationFrame(() => window.scrollTo(0, Math.max(0, y)));
});
sessionStorage.removeItem(paginationScrollKey);
} catch (_) {
// no-op
}
}
HTMLFormElement.prototype.submit = function () {
if (lockPostForm(this)) return;
return nativeSubmit.call(this);
};
document.addEventListener(
"submit",
function (event) {
const form = event.target;
if (!(form instanceof HTMLFormElement)) return;
const method = (form.getAttribute("method") || form.method || "get").toLowerCase();
if (method === "get") {
const hasPaginationField = !!form.querySelector('[name="page"], [name="page_size"]');
if (hasPaginationField) savePaginationScrollPosition();
}
if (lockPostForm(form)) {
event.preventDefault();
}
},
true
);
document.addEventListener(
"click",
function (event) {
const anchor = event.target instanceof Element ? event.target.closest("a[href]") : null;
if (!anchor) return;
if (isPaginationUrl(anchor.href)) savePaginationScrollPosition();
},
true
);
// Re-enable controls when navigating back/forward from bfcache.
window.addEventListener("pageshow", function () {
document.querySelectorAll('form[data-submitting="1"]').forEach((form) => {
form.dataset.submitting = "0";
form.querySelectorAll('button[type="submit"], input[type="submit"]').forEach((el) => {
el.disabled = false;
});
});
restorePaginationScrollPosition();
});
function setupLanguageSwitchers() {
const storageKey = "pvistant:ui-language";
const valid = new Set(["en", "tr"]);
let currentLang = "en";
let activeButton = null;
try {
const stored = (localStorage.getItem(storageKey) || "").toLowerCase();
if (valid.has(stored)) currentLang = stored;
} catch (_) {
// no-op
}
function ensureIcon(button) {
let icon = button.querySelector(".material-symbols-outlined");
if (!icon) {
button.textContent = "";
icon = document.createElement("span");
icon.className = "material-symbols-outlined";
icon.textContent = "language";
button.appendChild(icon);
}
return icon;
}
const menu = document.createElement("div");
menu.id = "global-language-menu";
menu.className = "hidden fixed z-[500] min-w-[160px] rounded-xl border border-surface-container-highest bg-white shadow-xl p-1";
menu.innerHTML = [
'",
'",
].join("");
document.body.appendChild(menu);
function isMenuOpen() {
return !menu.classList.contains("hidden");
}
function closeMenu() {
menu.classList.add("hidden");
activeButton = null;
}
function openMenu(button) {
activeButton = button;
const rect = button.getBoundingClientRect();
menu.style.top = `${Math.round(rect.bottom + 8)}px`;
menu.style.left = `${Math.round(Math.max(8, rect.right - 160))}px`;
menu.classList.remove("hidden");
}
function applyLanguageUi() {
const buttons = document.querySelectorAll('button[aria-label^="Language:"], button[title^="Language:"]');
buttons.forEach((button) => {
ensureIcon(button);
const isEn = currentLang === "en";
button.setAttribute(
"aria-label",
isEn
? "Language menu, English selected"
: "Language menu, Turkish selected"
);
button.setAttribute(
"title",
isEn
? "Language: English selected"
: "Language: Turkish selected"
);
if (!button.hasAttribute("type")) button.setAttribute("type", "button");
});
const enCheck = menu.querySelector('[data-lang-check="en"]');
const trCheck = menu.querySelector('[data-lang-check="tr"]');
if (enCheck && trCheck) {
enCheck.classList.toggle("opacity-100", currentLang === "en");
enCheck.classList.toggle("opacity-0", currentLang !== "en");
trCheck.classList.toggle("opacity-100", currentLang === "tr");
trCheck.classList.toggle("opacity-0", currentLang !== "tr");
}
}
applyLanguageUi();
document.addEventListener("click", function (event) {
const button = event.target instanceof Element
? event.target.closest('button[aria-label^="Language:"], button[title^="Language:"]')
: null;
const option = event.target instanceof Element
? event.target.closest("button[data-lang-option]")
: null;
if (option) {
const selected = (option.getAttribute("data-lang-option") || "").toLowerCase();
if (valid.has(selected)) {
currentLang = selected;
try {
localStorage.setItem(storageKey, currentLang);
} catch (_) {
// no-op
}
applyLanguageUi();
}
closeMenu();
return;
}
if (button) {
if (isMenuOpen() && activeButton === button) {
closeMenu();
} else {
openMenu(button);
}
return;
}
if (isMenuOpen() && event.target instanceof Node && !menu.contains(event.target)) {
closeMenu();
}
});
document.addEventListener("keydown", function (event) {
if (event.key === "Escape" && isMenuOpen()) closeMenu();
});
window.addEventListener("resize", closeMenu);
window.addEventListener("scroll", closeMenu, true);
}
restorePaginationScrollPosition();
setupLanguageSwitchers();
})();