- {# #TODO
-
+
Druckversion
- #}
{{ travel_program.title }}
diff --git a/trunk/app/config/config.yml b/trunk/app/config/config.yml
index 22400760..a2329225 100644
--- a/trunk/app/config/config.yml
+++ b/trunk/app/config/config.yml
@@ -86,9 +86,18 @@ assetic:
use_controller: '%kernel.debug%'
filters:
cssrewrite: ~
-
+ assets:
+ headerLogo:
+ inputs:
+ - '@AppBundle/Resources/public/images/wlogo.png'
+ footerText:
+ inputs:
+ - '@AppBundle/Resources/public/images/footer.svg'
stof_doctrine_extensions:
default_locale: de_DE
orm:
default:
- tree: true
\ No newline at end of file
+ tree: true
+
+white_october_tcpdf:
+ class: 'AppBundle\Pdf'
\ No newline at end of file
diff --git a/trunk/app/config/services.yml b/trunk/app/config/services.yml
index b28fda83..7c0ff2de 100644
--- a/trunk/app/config/services.yml
+++ b/trunk/app/config/services.yml
@@ -44,4 +44,10 @@ services:
app.keyword_service:
class: AppBundle\Service\KeywordService
arguments:
- - '@doctrine.orm.entity_manager'
\ No newline at end of file
+ - '@doctrine.orm.entity_manager'
+
+ app.pdf:
+ class: AppBundle\Pdf
+ arguments:
+ - '%kernel.root_dir%'
+ - '@assetic.asset_manager'
\ No newline at end of file
diff --git a/trunk/composer.json b/trunk/composer.json
index 59c47cd5..a58f2587 100644
--- a/trunk/composer.json
+++ b/trunk/composer.json
@@ -26,7 +26,8 @@
"symfony/assetic-bundle": "^2.8",
"stof/doctrine-extensions-bundle": "^1.2",
"doctrine/doctrine-migrations-bundle": "^1.2",
- "twig/twig": "^2.0"
+ "twig/twig": "^2.0",
+ "whiteoctober/tcpdf-bundle": "^1.0"
},
"require-dev": {
"sensio/generator-bundle": "^3.0",
diff --git a/trunk/composer.lock b/trunk/composer.lock
index dc814362..41727028 100644
--- a/trunk/composer.lock
+++ b/trunk/composer.lock
@@ -4,8 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "hash": "cafcb1290bf2f23646f9d7c96c217f14",
- "content-hash": "602fab2a074b1ea2fe86866aa42ba50f",
+ "content-hash": "b22f213c1e171369413d747296060a39",
"packages": [
{
"name": "behat/transliterator",
@@ -45,7 +44,7 @@
"slug",
"transliterator"
],
- "time": "2015-09-28 16:26:35"
+ "time": "2015-09-28T16:26:35+00:00"
},
{
"name": "doctrine/annotations",
@@ -113,7 +112,7 @@
"docblock",
"parser"
],
- "time": "2016-12-30 15:59:45"
+ "time": "2016-12-30T15:59:45+00:00"
},
{
"name": "doctrine/cache",
@@ -183,7 +182,7 @@
"cache",
"caching"
],
- "time": "2016-10-29 11:16:17"
+ "time": "2016-10-29T11:16:17+00:00"
},
{
"name": "doctrine/collections",
@@ -250,7 +249,7 @@
"collections",
"iterator"
],
- "time": "2017-01-03 10:49:41"
+ "time": "2017-01-03T10:49:41+00:00"
},
{
"name": "doctrine/common",
@@ -323,7 +322,7 @@
"persistence",
"spl"
],
- "time": "2017-01-13 14:02:13"
+ "time": "2017-01-13T14:02:13+00:00"
},
{
"name": "doctrine/dbal",
@@ -394,7 +393,7 @@
"persistence",
"queryobject"
],
- "time": "2017-02-08 12:53:47"
+ "time": "2017-02-08T12:53:47+00:00"
},
{
"name": "doctrine/doctrine-bundle",
@@ -475,7 +474,7 @@
"orm",
"persistence"
],
- "time": "2017-01-16 12:01:26"
+ "time": "2017-01-16T12:01:26+00:00"
},
{
"name": "doctrine/doctrine-cache-bundle",
@@ -563,7 +562,7 @@
"cache",
"caching"
],
- "time": "2016-01-26 17:28:51"
+ "time": "2016-01-26T17:28:51+00:00"
},
{
"name": "doctrine/doctrine-migrations-bundle",
@@ -624,7 +623,7 @@
"migrations",
"schema"
],
- "time": "2016-12-05 18:36:37"
+ "time": "2016-12-05T18:36:37+00:00"
},
{
"name": "doctrine/inflector",
@@ -691,7 +690,7 @@
"singularize",
"string"
],
- "time": "2015-11-06 14:35:42"
+ "time": "2015-11-06T14:35:42+00:00"
},
{
"name": "doctrine/instantiator",
@@ -745,7 +744,7 @@
"constructor",
"instantiate"
],
- "time": "2015-06-14 21:17:01"
+ "time": "2015-06-14T21:17:01+00:00"
},
{
"name": "doctrine/lexer",
@@ -799,7 +798,7 @@
"lexer",
"parser"
],
- "time": "2014-09-09 13:34:57"
+ "time": "2014-09-09T13:34:57+00:00"
},
{
"name": "doctrine/migrations",
@@ -873,7 +872,7 @@
"database",
"migrations"
],
- "time": "2016-12-25 22:54:00"
+ "time": "2016-12-25T22:54:00+00:00"
},
{
"name": "doctrine/orm",
@@ -949,7 +948,7 @@
"database",
"orm"
],
- "time": "2016-12-18 15:42:34"
+ "time": "2016-12-18T15:42:34+00:00"
},
{
"name": "gedmo/doctrine-extensions",
@@ -1028,7 +1027,7 @@
"tree",
"uploadable"
],
- "time": "2016-12-21 13:46:54"
+ "time": "2016-12-21T13:46:54+00:00"
},
{
"name": "incenteev/composer-parameter-handler",
@@ -1079,7 +1078,7 @@
"keywords": [
"parameters management"
],
- "time": "2015-11-10 17:04:01"
+ "time": "2015-11-10T17:04:01+00:00"
},
{
"name": "jdorn/sql-formatter",
@@ -1129,7 +1128,7 @@
"highlight",
"sql"
],
- "time": "2014-01-12 16:20:24"
+ "time": "2014-01-12T16:20:24+00:00"
},
{
"name": "kriswallsmith/assetic",
@@ -1206,7 +1205,7 @@
"compression",
"minification"
],
- "time": "2016-11-11 18:43:20"
+ "time": "2016-11-11T18:43:20+00:00"
},
{
"name": "monolog/monolog",
@@ -1284,7 +1283,7 @@
"logging",
"psr-3"
],
- "time": "2016-11-26 00:15:39"
+ "time": "2016-11-26T00:15:39+00:00"
},
{
"name": "ocramius/package-versions",
@@ -1332,7 +1331,7 @@
}
],
"description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)",
- "time": "2016-12-30 09:49:15"
+ "time": "2016-12-30T09:49:15+00:00"
},
{
"name": "ocramius/proxy-manager",
@@ -1397,7 +1396,7 @@
"proxy pattern",
"service proxies"
],
- "time": "2016-11-04 15:53:15"
+ "time": "2016-11-04T15:53:15+00:00"
},
{
"name": "paragonie/random_compat",
@@ -1445,31 +1444,7 @@
"pseudorandom",
"random"
],
- "time": "2016-11-07 23:38:38"
- },
- {
- "name": "pguardiario/phpuri",
- "version": "1.0",
- "source": {
- "type": "git",
- "url": "https://github.com/monkeysuffrage/phpuri.git",
- "reference": "ad0a5ec033fe616cfef55578b9c7f2458be8fbfc"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/monkeysuffrage/phpuri/zipball/ad0a5ec033fe616cfef55578b9c7f2458be8fbfc",
- "reference": "ad0a5ec033fe616cfef55578b9c7f2458be8fbfc",
- "shasum": ""
- },
- "type": "project",
- "autoload": {
- "files": [
- "phpuri.php"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "description": "A php library for converting relative urls to absolute.",
- "time": "2015-05-24 09:13:17"
+ "time": "2016-11-07T23:38:38+00:00"
},
{
"name": "psr/cache",
@@ -1515,7 +1490,7 @@
"psr",
"psr-6"
],
- "time": "2016-08-06 20:24:11"
+ "time": "2016-08-06T20:24:11+00:00"
},
{
"name": "psr/log",
@@ -1562,7 +1537,7 @@
"psr",
"psr-3"
],
- "time": "2016-10-10 12:19:37"
+ "time": "2016-10-10T12:19:37+00:00"
},
{
"name": "sensio/distribution-bundle",
@@ -1614,7 +1589,7 @@
"configuration",
"distribution"
],
- "time": "2017-01-10 14:58:45"
+ "time": "2017-01-10T14:58:45+00:00"
},
{
"name": "sensio/framework-extra-bundle",
@@ -1684,7 +1659,7 @@
"annotations",
"controllers"
],
- "time": "2017-02-15 06:52:30"
+ "time": "2017-02-15T06:52:30+00:00"
},
{
"name": "sensiolabs/security-checker",
@@ -1728,7 +1703,7 @@
}
],
"description": "A security checker for your composer.lock",
- "time": "2017-02-18 17:53:25"
+ "time": "2017-02-18T17:53:25+00:00"
},
{
"name": "stof/doctrine-extensions-bundle",
@@ -1789,7 +1764,7 @@
"translatable",
"tree"
],
- "time": "2016-01-26 23:58:32"
+ "time": "2016-01-26T23:58:32+00:00"
},
{
"name": "swiftmailer/swiftmailer",
@@ -1843,7 +1818,7 @@
"mail",
"mailer"
],
- "time": "2017-02-13 07:52:53"
+ "time": "2017-02-13T07:52:53+00:00"
},
{
"name": "symfony/assetic-bundle",
@@ -1913,7 +1888,7 @@
"compression",
"minification"
],
- "time": "2016-11-22 11:42:57"
+ "time": "2016-11-22T11:42:57+00:00"
},
{
"name": "symfony/monolog-bundle",
@@ -1973,7 +1948,7 @@
"log",
"logging"
],
- "time": "2017-01-02 19:04:26"
+ "time": "2017-01-02T19:04:26+00:00"
},
{
"name": "symfony/polyfill-apcu",
@@ -2026,7 +2001,7 @@
"portable",
"shim"
],
- "time": "2016-11-14 01:06:16"
+ "time": "2016-11-14T01:06:16+00:00"
},
{
"name": "symfony/polyfill-intl-icu",
@@ -2084,7 +2059,7 @@
"portable",
"shim"
],
- "time": "2016-11-14 01:06:16"
+ "time": "2016-11-14T01:06:16+00:00"
},
{
"name": "symfony/polyfill-mbstring",
@@ -2143,7 +2118,7 @@
"portable",
"shim"
],
- "time": "2016-11-14 01:06:16"
+ "time": "2016-11-14T01:06:16+00:00"
},
{
"name": "symfony/polyfill-php56",
@@ -2199,7 +2174,7 @@
"portable",
"shim"
],
- "time": "2016-11-14 01:06:16"
+ "time": "2016-11-14T01:06:16+00:00"
},
{
"name": "symfony/polyfill-php70",
@@ -2258,7 +2233,7 @@
"portable",
"shim"
],
- "time": "2016-11-14 01:06:16"
+ "time": "2016-11-14T01:06:16+00:00"
},
{
"name": "symfony/polyfill-util",
@@ -2310,7 +2285,7 @@
"polyfill",
"shim"
],
- "time": "2016-11-14 01:06:16"
+ "time": "2016-11-14T01:06:16+00:00"
},
{
"name": "symfony/swiftmailer-bundle",
@@ -2369,7 +2344,7 @@
],
"description": "Symfony SwiftmailerBundle",
"homepage": "http://symfony.com",
- "time": "2016-12-20 04:44:33"
+ "time": "2016-12-20T04:44:33+00:00"
},
{
"name": "symfony/symfony",
@@ -2511,7 +2486,70 @@
"keywords": [
"framework"
],
- "time": "2017-01-28 02:53:38"
+ "time": "2017-01-28T02:53:38+00:00"
+ },
+ {
+ "name": "tecnickcom/tcpdf",
+ "version": "6.2.12",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/tecnickcom/TCPDF.git",
+ "reference": "2f732eaa91b5665274689b1d40b285a7bacdc37f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/2f732eaa91b5665274689b1d40b285a7bacdc37f",
+ "reference": "2f732eaa91b5665274689b1d40b285a7bacdc37f",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "fonts",
+ "config",
+ "include",
+ "tcpdf.php",
+ "tcpdf_parser.php",
+ "tcpdf_import.php",
+ "tcpdf_barcodes_1d.php",
+ "tcpdf_barcodes_2d.php",
+ "include/tcpdf_colors.php",
+ "include/tcpdf_filters.php",
+ "include/tcpdf_font_data.php",
+ "include/tcpdf_fonts.php",
+ "include/tcpdf_images.php",
+ "include/tcpdf_static.php",
+ "include/barcodes/datamatrix.php",
+ "include/barcodes/pdf417.php",
+ "include/barcodes/qrcode.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPLv3"
+ ],
+ "authors": [
+ {
+ "name": "Nicola Asuni",
+ "email": "info@tecnick.com",
+ "homepage": "http://nicolaasuni.tecnick.com"
+ }
+ ],
+ "description": "TCPDF is a PHP class for generating PDF documents and barcodes.",
+ "homepage": "http://www.tcpdf.org/",
+ "keywords": [
+ "PDFD32000-2008",
+ "TCPDF",
+ "barcodes",
+ "datamatrix",
+ "pdf",
+ "pdf417",
+ "qrcode"
+ ],
+ "time": "2015-09-12T10:08:34+00:00"
},
{
"name": "twig/twig",
@@ -2573,7 +2611,51 @@
"keywords": [
"templating"
],
- "time": "2017-01-11 19:39:01"
+ "time": "2017-01-11T19:39:01+00:00"
+ },
+ {
+ "name": "whiteoctober/tcpdf-bundle",
+ "version": "1.0.3",
+ "target-dir": "WhiteOctober/TCPDFBundle",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/whiteoctober/WhiteOctoberTCPDFBundle.git",
+ "reference": "3a705b0f416792351fc531eb086e6f5caf5339a5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/whiteoctober/WhiteOctoberTCPDFBundle/zipball/3a705b0f416792351fc531eb086e6f5caf5339a5",
+ "reference": "3a705b0f416792351fc531eb086e6f5caf5339a5",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.2",
+ "symfony/framework-bundle": ">=2.0",
+ "tecnickcom/tcpdf": "*"
+ },
+ "type": "symfony-bundle",
+ "autoload": {
+ "psr-0": {
+ "WhiteOctober\\TCPDFBundle": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Rich Sage",
+ "email": "rich.sage@gmail.com"
+ }
+ ],
+ "description": "A bundle to easily integrate TCPDF into Symfony2",
+ "homepage": "https://github.com/whiteoctober/WhiteOctoberTCPDFBundle",
+ "keywords": [
+ "TCPDF",
+ "pdf"
+ ],
+ "time": "2017-05-25T07:39:11+00:00"
},
{
"name": "zendframework/zend-code",
@@ -2626,7 +2708,7 @@
"code",
"zf2"
],
- "time": "2016-10-24 13:23:32"
+ "time": "2016-10-24T13:23:32+00:00"
},
{
"name": "zendframework/zend-eventmanager",
@@ -2680,10 +2762,34 @@
"events",
"zf2"
],
- "time": "2016-12-19 21:47:12"
+ "time": "2016-12-19T21:47:12+00:00"
}
],
"packages-dev": [
+ {
+ "name": "pguardiario/phpuri",
+ "version": "1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/monkeysuffrage/phpuri.git",
+ "reference": "ad0a5ec033fe616cfef55578b9c7f2458be8fbfc"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/monkeysuffrage/phpuri/zipball/ad0a5ec033fe616cfef55578b9c7f2458be8fbfc",
+ "reference": "ad0a5ec033fe616cfef55578b9c7f2458be8fbfc",
+ "shasum": ""
+ },
+ "type": "project",
+ "autoload": {
+ "files": [
+ "phpuri.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "description": "A php library for converting relative urls to absolute.",
+ "time": "2015-05-24T09:13:17+00:00"
+ },
{
"name": "sensio/generator-bundle",
"version": "v3.1.2",
@@ -2734,7 +2840,7 @@
}
],
"description": "This bundle generates code for you",
- "time": "2016-12-05 16:01:19"
+ "time": "2016-12-05T16:01:19+00:00"
},
{
"name": "symfony/phpunit-bridge",
@@ -2793,7 +2899,7 @@
],
"description": "Symfony PHPUnit Bridge",
"homepage": "https://symfony.com",
- "time": "2017-01-21 17:06:35"
+ "time": "2017-01-21T17:06:35+00:00"
}
],
"aliases": [],
diff --git a/trunk/src/AppBundle/Controller/BookingController.php b/trunk/src/AppBundle/Controller/BookingController.php
index 71237ece..de1594ec 100644
--- a/trunk/src/AppBundle/Controller/BookingController.php
+++ b/trunk/src/AppBundle/Controller/BookingController.php
@@ -64,7 +64,8 @@ class BookingController extends Controller
$bookingRequest = new BookingRequest();
if ($request->getMethod() != 'POST')
{
- $bookingRequest->setTravelerCount(2);
+ $bookingRequest->setDoubleRoomCount(1);
+ $bookingRequest->setRoomCount(2);
$bookingRequest->setDeparture($travelDate->getDepartures()[0]);
}
$form = $this->createForm(BookingRequestType::class, $bookingRequest, [
@@ -85,6 +86,8 @@ class BookingController extends Controller
$breadcrumbEntries = Util::createBreadcrumb($travelProgramPage);
$breadcrumbEntries[] = new BreadcrumbEntry('Buchen');
+
+
if ($request->getMethod() == 'POST' && $form->isValid())
{
$booking = $this->getDoctrine()->getRepository('AppBundle:TravelBooking')->createFromBookingRequest(
@@ -187,7 +190,11 @@ class BookingController extends Controller
{
$ret = 0;
$insuranceAssessmentBasis = 0;
+
$travelerCount = $bookingRequest->getTravelerCount();
+ $singleRoomCount = $bookingRequest->getSingleRoomCount();
+ $doubleRoomCount = $bookingRequest->getDoubleRoomCount();
+ $tripleRoomCount = $bookingRequest->getTripleRoomCount();
if (isset($outHtmlSummary))
{
$insuranceHtmlSummary = [];
@@ -242,24 +249,19 @@ class BookingController extends Controller
}
}
+
+
$persons = [
'total' => $travelerCount,
'adults' => $travelerCount,
- 'children' => 0
+ 'singleRoomPersons' => $singleRoomCount,
+ 'doubleRoomPersons' => $doubleRoomCount * 2,
+ 'tripleRoomPersons' => $tripleRoomCount * 3,
+ 'children' => 0 //TODO
];
- $possibleRooms = $this->searchRooms($travelDate->getPrices(), $persons);
- if (empty($possibleRooms))
- {
- if ($travelerCount % 2 == 0)
- {
- $possibleRooms = $this->splitIntoTwoGroups($travelDate->getPrices(), $persons, 'equal');
- }
- elseif ($travelerCount >= 3)
- {
- $possibleRooms = $this->splitIntoTwoGroups($travelDate->getPrices(), $persons, 'move_without_children');
- }
- }
+
+ $possibleRooms = $this->getRooms($travelDate->getPrices(), $persons);
if ($bookingRequest->getComfort())
{
@@ -385,52 +387,61 @@ class BookingController extends Controller
*
* @return array
*/
- private function searchRooms($prices, $persons)
+ private function getRooms($prices, $persons)
{
$ret = [];
- foreach ($prices as $price)
+
+ foreach($prices as $price)
{
- $priceType = $this->priceTypeById[$price->getPriceTypeId()];
- if ($priceType->getMax() == $persons['total'] &&
- $priceType->getMaxAdults() >= $persons['adults'] &&
- $priceType->getMinAdults() <= $persons['adults'] &&
- $priceType->getMaxChildren() >= $persons['children'])
+ $priceTypeId = $price->getPriceTypeId();
+ $priceType = $this->priceTypeById[$priceTypeId];
+
+ if($priceTypeId == 1 && $persons['singleRoomPersons'] > 0)
{
+ $currentPersons = [
+ 'total' => $persons['singleRoomPersons'],
+ 'adults' => $persons['singleRoomPersons'],
+ 'children' => 0 //TODO
+ ];
+
$ret[] = [
'priceType' => $priceType,
- 'persons' => $persons,
+ 'persons' => $currentPersons,
+ 'price' => $price
+ ];
+ }
+
+ if($priceTypeId == 3 && $persons['doubleRoomPersons'] > 0)
+ {
+ $currentPersons = [
+ 'total' => $persons['doubleRoomPersons'],
+ 'adults' => $persons['doubleRoomPersons'],
+ 'children' => 0
+ ];
+
+ $ret[] = [
+ 'priceType' => $priceType,
+ 'persons' => $currentPersons,
+ 'price' => $price
+ ];
+ }
+
+ if($priceTypeId == 5 && $persons['tripleRoomPersons'] > 0)
+ {
+ $currentPersons = [
+ 'total' => $persons['tripleRoomPersons'],
+ 'adults' => $persons['tripleRoomPersons'],
+ 'children' => 0
+ ];
+
+ $ret[] = [
+ 'priceType' => $priceType,
+ 'persons' => $currentPersons,
'price' => $price
];
}
}
+
return $ret;
}
-
- private function splitIntoTwoGroups($prices, $persons, $mode)
- {
- $group1 = [];
- $group2 = [];
- if($mode == 'equal')
- {
- $group1['adults'] = $group2['adults'] = $persons['adults'] / 2;
- $group1['children'] = $group2['children'] = $persons['children'] / 2;
- $group1['total'] = $group2['total'] = $group1['adults'] + $group2['children'];
- }
- elseif($mode = 'move_without_children')
- {
- $group1['adults'] = $persons['adults'] - 1;
- $group1['children'] = 0;
- $group1['total'] = $group1['adults'] + $group1['children'];
-
- $group2['adults'] = 1;
- $group2['children'] = 0;
- $group2['total'] = $group2['adults'] + $group2['children'];
- }
- $possibleRoomsGroup1 = $this->searchRooms($prices, $group1);
- $possibleRoomsGroup2 = $this->searchRooms($prices, $group2);
-
- return array_merge($possibleRoomsGroup1, $possibleRoomsGroup2);
- }
-
-
}
\ No newline at end of file
diff --git a/trunk/src/AppBundle/Controller/CmsController.php b/trunk/src/AppBundle/Controller/CmsController.php
index 280c091c..99d80029 100644
--- a/trunk/src/AppBundle/Controller/CmsController.php
+++ b/trunk/src/AppBundle/Controller/CmsController.php
@@ -13,6 +13,8 @@ use AppBundle\Form\TtSearchRequestType;
use AppBundle\Listener\KernelControllerListener;
use Doctrine\ORM\EntityManager;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
+use AppBundle\Util;
+use Symfony\Component\HttpFoundation\Response;
/**
* Controller for CMS pages. CMS pages are represented by Page instances (i.e. entries of the page database table).
@@ -121,6 +123,53 @@ class CmsController extends Controller
]);
}
+ public function pdfAction(Page $page)
+ {
+ $travelProgram = $page->getTravelProgram();
+ $program_id = $travelProgram->getId();
+
+ if($program_id != NULL)
+ {
+
+ $url = Util::getBaseUrl().$page->getUrlPath();
+
+ // Initialisierung
+ $pdfObj = $this->container->get('app.pdf');
+ $pdfObj->SetMargins(PDF_MARGIN_LEFT, 40, PDF_MARGIN_RIGHT);
+ $pdfObj->SetAutoPageBreak(true, 65);
+ $pdfObj->AddPage();
+
+ // Erzeugen des HTML über das Twig-Template
+ $pageHTML = $this->render('default/pages/cms/travelProgramPDF.html.twig', [
+ 'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
+ 'page' => $page,
+ 'show_offers_sidebar_widget' => false,
+ 'travel_program' => $page->getTravelProgram()
+ ]);
+
+ // Filtern von Hyper-Links
+ $filteredContent = preg_replace('#
(.*)
#Uis', '', $pageHTML->getContent());
+ $filteredContent = preg_replace('#
#Uis', '', $filteredContent);
+ $filteredContent = preg_replace('# #Uis', '', $filteredContent);
+ $filteredContent = str_replace('*', '
', $filteredContent);
+
+ // Schreiben des HTML
+ $pdfObj->writeHTML('
Reiseangebot zu finden unter: '.$url.' ');
+ $pdfObj->writeHTML($filteredContent);
+
+ // Ersetzen der Umlaute
+ $germanLetters = array("/ä/","/ö/","/ü/","/Ä/","/Ö/","/Ü/","/ß/");
+ $replace = array("ae","oe","ue","Ae","Oe","Ue","ss");
+ $filename = preg_replace($germanLetters, $replace, $travelProgram->getTitle());
+
+ header('Link: <'.$travelProgram->getUrl().'>; rel="canonical"');
+
+ $pdfObj->Output($filename.'.pdf', 'D');
+ }
+ }
+
+
+
/**
* @param Page $page
*
diff --git a/trunk/src/AppBundle/Entity/BookingRequest.php b/trunk/src/AppBundle/Entity/BookingRequest.php
index 5ff0696a..97e02f5f 100644
--- a/trunk/src/AppBundle/Entity/BookingRequest.php
+++ b/trunk/src/AppBundle/Entity/BookingRequest.php
@@ -26,7 +26,13 @@ class BookingRequest
*/
private $departure;
- private $travelerCount;
+ private $singleRoomCount;
+
+ private $doubleRoomCount;
+
+ private $tripleRoomCount;
+
+ private $roomCount;
/**
* @var TravelInsurance $insurance
@@ -80,6 +86,10 @@ class BookingRequest
private $travelers = [];
+ private $singleRooms = [];
+ private $doubleRooms = [];
+ private $tripleRooms = [];
+
private $notes;
/**
@@ -92,9 +102,11 @@ class BookingRequest
*/
public function __construct()
{
- for ($i = 0; $i < 4; ++$i)
+ for($i = 0; $i < 5; ++$i)
{
- $this->travelers[] = new Traveler();
+ $this->singleRooms[] = new Room(1);
+ $this->doubleRooms[] = new Room(2);
+ $this->tripleRooms[] = new Room(3);
}
}
@@ -119,7 +131,23 @@ class BookingRequest
*/
public function getTravelerCount()
{
- return $this->travelerCount;
+ $allUsedTravelersCount = 0;
+ for($i = 0; $i < $this->singleRoomCount; ++$i)
+ {
+ $allUsedTravelersCount += $this->singleRooms[$i]->getTravelerCount();
+ }
+
+ for($i = 0; $i < $this->doubleRoomCount; ++$i)
+ {
+ $allUsedTravelersCount += $this->doubleRooms[$i]->getTravelerCount();
+ }
+
+ for($i = 0; $i < $this->tripleRoomCount; ++$i)
+ {
+ $allUsedTravelersCount += $this->tripleRooms[$i]->getTravelerCount();
+ }
+
+ return $allUsedTravelersCount;
}
/**
@@ -130,6 +158,89 @@ class BookingRequest
$this->travelerCount = $travelerCount;
}
+ /**
+ * @return mixed
+ */
+ public function getRoomCount()
+ {
+ return $this->roomCount;
+ }
+
+ /**
+ * @param mixed $travelers
+ */
+ public function setRoomCount($travelers)
+ {
+ // nicht so kompliziert
+ // übliche Anzahl der Reisenden war 2 -> Standardraum: 1 Doppelzimmer
+ $this->travelerCount = $travelers;
+ if($travelers % 2 != 0)
+ {
+ $times = ($travelers - 1) / 2;
+ $this->singleRoomCount = 1;
+ $this->doubleRoomCount = $times;
+ $this->tripleRoomCount = 0;
+ $this->roomCount = $times + 1;
+ }
+ else
+ {
+ $times = $travelers / 2;
+ $this->singleRoomCount = 0;
+ $this->doubleRoomCount = $times;
+ $this->tripleRoomCount = 0;
+ $this->roomCount = $times;
+ }
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getSingleRoomCount()
+ {
+ return $this->singleRoomCount;
+ }
+
+ /**
+ * @param mixed $singleRoomCount
+ */
+ public function setSingleRoomCount($singleRoomCount)
+ {
+ $this->singleRoomCount = $singleRoomCount;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getDoubleRoomCount()
+ {
+ return $this->doubleRoomCount;
+ }
+
+ /**
+ * @param mixed $doubleRoomCount
+ */
+ public function setDoubleRoomCount($doubleRoomCount)
+ {
+ $this->doubleRoomCount = $doubleRoomCount;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getTripleRoomCount()
+ {
+ return $this->tripleRoomCount;
+ }
+
+ /**
+ * @param mixed $tripleRoomCount
+ */
+ public function setTripleRoomCount($tripleRoomCount)
+ {
+ $this->tripleRoomCount = $tripleRoomCount;
+ }
+
+
/**
* @return TravelInsurance
*/
@@ -338,12 +449,33 @@ class BookingRequest
$this->email = $email;
}
+ // get und set der Travelers liegt jetzt in Room; sollte so nicht mehr verwendet werden!
/**
* @return Traveler[]
*/
public function getTravelers()
{
- return $this->travelers;
+ $allUsedTravelers = [];
+
+ // könnte man eventuell in eine for-Schleife packen, wenn man garantiert, dass es immer gleich viele Räume von jedem Typ gibt
+ for ($i = 0; $i < $this->singleRoomCount; ++$i)
+ {
+ $allUsedTravelers = array_merge($allUsedTravelers, $this->singleRooms[$i]->getTravelers());
+ }
+
+ for ($i = 0; $i < $this->doubleRoomCount; ++$i)
+ {
+ $allUsedTravelers = array_merge($allUsedTravelers, $this->doubleRooms[$i]->getTravelers());
+ }
+
+ for ($i = 0; $i < $this->tripleRoomCount; ++$i)
+ {
+ $allUsedTravelers = array_merge($allUsedTravelers, $this->tripleRooms[$i]->getTravelers());
+ }
+
+// $this->travelers = $allUsedTravelers; // schlecht, getter sollte kein setter sein
+// return $this->travelers; // aber wenn man es so verwenden würde, dann sollte man auch das verwenden
+ return $allUsedTravelers;
}
/**
@@ -354,6 +486,76 @@ class BookingRequest
$this->travelers = $travelers;
}
+ /**
+ * @return Room[]
+ */
+ public function getSingleRooms()
+ {
+ return $this->singleRooms;
+ }
+
+ /**
+ * @param Room[] $singleRooms
+ */
+ public function setSingleRooms($singleRooms)
+ {
+ $this->singleRooms = $singleRooms;
+ }
+
+ /**
+ * @return Room[]
+ */
+ public function getDoubleRooms()
+ {
+ return $this->doubleRooms;
+ }
+
+ /**
+ * @param Room[] $doubleRooms
+ */
+ public function setDoubleRooms($doubleRooms)
+ {
+ $this->doubleRooms = $doubleRooms;
+ }
+
+ /**
+ * @return Room[]
+ */
+ public function getTripleRooms()
+ {
+ return $this->tripleRooms;
+ }
+
+ /**
+ * @param Room[] $tripleRooms
+ */
+ public function setTripleRooms($tripleRooms)
+ {
+ $this->tripleRooms = $tripleRooms;
+ }
+
+ /**
+ * @return Room[]
+ */
+ public function getRooms()
+ {
+ $allRooms = [];
+ $allRooms = array_merge($allRooms, $this->singleRooms);
+ $allRooms = array_merge($allRooms, $this->doubleRooms);
+ $allRooms = array_merge($allRooms, $this->tripleRooms);
+
+ return $allRooms;
+ }
+
+ /**
+ * @param Room[] $tripleRooms
+ */
+ public function setRooms($rooms)
+ {
+ // falls man es braucht, nachziehen und oder umstrukturieren (booking.html.twig)
+ }
+
+
/*
public function addTraveler(Traveler $traveler)
{
diff --git a/trunk/src/AppBundle/Entity/Room.php b/trunk/src/AppBundle/Entity/Room.php
new file mode 100644
index 00000000..6e9d6f1f
--- /dev/null
+++ b/trunk/src/AppBundle/Entity/Room.php
@@ -0,0 +1,87 @@
+type = $type;
+ for($i = 0; $i < $this->type; $i++)
+ {
+ $this->travelers[] = new Traveler();
+ }
+
+ $this->travelerCount = $type;
+ }
+
+ /**
+ * @return int
+ */
+ public function getType()
+ {
+ return $this->type;
+ }
+
+ /**
+ * @param int $type
+ */
+ public function setType($type)
+ {
+ $this->type = $type;
+ }
+
+ /**
+ * @return Traveler[]
+ */
+ public function getTravelers()
+ {
+ return $this->travelers;
+ }
+
+ /**
+ * @param Traveler[] $travelers
+ */
+ public function setTravelers($travelers)
+ {
+ $this->travelers = $travelers;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getTravelerCount()
+ {
+ return $this->travelerCount;
+ }
+
+ /**
+ * @param mixed $travelerCount
+ */
+ public function setTravelerCount($travelerCount)
+ {
+ $this->travelerCount = $travelerCount;
+ }
+
+
+}
\ No newline at end of file
diff --git a/trunk/src/AppBundle/Entity/TravelBookingRepository.php b/trunk/src/AppBundle/Entity/TravelBookingRepository.php
index 2aade6d8..399cabcc 100644
--- a/trunk/src/AppBundle/Entity/TravelBookingRepository.php
+++ b/trunk/src/AppBundle/Entity/TravelBookingRepository.php
@@ -59,7 +59,8 @@ class TravelBookingRepository extends \Doctrine\ORM\EntityRepository
}
$ret->setInsurances($insurances);
}
- $ret->setParticipants(array_slice($bookingRequest->getTravelers(), 0, $bookingRequest->getTravelerCount()));
+
+ $ret->setParticipants($bookingRequest->getTravelers());
$ret->setParticipantsTotal($bookingRequest->getTravelerCount());
$ret->setRooms($bookingPriceInfo['rooms']);
$ret->setPriceTotal($bookingPriceInfo['total']);
diff --git a/trunk/src/AppBundle/Form/BookingRequestType.php b/trunk/src/AppBundle/Form/BookingRequestType.php
index b07d6a02..fe0777b1 100644
--- a/trunk/src/AppBundle/Form/BookingRequestType.php
+++ b/trunk/src/AppBundle/Form/BookingRequestType.php
@@ -29,11 +29,31 @@ use Symfony\Component\Validator\Constraints\NotNull;
class BookingRequestType extends AbstractType
{
- public static $TRAVELER_COUNT_CHOICES = [
- '1 Person' => 1,
- '2 Personen' => 2,
- '3 Personen' => 3,
- '4 Personen' => 4,
+ public static $SINGLE_ROOM_COUNT_CHOICES = [
+ '0 Einzelzimmer' => 0,
+ '1 Einzelzimmer' => 1,
+ '2 Einzelzimmer' => 2,
+ '3 Einzelzimmer' => 3,
+ '4 Einzelzimmer' => 4,
+ '5 Einzelzimmer' => 5,
+ ];
+
+ public static $DOUBLE_ROOM_COUNT_CHOICES = [
+ '0 Doppelzimmer' => 0,
+ '1 Doppelzimmer' => 1,
+ '2 Doppelzimmer' => 2,
+ '3 Doppelzimmer' => 3,
+ '4 Doppelzimmer' => 4,
+ '5 Doppelzimmer' => 5,
+ ];
+
+ public static $TRIPLE_ROOM_COUNT_CHOICES = [
+ '0 Dreibettzimmer' => 0,
+ '1 Dreibettzimmer' => 1,
+ '2 Dreibettzimmer' => 2,
+ '3 Dreibettzimmer' => 3,
+ '4 Dreibettzimmer' => 4,
+ '5 Dreibettzimmer' => 5,
];
public static $NATION_CHOICES = [
@@ -110,8 +130,8 @@ class BookingRequestType extends AbstractType
->add('phone')
->add('fax')
->add('email')
- ->add('travelers', CollectionType::class, [
- 'entry_type' => TravelerType::class,
+ ->add('rooms', CollectionType::class, [
+ 'entry_type' => RoomType::class,
'by_reference' => false,
])
->add('notes', TextareaType::class, ['required' => false])
@@ -130,11 +150,25 @@ class BookingRequestType extends AbstractType
)]
]);
- $builder->add('travelerCount', ChoiceType::class, [
- 'choices' => self::$TRAVELER_COUNT_CHOICES,
+ $builder->add('singleRoomCount', ChoiceType::class, [
+ 'choices' => self::$SINGLE_ROOM_COUNT_CHOICES,
'constraints' => [
- new Choice(['choices' => self::$TRAVELER_COUNT_CHOICES]
- )]
+ new Choice(['choices' => self::$SINGLE_ROOM_COUNT_CHOICES]
+ )]
+ ]);
+
+ $builder->add('doubleRoomCount', ChoiceType::class, [
+ 'choices' => self::$DOUBLE_ROOM_COUNT_CHOICES,
+ 'constraints' => [
+ new Choice(['choices' => self::$DOUBLE_ROOM_COUNT_CHOICES]
+ )]
+ ]);
+
+ $builder->add('tripleRoomCount', ChoiceType::class, [
+ 'choices' => self::$TRIPLE_ROOM_COUNT_CHOICES,
+ 'constraints' => [
+ new Choice(['choices' => self::$TRIPLE_ROOM_COUNT_CHOICES]
+ )]
]);
$insuranceChoices = [];
@@ -159,6 +193,8 @@ class BookingRequestType extends AbstractType
]);
}
+ //$travelDate->getPrices()[0]->getPriceType()
+
if ($travelDate->hasComfortCategory())
{
$builder->add('comfort', CheckboxType::class, ['required' => false]);
diff --git a/trunk/src/AppBundle/Form/RoomType.php b/trunk/src/AppBundle/Form/RoomType.php
new file mode 100644
index 00000000..7a58e15b
--- /dev/null
+++ b/trunk/src/AppBundle/Form/RoomType.php
@@ -0,0 +1,47 @@
+ Room::SINGLE,
+ 'Doppelzimmer' => Room::DOUBLE,
+ 'Dreibettzimmer' => Room::TRIPLE
+ ];
+
+ /**
+ * @param OptionsResolver $resolver
+ */
+ public function configureOptions(OptionsResolver $resolver)
+ {
+ $resolver->setDefaults(array(
+ 'data_class' => 'AppBundle\Entity\Room'
+ ));
+ }
+
+ /**
+ * @param FormBuilderInterface $builder
+ * @param array $options
+ */
+ public function buildForm(FormBuilderInterface $builder, array $options)
+ {
+ $builder
+ ->add('travelers', CollectionType::class, [
+ 'entry_type' => TravelerType::class,
+ ]);
+ }
+}
\ No newline at end of file
diff --git a/trunk/src/AppBundle/Form/StPlainDateType.php b/trunk/src/AppBundle/Form/StPlainDateType.php
new file mode 100644
index 00000000..aa7b230f
--- /dev/null
+++ b/trunk/src/AppBundle/Form/StPlainDateType.php
@@ -0,0 +1,25 @@
+setDefaults([
+ 'placeholder' => 'TT.MM.JJJJ',
+ 'widget' => 'single_text',
+ 'format' => 'dd.MM.yyyy'
+ ]);
+ }
+
+ public function getParent()
+ {
+ return DateType::class;
+ }
+}
\ No newline at end of file
diff --git a/trunk/src/AppBundle/Form/TravelerType.php b/trunk/src/AppBundle/Form/TravelerType.php
index 1d4768a3..9de342d6 100644
--- a/trunk/src/AppBundle/Form/TravelerType.php
+++ b/trunk/src/AppBundle/Form/TravelerType.php
@@ -50,7 +50,7 @@ class TravelerType extends AbstractType
])
->add('firstName')
->add('lastName')
- ->add('birthDate', DateType::class, [
+ ->add('birthDate', StPlainDateType::class, [
'widget' => 'single_text',
'format' => 'dd.MM.yyyy',
'required' => true,
diff --git a/trunk/src/AppBundle/Listener/KernelControllerListener.php b/trunk/src/AppBundle/Listener/KernelControllerListener.php
index ec176cc2..32a3aa07 100644
--- a/trunk/src/AppBundle/Listener/KernelControllerListener.php
+++ b/trunk/src/AppBundle/Listener/KernelControllerListener.php
@@ -132,6 +132,11 @@ class KernelControllerListener
$request->attributes->set('action', $restOfPath);
$request->attributes->set('_controller', 'AppBundle:Booking:index');
}
+ elseif($restOfPath && $node->getTravelProgram() != null && (
+ $restOfPath == '/pdf'))
+ {
+ $request->attributes->set('_controller', 'AppBundle:Cms:pdf');
+ }
elseif ($node->getTravelProgram() != null)
{
if ($node->getTravelProgram()->getStatus() == 0)
diff --git a/trunk/src/AppBundle/Pdf.php b/trunk/src/AppBundle/Pdf.php
new file mode 100644
index 00000000..f4edc7df
--- /dev/null
+++ b/trunk/src/AppBundle/Pdf.php
@@ -0,0 +1,53 @@
+webDir = realpath($rootDir . '/../web');
+ $this->assetManager = $assetManager;
+ }
+
+ private function getFileName($file)
+ {
+ $assetPath = $this->assetManager->get($file)->getTargetPath();
+ $fileNameParts = explode('/', $assetPath);
+ $lastPartIndex = count($fileNameParts) - 1;
+ $fileName = $fileNameParts[$lastPartIndex];
+
+ return $fileName;
+ }
+
+ public function Header()
+ {
+ $backgroundDir = $this->webDir.'\bundles\app\images\header-bg.png';
+ $logoDir = $this->webDir.'\assetic\\'.$this->getFileName('headerLogo');
+
+ $this->Image($backgroundDir, 0, 0, 210, 0, '', '', '', false, 300, 'C');
+ $this->Image($logoDir, 0, 15, 90, 0, '', '', '', false, 300, 'C');
+ }
+
+ public function Footer()
+ {
+
+ $footerDir = $this->webDir.'\assetic\\'.$this->getFileName('footerText');
+
+ $this->ImageSVG($footerDir, 0, 228, 210, '');
+
+ $this->SetY(-58);
+ $this->SetX(-30);
+ $this->SetFont('helvetica', '', 10);
+ $this->Cell(0, 14, 'Seite '.$this->getAliasNumPage().' von '.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
+ }
+}
+
+/* End of file Pdf.php */
+/* Location: ./application/libraries/Pdf.php */
\ No newline at end of file
diff --git a/trunk/src/AppBundle/Resources/public/css/includes/fonts.css b/trunk/src/AppBundle/Resources/public/css/includes/fonts.css
new file mode 100644
index 00000000..65339bb6
--- /dev/null
+++ b/trunk/src/AppBundle/Resources/public/css/includes/fonts.css
@@ -0,0 +1,10 @@
+@import url(https://fonts.googleapis.com/css?family=Raleway:400,100,200,300,500,600,700,800,900);
+@import url(https://fonts.googleapis.com/css?family=Oswald:400,700);
+@import url(https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css);
+@import url(../../app/css/font-awesome-4.7.0.css);
+@import url(../../app/css/bootstrap-select-1.12.0.css);
+@import url(../../app/css/owl-carousel.css);
+@import url(../../app/css/prettyPhoto.css);
+/* ==================================================================
+ FONTS
+================================================================== */
diff --git a/trunk/src/AppBundle/Resources/public/images/footer.svg b/trunk/src/AppBundle/Resources/public/images/footer.svg
new file mode 100644
index 00000000..1dbbd4ff
--- /dev/null
+++ b/trunk/src/AppBundle/Resources/public/images/footer.svg
@@ -0,0 +1,16 @@
+
+
+
+
+
+STERN TOURS GmbH Uhlandstraße 137 10717 Berlin
+
+e-Mail stern@stern-tours.de Web www.stern-tours.de Fon 030 | 700 94 100 Fax 030 | 700 94 1044
+
+Bankverbindung STERN TOURS GmbH Hypo Vereinsbank BLZ: 10020890 Kto.: 18857111 IBAN: DE83100208900018857111 BIC-/SWIFT-Code: HYVEDEMM488
+
+Telefonische Öffnungszeiten Mo - Do: 09:00 - 23:00 Uhr Fr: 10:00 - 23:00 Uhr Sa: 11:00 - 23.00 Uhr UStID: DE192609253 Registernummer: HRB 67111 Amtsgericht Charlottenburg
+
+
diff --git a/trunk/src/AppBundle/Resources/public/js/booking.js b/trunk/src/AppBundle/Resources/public/js/booking.js
index ababa6ed..751164d3 100644
--- a/trunk/src/AppBundle/Resources/public/js/booking.js
+++ b/trunk/src/AppBundle/Resources/public/js/booking.js
@@ -2,7 +2,12 @@ $(document).ready(function() {
var frm$ = $('.st-booking-form');
var summary$ = $('.st-booking-summary');
- var travelerCountDd$ = $('#booking_request_travelerCount');
+
+ var roomCountSR$ = $('#booking_request_singleRoomCount');
+ var roomCountDR$ = $('#booking_request_doubleRoomCount');
+ var roomCountTR$ = $('#booking_request_tripleRoomCount');
+ //var travelersIndices = $('.st-traveller-index');
+
var travelers$ = $('.st-traveler');
var travelerFields$ = travelers$.find('input,select');
@@ -31,15 +36,58 @@ $(document).ready(function() {
function updateTravelers()
{
- var travelerCount = parseInt(travelerCountDd$.val());
+ var travelersIndex = 1;
+
+ var singleTravelerCount = parseInt(roomCountSR$.val());
+ var doubleTravelerCount = parseInt(roomCountDR$.val()) * 2;
+ var tripleTravelerCount = parseInt(roomCountTR$.val()) * 3;
+
+ var allTravelersCount = singleTravelerCount + doubleTravelerCount + tripleTravelerCount;
+
travelers$.hide();
travelerFields$.prop('required', false);
- for (var i = 1; i <= travelerCount; ++i)
- {
- $('.st-traveler-'+ i).show().find('input,select').prop('required', true);
- }
- }
- travelerCountDd$.change(updateTravelers);
- updateTravelers();
+ if(singleTravelerCount > 0)
+ {
+ for(var i = 1; i <= singleTravelerCount; i++)
+ {
+ var travelerSelector = '.st-traveler-' + i;
+ var roomIndexSelector = travelerSelector+' .st-traveller-index';
+ var currentRoomIndex = $(travelerSelector).attr("data-room-index");
+ $(travelerSelector).show().find('input,select').prop('required', true);
+ $(roomIndexSelector).text(currentRoomIndex);
+ }
+ }
+
+ if(doubleTravelerCount > 0)
+ {
+ var offset = 5 - singleTravelerCount;
+ for(var j = 6; j <= doubleTravelerCount + 5; j++)
+ {
+ var travelerSelector = '.st-traveler-'+j;
+ var roomIndexSelector = travelerSelector+' .st-traveller-index';
+ var currentRoomIndex = $(travelerSelector).attr("data-room-index");
+ $(travelerSelector).show().find('input,select').prop('required', true);
+ $(roomIndexSelector).text(currentRoomIndex - offset);
+ }
+ }
+
+ if(tripleTravelerCount > 0)
+ {
+ var offset = 10 - (singleTravelerCount + (doubleTravelerCount / 2));
+ for(var k = 16; k <= tripleTravelerCount + 15; k++)
+ {
+ var travelerSelector = '.st-traveler-'+k;
+ var roomIndexSelector = travelerSelector+' .st-traveller-index';
+ var currentRoomIndex = $(travelerSelector).attr("data-room-index");
+ $(travelerSelector).show().find('input,select').prop('required', true);
+ $(roomIndexSelector).text(currentRoomIndex - offset);
+ }
+ }
+
+ }
+ roomCountSR$.change(updateTravelers);
+ roomCountDR$.change(updateTravelers);
+ roomCountTR$.change(updateTravelers);
+ updateTravelers();
});
\ No newline at end of file
diff --git a/trunk/src/AppBundle/Validator/Constraints/BookingRequestValidator.php b/trunk/src/AppBundle/Validator/Constraints/BookingRequestValidator.php
index e6e23d69..878d9f03 100644
--- a/trunk/src/AppBundle/Validator/Constraints/BookingRequestValidator.php
+++ b/trunk/src/AppBundle/Validator/Constraints/BookingRequestValidator.php
@@ -38,17 +38,29 @@ class BookingRequestValidator extends ConstraintValidator
*/
public function validate($bookingRequest, Constraint $constraint)
{
- //die($bookingRequest->get);
- for ($i = 0; $i < $bookingRequest->getTravelerCount(); ++$i)
+
+ for($i = 0; $i < $bookingRequest->getSingleRoomCount(); ++$i)
{
- //$this->context->atPa
$this->context->getValidator()->inContext($this->context)
- ->atPath('travelers['. $i .']')
- ->validate($bookingRequest->getTravelers()[$i])
+ ->atPath('rooms['.$i.']')
+ ->validate($bookingRequest->getSingleRooms()[$i])
;
- //$this->context->getValidator()->validate($bookingRequest->getTravelers()[$i]);
}
- //$this->context->getValidator()->startContext()
- //->atPath('travelers')->
+
+ for($j = 0; $j < $bookingRequest->getDoubleRoomCount(); ++$j)
+ {
+ $this->context->getValidator()->inContext($this->context)
+ ->atPath('rooms['.($j+5).']')
+ ->validate($bookingRequest->getDoubleRooms()[$j])
+ ;
+ }
+
+ for($k = 0; $k < $bookingRequest->getTripleRoomCount(); ++$k)
+ {
+ $this->context->getValidator()->inContext($this->context)
+ ->atPath('rooms['.($k + 10).']')
+ ->validate($bookingRequest->getTripleRooms()[$k])
+ ;
+ }
}
}
\ No newline at end of file