{% extends app.request.xmlHttpRequest ? 'form.html.twig' : 'base.html.twig' %} {% import "macros/widgets.html.twig" as widgets %} {% block main %} {% if timesheet.exported %} {{ widgets.alert('warning', ('timesheet.locked.warning'|trans({}, 'flashmessages')), ('warning'|trans({}, 'flashmessages')), 'warning') }} {% endif %} {% set formEditTemplate = app.request.xmlHttpRequest ? 'default/_form_modal.html.twig' : 'default/_form.html.twig' %} {% set formOptions = { 'title': (timesheet.id ? 'timesheet.edit'|trans : 'create'|trans), 'form': form, 'back': path(route_back) } %} {% embed formEditTemplate with formOptions %} {% set length = 6 %} {% if form.begin is defined and form.end is defined and form.duration is defined %} {% set length = 5 %} {% elseif form.begin is defined and form.end is defined and form.duration is not defined %} {% set length = 6 %} {% elseif form.begin is defined and form.end is not defined and form.duration is defined %} {% set length = 10 %} {% elseif form.begin is not defined and form.end is defined and form.duration is defined %} {% set length = 10 %} {% endif %} {% block form_body %} {% if form.begin is defined or form.end is defined or form.duration is defined %}
{% if form.begin is defined %}
{{ form_row(form.begin) }}
{% endif %} {% if form.end is defined %}
{{ form_row(form.end) }}
{% endif %} {% if form.duration is defined %}
{{ form_row(form.duration) }}
{% endif %}
{% endif %} {% if form.customer is defined %} {{ form_row(form.customer) }} {% endif %} {% if form.project is defined %} {{ form_row(form.project) }} {% endif %} {% if form.activity is defined %} {{ form_row(form.activity) }} {% endif %} {% if form.description is defined %} {{ form_row(form.description) }} {% endif %} {% if form.tags is defined %} {{ form_row(form.tags) }} {% endif %} {% if form.user is defined %} {{ form_row(form.user) }} {% endif %} {% if form.users is defined or form.teams is defined %} {% set uLength = 12 %} {% if form.users is defined and form.teams is defined %} {% set uLength = 6 %} {% endif %}
{% if form.users is defined %}
{{ form_row(form.users) }}
{% endif %} {% if form.teams is defined %}
{{ form_row(form.teams) }}
{% endif %}
{% endif %} {% if form.fixedRate is defined and form.hourlyRate is defined %}
{{ form_row(form.fixedRate) }}
{{ form_row(form.hourlyRate) }}
{% endif %} {% if form.metaFields is defined and form.metaFields is not empty %} {% for meta in form.metaFields|sort((a, b) => a.vars.data.order <=> b.vars.data.order) %} {{ form_row(meta) }} {% endfor %} {% endif %} {% if form.exported is defined or form.billable is defined %} {% set ebLength = (form.exported is defined and form.billable is defined) ? 6 : 12 %}
{% if form.exported is defined %}
{{ form_row(form.exported) }}
{% endif %} {% if form.billable is defined %}
{{ form_row(form.billable) }}
{% endif %}
{% endif %} {{ form_widget(form) }} {% endblock %} {% block form_after %} {% if form.begin is defined and form.end is defined and form.duration is defined %} {% set blockPrefix = form.vars.id %} {% endif %} {% endblock %} {% endembed %} {% endblock %}