added basic invoice rendering #97 #93 (#99)

This commit is contained in:
Kevin Papst
2018-01-21 22:50:46 +01:00
committed by GitHub
parent 9a161b8fd9
commit 4cbc5391c0
73 changed files with 2986 additions and 918 deletions

View File

@@ -14,7 +14,6 @@ namespace App\Form\Toolbar;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use App\Form\Type\ActivityType;
use App\Repository\Query\TimesheetQuery;
/**
@@ -22,7 +21,7 @@ use App\Repository\Query\TimesheetQuery;
*
* @author Kevin Papst <kevin@kevinpapst.de>
*/
class TimesheetToolbarForm extends ActivityToolbarForm
class TimesheetToolbarForm extends AbstractToolbarForm
{
/**
@@ -30,42 +29,26 @@ class TimesheetToolbarForm extends ActivityToolbarForm
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('state', ChoiceType::class, [
'label' => 'label.entryState',
'choices' => [
'entryState.all' => TimesheetQuery::STATE_ALL,
'entryState.running' => TimesheetQuery::STATE_RUNNING,
'entryState.stopped' => TimesheetQuery::STATE_STOPPED
],
])
;
parent::buildForm($builder, $options);
$this->addActivityChoice($builder, $options['data']);
$builder->remove('visibility');
$this->addTimesheetStateChoice($builder);
$this->addPageSizeChoice($builder);
$this->addCustomerChoice($builder);
$this->addProjectChoice($builder);
$this->addActivityChoice($builder);
}
/**
* @param FormBuilderInterface $builder
* @param TimesheetQuery $query
*/
protected function addActivityChoice(FormBuilderInterface $builder, TimesheetQuery $query)
protected function addTimesheetStateChoice(FormBuilderInterface $builder)
{
if ($query->getProject() === null) {
return;
}
$choices = [];
foreach ($query->getProject()->getActivities() as $activity) {
$choices[] = $activity;
}
$builder
->add('activity', ActivityType::class, [
'required' => false,
'choices' => $choices,
]);
$builder->add('state', ChoiceType::class, [
'label' => 'label.entryState',
'choices' => [
'entryState.all' => TimesheetQuery::STATE_ALL,
'entryState.running' => TimesheetQuery::STATE_RUNNING,
'entryState.stopped' => TimesheetQuery::STATE_STOPPED
],
]);
}
/**