Compare commits

...
Sign in to create a new pull request.

3 commits

Author SHA1 Message Date
Kevin Adametz
e236e97936 WIP on master: 5fe7789 remove Room Validation 2018-08-23 16:38:38 +02:00
Kevin Adametz
26e4ec2039 index on master: 5fe7789 remove Room Validation 2018-08-23 16:38:38 +02:00
Kevin Adametz
5fe778977c remove Room Validation 2018-08-23 16:38:26 +02:00
6 changed files with 75 additions and 18 deletions

View file

@ -551,6 +551,7 @@
data-st-traveler-index="{{ currentIndex }}"
data-room-index="{{ loop.parent.loop.index }}"
data-room-type="{{ room.vars.value.type }}"
data-room-count="{{ room.vars.value.count }}"
style="display: ; border-bottom:2px solid #ffc926; margin-bottom: 20px; padding-bottom: 10px;">
<div class="col-md-12 col-sm-12 col-xs-12" style="margin-bottom:10px; padding-bottom:10px; border-bottom:1px solid #fff;">
@ -576,9 +577,7 @@
<div class="col-md-3 col-sm-12 col-xs-12">
<div class="form-group" style="margin-top:5px;">
<div class="">
{{ form_field_pho(traveler.sex, 'Geschlecht', {
required: false
}) }}
{{ form_field_pho(traveler.sex, 'Geschlecht') }}
</div>
<div class="help-block with-errors"></div>
</div>

View file

@ -124,6 +124,7 @@ class BookingController extends Controller
$em->flush();
$crmBookingUrl = $this->get('app.booking_exporter')->process($bookingRequest, $travelDate, $bookingPriceInfo);
if (!$crmBookingUrl)
@ -193,13 +194,13 @@ class BookingController extends Controller
]);
}
/* $string = (string) $form->getErrors(true, true);
$string = (string) $form->getErrors(true, true);
var_dump($string);
var_dump( $form->isValid());
var_dump($this->getErrorMessages($form));
die();
*/
return $this->render('default/pages/booking.html.twig', [
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
'page' => $travelProgramPage,

View file

@ -116,29 +116,36 @@ class BookingRequest
*/
public function __construct()
{
$counter = 1;
for($i = 0; $i < 4; ++$i)
{
$this->singleRooms[] = new Room(1);
$this->singleRooms[] = new Room(1, $counter);
$counter++;
}
for($i = 0; $i < 4; ++$i)
{
$this->singleChildRooms[] = new Room(4);
$this->singleChildRooms[] = new Room(4, $counter);
$counter++;
}
for($i = 0; $i < 3; ++$i)
{
$this->doubleRooms[] = new Room(2);
$this->doubleRooms[] = new Room(2, $counter);
$counter++;
}
for($i = 0; $i < 3; ++$i)
{
$this->doubleChildRooms[] = new Room(5);
$this->doubleChildRooms[] = new Room(5, $counter);
$counter++;
}
for($i = 0; $i < 2; ++$i)
{
$this->tripleRooms[] = new Room(3);
$this->tripleRooms[] = new Room(3, $counter);
$counter++;
}
for($i = 0; $i < 2; ++$i)
{
$this->tripleChildRooms[] = new Room(6);
$this->tripleChildRooms[] = new Room(6, $counter);
$counter++;
}
}
@ -164,7 +171,7 @@ class BookingRequest
public function getTravelerCount()
{
$allUsedTravelersCount = 0;
for($i = 0; $i < $this->singleRoomCount; ++$i)
for($i = 0; $i < $this->singleRoomCount; $i++)
{
$allUsedTravelersCount += $this->singleRooms[$i]->getTravelerCount();
}
@ -196,7 +203,7 @@ class BookingRequest
public function getChildrenCount()
{
$allUsedChildrenCount = 0;
for($i = 0; $i < $this->singleRoomCount; ++$i)
for($i = 0; $i < $this->singleRoomCount; $i++)
{
$allUsedChildrenCount += 0;//$this->singleRooms[$i]->getTravelerCount();
}

View file

@ -23,6 +23,8 @@ class Room
private $child = false;
private $count;
/**
* @Assert\Valid
*/
@ -31,8 +33,9 @@ class Room
private $travelerCount;
private $childrenCount;
public function __construct($type)
public function __construct($type, $count)
{
$this->count = $count;
$child = 0;
if($type == 4){
$type = 1;
@ -99,6 +102,22 @@ class Room
$this->child = $child;
}
/**
* @return int
*/
public function getCount()
{
return $this->count;
}
/**
* @param int $count
*/
public function setCount($count)
{
$this->count = $count;
}
/**
* @return Traveler[]
*/

View file

@ -144,15 +144,19 @@ $(document).ready(function() {
var counter = 1;
var $offset = 1;
console.log(allTravelersCount);
//single
if(singleTravelerCount > 0)
{
console.log(singleTravelerCount);
for(var i = $offset; i <= singleTravelerCount; i++)
{
var travelerSelector = '.st-traveler-' + i;
var roomIndexSelector = travelerSelector+' .st-traveller-index';
console.log($(travelerSelector));
//var currentRoomIndex = $(travelerSelector).attr("data-room-index");
$(travelerSelector).show().find('input,select').prop('required', true);
$(travelerSelector).show(); //.find('input,select').prop('required', true);
$(roomIndexSelector).text(counter + ".) Reiseteilnehmer | Einzelzimmer | 1. Erwachsender");
counter ++;
}

View file

@ -39,15 +39,35 @@ class BookingRequestValidator extends ConstraintValidator
public function validate($bookingRequest, Constraint $constraint)
{
for($i = 1; $i < $bookingRequest->getSingleRoomCount(); ++$i)
/*var_dump($bookingRequest->getSingleRoomCount());
echo "<br>-<br>";
$bs = $bookingRequest->getSingleRooms();
foreach ($bs as $b ){
var_dump($b->getCount());
echo "<br>";
var_dump($b->getTravelerCount());
echo "<br>-<br>";
}*/
/*
for($i = 0; $i < $bookingRequest->getSingleRoomCount(); ++$i)
{
//echo "<br>check 1<br>";
$a = $bookingRequest->getSingleRooms()[$i];
var_dump($a->getCount());
var_dump($i);
$this->context->getValidator()->inContext($this->context)
->atPath('rooms['.$i.']')
->validate($bookingRequest->getSingleRooms()[$i])
;
}
for($i = 1; $i < $bookingRequest->getSingleRoomChildCount(); ++$i)
{
//echo "<br>check 2<br>";
$a = $bookingRequest->getSingleChildRooms()[$i];
//var_dump($a->getType());
$this->context->getValidator()->inContext($this->context)
->atPath('rooms['.($i+3).']')
->validate($bookingRequest->getSingleChildRooms()[$i])
@ -55,6 +75,7 @@ class BookingRequestValidator extends ConstraintValidator
}
for($i = 1; $i < $bookingRequest->getDoubleRoomCount(); ++$i)
{
//echo "<br>check 3<br>";
$this->context->getValidator()->inContext($this->context)
->atPath('rooms['.($i+7).']')
->validate($bookingRequest->getDoubleRooms()[$i])
@ -63,14 +84,15 @@ class BookingRequestValidator extends ConstraintValidator
for($i = 1; $i < $bookingRequest->getDoubleRoomChildCount(); ++$i)
{
//echo "<br>check 4<br>";
$this->context->getValidator()->inContext($this->context)
->atPath('rooms['.($i+10).']')
->validate($bookingRequest->getDoubleChildRooms()[$i])
;
}
for($i = 1; $i < $bookingRequest->getTripleRoomCount(); ++$i)
{
//echo "<br>check 5<br>";
$this->context->getValidator()->inContext($this->context)
->atPath('rooms['.($i + 13).']')
->validate($bookingRequest->getTripleRooms()[$i])
@ -78,10 +100,15 @@ class BookingRequestValidator extends ConstraintValidator
}
for($i = 1; $i < $bookingRequest->getTripleRoomChildCount(); ++$i)
{
//echo "<br>check 6<br>";
$this->context->getValidator()->inContext($this->context)
->atPath('rooms['.($i + 15).']')
->validate($bookingRequest->getTripleChildRooms()[$i])
;
}
die();
*/
}
}