improved duration and minute selector (#2264)

* do not close modal if form is dirty
* deprecated TimesheetConfiguration
* inject timezone in form types
* cleanup usage of UserDateTimeFactory
* allow to configure increment steps for minutes
* use 15 minutes step for datetimepicker in project edit form
* use rounding rules for increments in minute select for begin and end
* allow duration in multi user and admin timesheet forms
* make dropdown values configurable
This commit is contained in:
Kevin Papst
2021-01-17 14:04:13 +01:00
committed by GitHub
parent e2324b7d51
commit 8d72d114c7
95 changed files with 1381 additions and 510 deletions

View File

@@ -44,12 +44,20 @@ class ProjectEditForm extends AbstractType
}
}
$dateTimeOptions = [];
$dateTimeOptions = [
'model_timezone' => $options['timezone'],
'view_timezone' => $options['timezone'],
];
// primarily for API usage, where we cannot use a user/locale specific format
if (null !== $options['date_format']) {
$dateTimeOptions['format'] = $options['date_format'];
}
$timeIncrement = 1;
if ($options['time_increment'] >= 1 && $options['time_increment'] <= 60) {
$timeIncrement = $options['time_increment'];
}
$builder
->add('name', TextType::class, [
'label' => 'label.name',
@@ -68,14 +76,17 @@ class ProjectEditForm extends AbstractType
->add('orderDate', DateTimePickerType::class, array_merge($dateTimeOptions, [
'label' => 'label.orderDate',
'required' => false,
'time_increment' => $timeIncrement,
]))
->add('start', DateTimePickerType::class, array_merge($dateTimeOptions, [
'label' => 'label.project_start',
'required' => false,
'time_increment' => $timeIncrement,
]))
->add('end', DateTimePickerType::class, array_merge($dateTimeOptions, [
'label' => 'label.project_end',
'required' => false,
'time_increment' => $timeIncrement,
]))
->add('customer', CustomerType::class, [
'placeholder' => (null === $id && null === $customer) ? '' : false,
@@ -103,6 +114,8 @@ class ProjectEditForm extends AbstractType
'currency' => Customer::DEFAULT_CURRENCY,
'date_format' => null,
'include_budget' => false,
'timezone' => date_default_timezone_get(),
'time_increment' => 1,
'attr' => [
'data-form-event' => 'kimai.projectUpdate'
],