{% 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 %}