This commit is contained in:
Lamprecht 2018-06-09 07:00:48 +02:00
parent 980d5ee61b
commit d7247c3fb9
2 changed files with 27 additions and 4 deletions

View File

@ -1,5 +1,7 @@
from django.shortcuts import render from django.shortcuts import render
from roomservice.models import Room from roomservice.models import Room
from django.utils import simplejson
import logging import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -12,10 +14,8 @@ def search(request):
def booking(request): def booking(request):
room_id = request.POST["room"] room_id = request.POST["room"]
room = Room.objects.get(id=room_id) dataFromAPI =
logger.info(room_id) return render(request, 'booking.jinja', {"title": "rooF(i)S is love rooF(i)S is live!!","data":dataFromAPI})
logger.info(room)
return render(request, 'booking.jinja', {"title": "rooF(i)S is love rooF(i)S is live!!","room":room})
def admin(request): def admin(request):

View File

@ -0,0 +1,23 @@
$.document.ready(function () {
updateColors();
});
function updateColors(listOfBookings) {
let list = [];
listOfBookings.forEach(booking =>{
list.add(getDayOfWeek(booking.startDate)+)
});
list.forEach(id => {
$("#"+id).addClass("booked");
});
}
// Accepts a Date object or date string that is recognized by the Date.parse() method
function getDayOfWeek(date) {
var dayOfWeek = new Date(date).getDay();
return isNaN(dayOfWeek) ? null : ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'][dayOfWeek];
}