git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3356 f459cee4-fb09-11de-96c3-f9c5f16c3c76
This commit is contained in:
uli 2017-10-27 09:47:23 +00:00
parent 8240ce87f9
commit 3bb0bb53a7
11 changed files with 276 additions and 330 deletions

View file

@ -22,83 +22,42 @@
{% for dayIndex in 0..6 %}
{# @var dayState \AppBundle\Util\CalendarDayState #}
{% set dayState = calendar[monthIndex]['data'][(weekIndex * 7) + dayIndex] %}
{% if dayState.isBookable or dayState.isReserved %}
{% if dayState.isBookable %}
<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']}}"
style="color: #5a5a5a;"
{#class="btn btn-primary"#}
rel="nofollow"
>
{{ dayState.day }}
</a>
</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: 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 %}
{% set is_past_date = dayState.date is not empty and date(dayState.date) < date('now') %}
{# Set cell class #}
{% if (dayState.isReserved and
not dayState.isReservationBegin and not dayState.isReservationEnd)
%}
{% set cell_class = 'admin-calendar-day-reservation' %}
{% elseif dayState.isReservationBegin %}
{% set cell_class = 'admin-calendar-day-reservation-begin' %}
{% elseif dayState.isReservationEnd %}
{% set cell_class = 'admin-calendar-day-reservation-end' %}
{% elseif dayState.isInSeason %}
{% set cell_class = 'admin-calendar-day-free' %}
{% else %}
{% if dayState.day == 0 %}
<td>
-
</td>
{% else %}
<td>{{ dayState.day }}</td>
{% endif %}
{% set cell_class = '' %}
{% 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 %}
</tr>
{% endfor %}
</tbody>

View file

@ -1,97 +1,65 @@
{% for monthIndex in 0..11 %}
{% if monthIndex is even %}
<table class="table calendarEven">
{% else %}
<table class="table calendarOdd">
{% endif %}
<thead>
<tr>
<th colspan="7">
{{ calendar[monthIndex]['monthName'] }} {{ calendar[monthIndex]['year'] }}
</th>
</tr>
<tr>
<th>Mo</th>
<th>Di</th>
<th>Mi</th>
<th>Do</th>
<th>Fr</th>
<th>Sa</th>
<th>So</th>
</tr>
</thead>
<tbody>
{% for weekIndex in 0..5 %}
<tr>
{% for dayIndex in 0..6 %}
{# @var dayState \AppBundle\Util\CalendarDayState #}
{% set dayState = calendar[monthIndex]['data'][(weekIndex * 7) + dayIndex] %}
{% if dayState.isBookable or dayState.isReserved %}
{% if dayState.isBookable %}
<td>
<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>
</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 %}
<div class="row">
{% for monthIndex in 0..11 %}
<div class="col-xs-12 col-sm-6">
<table class="table calendar-table">
<thead>
<tr>
<th colspan="7">
{{ calendar[monthIndex]['monthName'] }} {{ calendar[monthIndex]['year'] }}
</th>
</tr>
<tr>
<th>Mo</th>
<th>Di</th>
<th>Mi</th>
<th>Do</th>
<th>Fr</th>
<th>Sa</th>
<th>So</th>
</tr>
</thead>
<tbody>
{% for weekIndex in 0..5 %}
<tr>
{% for dayIndex in 0..6 %}
{# @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') %}
{# Set cell class #}
{% if is_past_date or
(dayState.isReserved and not dayState.isReservationBegin and not dayState.isReservationEnd) or
not dayState.isInSeason
%}
{% set cell_class = 'calendar-day-disabled' %}
{% elseif dayState.isReservationBegin %}
{% set cell_class = 'calendar-day-reservation-begin' %}
{% elseif dayState.isReservationEnd %}
{# @var nextState \AppBundle\Util\CalendarDayState #}
{% set nextState = calendar[monthIndex]['data'][(weekIndex * 7) + (dayIndex + 1)] %}
{% if nextState.isReservationBegin %}
<td style="background-color: darkgray!important;">
<del>{{ dayState.day }}</del>
</td>
{% set cell_class = 'calendar-day-reservation-end' %}
{% else %}
{% set cell_class = '' %}
{% endif %}
<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 %}
<td class="calendarGradientTravelEnd">
<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>
<del>{{ dayState.day }}</del>
{% endif %}
{% else %}
<td style="background-color: darkgray!important;">
<del>{{ dayState.day }}</del>
</td>
{% endif %}
{% endif %}
{% else %}
{% if dayState.day == 0 %}
<td>
-
</td>
{% else %}
{% if dayState.isInSeason and not(dayState.isBookable) and not(dayState.isReserved) %}
<td>
<del>{{ dayState.day }}</del>
</td>
{% else %}
<td style="background-color: darkgray!important">
<del>{{ dayState.day }}</del>
</td>
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
</tr>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{% endfor %}
</tbody>
</table>
</div>
{% endfor %}
</div>

View file

@ -205,13 +205,17 @@
{% endfor %}
</tbody>
</table>
<h3>Buchung</h3>
{% include 'default/pages/cms/calendarLodgingProgram.html.twig' %}
{% else %}
Momentan sind für dieses Programm keine Termine verfügbar.
{% endif %}
</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>

View file

@ -71,6 +71,6 @@ services:
- { name: doctrine.event_listener, event: preRemove }
app.lodging_calendar_util:
class: AppBundle\Util\LodgingCalendarUtil
class: AppBundle\Service\LodgingCalendarService
arguments:
- '@doctrine.orm.entity_manager'

View file

@ -168,7 +168,7 @@ class AdminController extends Controller
$calendar = $calendarUtil->getCalendar();
if (count($lodging->getPrices()->toArray()) != 0)
{
$calendar = $calendarUtil->markCalendarDaysWithReservations($lodging, $calendar);
$calendar = $calendarUtil->getCalendarWithReservations($lodging);
$calendar = $calendarUtil->mergeWithPaddedCalendar($calendar, $paddedCalendar);
} else {
$calendar = $paddedCalendar;
@ -238,7 +238,7 @@ class AdminController extends Controller
$calendar = $calendarUtil->getCalendar();
if (count($lodging->getPrices()->toArray()) != 0)
{
$calendar = $calendarUtil->markCalendarDaysWithReservations($lodging, $calendar);
$calendar = $calendarUtil->getCalendarWithReservations($lodging);
$calendar = $calendarUtil->mergeWithPaddedCalendar($calendar, $paddedCalendar);
} else {
$calendar = $paddedCalendar;

View file

@ -134,7 +134,7 @@ class CmsController extends Controller
$calendar = $calendarUtil->getCalendar();
if (count($lodging->getPrices()->toArray()) != 0)
{
$calendar = $calendarUtil->markCalendarDaysWithReservations($lodging, $calendar);
$calendar = $calendarUtil->getCalendarWithReservations($lodging);
$calendar = $calendarUtil->mergeWithPaddedCalendar($calendar, $paddedCalendar);
} else {
$calendar = $paddedCalendar;

View file

@ -508,40 +508,39 @@
color:#ffffff !important;
}
.calendarEven{
float: left;
width: 50%;
.table > tbody > tr > .calendar-day-disabled {
background-color: darkgrey;
}
.table > tbody > tr > .admin-calendar-day-reservation {
background-color: @background-red;
}
.table > tbody > tr > .admin-calendar-day-free {
background-color: @background-green;
}
.calendarOdd{
float: left;
width: 50%;
.calendar-day-dual-state(@color-a, @color-b) {
background-color: @color-b;
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 {
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));
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));
.table > tbody > tr > .calendar-day-reservation-begin {
.calendar-day-dual-state(#f2f2f2, darkgrey);
}
.calendarGradientTravelEnd {
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));
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));
.table > tbody > tr > .calendar-day-reservation-end {
.calendar-day-dual-state(darkgrey, #f2f2f2);
}
.calendarGradientAdminEnd {
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));
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-begin {
.calendar-day-dual-state(@background-green, @background-red);
}
.table > tbody > tr > .admin-calendar-day-reservation-end {
.calendar-day-dual-state(@background-red, @background-green);
}

View file

@ -33,4 +33,7 @@
@font-size-def-h5: @font-size-alternative-base;
@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;

View file

@ -1057,37 +1057,74 @@ a[id^="video_"]:before,
.widget .sidebar-price .btn {
color: #ffffff !important;
}
.calendarEven {
float: left;
width: 50%;
.table > tbody > tr > .calendar-day-disabled {
background-color: darkgrey;
}
.calendarOdd {
float: left;
width: 50%;
.table > tbody > tr > .admin-calendar-day-reservation {
background-color: #d9534f;
}
.calendarGradientTravelBegin {
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: -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));
.table > tbody > tr > .admin-calendar-day-free {
background-color: #648859;
}
.calendarGradientTravelEnd {
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: -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: -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));
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));
.table > tbody > tr > .calendar-day-reservation-begin {
background-color: #a9a9a9;
background: -moz-linear-gradient(to bottom right, #f2f2f2 0%, #f2f2f2 49%, #a9a9a9 50%, #a9a9a9 100%);
/* ff3.6+ */
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 {
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: -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: -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));
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));
.table > tbody > tr > .calendar-day-reservation-end {
background-color: #f2f2f2;
background: -moz-linear-gradient(to bottom right, #a9a9a9 0%, #a9a9a9 49%, #f2f2f2 50%, #f2f2f2 100%);
/* ff3.6+ */
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 {
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: -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: -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));
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));
.table > tbody > tr > .admin-calendar-day-reservation-begin {
background-color: #d9534f;
background: -moz-linear-gradient(to bottom right, #648859 0%, #648859 49%, #d9534f 50%, #d9534f 100%);
/* ff3.6+ */
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

View file

@ -1,6 +1,6 @@
<?php
namespace AppBundle\Util;
namespace AppBundle\Service;
use AppBundle\Entity\FewoLodging;
use AppBundle\Entity\FewoPrice;
@ -10,7 +10,7 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\EntityManager;
use AppBundle\Util\CalendarDayState;
class LodgingCalendarUtil
class LodgingCalendarService
{
private $em;
@ -159,6 +159,9 @@ class LodgingCalendarUtil
$day->setIsReserved(false);
$day->setIsReservationBegin(false);
$day->setIsReservationEnd(false);
$datetime = new \DateTime();
$datetime->setTimestamp(mktime(0,0,0, $actualMonth, $d, $actualCurrentYear));
$day->setDate($datetime);
$data[] = $day;
}
@ -299,7 +302,7 @@ class LodgingCalendarUtil
$data[$i]->setIsReserved(false);
$data[$i]->setPrice($price);
$data[$i]->setIsInSeason(true);
$data[$i]->setIsBookable(true);
$data[$i]->setIsBookable(false);
}
}
$calendar[$startCalendarIndex]['data'] = $data;
@ -341,7 +344,7 @@ class LodgingCalendarUtil
$data[$i]->setIsReserved(false);
$data[$i]->setPrice($price);
$data[$i]->setIsInSeason(true);
$data[$i]->setIsBookable(true);
$data[$i]->setIsBookable(false);
}
}
$calendar[$startCalendarIndex]['data'] = $data;
@ -366,7 +369,7 @@ class LodgingCalendarUtil
$data[$i]->setIsReservationEnd(true);
$data[$i]->setReservation($reservation);
$data[$i]->setIsInSeason(true);
$data[$i]->setIsBookable(false); // todo, hier evtl direkt true
$data[$i]->setIsBookable(false);
//$data[$i]->setIsBookable(true);
}
else
@ -382,7 +385,7 @@ class LodgingCalendarUtil
$data[$i]->setIsReserved(false);
$data[$i]->setPrice($price);
$data[$i]->setIsInSeason(true);
$data[$i]->setIsBookable(true);
$data[$i]->setIsBookable(false);
}
}
$calendar[$endCalendarIndex]['data'] = $data;
@ -412,7 +415,7 @@ class LodgingCalendarUtil
$data[$j]->setIsReserved(false);
$data[$j]->setPrice($price);
$data[$j]->setIsInSeason(true);
$data[$j]->setIsBookable(true);
$data[$j]->setIsBookable(false);
}
}
$calendar[$i]['data'] = $data;
@ -435,10 +438,6 @@ class LodgingCalendarUtil
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 ($extensionCalendarData[$j]->getIsInSeason())
@ -489,13 +488,13 @@ class LodgingCalendarUtil
// erste runde $pricesCalendar merge mit $reservationsCalendar
$price = $calendarData[$j]->getPrice();
$isInSeason = $calendarData[$j]->getIsInSeason();
$reservation = $calendarData[$j]->getReservation();
$calendarData[$j] = $extensionCalendarData[$j];
if ($calendarData[$j]->getIsReservationEnd() && $extensionCalendarData[$j]->getIsReservationBegin())
{
$calendarData[$j]->setReservation($reservation);
$calendarData[$j]->setIsReservationBegin(false);
$calendarData[$j]->setIsReservationEnd(false);
}
@ -581,88 +580,50 @@ class LodgingCalendarUtil
/**
* @param FewoLodging $lodging
* @param $calendar
* @return array|null
* @return array|null calendars
*/
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 = [];
$actuallyReservableDays = [];
$lastReservablePriceId = 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];
/** @var CalendarDayState[] $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];
if ($currDay->getIsBookable() || $currDay->getIsReserved())
if ($currDay->getPrice() !== $lastReservablePrice && !$currDay->getIsInSeason())
{
if ($currDay->getIsBookable())
{
$price = $currDay->getPrice();
$priceId = $price->getId();
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;
}
$actuallyReservableDays = $this->processPotentiallyReservableDays($potentiallyReservableDays,
$lastReservablePrice->getSeason()->getMinimumStay());
$this->processRest($actuallyReservableDays, $lastReservablePrice, $calendar);
$potentiallyReservableDays = [];
}
else
if ($currDay->getIsInSeason() && (!$currDay->getIsReserved() || $currDay->getIsReservationBegin() ||
$currDay->getIsReservationEnd()))
{
if($lastReservablePriceId == $priceId && $lastReservablePriceId != 0)
{
$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;
}
$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))
{
$data[$currDayIndex]->setIsInSeason(true);
$data[$currDayIndex]->setIsReserved(false); // todo ?
//$data[$currDayIndex]->setIsInSeason(true);
//$data[$currDayIndex]->setIsReserved(false); // todo ?
$data[$currDayIndex]->setIsBookable(true);
$data[$currDayIndex]->setIsReservationBegin(false);
$data[$currDayIndex]->setIsReservationEnd(false); // todo ?
$data[$currDayIndex]->setPrice($price);
//$data[$currDayIndex]->setIsReservationBegin(false);
//$data[$currDayIndex]->setIsReservationEnd(false); // todo ?
//$data[$currDayIndex]->setPrice($price);
$currMonth['marked'] = 1;
}
@ -761,28 +722,23 @@ class LodgingCalendarUtil
* @param $calendar
* @return mixed
*/
public function markCalendarDaysWithReservations(FewoLodging $lodging, $calendar)
public function getCalendarWithReservations(FewoLodging $lodging)
{
$today = new \DateTime();
$pricesCalendar = $calendar;
$reservationsCalendar = $calendar;
$pricesCalendar = $this->getCalendar();
$reservationsCalendar = $this->getCalendar();
$reservations = $lodging->getReservations();
$prices = $lodging->getPrices();
$lodgingId = $lodging->getId();
foreach($prices as $price)
foreach ($prices as $price)
{
/** @var FewoSeason $season */
$season = $price->getSeason();
$fromDate = $season->getFromDate();
$toDate = $season->getToDate();
if(!($toDate < $today))
{
$pricesCalendar = $this->markCalendarDays($pricesCalendar, $fromDate, $toDate, false, $price, null); //TODO fast fertig
}
$pricesCalendar = $this->markCalendarDays($pricesCalendar, $season->getFromDate(), $season->getToDate(),
false, $price);
}
foreach($reservations as $reservation)
@ -797,9 +753,10 @@ class LodgingCalendarUtil
$mergedPricesAndReservationsCalendar = $this->mergeCalendars($pricesCalendar, $reservationsCalendar, false);
$actuallyReservableDaysCalendar = $this->filterReservableDays($lodging, $mergedPricesAndReservationsCalendar);
$resultCalendar = $this->mergeCalendars($actuallyReservableDaysCalendar, $reservationsCalendar, true);
//$resultCalendar = $this->mergeCalendars($actuallyReservableDaysCalendar, $reservationsCalendar, true);
return $resultCalendar;
return $actuallyReservableDaysCalendar;
//return $resultCalendar;
}

View file

@ -17,12 +17,12 @@ class CalendarDayState
private $day;
/**
* @var FewoPrice
* @var FewoPrice|null
*/
private $price; // der preis / die saison
/**
* @var FewoReservation
* @var FewoReservation|null
*/
private $reservation; // die reservierung //todo wenns vorteile bringt, ne zweite speichern
@ -49,7 +49,12 @@ class CalendarDayState
/**
* @var bool
*/
private $isReservationEnd; // ist es das ende einer reservierung?
private $isReservationEnd;
/**
* @var \DateTime|null
*/
private $date = null;
/**
* @return int
@ -68,33 +73,33 @@ class CalendarDayState
}
/**
* @return FewoPrice
* @return FewoPrice|null
*/
public function getPrice(): FewoPrice
public function getPrice()
{
return $this->price;
}
/**
* @param FewoPrice $price
* @param FewoPrice|null $price
*/
public function setPrice(FewoPrice $price)
public function setPrice($price)
{
$this->price = $price;
}
/**
* @return FewoReservation
* @return FewoReservation|null
*/
public function getReservation(): FewoReservation
public function getReservation()
{
return $this->reservation;
}
/**
* @param FewoReservation $reservation
* @param FewoReservation|null $reservation
*/
public function setReservation(FewoReservation $reservation)
public function setReservation($reservation)
{
$this->reservation = $reservation;
}
@ -179,6 +184,20 @@ class CalendarDayState
$this->isReservationEnd = $isReservationEnd;
}
/**
* @return \DateTime|null
*/
public function getDate()
{
return $this->date;
}
/**
* @param \DateTime|null $date
*/
public function setDate($date)
{
$this->date = $date;
}
}