javascript and api to stop and display active records (#772)
This commit is contained in:
@@ -9,8 +9,10 @@
|
||||
|
||||
namespace App\Form\Extension;
|
||||
|
||||
use App\Configuration\ThemeConfiguration;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractTypeExtension;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Form\FormView;
|
||||
|
||||
@@ -29,14 +31,14 @@ class EnhancedChoiceTypeExtension extends AbstractTypeExtension
|
||||
/**
|
||||
* @param null|string $type
|
||||
*/
|
||||
public function __construct(?string $type)
|
||||
public function __construct(ThemeConfiguration $configuration)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->type = $configuration->getSelectPicker();
|
||||
}
|
||||
|
||||
public static function getExtendedTypes(): iterable
|
||||
{
|
||||
return [EntityType::class];
|
||||
return [EntityType::class, ChoiceType::class];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,6 +13,7 @@ class SystemConfiguration
|
||||
{
|
||||
public const SECTION_TIMESHEET = 'timesheet';
|
||||
public const SECTION_FORM_CUSTOMER = 'form_customer';
|
||||
public const SECTION_THEME = 'theme';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
|
||||
@@ -291,6 +291,11 @@ class TimesheetEditForm extends AbstractType
|
||||
'method' => 'POST',
|
||||
'date_format' => null,
|
||||
'customer' => false,
|
||||
'attr' => [
|
||||
'data-form-event' => 'kimai.timesheetUpdate',
|
||||
'data-msg-success' => 'action.update.success',
|
||||
'data-msg-error' => 'action.update.error',
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
43
src/Form/Type/EnhancedSelectboxType.php
Normal file
43
src/Form/Type/EnhancedSelectboxType.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?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\ChoiceType;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
/**
|
||||
* Custom form field type to select the javascript renderer for select boxes.
|
||||
*/
|
||||
class EnhancedSelectboxType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'label' => 'label.select_type',
|
||||
'choices' => [
|
||||
'' => null,
|
||||
'Javascript' => 'selectpicker',
|
||||
],
|
||||
'required' => false,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return ChoiceType::class;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user