inventory/inventory/templates/base.html
2025-10-16 14:42:33 -05:00

162 lines
No EOL
7.1 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}{{ title if title else "Inventory Manager" }}{% endblock %}</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
{% block styleincludes %}
{% endblock %}
<style>
{% block style %}
{% endblock %}
</style>
</head>
<body class="pb-5">
<header>
<nav class="navbar navbar-expand-sm bg-body-tertiary border border-top-0">
<div class="container-fluid">
<a class="navbar-brand" href="{{ url_for('index.index') }}">
{{ title if title else "Inventory Manager" }}
</a>
<ul class="navbar-nav me-auto">
<li class="nav-item">
<a href="{{ url_for('listing.show_list', model='inventory') }}"
class="nav-link link-success fw-semibold">Inventory</a>
</li>
<li class="nav-item">
<a href="{{ url_for('listing.show_list', model='worklog') }}"
class="nav-link link-success fw-semibold">Work Log</a>
</li>
<li class="nav-item">
<a href="{{ url_for('listing.show_list', model='user') }}"
class="nav-link link-success fw-semibold">Users</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle link-success fw-semibold" data-bs-toggle="dropdown">Reports</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="{{ url_for('reports.summary') }}">Inventory Summary</a></li>
</ul>
</li>
</ul>
{% block header %}
{% endblock %}
<div class="d-flex">
<input type="text" id="searchText" class="form-control me-3">
<button type="button" id="searchButton" class="btn btn-primary" disabled>Search</button>
</div>
<a href="{{ url_for('settings.settings') }}" class="link-success fw-semibold ms-3">
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor"
class="bi bi-gear-fill" viewBox="0 0 16 16">
<path
d="M9.405 1.05c-.413-1.4-2.397-1.4-2.81 0l-.1.34a1.464 1.464 0 0 1-2.105.872l-.31-.17c-1.283-.698-2.686.705-1.987 1.987l.169.311c.446.82.023 1.841-.872 2.105l-.34.1c-1.4.413-1.4 2.397 0 2.81l.34.1a1.464 1.464 0 0 1 .872 2.105l-.17.31c-.698 1.283.705 2.686 1.987 1.987l.311-.169a1.464 1.464 0 0 1 2.105.872l.1.34c.413 1.4 2.397 1.4 2.81 0l.1-.34a1.464 1.464 0 0 1 2.105-.872l.31.17c1.283.698 2.686-.705 1.987-1.987l-.169-.311a1.464 1.464 0 0 1 .872-2.105l.34-.1c1.4-.413 1.4-2.397 0-2.81l-.34-.1a1.464 1.464 0 0 1-.872-2.105l.17-.31c.698-1.283-.705-2.686-1.987-1.987l-.311.169a1.464 1.464 0 0 1-2.105-.872zM8 10.93a2.929 2.929 0 1 1 0-5.86 2.929 2.929 0 0 1 0 5.858z" />
</svg>
</a>
</div>
</nav>
</header>
{% block premain %}
{% endblock %}
<main class="container-fluid mt-3">
{% block main %}
{% endblock %}
</main>
{% block postmain %}
{% endblock %}
<div class="toast-container position-fixed bottom-0 end-0 p-3" id="toastContainer"></div>
<footer class="bg-body-tertiary border border-bottom-0 position-fixed bottom-0 w-100 pb-1">
<small>
<span class="align-middle">&copy; 2025 Conrad Nelson •
<a href="/LICENSE" class="link-underline link-underline-opacity-0">AGPL-3.0-or-later</a>
<a href="https://git.kasear.net/yaro/inventory" class="link-underline link-underline-opacity-0">Source
Code</a>
</span>
{% block footer %}
{% endblock %}
</small>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js"
integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI"
crossorigin="anonymous"></script>
{% block scriptincludes %}
{% endblock %}
<script>
document.addEventListener("DOMContentLoaded", () => {
const searchText = document.getElementById('searchText');
const searchButton = document.getElementById('searchButton');
if (searchText && searchButton) {
searchButton.disabled = (searchText.value === "");
searchText.addEventListener('input', () => {
searchButton.disabled = searchText.value == "";
});
searchText.addEventListener('keypress', (event) => {
if (event.key === "Enter") {
location.href = `{{ url_for('search.search') }}?q=${encodeURIComponent(searchText.value)}`;
}
});
searchButton.addEventListener('click', () => {
location.href = `{{ url_for('search.search') }}?q=${encodeURIComponent(searchText.value)}`;
});
}
window.toastNumber = 0;
window.toastMessage = function (message, type = 'info') {
const container = document.getElementById('toastContainer');
const id = `toast${window.toastNumber++}`;
const template = `
<div class="toast text-bg-${type}" id="${id}" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-body">${message}</div>
</div>
`;
container.insertAdjacentHTML('beforeend', template);
const el = document.getElementById(id);
const toast = new bootstrap.Toast(el, { autohide: true, delay: 4000 });
toast.show();
};
window.queueToast = function (message, type = 'info') {
try {
const key = 'flashToasts';
const list = JSON.parse(sessionStorage.getItem(key) || '[]');
list.push({ message, type });
sessionStorage.setItem(key, JSON.stringify(list));
} catch { }
};
{% block script %}
{% endblock %}
try {
const key = 'flashToasts';
const raw = sessionStorage.getItem(key);
if (!raw) return;
const list = JSON.parse(raw) || [];
sessionStorage.removeItem(key);
for (const t of list) {
window.toastMessage(t.message, t.type || 'info');
}
} catch { }
});
</script>
</body>
</html>