WIP: Implement feedback functionality

This commit is contained in:
Björn Fromme
2023-11-02 18:01:12 +01:00
parent 2689f93683
commit 2599fd69dc
28 changed files with 640 additions and 43 deletions
@@ -0,0 +1,43 @@
{% macro collectionRow(form) %}
<div {{ stimulus_target('form-collection', 'field') }}>
<div class="flex items-center space-x-4">
{{ form_widget(form) }}
<button type="button" {{ stimulus_action('form-collection', 'removeItem') }}>
{{ icon('delete', 'w-4 h-4 mt-2 pointer-events-none') }}
</button>
</div>
{{ form_errors(form) }}
</div>
{% endmacro %}
{{ form_start(form) }}
<div class="flex flex-col space-y-4 pb-8">
{{ form_row(form.name) }}
<div {{ stimulus_controller('form-collection', { 'prototype': _self.collectionRow(form.items.vars.prototype)|json_encode }) }}>
<h4 class="font-bold pb-2">
Bewertungen
</h4>
<div {{ stimulus_target('form-collection', 'fields')}} class="flex flex-col space-y-4 mb-4">
{% do form.items.setRendered %}
{%- for item in form.items -%}{{- _self.collectionRow(item) -}}{%- endfor -%}
</div>
<div class="flex justify-end">
<button type="button"
{{ stimulus_action('form-collection', 'addItem') }}
title="Bewertung hinzufügen">
{{ icon('plus', 'w-4 h-4 pointer-events-none') }}
</button>
</div>
{{ form_errors(form.items) }}
</div>
</div>
<div class="flex items-center space-x-2">
<button type="submit" class="btn">
Speichern
</button>
<a href="{{ path('app_admin_system_feedback_set_index') }}" class="btn btn--secondary">
Abbrechen
</a>
</div>
{{ form_rest(form) }}
{{ form_end(form) }}
@@ -0,0 +1,12 @@
{% extends 'admin/layout.html.twig' %}
{% block title %}Einstellungen - Feedback-Vorlage anlegen{% endblock %}
{% block content %}
<div class="max-w-screen-sm">
<h1 class="text-2xl font-bold pb-8">
Feedback-Vorlage
</h1>
{% include 'admin/system/feedback_set/_form.html.twig' %}
</div>
{% endblock %}
@@ -0,0 +1,12 @@
{% extends 'admin/layout.html.twig' %}
{% block title %}Einstellungen - Feedback-Vorlage bearbeiten{% endblock %}
{% block content %}
<div class="max-w-screen-sm">
<h1 class="text-2xl font-bold pb-8">
Feedback-Vorlage bearbeiten
</h1>
{% include 'admin/system/feedback_set/_form.html.twig' %}
</div>
{% endblock %}
@@ -0,0 +1,64 @@
{% extends 'admin/layout.html.twig' %}
{% block title %}Einstellungen - Feedback-Vorlagen{% endblock %}
{% block content %}
<h1 class="text-2xl font-bold pb-8">
Feedback-Vorlagen
</h1>
<div class="data-table-wrapper">
<div class="data-table-wrapper__inner">
<table class="data-table">
<thead>
<tr>
<th>
Bezeichnung
</th>
<th>
Bewertungen
</th>
<th></th>
</tr>
</thead>
<tbody>
{% for feedbackSet in feedbackSets %}
<tr>
<td>
{{ feedbackSet.name }}
</td>
<td>
{{ feedbackSet.items|length }}
</td>
<td>
<div class="flex items-center space-x-2 justify-end">
<button type="button"
class="text-red-500"
{{ stimulus_controller('modal-button', [], [], {'confirmation-modal': '#confirmation-modal'}) }}
{{ stimulus_action('modal-button', 'confirmation', null, {
'title': 'Bist du sicher?',
'content': 'Möchtest du das Job-Profil wirklich löschen?',
'target-url': path('app_admin_system_feedback_set_delete', { 'id': feedbackSet.id })
}) }}>
{{ icon('delete') }}
</button>
<a href="{{ path('app_admin_system_feedback_set_edit', { 'id': feedbackSet.id }) }}">
{{ icon('edit') }}
</a>
</div>
</td>
</tr>
{% else %}
<tr>
<td colspan="4">
Keine Daten...
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<a href="{{ path('app_admin_system_feedback_set_create') }}" class="btn">
Neu
</a>
{% endblock %}
@@ -1,6 +1,7 @@
{{ form_start(form) }}
<div class="flex flex-col space-y-4 pb-8">
{{ form_row(form.name) }}
{{ form_row(form.feedbackSet) }}
{{ form_row(form.requiredTrainings) }}
{{ form_row(form.requiredLicenses) }}
</div>