nguyenhai266 commited on
Commit
0bef0b7
·
1 Parent(s): 516077a
src/main/resources/static/css/faceID/faceID-list.css CHANGED
@@ -173,9 +173,65 @@
173
 
174
  object-fit: cover;
175
  }
176
- /* ==========================
177
- FACE MODAL
178
- ========================== */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
 
180
  .face-modal {
181
  display: none;
 
173
 
174
  object-fit: cover;
175
  }
176
+
177
+ .face-gallery {
178
+ display: grid;
179
+ grid-template-columns: 1.3fr 1fr;
180
+ gap: 24px;
181
+ align-items: start;
182
+ }
183
+
184
+ .face-gallery-image {
185
+ display: flex;
186
+ justify-content: center;
187
+ align-items: center;
188
+ }
189
+
190
+ .face-detail-panel {
191
+ display: grid;
192
+ gap: 14px;
193
+ }
194
+
195
+ .action-group {
196
+ display: flex;
197
+ gap: 8px;
198
+ }
199
+
200
+ .btn-small {
201
+ height: 38px;
202
+
203
+ padding: 0 16px;
204
+
205
+ font-size: .85rem;
206
+
207
+ border-radius: 10px;
208
+ }
209
+ .face-detail-panel .detail-item {
210
+ background: rgba(255, 255, 255, 0.05);
211
+ border: 1px solid var(--border);
212
+ border-radius: 14px;
213
+ padding: 16px;
214
+ }
215
+
216
+ .face-detail-panel .detail-item span {
217
+ display: block;
218
+ font-size: 0.85rem;
219
+ color: var(--text-light);
220
+ margin-bottom: 6px;
221
+ }
222
+
223
+ .face-detail-panel .detail-item p {
224
+ margin: 0;
225
+ font-size: 1rem;
226
+ font-weight: 600;
227
+ color: var(--text-white);
228
+ }
229
+
230
+ .face-detail-panel .detail-item p#detailStatus {
231
+ color: var(--success);
232
+ }
233
+
234
+
235
 
236
  .face-modal {
237
  display: none;
src/main/resources/templates/cms/face-id/faceID-list.html CHANGED
@@ -58,11 +58,32 @@
58
  </td>
59
  <td th:text="${faceProfile.userEmail}">user@example.com</td>
60
  <td>
61
- <img th:src="${faceProfile.thumbnailUrl}" alt="Face" style="width: 50px; height: 50px; object-fit: cover; border-radius: 4px;" th:if="${faceProfile.thumbnailUrl}">
 
 
 
 
 
 
 
62
  </td>
63
 
64
  <td>
65
- <button class="detail-btn btn-primary" type="button">Chi tiết</button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  </td>
67
  </tr>
68
  </tbody>
@@ -81,7 +102,7 @@
81
  <div class="face-modal-content">
82
 
83
  <div class="face-modal-header">
84
- <h2>Ảnh Face ID</h2>
85
 
86
  <button class="close-btn" onclick="closeFaceGallery()">
87
 
@@ -90,7 +111,37 @@
90
 
91
  <div class="face-gallery">
92
 
93
- <img id="facePreviewImage" src="https://i.pinimg.com/736x/6a/5e/fc/6a5efc25bf7c7603afac79d7046f999c.jpg" alt="Face ID">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
 
95
  </div>
96
 
@@ -98,25 +149,57 @@
98
 
99
  </div>
100
  <script>
101
- function openFaceGallery() {
 
 
 
 
 
 
102
 
103
- document
104
- .getElementById("faceGalleryModal")
105
- .classList.add("show");
106
  }
107
 
108
  function closeFaceGallery() {
 
 
109
 
110
- document
111
- .getElementById("faceGalleryModal")
112
- .classList.remove("show");
113
  }
114
 
115
- window.onclick = function (event) {
 
 
 
 
 
 
116
 
117
- const modal =
118
- document.getElementById("faceGalleryModal");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
 
 
 
120
  if (event.target === modal) {
121
  closeFaceGallery();
122
  }
 
58
  </td>
59
  <td th:text="${faceProfile.userEmail}">user@example.com</td>
60
  <td>
61
+ <button class="detail-btn btn-small" type="button" th:data-id="${faceProfile.id}"
62
+ th:data-name="${faceProfile.userFullName}"
63
+ th:data-face-code="${faceProfile.faceCode}"
64
+ th:data-sample-count="${faceProfile.sampleCount}"
65
+ th:data-email="${faceProfile.userEmail}"
66
+ th:data-thumbnail-url="${faceProfile.thumbnailUrl}">
67
+ Chi tiết
68
+ </button>
69
  </td>
70
 
71
  <td>
72
+ <div class="action-group">
73
+
74
+ <form method="post">
75
+ <button class="btn-primary btn-small">
76
+ Phê duyệt
77
+ </button>
78
+ </form>
79
+
80
+ <form method="post">
81
+ <button class="btn-secondary btn-small">
82
+ Từ chối
83
+ </button>
84
+ </form>
85
+
86
+ </div>
87
  </td>
88
  </tr>
89
  </tbody>
 
102
  <div class="face-modal-content">
103
 
104
  <div class="face-modal-header">
105
+ <h2>Chi tiết Face ID</h2>
106
 
107
  <button class="close-btn" onclick="closeFaceGallery()">
108
 
 
111
 
112
  <div class="face-gallery">
113
 
114
+ <div class="face-gallery-image">
115
+ <img id="facePreviewImage"
116
+ src="https://i.pinimg.com/736x/6a/5e/fc/6a5efc25bf7c7603afac79d7046f999c.jpg" alt="Face ID">
117
+ </div>
118
+
119
+ <div class="face-detail-panel">
120
+ <div class="detail-item">
121
+ <span>Mã SV</span>
122
+ <p id="detailId">--</p>
123
+ </div>
124
+ <div class="detail-item">
125
+ <span>Họ tên</span>
126
+ <p id="detailName">--</p>
127
+ </div>
128
+ <div class="detail-item">
129
+ <span>Face ID</span>
130
+ <p id="detailFaceCode">--</p>
131
+ </div>
132
+ <div class="detail-item">
133
+ <span>Số mẫu</span>
134
+ <p id="detailSampleCount">--</p>
135
+ </div>
136
+ <div class="detail-item">
137
+ <span>Email</span>
138
+ <p id="detailEmail">--</p>
139
+ </div>
140
+ <div class="detail-item">
141
+ <span>Trạng thái</span>
142
+ <p id="detailStatus">--</p>
143
+ </div>
144
+ </div>
145
 
146
  </div>
147
 
 
149
 
150
  </div>
151
  <script>
152
+ const facePreviewImage = document.getElementById("facePreviewImage");
153
+ const detailId = document.getElementById("detailId");
154
+ const detailName = document.getElementById("detailName");
155
+ const detailFaceCode = document.getElementById("detailFaceCode");
156
+ const detailSampleCount = document.getElementById("detailSampleCount");
157
+ const detailEmail = document.getElementById("detailEmail");
158
+ const detailStatus = document.getElementById("detailStatus");
159
 
160
+ function openFaceGallery() {
161
+ document.getElementById("faceGalleryModal").classList.add("show");
 
162
  }
163
 
164
  function closeFaceGallery() {
165
+ document.getElementById("faceGalleryModal").classList.remove("show");
166
+ }
167
 
168
+ function formatDetailValue(value, suffix = "") {
169
+ return value !== undefined && value !== null && value !== "" ? `${value}${suffix}` : "--";
 
170
  }
171
 
172
+ function getFaceStatus(sampleCount) {
173
+ const count = Number(sampleCount);
174
+ if (Number.isNaN(count)) {
175
+ return "--";
176
+ }
177
+ return count >= 5 ? "Đã đăng ký" : "Chưa đủ mẫu";
178
+ }
179
 
180
+ document.querySelectorAll('.detail-btn').forEach(button => {
181
+ button.addEventListener('click', () => {
182
+ const faceId = button.dataset.id;
183
+ const name = button.dataset.name;
184
+ const faceCode = button.dataset.faceCode;
185
+ const sampleCount = button.dataset.sampleCount;
186
+ const email = button.dataset.email;
187
+ const thumbnailUrl = button.dataset.thumbnailUrl;
188
+
189
+ detailId.textContent = formatDetailValue(faceId);
190
+ detailName.textContent = formatDetailValue(name);
191
+ detailFaceCode.textContent = formatDetailValue(faceCode);
192
+ detailSampleCount.textContent = formatDetailValue(sampleCount, ' mẫu');
193
+ detailEmail.textContent = formatDetailValue(email);
194
+ detailStatus.textContent = getFaceStatus(sampleCount);
195
+ facePreviewImage.src = thumbnailUrl ? thumbnailUrl : "https://i.pinimg.com/736x/6a/5e/fc/6a5efc25bf7c7603afac79d7046f999c.jpg";
196
+
197
+ openFaceGallery();
198
+ });
199
+ });
200
 
201
+ window.onclick = function (event) {
202
+ const modal = document.getElementById("faceGalleryModal");
203
  if (event.target === modal) {
204
  closeFaceGallery();
205
  }