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

@@ -37,6 +37,9 @@ class SystemConfigurationTest extends TestCase
'timesheet' => [
'rules' => [
'allow_future_times' => false,
'lockdown_period_start' => null,
'lockdown_period_end' => null,
'lockdown_grace_period' => null,
],
'mode' => 'duration_only',
'markdown_content' => false,
@@ -44,6 +47,9 @@ class SystemConfigurationTest extends TestCase
'hard_limit' => 99,
'soft_limit' => 15,
],
'default_begin' => 'now',
'duration_increment' => 10,
'time_increment' => 5,
],
'defaults' => [
'customer' => [
@@ -94,12 +100,16 @@ class SystemConfigurationTest extends TestCase
return [
(new Configuration())->setName('defaults.customer.timezone')->setValue('Russia/Moscov'),
(new Configuration())->setName('defaults.customer.currency')->setValue('RUB'),
(new Configuration())->setName('calendar.slot_duration')->setValue('00:30:00'),
(new Configuration())->setName('timesheet.rules.allow_future_times')->setValue('1'),
(new Configuration())->setName('timesheet.rules.lockdown_period_start')->setValue('first day of last month'),
(new Configuration())->setName('timesheet.rules.lockdown_period_end')->setValue('last day of last month'),
(new Configuration())->setName('timesheet.rules.lockdown_grace_period')->setValue('+5 days'),
(new Configuration())->setName('timesheet.mode')->setValue('default'),
(new Configuration())->setName('timesheet.markdown_content')->setValue('1'),
(new Configuration())->setName('timesheet.default_begin')->setValue('07:00'),
(new Configuration())->setName('timesheet.active_entries.hard_limit')->setValue('7'),
(new Configuration())->setName('timesheet.active_entries.soft_limit')->setValue('3'),
(new Configuration())->setName('calendar.slot_duration')->setValue('00:30:00'),
];
}
@@ -114,7 +124,7 @@ class SystemConfigurationTest extends TestCase
$sut = $this->getSut($this->getDefaultSettings(), []);
$this->assertEquals('Europe/London', $sut->find('defaults.customer.timezone'));
$this->assertEquals('GBP', $sut->find('defaults.customer.currency'));
$this->assertEquals(false, $sut->find('timesheet.rules.allow_future_times'));
$this->assertFalse($sut->find('timesheet.rules.allow_future_times'));
$this->assertEquals(99, $sut->find('timesheet.active_entries.hard_limit'));
}
@@ -123,7 +133,7 @@ class SystemConfigurationTest extends TestCase
$sut = $this->getSut($this->getDefaultSettings(), $this->getDefaultLoaderSettings());
$this->assertEquals('Russia/Moscov', $sut->find('defaults.customer.timezone'));
$this->assertEquals('RUB', $sut->find('defaults.customer.currency'));
$this->assertEquals(true, $sut->find('timesheet.rules.allow_future_times'));
$this->assertTrue($sut->find('timesheet.rules.allow_future_times'));
$this->assertEquals(7, $sut->find('timesheet.active_entries.hard_limit'));
}
@@ -132,7 +142,7 @@ class SystemConfigurationTest extends TestCase
$sut = $this->getSut($this->getDefaultSettings(), [
(new Configuration())->setName('timesheet.rules.allow_future_times')->setValue(''),
]);
$this->assertEquals(false, $sut->find('timesheet.rules.allow_future_times'));
$this->assertFalse($sut->find('timesheet.rules.allow_future_times'));
}
public function testUnknownConfigs()
@@ -194,4 +204,52 @@ class SystemConfigurationTest extends TestCase
$this->assertEquals('IT', $sut->getUserDefaultLanguage());
$this->assertEquals('USD', $sut->getUserDefaultCurrency());
}
public function testTimesheetWithoutLoader()
{
$sut = $this->getSut($this->getDefaultSettings(), []);
$this->assertEquals(99, $sut->getTimesheetActiveEntriesHardLimit());
$this->assertEquals(15, $sut->getTimesheetActiveEntriesSoftLimit());
$this->assertFalse($sut->isTimesheetAllowFutureTimes());
$this->assertFalse($sut->isTimesheetMarkdownEnabled());
$this->assertEquals('duration_only', $sut->getTimesheetTrackingMode());
$this->assertEquals('now', $sut->getTimesheetDefaultBeginTime());
$this->assertFalse($sut->isTimesheetLockdownActive());
$this->assertEquals('', $sut->getTimesheetLockdownPeriodStart());
$this->assertEquals('', $sut->getTimesheetLockdownPeriodEnd());
$this->assertEquals('', $sut->getTimesheetLockdownGracePeriod());
$this->assertEquals('', $sut->isTimesheetAllowOverlappingRecords());
$this->assertEquals('', $sut->getTimesheetDefaultRoundingDays());
$this->assertEquals('', $sut->getTimesheetDefaultRoundingMode());
$this->assertEquals(0, $sut->getTimesheetDefaultRoundingDuration());
$this->assertEquals(0, $sut->getTimesheetDefaultRoundingEnd());
$this->assertEquals(0, $sut->getTimesheetDefaultRoundingBegin());
$this->assertEquals(10, $sut->getTimesheetIncrementDuration());
$this->assertEquals(5, $sut->getTimesheetIncrementBegin());
$this->assertEquals(5, $sut->getTimesheetIncrementEnd());
}
public function testTimesheetWithLoader()
{
$sut = $this->getSut($this->getDefaultSettings(), $this->getDefaultLoaderSettings());
$this->assertEquals(7, $sut->getTimesheetActiveEntriesHardLimit());
$this->assertEquals(3, $sut->getTimesheetActiveEntriesSoftLimit());
$this->assertTrue($sut->isTimesheetAllowFutureTimes());
$this->assertTrue($sut->isTimesheetMarkdownEnabled());
$this->assertEquals('default', $sut->getTimesheetTrackingMode());
$this->assertEquals('07:00', $sut->getTimesheetDefaultBeginTime());
$this->assertTrue($sut->isTimesheetLockdownActive());
$this->assertEquals('first day of last month', $sut->getTimesheetLockdownPeriodStart());
$this->assertEquals('last day of last month', $sut->getTimesheetLockdownPeriodEnd());
$this->assertEquals('+5 days', $sut->getTimesheetLockdownGracePeriod());
$this->assertEquals('', $sut->isTimesheetAllowOverlappingRecords());
$this->assertEquals('', $sut->getTimesheetDefaultRoundingDays());
$this->assertEquals('', $sut->getTimesheetDefaultRoundingMode());
$this->assertEquals(0, $sut->getTimesheetDefaultRoundingDuration());
$this->assertEquals(0, $sut->getTimesheetDefaultRoundingEnd());
$this->assertEquals(0, $sut->getTimesheetDefaultRoundingBegin());
$this->assertEquals(10, $sut->getTimesheetIncrementDuration());
$this->assertEquals(5, $sut->getTimesheetIncrementBegin());
$this->assertEquals(5, $sut->getTimesheetIncrementEnd());
}
}