#1342
#1343
#1345
#1346
#1349

git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3340 f459cee4-fb09-11de-96c3-f9c5f16c3c76
This commit is contained in:
valentin.wacker 2017-07-20 09:59:11 +00:00
parent 27d2713283
commit 652eeb16cb
27 changed files with 994 additions and 204 deletions

View file

@ -18,6 +18,7 @@ class AppKernel extends Kernel
new Symfony\Bundle\AsseticBundle\AsseticBundle(), new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(), new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
new AppBundle\AppBundle(), new AppBundle\AppBundle(),
new WhiteOctober\TCPDFBundle\WhiteOctoberTCPDFBundle(),
]; ];
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) { if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {

View file

@ -32,7 +32,9 @@
<div id="navbar-collapse" class="navbar-left navbar-collapse collapse clearfix"> <div id="navbar-collapse" class="navbar-left navbar-collapse collapse clearfix">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li itemprop="name"><a href="#" title="" itemprop="">Kulturreisen</a></li> <li itemprop="name">
<a href="/" title="Kulturreisen" itemprop="">Kulturreisen</a>
</li>
<li itemprop="name"> <li itemprop="name">
<a href="https://www.stern-usedom.de" title="Usedom Ferienwohnungen" itemprop="url" <a href="https://www.stern-usedom.de" title="Usedom Ferienwohnungen" itemprop="url"
target="_blank" rel="nofollow" target="_blank" rel="nofollow"
@ -97,9 +99,9 @@
</div> </div>
</div><!-- end navbar-header --> </div><!-- end navbar-header -->
<div id="navbar-collapse" class="navbar-right"> <div id="navbar-collapse" class="navbar-right">
<div class="navbar-times hidden-xs"> <div class="navbar-times hidden-xs">
<span style="float:left; margin-top: 30pt; margin-right: 5pt">E-Mail: <a href="mailto:stern@sterntours.de">stern@sterntours.de</a></span>
<i class="fa fa-phone "></i> <i class="fa fa-phone "></i>
<span>Mo-Fr: 09:00 - 23:00 Uhr<br>Sa: 10:00 - 23:00 Uhr<br>So: 11:00 - 23:00 Uhr</span> <span>Mo-Fr: 09:00 - 23:00 Uhr<br>Sa: 10:00 - 23:00 Uhr<br>So: 11:00 - 23:00 Uhr</span>
</div> </div>

View file

@ -20,7 +20,7 @@ Abfahrts-/Abflugort: {{ booking_request.departure.name }} {{ booking_request.
{% endfor %} {% endfor %}
{% for option in booking_request.travelOptions %} {% for option in booking_request.travelOptions %}
{{ booking_request.travelerCount }}x zugebuchte Leistung (Erwachsener): {{ option.name }} {{ option.price|number_format(2) -}} {{ booking_request.travelerCount }}x zugebuchte Leistung (Erwachsener): {{ option.name }} {{ option.price|number_format(2) -}}
€: {{ (booking_request.travelerCount * option.price|number_format(2)) }} €: {{ (booking_request.travelerCount * option.price)|number_format(2) }}
{% endfor %} {% endfor %}
{% for classOption in booking_price_info['classOptions'] %} {% for classOption in booking_price_info['classOptions'] %}
{{ classOption['count'] }}x {{ classOption['name'] }} {{ classOption['price']|number_format(2) }} €: {{ {{ classOption['count'] }}x {{ classOption['name'] }} {{ classOption['price']|number_format(2) }} €: {{
@ -53,6 +53,7 @@ PLZ: {{ booking_request.zipCode }}
Ort: {{ booking_request.city }} Ort: {{ booking_request.city }}
Telefonnummer: {{ booking_request.phone }} Telefonnummer: {{ booking_request.phone }}
Fax: {{ booking_request.fax ?? 'keine Angabe' }} Fax: {{ booking_request.fax ?? 'keine Angabe' }}
E-Mail: {{ booking_request.email ?? 'keine Angabe' }}
===================================================================================== =====================================================================================
Reiseteilnehmer: Reiseteilnehmer:

View file

@ -24,6 +24,12 @@
</div> </div>
{%- endblock %} {%- endblock %}
{% block st_plain_date_widget -%}
<div class="input-group">
{{- block('form_widget_simple') -}}
</div>
{%- endblock %}
{% block checkbox_widget -%} {% block checkbox_widget -%}
{{- block('base_checkbox_widget') -}} {{- block('base_checkbox_widget') -}}
{%- endblock checkbox_widget %} {%- endblock checkbox_widget %}

View file

@ -71,11 +71,25 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<td>{{ form_label(form.travelerCount, 'Reiseteilnehmer') }}</td> <td>{{ form_label(form.singleRoomCount, 'Einzelzimmer') }}</td>
<td> <td>
Erwachsene<br> {{ form_widget(form.singleRoomCount) }}
{{ form_widget(form.travelerCount) }} {{ form_errors(form.singleRoomCount) }}
{{ form_errors(form.travelerCount) }}
</td>
</tr>
<tr>
<td>{{ form_label(form.doubleRoomCount, 'Doppelzimmer') }}</td>
<td>
{{ form_widget(form.doubleRoomCount) }}
{{ form_errors(form.doubleRoomCount) }}
</td>
</tr>
<tr>
<td>{{ form_label(form.tripleRoomCount, 'Dreibettzimmer') }}</td>
<td>
{{ form_widget(form.tripleRoomCount) }}
{{ form_errors(form.tripleRoomCount) }}
</td> </td>
</tr> </tr>
<tr> <tr>
@ -259,48 +273,55 @@
<div class="table-responsive" id="no-more-tables"> <div class="table-responsive" id="no-more-tables">
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th>Nr.</th> <th>Raum-Nr.</th>
<th>Geschlecht</th> <th>Geschlecht</th>
<th>Vorname</th> <th>Vorname</th>
<th>Nachname</th> <th>Nachname</th>
<th>Geburtsdatum (TT.MM.JJJJ)</th> <th>Geburtsdatum (TT.MM.JJJJ)</th>
</tr> </tr>
</thead> </thead>
<tbody class="st-travelers"> <tbody class="st-travelers">
{% set currentIndex = 0 %}
{% for traveler_form in form.travelers %} {% for room in form.rooms %}
<tr class="st-traveler st-traveler-{{ loop.index }}" {% for traveler in room.travelers %}
data-st-traveler-index="{{ loop.index }}" {#{{ dump(room.vars.value.roomType) }}#}
style="display: none;" {% set currentIndex = currentIndex + 1 %}
> <tr class="st-traveler st-traveler-{{ currentIndex }}"
<td> data-st-traveler-index="{{ currentIndex }}"
<button class="btn btn-primary btn-sm border-radius st-traveller-index" data-room-index="{{ loop.parent.loop.index }}"
type="button" data-room-type="{{ room.vars.value.type }}"
style="display: none;"
> >
{{ loop.index ?? '' }} <td>
</button> <button class="btn btn-primary btn-sm border-radius st-traveller-index"
</td> type="button"
<td> >
{{ form_field_pho(traveler_form.sex, 'Geschlecht', { {{ loop.parent.loop.index ?? '' }} <!-- TODO -->
required: false </button>
}) }} </td>
</td> <td>
<td> {{ form_field_pho(traveler.sex, 'Geschlecht', {
{{ form_field_pho(traveler_form.firstName, 'Vorname') }} required: false
</td> }) }}
<td> </td>
{{ form_field_pho(traveler_form.lastName, 'Nachname') }} <td>
</td> {{ form_field_pho(traveler.firstName, 'Vorname') }}
<td> </td>
{{ form_field_pho(traveler_form.birthDate, 'Geburtsdatum') }} <td>
</td> {{ form_field_pho(traveler.lastName, 'Nachname') }}
</tr> </td>
{% endfor %} <td>
{{ form_field_pho(traveler.birthDate, 'Geburtsdatum') }}
</td>
</tr>
{% endfor %}
{% endfor %}
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
</div><!-- end form-box --> </div><!-- end form-box -->

View file

@ -122,6 +122,10 @@
<div role="tabpanel" class="tab-pane active" id="travel-description-content-tab"> <div role="tabpanel" class="tab-pane active" id="travel-description-content-tab">
<a href="{{ page.slug }}/pdf" title="Reisebeschreibung als PDF herunterladen" style="position: relative; float: right; z-index: 1;">
<span>PDF herunterladen</span>
</a>
{{ travel_program.htmlDescription|raw|keywords }} {{ travel_program.htmlDescription|raw|keywords }}
{% if travel_program.advices is not empty %} {% if travel_program.advices is not empty %}

View file

@ -0,0 +1,33 @@
<h1>{{ travel_program.title|default(page.pagetitle)|default(page.title) }}</h1>
<h2 style="color: #666">{{ travel_program.subtitle }}</h2>
{{ travel_program.htmlDescription|raw|keywords }}
<h2>Eingeschlossene Leistungen</h2>
<ul>
{% for travel_program_service in travel_program.included|split('\n') %}
<li>{{ travel_program_service|raw }}</li>
{% endfor %}
</ul>
{% if travel_program.classDescription is not empty %}
{{ travel_program.classDescription|raw }}
{% endif %}
{% if travel_program.excluded is not empty %}
<h2>Nicht eingeschlossene / zubuchbare Leistungen</h2>
<ul>
{% for travel_program_service in travel_program.excluded|split('\n') %}
<li>{{ travel_program_service|raw }}</li>
{% endfor %}
</ul>
{% endif %}
{% if travel_program.advices is not empty %}
<h3>Hinweise</h3>
<ul>
{% for travel_program_advice in travel_program.advices|trim|split('\n') %}
<li>{{ travel_program_advice|raw }}</li>
{% endfor %}
</ul>
{% endif %}

View file

@ -27,11 +27,9 @@
</div> </div>
<div class="description col-md-9"> <div class="description col-md-9">
<span class="pull-right"> <span class="pull-right">
{# #TODO <a href="{{ travel_program.page.urlPath }}/pdf" class="btn btn-default btn-sm border-radius">
<a href="https://www.sterntours.de/travel_program/pdf/22/" class="btn btn-default btn-sm border-radius">
<i class="fa fa-file-pdf-o"></i> Druckversion <i class="fa fa-file-pdf-o"></i> Druckversion
</a> </a>
#}
</span> </span>
<div class="title clearfix">{{ travel_program.title }}</div> <div class="title clearfix">{{ travel_program.title }}</div>

View file

@ -86,9 +86,18 @@ assetic:
use_controller: '%kernel.debug%' use_controller: '%kernel.debug%'
filters: filters:
cssrewrite: ~ cssrewrite: ~
assets:
headerLogo:
inputs:
- '@AppBundle/Resources/public/images/wlogo.png'
footerText:
inputs:
- '@AppBundle/Resources/public/images/footer.svg'
stof_doctrine_extensions: stof_doctrine_extensions:
default_locale: de_DE default_locale: de_DE
orm: orm:
default: default:
tree: true tree: true
white_october_tcpdf:
class: 'AppBundle\Pdf'

View file

@ -44,4 +44,10 @@ services:
app.keyword_service: app.keyword_service:
class: AppBundle\Service\KeywordService class: AppBundle\Service\KeywordService
arguments: arguments:
- '@doctrine.orm.entity_manager' - '@doctrine.orm.entity_manager'
app.pdf:
class: AppBundle\Pdf
arguments:
- '%kernel.root_dir%'
- '@assetic.asset_manager'

View file

@ -26,7 +26,8 @@
"symfony/assetic-bundle": "^2.8", "symfony/assetic-bundle": "^2.8",
"stof/doctrine-extensions-bundle": "^1.2", "stof/doctrine-extensions-bundle": "^1.2",
"doctrine/doctrine-migrations-bundle": "^1.2", "doctrine/doctrine-migrations-bundle": "^1.2",
"twig/twig": "^2.0" "twig/twig": "^2.0",
"whiteoctober/tcpdf-bundle": "^1.0"
}, },
"require-dev": { "require-dev": {
"sensio/generator-bundle": "^3.0", "sensio/generator-bundle": "^3.0",

246
trunk/composer.lock generated
View file

@ -4,8 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"hash": "cafcb1290bf2f23646f9d7c96c217f14", "content-hash": "b22f213c1e171369413d747296060a39",
"content-hash": "602fab2a074b1ea2fe86866aa42ba50f",
"packages": [ "packages": [
{ {
"name": "behat/transliterator", "name": "behat/transliterator",
@ -45,7 +44,7 @@
"slug", "slug",
"transliterator" "transliterator"
], ],
"time": "2015-09-28 16:26:35" "time": "2015-09-28T16:26:35+00:00"
}, },
{ {
"name": "doctrine/annotations", "name": "doctrine/annotations",
@ -113,7 +112,7 @@
"docblock", "docblock",
"parser" "parser"
], ],
"time": "2016-12-30 15:59:45" "time": "2016-12-30T15:59:45+00:00"
}, },
{ {
"name": "doctrine/cache", "name": "doctrine/cache",
@ -183,7 +182,7 @@
"cache", "cache",
"caching" "caching"
], ],
"time": "2016-10-29 11:16:17" "time": "2016-10-29T11:16:17+00:00"
}, },
{ {
"name": "doctrine/collections", "name": "doctrine/collections",
@ -250,7 +249,7 @@
"collections", "collections",
"iterator" "iterator"
], ],
"time": "2017-01-03 10:49:41" "time": "2017-01-03T10:49:41+00:00"
}, },
{ {
"name": "doctrine/common", "name": "doctrine/common",
@ -323,7 +322,7 @@
"persistence", "persistence",
"spl" "spl"
], ],
"time": "2017-01-13 14:02:13" "time": "2017-01-13T14:02:13+00:00"
}, },
{ {
"name": "doctrine/dbal", "name": "doctrine/dbal",
@ -394,7 +393,7 @@
"persistence", "persistence",
"queryobject" "queryobject"
], ],
"time": "2017-02-08 12:53:47" "time": "2017-02-08T12:53:47+00:00"
}, },
{ {
"name": "doctrine/doctrine-bundle", "name": "doctrine/doctrine-bundle",
@ -475,7 +474,7 @@
"orm", "orm",
"persistence" "persistence"
], ],
"time": "2017-01-16 12:01:26" "time": "2017-01-16T12:01:26+00:00"
}, },
{ {
"name": "doctrine/doctrine-cache-bundle", "name": "doctrine/doctrine-cache-bundle",
@ -563,7 +562,7 @@
"cache", "cache",
"caching" "caching"
], ],
"time": "2016-01-26 17:28:51" "time": "2016-01-26T17:28:51+00:00"
}, },
{ {
"name": "doctrine/doctrine-migrations-bundle", "name": "doctrine/doctrine-migrations-bundle",
@ -624,7 +623,7 @@
"migrations", "migrations",
"schema" "schema"
], ],
"time": "2016-12-05 18:36:37" "time": "2016-12-05T18:36:37+00:00"
}, },
{ {
"name": "doctrine/inflector", "name": "doctrine/inflector",
@ -691,7 +690,7 @@
"singularize", "singularize",
"string" "string"
], ],
"time": "2015-11-06 14:35:42" "time": "2015-11-06T14:35:42+00:00"
}, },
{ {
"name": "doctrine/instantiator", "name": "doctrine/instantiator",
@ -745,7 +744,7 @@
"constructor", "constructor",
"instantiate" "instantiate"
], ],
"time": "2015-06-14 21:17:01" "time": "2015-06-14T21:17:01+00:00"
}, },
{ {
"name": "doctrine/lexer", "name": "doctrine/lexer",
@ -799,7 +798,7 @@
"lexer", "lexer",
"parser" "parser"
], ],
"time": "2014-09-09 13:34:57" "time": "2014-09-09T13:34:57+00:00"
}, },
{ {
"name": "doctrine/migrations", "name": "doctrine/migrations",
@ -873,7 +872,7 @@
"database", "database",
"migrations" "migrations"
], ],
"time": "2016-12-25 22:54:00" "time": "2016-12-25T22:54:00+00:00"
}, },
{ {
"name": "doctrine/orm", "name": "doctrine/orm",
@ -949,7 +948,7 @@
"database", "database",
"orm" "orm"
], ],
"time": "2016-12-18 15:42:34" "time": "2016-12-18T15:42:34+00:00"
}, },
{ {
"name": "gedmo/doctrine-extensions", "name": "gedmo/doctrine-extensions",
@ -1028,7 +1027,7 @@
"tree", "tree",
"uploadable" "uploadable"
], ],
"time": "2016-12-21 13:46:54" "time": "2016-12-21T13:46:54+00:00"
}, },
{ {
"name": "incenteev/composer-parameter-handler", "name": "incenteev/composer-parameter-handler",
@ -1079,7 +1078,7 @@
"keywords": [ "keywords": [
"parameters management" "parameters management"
], ],
"time": "2015-11-10 17:04:01" "time": "2015-11-10T17:04:01+00:00"
}, },
{ {
"name": "jdorn/sql-formatter", "name": "jdorn/sql-formatter",
@ -1129,7 +1128,7 @@
"highlight", "highlight",
"sql" "sql"
], ],
"time": "2014-01-12 16:20:24" "time": "2014-01-12T16:20:24+00:00"
}, },
{ {
"name": "kriswallsmith/assetic", "name": "kriswallsmith/assetic",
@ -1206,7 +1205,7 @@
"compression", "compression",
"minification" "minification"
], ],
"time": "2016-11-11 18:43:20" "time": "2016-11-11T18:43:20+00:00"
}, },
{ {
"name": "monolog/monolog", "name": "monolog/monolog",
@ -1284,7 +1283,7 @@
"logging", "logging",
"psr-3" "psr-3"
], ],
"time": "2016-11-26 00:15:39" "time": "2016-11-26T00:15:39+00:00"
}, },
{ {
"name": "ocramius/package-versions", "name": "ocramius/package-versions",
@ -1332,7 +1331,7 @@
} }
], ],
"description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", "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", "name": "ocramius/proxy-manager",
@ -1397,7 +1396,7 @@
"proxy pattern", "proxy pattern",
"service proxies" "service proxies"
], ],
"time": "2016-11-04 15:53:15" "time": "2016-11-04T15:53:15+00:00"
}, },
{ {
"name": "paragonie/random_compat", "name": "paragonie/random_compat",
@ -1445,31 +1444,7 @@
"pseudorandom", "pseudorandom",
"random" "random"
], ],
"time": "2016-11-07 23:38:38" "time": "2016-11-07T23:38:38+00:00"
},
{
"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"
}, },
{ {
"name": "psr/cache", "name": "psr/cache",
@ -1515,7 +1490,7 @@
"psr", "psr",
"psr-6" "psr-6"
], ],
"time": "2016-08-06 20:24:11" "time": "2016-08-06T20:24:11+00:00"
}, },
{ {
"name": "psr/log", "name": "psr/log",
@ -1562,7 +1537,7 @@
"psr", "psr",
"psr-3" "psr-3"
], ],
"time": "2016-10-10 12:19:37" "time": "2016-10-10T12:19:37+00:00"
}, },
{ {
"name": "sensio/distribution-bundle", "name": "sensio/distribution-bundle",
@ -1614,7 +1589,7 @@
"configuration", "configuration",
"distribution" "distribution"
], ],
"time": "2017-01-10 14:58:45" "time": "2017-01-10T14:58:45+00:00"
}, },
{ {
"name": "sensio/framework-extra-bundle", "name": "sensio/framework-extra-bundle",
@ -1684,7 +1659,7 @@
"annotations", "annotations",
"controllers" "controllers"
], ],
"time": "2017-02-15 06:52:30" "time": "2017-02-15T06:52:30+00:00"
}, },
{ {
"name": "sensiolabs/security-checker", "name": "sensiolabs/security-checker",
@ -1728,7 +1703,7 @@
} }
], ],
"description": "A security checker for your composer.lock", "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", "name": "stof/doctrine-extensions-bundle",
@ -1789,7 +1764,7 @@
"translatable", "translatable",
"tree" "tree"
], ],
"time": "2016-01-26 23:58:32" "time": "2016-01-26T23:58:32+00:00"
}, },
{ {
"name": "swiftmailer/swiftmailer", "name": "swiftmailer/swiftmailer",
@ -1843,7 +1818,7 @@
"mail", "mail",
"mailer" "mailer"
], ],
"time": "2017-02-13 07:52:53" "time": "2017-02-13T07:52:53+00:00"
}, },
{ {
"name": "symfony/assetic-bundle", "name": "symfony/assetic-bundle",
@ -1913,7 +1888,7 @@
"compression", "compression",
"minification" "minification"
], ],
"time": "2016-11-22 11:42:57" "time": "2016-11-22T11:42:57+00:00"
}, },
{ {
"name": "symfony/monolog-bundle", "name": "symfony/monolog-bundle",
@ -1973,7 +1948,7 @@
"log", "log",
"logging" "logging"
], ],
"time": "2017-01-02 19:04:26" "time": "2017-01-02T19:04:26+00:00"
}, },
{ {
"name": "symfony/polyfill-apcu", "name": "symfony/polyfill-apcu",
@ -2026,7 +2001,7 @@
"portable", "portable",
"shim" "shim"
], ],
"time": "2016-11-14 01:06:16" "time": "2016-11-14T01:06:16+00:00"
}, },
{ {
"name": "symfony/polyfill-intl-icu", "name": "symfony/polyfill-intl-icu",
@ -2084,7 +2059,7 @@
"portable", "portable",
"shim" "shim"
], ],
"time": "2016-11-14 01:06:16" "time": "2016-11-14T01:06:16+00:00"
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
@ -2143,7 +2118,7 @@
"portable", "portable",
"shim" "shim"
], ],
"time": "2016-11-14 01:06:16" "time": "2016-11-14T01:06:16+00:00"
}, },
{ {
"name": "symfony/polyfill-php56", "name": "symfony/polyfill-php56",
@ -2199,7 +2174,7 @@
"portable", "portable",
"shim" "shim"
], ],
"time": "2016-11-14 01:06:16" "time": "2016-11-14T01:06:16+00:00"
}, },
{ {
"name": "symfony/polyfill-php70", "name": "symfony/polyfill-php70",
@ -2258,7 +2233,7 @@
"portable", "portable",
"shim" "shim"
], ],
"time": "2016-11-14 01:06:16" "time": "2016-11-14T01:06:16+00:00"
}, },
{ {
"name": "symfony/polyfill-util", "name": "symfony/polyfill-util",
@ -2310,7 +2285,7 @@
"polyfill", "polyfill",
"shim" "shim"
], ],
"time": "2016-11-14 01:06:16" "time": "2016-11-14T01:06:16+00:00"
}, },
{ {
"name": "symfony/swiftmailer-bundle", "name": "symfony/swiftmailer-bundle",
@ -2369,7 +2344,7 @@
], ],
"description": "Symfony SwiftmailerBundle", "description": "Symfony SwiftmailerBundle",
"homepage": "http://symfony.com", "homepage": "http://symfony.com",
"time": "2016-12-20 04:44:33" "time": "2016-12-20T04:44:33+00:00"
}, },
{ {
"name": "symfony/symfony", "name": "symfony/symfony",
@ -2511,7 +2486,70 @@
"keywords": [ "keywords": [
"framework" "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", "name": "twig/twig",
@ -2573,7 +2611,51 @@
"keywords": [ "keywords": [
"templating" "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", "name": "zendframework/zend-code",
@ -2626,7 +2708,7 @@
"code", "code",
"zf2" "zf2"
], ],
"time": "2016-10-24 13:23:32" "time": "2016-10-24T13:23:32+00:00"
}, },
{ {
"name": "zendframework/zend-eventmanager", "name": "zendframework/zend-eventmanager",
@ -2680,10 +2762,34 @@
"events", "events",
"zf2" "zf2"
], ],
"time": "2016-12-19 21:47:12" "time": "2016-12-19T21:47:12+00:00"
} }
], ],
"packages-dev": [ "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", "name": "sensio/generator-bundle",
"version": "v3.1.2", "version": "v3.1.2",
@ -2734,7 +2840,7 @@
} }
], ],
"description": "This bundle generates code for you", "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", "name": "symfony/phpunit-bridge",
@ -2793,7 +2899,7 @@
], ],
"description": "Symfony PHPUnit Bridge", "description": "Symfony PHPUnit Bridge",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2017-01-21 17:06:35" "time": "2017-01-21T17:06:35+00:00"
} }
], ],
"aliases": [], "aliases": [],

View file

@ -64,7 +64,8 @@ class BookingController extends Controller
$bookingRequest = new BookingRequest(); $bookingRequest = new BookingRequest();
if ($request->getMethod() != 'POST') if ($request->getMethod() != 'POST')
{ {
$bookingRequest->setTravelerCount(2); $bookingRequest->setDoubleRoomCount(1);
$bookingRequest->setRoomCount(2);
$bookingRequest->setDeparture($travelDate->getDepartures()[0]); $bookingRequest->setDeparture($travelDate->getDepartures()[0]);
} }
$form = $this->createForm(BookingRequestType::class, $bookingRequest, [ $form = $this->createForm(BookingRequestType::class, $bookingRequest, [
@ -85,6 +86,8 @@ class BookingController extends Controller
$breadcrumbEntries = Util::createBreadcrumb($travelProgramPage); $breadcrumbEntries = Util::createBreadcrumb($travelProgramPage);
$breadcrumbEntries[] = new BreadcrumbEntry('Buchen'); $breadcrumbEntries[] = new BreadcrumbEntry('Buchen');
if ($request->getMethod() == 'POST' && $form->isValid()) if ($request->getMethod() == 'POST' && $form->isValid())
{ {
$booking = $this->getDoctrine()->getRepository('AppBundle:TravelBooking')->createFromBookingRequest( $booking = $this->getDoctrine()->getRepository('AppBundle:TravelBooking')->createFromBookingRequest(
@ -187,7 +190,11 @@ class BookingController extends Controller
{ {
$ret = 0; $ret = 0;
$insuranceAssessmentBasis = 0; $insuranceAssessmentBasis = 0;
$travelerCount = $bookingRequest->getTravelerCount(); $travelerCount = $bookingRequest->getTravelerCount();
$singleRoomCount = $bookingRequest->getSingleRoomCount();
$doubleRoomCount = $bookingRequest->getDoubleRoomCount();
$tripleRoomCount = $bookingRequest->getTripleRoomCount();
if (isset($outHtmlSummary)) if (isset($outHtmlSummary))
{ {
$insuranceHtmlSummary = []; $insuranceHtmlSummary = [];
@ -242,24 +249,19 @@ class BookingController extends Controller
} }
} }
$persons = [ $persons = [
'total' => $travelerCount, 'total' => $travelerCount,
'adults' => $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))
{ $possibleRooms = $this->getRooms($travelDate->getPrices(), $persons);
if ($travelerCount % 2 == 0)
{
$possibleRooms = $this->splitIntoTwoGroups($travelDate->getPrices(), $persons, 'equal');
}
elseif ($travelerCount >= 3)
{
$possibleRooms = $this->splitIntoTwoGroups($travelDate->getPrices(), $persons, 'move_without_children');
}
}
if ($bookingRequest->getComfort()) if ($bookingRequest->getComfort())
{ {
@ -385,52 +387,61 @@ class BookingController extends Controller
* *
* @return array * @return array
*/ */
private function searchRooms($prices, $persons) private function getRooms($prices, $persons)
{ {
$ret = []; $ret = [];
foreach ($prices as $price)
foreach($prices as $price)
{ {
$priceType = $this->priceTypeById[$price->getPriceTypeId()]; $priceTypeId = $price->getPriceTypeId();
if ($priceType->getMax() == $persons['total'] && $priceType = $this->priceTypeById[$priceTypeId];
$priceType->getMaxAdults() >= $persons['adults'] &&
$priceType->getMinAdults() <= $persons['adults'] && if($priceTypeId == 1 && $persons['singleRoomPersons'] > 0)
$priceType->getMaxChildren() >= $persons['children'])
{ {
$currentPersons = [
'total' => $persons['singleRoomPersons'],
'adults' => $persons['singleRoomPersons'],
'children' => 0 //TODO
];
$ret[] = [ $ret[] = [
'priceType' => $priceType, '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 'price' => $price
]; ];
} }
} }
return $ret; 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);
}
} }

View file

@ -13,6 +13,8 @@ use AppBundle\Form\TtSearchRequestType;
use AppBundle\Listener\KernelControllerListener; use AppBundle\Listener\KernelControllerListener;
use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManager;
use Symfony\Bundle\FrameworkBundle\Controller\Controller; 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). * 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('#<p><a(.*)>(.*)</a></p>#Uis', '', $pageHTML->getContent());
$filteredContent = preg_replace('#<a(.*)>#Uis', '', $filteredContent);
$filteredContent = preg_replace('#</a>#Uis', '', $filteredContent);
$filteredContent = str_replace('*', '<img src="https://www.stern-tours.de/images/icons/star-mini.png" />', $filteredContent);
// Schreiben des HTML
$pdfObj->writeHTML('<strong>Reiseangebot zu finden unter:</strong><br /><a href="'.$url.'"style="text-decoration: none!; font-size: 10px; color: black;">'.$url.'</a><br />');
$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 * @param Page $page
* *

View file

@ -26,7 +26,13 @@ class BookingRequest
*/ */
private $departure; private $departure;
private $travelerCount; private $singleRoomCount;
private $doubleRoomCount;
private $tripleRoomCount;
private $roomCount;
/** /**
* @var TravelInsurance $insurance * @var TravelInsurance $insurance
@ -80,6 +86,10 @@ class BookingRequest
private $travelers = []; private $travelers = [];
private $singleRooms = [];
private $doubleRooms = [];
private $tripleRooms = [];
private $notes; private $notes;
/** /**
@ -92,9 +102,11 @@ class BookingRequest
*/ */
public function __construct() 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() 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; $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 * @return TravelInsurance
*/ */
@ -338,12 +449,33 @@ class BookingRequest
$this->email = $email; $this->email = $email;
} }
// get und set der Travelers liegt jetzt in Room; sollte so nicht mehr verwendet werden!
/** /**
* @return Traveler[] * @return Traveler[]
*/ */
public function getTravelers() 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; $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) public function addTraveler(Traveler $traveler)
{ {

View file

@ -0,0 +1,87 @@
<?php
namespace AppBundle\Entity;
use Symfony\Component\Validator\Constraints as Assert;
class Room
{
// von BookingRequest abgeguckt, brauch ich das überhaupt, wenn ich bei $type ein Assert habe?
const SINGLE = 1;
const DOUBLE = 2;
const TRIPLE = 3;
/**
* @Assert\NotNull
* @Assert\Choice(choices={1,2,3})
*/
private $type;
/**
* @Assert\Valid
*/
private $travelers = [];
private $travelerCount;
public function __construct($type)
{
$this->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;
}
}

View file

@ -59,7 +59,8 @@ class TravelBookingRepository extends \Doctrine\ORM\EntityRepository
} }
$ret->setInsurances($insurances); $ret->setInsurances($insurances);
} }
$ret->setParticipants(array_slice($bookingRequest->getTravelers(), 0, $bookingRequest->getTravelerCount()));
$ret->setParticipants($bookingRequest->getTravelers());
$ret->setParticipantsTotal($bookingRequest->getTravelerCount()); $ret->setParticipantsTotal($bookingRequest->getTravelerCount());
$ret->setRooms($bookingPriceInfo['rooms']); $ret->setRooms($bookingPriceInfo['rooms']);
$ret->setPriceTotal($bookingPriceInfo['total']); $ret->setPriceTotal($bookingPriceInfo['total']);

View file

@ -29,11 +29,31 @@ use Symfony\Component\Validator\Constraints\NotNull;
class BookingRequestType extends AbstractType class BookingRequestType extends AbstractType
{ {
public static $TRAVELER_COUNT_CHOICES = [ public static $SINGLE_ROOM_COUNT_CHOICES = [
'1 Person' => 1, '0 Einzelzimmer' => 0,
'2 Personen' => 2, '1 Einzelzimmer' => 1,
'3 Personen' => 3, '2 Einzelzimmer' => 2,
'4 Personen' => 4, '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 = [ public static $NATION_CHOICES = [
@ -110,8 +130,8 @@ class BookingRequestType extends AbstractType
->add('phone') ->add('phone')
->add('fax') ->add('fax')
->add('email') ->add('email')
->add('travelers', CollectionType::class, [ ->add('rooms', CollectionType::class, [
'entry_type' => TravelerType::class, 'entry_type' => RoomType::class,
'by_reference' => false, 'by_reference' => false,
]) ])
->add('notes', TextareaType::class, ['required' => false]) ->add('notes', TextareaType::class, ['required' => false])
@ -130,11 +150,25 @@ class BookingRequestType extends AbstractType
)] )]
]); ]);
$builder->add('travelerCount', ChoiceType::class, [ $builder->add('singleRoomCount', ChoiceType::class, [
'choices' => self::$TRAVELER_COUNT_CHOICES, 'choices' => self::$SINGLE_ROOM_COUNT_CHOICES,
'constraints' => [ '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 = []; $insuranceChoices = [];
@ -159,6 +193,8 @@ class BookingRequestType extends AbstractType
]); ]);
} }
//$travelDate->getPrices()[0]->getPriceType()
if ($travelDate->hasComfortCategory()) if ($travelDate->hasComfortCategory())
{ {
$builder->add('comfort', CheckboxType::class, ['required' => false]); $builder->add('comfort', CheckboxType::class, ['required' => false]);

View file

@ -0,0 +1,47 @@
<?php
namespace AppBundle\Form;
//use AppBundle\Entity\Traveler;
use AppBundle\Entity\Room;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
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 RoomType extends AbstractType
{
public static $TYPE_CHOICES = [
'Einzelzimmer' => 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,
]);
}
}

View file

@ -0,0 +1,25 @@
<?php
namespace AppBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\DateType;
class StPlainDateType extends AbstractType
{
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'placeholder' => 'TT.MM.JJJJ',
'widget' => 'single_text',
'format' => 'dd.MM.yyyy'
]);
}
public function getParent()
{
return DateType::class;
}
}

View file

@ -50,7 +50,7 @@ class TravelerType extends AbstractType
]) ])
->add('firstName') ->add('firstName')
->add('lastName') ->add('lastName')
->add('birthDate', DateType::class, [ ->add('birthDate', StPlainDateType::class, [
'widget' => 'single_text', 'widget' => 'single_text',
'format' => 'dd.MM.yyyy', 'format' => 'dd.MM.yyyy',
'required' => true, 'required' => true,

View file

@ -132,6 +132,11 @@ class KernelControllerListener
$request->attributes->set('action', $restOfPath); $request->attributes->set('action', $restOfPath);
$request->attributes->set('_controller', 'AppBundle:Booking:index'); $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) elseif ($node->getTravelProgram() != null)
{ {
if ($node->getTravelProgram()->getStatus() == 0) if ($node->getTravelProgram()->getStatus() == 0)

View file

@ -0,0 +1,53 @@
<?php
namespace AppBundle;
use TCPDF;
class Pdf extends TCPDF
{
private $webDir;
private $assetManager;
function __construct($rootDir, $assetManager)
{
parent::__construct('P', 'mm', 'A4', true, 'UTF-8', false, false);//($orientation, $unit, $format, $unicode, $encoding, $diskcache, $pdfa);//('P', 'mm', 'A4', true, 'UTF-8', false, false);
$this->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 */

View file

@ -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
================================================================== */

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" id="Ebene_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="595.358px" height="191.533px" viewBox="0 0 595.358 191.533" enable-background="new 0 0 595.358 191.533"
xml:space="preserve">
<rect x="30.424" y="97.229" fill="none" width="95.653" height="79.521"/>
<text transform="matrix(1 0 0 1 30.4243 103.3096)"><tspan x="0" y="0" fill="#7e7e7e" font-family="'Tahoma-Bold'" font-size="8">STERN TOURS GmbH</tspan><tspan x="0" y="9.5" fill="#1E181A" font-family="'Tahoma-Bold'" font-size="8">Uhlandstraße 137</tspan><tspan x="0" y="19" fill="#1E181A" font-family="'Tahoma'" font-size="8">10717 Berlin </tspan></text>
<rect x="144.078" y="97.229" fill="none" width="126.32" height="79.521"/>
<text transform="matrix(1 0 0 1 144.0776 103.3096)"><tspan x="0" y="0" fill="#7e7e7e" font-family="'Tahoma-Bold'" font-size="8">e-Mail</tspan><tspan x="24.961" y="0" fill="#1E181A" font-family="'Tahoma'" font-size="8" letter-spacing="1"> </tspan><tspan x="28.667" y="0" fill="#1E181A" font-family="'Tahoma'" font-size="8"> stern@stern-tours.de</tspan><tspan x="0" y="9.5" fill="#7e7e7e" font-family="'Tahoma-Bold'" font-size="8">Web</tspan><tspan x="18.027" y="9.5" fill="#1E181A" font-family="'Tahoma'" font-size="8" letter-spacing="8"> </tspan><tspan x="28.667" y="9.5" fill="#1E181A" font-family="'Tahoma'" font-size="8"> www.stern-tours.de</tspan><tspan x="0" y="28.5" fill="#7e7e7e" font-family="'Tahoma-Bold'" font-size="8">Fon</tspan><tspan x="14.707" y="28.5" fill="#1E181A" font-family="'Tahoma'" font-size="8" letter-spacing="11"> </tspan><tspan x="28.667" y="28.5" fill="#1E181A" font-family="'Tahoma'" font-size="8"> 030 | 700 94 100</tspan><tspan x="0" y="38" fill="#7e7e7e" font-family="'Tahoma-Bold'" font-size="8">Fax</tspan><tspan x="14.273" y="38" fill="#1E181A" font-family="'Tahoma'" font-size="8" letter-spacing="11"> </tspan><tspan x="28.667" y="38" fill="#1E181A" font-family="'Tahoma'" font-size="8"> 030 | 700 94 1044</tspan></text>
<rect x="287.48" y="97.229" fill="none" width="135.597" height="79.521"/>
<text transform="matrix(1 0 0 1 287.4805 103.3086)"><tspan x="0" y="0" fill="#7e7e7e" font-family="'Tahoma-Bold'" font-size="8">Bankverbindung</tspan><tspan x="0" y="9.5" fill="#1E181A" font-family="'Tahoma'" font-size="8">STERN TOURS GmbH</tspan><tspan x="0" y="19" fill="#1E181A" font-family="'Tahoma'" font-size="8">Hypo Vereinsbank</tspan><tspan x="0" y="28.5" fill="#1E181A" font-family="'Tahoma'" font-size="8">BLZ: 10020890</tspan><tspan x="0" y="38" fill="#1E181A" font-family="'Tahoma'" font-size="8">Kto.: 18857111</tspan><tspan x="0" y="57" fill="#1E181A" font-family="'Tahoma'" font-size="8">IBAN: DE83100208900018857111</tspan><tspan x="0" y="66.5" fill="#1E181A" font-family="'Tahoma'" font-size="8">BIC-/SWIFT-Code: HYVEDEMM488</tspan></text>
<rect x="447.182" y="97.229" fill="none" width="129.12" height="88.521"/>
<text transform="matrix(1 0 0 1 447.1821 103.3086)"><tspan x="0" y="0" fill="#7e7e7e" font-family="'Tahoma-Bold'" font-size="8">Telefonische Öffnungszeiten</tspan><tspan x="0" y="9.5" fill="#1E181A" font-family="'Tahoma'" font-size="8">Mo - Do:</tspan><tspan x="31.012" y="9.5" fill="#1E181A" font-family="'Tahoma'" font-size="8" letter-spacing="10"> </tspan><tspan x="43.75" y="9.5" fill="#1E181A" font-family="'Tahoma'" font-size="8">09:00 - 23:00 Uhr</tspan><tspan x="0" y="19" fill="#1E181A" font-family="'Tahoma'" font-size="8">Fr:</tspan><tspan x="9.883" y="19" fill="#1E181A" font-family="'Tahoma'" font-size="8" letter-spacing="13"> </tspan><tspan x="26" y="19" fill="#1E181A" font-family="'Tahoma'" font-size="8" letter-spacing="15"> </tspan><tspan x="43.75" y="19" fill="#1E181A" font-family="'Tahoma'" font-size="8">10:00 - 23:00 Uhr</tspan><tspan x="0" y="28.5" fill="#1E181A" font-family="'Tahoma'" font-size="8">Sa: </tspan><tspan x="13.984" y="28.5" fill="#1E181A" font-family="'Tahoma'" font-size="8" letter-spacing="9"> </tspan><tspan x="26" y="28.5" fill="#1E181A" font-family="'Tahoma'" font-size="8" letter-spacing="15"> </tspan><tspan x="43.75" y="28.5" fill="#1E181A" font-family="'Tahoma'" font-size="8">11:00 - 23.00 Uhr</tspan><tspan x="0" y="47.5" fill="#1E181A" font-family="'Tahoma'" font-size="8">UStID:</tspan><tspan x="23.617" y="47.5" fill="#1E181A" font-family="'Tahoma'" font-size="8"> </tspan><tspan x="26" y="47.5" fill="#1E181A" font-family="'Tahoma'" font-size="8"> DE192609253</tspan><tspan x="0" y="57" fill="#1E181A" font-family="'Tahoma'" font-size="8">Registernummer: HRB 67111</tspan><tspan x="0" y="66.5" fill="#1E181A" font-family="'Tahoma'" font-size="8">Amtsgericht Charlottenburg</tspan></text>
</svg>

After

Width:  |  Height:  |  Size: 4.9 KiB

View file

@ -2,7 +2,12 @@ $(document).ready(function() {
var frm$ = $('.st-booking-form'); var frm$ = $('.st-booking-form');
var summary$ = $('.st-booking-summary'); 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 travelers$ = $('.st-traveler');
var travelerFields$ = travelers$.find('input,select'); var travelerFields$ = travelers$.find('input,select');
@ -31,15 +36,58 @@ $(document).ready(function() {
function updateTravelers() 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(); travelers$.hide();
travelerFields$.prop('required', false); 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();
}); });

View file

@ -38,17 +38,29 @@ class BookingRequestValidator extends ConstraintValidator
*/ */
public function validate($bookingRequest, Constraint $constraint) 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) $this->context->getValidator()->inContext($this->context)
->atPath('travelers['. $i .']') ->atPath('rooms['.$i.']')
->validate($bookingRequest->getTravelers()[$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])
;
}
} }
} }