Skip to content

Commit

Permalink
Style forms, report, vorfall
Browse files Browse the repository at this point in the history
  • Loading branch information
Rayvented committed Dec 1, 2023
1 parent 1d5870d commit 60eba7c
Show file tree
Hide file tree
Showing 21 changed files with 212 additions and 361 deletions.
32 changes: 24 additions & 8 deletions assets/styles/tailmater.css
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,18 @@ form > fieldset .btn-primary {
@apply text-muted text-sm mt-3;
}

.form-inline {

}

.form-inline .sr-only {
@apply hidden;
}

.form-inline .form-control {
@apply h-auto w-auto;
}

.tabs-nav {
@apply relative flex flex-row items-center;
}
Expand Down Expand Up @@ -929,31 +941,35 @@ form {
@apply w-full;
}

.form-group {
@apply mb-4;
form > fieldset > div {
@apply mb-5;
}

.form-group:last-of-type {
form > fieldset > div:last-of-type {
@apply mb-0;
}

.form-group label {
form > fieldset > div > .form-time > div {
@apply flex gap-1;
}

form label {
@apply block text-sm mb-1;
}

.form-group label.required {
form label.required {
@apply font-medium;
}

.form-group label.required::after {
form label.required::after {
content: " *";
}

.form-group.form-buttons {
form .form-buttons {
@apply pt-3 mb-0 -mt-3;
}

.form-group.form-buttons .btn {
form .form-buttons .btn {
@apply btn-elevated;
}

Expand Down
1 change: 1 addition & 0 deletions config/packages/twig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ twig:
debug: '%kernel.debug%'
strict_variables: '%kernel.debug%'
exception_controller: null
#form_themes: ['tailwind_2_layout.html.twig']
paths:
'%kernel.project_dir%/public/mail/css': css
globals:
Expand Down
6 changes: 4 additions & 2 deletions src/Controller/FormsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ public function addForms(
'errors' => $errors,
'title' => $this->translator->trans(id: 'form.create', domain: 'forms'),
'daten' => $daten,
'activ' => $daten->getActiv()
'activ' => $daten->getActiv(),
'urlBack' => $this->generateUrl('forms'),
]);
}

Expand Down Expand Up @@ -216,7 +217,8 @@ public function editFormulare(
'title' => $this->translator->trans(id: 'form.edit', domain: 'forms'),
'daten' => $forms,
'activ' => $forms->getActiv(),
'snack' => $request->get('snack')
'snack' => $request->get('snack'),
'urlBack' => $this->generateUrl('forms'),
]);
}

Expand Down
9 changes: 8 additions & 1 deletion src/Controller/ReportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public function addReport(
'title' => $this->translator->trans(id: 'task.create', domain: 'report'),
'report' => $report,
'activ' => $report->getActiv(),
'urlBack' => $this->generateUrl('report'),
]);
}

Expand Down Expand Up @@ -120,14 +121,20 @@ public function editReport(
);
}
}

$title = $request->get('edit')
? $this->translator->trans(id: 'work.edit', domain: 'report')
: $this->translator->trans(id: 'work.show', domain: 'report');

return $this->render('report/edit.html.twig', [
'form' => $form->createView(),
'errors' => $errors,
'title' => $this->translator->trans(id: 'work.edit', domain: 'report'),
'title' => $title,
'report' => $report,
'activ' => $report->getActiv(),
'snack' => $request->get('snack'),
'edit' => $request->get('edit'),
'urlBack' => $this->generateUrl('report'),
]);
}

Expand Down
6 changes: 4 additions & 2 deletions src/Controller/VorfallController.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ public function addVorfall(
'errors' => $errors,
'title' => $this->translator->trans(id: 'incident.register', domain: 'vorfall'),
'vorfall' => $vorfall,
'activ' => $vorfall->getActiv()
'activ' => $vorfall->getActiv(),
'urlBack' => $this->generateUrl('vorfall'),
]);
}

Expand Down Expand Up @@ -141,7 +142,8 @@ public function editVorfall(
'title' => $this->translator->trans(id: 'incident.edit', domain: 'vorfall'),
'vorfall' => $vorgang,
'activ' => $vorgang->getActiv(),
'snack' => $request->get('snack')
'snack' => $request->get('snack'),
'urlBack' => $this->generateUrl('vorfall'),
]);
}

Expand Down
79 changes: 23 additions & 56 deletions templates/forms/__form.html.twig
Original file line number Diff line number Diff line change
@@ -1,58 +1,25 @@
{% trans_default_domain 'forms' %}
{{ form_start(form) }}
<div>
<div>
<div>
{{ form_label(form.title) }}
{{ form_widget(form.title) }}
</div>
<div>
{{ form_label(form.version) }}
{{ form_widget(form.version) }}
</div>
<div>
{{ form_label(form.description) }}
{{ form_widget(form.description) }}
</div>
<div>
<div>
<div>
{{ form_label(form.products) }}
{{ form_widget(form.products) }}
</div>
</div>
<div>
<div>
{{ form_label(form.departments) }}
{{ form_widget(form.departments) }}
</div>
</div>
</div>
<div>
{{ form_label(form.status) }}
{{ form_widget(form.status) }}
</div>

</div>

<div>
<div>
{{ form_label(form.uploadFile) }}
{{ form_widget(form.uploadFile) }}
</div>
{% if daten.upload %}
<a href="{{ path('forms_download_file', {'id':daten.id}) }}" download>{{ daten.title }}
{% trans %}download{% endtrans %}</a>
{% endif %}
</div>
</div>


{{ form_label(form.save) }}
{% if not activ or daten.approved %}
{{ form_widget(form.save, { 'disabled':'disabled' }) }}
{% else %}
{{ form_widget(form.save) }}
{% set disabled = not activ or daten.approved %}
{{ form_start(form, {'attr': {'disabled': disabled }}) }}
<fieldset>
{{ form_row(form.title) }}
{{ form_row(form.version) }}
{{ form_row(form.description) }}
</fieldset>
<fieldset>
{{ form_row(form.products) }}
{{ form_row(form.departments) }}
{{ form_row(form.status) }}
</fieldset>
<fieldset>
{{ form_label(form.uploadFile) }}
{{ form_widget(form.uploadFile) }}
{% if daten.upload %}
<a href="{{ path('forms_download_file', {'id':daten.id}) }}">
{% trans %}download{% endtrans %}
</a>
{% endif %}

{{ form_end(form) }}
</fieldset>
{{ form_row(form.save, { row_attr: {class: 'form-buttons'}, attr: {'disabled': disabled} }) }}
{{ form_rest(form) }}
{{ form_end(form) }}
8 changes: 5 additions & 3 deletions templates/forms/__history.html.twig
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{% trans_default_domain 'forms' %}
<a href="{{ path('forms_edit',{'id':p.id}) }}">id: {{ p.id }} -- {{ p.createdAt|date('d.m.Y H:i') }}
-- {{ p.user.email }} -- {% trans %}version{% endtrans %}: {{ p.version }} {{ p.approved?'approved' | trans }}</a>
<li>
<a href="{{ path('forms_edit',{'id':p.id}) }}">id: {{ p.id }} -- {{ p.createdAt|date('d.m.Y H:i') }}
-- {{ p.user.email }} -- {% trans %}version{% endtrans %}: {{ p.version }} {{ p.approved?'approved' | trans }}</a>
</li>
{% if p.previous %}
{{ include('forms/__history.html.twig', {'p':p.previous}) }}
{% endif %}
{% endif %}
34 changes: 13 additions & 21 deletions templates/forms/edit.html.twig
Original file line number Diff line number Diff line change
@@ -1,33 +1,25 @@
{% extends 'base.html.twig' %}
{% trans_default_domain 'forms' %}

{% block title %}
{{ title }}
{% endblock %}

{% block CTA %}
{{ include('base/__approveBtn.html.twig',{'data':daten,'dataLink':'forms_approve'}) }}
{{ include('base/__disableBtn.html.twig',{'data':daten,'dataLink':'forms_disable'}) }}
{{ include('base/__approvedBy.html.twig', {'data':daten}) }}
{{ include('assign/__assign.html.twig',{'data':daten,'path':'assign_form'}) }}
{% endblock %}

{% block body %}
<div>
<div>
<h2>{{ title }}</h2>
{{ include('base/__approvedBy.html.twig', {'data':daten}) }}
</div>
<div>
{{ include('assign/__assign.html.twig',{'data':daten,'path':'assign_form'}) }}
</div>
</div>

<div>
{{ include('forms/__form.html.twig') }}
</div>
<p>{% trans from 'general' %}createdBy{% endtrans %}: {{ daten.user.email }}</p>
{{ include('forms/__form.html.twig') }}
<p class="created-by">{% trans from 'general' %}createdBy{% endtrans %}: {{ daten.user.email }}</p>
{% if daten.previous %}
<div>
<h2>{% trans from 'general' %}history{% endtrans %}</h2>
<h3 class="mt-10">{% trans from 'general' %}history{% endtrans %}</h3>
<ol class="item-history" reversed>
{{ include('forms/__history.html.twig', {'p':daten.previous}) }}
</div>
</ol>
{% endif %}
{{ include('base/__snack.html.twig') }}
{% endblock %}

{% block javascript %}
{% endblock %}
{% endblock %}
22 changes: 5 additions & 17 deletions templates/forms/new.html.twig
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
{% extends 'base.html.twig' %}
{% trans_default_domain 'forms' %}
{% block CTA %}
{% endblock %}

{% block body %}

<h2>{{ title }}</h2>
<div>
{{ include('forms/__form.html.twig') }}
</div>
<p>{% trans from 'general' %}createdBy{% endtrans %}: {{ daten.user.email }}</p>
{% if daten.previous %}
<div>
<h2>{% trans from 'general' %}history{% endtrans %}</h2>
{{ include('forms/__history.html.twig', {'p':daten.previous}) }}
</div>
{% endif %}
{% block title %}
{{ title }}
{% endblock %}

{% block javascript %}
{% endblock %}
{% block body %}
{{ include('forms/__form.html.twig') }}
{% endblock %}
Loading

0 comments on commit 60eba7c

Please sign in to comment.