Files
SkyArtShop/website/admin/media-library.html

774 lines
22 KiB
HTML
Raw Normal View History

2025-12-14 01:54:40 -06:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Media Library - Sky Art Shop</title>
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css"
/>
<link rel="stylesheet" href="/admin/css/admin-style.css" />
<style>
2025-12-19 20:44:46 -06:00
.media-container {
display: flex;
flex-direction: column;
gap: 20px;
}
.toolbar {
background: #fff;
padding: 15px 20px;
border-radius: 8px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 15px;
}
.toolbar-left {
display: flex;
align-items: center;
gap: 10px;
}
.toolbar-right {
display: flex;
gap: 10px;
}
.breadcrumb {
background: transparent;
padding: 0;
margin: 0;
font-size: 14px;
}
.breadcrumb-item a {
color: #7c3aed;
text-decoration: none;
}
.breadcrumb-item a:hover {
text-decoration: underline;
}
.selected-count {
background: #7c3aed;
color: white;
padding: 6px 16px;
border-radius: 20px;
font-size: 14px;
font-weight: 500;
}
2025-12-14 01:54:40 -06:00
.media-grid {
display: grid;
2025-12-19 20:44:46 -06:00
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
2025-12-14 01:54:40 -06:00
gap: 15px;
padding: 20px;
2025-12-19 20:44:46 -06:00
background: #fff;
border-radius: 8px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
min-height: 400px;
2025-12-14 01:54:40 -06:00
}
2025-12-19 20:44:46 -06:00
2025-12-14 01:54:40 -06:00
.media-item {
position: relative;
2025-12-19 20:44:46 -06:00
border: 2px solid #e5e7eb;
2025-12-14 01:54:40 -06:00
border-radius: 8px;
overflow: hidden;
cursor: pointer;
2025-12-19 20:44:46 -06:00
transition: all 0.2s;
background: #fff;
2025-12-14 01:54:40 -06:00
}
2025-12-19 20:44:46 -06:00
2025-12-14 01:54:40 -06:00
.media-item:hover {
border-color: #7c3aed;
2025-12-19 20:44:46 -06:00
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(124, 58, 237, 0.2);
2025-12-14 01:54:40 -06:00
}
2025-12-19 20:44:46 -06:00
2025-12-14 01:54:40 -06:00
.media-item.selected {
border-color: #7c3aed;
border-width: 3px;
2025-12-19 20:44:46 -06:00
box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
2025-12-14 01:54:40 -06:00
}
2025-12-19 20:44:46 -06:00
.media-checkbox {
position: absolute;
top: 8px;
left: 8px;
z-index: 10;
width: 24px;
height: 24px;
cursor: pointer;
2025-12-14 01:54:40 -06:00
}
2025-12-19 20:44:46 -06:00
.folder-item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 20px;
height: 150px;
background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
2025-12-14 01:54:40 -06:00
}
2025-12-19 20:44:46 -06:00
.folder-item i {
font-size: 48px;
color: #7c3aed;
margin-bottom: 10px;
}
.folder-name {
font-size: 13px;
font-weight: 500;
text-align: center;
word-break: break-word;
color: #374151;
2025-12-14 01:54:40 -06:00
}
2025-12-19 20:44:46 -06:00
.file-item img {
width: 100%;
height: 150px;
object-fit: cover;
2025-12-14 01:54:40 -06:00
display: block;
}
2025-12-19 20:44:46 -06:00
.file-name {
padding: 8px;
background: #f9fafb;
font-size: 11px;
text-align: center;
word-break: break-all;
color: #6b7280;
border-top: 1px solid #e5e7eb;
}
2025-12-14 01:54:40 -06:00
.upload-zone {
2025-12-19 20:44:46 -06:00
border: 3px dashed #d1d5db;
2025-12-14 01:54:40 -06:00
border-radius: 10px;
2025-12-19 20:44:46 -06:00
padding: 40px;
2025-12-14 01:54:40 -06:00
text-align: center;
cursor: pointer;
transition: all 0.3s;
2025-12-19 20:44:46 -06:00
background: #f9fafb;
margin-bottom: 20px;
2025-12-14 01:54:40 -06:00
}
2025-12-19 20:44:46 -06:00
2025-12-14 01:54:40 -06:00
.upload-zone:hover,
.upload-zone.dragover {
border-color: #7c3aed;
background: #f3f0ff;
}
2025-12-19 20:44:46 -06:00
2025-12-14 01:54:40 -06:00
.upload-zone i {
font-size: 48px;
color: #7c3aed;
2025-12-19 20:44:46 -06:00
margin-bottom: 15px;
2025-12-14 01:54:40 -06:00
}
2025-12-19 20:44:46 -06:00
.empty-state {
text-align: center;
padding: 60px 20px;
color: #9ca3af;
}
.empty-state i {
font-size: 64px;
2025-12-14 01:54:40 -06:00
margin-bottom: 20px;
2025-12-19 20:44:46 -06:00
opacity: 0.5;
2025-12-14 01:54:40 -06:00
}
2025-12-19 20:44:46 -06:00
.progress-container {
position: fixed;
bottom: 20px;
right: 20px;
width: 350px;
background: white;
border-radius: 8px;
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
padding: 20px;
z-index: 1000;
}
.modal-content {
border-radius: 12px;
2025-12-14 01:54:40 -06:00
}
</style>
</head>
<body>
<!-- Sidebar -->
<div class="sidebar">
<div class="sidebar-brand">🛍️ Sky Art Shop</div>
<ul class="sidebar-menu">
<li>
<a href="/admin/dashboard.html"
><i class="bi bi-speedometer2"></i> Dashboard</a
>
</li>
<li>
<a href="/admin/homepage.html"
><i class="bi bi-house"></i> Homepage Editor</a
>
</li>
<li>
<a href="/admin/products.html"><i class="bi bi-box"></i> Products</a>
</li>
<li>
<a href="/admin/portfolio.html"
><i class="bi bi-easel"></i> Portfolio</a
>
</li>
<li>
<a href="/admin/blog.html"><i class="bi bi-newspaper"></i> Blog</a>
</li>
<li>
<a href="/admin/pages.html"
><i class="bi bi-file-text"></i> Custom Pages</a
>
</li>
<li>
<a href="/admin/media-library.html" class="active"
><i class="bi bi-images"></i> Media Library</a
>
</li>
<li>
<a href="/admin/menu.html"><i class="bi bi-list"></i> Menu</a>
</li>
<li>
<a href="/admin/settings.html"><i class="bi bi-gear"></i> Settings</a>
</li>
<li>
<a href="/admin/users.html"><i class="bi bi-people"></i> Users</a>
</li>
</ul>
</div>
<!-- Main Content -->
<div class="main-content">
<!-- Top Bar -->
<div class="top-bar">
<div>
<h3>Media Library</h3>
<p class="mb-0 text-muted">Manage your images and media files</p>
</div>
<div>
<button class="btn-logout" onclick="logout()">
<i class="bi bi-box-arrow-right"></i> Logout
</button>
</div>
</div>
<div class="container-fluid">
2025-12-19 20:44:46 -06:00
<!-- Toolbar -->
2025-12-14 01:54:40 -06:00
<div class="toolbar">
2025-12-19 20:44:46 -06:00
<div class="toolbar-left">
<nav aria-label="breadcrumb">
<ol class="breadcrumb" id="breadcrumb">
<li class="breadcrumb-item">
<a href="#" onclick="navigateToFolder(null); return false;"
><i class="bi bi-house-door"></i> Root</a
>
</li>
</ol>
</nav>
2025-12-14 01:54:40 -06:00
<span
class="selected-count"
id="selectedCount"
style="display: none"
>0 selected</span
>
</div>
2025-12-19 20:44:46 -06:00
<div class="toolbar-right">
<button
class="btn btn-sm btn-success"
onclick="showCreateFolderModal()"
>
<i class="bi bi-folder-plus"></i> New Folder
</button>
<button class="btn btn-sm btn-primary" onclick="showUploadZone()">
2025-12-14 01:54:40 -06:00
<i class="bi bi-cloud-upload"></i> Upload Files
</button>
<button
2025-12-19 20:44:46 -06:00
class="btn btn-sm btn-danger"
id="deleteSelectedBtn"
2025-12-14 01:54:40 -06:00
style="display: none"
2025-12-19 20:44:46 -06:00
onclick="handleDeleteSelected()"
2025-12-14 01:54:40 -06:00
>
2025-12-19 20:44:46 -06:00
<i class="bi bi-trash"></i> Delete Selected
2025-12-14 01:54:40 -06:00
</button>
</div>
</div>
2025-12-19 20:44:46 -06:00
<!-- Upload Zone (hidden by default) -->
<div
class="upload-zone"
id="uploadZone"
style="display: none"
ondrop="handleDrop(event)"
ondragover="event.preventDefault(); event.currentTarget.classList.add('dragover');"
ondragleave="event.currentTarget.classList.remove('dragover');"
onclick="document.getElementById('fileInput').click()"
>
<i class="bi bi-cloud-arrow-up d-block"></i>
<h5>Drop files here or click to browse</h5>
<p class="text-muted mb-0">
2025-12-14 01:54:40 -06:00
Supported: JPG, PNG, GIF, WebP (Max 5MB each)
</p>
<input
type="file"
id="fileInput"
multiple
accept="image/*"
style="display: none"
2025-12-19 20:44:46 -06:00
onchange="handleFileSelect(event)"
2025-12-14 01:54:40 -06:00
/>
</div>
2025-12-19 20:44:46 -06:00
<!-- Progress Bar -->
<div
class="progress-container"
id="uploadProgress"
style="display: none"
>
<h6 class="mb-3">Uploading files...</h6>
<div class="progress">
2025-12-14 01:54:40 -06:00
<div
class="progress-bar progress-bar-striped progress-bar-animated"
id="progressBar"
2025-12-19 20:44:46 -06:00
style="width: 0%"
2025-12-14 01:54:40 -06:00
>
0%
</div>
</div>
</div>
2025-12-19 20:44:46 -06:00
<!-- Media Grid -->
<div class="media-grid" id="mediaGrid">
<div class="empty-state">
<i class="bi bi-folder-x d-block"></i>
<h5>No files yet</h5>
<p>Upload files or create folders to get started</p>
</div>
</div>
</div>
</div>
<!-- Create Folder Modal -->
<div class="modal fade" id="createFolderModal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Create New Folder</h5>
<button
type="button"
class="btn-close"
data-bs-dismiss="modal"
></button>
2025-12-14 01:54:40 -06:00
</div>
2025-12-19 20:44:46 -06:00
<div class="modal-body">
<div class="mb-3">
<label class="form-label">Folder Name</label>
<input
type="text"
class="form-control"
id="folderNameInput"
placeholder="Enter folder name"
/>
</div>
2025-12-14 01:54:40 -06:00
</div>
2025-12-19 20:44:46 -06:00
<div class="modal-footer">
2025-12-14 01:54:40 -06:00
<button
2025-12-19 20:44:46 -06:00
type="button"
class="btn btn-secondary"
data-bs-dismiss="modal"
2025-12-14 01:54:40 -06:00
>
2025-12-19 20:44:46 -06:00
Cancel
</button>
<button
type="button"
class="btn btn-primary"
onclick="createFolder()"
>
Create Folder
2025-12-14 01:54:40 -06:00
</button>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script>
2025-12-19 20:44:46 -06:00
let currentFolderId = null;
let allFolders = [];
2025-12-14 01:54:40 -06:00
let allFiles = [];
2025-12-19 20:44:46 -06:00
let selectedItems = new Set(); // Store IDs: 'f-{id}' for folders, 'u-{id}' for files
let folderPath = [];
2025-12-14 01:54:40 -06:00
2025-12-19 20:44:46 -06:00
async function init() {
await Promise.all([loadFolders(), loadFiles()]);
2025-12-14 01:54:40 -06:00
}
2025-12-19 20:44:46 -06:00
async function loadFolders() {
try {
const response = await fetch("/api/admin/folders", {
credentials: "include",
});
const data = await response.json();
if (data.success) {
allFolders = data.folders;
}
} catch (error) {
console.error("Failed to load folders:", error);
}
2025-12-14 01:54:40 -06:00
}
2025-12-19 20:44:46 -06:00
async function loadFiles(folderId = null) {
2025-12-14 01:54:40 -06:00
try {
2025-12-19 20:44:46 -06:00
currentFolderId = folderId;
let url = "/api/admin/uploads";
if (folderId !== null) {
url += `?folder_id=${folderId}`;
} else {
url += "?folder_id=null";
}
const response = await fetch(url, {
2025-12-14 01:54:40 -06:00
credentials: "include",
});
const data = await response.json();
if (data.success) {
allFiles = data.files;
2025-12-19 20:44:46 -06:00
renderMedia();
updateBreadcrumb();
2025-12-14 01:54:40 -06:00
}
} catch (error) {
console.error("Failed to load files:", error);
2025-12-19 20:44:46 -06:00
alert("Failed to load media library");
2025-12-14 01:54:40 -06:00
}
}
2025-12-19 20:44:46 -06:00
function renderMedia() {
2025-12-14 01:54:40 -06:00
const grid = document.getElementById("mediaGrid");
2025-12-19 20:44:46 -06:00
// Get subfolders of current folder
const subfolders = allFolders.filter(
(f) => f.parentId === currentFolderId
);
if (subfolders.length === 0 && allFiles.length === 0) {
grid.innerHTML = `
<div class="empty-state">
<i class="bi bi-folder-x d-block"></i>
<h5>No files yet</h5>
<p>Upload files or create folders to get started</p>
</div>
`;
2025-12-14 01:54:40 -06:00
return;
}
2025-12-19 20:44:46 -06:00
let html = "";
// Render folders first
for (const folder of subfolders) {
const isSelected = selectedItems.has(`f-${folder.id}`);
html += `
<div class="media-item ${
isSelected ? "selected" : ""
}" data-type="folder" data-id="${folder.id}">
<input type="checkbox" class="media-checkbox form-check-input"
${isSelected ? "checked" : ""}
onclick="toggleSelection('f-${folder.id}', event)" />
<div class="folder-item" ondblclick="navigateToFolder(${
folder.id
})">
<i class="bi bi-folder-fill"></i>
<div class="folder-name">${escapeHtml(folder.name)}</div>
<small class="text-muted">${folder.fileCount} files</small>
</div>
</div>
`;
}
// Render files
for (const file of allFiles) {
const isSelected = selectedItems.has(`u-${file.id}`);
html += `
<div class="media-item ${
isSelected ? "selected" : ""
}" data-type="file" data-id="${file.id}">
<input type="checkbox" class="media-checkbox form-check-input"
${isSelected ? "checked" : ""}
onclick="toggleSelection('u-${file.id}', event)" />
<div class="file-item">
<img src="${file.path}" alt="${escapeHtml(file.originalName)}"
onerror="this.src='/assets/images/placeholder.jpg'" />
<div class="file-name" title="${escapeHtml(
file.originalName
)}">${escapeHtml(file.originalName)}</div>
</div>
</div>
`;
2025-12-14 01:54:40 -06:00
}
2025-12-19 20:44:46 -06:00
grid.innerHTML = html;
}
function toggleSelection(itemId, event) {
event.stopPropagation();
if (selectedItems.has(itemId)) {
selectedItems.delete(itemId);
2025-12-14 01:54:40 -06:00
} else {
2025-12-19 20:44:46 -06:00
selectedItems.add(itemId);
2025-12-14 01:54:40 -06:00
}
2025-12-19 20:44:46 -06:00
updateSelectionUI();
2025-12-14 01:54:40 -06:00
}
2025-12-19 20:44:46 -06:00
function updateSelectionUI() {
2025-12-14 01:54:40 -06:00
const countEl = document.getElementById("selectedCount");
const deleteBtn = document.getElementById("deleteSelectedBtn");
2025-12-19 20:44:46 -06:00
if (selectedItems.size > 0) {
countEl.textContent = `${selectedItems.size} selected`;
countEl.style.display = "inline-block";
deleteBtn.style.display = "inline-block";
2025-12-14 01:54:40 -06:00
} else {
countEl.style.display = "none";
deleteBtn.style.display = "none";
}
2025-12-19 20:44:46 -06:00
renderMedia();
2025-12-14 01:54:40 -06:00
}
2025-12-19 20:44:46 -06:00
function navigateToFolder(folderId) {
selectedItems.clear();
updateSelectionUI();
if (folderId === null) {
folderPath = [];
} else {
// Build path
folderPath = [];
let currentId = folderId;
while (currentId !== null) {
const folder = allFolders.find((f) => f.id === currentId);
if (!folder) break;
folderPath.unshift({ id: folder.id, name: folder.name });
currentId = folder.parentId;
}
2025-12-14 01:54:40 -06:00
}
2025-12-19 20:44:46 -06:00
loadFiles(folderId);
}
function updateBreadcrumb() {
const breadcrumb = document.getElementById("breadcrumb");
let html =
'<li class="breadcrumb-item"><a href="#" onclick="navigateToFolder(null); return false;"><i class="bi bi-house-door"></i> Root</a></li>';
for (const folder of folderPath) {
html += `<li class="breadcrumb-item"><a href="#" onclick="navigateToFolder(${
folder.id
}); return false;">${escapeHtml(folder.name)}</a></li>`;
}
breadcrumb.innerHTML = html;
}
function showUploadZone() {
const zone = document.getElementById("uploadZone");
zone.style.display = zone.style.display === "none" ? "block" : "none";
2025-12-14 01:54:40 -06:00
}
2025-12-19 20:44:46 -06:00
async function handleFileSelect(event) {
const files = Array.from(event.target.files);
2025-12-14 01:54:40 -06:00
await uploadFiles(files);
2025-12-19 20:44:46 -06:00
event.target.value = ""; // Reset input
2025-12-14 01:54:40 -06:00
}
2025-12-19 20:44:46 -06:00
async function handleDrop(event) {
event.preventDefault();
event.currentTarget.classList.remove("dragover");
2025-12-14 01:54:40 -06:00
2025-12-19 20:44:46 -06:00
const files = Array.from(event.dataTransfer.files);
2025-12-14 01:54:40 -06:00
await uploadFiles(files);
}
async function uploadFiles(files) {
2025-12-19 20:44:46 -06:00
if (files.length === 0) return;
2025-12-14 01:54:40 -06:00
const formData = new FormData();
files.forEach((file) => formData.append("files", file));
2025-12-19 20:44:46 -06:00
if (currentFolderId !== null) {
formData.append("folder_id", currentFolderId);
}
2025-12-14 01:54:40 -06:00
const progressBar = document.getElementById("progressBar");
const progressContainer = document.getElementById("uploadProgress");
progressContainer.style.display = "block";
try {
const xhr = new XMLHttpRequest();
xhr.upload.addEventListener("progress", (e) => {
if (e.lengthComputable) {
const percentComplete = (e.loaded / e.total) * 100;
progressBar.style.width = percentComplete + "%";
progressBar.textContent = Math.round(percentComplete) + "%";
}
});
xhr.addEventListener("load", function () {
if (xhr.status === 200) {
const data = JSON.parse(xhr.responseText);
if (data.success) {
setTimeout(() => {
progressContainer.style.display = "none";
2025-12-19 20:44:46 -06:00
progressBar.style.width = "0%";
2025-12-14 01:54:40 -06:00
document.getElementById("uploadZone").style.display = "none";
2025-12-19 20:44:46 -06:00
loadFiles(currentFolderId);
2025-12-14 01:54:40 -06:00
}, 500);
2025-12-19 20:44:46 -06:00
} else {
alert("Upload failed: " + data.message);
progressContainer.style.display = "none";
2025-12-14 01:54:40 -06:00
}
2025-12-19 20:44:46 -06:00
} else {
alert("Upload failed");
progressContainer.style.display = "none";
2025-12-14 01:54:40 -06:00
}
});
xhr.open("POST", "/api/admin/upload");
xhr.withCredentials = true;
xhr.send(formData);
} catch (error) {
console.error("Upload failed:", error);
alert("Upload failed: " + error.message);
progressContainer.style.display = "none";
}
}
2025-12-19 20:44:46 -06:00
function showCreateFolderModal() {
const modal = new bootstrap.Modal(
document.getElementById("createFolderModal")
);
document.getElementById("folderNameInput").value = "";
modal.show();
}
2025-12-14 01:54:40 -06:00
2025-12-19 20:44:46 -06:00
async function createFolder() {
const nameInput = document.getElementById("folderNameInput");
const name = nameInput.value.trim();
if (!name) {
alert("Please enter a folder name");
return;
}
2025-12-14 01:54:40 -06:00
try {
2025-12-19 20:44:46 -06:00
const response = await fetch("/api/admin/folders", {
method: "POST",
headers: { "Content-Type": "application/json" },
2025-12-14 01:54:40 -06:00
credentials: "include",
2025-12-19 20:44:46 -06:00
body: JSON.stringify({
name: name,
parent_id: currentFolderId,
}),
2025-12-14 01:54:40 -06:00
});
const data = await response.json();
2025-12-19 20:44:46 -06:00
2025-12-14 01:54:40 -06:00
if (data.success) {
2025-12-19 20:44:46 -06:00
bootstrap.Modal.getInstance(
document.getElementById("createFolderModal")
).hide();
await loadFolders();
loadFiles(currentFolderId);
} else {
alert("Failed to create folder: " + data.error);
2025-12-14 01:54:40 -06:00
}
} catch (error) {
2025-12-19 20:44:46 -06:00
console.error("Failed to create folder:", error);
alert("Failed to create folder");
2025-12-14 01:54:40 -06:00
}
}
async function handleDeleteSelected() {
2025-12-19 20:44:46 -06:00
if (selectedItems.size === 0) return;
2025-12-14 01:54:40 -06:00
2025-12-19 20:44:46 -06:00
const folderIds = Array.from(selectedItems)
.filter((id) => id.startsWith("f-"))
.map((id) => parseInt(id.substring(2)));
2025-12-14 01:54:40 -06:00
2025-12-19 20:44:46 -06:00
const fileIds = Array.from(selectedItems)
.filter((id) => id.startsWith("u-"))
.map((id) => parseInt(id.substring(2)));
2025-12-14 01:54:40 -06:00
2025-12-19 20:44:46 -06:00
const confirmMsg = `Delete ${selectedItems.size} item(s)?`;
if (!confirm(confirmMsg)) return;
2025-12-14 01:54:40 -06:00
2025-12-19 20:44:46 -06:00
try {
// Delete files
if (fileIds.length > 0) {
const response = await fetch("/api/admin/uploads/bulk-delete", {
method: "POST",
headers: { "Content-Type": "application/json" },
credentials: "include",
body: JSON.stringify({ file_ids: fileIds }),
});
const data = await response.json();
if (!data.success) {
alert("Failed to delete some files: " + data.error);
}
}
2025-12-14 01:54:40 -06:00
2025-12-19 20:44:46 -06:00
// Delete folders
for (const folderId of folderIds) {
await fetch(`/api/admin/folders/${folderId}?delete_contents=true`, {
method: "DELETE",
credentials: "include",
});
}
selectedItems.clear();
await loadFolders();
loadFiles(currentFolderId);
} catch (error) {
console.error("Failed to delete items:", error);
alert("Failed to delete items");
2025-12-14 01:54:40 -06:00
}
2025-12-19 20:44:46 -06:00
}
2025-12-14 01:54:40 -06:00
2025-12-19 20:44:46 -06:00
function escapeHtml(text) {
const div = document.createElement("div");
div.textContent = text;
return div.innerHTML;
2025-12-14 01:54:40 -06:00
}
2025-12-19 20:44:46 -06:00
// Initialize after authentication is confirmed
document.addEventListener("DOMContentLoaded", async function () {
// Wait a bit for auth.js to check authentication
setTimeout(init, 100);
});
2025-12-14 01:54:40 -06:00
</script>
<script src="/admin/js/auth.js"></script>
</body>
</html>