detail pages for customers and projects (#1371)
This commit is contained in:
@@ -59,7 +59,7 @@ class ActivityEditForm extends AbstractType
|
||||
],
|
||||
])
|
||||
->add('comment', TextareaType::class, [
|
||||
'label' => 'label.comment',
|
||||
'label' => 'label.description',
|
||||
'required' => false,
|
||||
])
|
||||
;
|
||||
|
||||
47
src/Form/CustomerCommentForm.php
Normal file
47
src/Form/CustomerCommentForm.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?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;
|
||||
|
||||
use App\Entity\CustomerComment;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class CustomerCommentForm extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('message', TextareaType::class, [
|
||||
'label' => false,
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => CustomerComment::class,
|
||||
'csrf_protection' => true,
|
||||
'csrf_field_name' => '_token',
|
||||
'csrf_token_id' => 'admin_customer_comment',
|
||||
'attr' => [
|
||||
'data-form-event' => 'kimai.customerComment'
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,7 @@ class CustomerEditForm extends AbstractType
|
||||
'required' => false,
|
||||
])
|
||||
->add('comment', TextareaType::class, [
|
||||
'label' => 'label.comment',
|
||||
'label' => 'label.description',
|
||||
'required' => false,
|
||||
])
|
||||
->add('company', TextType::class, [
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
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;
|
||||
@@ -20,19 +19,12 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
/**
|
||||
* Converts normal select boxes into javascript enhanced versions.
|
||||
*/
|
||||
class EnhancedChoiceTypeExtension extends AbstractTypeExtension
|
||||
final class EnhancedChoiceTypeExtension extends AbstractTypeExtension
|
||||
{
|
||||
public const TYPE_SELECTPICKER = 'selectpicker';
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
* @deprecated since 1.7 will be removed with 2.0
|
||||
*/
|
||||
protected $type = null;
|
||||
|
||||
public function __construct(ThemeConfiguration $configuration)
|
||||
{
|
||||
$this->type = $configuration->getSelectPicker();
|
||||
}
|
||||
public const TYPE_SELECTPICKER = 'selectpicker';
|
||||
|
||||
public static function getExtendedTypes(): iterable
|
||||
{
|
||||
@@ -46,10 +38,6 @@ class EnhancedChoiceTypeExtension extends AbstractTypeExtension
|
||||
*/
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
if ($this->type !== self::TYPE_SELECTPICKER) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($options['selectpicker']) && false === $options['selectpicker']) {
|
||||
return;
|
||||
}
|
||||
|
||||
47
src/Form/ProjectCommentForm.php
Normal file
47
src/Form/ProjectCommentForm.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?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;
|
||||
|
||||
use App\Entity\ProjectComment;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class ProjectCommentForm extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('message', TextareaType::class, [
|
||||
'label' => false,
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => ProjectComment::class,
|
||||
'csrf_protection' => true,
|
||||
'csrf_field_name' => '_token',
|
||||
'csrf_token_id' => 'admin_project_comment',
|
||||
'attr' => [
|
||||
'data-form-event' => 'kimai.projectComment'
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@ class ProjectEditForm extends AbstractType
|
||||
$entry = $options['data'];
|
||||
$id = $entry->getId();
|
||||
|
||||
if ($id !== null) {
|
||||
if (null !== $entry->getCustomer()) {
|
||||
$customer = $entry->getCustomer();
|
||||
$options['currency'] = $customer->getCurrency();
|
||||
}
|
||||
@@ -52,7 +52,7 @@ class ProjectEditForm extends AbstractType
|
||||
],
|
||||
])
|
||||
->add('comment', TextareaType::class, [
|
||||
'label' => 'label.comment',
|
||||
'label' => 'label.description',
|
||||
'required' => false,
|
||||
])
|
||||
->add('orderNumber', TextType::class, [
|
||||
|
||||
Reference in New Issue
Block a user