git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3356 f459cee4-fb09-11de-96c3-f9c5f16c3c76
This commit is contained in:
parent
8240ce87f9
commit
3bb0bb53a7
11 changed files with 276 additions and 330 deletions
|
|
@ -22,83 +22,42 @@
|
||||||
{% for dayIndex in 0..6 %}
|
{% for dayIndex in 0..6 %}
|
||||||
{# @var dayState \AppBundle\Util\CalendarDayState #}
|
{# @var dayState \AppBundle\Util\CalendarDayState #}
|
||||||
{% set dayState = calendar[monthIndex]['data'][(weekIndex * 7) + dayIndex] %}
|
{% set dayState = calendar[monthIndex]['data'][(weekIndex * 7) + dayIndex] %}
|
||||||
{% if dayState.isBookable or dayState.isReserved %}
|
|
||||||
{% if dayState.isBookable %}
|
{% set is_past_date = dayState.date is not empty and date(dayState.date) < date('now') %}
|
||||||
<td style="background-color: green!important;">
|
|
||||||
<a href="/admin/fewo/lodgings/{{ lodging.id }}/reservations/new/{{ dayState.day < 10 ? '0':'' }}{{dayState.day}}{{ calendar[monthIndex]['monthNumber'] < 10 ? '0':'' }}{{calendar[monthIndex]['monthNumber']}}{{calendar[monthIndex]['year']}}"
|
{# Set cell class #}
|
||||||
style="color: #5a5a5a;"
|
{% if (dayState.isReserved and
|
||||||
{#class="btn btn-primary"#}
|
not dayState.isReservationBegin and not dayState.isReservationEnd)
|
||||||
rel="nofollow"
|
%}
|
||||||
>
|
{% set cell_class = 'admin-calendar-day-reservation' %}
|
||||||
{{ dayState.day }}
|
{% elseif dayState.isReservationBegin %}
|
||||||
</a>
|
{% set cell_class = 'admin-calendar-day-reservation-begin' %}
|
||||||
</td>
|
{% elseif dayState.isReservationEnd %}
|
||||||
{% elseif dayState.isReserved %}
|
{% set cell_class = 'admin-calendar-day-reservation-end' %}
|
||||||
{% if dayState.isReservationBegin %}
|
{% elseif dayState.isInSeason %}
|
||||||
{# @var prevState \AppBundle\Util\CalendarDayState #}
|
{% set cell_class = 'admin-calendar-day-free' %}
|
||||||
{% set prevState = calendar[monthIndex]['data'][(weekIndex * 7) + (dayIndex - 1)] %}
|
|
||||||
{% if prevState.day == 0 or prevState.isReservationEnd %}
|
|
||||||
<td style="background-color: red!important;">
|
|
||||||
<a href="{{ '/admin/fewo/lodgings/' ~ lodging.id ~ '/reservations/' ~ dayState.reservation.id }}"
|
|
||||||
style="color: #5a5a5a;"
|
|
||||||
rel="nofollow"
|
|
||||||
>
|
|
||||||
{{ dayState.day }}
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
{% else %}
|
|
||||||
<td class="calendarGradientAdminBegin">
|
|
||||||
<a href="{{ '/admin/fewo/lodgings/' ~ lodging.id ~ '/reservations/' ~ dayState.reservation.id }}"
|
|
||||||
style="color: #5a5a5a;"
|
|
||||||
rel="nofollow"
|
|
||||||
>
|
|
||||||
{{ dayState.day }}
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
{% endif %}
|
|
||||||
{% elseif dayState.isReservationEnd %}
|
|
||||||
{# @var nextState \AppBundle\Util\CalendarDayState #}
|
|
||||||
{% set nextState = calendar[monthIndex]['data'][(weekIndex * 7) + (dayIndex + 1)] %}
|
|
||||||
{% if nextState.isReservationBegin %}
|
|
||||||
<td style="background-color: red!important;">
|
|
||||||
<a href="{{ '/admin/fewo/lodgings/' ~ lodging.id ~ '/reservations/' ~ dayState.reservation.id }}"
|
|
||||||
style="color: #5a5a5a;"
|
|
||||||
rel="nofollow"
|
|
||||||
>
|
|
||||||
{{ dayState.day }}
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
{% else %}
|
|
||||||
<td class="calendarGradientAdminEnd">
|
|
||||||
<a href="/admin/fewo/lodgings/{{ lodging.id }}/reservations/new/{{ dayState.day < 10 ? '0':'' }}{{dayState.day}}{{ calendar[monthIndex]['monthNumber'] < 10 ? '0':'' }}{{calendar[monthIndex]['monthNumber']}}{{calendar[monthIndex]['year']}}"
|
|
||||||
style="color: #5a5a5a;"
|
|
||||||
rel="nofollow"
|
|
||||||
>
|
|
||||||
{{ dayState.day }}
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
{% endif %}
|
|
||||||
{% else %}
|
|
||||||
<td style="background-color: red!important;">
|
|
||||||
<a href="{{ '/admin/fewo/lodgings/' ~ lodging.id ~ '/reservations/' ~ dayState.reservation.id }}"
|
|
||||||
style="color: #5a5a5a;"
|
|
||||||
rel="nofollow"
|
|
||||||
>
|
|
||||||
{{ dayState.day }}
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if dayState.day == 0 %}
|
{% set cell_class = '' %}
|
||||||
<td>
|
|
||||||
-
|
|
||||||
</td>
|
|
||||||
{% else %}
|
|
||||||
<td>{{ dayState.day }}</td>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
<td class="{{ cell_class }}">
|
||||||
|
{% if dayState.isReserved and not dayState.isReservationEnd %}
|
||||||
|
<a href="{{ '/admin/fewo/lodgings/' ~ lodging.id ~ '/reservations/' ~ dayState.reservation.id }}">
|
||||||
|
{{ dayState.day }}
|
||||||
|
</a>
|
||||||
|
{% elseif dayState.isBookable and not is_past_date %}
|
||||||
|
<a href="/admin/fewo/lodgings/{{ lodging.id }}/reservations/new/{{ dayState.day < 10 ? '0':'' }}{{dayState.day}}{{ calendar[monthIndex]['monthNumber'] < 10 ? '0':'' }}{{calendar[monthIndex]['monthNumber']}}{{calendar[monthIndex]['year']}}">
|
||||||
|
{{ dayState.day }}
|
||||||
|
</a>
|
||||||
|
{% elseif dayState.day == 0 %}
|
||||||
|
-
|
||||||
|
{% else %}
|
||||||
|
<del>{{ dayState.day }}</del>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
||||||
|
|
@ -1,97 +1,65 @@
|
||||||
{% for monthIndex in 0..11 %}
|
<div class="row">
|
||||||
{% if monthIndex is even %}
|
{% for monthIndex in 0..11 %}
|
||||||
<table class="table calendarEven">
|
<div class="col-xs-12 col-sm-6">
|
||||||
{% else %}
|
<table class="table calendar-table">
|
||||||
<table class="table calendarOdd">
|
<thead>
|
||||||
{% endif %}
|
<tr>
|
||||||
<thead>
|
<th colspan="7">
|
||||||
<tr>
|
{{ calendar[monthIndex]['monthName'] }} {{ calendar[monthIndex]['year'] }}
|
||||||
<th colspan="7">
|
</th>
|
||||||
{{ calendar[monthIndex]['monthName'] }} {{ calendar[monthIndex]['year'] }}
|
</tr>
|
||||||
</th>
|
<tr>
|
||||||
</tr>
|
<th>Mo</th>
|
||||||
<tr>
|
<th>Di</th>
|
||||||
<th>Mo</th>
|
<th>Mi</th>
|
||||||
<th>Di</th>
|
<th>Do</th>
|
||||||
<th>Mi</th>
|
<th>Fr</th>
|
||||||
<th>Do</th>
|
<th>Sa</th>
|
||||||
<th>Fr</th>
|
<th>So</th>
|
||||||
<th>Sa</th>
|
</tr>
|
||||||
<th>So</th>
|
</thead>
|
||||||
</tr>
|
<tbody>
|
||||||
</thead>
|
{% for weekIndex in 0..5 %}
|
||||||
<tbody>
|
<tr>
|
||||||
{% for weekIndex in 0..5 %}
|
{% for dayIndex in 0..6 %}
|
||||||
<tr>
|
{# @var dayState \AppBundle\Util\CalendarDayState #}
|
||||||
{% for dayIndex in 0..6 %}
|
{% set dayState = calendar[monthIndex]['data'][(weekIndex * 7) + dayIndex] %}
|
||||||
{# @var dayState \AppBundle\Util\CalendarDayState #}
|
|
||||||
{% set dayState = calendar[monthIndex]['data'][(weekIndex * 7) + dayIndex] %}
|
{% set is_past_date = dayState.date is not empty and date(dayState.date) < date('now') %}
|
||||||
{% if dayState.isBookable or dayState.isReserved %}
|
|
||||||
{% if dayState.isBookable %}
|
{# Set cell class #}
|
||||||
<td>
|
{% if is_past_date or
|
||||||
<a href="/fewo/{{ page.slug }}/fewo-buchen?pnr={{ dayState.price.id }}&fd={{ dayState.day < 10 ? '0':'' }}{{dayState.day}}{{ calendar[monthIndex]['monthNumber'] < 10 ? '0':'' }}{{calendar[monthIndex]['monthNumber']}}{{calendar[monthIndex]['year']}}"
|
(dayState.isReserved and not dayState.isReservationBegin and not dayState.isReservationEnd) or
|
||||||
style="color: #5a5a5a;"
|
not dayState.isInSeason
|
||||||
rel="nofollow"
|
%}
|
||||||
>
|
{% set cell_class = 'calendar-day-disabled' %}
|
||||||
{{ dayState.day }}
|
{% elseif dayState.isReservationBegin %}
|
||||||
</a>
|
{% set cell_class = 'calendar-day-reservation-begin' %}
|
||||||
</td>
|
|
||||||
{% elseif dayState.isReserved %}
|
|
||||||
{% if dayState.isReservationBegin %}
|
|
||||||
{# @var prevState \AppBundle\Util\CalendarDayState #}
|
|
||||||
{% set prevState = calendar[monthIndex]['data'][(weekIndex * 7) + (dayIndex - 1)] %}
|
|
||||||
{% if prevState.day == 0 or prevState.isReservationEnd %}
|
|
||||||
<td style="background-color: darkgray!important;">
|
|
||||||
<del>{{ dayState.day }}</del>
|
|
||||||
</td>
|
|
||||||
{% else %}
|
|
||||||
<td class="calendarGradientTravelBegin">
|
|
||||||
<del>{{ dayState.day }}</del>
|
|
||||||
</td>
|
|
||||||
{% endif %}
|
|
||||||
{% elseif dayState.isReservationEnd %}
|
{% elseif dayState.isReservationEnd %}
|
||||||
{# @var nextState \AppBundle\Util\CalendarDayState #}
|
{% set cell_class = 'calendar-day-reservation-end' %}
|
||||||
{% set nextState = calendar[monthIndex]['data'][(weekIndex * 7) + (dayIndex + 1)] %}
|
{% else %}
|
||||||
{% if nextState.isReservationBegin %}
|
{% set cell_class = '' %}
|
||||||
<td style="background-color: darkgray!important;">
|
{% endif %}
|
||||||
<del>{{ dayState.day }}</del>
|
|
||||||
</td>
|
<td class="{{ cell_class }}">
|
||||||
|
{% if dayState.isBookable and not is_past_date %}
|
||||||
|
<a href="/fewo/{{ page.slug }}/fewo-buchen?pnr={{ dayState.price.id }}&fd={{ dayState.day < 10 ? '0':'' }}{{dayState.day}}{{ calendar[monthIndex]['monthNumber'] < 10 ? '0':'' }}{{calendar[monthIndex]['monthNumber']}}{{calendar[monthIndex]['year']}}"
|
||||||
|
style="color: #5a5a5a;"
|
||||||
|
rel="nofollow"
|
||||||
|
>
|
||||||
|
{{ dayState.day }}
|
||||||
|
</a>
|
||||||
|
{% elseif dayState.day == 0 %}
|
||||||
|
-
|
||||||
{% else %}
|
{% else %}
|
||||||
<td class="calendarGradientTravelEnd">
|
<del>{{ dayState.day }}</del>
|
||||||
<a href="/fewo/{{ page.slug }}/fewo-buchen?pnr={{ dayState.price.id }}&fd={{ dayState.day < 10 ? '0':'' }}{{dayState.day}}{{ calendar[monthIndex]['monthNumber'] < 10 ? '0':'' }}{{calendar[monthIndex]['monthNumber']}}{{calendar[monthIndex]['year']}}"
|
|
||||||
style="color: white;"
|
|
||||||
rel="nofollow"
|
|
||||||
>
|
|
||||||
<del>{{ dayState.day }}</del>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
|
||||||
<td style="background-color: darkgray!important;">
|
|
||||||
<del>{{ dayState.day }}</del>
|
|
||||||
</td>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
{% else %}
|
|
||||||
{% if dayState.day == 0 %}
|
|
||||||
<td>
|
|
||||||
-
|
|
||||||
</td>
|
</td>
|
||||||
{% else %}
|
{% endfor %}
|
||||||
{% if dayState.isInSeason and not(dayState.isBookable) and not(dayState.isReserved) %}
|
</tr>
|
||||||
<td>
|
|
||||||
<del>{{ dayState.day }}</del>
|
|
||||||
</td>
|
|
||||||
{% else %}
|
|
||||||
<td style="background-color: darkgray!important">
|
|
||||||
<del>{{ dayState.day }}</del>
|
|
||||||
</td>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tbody>
|
||||||
{% endfor %}
|
</table>
|
||||||
</tbody>
|
</div>
|
||||||
</table>
|
{% endfor %}
|
||||||
{% endfor %}
|
</div>
|
||||||
|
|
@ -205,13 +205,17 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<h3>Buchung</h3>
|
|
||||||
{% include 'default/pages/cms/calendarLodgingProgram.html.twig' %}
|
|
||||||
{% else %}
|
{% else %}
|
||||||
Momentan sind für dieses Programm keine Termine verfügbar.
|
Momentan sind für dieses Programm keine Termine verfügbar.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h3>Buchung</h3>
|
||||||
|
|
||||||
|
<p>Bitte klicken Sie einen Anreisetermin, um zur Buchungsmaske zu gelagen.</p>
|
||||||
|
|
||||||
|
{% include 'default/pages/cms/calendarLodgingProgram.html.twig' %}
|
||||||
|
|
||||||
</div> <!-- END tabpanel -->
|
</div> <!-- END tabpanel -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,6 @@ services:
|
||||||
- { name: doctrine.event_listener, event: preRemove }
|
- { name: doctrine.event_listener, event: preRemove }
|
||||||
|
|
||||||
app.lodging_calendar_util:
|
app.lodging_calendar_util:
|
||||||
class: AppBundle\Util\LodgingCalendarUtil
|
class: AppBundle\Service\LodgingCalendarService
|
||||||
arguments:
|
arguments:
|
||||||
- '@doctrine.orm.entity_manager'
|
- '@doctrine.orm.entity_manager'
|
||||||
|
|
@ -168,7 +168,7 @@ class AdminController extends Controller
|
||||||
$calendar = $calendarUtil->getCalendar();
|
$calendar = $calendarUtil->getCalendar();
|
||||||
if (count($lodging->getPrices()->toArray()) != 0)
|
if (count($lodging->getPrices()->toArray()) != 0)
|
||||||
{
|
{
|
||||||
$calendar = $calendarUtil->markCalendarDaysWithReservations($lodging, $calendar);
|
$calendar = $calendarUtil->getCalendarWithReservations($lodging);
|
||||||
$calendar = $calendarUtil->mergeWithPaddedCalendar($calendar, $paddedCalendar);
|
$calendar = $calendarUtil->mergeWithPaddedCalendar($calendar, $paddedCalendar);
|
||||||
} else {
|
} else {
|
||||||
$calendar = $paddedCalendar;
|
$calendar = $paddedCalendar;
|
||||||
|
|
@ -238,7 +238,7 @@ class AdminController extends Controller
|
||||||
$calendar = $calendarUtil->getCalendar();
|
$calendar = $calendarUtil->getCalendar();
|
||||||
if (count($lodging->getPrices()->toArray()) != 0)
|
if (count($lodging->getPrices()->toArray()) != 0)
|
||||||
{
|
{
|
||||||
$calendar = $calendarUtil->markCalendarDaysWithReservations($lodging, $calendar);
|
$calendar = $calendarUtil->getCalendarWithReservations($lodging);
|
||||||
$calendar = $calendarUtil->mergeWithPaddedCalendar($calendar, $paddedCalendar);
|
$calendar = $calendarUtil->mergeWithPaddedCalendar($calendar, $paddedCalendar);
|
||||||
} else {
|
} else {
|
||||||
$calendar = $paddedCalendar;
|
$calendar = $paddedCalendar;
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ class CmsController extends Controller
|
||||||
$calendar = $calendarUtil->getCalendar();
|
$calendar = $calendarUtil->getCalendar();
|
||||||
if (count($lodging->getPrices()->toArray()) != 0)
|
if (count($lodging->getPrices()->toArray()) != 0)
|
||||||
{
|
{
|
||||||
$calendar = $calendarUtil->markCalendarDaysWithReservations($lodging, $calendar);
|
$calendar = $calendarUtil->getCalendarWithReservations($lodging);
|
||||||
$calendar = $calendarUtil->mergeWithPaddedCalendar($calendar, $paddedCalendar);
|
$calendar = $calendarUtil->mergeWithPaddedCalendar($calendar, $paddedCalendar);
|
||||||
} else {
|
} else {
|
||||||
$calendar = $paddedCalendar;
|
$calendar = $paddedCalendar;
|
||||||
|
|
|
||||||
|
|
@ -508,40 +508,39 @@
|
||||||
color:#ffffff !important;
|
color:#ffffff !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.calendarEven{
|
.table > tbody > tr > .calendar-day-disabled {
|
||||||
float: left;
|
background-color: darkgrey;
|
||||||
width: 50%;
|
}
|
||||||
|
.table > tbody > tr > .admin-calendar-day-reservation {
|
||||||
|
background-color: @background-red;
|
||||||
|
}
|
||||||
|
.table > tbody > tr > .admin-calendar-day-free {
|
||||||
|
background-color: @background-green;
|
||||||
}
|
}
|
||||||
|
|
||||||
.calendarOdd{
|
.calendar-day-dual-state(@color-a, @color-b) {
|
||||||
float: left;
|
background-color: @color-b;
|
||||||
width: 50%;
|
background: -moz-linear-gradient(to bottom right, @color-a 0%, @color-a 49%, @color-b 50%, @color-b 100%); /* ff3.6+ */
|
||||||
|
background: -webkit-gradient(linear, left top, right bottom, color-stop(0%, @color-a), color-stop(49%, @color-a), color-stop(50%, @color-b), color-stop(100%, @color-b)); /* safari4+,chrome */
|
||||||
|
background: -webkit-linear-gradient(to bottom right, @color-a 0%, @color-a 49%, @color-b 50%, @color-b 100%); /* safari5.1+,chrome10+ */
|
||||||
|
background: -o-linear-gradient(to bottom right, @color-a 0%, @color-a 49%, @color-b 50%, @color-b 100%); /* opera 11.10+ */
|
||||||
|
background: -ms-linear-gradient(to bottom right, @color-a 0%, @color-a 49%, @color-b 50%, @color-b 100%); /* ie10+ */
|
||||||
|
background: linear-gradient(to bottom right, @color-a 0%, @color-a 49%, @color-b 50%, @color-b 100%); /* w3c */
|
||||||
|
//filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='@color-b', endColorstr='@color-a',GradientType=1 ); /* ie6-9 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.calendarGradientTravelBegin {
|
.table > tbody > tr > .calendar-day-reservation-begin {
|
||||||
background: -webkit-gradient(linear, left top, right bottom, color-stop(1%, #f2f2f2), color-stop(52%, #f2f2f2), color-stop(52%, darkgrey), color-stop(52%, darkgrey), color-stop(100%, darkgrey));
|
.calendar-day-dual-state(#f2f2f2, darkgrey);
|
||||||
background: -moz-gradient(linear, left top, right bottom, color-stop(1%, #f2f2f2), color-stop(52%, #f2f2f2), color-stop(52%, darkgrey), color-stop(52%, darkgrey), color-stop(100%, darkgrey));
|
|
||||||
background: -o-gradient(linear, left top, right bottom, color-stop(1%, #f2f2f2), color-stop(52%, #f2f2f2), color-stop(52%, darkgrey), color-stop(52%, darkgrey), color-stop(100%, darkgrey));
|
|
||||||
background: gradient(linear, left top, right bottom, color-stop(1%, #f2f2f2), color-stop(52%, #f2f2f2), color-stop(52%, darkgrey), color-stop(52%, darkgrey), color-stop(100%, darkgrey));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.calendarGradientTravelEnd {
|
.table > tbody > tr > .calendar-day-reservation-end {
|
||||||
background: -webkit-gradient(linear, left top, right bottom, color-stop(1%, darkgray), color-stop(52%, darkgray), color-stop(52%, #f2f2f2), color-stop(52%, #f2f2f2), color-stop(100%, #f2f2f2));
|
.calendar-day-dual-state(darkgrey, #f2f2f2);
|
||||||
background: -moz-gradient(linear, left top, right bottom, color-stop(1%, darkgray), color-stop(52%, darkgray), color-stop(52%, #f2f2f2), color-stop(52%, #f2f2f2), color-stop(100%, #f2f2f2));
|
|
||||||
background: -o-gradient(linear, left top, right bottom, color-stop(1%, darkgray), color-stop(52%, darkgray), color-stop(52%, #f2f2f2), color-stop(52%, #f2f2f2), color-stop(100%, #f2f2f2));
|
|
||||||
background: gradient(linear, left top, right bottom, color-stop(1%, darkgray), color-stop(52%, darkgray), color-stop(52%, #f2f2f2), color-stop(52%, #f2f2f2), color-stop(100%, #f2f2f2));
|
|
||||||
}
|
|
||||||
|
|
||||||
.calendarGradientAdminBegin {
|
|
||||||
background: -webkit-gradient(linear, left top, right bottom, color-stop(1%, #f2f2f2), color-stop(52%, #f2f2f2), color-stop(52%, red), color-stop(52%, red), color-stop(100%, red));
|
|
||||||
background: -moz-gradient(linear, left top, right bottom, color-stop(1%, #f2f2f2), color-stop(52%, #f2f2f2), color-stop(52%, red), color-stop(52%, red), color-stop(100%, red));
|
|
||||||
background: -o-gradient(linear, left top, right bottom, color-stop(1%, #f2f2f2), color-stop(52%, #f2f2f2), color-stop(52%, red), color-stop(52%, red), color-stop(100%, red));
|
|
||||||
background: gradient(linear, left top, right bottom, color-stop(1%, #f2f2f2), color-stop(52%, #f2f2f2), color-stop(52%, red), color-stop(52%, red), color-stop(100%, red));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.calendarGradientAdminEnd {
|
.table > tbody > tr > .admin-calendar-day-reservation-begin {
|
||||||
background: -webkit-gradient(linear, left top, right bottom, color-stop(1%, red), color-stop(52%, red), color-stop(52%, green), color-stop(52%, green), color-stop(100%, green));
|
.calendar-day-dual-state(@background-green, @background-red);
|
||||||
background: -moz-gradient(linear, left top, right bottom, color-stop(1%, red), color-stop(52%, red), color-stop(52%, green), color-stop(52%, green), color-stop(100%, green));
|
}
|
||||||
background: -o-gradient(linear, left top, right bottom, color-stop(1%, red), color-stop(52%, red), color-stop(52%, green), color-stop(52%, green), color-stop(100%, green));
|
|
||||||
background: gradient(linear, left top, right bottom, color-stop(1%, red), color-stop(52%, red), color-stop(52%, green), color-stop(52%, green), color-stop(100%, green));
|
.table > tbody > tr > .admin-calendar-day-reservation-end {
|
||||||
|
.calendar-day-dual-state(@background-red, @background-green);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,4 +33,7 @@
|
||||||
@font-size-def-h5: @font-size-alternative-base;
|
@font-size-def-h5: @font-size-alternative-base;
|
||||||
@font-size-def-h6: ceil((@font-size-alternative-base * 0.85));
|
@font-size-def-h6: ceil((@font-size-alternative-base * 0.85));
|
||||||
|
|
||||||
@btn-color-all: #648859;
|
@background-green: #648859;
|
||||||
|
@background-red: #d9534f;
|
||||||
|
|
||||||
|
@btn-color-all: @background-green;
|
||||||
|
|
@ -1057,37 +1057,74 @@ a[id^="video_"]:before,
|
||||||
.widget .sidebar-price .btn {
|
.widget .sidebar-price .btn {
|
||||||
color: #ffffff !important;
|
color: #ffffff !important;
|
||||||
}
|
}
|
||||||
.calendarEven {
|
.table > tbody > tr > .calendar-day-disabled {
|
||||||
float: left;
|
background-color: darkgrey;
|
||||||
width: 50%;
|
|
||||||
}
|
}
|
||||||
.calendarOdd {
|
.table > tbody > tr > .admin-calendar-day-reservation {
|
||||||
float: left;
|
background-color: #d9534f;
|
||||||
width: 50%;
|
|
||||||
}
|
}
|
||||||
.calendarGradientTravelBegin {
|
.table > tbody > tr > .admin-calendar-day-free {
|
||||||
background: -webkit-gradient(linear, left top, right bottom, color-stop(1%, #f2f2f2), color-stop(52%, #f2f2f2), color-stop(52%, #a9a9a9), color-stop(52%, #a9a9a9), color-stop(100%, #a9a9a9));
|
background-color: #648859;
|
||||||
background: -moz-gradient(linear, left top, right bottom, color-stop(1%, #f2f2f2), color-stop(52%, #f2f2f2), color-stop(52%, #a9a9a9), color-stop(52%, #a9a9a9), color-stop(100%, #a9a9a9));
|
|
||||||
background: -o-gradient(linear, left top, right bottom, color-stop(1%, #f2f2f2), color-stop(52%, #f2f2f2), color-stop(52%, #a9a9a9), color-stop(52%, #a9a9a9), color-stop(100%, #a9a9a9));
|
|
||||||
background: gradient(linear, left top, right bottom, color-stop(1%, #f2f2f2), color-stop(52%, #f2f2f2), color-stop(52%, #a9a9a9), color-stop(52%, #a9a9a9), color-stop(100%, #a9a9a9));
|
|
||||||
}
|
}
|
||||||
.calendarGradientTravelEnd {
|
.table > tbody > tr > .calendar-day-reservation-begin {
|
||||||
background: -webkit-gradient(linear, left top, right bottom, color-stop(1%, #a9a9a9), color-stop(52%, #a9a9a9), color-stop(52%, #f2f2f2), color-stop(52%, #f2f2f2), color-stop(100%, #f2f2f2));
|
background-color: #a9a9a9;
|
||||||
background: -moz-gradient(linear, left top, right bottom, color-stop(1%, #a9a9a9), color-stop(52%, #a9a9a9), color-stop(52%, #f2f2f2), color-stop(52%, #f2f2f2), color-stop(100%, #f2f2f2));
|
background: -moz-linear-gradient(to bottom right, #f2f2f2 0%, #f2f2f2 49%, #a9a9a9 50%, #a9a9a9 100%);
|
||||||
background: -o-gradient(linear, left top, right bottom, color-stop(1%, #a9a9a9), color-stop(52%, #a9a9a9), color-stop(52%, #f2f2f2), color-stop(52%, #f2f2f2), color-stop(100%, #f2f2f2));
|
/* ff3.6+ */
|
||||||
background: gradient(linear, left top, right bottom, color-stop(1%, #a9a9a9), color-stop(52%, #a9a9a9), color-stop(52%, #f2f2f2), color-stop(52%, #f2f2f2), color-stop(100%, #f2f2f2));
|
background: -webkit-gradient(linear, left top, right bottom, color-stop(0%, #f2f2f2), color-stop(49%, #f2f2f2), color-stop(50%, #a9a9a9), color-stop(100%, #a9a9a9));
|
||||||
|
/* safari4+,chrome */
|
||||||
|
background: -webkit-linear-gradient(to bottom right, #f2f2f2 0%, #f2f2f2 49%, #a9a9a9 50%, #a9a9a9 100%);
|
||||||
|
/* safari5.1+,chrome10+ */
|
||||||
|
background: -o-linear-gradient(to bottom right, #f2f2f2 0%, #f2f2f2 49%, #a9a9a9 50%, #a9a9a9 100%);
|
||||||
|
/* opera 11.10+ */
|
||||||
|
background: -ms-linear-gradient(to bottom right, #f2f2f2 0%, #f2f2f2 49%, #a9a9a9 50%, #a9a9a9 100%);
|
||||||
|
/* ie10+ */
|
||||||
|
background: linear-gradient(to bottom right, #f2f2f2 0%, #f2f2f2 49%, #a9a9a9 50%, #a9a9a9 100%);
|
||||||
|
/* w3c */
|
||||||
}
|
}
|
||||||
.calendarGradientAdminBegin {
|
.table > tbody > tr > .calendar-day-reservation-end {
|
||||||
background: -webkit-gradient(linear, left top, right bottom, color-stop(1%, #f2f2f2), color-stop(52%, #f2f2f2), color-stop(52%, #ff0000), color-stop(52%, #ff0000), color-stop(100%, #ff0000));
|
background-color: #f2f2f2;
|
||||||
background: -moz-gradient(linear, left top, right bottom, color-stop(1%, #f2f2f2), color-stop(52%, #f2f2f2), color-stop(52%, #ff0000), color-stop(52%, #ff0000), color-stop(100%, #ff0000));
|
background: -moz-linear-gradient(to bottom right, #a9a9a9 0%, #a9a9a9 49%, #f2f2f2 50%, #f2f2f2 100%);
|
||||||
background: -o-gradient(linear, left top, right bottom, color-stop(1%, #f2f2f2), color-stop(52%, #f2f2f2), color-stop(52%, #ff0000), color-stop(52%, #ff0000), color-stop(100%, #ff0000));
|
/* ff3.6+ */
|
||||||
background: gradient(linear, left top, right bottom, color-stop(1%, #f2f2f2), color-stop(52%, #f2f2f2), color-stop(52%, #ff0000), color-stop(52%, #ff0000), color-stop(100%, #ff0000));
|
background: -webkit-gradient(linear, left top, right bottom, color-stop(0%, #a9a9a9), color-stop(49%, #a9a9a9), color-stop(50%, #f2f2f2), color-stop(100%, #f2f2f2));
|
||||||
|
/* safari4+,chrome */
|
||||||
|
background: -webkit-linear-gradient(to bottom right, #a9a9a9 0%, #a9a9a9 49%, #f2f2f2 50%, #f2f2f2 100%);
|
||||||
|
/* safari5.1+,chrome10+ */
|
||||||
|
background: -o-linear-gradient(to bottom right, #a9a9a9 0%, #a9a9a9 49%, #f2f2f2 50%, #f2f2f2 100%);
|
||||||
|
/* opera 11.10+ */
|
||||||
|
background: -ms-linear-gradient(to bottom right, #a9a9a9 0%, #a9a9a9 49%, #f2f2f2 50%, #f2f2f2 100%);
|
||||||
|
/* ie10+ */
|
||||||
|
background: linear-gradient(to bottom right, #a9a9a9 0%, #a9a9a9 49%, #f2f2f2 50%, #f2f2f2 100%);
|
||||||
|
/* w3c */
|
||||||
}
|
}
|
||||||
.calendarGradientAdminEnd {
|
.table > tbody > tr > .admin-calendar-day-reservation-begin {
|
||||||
background: -webkit-gradient(linear, left top, right bottom, color-stop(1%, #ff0000), color-stop(52%, #ff0000), color-stop(52%, #008000), color-stop(52%, #008000), color-stop(100%, #008000));
|
background-color: #d9534f;
|
||||||
background: -moz-gradient(linear, left top, right bottom, color-stop(1%, #ff0000), color-stop(52%, #ff0000), color-stop(52%, #008000), color-stop(52%, #008000), color-stop(100%, #008000));
|
background: -moz-linear-gradient(to bottom right, #648859 0%, #648859 49%, #d9534f 50%, #d9534f 100%);
|
||||||
background: -o-gradient(linear, left top, right bottom, color-stop(1%, #ff0000), color-stop(52%, #ff0000), color-stop(52%, #008000), color-stop(52%, #008000), color-stop(100%, #008000));
|
/* ff3.6+ */
|
||||||
background: gradient(linear, left top, right bottom, color-stop(1%, #ff0000), color-stop(52%, #ff0000), color-stop(52%, #008000), color-stop(52%, #008000), color-stop(100%, #008000));
|
background: -webkit-gradient(linear, left top, right bottom, color-stop(0%, #648859), color-stop(49%, #648859), color-stop(50%, #d9534f), color-stop(100%, #d9534f));
|
||||||
|
/* safari4+,chrome */
|
||||||
|
background: -webkit-linear-gradient(to bottom right, #648859 0%, #648859 49%, #d9534f 50%, #d9534f 100%);
|
||||||
|
/* safari5.1+,chrome10+ */
|
||||||
|
background: -o-linear-gradient(to bottom right, #648859 0%, #648859 49%, #d9534f 50%, #d9534f 100%);
|
||||||
|
/* opera 11.10+ */
|
||||||
|
background: -ms-linear-gradient(to bottom right, #648859 0%, #648859 49%, #d9534f 50%, #d9534f 100%);
|
||||||
|
/* ie10+ */
|
||||||
|
background: linear-gradient(to bottom right, #648859 0%, #648859 49%, #d9534f 50%, #d9534f 100%);
|
||||||
|
/* w3c */
|
||||||
|
}
|
||||||
|
.table > tbody > tr > .admin-calendar-day-reservation-end {
|
||||||
|
background-color: #648859;
|
||||||
|
background: -moz-linear-gradient(to bottom right, #d9534f 0%, #d9534f 49%, #648859 50%, #648859 100%);
|
||||||
|
/* ff3.6+ */
|
||||||
|
background: -webkit-gradient(linear, left top, right bottom, color-stop(0%, #d9534f), color-stop(49%, #d9534f), color-stop(50%, #648859), color-stop(100%, #648859));
|
||||||
|
/* safari4+,chrome */
|
||||||
|
background: -webkit-linear-gradient(to bottom right, #d9534f 0%, #d9534f 49%, #648859 50%, #648859 100%);
|
||||||
|
/* safari5.1+,chrome10+ */
|
||||||
|
background: -o-linear-gradient(to bottom right, #d9534f 0%, #d9534f 49%, #648859 50%, #648859 100%);
|
||||||
|
/* opera 11.10+ */
|
||||||
|
background: -ms-linear-gradient(to bottom right, #d9534f 0%, #d9534f 49%, #648859 50%, #648859 100%);
|
||||||
|
/* ie10+ */
|
||||||
|
background: linear-gradient(to bottom right, #d9534f 0%, #d9534f 49%, #648859 50%, #648859 100%);
|
||||||
|
/* w3c */
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
7) SHORTCODES
|
7) SHORTCODES
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace AppBundle\Util;
|
namespace AppBundle\Service;
|
||||||
|
|
||||||
use AppBundle\Entity\FewoLodging;
|
use AppBundle\Entity\FewoLodging;
|
||||||
use AppBundle\Entity\FewoPrice;
|
use AppBundle\Entity\FewoPrice;
|
||||||
|
|
@ -10,7 +10,7 @@ use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\EntityManager;
|
use Doctrine\ORM\EntityManager;
|
||||||
use AppBundle\Util\CalendarDayState;
|
use AppBundle\Util\CalendarDayState;
|
||||||
|
|
||||||
class LodgingCalendarUtil
|
class LodgingCalendarService
|
||||||
{
|
{
|
||||||
private $em;
|
private $em;
|
||||||
|
|
||||||
|
|
@ -159,6 +159,9 @@ class LodgingCalendarUtil
|
||||||
$day->setIsReserved(false);
|
$day->setIsReserved(false);
|
||||||
$day->setIsReservationBegin(false);
|
$day->setIsReservationBegin(false);
|
||||||
$day->setIsReservationEnd(false);
|
$day->setIsReservationEnd(false);
|
||||||
|
$datetime = new \DateTime();
|
||||||
|
$datetime->setTimestamp(mktime(0,0,0, $actualMonth, $d, $actualCurrentYear));
|
||||||
|
$day->setDate($datetime);
|
||||||
|
|
||||||
$data[] = $day;
|
$data[] = $day;
|
||||||
}
|
}
|
||||||
|
|
@ -299,7 +302,7 @@ class LodgingCalendarUtil
|
||||||
$data[$i]->setIsReserved(false);
|
$data[$i]->setIsReserved(false);
|
||||||
$data[$i]->setPrice($price);
|
$data[$i]->setPrice($price);
|
||||||
$data[$i]->setIsInSeason(true);
|
$data[$i]->setIsInSeason(true);
|
||||||
$data[$i]->setIsBookable(true);
|
$data[$i]->setIsBookable(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$calendar[$startCalendarIndex]['data'] = $data;
|
$calendar[$startCalendarIndex]['data'] = $data;
|
||||||
|
|
@ -341,7 +344,7 @@ class LodgingCalendarUtil
|
||||||
$data[$i]->setIsReserved(false);
|
$data[$i]->setIsReserved(false);
|
||||||
$data[$i]->setPrice($price);
|
$data[$i]->setPrice($price);
|
||||||
$data[$i]->setIsInSeason(true);
|
$data[$i]->setIsInSeason(true);
|
||||||
$data[$i]->setIsBookable(true);
|
$data[$i]->setIsBookable(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$calendar[$startCalendarIndex]['data'] = $data;
|
$calendar[$startCalendarIndex]['data'] = $data;
|
||||||
|
|
@ -366,7 +369,7 @@ class LodgingCalendarUtil
|
||||||
$data[$i]->setIsReservationEnd(true);
|
$data[$i]->setIsReservationEnd(true);
|
||||||
$data[$i]->setReservation($reservation);
|
$data[$i]->setReservation($reservation);
|
||||||
$data[$i]->setIsInSeason(true);
|
$data[$i]->setIsInSeason(true);
|
||||||
$data[$i]->setIsBookable(false); // todo, hier evtl direkt true
|
$data[$i]->setIsBookable(false);
|
||||||
//$data[$i]->setIsBookable(true);
|
//$data[$i]->setIsBookable(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -382,7 +385,7 @@ class LodgingCalendarUtil
|
||||||
$data[$i]->setIsReserved(false);
|
$data[$i]->setIsReserved(false);
|
||||||
$data[$i]->setPrice($price);
|
$data[$i]->setPrice($price);
|
||||||
$data[$i]->setIsInSeason(true);
|
$data[$i]->setIsInSeason(true);
|
||||||
$data[$i]->setIsBookable(true);
|
$data[$i]->setIsBookable(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$calendar[$endCalendarIndex]['data'] = $data;
|
$calendar[$endCalendarIndex]['data'] = $data;
|
||||||
|
|
@ -412,7 +415,7 @@ class LodgingCalendarUtil
|
||||||
$data[$j]->setIsReserved(false);
|
$data[$j]->setIsReserved(false);
|
||||||
$data[$j]->setPrice($price);
|
$data[$j]->setPrice($price);
|
||||||
$data[$j]->setIsInSeason(true);
|
$data[$j]->setIsInSeason(true);
|
||||||
$data[$j]->setIsBookable(true);
|
$data[$j]->setIsBookable(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$calendar[$i]['data'] = $data;
|
$calendar[$i]['data'] = $data;
|
||||||
|
|
@ -435,10 +438,6 @@ class LodgingCalendarUtil
|
||||||
|
|
||||||
for($j = 0; $j < $endIndex; $j++)
|
for($j = 0; $j < $endIndex; $j++)
|
||||||
{
|
{
|
||||||
//$mergedPricesAndReservationsCalendar = $this->mergeCalendarsNew($pricesCalendar, $reservationsCalendar, false);
|
|
||||||
//$actuallyReservableDaysCalendar = $this->filterReservableDays($lodging, $mergedPricesAndReservationsCalendar);
|
|
||||||
//$resultCalendar = $this->mergeCalendars($actuallyReservableDaysCalendar, $reservationsCalendar, true);
|
|
||||||
|
|
||||||
if ($withFromTo)
|
if ($withFromTo)
|
||||||
{
|
{
|
||||||
if ($extensionCalendarData[$j]->getIsInSeason())
|
if ($extensionCalendarData[$j]->getIsInSeason())
|
||||||
|
|
@ -489,13 +488,13 @@ class LodgingCalendarUtil
|
||||||
// erste runde $pricesCalendar merge mit $reservationsCalendar
|
// erste runde $pricesCalendar merge mit $reservationsCalendar
|
||||||
|
|
||||||
$price = $calendarData[$j]->getPrice();
|
$price = $calendarData[$j]->getPrice();
|
||||||
|
$isInSeason = $calendarData[$j]->getIsInSeason();
|
||||||
$reservation = $calendarData[$j]->getReservation();
|
$reservation = $calendarData[$j]->getReservation();
|
||||||
$calendarData[$j] = $extensionCalendarData[$j];
|
$calendarData[$j] = $extensionCalendarData[$j];
|
||||||
|
|
||||||
if ($calendarData[$j]->getIsReservationEnd() && $extensionCalendarData[$j]->getIsReservationBegin())
|
if ($calendarData[$j]->getIsReservationEnd() && $extensionCalendarData[$j]->getIsReservationBegin())
|
||||||
{
|
{
|
||||||
$calendarData[$j]->setReservation($reservation);
|
$calendarData[$j]->setReservation($reservation);
|
||||||
|
|
||||||
$calendarData[$j]->setIsReservationBegin(false);
|
$calendarData[$j]->setIsReservationBegin(false);
|
||||||
$calendarData[$j]->setIsReservationEnd(false);
|
$calendarData[$j]->setIsReservationEnd(false);
|
||||||
}
|
}
|
||||||
|
|
@ -581,88 +580,50 @@ class LodgingCalendarUtil
|
||||||
/**
|
/**
|
||||||
* @param FewoLodging $lodging
|
* @param FewoLodging $lodging
|
||||||
* @param $calendar
|
* @param $calendar
|
||||||
* @return array|null
|
* @return array|null calendars
|
||||||
*/
|
*/
|
||||||
private function filterReservableDays(FewoLodging $lodging, $calendar)
|
private function filterReservableDays(FewoLodging $lodging, $calendar)
|
||||||
{
|
{
|
||||||
$priceRepo = $this->em->getRepository('AppBundle:FewoPrice');
|
|
||||||
|
|
||||||
$today = new \DateTime();
|
|
||||||
$seasons = $lodging->getSeasons();
|
|
||||||
$prices = $lodging->getPrices();
|
|
||||||
$cleanCalendar = $this->getCalendar();
|
|
||||||
|
|
||||||
$potentiallyReservableDays = [];
|
$potentiallyReservableDays = [];
|
||||||
$actuallyReservableDays = [];
|
|
||||||
$lastReservablePriceId = 0;
|
|
||||||
$priceId = 0;
|
$priceId = 0;
|
||||||
|
/** @var FewoPrice $lastReservablePrice */
|
||||||
|
$lastReservablePrice = null;
|
||||||
|
|
||||||
for($currMonthIndex = 0; $currMonthIndex < count($calendar); $currMonthIndex++)
|
for ($currMonthIndex = 0; $currMonthIndex < count($calendar); $currMonthIndex++)
|
||||||
{
|
{
|
||||||
$currMonth = $calendar[$currMonthIndex];
|
$currMonth = $calendar[$currMonthIndex];
|
||||||
/** @var CalendarDayState[] $data */
|
/** @var CalendarDayState[] $data */
|
||||||
$data = $currMonth['data'];
|
$data = $currMonth['data'];
|
||||||
|
|
||||||
for($currDayIndex = 0; $currDayIndex < count($data); $currDayIndex++)
|
for ($currDayIndex = 0; $currDayIndex < count($data); $currDayIndex++)
|
||||||
{
|
{
|
||||||
//$currDay = explode(',', $data[$currDayIndex]);
|
|
||||||
$currDay = $data[$currDayIndex];
|
$currDay = $data[$currDayIndex];
|
||||||
|
|
||||||
if ($currDay->getIsBookable() || $currDay->getIsReserved())
|
if ($currDay->getPrice() !== $lastReservablePrice && !$currDay->getIsInSeason())
|
||||||
{
|
{
|
||||||
if ($currDay->getIsBookable())
|
$actuallyReservableDays = $this->processPotentiallyReservableDays($potentiallyReservableDays,
|
||||||
{
|
$lastReservablePrice->getSeason()->getMinimumStay());
|
||||||
$price = $currDay->getPrice();
|
$this->processRest($actuallyReservableDays, $lastReservablePrice, $calendar);
|
||||||
$priceId = $price->getId();
|
$potentiallyReservableDays = [];
|
||||||
|
|
||||||
if ($lastReservablePriceId == 0)
|
|
||||||
{
|
|
||||||
$lastReservablePriceId = $priceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($lastReservablePriceId != $priceId)
|
|
||||||
{
|
|
||||||
$lastPrice = $priceRepo->find($lastReservablePriceId);
|
|
||||||
/** @var FewoSeason $season */
|
|
||||||
$season = $lastPrice->getSeason();
|
|
||||||
|
|
||||||
$actuallyReservableDays = $this->processPotentiallyReservableDays($potentiallyReservableDays, $season->getMinimumStay());
|
|
||||||
$this->processRest($actuallyReservableDays, $lastPrice, $cleanCalendar); //todo
|
|
||||||
|
|
||||||
$lastReservablePriceId = $priceId;
|
|
||||||
$potentiallyReservableDays = [];
|
|
||||||
$actuallyReservableDays = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$currentDayDate = date("d.m.Y", strtotime($currMonth['year']."-".$currMonth['monthNumber']."-".$currDay->getDay()));
|
|
||||||
$potentiallyReservableDays[] = $currentDayDate;
|
|
||||||
}
|
|
||||||
elseif ($currDay->getIsReserved() && $currDay->getIsReservationBegin())
|
|
||||||
{
|
|
||||||
$currentDayDate = date("d.m.Y", strtotime($currMonth['year']."-".$currMonth['monthNumber']."-".$currDay->getDay()));
|
|
||||||
$potentiallyReservableDays[] = $currentDayDate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
if ($currDay->getIsInSeason() && (!$currDay->getIsReserved() || $currDay->getIsReservationBegin() ||
|
||||||
|
$currDay->getIsReservationEnd()))
|
||||||
{
|
{
|
||||||
if($lastReservablePriceId == $priceId && $lastReservablePriceId != 0)
|
$currentDayDate = date("d.m.Y", strtotime($currMonth['year']."-".
|
||||||
{
|
$currMonth['monthNumber']."-".$currDay->getDay()));
|
||||||
$lastPrice = $priceRepo->find($lastReservablePriceId);
|
$potentiallyReservableDays[] = $currentDayDate;
|
||||||
/** @var FewoSeason $season */
|
|
||||||
$season = $lastPrice->getSeason();
|
|
||||||
|
|
||||||
$actuallyReservableDays = $this->processPotentiallyReservableDays($potentiallyReservableDays, $season->getMinimumStay());
|
|
||||||
$this->processRest($actuallyReservableDays, $lastPrice, $cleanCalendar); //todo
|
|
||||||
|
|
||||||
$lastReservablePriceId = $priceId;
|
|
||||||
$potentiallyReservableDays = [];
|
|
||||||
$actuallyReservableDays = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$lastReservablePrice = $currDay->getIsInSeason() ? $currDay->getPrice() : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $cleanCalendar;
|
if ($lastReservablePrice !== null)
|
||||||
|
{
|
||||||
|
$actuallyReservableDays = $this->processPotentiallyReservableDays($potentiallyReservableDays,
|
||||||
|
$lastReservablePrice->getSeason()->getMinimumStay());
|
||||||
|
$this->processRest($actuallyReservableDays, $lastReservablePrice, $calendar);
|
||||||
|
}
|
||||||
|
return $calendar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -739,12 +700,12 @@ class LodgingCalendarUtil
|
||||||
|
|
||||||
if (in_array($currentDate, $actuallyReservableDays))
|
if (in_array($currentDate, $actuallyReservableDays))
|
||||||
{
|
{
|
||||||
$data[$currDayIndex]->setIsInSeason(true);
|
//$data[$currDayIndex]->setIsInSeason(true);
|
||||||
$data[$currDayIndex]->setIsReserved(false); // todo ?
|
//$data[$currDayIndex]->setIsReserved(false); // todo ?
|
||||||
$data[$currDayIndex]->setIsBookable(true);
|
$data[$currDayIndex]->setIsBookable(true);
|
||||||
$data[$currDayIndex]->setIsReservationBegin(false);
|
//$data[$currDayIndex]->setIsReservationBegin(false);
|
||||||
$data[$currDayIndex]->setIsReservationEnd(false); // todo ?
|
//$data[$currDayIndex]->setIsReservationEnd(false); // todo ?
|
||||||
$data[$currDayIndex]->setPrice($price);
|
//$data[$currDayIndex]->setPrice($price);
|
||||||
|
|
||||||
$currMonth['marked'] = 1;
|
$currMonth['marked'] = 1;
|
||||||
}
|
}
|
||||||
|
|
@ -761,28 +722,23 @@ class LodgingCalendarUtil
|
||||||
* @param $calendar
|
* @param $calendar
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function markCalendarDaysWithReservations(FewoLodging $lodging, $calendar)
|
public function getCalendarWithReservations(FewoLodging $lodging)
|
||||||
{
|
{
|
||||||
$today = new \DateTime();
|
$today = new \DateTime();
|
||||||
$pricesCalendar = $calendar;
|
$pricesCalendar = $this->getCalendar();
|
||||||
$reservationsCalendar = $calendar;
|
$reservationsCalendar = $this->getCalendar();
|
||||||
|
|
||||||
$reservations = $lodging->getReservations();
|
$reservations = $lodging->getReservations();
|
||||||
$prices = $lodging->getPrices();
|
$prices = $lodging->getPrices();
|
||||||
|
|
||||||
$lodgingId = $lodging->getId();
|
$lodgingId = $lodging->getId();
|
||||||
|
|
||||||
foreach($prices as $price)
|
foreach ($prices as $price)
|
||||||
{
|
{
|
||||||
/** @var FewoSeason $season */
|
/** @var FewoSeason $season */
|
||||||
$season = $price->getSeason();
|
$season = $price->getSeason();
|
||||||
$fromDate = $season->getFromDate();
|
$pricesCalendar = $this->markCalendarDays($pricesCalendar, $season->getFromDate(), $season->getToDate(),
|
||||||
$toDate = $season->getToDate();
|
false, $price);
|
||||||
|
|
||||||
if(!($toDate < $today))
|
|
||||||
{
|
|
||||||
$pricesCalendar = $this->markCalendarDays($pricesCalendar, $fromDate, $toDate, false, $price, null); //TODO fast fertig
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($reservations as $reservation)
|
foreach($reservations as $reservation)
|
||||||
|
|
@ -797,9 +753,10 @@ class LodgingCalendarUtil
|
||||||
|
|
||||||
$mergedPricesAndReservationsCalendar = $this->mergeCalendars($pricesCalendar, $reservationsCalendar, false);
|
$mergedPricesAndReservationsCalendar = $this->mergeCalendars($pricesCalendar, $reservationsCalendar, false);
|
||||||
$actuallyReservableDaysCalendar = $this->filterReservableDays($lodging, $mergedPricesAndReservationsCalendar);
|
$actuallyReservableDaysCalendar = $this->filterReservableDays($lodging, $mergedPricesAndReservationsCalendar);
|
||||||
$resultCalendar = $this->mergeCalendars($actuallyReservableDaysCalendar, $reservationsCalendar, true);
|
//$resultCalendar = $this->mergeCalendars($actuallyReservableDaysCalendar, $reservationsCalendar, true);
|
||||||
|
|
||||||
return $resultCalendar;
|
return $actuallyReservableDaysCalendar;
|
||||||
|
//return $resultCalendar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -17,12 +17,12 @@ class CalendarDayState
|
||||||
private $day;
|
private $day;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var FewoPrice
|
* @var FewoPrice|null
|
||||||
*/
|
*/
|
||||||
private $price; // der preis / die saison
|
private $price; // der preis / die saison
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var FewoReservation
|
* @var FewoReservation|null
|
||||||
*/
|
*/
|
||||||
private $reservation; // die reservierung //todo wenns vorteile bringt, ne zweite speichern
|
private $reservation; // die reservierung //todo wenns vorteile bringt, ne zweite speichern
|
||||||
|
|
||||||
|
|
@ -49,7 +49,12 @@ class CalendarDayState
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
private $isReservationEnd; // ist es das ende einer reservierung?
|
private $isReservationEnd;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \DateTime|null
|
||||||
|
*/
|
||||||
|
private $date = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int
|
* @return int
|
||||||
|
|
@ -68,33 +73,33 @@ class CalendarDayState
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return FewoPrice
|
* @return FewoPrice|null
|
||||||
*/
|
*/
|
||||||
public function getPrice(): FewoPrice
|
public function getPrice()
|
||||||
{
|
{
|
||||||
return $this->price;
|
return $this->price;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param FewoPrice $price
|
* @param FewoPrice|null $price
|
||||||
*/
|
*/
|
||||||
public function setPrice(FewoPrice $price)
|
public function setPrice($price)
|
||||||
{
|
{
|
||||||
$this->price = $price;
|
$this->price = $price;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return FewoReservation
|
* @return FewoReservation|null
|
||||||
*/
|
*/
|
||||||
public function getReservation(): FewoReservation
|
public function getReservation()
|
||||||
{
|
{
|
||||||
return $this->reservation;
|
return $this->reservation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param FewoReservation $reservation
|
* @param FewoReservation|null $reservation
|
||||||
*/
|
*/
|
||||||
public function setReservation(FewoReservation $reservation)
|
public function setReservation($reservation)
|
||||||
{
|
{
|
||||||
$this->reservation = $reservation;
|
$this->reservation = $reservation;
|
||||||
}
|
}
|
||||||
|
|
@ -179,6 +184,20 @@ class CalendarDayState
|
||||||
$this->isReservationEnd = $isReservationEnd;
|
$this->isReservationEnd = $isReservationEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \DateTime|null
|
||||||
|
*/
|
||||||
|
public function getDate()
|
||||||
|
{
|
||||||
|
return $this->date;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param \DateTime|null $date
|
||||||
|
*/
|
||||||
|
public function setDate($date)
|
||||||
|
{
|
||||||
|
$this->date = $date;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue