diff --git a/config/packages/kimai.yaml b/config/packages/kimai.yaml index 5bb10129..273f2f20 100644 --- a/config/packages/kimai.yaml +++ b/config/packages/kimai.yaml @@ -124,6 +124,7 @@ kimai: # week_numbers: true # weekends: true # day_limit: 4 +# slot_duration: '00:30:00' # businessHours: # days: [1, 2, 3, 4, 5] # begin: '08:00' diff --git a/src/Configuration/CalendarConfiguration.php b/src/Configuration/CalendarConfiguration.php index c7019a4b..205ddcf6 100644 --- a/src/Configuration/CalendarConfiguration.php +++ b/src/Configuration/CalendarConfiguration.php @@ -97,4 +97,9 @@ class CalendarConfiguration implements SystemBundleConfiguration { return $this->find('google.sources'); } + + public function getSlotDuration(): string + { + return (string) $this->find('slot_duration'); + } } diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 16c300c9..2f68045d 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -250,6 +250,7 @@ class Configuration implements ConfigurationInterface ->children() ->booleanNode('week_numbers')->defaultTrue()->end() ->integerNode('day_limit')->defaultValue(4)->end() + ->scalarNode('slot_duration')->defaultValue('00:30:00')->end() ->arrayNode('businessHours') ->addDefaultsIfNotSet() ->children() diff --git a/templates/calendar/user.html.twig b/templates/calendar/user.html.twig index ca7cd281..0c33f93d 100644 --- a/templates/calendar/user.html.twig +++ b/templates/calendar/user.html.twig @@ -215,9 +215,8 @@ eventResize: changeHandler, {% endif %} {% endif %} - /* - slotDuration: '00:30:00', // TODO make me configurable - */ + slotDuration: '{{ config.slotDuration }}', + slotLabelInterval: '{{ config.slotDuration }}', minTime: '{{ config.timeframeBegin }}', maxTime: '{{ config.timeframeEnd }}', defaultTimedEventDuration: '00:30' diff --git a/tests/Configuration/CalendarConfigurationTest.php b/tests/Configuration/CalendarConfigurationTest.php index 6ce70279..2363140f 100644 --- a/tests/Configuration/CalendarConfigurationTest.php +++ b/tests/Configuration/CalendarConfigurationTest.php @@ -42,6 +42,7 @@ class CalendarConfigurationTest extends TestCase 'end' => '19:27' ], 'day_limit' => 20, + 'slot_duration' => '01:11:00', 'week_numbers' => false, 'google' => [ 'api_key' => 'wertwertwegsdfbdf243w567fg8ihuon', @@ -72,6 +73,7 @@ class CalendarConfigurationTest extends TestCase $this->assertEquals([2, 4, 6], $sut->getBusinessDays()); $this->assertEquals('07:49', $sut->getBusinessTimeBegin()); $this->assertEquals('19:27', $sut->getBusinessTimeEnd()); + $this->assertEquals('01:11:00', $sut->getSlotDuration()); $this->assertEquals(20, $sut->getDayLimit()); $this->assertFalse($sut->isShowWeekNumbers()); diff --git a/tests/Controller/CalendarControllerTest.php b/tests/Controller/CalendarControllerTest.php index 20d4eae9..a087131c 100644 --- a/tests/Controller/CalendarControllerTest.php +++ b/tests/Controller/CalendarControllerTest.php @@ -68,6 +68,7 @@ class CalendarControllerTest extends ControllerBaseTest ], 'day_limit' => 20, 'week_numbers' => false, + 'slot_duration' => '00:15:00', 'google' => [ 'api_key' => 'wertwertwegsdfbdf243w567fg8ihuon', 'sources' => [ diff --git a/tests/DependencyInjection/AppExtensionTest.php b/tests/DependencyInjection/AppExtensionTest.php index 99f9b029..38c2ecf5 100644 --- a/tests/DependencyInjection/AppExtensionTest.php +++ b/tests/DependencyInjection/AppExtensionTest.php @@ -63,6 +63,7 @@ class AppExtensionTest extends TestCase 'kimai.calendar' => [ 'week_numbers' => true, 'day_limit' => 4, + 'slot_duration' => '00:30:00', 'businessHours' => [ 'days' => [1, 2, 3, 4, 5], 'begin' => '08:00',