-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
220 lines (212 loc) · 10.8 KB
/
index.html
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Patient Diet Recorder</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" rel="stylesheet">
<link rel="stylesheet" href="./styles.css">
</head>
<body>
<div id="app" class="container">
<template v-if="!authenticated">
<div class="row mt-1">
<div class="col text-center">
<h1> 護理站數據監測 </h1>
</div>
</div>
<div class="row mt-5">
<div class="col-md-4 offset-md-4 col-10 offset-1">
<div class="input-group">
<span class="input-group-text">帳號</span>
<input type="text" class="form-control" v-model="account">
</div>
</div>
</div>
<div class="row mt-1">
<div class="col-md-4 offset-md-4 col-10 offset-1">
<div class="input-group">
<span class="input-group-text">密碼</span>
<input :type="showPassword ? 'text' : 'password'" class="form-control" v-model="password">
<button class="btn btn-outline-secondary" @click="togglePasswordVisibility">
<i class="fas" :class="showPassword ? 'fa-eye-slash' : 'fa-eye'" aria-hidden="true"></i>
</button>
</div>
</div>
</div>
<div class="row mt-3">
<div class="col-md-2 offset-md-7 col-3 offset-7">
<button class="btn btn-primary" @click="authenticate"> 登入 </button>
</div>
</div>
<footer class="footer pt-2 mt-2 bg-light fixed-bottom">
<div v-if="!authenticated" class="container">
<div class="row">
<div class="col-md-5 col-12 text-muted">
<p class="text-left small">Copyright © 2023-2024 LifeAdventurer | All Rights Reserved.</p>
</div>
<div class="col-md-3 col-6 text-muted">
<p>
Code licensed
<a href="https://github.com/LifeAdventurer/patient-diet-recorder/blob/main/LICENSE">GPL-3.0</a>
</p>
</div>
<div class="col-md-2 col-6 text-muted">
<p>Currently v0.2.0</p>
</div>
</div>
</div>
</footer>
</template>
<template v-else>
<!-- DATE and TIME -->
<div class="time-bar mb-4">
<div class="row">
<div class="col-md-3 col-7 fw-bold" style="font-size: 24px;">
{{ currentDate }}
</div>
<div class="col-md-2 offset-md-7 col-3 offset-1 fw-bold" style="font-size: 24px;">
{{ currentTime }}
</div>
</div>
</div>
<!-- Patient Records -->
<div class="row justify-content-start row-cols-1 row-cols-lg-2 gy-4 mb-2">
<div v-for="(patientAccount, index) in patientAccounts" :key="index">
<div class="col">
<div class="card shadow h-100 py-2 bg-light">
<div class="card-body">
<h3 class="card-title mb-3">{{ patientAccount }}</h3>
<div class="row">
<template v-if="patientRecords[patientAccount][currentDateYY_MM_DD]">
<table class="table table-striped table-bordered">
<thead>
<tr class="text-center">
<th scope="col">{{ patientRecords[patientAccount][currentDateYY_MM_DD]['recordDate'] }}</th>
<th scope="col">進食</th>
<th scope="col">喝水</th>
<th scope="col">排尿</th>
<th scope="col">排便</th>
</tr>
</thead>
<tbody>
<tr class="text-center fw-bold">
<td>總和</td>
<td>{{ patientRecords[patientAccount][currentDateYY_MM_DD]['foodSum'] }}</td>
<td>{{ patientRecords[patientAccount][currentDateYY_MM_DD]['waterSum'] }}</td>
<td>{{ patientRecords[patientAccount][currentDateYY_MM_DD]['urinationSum'] }}</td>
<td>{{ patientRecords[patientAccount][currentDateYY_MM_DD]['defecationSum'] }}</td>
</tr>
</tbody>
</table>
</template>
<template v-else>
<h4 class="text-center">今日尚無紀錄</h4>
</template>
</div>
<div class="row">
<div class="accordion">
<div class="accordion-item shadow bg-light">
<h2 class="accordion-header" id="recordSection">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" :data-bs-target="`#content_${index}`" aria-expanded="false" :aria-controls="`content_${index}`">
<div class="row">
<div class="col">
<b>所有紀錄</b>
</div>
</div>
</button>
</h2>
<div class="accordion-collapse collapse" :id="`content_${index}`" aria-labelledby="recordSection" data-bs-parent="#accordionExample">
<div class="accordion-body">
<template v-if="patientRecords[patientAccount] == '{}'">
<div v-for="(dailyRecord, index2) in patientRecords[patientAccount]">
<div class="accordion">
<div class="accordion-item shadow bg-light">
<h2 class="accordion-header" id="recordSection">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" :data-bs-target="`#content_${index2}`" aria-expanded="false" :aria-controls="`content_${index2}`">
<div class="row">
<div class="col-4" style="font-size: 20px; margin-left: -10px;">
<div class="recordDate">
<b>{{ dailyRecord['recordDate'] }}</b>
</div>
</div>
<div class="col-6" style="font-size: 18px; margin-left: 6px;">
<div class="weight">
<b>體重: {{ dailyRecord['weight'] == 'NaN' ? '未測量' : dailyRecord['weight'] }}</b>
</div>
</div>
<div class="col-2" style="white-space: nowrap; font-size: 18px;">
<div class="count">
<b>{{ dailyRecord['count'] }}筆資料</b>
</div>
</div>
</div>
</button>
</h2>
<div class="accordion-collapse collapse" :id="`content_${index2}`" aria-labelledby="recordSection" data-bs-parent="#accordionExample">
<div class="accordion-body">
<table class="table table-striped table-bordered" style="font-size: 18px;">
<thead>
<tr class="text-center">
<th scope="col">時間</th>
<th scope="col">進食</th>
<th scope="col">喝水</th>
<th scope="col">排尿</th>
<th scope="col">排便</th>
</tr>
</thead>
<tbody>
<tr v-for="(data, index3) in dailyRecord['data']" :key="index3">
<td v-for="content in data" class="text-center">
{{ content }}
</td>
</tr>
<tr class="text-center fw-bold">
<td>總和</td>
<td>{{ dailyRecord['foodSum'] }}</td>
<td>{{ dailyRecord['waterSum'] }}</td>
<td>{{ dailyRecord['urinationSum'] }}</td>
<td>{{ dailyRecord['defecationSum'] }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</template>
<template v-else>
<h4 class="text-center">無紀錄</h4>
</template>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Logout -->
<div class="row mt-3">
<div class="col text-center" id="logout">
<button class="btn btn-dark" @click="confirmLogout">登出</button>
</div>
</div>
</template>
</div>
<script src="https://unpkg.com/vue@3.4.21/dist/vue.global.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/umd/popper.min.js"
integrity="sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.min.js"
integrity="sha384-BBtl+eGJRgqQAUMxJ7pMwbEyER4l1g+O15P+16Ep7Q9Q+zqX6gSbd85u4mG4QzX+"
crossorigin="anonymous"></script>
<script src="./script.js"></script>
</body>
</html>