Fix: JS Error in articles.php und PHP Warning in public_location behoben
All checks were successful
Docker Build & Push / build-and-push (push) Successful in 37s
All checks were successful
Docker Build & Push / build-and-push (push) Successful in 37s
This commit is contained in:
@@ -196,9 +196,10 @@ $conn->close();
|
||||
|
||||
<div class="filter-controls p-3 border-bottom bg-light">
|
||||
<div class="row g-2 align-items-center">
|
||||
<div class="col-md-4"><input type="text" id="filter-text" class="form-control form-control-sm" placeholder="Suchen..."></div>
|
||||
<div class="col-md-3"><select id="filter-category" class="form-select form-select-sm"><option value="">Alle Kategorien</option><?php foreach($categories_for_filter as $cat) echo '<option value="'.$cat['id'].'">'.htmlspecialchars($cat['name']).'</option>'; ?></select></div>
|
||||
<div class="col-md-3"><select id="filter-manufacturer" class="form-select form-select-sm"><option value="">Alle Hersteller</option><?php foreach($manufacturers_for_filter as $man) echo '<option value="'.$man['id'].'">'.htmlspecialchars($man['name']).'</option>'; ?></select></div>
|
||||
<div class="col-md-3"><input type="text" id="filter-text" class="form-control form-control-sm" placeholder="Suchen..."></div>
|
||||
<div class="col-md-2"><select id="filter-category" class="form-select form-select-sm"><option value="">Alle Kategorien</option><?php foreach($categories_for_filter as $cat) echo '<option value="'.$cat['id'].'">'.htmlspecialchars($cat['name']).'</option>'; ?></select></div>
|
||||
<div class="col-md-2"><select id="filter-manufacturer" class="form-select form-select-sm"><option value="">Alle Hersteller</option><?php foreach($manufacturers_for_filter as $man) echo '<option value="'.$man['id'].'">'.htmlspecialchars($man['name']).'</option>'; ?></select></div>
|
||||
<div class="col-md-3"><select id="filter-location" class="form-select form-select-sm"><option value="">Alle Lagerorte</option><?php echo $location_options_html; ?></select></div>
|
||||
<div class="col-md-2 text-end">
|
||||
<div class="btn-group btn-group-sm me-2" role="group">
|
||||
<button type="button" class="btn btn-outline-secondary active" id="btn-view-list" title="Listenansicht"><i class="fas fa-list"></i></button>
|
||||
@@ -376,6 +377,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
const filterText = document.getElementById('filter-text');
|
||||
const filterCategory = document.getElementById('filter-category');
|
||||
const filterManufacturer = document.getElementById('filter-manufacturer');
|
||||
const filterLocation = document.getElementById('filter-location');
|
||||
|
||||
const collapsedCategories = new Set();
|
||||
let currentView = 'list';
|
||||
|
||||
@@ -41,7 +41,7 @@ if (!empty($parent_name)) {
|
||||
}
|
||||
|
||||
// Lade Artikel in diesem Lagerort (und in Unterorten, falls Ebene 1)
|
||||
$sql_articles = "SELECT a.name, a.weight_grams, a.quantity_owned, a.image_url, a.product_designation, m.name as manufacturer_name, c.name as category_name, c.color as category_color
|
||||
$sql_articles = "SELECT a.id, a.parent_article_id, a.name, a.weight_grams, a.quantity_owned, a.image_url, a.product_designation, m.name as manufacturer_name, c.name as category_name, c.color as category_color
|
||||
FROM articles a
|
||||
LEFT JOIN manufacturers m ON a.manufacturer_id = m.id
|
||||
LEFT JOIN categories c ON a.category_id = c.id
|
||||
@@ -137,33 +137,16 @@ function renderArticleCard($article, $level = 0) {
|
||||
</div>
|
||||
|
||||
<div class="container py-3 pb-5">
|
||||
<?php if (empty($articles)): ?>
|
||||
<?php if (empty($articles_raw)): ?>
|
||||
<div class="text-center text-muted mt-5 pt-5">
|
||||
<i class="fas fa-box-open fa-3x mb-3 opacity-25"></i>
|
||||
<p>Dieser Lagerort ist leer.</p>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<p class="text-muted small mb-3"><?php echo count($articles); ?> Artikel gefunden</p>
|
||||
<p class="text-muted small mb-3"><?php echo count($articles_raw); ?> Artikel gefunden</p>
|
||||
|
||||
<?php foreach ($articles as $article):
|
||||
$img = !empty($article['image_url']) ? htmlspecialchars($article['image_url']) : 'assets/images/keinbild.png';
|
||||
$meta = array_filter([$article['manufacturer_name'], $article['product_designation']]);
|
||||
$meta_text = !empty($meta) ? htmlspecialchars(implode(' - ', $meta)) : 'Keine Details';
|
||||
$catColor = !empty($article['category_color']) ? htmlspecialchars($article['category_color']) : '#e2e8f0';
|
||||
$catName = !empty($article['category_name']) ? htmlspecialchars($article['category_name']) : 'Ohne Kategorie';
|
||||
?>
|
||||
<div class="article-card">
|
||||
<img src="<?php echo $img; ?>" class="article-img" alt="Bild">
|
||||
<div class="article-info">
|
||||
<div class="article-title"><?php echo htmlspecialchars($article['name']); ?></div>
|
||||
<div class="article-meta mb-1"><?php echo $meta_text; ?></div>
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<span class="badge rounded-pill border" style="background-color: <?php echo $catColor; ?>; color: #fff; text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; font-size: 0.7rem;"><?php echo $catName; ?></span>
|
||||
<span class="text-muted" style="font-size: 0.75rem;"><i class="fas fa-weight-hanging me-1"></i><?php echo $article['weight_grams']; ?>g</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="qty-badge"><?php echo $article['quantity_owned']; ?>x</div>
|
||||
</div>
|
||||
<?php foreach ($articlesHierarchical as $article): ?>
|
||||
<?php echo renderArticleCard($article); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user