Hotel/hotel/rooms/templates/index.html

111 lines
4.5 KiB
HTML
Raw Normal View History

2019-01-13 15:17:14 +01:00
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
2019-01-13 15:17:14 +01:00
<link rel="stylesheet" type="text/css" href="{% static 'style.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'jquery-ui.css' %}">
<meta charset="UTF-8">
2019-01-13 15:17:14 +01:00
<title>Hotel INO Scrum</title>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
2019-01-20 11:51:10 +01:00
<script>
function changeBackground(imageUrl) {
if(imageUrl != null) {
document.body.style.background = "url(" + imageUrl + ") no-repeat center center fixed";
document.body.style.backgroundSize = "cover";
localStorage.backgroundImage = imageUrl;
}
2019-01-20 11:51:10 +01:00
}
$( function() {
$( ".datepicker" ).datepicker({ dateFormat: 'dd-mm-yy' }).val();
$( ".dateform" ).submit(function(event){
2019-01-30 20:58:03 +01:00
var begindate = $(this).find('input[name=begindate]').val().split("-");
var enddate = $(this).find('input[name=enddate]').val().split("-");
2019-01-30 20:58:03 +01:00
var today = new Date();
begindate = new Date(begindate[2], begindate[1] - 1, begindate[0]);
enddate = new Date(enddate[2], enddate[1] - 1, enddate[0]);
if (begindate.getTime() < today.getTime()){
alert('Data początkowa jest z przeszłości');
return false;
}
2019-01-30 20:58:03 +01:00
if (enddate.getTime() < today.getTime()){
alert('Data końcowa jest z przeszłości');
return false;
}
2019-01-30 20:58:03 +01:00
if (begindate.getTime() > enddate.getTime()){
alert('Data końcowa jest przed początkową');
return false;
}
});
} );
2019-01-20 11:51:10 +01:00
</script>
</head>
<body onLoad="changeBackground(imageUrl = localStorage.backgroundImage)">
2019-01-13 17:37:21 +01:00
<h1>Hotel INO Scrum</h1>
<center><h3>Lista pokoi dostępnych w naszym hotelu</h3></center>
2019-01-22 22:20:06 +01:00
<center><h3>{{ error }}</h3></center>
2019-01-13 15:17:14 +01:00
<table id="hotels">
2019-01-20 11:51:10 +01:00
<col style="width:10%">
<col style="width:30%">
2019-01-22 20:34:02 +01:00
<col style="width:15%">
<col style="width:45%">
<th>Numer pokoju</th>
<th>Typ pokoju</th>
<th>Cena</th>
2019-01-13 15:17:14 +01:00
<th>Rezerwacja</th>
{% for room in rooms %}
<tr>
<td>{{ room.room_number }}</td>
<td>{{ room.room_type }}</td>
<td>{{ room.price }} zł</td>
<td>
<form action="{% url 'reservation' %}" class="dateform" method="POST">
2019-01-13 20:27:23 +01:00
{% csrf_token %}
<input type="hidden" name="room" value="{{ room.room_number }}">
<div class="button-box" >
Od: <input type="text" class="datepicker" name="begindate" size="3" required>
Do: <input type="text" class="datepicker" name="enddate" size="3" required>
2019-01-22 20:34:02 +01:00
<button>Rezerwuj</button>
2019-01-13 20:27:23 +01:00
</div>
</form>
</td>
</tr>
{% endfor %}
</table>
2019-01-27 13:01:04 +01:00
<br>
2019-01-20 11:51:10 +01:00
<center>
{% if firstpage == False %}
2019-01-27 13:01:04 +01:00
<a href="{% url 'indexpage' currentpage|add:'-1' %}"><button id="page"><<</button></a>
{% endif %}
{% for p in pages %}
2019-01-27 13:01:04 +01:00
<a href="{% url 'indexpage' p %}"><div id="page">{{ p }}</div></a>
{% endfor %}
{% if lastpage == False %}
2019-01-27 13:01:04 +01:00
<a href="{% url 'indexpage' currentpage|add:'+1' %}"><button id="page">>></button></a>
{% endif %}
2019-01-27 13:01:04 +01:00
<br>
2019-01-20 11:51:10 +01:00
<table id="images">
<th><input type="image" src="static/images/background1.jpg" height="150px" width="250px" onClick="changeBackground(imageUrl='static/images/background1.jpg')"/></th>
<th><input type="image" src="static/images/background2.jpg" height="150px" width="250px" onClick="changeBackground(imageUrl='static/images/background2.jpg')"/></th>
<th><input type="image" src="static/images/background3.jpg" height="150px" width="250px" onClick="changeBackground(imageUrl='static/images/background3.jpg')"/></th>
<th><input type="image" src="static/images/background4.jpg" height="150px" width="250px" onClick="changeBackground(imageUrl='static/images/background4.jpg')"/></th>
<th><input type="image" src="static/images/background5.jpg" height="150px" width="250px" onClick="changeBackground(imageUrl='static/images/background5.jpg')"/></th>
</table>
</center>
</body>
2019-01-13 15:17:14 +01:00
</html>