added new permission to separate time and money budget (#3352)

This commit is contained in:
Kevin Papst
2022-06-11 12:23:02 +02:00
committed by GitHub
parent 3f827b3104
commit b46fdcefad
47 changed files with 853 additions and 346 deletions

View File

@@ -97,6 +97,7 @@ class ActivityEditForm extends AbstractType
'customer' => false,
'currency' => Customer::DEFAULT_CURRENCY,
'include_budget' => false,
'include_time' => false,
'attr' => [
'data-form-event' => 'kimai.activityUpdate'
],

View File

@@ -114,6 +114,7 @@ class CustomerEditForm extends AbstractType
'csrf_token_id' => 'admin_customer_edit',
'currency' => Customer::DEFAULT_CURRENCY,
'include_budget' => false,
'include_time' => false,
'attr' => [
'data-form-event' => 'kimai.customerUpdate'
],

View File

@@ -26,22 +26,30 @@ trait EntityFormTrait
{
$this->addColor($builder);
if ($options['include_budget']) {
$builder
->add('budget', MoneyType::class, [
'empty_data' => '0.00',
'label' => 'label.budget',
'required' => false,
'currency' => $options['currency'],
])
->add('timeBudget', DurationType::class, [
'empty_data' => 0,
'label' => 'label.timeBudget',
'icon' => 'clock',
'required' => false,
])
->add('budgetType', BudgetType::class)
;
$showMoney = $options['include_budget'];
$showTime = $options['include_time'];
$showBudget = $showMoney || $showTime;
if ($showMoney) {
$builder->add('budget', MoneyType::class, [
'empty_data' => '0.00',
'label' => 'label.budget',
'required' => false,
'currency' => $options['currency'],
]);
}
if ($showTime) {
$builder->add('timeBudget', DurationType::class, [
'empty_data' => 0,
'label' => 'label.timeBudget',
'icon' => 'clock',
'required' => false,
]);
}
if ($showBudget) {
$builder->add('budgetType', BudgetType::class);
}
$builder->add('metaFields', MetaFieldsCollectionType::class);

View File

@@ -112,6 +112,7 @@ class ProjectEditForm extends AbstractType
'currency' => Customer::DEFAULT_CURRENCY,
'date_format' => null,
'include_budget' => false,
'include_time' => false,
'timezone' => date_default_timezone_get(),
'time_increment' => 1,
'attr' => [