Komfort brechnung mit Kind Kalender im Admin formatieren

git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3454 f459cee4-fb09-11de-96c3-f9c5f16c3c76
This commit is contained in:
adametz 2018-08-27 12:51:36 +00:00
parent 0325e97509
commit 4ee51802ab
6 changed files with 210 additions and 63 deletions

View file

@ -89,6 +89,7 @@
<style>
.table > tbody > tr > td.normal {
background-color: #deebde;
padding: 6px;

View file

@ -86,11 +86,18 @@
<script type="text/javascript">
var checkDates = function(date) {
var formatted = date.format('DD.MM.YYYY');
var reservationDays = "{{ reservationDays }}";
checkDates = function(date) {
formatted = date.format('DD.MM.YYYY');
reservationDays = {{ reservationDays|json_encode|raw }}
return reservationDays.indexOf(formatted) > -1;
}
};
checkCustom = function(date) {
customDays = {{ classByDays|json_encode|raw }};
formatted = date.format('DD.MM.YYYY');
if(customDays[formatted] != undefined){
return customDays[formatted];
}
};
$(document).ready(function() {
@ -103,6 +110,7 @@
$('#appbundle_feworeservation_fromDate, #appbundle_feworeservation_toDate').daterangepicker({
isInvalidDate: checkDates,
isCustomDate: checkCustom,
"minDate": moment(),
"maxDate": maxDate,
"timePickerSeconds": true,
@ -131,7 +139,7 @@
"Februar",
"März",
"April",
"Kann",
"Mai",
"Juni",
"Juli",
"August",
@ -147,6 +155,7 @@
"startDate": startDate,
"endDate": endDate,
}, function(start, end, label) {
console.log(start);
// 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
@ -170,6 +179,11 @@
checkInPicker.setEndDate(selectedEndDate);
});
$('#appbundle_feworeservation_fromDate, #appbundle_feworeservation_toDate').on('show.daterangepicker', function(ev, picker) {
console.log(picker.startDate.format('YYYY-MM-DD'));
console.log(picker.endDate.format('YYYY-MM-DD'));
});
});
</script>

View file

@ -81,11 +81,18 @@
<script type="text/javascript">
var checkDates = function(date) {
var formatted = date.format('DD.MM.YYYY');
var reservationDays = "{{ reservationDays }}";
checkDates = function(date) {
formatted = date.format('DD.MM.YYYY');
reservationDays = {{ reservationDays|json_encode|raw }}
return reservationDays.indexOf(formatted) > -1;
}
};
checkCustom = function(date) {
customDays = {{ classByDays|json_encode|raw }};
formatted = date.format('DD.MM.YYYY');
if(customDays[formatted] != undefined){
return customDays[formatted];
}
};
$(document).ready(function() {
@ -98,6 +105,7 @@
$('#appbundle_feworeservation_fromDate, #appbundle_feworeservation_toDate').daterangepicker({
isInvalidDate: checkDates,
isCustomDate: checkCustom,
"minDate": moment(),
"maxDate": maxDate,
"timePickerSeconds": true,
@ -126,7 +134,7 @@
"Februar",
"März",
"April",
"Kann",
"Mai",
"Juni",
"Juli",
"August",
@ -142,6 +150,7 @@
"startDate": startDate,
"endDate": endDate,
}, function(start, end, label) {
console.log(start);
// 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
@ -165,6 +174,11 @@
checkInPicker.setEndDate(selectedEndDate);
});
$('#appbundle_feworeservation_fromDate, #appbundle_feworeservation_toDate').on('show.daterangepicker', function(ev, picker) {
console.log(picker.startDate.format('YYYY-MM-DD'));
console.log(picker.endDate.format('YYYY-MM-DD'));
});
});
</script>
{% endblock body %}

View file

@ -626,6 +626,7 @@ class AdminController extends Controller
public function reservationDays(FewoLodging $lodging, $endDate)
{
$reservations = $lodging->getReservationsFilter(new \DateTime(), $endDate);
$days = array();
foreach($reservations as $reservation) {
@ -647,6 +648,34 @@ class AdminController extends Controller
}
public function classByDays(FewoLodging $lodging, $endDate)
{
$calendarService = $this->container->get('app.lodging_calendar_util');
$paddedCalendar = $calendarService->getCalendarWithPadding($calendarService->getMinCalendarEntriesByLodging($lodging));
if (count($lodging->getPrices()->toArray()) != 0)
{
$calendar = $calendarService->calendarAndFillDayStates($paddedCalendar, $lodging);
} else {
$calendar = $paddedCalendar;
}
$ret = array();
foreach ($calendar as $month => $calendar_month) {
foreach ($calendar_month['data'] as $key => $day) {
if($day && $day->getDate()){
$toClass = "";
if($day->getIsBookable()) {
$toClass .= " bookable";
}
$ret[$day->getDate()->format("d.m.Y")] = $day->getCssClass().$toClass;
}
}
}
return $ret;
}
/**
* @Route("/admin/fewo/lodgings/{lodgingId}/reservations/new", requirements={"lodgingId": "\d+"})
*/
@ -657,7 +686,9 @@ class AdminController extends Controller
$lodging = $fewoLodgingRepo->find($lodgingId);
$reservation = null;
$lastSeason = $this->getSeasonLast($lodging);
$reservationDays = $this->reservationDays($lodging, $lastSeason->getToDate());
$classByDays = $this->classByDays($lodging, $lastSeason->getToDate());
if ($request->getMethod() != 'POST')
@ -697,7 +728,8 @@ class AdminController extends Controller
'form' => $form->createView(),
'lodging' => $lodging,
'lastSeason' => $lastSeason,
'reservationDays' => json_encode($reservationDays),
'reservationDays' => $reservationDays,
'classByDays' => $classByDays,
]);
@ -731,6 +763,8 @@ class AdminController extends Controller
$lastSeason = $this->getSeasonLast($lodging);
$reservationDays = $this->reservationDays($lodging, $lastSeason->getToDate());
$classByDays = $this->classByDays($lodging, $lastSeason->getToDate());
$toDate = "";
if($season){
@ -776,7 +810,8 @@ class AdminController extends Controller
'lodging' => $lodging,
'season' => $season,
'lastSeason' => $lastSeason,
'reservationDays' => json_encode($reservationDays),
'reservationDays' => $reservationDays,
'classByDays' => $classByDays,
]);
}
@ -798,6 +833,8 @@ class AdminController extends Controller
$toDate = $reservation->getToDate()->format('d.m.Y');
$lastSeason = $this->getSeasonLast($lodging);
$reservationDays = $this->reservationDays($lodging, $lastSeason->getToDate());
$classByDays = $this->classByDays($lodging, $lastSeason->getToDate());
$form = $this->createForm(FewoReservationType::class, $reservation, [
'lodging' => $lodging,
@ -825,7 +862,9 @@ class AdminController extends Controller
'lodging' => $lodging,
'reservationId' => $reservationId,
'lastSeason' => $lastSeason,
'reservationDays' => json_encode($reservationDays),
'reservationDays' => $reservationDays,
'classByDays' => $classByDays,
]);

View file

@ -376,20 +376,26 @@ class BookingController extends Controller
{
$insuranceAssessmentBasis += $room['price']->getEffectiveComfortPrice();
$insuranceAssessmentChildBasis += $room['price']->getEffectiveComfortPrice();
$a = $room['persons']['total'] * $room['price']->getEffectiveComfortPrice();
$ret += $a;
$adultCount = $room['persons']['adults'];
$childrenCount = $room['persons']['children'];
$a = $adultCount * $room['price']->getEffectiveComfortPrice();;
$b = $childrenCount * $room['price']->getEffectiveComfortPrice();
$ret += $a + $b;
if (isset($outHtmlSummary))
{
$key = intval($room['price']->getEffectiveComfortPrice());
if(!empty($tempComfortHTML[$key])) {
$tempComfortHTML[$key]['count'] = $tempComfortHTML[$key]['count'] + 1;
$tempComfortHTML[$key]['value'] = $tempComfortHTML[$key]['value'] + $a;
$tempComfortHTML[$key]['count'] = $tempComfortHTML[$key]['count'] + $adultCount + $childrenCount;
$tempComfortHTML[$key]['value'] = $tempComfortHTML[$key]['value'] + $a + $b;
}else{
$tempComfortHTML[$key] = array(
'value' => $a,
'value' => $a + $b,
'label_first' => 'Komfort-Kategorie',
'label_last' => Util::formatPrice($room['price']->getEffectiveComfortPrice()) . ' pro Person',
'count' => 1,
'count' => $adultCount + $childrenCount,
);
}
}
@ -613,24 +619,8 @@ class BookingController extends Controller
}
//Departure
if(count($tempDepartureHTML) > 0){
foreach ($tempDepartureHTML as $item) {
$outHtmlSummary[] =[
'value' => $item['value'],
'label' => '<strong>'.$item['count'].'</strong> x '.$item['label_first'].'<strong> ['.$item['label_last'].' ]</strong>',
];
}
}
//Comfort
if(count($tempComfortHTML) > 0){
foreach ($tempComfortHTML as $item) {
$outHtmlSummary[] =[
'value' => $item['value'],
'label' => '<strong>'.$item['count'].'</strong> x '.$item['label_first'].'<strong> ['.$item['label_last'].' ]</strong>',
];
}
}
//ROOMS
if(count($tempRoomHTML) > 0){
foreach ($tempRoomHTML as $item) {
@ -645,6 +635,27 @@ class BookingController extends Controller
];
}
}
//Comfort
if(count($tempComfortHTML) > 0){
foreach ($tempComfortHTML as $item) {
$outHtmlSummary[] =[
'value' => $item['value'],
'label' => '<strong>'.$item['count'].'</strong> x '.$item['label_first'].'<strong> ['.$item['label_last'].' ]</strong>',
];
}
}
//Departure
if(count($tempDepartureHTML) > 0){
foreach ($tempDepartureHTML as $item) {
$outHtmlSummary[] =[
'value' => $item['value'],
'label' => '<strong>'.$item['count'].'</strong> x '.$item['label_first'].'<strong> ['.$item['label_last'].' ]</strong>',
];
}
}
//DISCOUNT
if(count($tempDiscountHTML) > 0){
foreach ($tempDiscountHTML as $item) {

View file

@ -154,7 +154,7 @@
line-height: 24px;
font-size: 14px;
border-radius: 4px;
border: 1px solid transparent;
border: 0 solid #fff;
white-space: nowrap;
cursor: pointer;
}
@ -182,18 +182,106 @@
color: #ccc;
}
.daterangepicker td.off, .daterangepicker td.off.in-range, .daterangepicker td.off.start-date, .daterangepicker td.off.end-date {
background-color: #fff;
border-color: transparent;
color: #999;
.daterangepicker td.start-date.end-date {
border-radius: 0px;
}
.daterangepicker th.month {
width: auto;
}
.daterangepicker td.available, .daterangepicker td.available:hover {
background-color: #f0faf0;
border-radius: 0;
cursor: not-allowed;
}
.daterangepicker td.bookable {
background-color: rgba(88, 155, 92, 0.4);
cursor: pointer !important;
border-radius: 0;
font-weight: bold;
text-decoration: underline;
}
.daterangepicker td.bookable:hover {
background-color: rgba(88, 155, 92, 0.50);
}
.daterangepicker td.calendar-day-reservation-begin {
background-color: #f0bcbc;
background: -moz-linear-gradient(to bottom right, #f0faf0 0%, #f0faf0 49%, #f0bcbc 50%, #f0bcbc 100%);
background: -webkit-gradient(linear, left top, right bottom, color-stop(0%, #f0faf0), color-stop(49%, #f0faf0), color-stop(50%, #f0bcbc), color-stop(100%, #f0bcbc));
background: -webkit-linear-gradient(to bottom right, #f0faf0 0%, #f0faf0 49%, #f0bcbc 50%, #f0bcbc 100%);
background: -o-linear-gradient(to bottom right, #f0faf0 0%, #f0faf0 49%, #f0bcbc 50%, #f0bcbc 100%);
background: -ms-linear-gradient(to bottom right, #f0faf0 0%, #f0faf0 49%, #f0bcbc 50%, #f0bcbc 100%);
background: linear-gradient(to bottom right, #f0faf0 0%, #f0faf0 49%, #f0bcbc 50%, #f0bcbc 100%);
border-radius: 0;
}
.daterangepicker td.calendar-day-reservation-end {
background-color: #f2f2f2;
background: -moz-linear-gradient(to bottom right, #f0bcbc 0%, #f0bcbc 49%, #deebde 50%, #deebde 100%);
background: -webkit-gradient(linear, left top, right bottom, color-stop(0%, #f0bcbc), color-stop(49%, #f0bcbc), color-stop(50%, #deebde), color-stop(100%, #deebde));
background: -webkit-linear-gradient(to bottom right, #f0bcbc 0%, #f0bcbc 49%, #deebde 50%, #deebde 100%);
background: -o-linear-gradient(to bottom right, #f0bcbc 0%, #f0bcbc 49%, #deebde 50%, #deebde 100%);
background: -ms-linear-gradient(to bottom right, #f0bcbc 0%, #f0bcbc 49%, #deebde 50%, #deebde 100%);
background: linear-gradient(to bottom right, #f0bcbc 0%, #f0bcbc 49%, #deebde 50%, #deebde 100%);
border-radius: 0;
}
.daterangepicker td.calendar-day-disabled-half-booked {
background-color: #f2f2f2;
background: -moz-linear-gradient(to bottom right, #f0bcbc 0%, #f0bcbc 49%, #bcd7be 50%, #bcd7be 100%);
background: -webkit-gradient(linear, left top, right bottom, color-stop(0%, #f0bcbc), color-stop(49%, #f0bcbc), color-stop(50%, #bcd7be), color-stop(100%, #bcd7be));
background: -webkit-linear-gradient(to bottom right, #f0bcbc 0%, #f0bcbc 49%, #bcd7be 50%, #bcd7be 100%);
background: -o-linear-gradient(to bottom right, #f0bcbc 0%, #f0bcbc 49%, #bcd7be 50%, #bcd7be 100%);
background: -ms-linear-gradient(to bottom right, #f0bcbc 0%, #f0bcbc 49%, #bcd7be 50%, #bcd7be 100%);
background: linear-gradient(to bottom right, #f0bcbc 0%, #f0bcbc 49%, #bcd7be 50%, #bcd7be 100%);
border-radius: 0;
}
.daterangepicker td.off, .daterangepicker td.off:hover {
background: none !important;
background-color: #fff !important;
color: #fff !important;
cursor: not-allowed;
}
.daterangepicker td.disabled, .daterangepicker option.disabled {
cursor: not-allowed;
text-decoration: none;
background-color: #f0bcbc !important;
border-radius: 0px;
}
.daterangepicker td.in-range {
background-color: #deebde;
background-color: rgba(88, 155, 92, 0.70) !important;
border-color: transparent;
color: #000;
border-radius: 0;
}
.daterangepicker td.active, .daterangepicker td.active:hover {
background: none !important;
background-color: rgba(88, 155, 92, 1) !important;
color: #fff !important;
}
.daterangepicker td.start-date {
border-radius: 4px 0 0 4px;
@ -203,28 +291,8 @@
border-radius: 0 4px 4px 0;
}
.daterangepicker td.start-date.end-date {
border-radius: 4px;
}
.daterangepicker td.active, .daterangepicker td.active:hover {
background-color: #648859;
border-color: transparent;
color: #fff;
}
.daterangepicker th.month {
width: auto;
}
.daterangepicker td.disabled, .daterangepicker option.disabled {
color: #999;
cursor: not-allowed;
text-decoration: line-through;
background-color: #f0bcbc;
border-radius: 0px;
}
.daterangepicker select.monthselect, .daterangepicker select.yearselect {
font-size: 12px;