added start and stop entries

enhanced administration of activities/projects/customers
added navbar for active records and recent activities
added edit timesheet entry form
added translation packages for errors and flashmessages
upgraded composer packages
This commit is contained in:
Kevin Papst
2018-01-04 14:06:07 +01:00
parent 3f429a3663
commit c9c82e767f
50 changed files with 973 additions and 405 deletions

View File

@@ -14,6 +14,7 @@ namespace TimesheetBundle\Form;
use AppBundle\Form\Type\YesNoType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CountryType;
use Symfony\Component\Form\Extension\Core\Type\CurrencyType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\PercentType;
use Symfony\Component\Form\Extension\Core\Type\TelType;
@@ -83,10 +84,14 @@ class CustomerEditForm extends AbstractType
'label' => 'label.address',
'required' => false,
])
// TODO string - length 2
// string - length 2
->add('country', CountryType::class, [
'label' => 'label.country',
])
// string - length 3
->add('currency', CurrencyType::class, [
'label' => 'label.currency',
])
// string - length 255
->add('phone', TelType::class, [
'label' => 'label.phone',

View File

@@ -12,18 +12,18 @@
namespace TimesheetBundle\Form;
use AppBundle\Form\Type\YesNoType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Intl\Intl;
use Symfony\Component\OptionsResolver\OptionsResolver;
use TimesheetBundle\Entity\Customer;
use TimesheetBundle\Entity\Project;
use TimesheetBundle\Form\Type\CustomerType;
/**
* Defines the form used to manipulate Projects.
* Defines the form used to edit Projects.
*
* @author Kevin Papst <kevin@kevinpapst.de>
*/
@@ -37,7 +37,7 @@ class ProjectEditForm extends AbstractType
{
$builder
// string - length 255
->add('name', null, [
->add('name', TextType::class, [
'label' => 'label.name',
])
// text
@@ -57,7 +57,6 @@ class ProjectEditForm extends AbstractType
'label' => 'label.budget',
'currency' => $builder->getOption('currency'),
])
// FIXME add budget
// do not allow activity selection as this causes headaches:
// 1. it is a bad UX
// 2. what should happen if they are detached?
@@ -82,7 +81,7 @@ class ProjectEditForm extends AbstractType
'csrf_protection' => true,
'csrf_field_name' => '_token',
'csrf_token_id' => 'admin_activity_edit',
'currency' => 'EUR,'
'currency' => Customer::DEFAULT_CURRENCY,
]);
}
}

View File

@@ -0,0 +1,88 @@
<?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 Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use TimesheetBundle\Entity\Customer;
use TimesheetBundle\Entity\Timesheet;
/**
* Defines the form used to manipulate Timesheet entries.
*
* @author Kevin Papst <kevin@kevinpapst.de>
*/
class TimesheetEditForm extends AbstractType
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
// datetime
->add('begin', DateTimeType::class, [
'label' => 'label.begin',
'date_widget' => 'single_text',
])
// datetime
->add('end', DateTimeType::class, [
'label' => 'label.end',
'date_widget' => 'single_text',
'required' => false,
])
// integer
/*
->add('duration', RangeType::class, [
'label' => 'label.duration',
])
// User
->add('user', UserType::class, [
'label' => 'label.user',
])
// Activity
->add('activity', ActivityType::class, [
'label' => 'label.activity',
])
*/
// customer
->add('description', TextareaType::class, [
'label' => 'label.description',
'required' => false,
])
// string
->add('rate', MoneyType::class, [
'label' => 'label.rate',
'currency' => $builder->getOption('currency'),
])
;
}
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => Timesheet::class,
'csrf_protection' => true,
'csrf_field_name' => '_token',
'csrf_token_id' => 'admin_timsheet_edit',
'currency' => Customer::DEFAULT_CURRENCY,
]);
}
}