#1480 Frontent
git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3473 f459cee4-fb09-11de-96c3-f9c5f16c3c76
This commit is contained in:
parent
8f7f2c03db
commit
6241856464
10 changed files with 160 additions and 25 deletions
|
|
@ -543,6 +543,12 @@
|
|||
</div>
|
||||
<div class="col-md-12 col-sm-12 col-xs-12">
|
||||
|
||||
<div class="hidden">
|
||||
{% for country in travel_program.countries %}
|
||||
<input type="hidden" name="travel_program_countries_id[]" value="{{ country.id }}">
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div class="st-travelers">
|
||||
{% set currentIndex = 0 %}
|
||||
{% for room in form.rooms %}
|
||||
|
|
@ -607,7 +613,7 @@
|
|||
|
||||
<div class="col-md-offset-3 col-md-4 col-sm-12 col-xs-12">
|
||||
<div class="form-group" style="margin-top:5px;">
|
||||
<div class=" nationality_select" data-toggle="#nationality_entry_{{ currentIndex }}">
|
||||
<div class="nationality_select" data-toggle="#nationality_entry_{{ currentIndex }}">
|
||||
{{ form_field_pho(traveler.nationality, 'Nationalität') }}
|
||||
</div>
|
||||
<div class="help-block with-errors"></div>
|
||||
|
|
@ -633,11 +639,8 @@
|
|||
<h3><span>Einreise-, Visabestimmungen und gesundheitspolizeilichen Vorschriften</span><i class="indicator pull-right icon-plus"></i></h3>
|
||||
</a>
|
||||
<div id="collapse_entry_{{ currentIndex }}" class="panel-collapse collapse acc_nationality_panel" aria-expanded="true" style="">
|
||||
<div class="panel-body">
|
||||
{% for country in travel_program.countries %}
|
||||
<h2>{{ country.name }}</h2>
|
||||
{{ country.entryRequirements|raw|nl2br }}
|
||||
{% endfor %}
|
||||
<div class="panel-body set_nationality_country_text">
|
||||
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -663,7 +666,7 @@
|
|||
|
||||
</div> <!-- st trav -->
|
||||
<h2>Hinweis</h2>
|
||||
<p>Sofern Sie nicht oder nicht ausschließlich nur die deutsche Staatsbürgerschaft besitzen, können Sie die Reise nicht buchen,
|
||||
<p>Sofern Sie nicht oder nicht ausschließlich nur die deutsche, österreichische oder schweizerische Staatsbürgerschaft besitzen, können Sie die Reise nicht buchen,
|
||||
da wir Sie vorher u.a. über die Einreisebestimmungen für Ihre individuelle Staatsbürgerschaft informieren müssen.
|
||||
Bitte nehmen Sie vor einer Buchung Kontakt mit uns auf, damit Sie nach Erhalt der Informationen entscheiden können, ob Sie die Reise buchen möchten.</p>
|
||||
</div> <!-- col -->
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ use AppBundle\Entity\TravelPeriodPrice;
|
|||
use AppBundle\Entity\TravelPeriodPriceType;
|
||||
use AppBundle\Form\BookingRequestType;
|
||||
use AppBundle\Util;
|
||||
use Doctrine\ORM\Query;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
|
@ -55,9 +56,34 @@ class BookingController extends Controller
|
|||
|
||||
return $errors;
|
||||
}
|
||||
public function getEntityManager()
|
||||
{
|
||||
return $this->getDoctrine()->getManager();
|
||||
}
|
||||
|
||||
public function indexAction(Page $travelProgramPage, $action, Request $request)
|
||||
{
|
||||
if($action == '/show_nationality_country_text')
|
||||
{
|
||||
$ret = "";
|
||||
$nationality_id = $request->request->get('nationality_id');
|
||||
$country_ids = $request->request->get('country_ids');
|
||||
foreach ($country_ids as $country_id){
|
||||
|
||||
$country = $this->getEntityManager()->getRepository('AppBundle:TravelCountry')
|
||||
->findOneBy(['id' => $country_id]);
|
||||
$req = $this->getDoctrine()->getRepository('AppBundle:TravelNationalityRequirement')->findOneByCountryAndNationality($country_id, $nationality_id);
|
||||
if($req && $country){
|
||||
$ret .= "<h2>".$country->getName()."</h2>";
|
||||
$ret .= "<p>".$req->getText()."</p>";
|
||||
$ret .= "<hr>";
|
||||
}
|
||||
}
|
||||
echo $ret;
|
||||
die();
|
||||
|
||||
}
|
||||
|
||||
$travelProgram = $travelProgramPage->getTravelProgram();
|
||||
if (!$request->query->has('nr'))
|
||||
{
|
||||
|
|
@ -90,6 +116,12 @@ class BookingController extends Controller
|
|||
throw $this->createNotFoundException();
|
||||
}
|
||||
|
||||
/**/
|
||||
$nationalities = $this->getDoctrine()
|
||||
->getRepository('AppBundle:TravelNationality')
|
||||
->createQueryBuilder('n')
|
||||
->getQuery()->getResult(Query::HYDRATE_ARRAY);;
|
||||
|
||||
|
||||
/** @var BookingRequest $bookingRequest */
|
||||
$bookingRequest = new BookingRequest();
|
||||
|
|
@ -99,7 +131,8 @@ class BookingController extends Controller
|
|||
}
|
||||
$form = $this->createForm(BookingRequestType::class, $bookingRequest, [
|
||||
'travel_date' => $travelDate,
|
||||
'travel_program' => $travelProgram
|
||||
'travel_program' => $travelProgram,
|
||||
'nationalities' => $nationalities
|
||||
]);
|
||||
if ($request->getMethod() == 'POST')
|
||||
{
|
||||
|
|
@ -110,6 +143,8 @@ class BookingController extends Controller
|
|||
$bookingPriceInfo = [];
|
||||
$totalPrice = $this->calculatePrice($travelDate, $bookingRequest, $travelProgram->getCategory()->getId(), $travelProgram->getDepositPercent(), $htmlSummary, $bookingPriceInfo);
|
||||
|
||||
|
||||
|
||||
if ($action == '/buchen')
|
||||
{
|
||||
$breadcrumbEntries = Util::createBreadcrumb($travelProgramPage);
|
||||
|
|
|
|||
16
trunk/src/AppBundle/Entity/TravelNationalityRepository.php
Normal file
16
trunk/src/AppBundle/Entity/TravelNationalityRepository.php
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
/**
|
||||
* TravelNationalityRepository
|
||||
*/
|
||||
|
||||
class TravelNationalityRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
|
||||
public function getAllEntries()
|
||||
{
|
||||
return $this->createQueryBuilder('n')->select('n')->getQuery()->execute();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
/**
|
||||
* TravelNationalityRequirementRepository
|
||||
*/
|
||||
|
||||
class TravelNationalityRequirementRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
|
||||
public function findOneByCountryAndNationality($travel_country_id, $travel_nationality_id)
|
||||
{
|
||||
$qb = $this->createQueryBuilder('nr');
|
||||
return $qb
|
||||
->where('nr.travelCountryId = '.$travel_country_id)
|
||||
->andWhere('nr.travelNationalityId = '.$travel_nationality_id)
|
||||
->setMaxResults(1)
|
||||
->getQuery()
|
||||
->getOneOrNullResult();
|
||||
}
|
||||
}
|
||||
|
|
@ -55,6 +55,13 @@ class Traveler
|
|||
*/
|
||||
private $child = false;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->nationalities = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
}
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
|
|
@ -141,6 +148,7 @@ class Traveler
|
|||
$this->nationality = $nationality;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -107,11 +107,14 @@ class BookingRequestType extends AbstractType
|
|||
$resolver->setDefaults([
|
||||
'travel_date' => null,
|
||||
'travel_program' => null,
|
||||
'nationalities' => null,
|
||||
'data_class' => 'AppBundle\Entity\BookingRequest',
|
||||
]);
|
||||
|
||||
$resolver->setAllowedTypes('travel_date', ['AppBundle\Entity\TravelDate']);
|
||||
$resolver->setAllowedTypes('travel_program', ['AppBundle\Entity\TravelProgram']);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -125,6 +128,8 @@ class BookingRequestType extends AbstractType
|
|||
/* @var TravelProgram $travelProgram */
|
||||
$travelProgram = $options['travel_program'];
|
||||
|
||||
$nationalities = $options['nationalities'];
|
||||
|
||||
$builder
|
||||
->add('salutation', ChoiceType::class, [
|
||||
//'placeholder' => 'Anrede (Bitte wählen) *',
|
||||
|
|
@ -161,6 +166,9 @@ class BookingRequestType extends AbstractType
|
|||
])
|
||||
->add('rooms', CollectionType::class, [
|
||||
'entry_type' => RoomType::class,
|
||||
'entry_options' => array(
|
||||
'nationalities' =>$nationalities,
|
||||
),
|
||||
'by_reference' => false,
|
||||
])
|
||||
->add('notes', TextareaType::class, ['required' => false])
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ class RoomType extends AbstractType
|
|||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'nationalities' => null,
|
||||
'data_class' => 'AppBundle\Entity\Room'
|
||||
));
|
||||
}
|
||||
|
|
@ -39,9 +40,14 @@ class RoomType extends AbstractType
|
|||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$nationalities = $options['nationalities'];
|
||||
|
||||
$builder
|
||||
->add('travelers', CollectionType::class, [
|
||||
'entry_type' => TravelerType::class,
|
||||
'entry_options' => array(
|
||||
'nationalities' =>$nationalities,
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -7,6 +7,10 @@
|
|||
namespace AppBundle\Form;
|
||||
|
||||
use AppBundle\Entity\Traveler;
|
||||
use AppBundle\Entity\TravelNationality;
|
||||
use AppBundle\Entity\TravelNationalityRepository;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
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;
|
||||
|
|
@ -24,10 +28,8 @@ class TravelerType extends AbstractType
|
|||
'weiblich' => Traveler::FEMALE
|
||||
];
|
||||
|
||||
public static $NATIONALITY_CHOICES = [
|
||||
'Nationalität (Bitte wählen)' => '',
|
||||
'deutsch' => 1,
|
||||
];
|
||||
public static $NATIONALITY_CHOICES = [];
|
||||
|
||||
|
||||
/**
|
||||
* @param OptionsResolver $resolver
|
||||
|
|
@ -35,8 +37,10 @@ class TravelerType extends AbstractType
|
|||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'nationalities' => null,
|
||||
'data_class' => 'AppBundle\Entity\Traveler'
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -45,6 +49,18 @@ class TravelerType extends AbstractType
|
|||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
|
||||
if(!count(self::$NATIONALITY_CHOICES)){
|
||||
$nationalities = $options['nationalities'];
|
||||
self::$NATIONALITY_CHOICES = [
|
||||
'Nationalität (Bitte wählen)' => '',
|
||||
];
|
||||
foreach ($nationalities as $nationality){
|
||||
self::$NATIONALITY_CHOICES[$nationality['name']] = $nationality['id'];
|
||||
}
|
||||
}
|
||||
|
||||
/* @var TravelProgram $travelProgram */
|
||||
$builder
|
||||
->add('sex', ChoiceType::class, [
|
||||
//'placeholder' => 'Geschlecht (Bitte wählen) *',
|
||||
|
|
@ -57,6 +73,7 @@ class TravelerType extends AbstractType
|
|||
->add('firstName')
|
||||
->add('lastName')
|
||||
->add('birthDate')
|
||||
|
||||
->add('nationality', ChoiceType::class, [
|
||||
'choices' => self::$NATIONALITY_CHOICES,
|
||||
'constraints' => [
|
||||
|
|
@ -69,11 +86,7 @@ class TravelerType extends AbstractType
|
|||
|
||||
|
||||
;
|
||||
/*
|
||||
, StDateType::class, [
|
||||
'format' => 'dd.MM.yyyy'
|
||||
]
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ class KernelControllerListener
|
|||
$request->attributes->set('page', $node);
|
||||
|
||||
if ($node->getTravelProgram() != null && (
|
||||
$restOfPath == '/buchen' || $restOfPath == '/berechne-gesamtpreis'))
|
||||
$restOfPath == '/buchen' || $restOfPath == '/berechne-gesamtpreis' || $restOfPath == '/show_nationality_country_text'))
|
||||
{
|
||||
// Special case: Booking actions
|
||||
$request->attributes->set('travelProgramPage', $node);
|
||||
|
|
|
|||
|
|
@ -63,16 +63,40 @@ $(document).ready(function() {
|
|||
$('#no_flight_time').show();
|
||||
}
|
||||
});
|
||||
var toggle_first = false;
|
||||
var toggle_first= [];
|
||||
|
||||
function updateNationality(ele){
|
||||
var obj = ele.parents('.nationality_select').data('toggle');
|
||||
if(ele.val()){
|
||||
$(obj).show('slow');
|
||||
if(!toggle_first){
|
||||
$(obj).find('.accordion-toggle').click();
|
||||
toggle_first = true;
|
||||
var values = $("input[name='travel_program_countries_id[]']").map(function(){return $(this).val();}).get();
|
||||
|
||||
var tmp = location.href.split('?');
|
||||
var tmp2 = tmp[0].split('/');
|
||||
tmp2.pop();
|
||||
var url = tmp2.join('/') + '/show_nationality_country_text';
|
||||
if (tmp[1])
|
||||
{
|
||||
url += '?'+ tmp[1];
|
||||
}
|
||||
|
||||
var data = {nationality_id : ele.val(), country_ids: values};
|
||||
|
||||
$.ajax({
|
||||
url:url,
|
||||
type: "POST",
|
||||
data: data,
|
||||
}).then(function(r) {
|
||||
$(obj).find('.set_nationality_country_text').html(r);
|
||||
$(obj).show('slow');
|
||||
if(!toggle_first[ele.val()]){
|
||||
$(obj).find('.accordion-toggle').click();
|
||||
toggle_first[ele.val()] = true;
|
||||
}
|
||||
|
||||
|
||||
}, function() {
|
||||
summary$.html('Aufgrund eines Fehlers konnte kein Angebot ermittelt werden.');
|
||||
});
|
||||
}else{
|
||||
$(obj).hide();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue