diff --git a/src/Form/TimesheetEditForm.php b/src/Form/TimesheetEditForm.php index a824a746..d3812a74 100644 --- a/src/Form/TimesheetEditForm.php +++ b/src/Form/TimesheetEditForm.php @@ -310,6 +310,10 @@ class TimesheetEditForm extends AbstractType $builder->add('duration', DurationType::class, $durationOptions); + if ($this->systemConfiguration->isBreakTimeEnabled()) { + $builder->add('break', DurationType::class, ['label' => 'break', 'required' => false]); + } + $builder->addEventListener( FormEvents::POST_SET_DATA, function (FormEvent $event) { @@ -338,7 +342,7 @@ class TimesheetEditForm extends AbstractType $duration = $timesheet->getDuration() ?? 0; - // only apply the duration, if the end is not yet set + // only apply the duration, if the end is not yet set. // without that check, the end would be overwritten and the real end time would be lost if (($forceApply && $duration > 0) || ($duration > 0 && $timesheet->isRunning())) { $end = clone $timesheet->getBegin(); diff --git a/templates/timesheet/edit-default.html.twig b/templates/timesheet/edit-default.html.twig index c857b9b8..77ddfdd6 100644 --- a/templates/timesheet/edit-default.html.twig +++ b/templates/timesheet/edit-default.html.twig @@ -46,6 +46,9 @@ {% endif %} {% endif %} + {% if form.break is defined %} + {{ form_row(form.break, {'row_attr': {'class': 'mb-3 ' ~ form.vars.name ~ '_row_' ~ form.break.vars.name}}) }} + {% endif %} {% if form.customer is defined %} {{ form_row(form.customer, {'row_attr': {'class': 'mb-3 ' ~ form.vars.name ~ '_row_' ~ form.customer.vars.name}}) }} {% endif %}