12.21
This commit is contained in:
parent
ebf90ff869
commit
4e71ddabec
17 changed files with 448 additions and 101 deletions
|
|
@ -90,7 +90,11 @@
|
||||||
</style>
|
</style>
|
||||||
<body class="no-js">
|
<body class="no-js">
|
||||||
<div id="wrapper">
|
<div id="wrapper">
|
||||||
{{ render(controller('AppBundle:Component:header')) }}
|
{% if page is defined %}
|
||||||
|
{{ render(controller('AppBundle:Component:header', {'page': page})) }}
|
||||||
|
{% else %}
|
||||||
|
{{ render(controller('AppBundle:Component:header', {'page': null})) }}
|
||||||
|
{% endif %}
|
||||||
{% block header2 %}
|
{% block header2 %}
|
||||||
<section class="section fullscreen background lozad" data-background-image="/bundles/app/images/travel/header-top-image3.jpg" style="background-image:url({{ asset('images/placeholder-image.png') }});">
|
<section class="section fullscreen background lozad" data-background-image="/bundles/app/images/travel/header-top-image3.jpg" style="background-image:url({{ asset('images/placeholder-image.png') }});">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
|
|
@ -119,7 +123,6 @@
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div id="fullwidth" class="col-sm-12">
|
<div id="fullwidth" class="col-sm-12">
|
||||||
|
|
||||||
{% block breadcrumb %}
|
{% block breadcrumb %}
|
||||||
{% if page is defined %}
|
{% if page is defined %}
|
||||||
{{ render(controller('AppBundle:Component:breadcrumb', {'page': page})) }}
|
{{ render(controller('AppBundle:Component:breadcrumb', {'page': page})) }}
|
||||||
|
|
@ -170,6 +173,18 @@
|
||||||
|
|
||||||
{% block javascripts %}
|
{% block javascripts %}
|
||||||
<script rel="preload" src="{{ asset('js/custom-min.js?v') }}{{ get_file_last_time('js/custom-min.js') }}"></script>
|
<script rel="preload" src="{{ asset('js/custom-min.js?v') }}{{ get_file_last_time('js/custom-min.js') }}"></script>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('a.travel-booking-content-open').click(function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
$('a.travel-booking-content').tab('show');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
{% endblock javascripts %}
|
{% endblock javascripts %}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,56 @@
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<ul class="top-links block wrap" id="topNavAccordion">
|
<ul class="top-links block wrap" id="topNavAccordion">
|
||||||
|
<li>
|
||||||
|
<a class="dropdown-toggle no-text-underline collapsed" data-toggle="collapse" href="#collapseTopTravelDates" role="button" aria-expanded="false" aria-controls="collapseTopTravelDates">
|
||||||
|
<i class="fa fa-plane"></i> Reisetermine
|
||||||
|
<i class="fa fa-caret-collapse"></i>
|
||||||
|
</a>
|
||||||
|
<!-- ab Montag um 09:00 Uhr -->
|
||||||
|
<!-- bis xxx Uhr -->
|
||||||
|
<div class="dropdown-menu-infos collapse" id="collapseTopTravelDates">
|
||||||
|
<div class="dropdown-menu-body">
|
||||||
|
<div class="badge badge-default btn-block">
|
||||||
|
<span class="text-default">{{ header_travel_program.title }} <br>
|
||||||
|
</div>
|
||||||
|
<table class="table table-condensed table-vertical-middle">
|
||||||
|
<tr>
|
||||||
|
<th class="text-left">Hinflug</th>
|
||||||
|
<th class="text-left">Rückflug</th>
|
||||||
|
<th class="text-left">Preis p. P.</th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{% set last_name = "" %}
|
||||||
|
{% for travel_date in header_travel_program.travelDates('header') if travel_date.status >= 0 %}
|
||||||
|
{% if loop.index <= 6 %}
|
||||||
|
{% if last_name != travel_date.name %}
|
||||||
|
{% set last_name = travel_date.name %}
|
||||||
|
<tr>
|
||||||
|
<td class="text-left">{{ travel_date.start|date }}</td>
|
||||||
|
<td class="text-left">{{ travel_date.end|date }}</td>
|
||||||
|
<td class="text-left">
|
||||||
|
<strong>
|
||||||
|
{% if travel_date.prices[3] is defined %}
|
||||||
|
{% if travel_date.prices[3].available == "1" %}
|
||||||
|
{% if travel_date.prices[3].effectiveDiscountPrice %}
|
||||||
|
<a href="{{ header_travel_program.page.urlPath }}" style="color: #558c55; text-decoration: underline;">
|
||||||
|
ab {{ travel_date.prices[3].effectiveDiscountPrice|number_format }} €
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
</strong>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
<a href="{{ header_travel_program.page.getUrlPathBefore }}">weitere Rundreisen ansehen</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="dropdown-toggle no-text-underline collapsed" data-toggle="collapse" href="#collapseTopPhone" role="button" aria-expanded="false" aria-controls="collapseTopPhone">
|
<a class="dropdown-toggle no-text-underline collapsed" data-toggle="collapse" href="#collapseTopPhone" role="button" aria-expanded="false" aria-controls="collapseTopPhone">
|
||||||
<i class="fa fa-phone-square"></i> 030 - 700 94 100 •
|
<i class="fa fa-phone-square"></i> 030 - 700 94 100 •
|
||||||
|
|
|
||||||
|
|
@ -68,9 +68,14 @@
|
||||||
Ausstattung
|
Ausstattung
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="#travel-saisons-content-tab" aria-controls="travel-saisons-content-tab" role="tab" data-toggle="tab">
|
||||||
|
Saisons <i class="fa fa-star"></i> Preise
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<li class="active">
|
<li class="active">
|
||||||
<a href="#travel-dates-content-tab" aria-controls="travel-dates-content-tab" role="tab" data-toggle="tab">
|
<a href="#travel-booking-content-tab" class="travel-booking-content" aria-controls="travel-booking-content-tab" role="tab" data-toggle="tab">
|
||||||
Termine <i class="fa fa-star"></i> Preise <i class="fa fa-star"></i> Mieten
|
Kalender <i class="fa fa-star"></i> Buchen
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
@ -139,7 +144,7 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</div> <!-- END tabpanel -->
|
</div>
|
||||||
|
|
||||||
{#
|
{#
|
||||||
********* AUSSTATTUNG *********
|
********* AUSSTATTUNG *********
|
||||||
|
|
@ -149,14 +154,14 @@
|
||||||
<div>
|
<div>
|
||||||
{{ fewo_lodging.equipment|raw }}
|
{{ fewo_lodging.equipment|raw }}
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- END tabpanel -->
|
</div>
|
||||||
|
|
||||||
{#
|
{#
|
||||||
********* TERMINE UND PREISE *********
|
********* TERMINE UND PREISE *********
|
||||||
#}
|
#}
|
||||||
|
|
||||||
<div role="tabpanel" class="tab-pane active" id="travel-dates-content-tab">
|
<div role="tabpanel" class="tab-pane" id="travel-saisons-content-tab">
|
||||||
<h3>Saisons</h3>
|
<h3>Saisons <i class="fa fa-star"></i> Preise</h3>
|
||||||
<div class="table-responsive" id="no-more-tables">
|
<div class="table-responsive" id="no-more-tables">
|
||||||
|
|
||||||
{% if fewo_lodging.prices is not empty %}
|
{% if fewo_lodging.prices is not empty %}
|
||||||
|
|
@ -182,14 +187,20 @@
|
||||||
</strong>
|
</strong>
|
||||||
</td>
|
</td>
|
||||||
<td data-title="Beginn">
|
<td data-title="Beginn">
|
||||||
<a class="default scroll-to-jump" href="#jump-{{ price.season.fromDate|date("n-Y") }}">
|
{#<a class="default scroll-to-jump" >
|
||||||
{{ price.season.fromDate|date }}
|
{{ price.season.fromDate|date }}
|
||||||
</a>
|
</a>#}
|
||||||
|
<strong>
|
||||||
|
<a href="#jump-{{ price.season.fromDate|date("n-Y") }}"class="default travel-booking-content-open">{{ price.season.fromDate|date }}</a>
|
||||||
|
</strong>
|
||||||
</td>
|
</td>
|
||||||
<td data-title="Ende">
|
<td data-title="Ende">
|
||||||
<a class="default scroll-to-jump" href="#jump-{{ price.season.toDate|date("n-Y") }}">
|
{#<a class="default scroll-to-jump" >
|
||||||
{{ price.season.toDate|date }}
|
{{ price.season.toDate|date }}
|
||||||
</a>
|
</a>#}
|
||||||
|
<strong>
|
||||||
|
<a href="#jump-{{ price.season.toDate|date("n-Y") }}" class="default travel-booking-content-open">{{ price.season.toDate|date }}</a>
|
||||||
|
</strong>
|
||||||
</td>
|
</td>
|
||||||
<td data-title="Mindestbelegung">
|
<td data-title="Mindestbelegung">
|
||||||
{{ price.season.minimumStay }} {{ price.season.minimumStay < 2 ? 'Nacht' : 'Nächte' }}
|
{{ price.season.minimumStay }} {{ price.season.minimumStay < 2 ? 'Nacht' : 'Nächte' }}
|
||||||
|
|
@ -214,14 +225,23 @@
|
||||||
Momentan sind für dieses Programm keine Termine verfügbar.
|
Momentan sind für dieses Programm keine Termine verfügbar.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h3>Buchung</h3>
|
<div role="tabpanel" class="tab-pane active" id="travel-booking-content-tab">
|
||||||
|
<h3>Kalender <i class="fa fa-star"></i> Buchen</h3>
|
||||||
<p>Bitte klicken Sie einen Anreisetermin (grüne Zahl), um zur Buchungsmaske zu gelagen.</p>
|
<style>
|
||||||
|
.table > tbody > tr > td.active {
|
||||||
|
background-color: rgba(89, 156, 93, 0.6);
|
||||||
|
}
|
||||||
|
.table > tbody > tr > td.normal {
|
||||||
|
background-color: rgba(94, 134, 136, 0.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="alert alert-success"><strong>Bitte klicken Sie im Kalender auf einen freien Buchungstag (grün), um zum Buchungsformular zu gelagen.</strong></div>
|
||||||
|
<hr>
|
||||||
{% include 'default/pages/cms/calendarLodgingProgram.html.twig' %}
|
{% include 'default/pages/cms/calendarLodgingProgram.html.twig' %}
|
||||||
|
</div>
|
||||||
</div> <!-- END tabpanel -->
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<section class="article clearfix">
|
<section class="article clearfix">
|
||||||
{% if(api is defined) %}
|
{% if(api is defined) %}
|
||||||
<article role="article" itemscope itemtype="http://schema.org/Article">
|
<article role="article" itemscope itemtype="http://schema.org/Article">
|
||||||
{% if(api.nodes_active.image.url is defined) %}
|
{% if(api.nodes_active.image.url is defined and api.nodes_active.image.url != "") %}
|
||||||
<header>
|
<header>
|
||||||
<div class="mediaTop">
|
<div class="mediaTop">
|
||||||
<div class="mediaTopImageItem">
|
<div class="mediaTopImageItem">
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@
|
||||||
-->
|
-->
|
||||||
<tr>
|
<tr>
|
||||||
<td><label class="st-required control-label required">Datum</label></td>
|
<td><label class="st-required control-label required">Datum</label></td>
|
||||||
<td>
|
<td style="white-space: normal;">
|
||||||
<div class="form-group" style="margin-bottom:0;">
|
<div class="form-group" style="margin-bottom:0;">
|
||||||
<div class="input-daterange input-group" id="date-range">
|
<div class="input-daterange input-group" id="date-range">
|
||||||
{{ form_widget(form.fromDate) }}
|
{{ form_widget(form.fromDate) }}
|
||||||
|
|
@ -69,6 +69,7 @@
|
||||||
{{ form_widget(form.toDate) }}
|
{{ form_widget(form.toDate) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="small alert alert-success" style="margin-bottom: 0; padding-top: 6px; padding-bottom: 6px">Bei Datumsänderung, erst immer das Anreisedatum, dann das Abreisedatum im Kalender auswählen.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- <tr>
|
<!-- <tr>
|
||||||
|
|
|
||||||
|
|
@ -294,6 +294,7 @@ class CmsController extends Controller
|
||||||
|
|
||||||
public function travelProgramAction(Page $page)
|
public function travelProgramAction(Page $page)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->getDoctrine()->getRepository('AppBundle:TravelPeriod')->getTrueTravelPeriods($page->getTravelProgram());
|
$this->getDoctrine()->getRepository('AppBundle:TravelPeriod')->getTrueTravelPeriods($page->getTravelProgram());
|
||||||
|
|
||||||
// replace this example code with whatever you need
|
// replace this example code with whatever you need
|
||||||
|
|
|
||||||
|
|
@ -36,11 +36,51 @@ class ComponentController extends Controller
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function headerAction()
|
|
||||||
|
public function getHeaderTravelProgram($page){
|
||||||
|
$programmes = [
|
||||||
|
'aegypten-reisen' => 1,
|
||||||
|
'israel-reisen' => 22,
|
||||||
|
'jordanien-reisen' => 197,
|
||||||
|
'oman-reisen' => 194
|
||||||
|
];
|
||||||
|
$p_id = null;
|
||||||
|
foreach($programmes as $key=>$id){
|
||||||
|
if(strpos($_SERVER['REQUEST_URI'], $key) !== false){
|
||||||
|
$p_id = $id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($p_id === null){
|
||||||
|
if($page){
|
||||||
|
$p_id = $page->getId()%2 ? 1 : 22;
|
||||||
|
}
|
||||||
|
$p_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$em = $this->getEntityManager();
|
||||||
|
// $em->flush();
|
||||||
|
$TravelProgramRepo = $em->getRepository('AppBundle:TravelProgram');
|
||||||
|
$TravelProgram = $TravelProgramRepo->find($p_id);
|
||||||
|
$em->getRepository('AppBundle:TravelPeriod')->getTrueTravelPeriods($TravelProgram, false, 1, 'start_week');
|
||||||
|
|
||||||
|
/*foreach($TravelProgram->getTravelDates('header') as $travelDate){
|
||||||
|
var_dump($travelDate->getStart()->format("d.m.Y"));
|
||||||
|
echo "<br>";
|
||||||
|
}*/
|
||||||
|
// $em->persist($TravelProgram);
|
||||||
|
// $em->flush();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return $TravelProgram;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function headerAction($page)
|
||||||
{
|
{
|
||||||
$navPages = $this->getEntityManager()->getRepository('AppBundle:Page')->findTopCountryNavPages();
|
$navPages = $this->getEntityManager()->getRepository('AppBundle:Page')->findTopCountryNavPages();
|
||||||
|
|
||||||
$content = $this->getHeaderContent();
|
$content = $this->getHeaderContent();
|
||||||
|
$header_travel_program = $this->getHeaderTravelProgram($page);
|
||||||
|
|
||||||
$local = [];
|
$local = [];
|
||||||
foreach ($content->local as $key=>$value){
|
foreach ($content->local as $key=>$value){
|
||||||
|
|
@ -51,14 +91,13 @@ class ComponentController extends Controller
|
||||||
foreach ($content->phone as $key=>$value){
|
foreach ($content->phone as $key=>$value){
|
||||||
$phone[$key] = $value;
|
$phone[$key] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $this->render('default/components/header.html.twig', [
|
return $this->render('default/components/header.html.twig', [
|
||||||
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
|
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
|
||||||
'nav_pages' => $navPages,
|
'nav_pages' => $navPages,
|
||||||
'content' => $content,
|
'content' => $content,
|
||||||
'local' => $local,
|
'local' => $local,
|
||||||
'phone' => $phone,
|
'phone' => $phone,
|
||||||
|
'header_travel_program' => $header_travel_program,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1263,6 +1263,15 @@ class Page
|
||||||
return '/'. implode('/', array_reverse($urlParts));
|
return '/'. implode('/', array_reverse($urlParts));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getUrlPathBefore()
|
||||||
|
{
|
||||||
|
|
||||||
|
$url = explode('/', $this->getUrlPath());
|
||||||
|
array_pop($url);
|
||||||
|
return implode('/', $url);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set boxBody
|
* Set boxBody
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -221,7 +221,7 @@ class TravelPeriodRepository extends \Doctrine\ORM\EntityRepository
|
||||||
* @todo Find a more appropriate name for this method
|
* @todo Find a more appropriate name for this method
|
||||||
*/
|
*/
|
||||||
public function getTrueTravelPeriods(TravelProgram $program, $class = false, $flags =
|
public function getTrueTravelPeriods(TravelProgram $program, $class = false, $flags =
|
||||||
self::TD_QUERY_VIRTUAL_AND_NON_VIRTUAL)
|
self::TD_QUERY_VIRTUAL_AND_NON_VIRTUAL, $start = false)
|
||||||
{
|
{
|
||||||
if (!($flags & self::TD_QUERY_VIRTUAL_AND_NON_VIRTUAL))
|
if (!($flags & self::TD_QUERY_VIRTUAL_AND_NON_VIRTUAL))
|
||||||
{
|
{
|
||||||
|
|
@ -230,7 +230,6 @@ class TravelPeriodRepository extends \Doctrine\ORM\EntityRepository
|
||||||
$doQueryVirtualAndNonVirtual = $flags & self::TD_QUERY_VIRTUAL_AND_NON_VIRTUAL ==
|
$doQueryVirtualAndNonVirtual = $flags & self::TD_QUERY_VIRTUAL_AND_NON_VIRTUAL ==
|
||||||
self::TD_QUERY_VIRTUAL_AND_NON_VIRTUAL;
|
self::TD_QUERY_VIRTUAL_AND_NON_VIRTUAL;
|
||||||
|
|
||||||
|
|
||||||
/** @var TravelPeriod[] $periods */
|
/** @var TravelPeriod[] $periods */
|
||||||
$qb = $this->createQueryBuilder('p');
|
$qb = $this->createQueryBuilder('p');
|
||||||
$qb
|
$qb
|
||||||
|
|
@ -262,8 +261,11 @@ class TravelPeriodRepository extends \Doctrine\ORM\EntityRepository
|
||||||
$startDate = null;
|
$startDate = null;
|
||||||
if (!($flags & self::TD_QUERY_OUTDATED))
|
if (!($flags & self::TD_QUERY_OUTDATED))
|
||||||
{
|
{
|
||||||
$startDate = new \DateTime('tomorrow');
|
if($start && $start == 'start_week'){
|
||||||
|
$startDate = new \DateTime('+3 week');
|
||||||
|
}else{
|
||||||
|
$startDate = new \DateTime('tomorrow');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($class)
|
if ($class)
|
||||||
{
|
{
|
||||||
|
|
@ -334,6 +336,7 @@ class TravelPeriodRepository extends \Doctrine\ORM\EntityRepository
|
||||||
{
|
{
|
||||||
$fpKey = $date->getStartDate()->format('Y-m-d') . $date->getEndDate()->format('Y-m-d') .
|
$fpKey = $date->getStartDate()->format('Y-m-d') . $date->getEndDate()->format('Y-m-d') .
|
||||||
$program->getTravelArrivalPoint()->getId();
|
$program->getTravelArrivalPoint()->getId();
|
||||||
|
|
||||||
if (isset($flightPeriodByKey[$fpKey]))
|
if (isset($flightPeriodByKey[$fpKey]))
|
||||||
{
|
{
|
||||||
// #TODO Does this cause performance problems?
|
// #TODO Does this cause performance problems?
|
||||||
|
|
@ -342,8 +345,8 @@ class TravelPeriodRepository extends \Doctrine\ORM\EntityRepository
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->addTravelDatesToProgram($program, $entities, $flightPeriodByKey, $startDate, null);
|
$this->addTravelDatesToProgram($program, $entities, $flightPeriodByKey, $startDate, null, $start);
|
||||||
return $program->getTravelDates();
|
return $program->getTravelDates($start);
|
||||||
}
|
}
|
||||||
|
|
||||||
private $currencyFactor = null;
|
private $currencyFactor = null;
|
||||||
|
|
@ -373,13 +376,14 @@ class TravelPeriodRepository extends \Doctrine\ORM\EntityRepository
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function addTravelDatesToProgram(TravelProgram &$travelProgram, $travelPeriods, $flightPeriods,
|
public function addTravelDatesToProgram(TravelProgram &$travelProgram, $travelPeriods, $flightPeriods,
|
||||||
\DateTime $startDate = null, \DateTime $endDate = null)
|
\DateTime $startDate = null, \DateTime $endDate = null, $header = null)
|
||||||
{
|
{
|
||||||
$currencyFactor = $travelProgram->getNettoPricesInEuro() ? 1 : $this->getCurrencyFactor();
|
$currencyFactor = $travelProgram->getNettoPricesInEuro() ? 1 : $this->getCurrencyFactor();
|
||||||
$counters = array();
|
$counters = array();
|
||||||
|
|
||||||
// #TODO Consider adding travelPeriods to travelProgram in the search algorithm
|
// #TODO Consider adding travelPeriods to travelProgram in the search algorithm
|
||||||
//foreach ($travelProgram->getPeriods() as $travelPeriod)
|
//foreach ($travelProgram->getPeriods() as $travelPeriod)
|
||||||
|
$counter = 0;
|
||||||
foreach ($travelPeriods as $travelPeriod)
|
foreach ($travelPeriods as $travelPeriod)
|
||||||
{
|
{
|
||||||
if ($travelPeriod->getIsSeason())
|
if ($travelPeriod->getIsSeason())
|
||||||
|
|
@ -406,6 +410,7 @@ class TravelPeriodRepository extends \Doctrine\ORM\EntityRepository
|
||||||
\DateInterval::createFromDateString('1 day'), $seasonEndDate);
|
\DateInterval::createFromDateString('1 day'), $seasonEndDate);
|
||||||
|
|
||||||
$doTestStartDate = $startDate != null;
|
$doTestStartDate = $startDate != null;
|
||||||
|
|
||||||
/** @var \DateTime $date */
|
/** @var \DateTime $date */
|
||||||
foreach ($dates as $date)
|
foreach ($dates as $date)
|
||||||
{
|
{
|
||||||
|
|
@ -424,7 +429,7 @@ class TravelPeriodRepository extends \Doctrine\ORM\EntityRepository
|
||||||
$travelDateEnd = (clone $date)->modify('+'.$travelProgram->getProgramDuration().' day');
|
$travelDateEnd = (clone $date)->modify('+'.$travelProgram->getProgramDuration().' day');
|
||||||
$travelDateKey = $this->createTravelDateKey($date, $travelDateEnd);
|
$travelDateKey = $this->createTravelDateKey($date, $travelDateEnd);
|
||||||
|
|
||||||
if (!$travelProgram->hasTravelDate($travelDateKey))
|
if (!$travelProgram->hasTravelDate($travelDateKey, $header))
|
||||||
{
|
{
|
||||||
$flightPeriod = null;
|
$flightPeriod = null;
|
||||||
if (!$travelProgram->getIsMediated())
|
if (!$travelProgram->getIsMediated())
|
||||||
|
|
@ -440,7 +445,8 @@ class TravelPeriodRepository extends \Doctrine\ORM\EntityRepository
|
||||||
$date,
|
$date,
|
||||||
$travelDateEnd,
|
$travelDateEnd,
|
||||||
$flightPeriod,
|
$flightPeriod,
|
||||||
$currencyFactor
|
$currencyFactor,
|
||||||
|
$header
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -464,8 +470,8 @@ class TravelPeriodRepository extends \Doctrine\ORM\EntityRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
// #TODO There is an error in the old backend which causes duplicates
|
// #TODO There is an error in the old backend which causes duplicates
|
||||||
if ($travelProgram->hasTravelDate($travelDateKey) &&
|
if ($travelProgram->hasTravelDate($travelDateKey, $header) &&
|
||||||
$travelProgram->getTravelDate($travelDateKey)->__getTravelPeriod()->getId() != $travelPeriod->getId())
|
$travelProgram->getTravelDate($travelDateKey, $header)->__getTravelPeriod()->getId() != $travelPeriod->getId())
|
||||||
{
|
{
|
||||||
global $kernel;
|
global $kernel;
|
||||||
if($kernel instanceOf \AppCache) $kernel = $kernel->getKernel();
|
if($kernel instanceOf \AppCache) $kernel = $kernel->getKernel();
|
||||||
|
|
@ -475,7 +481,7 @@ class TravelPeriodRepository extends \Doctrine\ORM\EntityRepository
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$TravelDate = $travelProgram->addTravelDateFromNonSeasonTravelPeriod($travelDateKey, $travelPeriod, $flightPeriod,
|
$TravelDate = $travelProgram->addTravelDateFromNonSeasonTravelPeriod($travelDateKey, $travelPeriod, $flightPeriod,
|
||||||
$currencyFactor);
|
$currencyFactor, $header);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -402,8 +402,10 @@ class TravelProgram
|
||||||
* @var array|TravelDate[]
|
* @var array|TravelDate[]
|
||||||
*/
|
*/
|
||||||
private $travelDateByKey = [];
|
private $travelDateByKey = [];
|
||||||
|
private $headerTravelDateByKey = [];
|
||||||
|
|
||||||
private $isTravelDateMapTainted = true;
|
private $isTravelDateMapTainted = true;
|
||||||
|
private $isHeaderTravelDateMapTainted = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set profitMargin
|
* Set profitMargin
|
||||||
|
|
@ -1475,6 +1477,7 @@ class TravelProgram
|
||||||
$this->countries = new \Doctrine\Common\Collections\ArrayCollection();
|
$this->countries = new \Doctrine\Common\Collections\ArrayCollection();
|
||||||
$this->departures = new \Doctrine\Common\Collections\ArrayCollection();
|
$this->departures = new \Doctrine\Common\Collections\ArrayCollection();
|
||||||
$this->travelDateByKey = [];
|
$this->travelDateByKey = [];
|
||||||
|
$this->headerTravelDateByKey = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1680,16 +1683,25 @@ class TravelProgram
|
||||||
return $this->images;
|
return $this->images;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function assertTravelDateNotDefinedYet($key)
|
private function assertTravelDateNotDefinedYet($key, $header = null)
|
||||||
{
|
{
|
||||||
|
if($header){
|
||||||
|
if (isset($this->headerTravelDateByKey[$key]))
|
||||||
|
{
|
||||||
|
return true; //throw new \Exception('Travel period with key '. $key .' already exists');
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($this->travelDateByKey[$key]))
|
if (isset($this->travelDateByKey[$key]))
|
||||||
{
|
{
|
||||||
throw new \Exception('Travel period with key '. $key .' already exists');
|
return true; //throw new \Exception('Travel period with key '. $key .' already exists');
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addTravelDateFromNonSeasonTravelPeriod($key, TravelPeriod $travelPeriod,
|
public function addTravelDateFromNonSeasonTravelPeriod($key, TravelPeriod $travelPeriod,
|
||||||
FlightPeriod $flightPeriod = null, $currencyFactor)
|
FlightPeriod $flightPeriod = null, $currencyFactor, $header = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
$now = new \DateTime();
|
$now = new \DateTime();
|
||||||
|
|
@ -1698,47 +1710,79 @@ class TravelProgram
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->assertTravelDateNotDefinedYet($key);
|
if($header){
|
||||||
$this->travelDateByKey[$key] = TravelDate::createForNonSeasonTravelPeriod($key, $travelPeriod, $flightPeriod,
|
if(!$this->assertTravelDateNotDefinedYet($key, $header)){
|
||||||
$currencyFactor);
|
|
||||||
|
|
||||||
|
$this->headerTravelDateByKey[$key] = TravelDate::createForNonSeasonTravelPeriod($key, $travelPeriod, $flightPeriod, $currencyFactor);
|
||||||
|
}
|
||||||
|
return $this->headerTravelDateByKey[$key];;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$this->assertTravelDateNotDefinedYet($key)){
|
||||||
|
$this->travelDateByKey[$key] = TravelDate::createForNonSeasonTravelPeriod($key, $travelPeriod, $flightPeriod, $currencyFactor);
|
||||||
|
}
|
||||||
return $this->travelDateByKey[$key];
|
return $this->travelDateByKey[$key];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addTravelDateFromSeasonTravelPeriod($key, TravelPeriod $travelPeriod, $index, \DateTime $start,
|
public function addTravelDateFromSeasonTravelPeriod($key, TravelPeriod $travelPeriod, $index, \DateTime $start,
|
||||||
\DateTime $end = null, FlightPeriod $flightPeriod = null, $currencyFactor)
|
\DateTime $end = null, FlightPeriod $flightPeriod = null, $currencyFactor, $header = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->assertTravelDateNotDefinedYet($key);
|
if($header){
|
||||||
$this->isTravelDateMapTainted = true;
|
if(!$this->assertTravelDateNotDefinedYet($key, $header)){
|
||||||
$this->travelDateByKey[$key] = TravelDate::createForSeasonTravelPeriod($key, $travelPeriod, $index, $start,
|
$this->isHeaderTravelDateMapTainted = true;
|
||||||
$end, $flightPeriod, $currencyFactor);
|
$this->headerTravelDateByKey[$key] = TravelDate::createForSeasonTravelPeriod($key, $travelPeriod, $index, $start,
|
||||||
|
$end, $flightPeriod, $currencyFactor);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(!$this->assertTravelDateNotDefinedYet($key)){
|
||||||
|
$this->isTravelDateMapTainted = true;
|
||||||
|
$this->travelDateByKey[$key] = TravelDate::createForSeasonTravelPeriod($key, $travelPeriod, $index, $start,
|
||||||
|
$end, $flightPeriod, $currencyFactor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addTravelDate($key, TravelPeriod $travelPeriod, FlightPeriod $flightPeriod = null, $currencyFactor,
|
public function addTravelDate($key, TravelPeriod $travelPeriod, FlightPeriod $flightPeriod = null, $currencyFactor,
|
||||||
\DateTime $start = null, \DateTime $end = null, $index = null)
|
\DateTime $start = null, \DateTime $end = null, $index = null)
|
||||||
{
|
{
|
||||||
$this->assertTravelDateNotDefinedYet($key);
|
if(!$this->assertTravelDateNotDefinedYet($key)){
|
||||||
$this->isTravelDateMapTainted = true;
|
$this->isTravelDateMapTainted = true;
|
||||||
$this->travelDateByKey[$key] = new TravelDate($key, $travelPeriod, $flightPeriod, $currencyFactor, $start, $end,
|
$this->travelDateByKey[$key] = new TravelDate($key, $travelPeriod, $flightPeriod, $currencyFactor, $start, $end,
|
||||||
$index);
|
$index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasTravelDate($key)
|
public function hasTravelDate($key, $header = null)
|
||||||
{
|
{
|
||||||
|
if($header){
|
||||||
|
return isset($this->headerTravelDateByKey[$key]);
|
||||||
|
}
|
||||||
return isset($this->travelDateByKey[$key]);
|
return isset($this->travelDateByKey[$key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTravelDate($key)
|
public function getTravelDate($key, $header = null)
|
||||||
{
|
{
|
||||||
|
if($header){
|
||||||
|
return $this->headerTravelDateByKey[$key] ?? null;
|
||||||
|
}
|
||||||
return $this->travelDateByKey[$key] ?? null;
|
return $this->travelDateByKey[$key] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return TravelDate[]|array
|
* @return TravelDate[]|array
|
||||||
*/
|
*/
|
||||||
public function getTravelDates()
|
public function getTravelDates($header = null)
|
||||||
{
|
{
|
||||||
|
if($header){
|
||||||
|
if ($this->isHeaderTravelDateMapTainted)
|
||||||
|
{
|
||||||
|
ksort($this->headerTravelDateByKey);
|
||||||
|
$this->isHeaderTravelDateMapTainted = false;
|
||||||
|
}
|
||||||
|
return $this->headerTravelDateByKey;
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->isTravelDateMapTainted)
|
if ($this->isTravelDateMapTainted)
|
||||||
{
|
{
|
||||||
ksort($this->travelDateByKey);
|
ksort($this->travelDateByKey);
|
||||||
|
|
@ -1747,11 +1791,16 @@ class TravelProgram
|
||||||
return $this->travelDateByKey;
|
return $this->travelDateByKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasTravelDates()
|
public function hasTravelDates($header = null)
|
||||||
{
|
{
|
||||||
|
if($header){
|
||||||
|
return !empty($this->headerTravelDateByKey);
|
||||||
|
|
||||||
|
}
|
||||||
return !empty($this->travelDateByKey);
|
return !empty($this->travelDateByKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getIsPossibleStartDate(\DateTime $startDate)
|
public function getIsPossibleStartDate(\DateTime $startDate)
|
||||||
{
|
{
|
||||||
return $this->getIsAvailWeekday(intval($startDate->format('w')));
|
return $this->getIsAvailWeekday(intval($startDate->format('w')));
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,10 @@ class ContactSternToursCrmExporter extends SternToursCrmExporter
|
||||||
|
|
||||||
public function v3process(ContactRequest $contactRequest)
|
public function v3process(ContactRequest $contactRequest)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$travelperiod_start = $contactRequest->getStart() ? $contactRequest->getStart()->format('Y-m-d') : "";
|
||||||
|
$travelperiod_end = $contactRequest->getEnd() ? $contactRequest->getEnd()->format('Y-m-d') : "";
|
||||||
|
|
||||||
$data = ['lead' => [
|
$data = ['lead' => [
|
||||||
'customerForm' => [
|
'customerForm' => [
|
||||||
'salutation_id' => $contactRequest->getSalutation(),
|
'salutation_id' => $contactRequest->getSalutation(),
|
||||||
|
|
@ -79,8 +83,8 @@ class ContactSternToursCrmExporter extends SternToursCrmExporter
|
||||||
'request_date' => (new \DateTime())->format('Y-m-d'),
|
'request_date' => (new \DateTime())->format('Y-m-d'),
|
||||||
'sf_guard_user_id' => self::API_USER_ID,
|
'sf_guard_user_id' => self::API_USER_ID,
|
||||||
'status_id' => 10, // 'Angebot erstellen'
|
'status_id' => 10, // 'Angebot erstellen'
|
||||||
'travelperiod_start' => $contactRequest->getStart()->format('Y-m-d'),
|
'travelperiod_start' => $travelperiod_start,
|
||||||
'travelperiod_end' => $contactRequest->getEnd()->format('Y-m-d'),
|
'travelperiod_end' => $travelperiod_end,
|
||||||
//'travelcategory_id'
|
//'travelcategory_id'
|
||||||
'is_closed' => 0,
|
'is_closed' => 0,
|
||||||
'website_id' => self::WEBSITE_ID,
|
'website_id' => self::WEBSITE_ID,
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,6 @@ class KernelControllerListener
|
||||||
//search for entry in new tree objects
|
//search for entry in new tree objects
|
||||||
$api = Util::loadFromApi('cms/search', ['url'=>$curPath]);
|
$api = Util::loadFromApi('cms/search', ['url'=>$curPath]);
|
||||||
|
|
||||||
|
|
||||||
while (!empty($pathArray))
|
while (!empty($pathArray))
|
||||||
{
|
{
|
||||||
if(!$api){
|
if(!$api){
|
||||||
|
|
@ -96,7 +95,6 @@ class KernelControllerListener
|
||||||
$restOfPath = '/'. array_pop($pathArray) . $restOfPath;
|
$restOfPath = '/'. array_pop($pathArray) . $restOfPath;
|
||||||
$curPath = implode('/', $pathArray);
|
$curPath = implode('/', $pathArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
//find and try 301
|
//find and try 301
|
||||||
//find => to
|
//find => to
|
||||||
$redirects = [
|
$redirects = [
|
||||||
|
|
|
||||||
|
|
@ -49,16 +49,16 @@
|
||||||
}
|
}
|
||||||
#topBar ul.top-links>li>a {
|
#topBar ul.top-links>li>a {
|
||||||
padding: 8px 10px;
|
padding: 8px 10px;
|
||||||
font-size:14px;
|
font-size:13px;
|
||||||
display:inline-block;
|
display:inline-block;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
background-color: #648859;
|
background-color: #648859;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
|
||||||
/*border-right:rgba(0,0,0,0.1) 1px solid;
|
|
||||||
border-left:rgba(0,0,0,0.1) 1px solid;*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#topBar ul.top-links>li>a
|
#topBar ul.top-links>li>a
|
||||||
#topBar ul.top-links>li.icon>a {
|
#topBar ul.top-links>li.icon>a {
|
||||||
padding: 4px 10px;
|
padding: 4px 10px;
|
||||||
|
|
@ -111,7 +111,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Drop Downs & Lang */
|
/* Drop Downs & Lang */
|
||||||
#topBar ul.dropdown-menu {
|
#topBar ul.dropdown-menu {
|
||||||
min-width:50px;
|
min-width:50px;
|
||||||
|
|
@ -903,12 +902,12 @@
|
||||||
/* border-bottom-right-radius: 8px;
|
/* border-bottom-right-radius: 8px;
|
||||||
border-bottom-left-radius: 8px; */
|
border-bottom-left-radius: 8px; */
|
||||||
border:1px solid #ddd;
|
border:1px solid #ddd;
|
||||||
min-width: 327px;
|
min-width: 240px;
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#collapseTopContact {
|
#collapseTopContact {
|
||||||
width: 327px;
|
width: 247px;
|
||||||
}
|
}
|
||||||
#topNav .container-fluid {
|
#topNav .container-fluid {
|
||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
|
|
@ -1205,6 +1204,34 @@
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media only screen and (min-width: 992px) and (max-width:1240px){
|
||||||
|
#topBar ul.top-links>li>a {
|
||||||
|
padding: 8px 0px;
|
||||||
|
font-size:12px;
|
||||||
|
}
|
||||||
|
#topBar ul.top-links>li>a>i {
|
||||||
|
font-size: 1.5em;
|
||||||
|
width: 28px;
|
||||||
|
}
|
||||||
|
.dropdown-menu-infos {
|
||||||
|
min-width: 220px;
|
||||||
|
}
|
||||||
|
.dropdown-menu-infos .badge-default {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
.dropdown-menu-body p {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#topBar .table>tbody>tr>td {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
#topBar .table>tbody>tr>th {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@media (max-width: 786px) {
|
@media (max-width: 786px) {
|
||||||
#eKomiSeal_default img {
|
#eKomiSeal_default img {
|
||||||
height: 66px !important;
|
height: 66px !important;
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ $(document).ready(function() {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$('#fewo_booking_request_fromDate, #fewo_booking_request_toDate').daterangepicker({
|
$('#fewo_booking_request_fromDate1, #fewo_booking_request_toDate1').daterangepicker({
|
||||||
isInvalidDate: checkDates,
|
isInvalidDate: checkDates,
|
||||||
isCustomDate: checkCustom,
|
isCustomDate: checkCustom,
|
||||||
"minDate": moment(),
|
"minDate": moment(),
|
||||||
|
|
@ -106,6 +106,7 @@ $(document).ready(function() {
|
||||||
},
|
},
|
||||||
autoApply: true,
|
autoApply: true,
|
||||||
autoUpdateInput: false,
|
autoUpdateInput: false,
|
||||||
|
singleDatePicker: true,
|
||||||
"startDate": startDate,
|
"startDate": startDate,
|
||||||
"endDate": endDate,
|
"endDate": endDate,
|
||||||
}, function(start, end, label) {
|
}, function(start, end, label) {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
143
web/js/fewoBooking.js
Normal file
143
web/js/fewoBooking.js
Normal file
|
|
@ -0,0 +1,143 @@
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
var frm$ = $('.st-booking-form');
|
||||||
|
var summary$ = $('.st-booking-summary');
|
||||||
|
|
||||||
|
var toDateDay$ = $('#fewo_booking_request_toDate_day');
|
||||||
|
var toDateMonth$ = $('#fewo_booking_request_toDate_month');
|
||||||
|
var toDateYear$ = $('#fewo_booking_request_toDate_year');
|
||||||
|
|
||||||
|
|
||||||
|
function loadCalculationFewo(){
|
||||||
|
var tmp = location.href.split('?');
|
||||||
|
var tmp2 = tmp[0].split('/');
|
||||||
|
tmp2.pop();
|
||||||
|
var url = tmp2.join('/') + '/berechne-gesamtpreis';
|
||||||
|
if (tmp[1])
|
||||||
|
{
|
||||||
|
url += '?'+ tmp[1];
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: url,
|
||||||
|
type: 'post',
|
||||||
|
data: frm$.serialize()
|
||||||
|
|
||||||
|
}).then(function(r) {
|
||||||
|
summary$.html(r);
|
||||||
|
|
||||||
|
}, function() {
|
||||||
|
summary$.html('Aufgrund eines Fehlers konnte kein Angebot ermittelt werden.');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
frm$.find('input, select').change(function() {
|
||||||
|
loadCalculationFewo();
|
||||||
|
});
|
||||||
|
|
||||||
|
// var currentDate = moment().format("DD.MM.YYYY");
|
||||||
|
|
||||||
|
var startDate = $('#fewo_booking_request_fromDate').val();
|
||||||
|
var endDate = $('#fewo_booking_request_toDate').val();
|
||||||
|
|
||||||
|
var maxDate = $('#hidden_toDate').val();
|
||||||
|
|
||||||
|
var reservationDays = JSON.parse($('#hidden_reservationDays').val());
|
||||||
|
var customDays = JSON.parse($('#hidden_customDays').val());
|
||||||
|
var checkDates = function (date) {
|
||||||
|
var formatted = date.format('DD.MM.YYYY');
|
||||||
|
if(reservationDays.indexOf(formatted) > -1){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(customDays[formatted] !== undefined && customDays[formatted].indexOf('bookable') == -1 && customDays[formatted].indexOf('bookable-end') == -1){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
var checkCustom = function (date) {
|
||||||
|
if (date !== false) {
|
||||||
|
var formatted = date.format('DD.MM.YYYY');
|
||||||
|
if(customDays[formatted] !== undefined){
|
||||||
|
return customDays[formatted];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
$('#fewo_booking_request_fromDate, #fewo_booking_request_toDate').daterangepicker({
|
||||||
|
isInvalidDate: checkDates,
|
||||||
|
isCustomDate: checkCustom,
|
||||||
|
"minDate": moment(),
|
||||||
|
"maxDate": maxDate,
|
||||||
|
"timePickerSeconds": true,
|
||||||
|
|
||||||
|
"locale": {
|
||||||
|
"format": "DD.MM.YYYY",
|
||||||
|
"separator": " - ",
|
||||||
|
"applyLabel": "OK",
|
||||||
|
"cancelLabel": "X",
|
||||||
|
"fromLabel": "Von",
|
||||||
|
"toLabel": "Bis",
|
||||||
|
"customRangeLabel": "Custom",
|
||||||
|
"weekLabel": "W",
|
||||||
|
"daysOfWeek": [
|
||||||
|
"So",
|
||||||
|
"Mo",
|
||||||
|
"Di",
|
||||||
|
"Mi",
|
||||||
|
"Do",
|
||||||
|
"Fr",
|
||||||
|
"Sa"
|
||||||
|
],
|
||||||
|
"monthNames": [
|
||||||
|
"Januar",
|
||||||
|
"Februar",
|
||||||
|
"März",
|
||||||
|
"April",
|
||||||
|
"Mai",
|
||||||
|
"Juni",
|
||||||
|
"Juli",
|
||||||
|
"August",
|
||||||
|
"September",
|
||||||
|
"Oktober",
|
||||||
|
"November",
|
||||||
|
"Dezember"
|
||||||
|
],
|
||||||
|
"firstDay": 1
|
||||||
|
},
|
||||||
|
autoApply: true,
|
||||||
|
autoUpdateInput: false,
|
||||||
|
"startDate": startDate,
|
||||||
|
"endDate": endDate,
|
||||||
|
}, function(start, end, label) {
|
||||||
|
|
||||||
|
// console.log("New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')");
|
||||||
|
// Lets update the fields manually this event fires on selection of range
|
||||||
|
var selectedStartDate = start.format('DD.MM.YYYY'); // selected start
|
||||||
|
var selectedEndDate = end.format('DD.MM.YYYY'); // selected end
|
||||||
|
|
||||||
|
var $checkinInput = $('#fewo_booking_request_fromDate');
|
||||||
|
var $checkoutInput = $('#fewo_booking_request_toDate');
|
||||||
|
|
||||||
|
// Updating Fields with selected dates
|
||||||
|
$checkinInput.val(selectedStartDate);
|
||||||
|
$checkoutInput.val(selectedEndDate);
|
||||||
|
|
||||||
|
// Setting the Selection of dates on calender on CHECKOUT FIELD (To get this it must be binded by Ids not Calss)
|
||||||
|
var checkOutPicker = $checkoutInput.data('daterangepicker');
|
||||||
|
checkOutPicker.setStartDate(selectedStartDate);
|
||||||
|
checkOutPicker.setEndDate(selectedEndDate);
|
||||||
|
|
||||||
|
// Setting the Selection of dates on calender on CHECKIN FIELD (To get this it must be binded by Ids not Calss)
|
||||||
|
var checkInPicker = $checkinInput.data('daterangepicker');
|
||||||
|
checkInPicker.setStartDate(selectedStartDate);
|
||||||
|
checkInPicker.setEndDate(selectedEndDate);
|
||||||
|
loadCalculationFewo();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#fewo_booking_request_fromDate, #fewo_booking_request_toDate').on('show.daterangepicker', function(ev, picker) {
|
||||||
|
/* console.log(picker.startDate.format('YYYY-MM-DD'));
|
||||||
|
console.log(picker.endDate.format('YYYY-MM-DD'));
|
||||||
|
*/
|
||||||
|
});
|
||||||
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue