diff --git a/trunk/app/Resources/views/default/pages/booking.html.twig b/trunk/app/Resources/views/default/pages/booking.html.twig index 064292a9..0df08906 100644 --- a/trunk/app/Resources/views/default/pages/booking.html.twig +++ b/trunk/app/Resources/views/default/pages/booking.html.twig @@ -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;">
@@ -576,9 +577,7 @@
- {{ form_field_pho(traveler.sex, 'Geschlecht', { - required: false - }) }} + {{ form_field_pho(traveler.sex, 'Geschlecht') }}
diff --git a/trunk/src/AppBundle/Controller/BookingController.php b/trunk/src/AppBundle/Controller/BookingController.php index 515e6c75..cd9325ab 100644 --- a/trunk/src/AppBundle/Controller/BookingController.php +++ b/trunk/src/AppBundle/Controller/BookingController.php @@ -123,6 +123,7 @@ class BookingController extends Controller $em->persist($booking); $em->flush(); + $crmBookingUrl = $this->get('app.booking_exporter')->process($bookingRequest, $travelDate, $bookingPriceInfo); @@ -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, diff --git a/trunk/src/AppBundle/Entity/BookingRequest.php b/trunk/src/AppBundle/Entity/BookingRequest.php index 36efe3c3..2af1af32 100644 --- a/trunk/src/AppBundle/Entity/BookingRequest.php +++ b/trunk/src/AppBundle/Entity/BookingRequest.php @@ -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(); } diff --git a/trunk/src/AppBundle/Entity/Room.php b/trunk/src/AppBundle/Entity/Room.php index 7eee05f4..d3f8dd14 100644 --- a/trunk/src/AppBundle/Entity/Room.php +++ b/trunk/src/AppBundle/Entity/Room.php @@ -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[] */ diff --git a/trunk/src/AppBundle/Resources/public/js/booking.js b/trunk/src/AppBundle/Resources/public/js/booking.js index 74a00fb9..878f7de5 100644 --- a/trunk/src/AppBundle/Resources/public/js/booking.js +++ b/trunk/src/AppBundle/Resources/public/js/booking.js @@ -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 ++; }