projectbased/updates/baseline/app/Views/projects/view.php

SHA-256: 27b1de49cc28a60a81c08bc8bcacf10355e7216fe5cdddc326144b4589100d82
<div class="row g-4">
  <div class="col-lg-8">
    <div class="card p-4">
      <div class="d-flex justify-content-between align-items-start gap-3">
        <div>
          <h1 class="h4 mb-1"><?= htmlspecialchars($project['title']) ?></h1>
          <div class="muted">Kategorie: <span class="badge badge-soft"><?= htmlspecialchars($project['category']) ?></span> · Region: <?= htmlspecialchars($project['region']) ?></div>
          <div class="muted mt-2">Owner: <?= htmlspecialchars($project['owner_name']) ?></div>
        </div>
        <div class="text-end">
          <div class="badge badge-soft mb-2">Score: <?= (int)$score ?></div><br>
          <?php if (!$isMember): ?>
            <form method="post" action="<?= \App\Lib\Url::route('project_join') ?>">
              <input type="hidden" name="csrf" value="<?= htmlspecialchars($csrf) ?>">
              <input type="hidden" name="project_id" value="<?= (int)$project['id'] ?>">
              <button class="btn btn-primary btn-sm" type="submit">Beitreten</button>
            </form>
          <?php else: ?>
            <span class="muted">Du bist Mitglied</span>
          <?php endif; ?>
        </div>
      </div>

      <hr>

      <p class="mb-0"><?= nl2br(htmlspecialchars($project['description'] ?? '')) ?></p>

      <hr>

      <div class="d-flex align-items-center gap-2">
        <form method="post" action="<?= \App\Lib\Url::route('project_vote') ?>" class="d-inline">
          <input type="hidden" name="csrf" value="<?= htmlspecialchars($csrf) ?>">
          <input type="hidden" name="project_id" value="<?= (int)$project['id'] ?>">
          <input type="hidden" name="value" value="1">
          <button class="btn btn-outline-light btn-sm" type="submit">👍 Zustimmung</button>
        </form>
        <form method="post" action="<?= \App\Lib\Url::route('project_vote') ?>" class="d-inline">
          <input type="hidden" name="csrf" value="<?= htmlspecialchars($csrf) ?>">
          <input type="hidden" name="project_id" value="<?= (int)$project['id'] ?>">
          <input type="hidden" name="value" value="-1">
          <button class="btn btn-outline-light btn-sm" type="submit">👎 Ablehnung</button>
        </form>
        <button class="btn btn-outline-danger btn-sm" data-bs-toggle="collapse" data-bs-target="#vetoBox">Veto mit Begründung</button>
      </div>

      <div class="collapse mt-3" id="vetoBox">
        <form method="post" action="<?= \App\Lib\Url::route('project_veto') ?>">
          <input type="hidden" name="csrf" value="<?= htmlspecialchars($csrf) ?>">
          <input type="hidden" name="project_id" value="<?= (int)$project['id'] ?>">
          <label class="form-label">Veto-Begründung (min. 10 Zeichen)</label>
          <textarea class="form-control" name="reason" rows="3" required></textarea>
          <button class="btn btn-danger btn-sm mt-2" type="submit">Veto einreichen</button>
        </form>
      </div>

    </div>

    <div class="card p-4 mt-4">
      <h2 class="h5 mb-3">Veto-Historie</h2>
      <?php if (empty($vetoes)): ?>
        <p class="muted mb-0">Noch keine Vetos.</p>
      <?php else: ?>
        <?php foreach($vetoes as $v): ?>
          <div class="mb-3">
            <div class="muted small"><?= htmlspecialchars($v['created_at']) ?> · <?= htmlspecialchars($v['display_name']) ?></div>
            <div><?= nl2br(htmlspecialchars($v['reason'])) ?></div>
          </div>
          <hr class="opacity-25">
        <?php endforeach; ?>
      <?php endif; ?>
    </div>
  </div>

  <div class="col-lg-4">
    <div class="card p-4">
      <h2 class="h5 mb-2">Projekt-Management (MPC)</h2>
      <?php if (!empty($manager)): ?>
        <div class="muted">Aktuell: <strong><?= htmlspecialchars($manager['display_name']) ?></strong></div>
        <div class="muted">Rotation fällig: <?= htmlspecialchars($manager['rotation_due_at']) ?></div>
      <?php else: ?>
        <div class="muted">Noch kein Manager gesetzt.</div>
      <?php endif; ?>
      <div class="mt-3 muted small">Demo-Regel: Rotation alle 30 Tage (Cron).</div>
    </div>

    <div class="card p-4 mt-4">
      <h2 class="h5 mb-3">Mitglieder</h2>
      <div class="table-responsive">
        <table class="table table-sm align-middle mb-0">
          <thead><tr><th>Name</th><th>R</th></tr></thead>
          <tbody>
          <?php foreach($members as $m): ?>
            <tr>
              <td><?= htmlspecialchars($m['display_name']) ?><div class="muted small"><?= htmlspecialchars($m['joined_at']) ?></div></td>
              <td><?= (int)$m['r_index'] ?></td>
            </tr>
          <?php endforeach; ?>
          </tbody>
        </table>
      </div>
    </div>

  </div>
</div>