Added functionality to all pages

This commit is contained in:
2026-06-07 01:15:30 +02:00
parent 28bf03d1a3
commit e46b4904e3
9 changed files with 561 additions and 137 deletions

View File

@@ -1,4 +1,5 @@
{{ define "base.html" }}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
@@ -8,14 +9,16 @@
<link rel="stylesheet" href="/assets/css/theme.css">
<link rel="stylesheet" href="/assets/css/dashboard.css">
</head>
<body>
<body class="dashboard-layout">
<header>
<div class="nav-container">
<div class="nav-left">
<div class="brand">Miau<span>Inv</span></div>
<button class="menu-trigger" id="menu-btn" aria-label="Menu">Menu</button>
<button class="menu-trigger" id="menu-btn" aria-label="Menu">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg>
</button>
<nav id="main-nav">
<a href="/dashboard">Dashboard</a>
@@ -28,6 +31,8 @@
<div class="profile-dropdown">
<button class="profile-trigger" id="profile-btn">
<div class="avatar">M</div>
<span class="username">Admin</span>
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>
</button>
<div class="dropdown-menu" id="dropdown-menu">
<a href="/profile/settings">Account Settings</a>
@@ -47,34 +52,7 @@
{{ template "content" . }}
</main>
<script>
const profileBtn = document.getElementById('profile-btn');
const dropdownMenu = document.getElementById('dropdown-menu');
const menuBtn = document.getElementById('menu-btn');
const mainNav = document.getElementById('main-nav');
// Profil-Menü Toggle
profileBtn.addEventListener('click', (e) => {
e.stopPropagation();
dropdownMenu.classList.toggle('show');
mainNav.classList.remove('show'); // Mobile Nav schließen
});
// Mobile Nav Toggle
menuBtn.addEventListener('click', (e) => {
console.log("Button wurde geklickt!"); // Wird das im Browser angezeigt?
e.stopPropagation();
e.preventDefault(); // Verhindert Standard-Browser-Aktionen
mainNav.classList.toggle('show');
dropdownMenu.classList.remove('show');
});
// Alles schließen bei Klick in den Body
window.addEventListener('click', () => {
dropdownMenu.classList.remove('show');
mainNav.classList.remove('show');
});
</script>
<script src="/assets/js/api.js"></script>
</body>
</html>
{{ end }}

View File

@@ -1,20 +1,37 @@
{{ define "content" }}
<h1>Dashboard</h1>
<div class="page-header">
<h1>Dashboard Overview</h1>
</div>
<div class="stats-grid">
<div class="stat-card">
<h2>{{ .Stats.Items }}</h2>
<p>Items</p>
<div class="stat-icon" style="background: rgba(59, 130, 246, 0.1); color: var(--accent);">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="12 2 2 7 12 12 22 7 12 2"></polygon><polyline points="2 17 12 22 22 17"></polyline><polyline points="2 12 12 17 22 12"></polyline></svg>
</div>
<div class="stat-info">
<p>Total Items</p>
<h2>{{ .Stats.Items }}</h2>
</div>
</div>
<div class="stat-card">
<h2>{{ .Stats.Projects }}</h2>
<p>Projects</p>
<div class="stat-icon" style="background: rgba(16, 185, 129, 0.1); color: var(--success);">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"></path></svg>
</div>
<div class="stat-info">
<p>Active Projects</p>
<h2>{{ .Stats.Projects }}</h2>
</div>
</div>
<div class="stat-card">
<h2>{{ .Stats.Locations }}</h2>
<p>Locations</p>
<div class="stat-icon" style="background: rgba(245, 158, 11, 0.1); color: #f59e0b;">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"></path><circle cx="12" cy="10" r="3"></circle></svg>
</div>
<div class="stat-info">
<p>Locations</p>
<h2>{{ .Stats.Locations }}</h2>
</div>
</div>
</div>
{{ end }}

View File

@@ -1,24 +1,49 @@
{{ define "content" }}
<h1>Inventory</h1>
<div class="action-bar">
<input
type="search"
name="q"
class="search-input"
placeholder="Search..."
hx-get="/api/item/search"
hx-trigger="keyup changed delay:300ms"
hx-target="#items"
>
<div class="page-header action-bar">
<h1>Inventory</h1>
<button class="btn btn-primary" style="width: auto; padding: 0.6rem 1.2rem; font-size: 0.95rem;" onclick="openItemModal()">
Add Item
</button>
</div>
<div class="table-container">
<div
id="items"
hx-get="/api/item"
hx-trigger="load"
>
<table>
<thead>
<tr>
<th>Name</th>
<th>Category</th>
<th>Total Quantity</th>
<th style="text-align: right;">Actions</th>
</tr>
</thead>
<tbody id="items-table-body">
<tr><td colspan="4" class="table-loader">Loading inventory...</td></tr>
</tbody>
</table>
</div>
<div id="item-modal" class="modal">
<div class="modal-content">
<h2 id="item-modal-title">New Item</h2>
<form id="item-form" onsubmit="saveItem(event)">
<input type="hidden" id="item-id">
<div class="form-group">
<input type="text" id="item-name" placeholder="Item Name" required>
</div>
<div class="form-group">
<input type="text" id="item-category" placeholder="Category" required>
</div>
<div class="form-group">
<input type="text" id="item-desc" placeholder="Description">
</div>
<div class="form-group">
<input type="number" id="item-qty" placeholder="Total Quantity" required>
</div>
<div class="button-group">
<button type="submit" class="btn btn-primary">Save Item</button>
<button type="button" class="btn btn-secondary" onclick="closeModal('item-modal')">Cancel</button>
</div>
</form>
</div>
</div>
{{ end }}

View File

@@ -5,15 +5,23 @@
<th>Category</th>
<th>Total</th>
<th>Free</th>
<th style="text-align: right;">Actions</th>
</tr>
</thead>
<tbody>
{{ range . }}
<tr>
<td style="font-weight: 600;">{{ .Name }}</td>
<td><span style="color: var(--text-muted);">{{ .Category }}</span></td>
<td style="font-family: monospace;">{{ .TotalQuantity }}</td>
<td style="font-family: monospace; color: var(--success);">{{ .FreeQuantity }}</td>
<td>
<span style="background: rgba(255,255,255,0.05); padding: 0.25rem 0.6rem; border-radius: 999px; font-size: 0.8rem; color: var(--text-muted); border: 1px solid var(--border);">
{{ .Category }}
</span>
</td>
<td style="font-family: monospace; font-size: 1.05rem;">{{ .TotalQuantity }}</td>
<td style="font-family: monospace; font-size: 1.05rem; color: var(--success);">{{ .FreeQuantity }}</td>
<td style="text-align: right;">
<button class="btn btn-secondary" style="width: auto; padding: 0.4rem 0.8rem; font-size: 0.85rem;">Edit</button>
</td>
</tr>
{{ end }}
</tbody>

View File

@@ -1,11 +1,38 @@
{{ define "content" }}
<h1>Locations</h1>
<div class="page-header action-bar">
<h1>Locations</h1>
<button class="btn btn-primary" style="width: auto; padding: 0.6rem 1.2rem; font-size: 0.95rem;" onclick="openLocationModal()">
Add Location
</button>
</div>
<div class="table-container">
<div
hx-get="/api/locations"
hx-trigger="load"
>
<table>
<thead>
<tr>
<th>Name</th>
<th style="text-align: right;">Actions</th>
</tr>
</thead>
<tbody id="locations-table-body">
<tr><td colspan="2" class="table-loader">Loading locations...</td></tr>
</tbody>
</table>
</div>
<div id="location-modal" class="modal">
<div class="modal-content">
<h2 id="location-modal-title">New Location</h2>
<form id="location-form" onsubmit="saveLocation(event)">
<input type="hidden" id="location-id">
<div class="form-group">
<input type="text" id="location-name" placeholder="Location Name" required>
</div>
<div class="button-group">
<button type="submit" class="btn btn-primary">Save Location</button>
<button type="button" class="btn btn-secondary" onclick="closeModal('location-modal')">Cancel</button>
</div>
</form>
</div>
</div>
{{ end }}

View File

@@ -1,22 +1,42 @@
{{ define "content" }}
<div class="action-bar">
<div class="page-header action-bar">
<h1>Projects</h1>
<button
class="btn btn-primary"
style="width: auto; padding: 0.6rem 1.2rem; font-size: 0.95rem;"
hx-get="/project/new"
hx-target="#modal"
>
<button class="btn btn-primary" style="width: auto; padding: 0.6rem 1.2rem; font-size: 0.95rem;" onclick="openProjectModal()">
New Project
</button>
</div>
<div
hx-get="/api/project"
hx-trigger="load"
hx-target="this"
>
<div class="table-container">
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th style="text-align: right;">Actions</th>
</tr>
</thead>
<tbody id="projects-table-body">
<tr><td colspan="3" class="table-loader">Loading projects...</td></tr>
</tbody>
</table>
</div>
<div id="modal"></div>
<div id="project-modal" class="modal">
<div class="modal-content">
<h2 id="project-modal-title">New Project</h2>
<form id="project-form" onsubmit="saveProject(event)">
<input type="hidden" id="project-id">
<div class="form-group">
<input type="text" id="project-name" placeholder="Project Name" required>
</div>
<div class="form-group">
<input type="text" id="project-desc" placeholder="Description">
</div>
<div class="button-group">
<button type="submit" class="btn btn-primary">Save Project</button>
<button type="button" class="btn btn-secondary" onclick="closeModal('project-modal')">Cancel</button>
</div>
</form>
</div>
</div>
{{ end }}