|
- {# templates/project/index.html.twig #}
- {% extends 'base.html.twig' %}
-
- {% block title %}Projekte{% endblock %}
-
- {% block body %}
- <script>
- window.CRUD = {
- apiBase: '/api/projects',
- clients: {{ clients|map(c => { id: c.id, name: c.name })|json_encode|raw }},
- };
- </script>
-
- <div class="crud-page">
-
- <div class="crud-page__header">
- <h1 class="crud-page__title">Projekte</h1>
- <button class="btn btn-primary" id="btn-new">Neues Projekt</button>
- </div>
-
- <div class="crud-create" id="crud-create">
- <div class="entry-form__grid">
-
- <label class="entry-form__label">Name</label>
- <div class="entry-form__field">
- <input type="text" id="create-name" class="input" placeholder="Projektname" />
- </div>
-
- <label class="entry-form__label">Kunde</label>
- <div class="entry-form__field">
- <select id="create-client" class="select">
- <option value="">Bitte wählen</option>
- {% for client in clients %}
- <option value="{{ client.id }}">{{ client.name }}</option>
- {% endfor %}
- </select>
- </div>
-
- <label class="entry-form__label">Bemerkung</label>
- <div class="entry-form__field">
- <textarea id="create-note" class="textarea" rows="2"></textarea>
- </div>
-
- <div class="entry-form__actions">
- <button type="button" class="btn btn-primary" id="btn-create-save">Erstellen</button>
- <button type="button" class="btn btn-secondary" id="btn-create-cancel">Abbrechen</button>
- </div>
-
- </div>
- </div>
-
- <div class="crud-tabs">
- <button class="crud-tab crud-tab--active" data-tab="active">Aktiv</button>
- <button class="crud-tab" data-tab="archived">Archiviert</button>
- </div>
-
- <div class="crud-list" id="crud-list">
-
- {% for project in projects %}
- <div class="crud-row{% if project.isArchived() %} crud-row--archived{% endif %}"
- id="project-{{ project.id }}"
- data-id="{{ project.id }}"
- data-archived="{{ project.isArchived() ? '1' : '0' }}"
- data-name="{{ project.name|e('html_attr') }}"
- data-client-id="{{ project.client.id }}"
- data-note="{{ project.note|default('')|e('html_attr') }}">
-
- <div class="crud-row__display">
- <div class="crud-row__info">
- <span class="crud-row__name">{{ project.name }}</span>
- <span class="crud-row__meta">{{ project.client.name }}</span>
- </div>
- <div class="crud-row__actions">
- {% if project.isArchived() %}
- <button class="crud-row__btn crud-row__btn--restore" data-action="unarchive" title="Wiederherstellen">
- <svg viewBox="0 0 16 16" fill="none"><path d="M2 8a6 6 0 1 1 1.5 3.5" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/><path d="M2 13V9h4" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/></svg>
- </button>
- {% else %}
- <button class="crud-row__btn crud-row__btn--edit" data-action="edit" title="Bearbeiten">
- <svg viewBox="0 0 16 16" fill="none"><path d="M11 2l3 3L5 14H2v-3L11 2z" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/></svg>
- </button>
- <button class="crud-row__btn crud-row__btn--delete" data-action="delete" title="Löschen">
- <svg viewBox="0 0 16 16" fill="none"><path d="M3 4h10M6 4V2h4v2M5 4l.5 9h5l.5-9" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/></svg>
- </button>
- {% endif %}
- </div>
- </div>
-
- {% if not project.isArchived() %}
- <div class="crud-row__edit" hidden>
- <div class="entry-form__grid entry-form__grid--inline">
-
- <label class="entry-form__label">Name</label>
- <div class="entry-form__field">
- <input type="text" class="input edit-name" value="{{ project.name }}" />
- </div>
-
- <label class="entry-form__label">Kunde</label>
- <div class="entry-form__field">
- <select class="select edit-client">
- {% for client in clients %}
- <option value="{{ client.id }}"
- {% if client.id == project.client.id %}selected{% endif %}>
- {{ client.name }}
- </option>
- {% endfor %}
- </select>
- </div>
-
- <label class="entry-form__label">Bemerkung</label>
- <div class="entry-form__field">
- <textarea class="textarea edit-note" rows="2">{{ project.note|default('') }}</textarea>
- </div>
-
- <div class="entry-form__actions">
- <button type="button" class="btn btn-primary" data-action="save">Sichern</button>
- <button type="button" class="btn btn-secondary" data-action="cancel">Abbrechen</button>
- </div>
-
- </div>
- </div>
- {% endif %}
-
- </div>
- {% else %}
- <div class="empty-state">
- <p class="empty-state__title">Noch keine Projekte angelegt.</p>
- </div>
- {% endfor %}
-
- </div>
- </div>
-
- {% endblock %}
-
- {% block javascripts %}
- {{ parent() }}
- {{ encore_entry_script_tags('crud') }}
- {% endblock %}
|