-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPAT02.html
316 lines (281 loc) · 15 KB
/
PAT02.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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="img/Logo.png" type="image/png">
<link rel="stylesheet" href="main.css">
<title>환자 목록</title>
</head>
<body>
<nav class="top-nav">
<div class="nav-container">
<div class="logo-area">
<img src="img/logo.png" alt="Logo" class="logo">
<img src="img/letters.svg" alt="Letters" class="letters">
</div>
<div class="login-area">
<div class="user-info" id="userInfo"> <a href="#" onclick="toggleDropdownMenu(event)" class="profile-link">
<img src="img/profile.svg" alt="프로필" class="profile-icon">
</a>
<a href="#" onclick="toggleDropdownMenu(event)" class="profile-link"> <span class="user-name">사용자 이름</span></a>
<div class="dropdown-menu hidden" id="userDropdown">
<ul>
<li onclick="viewProfile()">프로필 보기</li>
<li onclick="logout()">로그아웃</li>
</ul>
</div>
</div>
</div>
</div>
</nav>
<main class="table-content">
<div class="search-top">
<div class="input-container"><input type="text" class="search-patient" placeholder="환자 검색">
<img src="img/search.svg" alt="search" class="search-icon">
</div></div>
<div class="tablehead-container">
<div class="table-head"><span class="title-head">환자 목록</span> <button class="button-table" onclick="openRegisterModal()">환자 등록</button></div>
<div class="table-container"><div class="table">
<table>
<thead>
<tr>
<th class="th">환자 번호</th>
<th class="th">환자 이름</th>
<th class="th">성별</th>
<th class="th">나이</th>
<th class="th">누적 검사 횟수</th>
<th class="th">마지막 검사일</th>
<th class="th">상태</th>
<th class="th"></th>
</tr>
</thead>
<tbody>
<tr onclick="showDetails('123456')" class="status-critical">
<td data-label="환자 번호" class="td">842292</td>
<td data-label="환자 이름" class="td">이*화</td>
<td data-label="성별" class="td">여</td>
<td data-label="나이" class="td">2Y(24M)</td>
<td data-label="누적 검사 횟수" class="td">0회</td>
<td data-label="마지막 검사일" class="td">-</td>
<td class="td">검사 대기중</td>
<td data-label="관리" class="td"><button class="delete-button" onclick="openModal('홍길동', event)"><img src="img/trash.svg" class="button-delete"></button></td>
</tr>
<tr>
<td class="td">621441</td>
<td class="td">임*정</td>
<td class="td">여</td>
<td class="td">3Y(40M)</td>
<td class="td">1회</td>
<td class="td">2024.12.31</td>
<td class="td">검사 대기중</td>
<td class="td"><button class="delete-button" onclick="openModal('임*정', event)"><img src="img/trash.svg" class="button-delete"></button></td>
</tr>
<tr>
<td class="td">33689111</td>
<td class="td">심*민</td>
<td class="td">남</td>
<td class="td">5Y</td>
<td class="td">0회</td>
<td class="td">검사 전</td>
<td class="td">검사 전</td>
<td class="td"><button class="delete-button" onclick="openModal('심*민', event)"><img src="img/trash.svg" class="button-delete"></button></td>
</tr>
<tr>
<td class="td">872078</td>
<td class="td">현*빈</td>
<td class="td">남</td>
<td class="td">6Y</td>
<td class="td">1회</td>
<td class="td">2024.1.19</td>
<td class="td">분석 완료</td>
<td class="td"><button class="delete-button" onclick="openModal('현*빈', event)"><img src="img/trash.svg" class="button-delete"></button></td>
</tr>
<tr>
<td class="td">373487373487</td>
<td class="td">이*민</td>
<td class="td">여</td>
<td class="td">10Y</td>
<td class="td">3회</td>
<td class="td">2024.1.11</td>
<td class="td" style="color: var(--Red-500, #F04438);">분석 실패</td>
<td class="td"><button class="delete-button" onclick="openModal('이*민', event)"><img src="img/trash.svg" class="button-delete"></button></td>
</tr>
</tbody>
</table>
<div class="pagination">
<!-- 이전 버튼 -->
<button class="page-btn prev-btn">
<img src="img/arrow-left.svg" alt="이전" class="arrow-icon">이전
</button>
<button class="page-btn" onclick="goToPage(1)">1</button>
<button class="page-btn" onclick="goToPage(2)">2</button>
<button class="page-btn" onclick="goToPage(3)">3</button>
<button class="page-btn">... </button>
<button class="page-btn" onclick="goToPage(8)">8</button>
<button class="page-btn" onclick="goToPage(9)">9</button>
<button class="page-btn" onclick="goToPage(10)">10</button>
<!-- 다음 버튼 -->
<button class="page-btn next-btn">다음 <img src="img/arrow-right.svg" alt="다음" class="arrow-icon">
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
</div>
<!-- 공통 모달 팝업 -->
<div id="delete-modal" class="modal">
<div class="modal-content">
<!-- 타이틀 -->
<h2 id="delete-title"></h2>
<!-- 본문 -->
<p id="delete-message">등록된 환자 정보가 완전히 삭제됩니다.</p>
<div class="modal-actions">
<button class="cancel-button" onclick="closeModal()">취소</button>
<button class="confirm-button" onclick="confirmDeleteAction()">삭제</button>
</div>
</div>
</div>
<div id="register-modal" class="modal">
<div class="modal-register">
<h2 id="register-title">환자 등록</h2>
<label class="input-label">환자 번호</label>
<input type="text" placeholder="환자 번호 입력" class="styled-input">
<label class="input-label">환자 이름</label>
<input type="text" placeholder="환자 이름 입력" class="styled-input">
<label class="input-label">성별</label>
<div class="button-group" role="group" aria-label="Gender selection">
<input type="radio" class="btn-check" name="gender" id="male" autocomplete="off">
<label class="btn gender-btn" for="male">남성</label>
<input type="radio" class="btn-check" name="gender" id="female" autocomplete="off">
<label class="btn gender-btn" for="female">여성</label>
</div>
<label class="input-label">생년월일</label>
<input type="date" class="styled-input">
<label class="input-label">메모 (선택)</label>
<input type="text" placeholder="메모 입력" class="styled-input">
<div class="modal-actions">
<button class="cancel-button" onclick="closeRegisterModal()">취소</button>
<button class="registerOnly-button" onclick="registerPatient()">등록</button>
<button class="confirm-button" onclick="registerPatient()">등록 및 검사준비</button>
</div>
</div></div>
<!-- JavaScript -->
<script>
// 드롭다운 메뉴 열고 닫기
function toggleDropdownMenu(event) {
event.preventDefault(); // 기본 링크 동작 방지
const dropdown = document.getElementById("userDropdown");
if (dropdown) {
dropdown.classList.toggle("hidden"); // hidden 클래스 토글
console.log(`Dropdown visibility: ${!dropdown.classList.contains("hidden")}`); // 상태 확인
} else {
console.error("드롭다운 메뉴 요소를 찾을 수 없습니다.");
}
}
// 외부 클릭 시 드롭다운 메뉴 닫기
document.addEventListener("click", (event) => {
const dropdown = document.getElementById("userDropdown");
const userInfo = document.getElementById("userInfo");
if (!userInfo.contains(event.target)) {
dropdown.classList.add("hidden");
}
});
function viewProfile() {
alert("프로필 페이지로 이동합니다."); // 실제 프로필 페이지 URL로 이동 추가
}
function logout() {
alert("로그아웃 되었습니다."); // 실제 로그아웃 로직 추가
}
let currentDeleteName = ''; // 삭제 대상 이름 저장
// 모달 열기
function openModal(name) {
currentDeleteName = name; // 삭제 대상 이름 저장
document.getElementById('delete-title').textContent = `${name}님의 환자 정보를 삭제할까요?`; // 타이틀 업데이트
document.getElementById('delete-message').textContent = `등록된 환자 정보가 완전히 삭제됩니다.`; // 본문 메시지
document.getElementById('delete-modal').style.display = 'flex'; // 모달 표시
}
// 모달 닫기
function closeModal() {
document.getElementById('delete-modal').style.display = 'none'; // 모달 숨김
}
// 확인 버튼 클릭 시 동작
function confirmDeleteAction() {
alert(`${currentDeleteName}님의 환자 정보가 삭제되었습니다.`);
closeModal(); // 모달 숨김
}
function goToPage(pageNumber) {
console.log(`페이지 ${pageNumber}로 이동합니다.`);
// 여기에 페이지네이션 관련 로직 추가
}
// 환자 등록 모달 열기
function openRegisterModal() {
document.getElementById('register-modal').style.display = 'flex'; // 모달 표시
}
// 환자 등록 모달 닫기
function closeRegisterModal() {
document.getElementById('register-modal').style.display = 'none'; // 모달 숨김
}
// 환자 등록 확인
function registerPatient() {
const patientNumber = document.querySelector('#register-modal input[placeholder="환자 번호 입력"]').value;
const patientName = document.querySelector('#register-modal input[placeholder="환자 이름 입력"]').value;
if (patientNumber && patientName) {
alert(`환자 번호: ${patientNumber}, 환자 이름: ${patientName} 등록되었습니다.`);
closeRegisterModal();
} else {
alert('모든 필드를 입력하세요.');
}
}
// 테이블 행 클릭 시 상세 화면으로 이동
function showDetails(patientId) {
// 삭제 버튼이나 드롭다운 관련 클릭 시 이벤트 전파 차단
if (event.target.closest('.delete-button') || event.target.closest('.dropdown-container')) {
return;
}
// 상세 화면 URL로 이동
window.location.href = `/patient/details/${patientId}`;
}
// 삭제 버튼 클릭 시 모달 열기
function openModal(name, event) {
event.stopPropagation(); // 이벤트 전파 차단
currentDeleteName = name; // 삭제 대상 이름 저장
document.getElementById('delete-title').textContent = `${name}님의 환자 정보를 삭제할까요?`;
document.getElementById('delete-message').textContent = `등록된 환자 정보가 완전히 삭제됩니다.`;
document.getElementById('delete-modal').style.display = 'flex'; // 모달 표시
}
// 드롭다운 메뉴 토글
function toggleDropdown(event) {
event.stopPropagation(); // 클릭 이벤트 전파 방지
const container = event.target.closest('.dropdown-container');
container.classList.toggle('active');
}
// 상태값 변경
function changeStatus(element, newStatus) {
const container = element.closest('.dropdown-container');
const statusLabel = container.querySelector('.status-label');
const dropdownMenu = container.querySelector('.dropdown-menu');
statusLabel.textContent = newStatus; // 상태값 업데이트
container.classList.remove('active'); // 드롭다운 메뉴 닫기
}
// 모든 항목에서 'selected' 클래스 제거
dropdownMenu.querySelectorAll('li').forEach((item) => {
item.classList.remove('selected');
});
// 클릭한 항목에 'selected' 클래스 추가
element.classList.add('selected');
// 드롭다운 메뉴 닫기
container.classList.remove('active');
// 문서 외부 클릭 시 드롭다운 메뉴 닫기
document.addEventListener('click', () => {
document.querySelectorAll('.dropdown-container').forEach((container) => {
container.classList.remove('active');
});
});
</script>
</body>
</html>