detail pages for customers and projects (#1371)

This commit is contained in:
Kevin Papst
2020-01-16 16:25:28 +01:00
committed by GitHub
parent 28c5357f11
commit 6a44dbfe83
131 changed files with 3055 additions and 1742 deletions

View File

@@ -59,7 +59,7 @@ class ActivityEditForm extends AbstractType
],
])
->add('comment', TextareaType::class, [
'label' => 'label.comment',
'label' => 'label.description',
'required' => false,
])
;

View 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'
],
]);
}
}

View File

@@ -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, [

View File

@@ -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;
}

View 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'
],
]);
}
}

View File

@@ -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, [