Quelltext des aktuellen Standes
<?php
$this->layout('layouts/main', [
'page_title' => $page_title,
'current_route' => $current_route,
'full_width' => true,
'extra_css' => ['/assets/css/catalog.css?v=' . filemtime(dirname(__DIR__, 2) . '/public/assets/css/catalog.css')],
]);
$disp = ($display ?? 'net') === 'gross' ? 'gross' : 'net';
$money = fn($v) => $this->money($v);
$cycleShort = ['once' => 'einmalig', 'monthly' => 'pro Monat', 'yearly' => 'pro Jahr'];
// Zwei-Preise-Modell: einmalig + laufend (pro Jahr = monatlich×12 + jährlich).
$recurring = fn($t) => \OpenNIT\Catalog\CatalogManager::recurringYearly($t);
?>
<div class="cat-wrap">
<div class="content-header">
<div>
<h1><?= $this->te('Profile') ?></h1>
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/"><?= $this->te('Home') ?></a></li>
<li class="breadcrumb-item"><a href="/catalog"><?= $this->te('Ausstattung & Preise') ?></a></li>
<li class="breadcrumb-item active"><?= $this->te('Profile') ?></li>
</ol>
</div>
<div class="content-header-actions">
<a href="/catalog" class="btn btn-default"><i class="fas fa-arrow-left"></i> <?= $this->te('Zurück') ?></a>
<?php if (!empty($bundles)): ?>
<a href="/catalog/bundles/pdf" class="btn btn-default" target="_blank" rel="noopener"><i class="fas fa-file-pdf"></i> <?= $this->te('Übersicht drucken') ?></a>
<?php endif; ?>
<?php if (!empty($can_manage)): ?>
<a href="/catalog/bundles/new" class="btn btn-primary"><i class="fas fa-plus"></i> <?= $this->te('Neues Profil') ?></a>
<?php endif; ?>
</div>
</div>
<div class="page-body">
<?php if (empty($bundles)): ?>
<div class="table-wrapper">
<div class="empty-state">
<i class="fas fa-user-tag"></i>
<p><?= $this->te('Noch keine Profile angelegt.') ?><?php if (!empty($can_manage)): ?> <a href="/catalog/bundles/new"><?= $this->te('Erstes Profil anlegen') ?></a>.<?php endif; ?></p>
</div>
</div>
<?php else: ?>
<div class="cat-bundle-grid">
<?php foreach ($bundles as $b): $bd = $b['bundle']; $t = $b['totals']; $rec = $recurring($t); ?>
<div class="detail-card">
<div class="detail-card-header">
<span class="detail-card-title"><i class="fas fa-user-tag"></i> <?= $this->e($bd['name']) ?><?php if ((int)$bd['is_active'] !== 1): ?> <span class="status-pill status-pill--neutral"><?= $this->te('inaktiv') ?></span><?php endif; ?></span>
<?php if (!empty($can_manage)): ?>
<div>
<a href="/catalog/bundles/<?= (int)$bd['id'] ?>/edit" class="btn btn-default btn-xs" title="<?= $this->te('Bearbeiten') ?>"><i class="fas fa-pencil-alt"></i></a>
<form method="post" action="/catalog/bundles/<?= (int)$bd['id'] ?>/delete" onsubmit="return confirm('Profil wirklich löschen?');" style="display:inline;">
<input type="hidden" name="_csrf" value="<?= $this->e($this->csrf()) ?>">
<button type="submit" class="btn btn-outline-danger btn-xs" title="<?= $this->te('Löschen') ?>"><i class="fas fa-times"></i></button>
</form>
</div>
<?php endif; ?>
</div>
<div class="detail-card-body">
<?php if (!empty($bd['description'])): ?><p class="text-muted cat-bundle-desc"><?= nl2br($this->e($bd['description'])) ?></p><?php endif; ?>
<ul class="cat-bundle-list">
<?php foreach ($b['items'] as $bi): $pv = $disp === 'gross' ? $bi['price_gross'] : $bi['price_net']; ?>
<li>
<span><?= (int)$bi['quantity'] ?>× <a class="table-link" href="/catalog/items/<?= (int)$bi['item_id'] ?>"><?= $this->e($bi['name']) ?></a>
<?php if (($bi['billing_cycle'] ?? 'once') !== 'once'): ?><small class="text-muted">(<?= $this->e($cycleShort[$bi['billing_cycle']] ?? '') ?>)</small><?php endif; ?></span>
<span class="cat-bundle-price"><?= $pv === null ? '<span class="text-muted">–</span>' : $money((float)$pv * (int)$bi['quantity']) ?></span>
</li>
<?php endforeach; ?>
</ul>
<?php if (!empty($b['requirements'])): ?>
<div class="cat-req-note"><i class="fas fa-link"></i> <?= $this->te('Pflicht-Positionen (automatisch)') ?></div>
<ul class="cat-bundle-list cat-bundle-req">
<?php foreach ($b['requirements'] as $rq): $pv = $disp === 'gross' ? $rq['price_gross'] : $rq['price_net']; ?>
<li>
<span><?= (int)$rq['quantity'] ?>× <a class="table-link" href="/catalog/items/<?= (int)$rq['id'] ?>"><?= $this->e($rq['name']) ?></a>
<?php if (($rq['billing_cycle'] ?? 'once') !== 'once'): ?><small class="text-muted">(<?= $this->e($cycleShort[$rq['billing_cycle']] ?? '') ?>)</small><?php endif; ?></span>
<span class="cat-bundle-price"><?= $pv === null ? '<span class="text-muted">–</span>' : $money((float)$pv * (int)$rq['quantity']) ?></span>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php $other = $disp === 'gross' ? 'net' : 'gross'; $unit = $disp === 'gross' ? 'brutto' : 'netto'; $unitOther = $disp === 'gross' ? 'netto' : 'brutto'; ?>
<div class="cat-bundle-totals">
<div class="cat-bt-row">
<span class="cat-bt-label"><?= $this->te('Einmalig') ?></span>
<span class="cat-bt-val"><?= $money($t['once'][$disp]) ?> <small><?= $unit ?> · <?= $money($t['once'][$other]) ?> <?= $unitOther ?></small></span>
</div>
<div class="cat-bt-row cat-bt-row--accent">
<span class="cat-bt-label"><?= $this->te('Laufend') ?> <span class="cat-bt-unit"><?= $this->te('/ Jahr') ?></span></span>
<span class="cat-bt-val"><?= $money($rec[$disp]) ?> <small><?= $unit ?><?php if ($rec[$disp] > 0): ?> · <?= $this->te('≈ {betrag}/Monat', ['betrag' => $money($rec[$disp] / 12)]) ?><?php endif; ?></small></span>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
</div>