Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #4

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions hall.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="style.css">
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
<title>Grad Križevci</title>
</head>
<body>
<header>
<h1>Rezervacija dvorana</h1>
<nav>
<a href="index.html">Home</a>
<a href="hall.html">Dvorana</a>
<a href="#">O nama</a>
<a href="register.html">Registracija</a>
</nav>
</header>
<footer>
<h4>Grad Križevci</h4>
</footer>
</body>
</html>
40 changes: 20 additions & 20 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="style.css">
<title>Grad Križevci</title>
</head>
<body>
<header>
<h1>Rezervacija dvorana</h1>
<nav>
<a href="#">Home</a>
<a href="#">O nama</a>
<a href="register.html">Registracija</a>
</nav>
</header>

<img src="https://images.unsplash.com/photo-1497366754035-f200968a6e72?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80" alt="office">

<footer>
<h4>Grad Križevci</h4>
</footer>
</body>
<head>
<link rel="stylesheet" href="style.css">
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
<title>Grad Križevci</title>
</head>
<body class="hide-scroll">
<header>
<h1>Rezervacija dvorana</h1>
<nav>
<a href="index.html">Home</a>
<a href="hall.html">Dvorana</a>
<a href="#">O nama</a>
<a href="register.html">Registracija</a>
</nav>
</header>
<section></section>
<footer>
<h4>Grad Križevci</h4>
</footer>
</body>
</html>
85 changes: 85 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
let halls = [];
let hallId = 0;

function add(hallName) {
let hallObject = {
id: hallId,
name: hallName,
reservation: {
isReserved: false,
reservedFrom: null,
reservedUntil: null
}
}

halls.push(hallObject);
hallId++;
}

function remove(hallId) {
for (let i = 0; i < halls.length; i++) {
if (halls[i].id === hallId) {
halls.splice(i, 1);
}
}
}

function reservation(hallId, reservedFrom, reservedUntil) {
for (let i = 0; i < halls.length; i++) {
if (halls[i].id === hallId) {
halls[i].reservation.isReserved = true;
halls[i].reservation.reservedFrom = reservedFrom;
halls[i].reservation.reservedUntil = reservedUntil;
}
}
}

function checkReservation(hallId) {
let currentTimestamp = Date.now();

for (let i = 0; i < halls.length; i++) {
if (halls[i].id === hallId) {
if(halls[i].reservation.reservedUntil < currentTimestamp) {
halls[i].reservation.isReserved = false;
halls[i].reservation.reservedFrom = null;
halls[i].reservation.reservedUntil = null;
}
}
}

}


// empty halls array
console.log('Halls: ', halls);

add('Klub Kulture');
add('Hrvatski Dom');
add('Vladimir Nazor');
add('Galerija K1');
add('Ljudevit Modec');

// halls array after adding 5 objects
console.log('Halls: ', halls);


remove(3);

// halls array after removing object with id 3
console.log('Halls: ', halls);


remove(4);

// halls array after removing object with id 4
console.log('Halls: ', halls);


// reserve hall with id 2 from 04/01/2018 until 04/02/2018
reservation(2, 10142019, 10152019);
console.log('Halls: ', halls);


// check reservation for hall with id 2
checkReservation(2);
console.log('Halls: ', halls);
61 changes: 32 additions & 29 deletions register.html
Original file line number Diff line number Diff line change
@@ -1,44 +1,47 @@
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="style.css">
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Registracija</title>
</head>
<body>
<header>
<h1>Rezervacija dvorana</h1>
<nav>
<a href="#">Home</a>
<a href="#">O nama</a>
<a href="register.html">Registracija</a>
</nav>
</header>
<h1>Rezervacija dvorana</h1>
<nav>
<a href="index.html">Home</a>
<a href="hall.html">Dvorana</a>
<a href="#">O nama</a>
<a href="register.html">Registracija</a>
</nav>
</header>
<div class="form-container">
<form action="index.html" method="post">
<label for="username">Korisničko ime</label>
<input id="username" name="username" type="text" required>
<br>

<form action="index.html" method="post">
<label for="username">Korisničko ime</label>
<input id="username" name="username" type="text" required>
<br>

<label for="password">Lozinka</label>
<input id="password" name="password" type="password" required>
<br>

<label for="firstName">Ime</label>
<input id="firstName" name="firstName" type="text">
<br>

<label for="lastName">Prezime</label>
<input id="lastName" name="lastName" type="text">
<br>
<label for="password">Lozinka</label>
<input id="password" name="password" type="password" required>
<br>

<input type="submit">
</form>

<footer>
<h4>Grad Križevci</h4>
</footer>
<label for="firstName">Ime</label>
<input id="firstName" name="firstName" type="text">
<br>

<label for="lastName">Prezime</label>
<input id="lastName" name="lastName" type="text">
<br>

<input type="Submit" value="Registracija" id="search">
</form>
</div>
</div>
<footer>
<h4>Grad Križevci</h4>
</footer>
</body>
</html>
67 changes: 64 additions & 3 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,46 @@
margin: 0;
}

html, body {
height: 100%;
min-height: 100%;
display: flex;
flex-direction: column;
}

header {
background-color: #333;
display: flex;
justify-content: space-between;
height: 55px;
}

h1 {
display: inline-block;
color: #fff;
font-size: 50px;
font-family: 'Lato', sans-serif;
font-size: 28px;
padding: 10px 20px;
}

h4 {
font-family: 'Lato', sans-serif;
}

nav {
float: right;
padding: 10px 20px;
padding: 0px 20px;
display: flex;
align-items: stretch;
font-family: 'Lato', sans-serif;
}

a {
padding: 0 20px;
color: #fff;
text-decoration: none;
display: flex;
align-items: center;
}

a:hover {
Expand All @@ -31,11 +51,52 @@ a:hover {
img {
width: 100%;
}

footer {
padding-top: 30px;
color: white;
text-align: center;
height: 100px;
background-color: #333;
position: fixed;
bottom: 0;
width: 100%;
}

label {
display: inline-block;
text-align: left;
font-family: 'Lato', sans-serif;
margin-right: 150px;
width: 100%;
margin-bottom: 5px;
}

input {
margin-bottom: 20px;
width: 100%;
font-size: 18px;
height: 2em;
}

#search {
width: 10em; height: 2em;
background-color: #333;
color: #fff;
font-family: 'Lato', sans-serif;
font-weight: bold;
border: 0;
}

.form-container {
display: flex;
justify-content: center;
padding-top: 100px;
font-weight: bold;
}

section {
background-image: url("https://images.unsplash.com/photo-1497366754035-f200968a6e72?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80");
background-size: cover;
flex-grow: 2;
}