* Fertigstellung Buchungsformular (#1321) (SternTours-CRM-API-Anbindung, Mailversand, Validierung, Dynamische Preisberechnung, Persistierung von Buchungsinformationen)
* Fehler bei der Preisberechnung behoben * Farbschema geändert (Kevin Adametz) git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3289 f459cee4-fb09-11de-96c3-f9c5f16c3c76
This commit is contained in:
parent
dde3b91724
commit
3a28866cd2
36 changed files with 2200 additions and 268 deletions
|
|
@ -7,7 +7,9 @@
|
|||
namespace AppBundle\Form;
|
||||
|
||||
|
||||
use AppBundle\Entity\BookingRequest;
|
||||
use AppBundle\Entity\TravelDate;
|
||||
use AppBundle\Entity\Traveler;
|
||||
use AppBundle\Entity\TravelProgram;
|
||||
use AppBundle\Util;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
|
@ -15,7 +17,12 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
|||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormEvent;
|
||||
use Symfony\Component\Form\FormEvents;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Validator\Constraints\Choice;
|
||||
use Symfony\Component\Validator\Constraints\NotNull;
|
||||
|
|
@ -26,7 +33,20 @@ class BookingRequestType extends AbstractType
|
|||
'1 Person' => 1,
|
||||
'2 Personen' => 2,
|
||||
'3 Personen' => 3,
|
||||
'4 Personen' => 4
|
||||
'4 Personen' => 4,
|
||||
];
|
||||
|
||||
public static $NATION_CHOICES = [
|
||||
'Deutschland' => 27,
|
||||
'Österreich' => 34,
|
||||
'Schweiz' => 181,
|
||||
'Niederlande' => 196,
|
||||
'Sonstiges' => 197,
|
||||
];
|
||||
|
||||
public static $SALUTATION_CHOICES = [
|
||||
'Herr' => BookingRequest::MR,
|
||||
'Frau' => BookingRequest::MRS
|
||||
];
|
||||
|
||||
/*
|
||||
|
|
@ -47,7 +67,8 @@ class BookingRequestType extends AbstractType
|
|||
{
|
||||
$resolver->setDefaults([
|
||||
'travel_date' => null,
|
||||
'travel_program' => null
|
||||
'travel_program' => null,
|
||||
'data_class' => 'AppBundle\Entity\BookingRequest',
|
||||
]);
|
||||
|
||||
$resolver->setAllowedTypes('travel_date', ['AppBundle\Entity\TravelDate']);
|
||||
|
|
@ -65,14 +86,46 @@ class BookingRequestType extends AbstractType
|
|||
/* @var TravelProgram $travelProgram */
|
||||
$travelProgram = $options['travel_program'];
|
||||
|
||||
$builder
|
||||
->add('salutation', ChoiceType::class, [
|
||||
'placeholder' => 'Anrede (Bitte wählen) *',
|
||||
'choices' => self::$SALUTATION_CHOICES,
|
||||
'constraints' => [
|
||||
new NotNull(),
|
||||
new Choice(['choices' => self::$SALUTATION_CHOICES])
|
||||
]
|
||||
])
|
||||
->add('firstName')
|
||||
->add('lastName')
|
||||
->add('streetAddress')
|
||||
->add('zipCode')
|
||||
->add('city')
|
||||
->add('nation', ChoiceType::class, [
|
||||
'choices' => self::$NATION_CHOICES,
|
||||
'constraints' => [
|
||||
new NotNull(),
|
||||
new Choice(['choices' => self::$NATION_CHOICES])
|
||||
]
|
||||
])
|
||||
->add('phone')
|
||||
->add('fax')
|
||||
->add('email')
|
||||
->add('travelers', CollectionType::class, [
|
||||
'entry_type' => TravelerType::class,
|
||||
'by_reference' => false,
|
||||
])
|
||||
->add('notes', TextareaType::class, ['required' => false])
|
||||
->add('acceptTerms', CheckboxType::class, ['required' => true])
|
||||
;
|
||||
|
||||
$builder->add('departure', EntityType::class, [
|
||||
'placeholder' => 'Abflugort (Bitte wählen) *',
|
||||
'class' => 'AppBundle\Entity\TravelDeparturePoint',
|
||||
'choices' => $travelDate->getDepartures(),
|
||||
'constraints' => [
|
||||
new NotNull(),
|
||||
new Choice([
|
||||
'choices' => $travelDate->getDepartures(),
|
||||
'multiple' => true
|
||||
'choices' => $travelDate->getDepartures()
|
||||
]
|
||||
)]
|
||||
]);
|
||||
|
|
@ -84,7 +137,6 @@ class BookingRequestType extends AbstractType
|
|||
)]
|
||||
]);
|
||||
|
||||
|
||||
$insuranceChoices = [];
|
||||
if ($travelProgram->getInsurance1())
|
||||
{
|
||||
|
|
|
|||
60
trunk/src/AppBundle/Form/TravelerType.php
Normal file
60
trunk/src/AppBundle/Form/TravelerType.php
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Ulrich Hecht <ulrich.hecht@hecht-software.de>
|
||||
* @date 02/10/2017
|
||||
*/
|
||||
|
||||
namespace AppBundle\Form;
|
||||
|
||||
use AppBundle\Entity\Traveler;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Validator\Constraints\Choice;
|
||||
use Symfony\Component\Validator\Constraints\NotNull;
|
||||
|
||||
class TravelerType extends AbstractType
|
||||
{
|
||||
public static $SEX_CHOICES = [
|
||||
'männlich' => Traveler::MALE,
|
||||
'weiblich' => Traveler::FEMALE
|
||||
];
|
||||
|
||||
/**
|
||||
* @param OptionsResolver $resolver
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => 'AppBundle\Entity\Traveler'
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FormBuilderInterface $builder
|
||||
* @param array $options
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('sex', ChoiceType::class, [
|
||||
'placeholder' => 'Geschlecht (Bitte wählen) *',
|
||||
'choices' => self::$SEX_CHOICES,
|
||||
'constraints' => [
|
||||
new Choice(['choices' => self::$SEX_CHOICES])
|
||||
],
|
||||
'required' => true,
|
||||
])
|
||||
->add('firstName')
|
||||
->add('lastName')
|
||||
->add('birthDate', DateType::class, [
|
||||
'widget' => 'single_text',
|
||||
'format' => 'dd.MM.yyyy',
|
||||
'required' => true,
|
||||
])
|
||||
;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue