{% extends 'base.html.twig' %}
{% use 'dropZone.html.twig' %}
{% block javascripts %}
{{ encore_entry_script_tags('person') }}
{{ encore_entry_script_tags('form') }}
{% endblock %}
{% block body %}
<div class="container">
<h1>Schadenanzeige Haftpflichtversicherung</h1>
{{ form_start(form) }}
<div class="row">
<div class="col-sm-12 col-lg-4">
{{ form_row(form.department) }}
</div>
</div>
<div class="border mb-2 px-1">
<div class="row">
<div class="col-sm-12 col-lg-3">
{{ form_row(form.claimDate) }}
</div>
<div class="col-sm-12 col-lg-5">
{{ form_row(form.claimAddress) }}
</div>
</div>
</div>
<div class="border mb-2 px-1">
<div class="row">
<div class="col-md-12">
{{ form_row(form.claimDescription) }}
</div>
</div>
</div>
<div class="border mb-2 px-1">
<div class="row">
<div class="col-md-12">
{{ form_row(form.damageCosts) }}
</div>
</div>
</div>
<div class="border mb-2 px-1">
<div class="row">
<div class="col-sm-12 col-lg-5">
{{ form_row(form.damageBy) }}
</div>
</div>
</div>
<div class="border mb-2 px-1">
<div class="row">
<div class="col-sm-12 col-lg-5">
{{ form_row(form.policeReport) }}
</div>
</div>
</div>
<div class="border mb-2 px-1">
<div class="row">
<div class="col-sm-12 col-lg-5">
{{ form_row(form.injuredPerson) }}
</div>
</div>
</div>
<div class="border mb-2 px-1">
<div class="row">
<div class="col-sm-12 col-lg-5">
{{ form_row(form.damagedItem) }}
</div>
</div>
</div>
<div class="border mb-2 px-1">
<div class="row">
<div class="col-md-12">
<label>Beteiligte Personen</label>
<table class="col-md-12">
<thead>
<tr>
<th class="align-top">Name</th>
<th class="align-top">Telefon</th>
<th class="align-top">Email</th>
<th class="align-top ml-2"></th>
</tr>
</thead>
<tbody id="persons" data-widget-counter="{{ form.persons|length }}"
data-prototype='<tr id="items__item__"><td>{{ form_widget(form.persons.vars.prototype.name) }}</td><td>{{ form_widget(form.persons.vars.prototype.phone) }}</td><td>{{ form_widget(form.persons.vars.prototype.email) }}</td><td><button type="button" class="btn btn-danger btn-sm remove-item" data-action="delete" data-row="items__item__"><i class="fas fa-trash"></i></button></td></tr>'
>
{% for person in form.persons %}
<tr>
<td>{{ form_widget(person.name) }}</td>
<td>{{ form_widget(person.phone) }}</td>
<td>{{ form_widget(person.email) }}</td>
<td>
<button type="button" class="btn btn-danger btn-sm remove-person" data-action="delete">
<i class="fas fa-trash"></i>
</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<button class="btn btn-sm btn-secondary my-md-1" id="add-person" data-list-selector="#persons">Weitere Person hinzufügen</button>
</div>
</div>
</div>
<div class="border mb-2 px-1">
<div class="row">
<div class="col-md-12">
{{ form_row(form.remark) }}
</div>
</div>
</div>
<div class="border mb-2 px-1">
<div class="row">
<div class="col-sm-12 col-lg-5">
<label class="form-label required">Gemeldet durch</label>
<div class="row">
<div class="col-md-12">
{{ form_row(form.name) }}
{{ form_row(form.email) }}
</div>
</div>
</div>
<div class="col-sm-12 col-lg-5">
<label class="form-label">Kopie an:</label>
<div class="row">
<div class="col-md-12">
{{ form_row(form.ccEmail) }}
</div>
</div>
</div>
</div>
</div>
<div class="border mb-2 px-1">
{% block dropZone %}
{{ parent() }}
{% endblock %}
</div>
<div class="row justify-content-between">
<div class="col-md-4">
{{ form_widget(form.submit) }}
</div>
<div class="col-md-4">
<a href="{{ url('home') }}" class="btn btn-danger float-end">Zurück</a>
</div>
</div>
{{ form_end(form) }}
</div>
{% endblock %}