Admin Booking
git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3443 f459cee4-fb09-11de-96c3-f9c5f16c3c76
This commit is contained in:
parent
e4f09da134
commit
73ed632267
4 changed files with 87 additions and 27 deletions
|
|
@ -214,6 +214,53 @@
|
||||||
|
|
||||||
<h1>Verfügbarkeit</h1>
|
<h1>Verfügbarkeit</h1>
|
||||||
|
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.table > tbody > tr > td.calendar-day-non {
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
.table > tbody > tr > td.calendar-day-past {
|
||||||
|
background-color: rgba(242, 242, 242, 0.5);
|
||||||
|
}
|
||||||
|
.table > tbody > tr > td.calendar-light {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
.table > tbody > tr > td.calendar-day-disabled-half {
|
||||||
|
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#f0bcbc+49,f2f2f2+50,f0bcbc+51 */
|
||||||
|
background: #f0bcbc; /* Old browsers */
|
||||||
|
background: -moz-linear-gradient(-35deg, #f0bcbc 49%, #f2f2f2 50%, #f0bcbc 51%); /* FF3.6-15 */
|
||||||
|
background: -webkit-linear-gradient(-35deg, #f0bcbc 49%,#f2f2f2 50%,#f0bcbc 51%); /* Chrome10-25,Safari5.1-6 */
|
||||||
|
background: linear-gradient(145deg, #f0bcbc 49%,#f2f2f2 50%,#f0bcbc 51%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
|
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f0bcbc', endColorstr='#f0bcbc',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
|
||||||
|
}
|
||||||
|
.table > tbody > tr > td.active {
|
||||||
|
background-color: rgba(88, 155, 92, 0.35);
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.table > tbody > tr > td.active:hover {
|
||||||
|
background-color: #648859;
|
||||||
|
}
|
||||||
|
.table > tbody > tr > td a.link {
|
||||||
|
color: #5a5a5a;
|
||||||
|
font-weight: 700;
|
||||||
|
width: 100%;
|
||||||
|
display: block;
|
||||||
|
height: 100%;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table > tbody > tr > td:hover a.link {
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 700;
|
||||||
|
width: 100%;
|
||||||
|
display: block;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
{% include 'default/admin/lodgingsEditCalendar.html.twig' %}
|
{% include 'default/admin/lodgingsEditCalendar.html.twig' %}
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
|
||||||
|
|
@ -26,41 +26,29 @@
|
||||||
{% set is_past_date = dayState.date is not empty and date(dayState.date) < date('now') %}
|
{% set is_past_date = dayState.date is not empty and date(dayState.date) < date('now') %}
|
||||||
|
|
||||||
{# Set cell class #}
|
{# 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 %}
|
|
||||||
{% set cell_class = '' %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
<td class="{{ dayState.getCssClass }} {% if dayState.isBookable %}active{% endif %}">
|
||||||
<td class="{{ cell_class }}">
|
{% if dayState.isReserved or dayState.isReservationBegin %}
|
||||||
{% if dayState.isReserved and not dayState.isReservationEnd %}
|
|
||||||
|
|
||||||
{% if dayState.reservation.id is defined %}
|
{% if dayState.reservation.id is defined %}
|
||||||
<a href="/admin/fewo/lodgings/{{ lodging.id }}/reservations/{{ dayState.reservation.id }}">
|
<a class="link" href="/admin/fewo/lodgings/{{ lodging.id }}/reservations/{{ dayState.reservation.id }}">
|
||||||
{{ dayState.day }}
|
{{ dayState.day }}
|
||||||
</a>
|
</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
ID
|
ID
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
{% elseif dayState.isBookable and not is_past_date %}
|
{% elseif dayState.isBookable and not is_past_date %}
|
||||||
<a href="/admin/fewo/lodgings/{{ lodging.id }}/reservations/new/{{ dayState.day < 10 ? '0':'' }}{{dayState.day}}{{ calendar_month['monthNumber'] < 10 ? '0':'' }}{{calendar_month['monthNumber']}}{{calendar_month['year']}}">
|
<a class="link" href="/admin/fewo/lodgings/{{ lodging.id }}/reservations/new/{{ dayState.day < 10 ? '0':'' }}{{dayState.day}}{{ calendar_month['monthNumber'] < 10 ? '0':'' }}{{calendar_month['monthNumber']}}{{calendar_month['year']}}">
|
||||||
{{ dayState.day }}
|
{{ dayState.day }}
|
||||||
</a>
|
</a>
|
||||||
{% elseif dayState.day == 0 %}
|
{% elseif dayState.day == 0 %}
|
||||||
-
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<del>{{ dayState.day }}</del>
|
{% if dayState.isPastDate %}
|
||||||
|
<del style="color:#989898;">{{ dayState.day }}</del>
|
||||||
|
{% else %}
|
||||||
|
{{ dayState.day }}
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
@ -69,4 +57,5 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -250,11 +250,15 @@ class AdminController extends Controller
|
||||||
$reservations = $calendarService->getReservations($lodging);
|
$reservations = $calendarService->getReservations($lodging);
|
||||||
|
|
||||||
$paddedCalendar = $calendarService->getCalendarWithPadding($calendarService->getMinCalendarEntriesByLodging($lodging));
|
$paddedCalendar = $calendarService->getCalendarWithPadding($calendarService->getMinCalendarEntriesByLodging($lodging));
|
||||||
$calendar = $calendarService->getCalendar($lodging);
|
// $calendar = $calendarService->getCalendar($lodging);
|
||||||
if (count($lodging->getPrices()->toArray()) != 0)
|
if (count($lodging->getPrices()->toArray()) != 0)
|
||||||
{
|
{
|
||||||
|
$calendar = $calendarService->calendarAndFillDayStates($paddedCalendar, $lodging);
|
||||||
|
|
||||||
|
/*
|
||||||
$calendar = $calendarService->createCalendarAndFillDayStates($lodging);
|
$calendar = $calendarService->createCalendarAndFillDayStates($lodging);
|
||||||
$calendar = $calendarService->mergeWithPaddedCalendar($calendar, $paddedCalendar);
|
$calendar = $calendarService->mergeWithPaddedCalendar($calendar, $paddedCalendar);
|
||||||
|
*/
|
||||||
} else {
|
} else {
|
||||||
$calendar = $paddedCalendar;
|
$calendar = $paddedCalendar;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -525,7 +525,23 @@ class LodgingCalendarService
|
||||||
|
|
||||||
public function mergeWithPaddedCalendar($calendar, $paddedCalendar)
|
public function mergeWithPaddedCalendar($calendar, $paddedCalendar)
|
||||||
{
|
{
|
||||||
for($i = 0; $i < count($paddedCalendar); $i++)
|
$i = 0;
|
||||||
|
foreach ($paddedCalendar as $key => $data){
|
||||||
|
|
||||||
|
$calendarDataCurrMonth = $calendar[$i]['data'];
|
||||||
|
$paddedCalendarDataCurrMonth = $paddedCalendar[$key]['data'];
|
||||||
|
|
||||||
|
$startIndex = $this->findCalendarDayIndexInMonth(1, $paddedCalendarDataCurrMonth);
|
||||||
|
//$startIndex = array_search(1, $paddedCalendarDataCurrMonth);
|
||||||
|
|
||||||
|
for($j = 0; $j < count($calendarDataCurrMonth); $j++, $startIndex++)
|
||||||
|
{
|
||||||
|
$paddedCalendarDataCurrMonth[$startIndex] = $calendarDataCurrMonth[$j];
|
||||||
|
}
|
||||||
|
$paddedCalendar[$key]['data'] = $paddedCalendarDataCurrMonth;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
/*for($i = 0; $i < count($paddedCalendar); $i++)
|
||||||
{
|
{
|
||||||
$calendarDataCurrMonth = $calendar[$i]['data'];
|
$calendarDataCurrMonth = $calendar[$i]['data'];
|
||||||
$paddedCalendarDataCurrMonth = $paddedCalendar[$i]['data'];
|
$paddedCalendarDataCurrMonth = $paddedCalendar[$i]['data'];
|
||||||
|
|
@ -538,7 +554,7 @@ class LodgingCalendarService
|
||||||
$paddedCalendarDataCurrMonth[$startIndex] = $calendarDataCurrMonth[$j];
|
$paddedCalendarDataCurrMonth[$startIndex] = $calendarDataCurrMonth[$j];
|
||||||
}
|
}
|
||||||
$paddedCalendar[$i]['data'] = $paddedCalendarDataCurrMonth;
|
$paddedCalendar[$i]['data'] = $paddedCalendarDataCurrMonth;
|
||||||
}
|
}*/
|
||||||
return $paddedCalendar;
|
return $paddedCalendar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -691,6 +707,8 @@ class LodgingCalendarService
|
||||||
if(isset($paddedCalendar[$fromDate->format("Y-n")])){
|
if(isset($paddedCalendar[$fromDate->format("Y-n")])){
|
||||||
$key = $this->findCalendarDayKey($paddedCalendar[$fromDate->format("Y-n")], $fromDate->format("d"));
|
$key = $this->findCalendarDayKey($paddedCalendar[$fromDate->format("Y-n")], $fromDate->format("d"));
|
||||||
$paddedCalendar[$fromDate->format("Y-n")]['data'][$key]->setIsReservationBegin(true);
|
$paddedCalendar[$fromDate->format("Y-n")]['data'][$key]->setIsReservationBegin(true);
|
||||||
|
$paddedCalendar[$fromDate->format("Y-n")]['data'][$key]->setReservation($reservation);
|
||||||
|
|
||||||
}
|
}
|
||||||
//last
|
//last
|
||||||
if(isset($paddedCalendar[$toDate->format("Y-n")])) {
|
if(isset($paddedCalendar[$toDate->format("Y-n")])) {
|
||||||
|
|
@ -702,6 +720,8 @@ class LodgingCalendarService
|
||||||
if(isset($paddedCalendar[$dt->format("Y-n")])) {
|
if(isset($paddedCalendar[$dt->format("Y-n")])) {
|
||||||
$key = $this->findCalendarDayKey($paddedCalendar[$dt->format("Y-n")], $dt->format("d"));
|
$key = $this->findCalendarDayKey($paddedCalendar[$dt->format("Y-n")], $dt->format("d"));
|
||||||
$paddedCalendar[$dt->format("Y-n")]['data'][$key]->setIsReserved(true);
|
$paddedCalendar[$dt->format("Y-n")]['data'][$key]->setIsReserved(true);
|
||||||
|
$paddedCalendar[$dt->format("Y-n")]['data'][$key]->setReservation($reservation);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue