-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhome.html
More file actions
97 lines (94 loc) · 4.46 KB
/
home.html
File metadata and controls
97 lines (94 loc) · 4.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="home.css"/>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Space+Mono&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Gothic+A1:wght@400;800&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Syncopate&display=swap" rel="stylesheet">
<title>자리 안내 서비스</title>
</head>
<body>
<h1 id="title" class="title_font">Now U SEAT Me</h1>
<div id="gridseatinfo">
<div id="seatinfo">
<p class="font">잔여좌석 안내</p>
</div>
<p class="font"><span style="color:rgb(254, 65, 65)">●</span> 이용중 : <span th:text="${seatNumber.fullSeat}"></span>석</p>
<p class="font"><span style="color:rgb(61, 171, 49)">●</span> 이용 가능 : <span th:text="${seatNumber.emptySeat}"></span>석</p>
<p class="font"><span style="color:rgb(238, 221, 64)">●</span> 자리 비움 : <span th:text="${seatNumber.awaySeat}"></span>석</p>
</div>
<div id="backmap">
<div id="window">
<p class="font">창가</p>
</div>
<div id="gridmap">
<div>
<p id="studyroom" class="font">스터디룸</p>
</div>
<div id="seats">
<div th:each="seat : ${seats}" th:switch="${seat.status.toString()}">
<button th:case="EMPTY" class="seatbutton emptyseat" onclick="alert('이미 비어있는 자리입니다.')"
th:text="${seat.seatNum}">
</button>
<button th:case="AWAY" class="seatbutton helpseat"
th:onclick="'document.getElementById(\'id' + ${seat.seatNum} + '\').style.display=\'block\''"
th:text="${seat.seatNum}">
</button>
<button th:case="FULL" class="seatbutton usingseat" onclick="alert('이용중인 자리입니다.')"
th:text="${seat.seatNum}">
</button>
<div th:id="'id' + ${seat.seatNum}" class="modal">
<span th:onclick="'document.getElementById(\'id' + ${seat.seatNum} + '\').style.display=\'none\''"
class="close"
title="Close Modal">×</span>
<form class="modal-content" action="/home">
<div class="container">
<h1>자리 비움 요청</h1>
<p>자리 비움 요청을 하시겠습니까?</p>
<div class="clearfix">
<button type="button"
th:onclick="'document.getElementById(\'id' + ${seat.seatNum} + '\').style.display=\'none\''"
th:class="'request' + ${seat.seatNum}" id="request"
th:classappend="${seat.seatNum}">자리 비움 요청
</button>
<button type="button"
th:onclick="'document.getElementById(\'id' + ${seat.seatNum} + '\').style.display=\'none\''"
class="cancelbtn">취소
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script src='/js/home.js'></script>
<script src='https://code.jquery.com/jquery-3.6.0.min.js'></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sockjs-client/1.1.5/sockjs.min.js"></script>
<script>
$(function () {
var requestBtn = [];
for (let i = 1; i <= 8; i++) {
requestBtn[i] = $('.request' + i);
}
var sock = new SockJS("/ws");
sock.onopen = function () {
sock.onmessage = function (e) {
window.location.reload();
}
}
for (let i = 1; i <= 8; i++) {
requestBtn[i].click(function () {
sock.send(JSON.stringify({seatNum: i, messageType: 'REQUEST'}));
});
}
});
</script>
</body>
</html>