added toolbar to customer screen #28 (#49)

* fixed filter query #28
* fixed annotation #28
* merge message files #28
* added page size type #28
* added visibility type #28
* added filter toolbar to customer screen #28
This commit is contained in:
Kevin Papst
2018-01-07 21:42:27 +01:00
committed by GitHub
parent c5c9f37de7
commit 79e87ecdbe
17 changed files with 289 additions and 87 deletions

View File

@@ -11,7 +11,7 @@
namespace TimesheetBundle\Form;
use AppBundle\Form\Type\YesNoType;
use AppBundle\Form\Type\VisibilityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
@@ -48,7 +48,7 @@ class ActivityEditForm extends AbstractType
'label' => 'label.project',
])
// boolean
->add('visible', YesNoType::class, [
->add('visible', VisibilityType::class, [
'label' => 'label.visible',
])
;

View File

@@ -11,7 +11,7 @@
namespace TimesheetBundle\Form;
use AppBundle\Form\Type\YesNoType;
use AppBundle\Form\Type\VisibilityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CountryType;
use Symfony\Component\Form\Extension\Core\Type\CurrencyType;
@@ -61,7 +61,7 @@ class CustomerEditForm extends AbstractType
])
*/
// boolean
->add('visible', YesNoType::class, [
->add('visible', VisibilityType::class, [
'label' => 'label.visible',
])
// string - length 255

View File

@@ -0,0 +1,67 @@
<?php
/*
* This file is part of the Kimai package.
*
* (c) Kevin Papst <kevin@kevinpapst.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace TimesheetBundle\Form;
use AppBundle\Form\Type\PageSizeType;
use AppBundle\Form\Type\VisibilityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use TimesheetBundle\Repository\Query\CustomerQuery;
/**
* Defines the form used for filtering the customer.
*
* @author Kevin Papst <kevin@kevinpapst.de>
*/
class CustomerToolbarForm extends AbstractType
{
/**
* Dirty hack to enable easy handling of GET form in controller and javascript.
*Cleans up the name of all form elents (and unfortunately of the form itself).
*
* @return null|string
*/
public function getBlockPrefix()
{
return '';
}
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
/** @var CustomerQuery $query */
$query = $options['data'];
$builder
->add('pageSize', PageSizeType::class, [
'required' => false,
])
->add('visibility', VisibilityType::class, [
'required' => false,
])
;
}
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => CustomerQuery::class,
'csrf_protection' => false,
]);
}
}

View File

@@ -11,7 +11,7 @@
namespace TimesheetBundle\Form;
use AppBundle\Form\Type\YesNoType;
use AppBundle\Form\Type\VisibilityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
@@ -49,7 +49,7 @@ class ProjectEditForm extends AbstractType
'label' => 'label.customer',
])
// boolean
->add('visible', YesNoType::class, [
->add('visible', VisibilityType::class, [
'label' => 'label.visible',
])
// string

View File

@@ -11,6 +11,7 @@
namespace TimesheetBundle\Form;
use AppBundle\Form\Type\PageSizeType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
@@ -47,9 +48,7 @@ class TimesheetToolbarForm extends AbstractType
$query = $options['data'];
$builder
->add('pageSize', ChoiceType::class, [
'label' => 'label.pageSize',
'choices' => [10 => 10, 25 => 25, 50 => 50, 75 => 75, 100 => 100],
->add('pageSize', PageSizeType::class, [
'required' => false,
])
->add('state', ChoiceType::class, [