random improvements (#5382)

* remove permission check, as own timesheets should always be visible
* new methods to create datetime
* allow access to user roles in javascript
* support class for dropdown actions
* allow to edit internal rate
* support human readable duration in export via user configuration
* allow to order timesheet listing by user, exported and billable field
* bump codecov action
This commit is contained in:
Kevin Papst
2025-03-13 18:00:50 +01:00
committed by GitHub
parent 934fdeb107
commit 2a75cd6230
26 changed files with 271 additions and 36 deletions

View File

@@ -18,6 +18,7 @@ use App\Form\Type\DescriptionType;
use App\Form\Type\DurationType;
use App\Form\Type\FixedRateType;
use App\Form\Type\HourlyRateType;
use App\Form\Type\InternalRateType;
use App\Form\Type\MetaFieldsCollectionType;
use App\Form\Type\TagsType;
use App\Form\Type\TimePickerType;
@@ -365,6 +366,9 @@ class TimesheetEditForm extends AbstractType
])
->add('hourlyRate', HourlyRateType::class, [
'currency' => $currency,
])
->add('internalRate', InternalRateType::class, [
'currency' => $currency,
]);
}

View File

@@ -44,8 +44,12 @@ final class TimesheetToolbarForm extends AbstractType
$this->addExportStateChoice($builder);
$this->addPageSizeChoice($builder);
$this->addHiddenPagination($builder);
$this->addOrder($builder);
$this->addOrderBy($builder, TimesheetQuery::TIMESHEET_ORDER_ALLOWED);
$query = $options['data'];
if ($query instanceof TimesheetQuery) {
$this->addOrder($builder);
$this->addOrderBy($builder, $query->getAllowedOrderColumns());
}
}
public function configureOptions(OptionsResolver $resolver): void

View File

@@ -0,0 +1,38 @@
<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* Custom form field type to set the internal rate.
*/
final class InternalRateType extends AbstractType
{
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
// documentation is for NelmioApiDocBundle
'documentation' => [
'type' => 'number',
'description' => 'Internal (hourly) rate',
],
'required' => false,
'label' => 'internalRate',
]);
}
public function getParent(): string
{
return MoneyType::class;
}
}