Spaces:
Sleeping

doluong6 commited on
Commit
5ca2d41
·
verified ·
1 Parent(s): f3e8ddb

Upload 2 files

Browse files
Files changed (2) hide show
  1. static/script.js +14 -7
  2. static/style.css +87 -80
static/script.js CHANGED
@@ -697,17 +697,24 @@ async function hienThiHSKH() {
697
 
698
  $("#bangHSKH tbody").html(tbodyHtml);
699
 
700
- $('#bangHSKH').DataTable({
701
- scrollY: '800px',
702
- scrollCollapse: true,
703
- paging: false, // ✅ Không giới hạn 25 dòng
704
  autoWidth: false,
 
 
705
  ordering: false,
706
- searching: false,
707
- info: false
 
 
 
 
 
 
 
 
708
  });
709
 
710
-
711
  // ✅ Tô màu dòng nếu FULL được tick
712
  function capNhatMauDong() {
713
  $("#bangHSKH tbody tr").each(function () {
 
697
 
698
  $("#bangHSKH tbody").html(tbodyHtml);
699
 
700
+ $("#bangHSKH").DataTable({
701
+ scrollX: true,
 
 
702
  autoWidth: false,
703
+ pageLength: 25,
704
+ lengthMenu: [10, 25, 50, 100],
705
  ordering: false,
706
+ language: {
707
+ search: "🔍 Tìm kiếm:",
708
+ lengthMenu: "Hiển thị _MENU_ dòng",
709
+ info: "Đang hiển thị _START_ đến _END_ của _TOTAL_ dòng",
710
+ paginate: {
711
+ previous: "←",
712
+ next: "→"
713
+ },
714
+ emptyTable: "Không có dữ liệu"
715
+ }
716
  });
717
 
 
718
  // ✅ Tô màu dòng nếu FULL được tick
719
  function capNhatMauDong() {
720
  $("#bangHSKH tbody tr").each(function () {
static/style.css CHANGED
@@ -259,101 +259,108 @@ table.dataTable tbody tr:hover {
259
  outline: none;
260
  background-color: #f0f8ff;
261
  }
 
 
 
 
 
 
 
262
 
263
- /* Tùy chỉnh bảng DataTables */
264
- table.dataTable {
265
- font-size: 14px;
266
- border-collapse: collapse;
267
- width: 100%;
268
- }
269
 
270
- table.dataTable th,
271
- table.dataTable td {
272
- padding: 8px 12px;
273
- text-align: left;
274
- border: 1px solid #ccc;
275
- }
 
276
 
277
- table.dataTable thead th {
278
- background-color: #2b6cb0;
279
- color: white;
280
- font-weight: bold;
281
- text-align: center;
282
- vertical-align: middle;
283
- }
284
 
285
- table.dataTable thead tr:nth-child(2) th {
286
- background-color: #4682b4;
287
- color: white;
288
- }
289
 
290
- table.dataTable tbody tr:nth-child(even) {
291
- background-color: #f9f9f9;
292
- }
293
 
294
- table.dataTable tbody tr:hover {
295
- background-color: #f1f7ff;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  }
297
 
298
- /* Input trong bảng chỉnh sửa */
299
- .input-cell {
300
- border: none;
301
- background: transparent;
302
- width: 100%;
303
- font-size: 14px;
304
  }
305
 
306
- .input-cell:focus {
307
- background: #fff8dc;
308
- outline: 1px solid #2b6cb0;
 
 
 
 
 
 
 
 
309
  }
310
 
311
- #bangHSKH {
312
- width: 100%;
313
- border-collapse: collapse;
314
- table-layout: fixed;
315
- font-family: 'Segoe UI', sans-serif;
316
- font-size: 13px;
317
- background-color: #fff;
318
- word-wrap: break-word;
319
- word-break: break-word;
320
  }
321
 
322
- #bangHSKH th,
323
- #bangHSKH td {
324
- border: 1px solid #ccc;
325
- padding: 6px 8px;
326
- text-align: center;
327
  vertical-align: middle;
 
 
 
 
 
 
 
 
328
  white-space: normal;
 
329
  }
330
-
331
- /* Kích thước cột */
332
- #bangHSKH th:nth-child(1), #bangHSKH td:nth-child(1) { width: 40px; }
333
- #bangHSKH th:nth-child(2), #bangHSKH td:nth-child(2) { width: 100px; }
334
- #bangHSKH th:nth-child(3), #bangHSKH td:nth-child(3),
335
- #bangHSKH th:nth-child(4), #bangHSKH td:nth-child(4) { width: 200px; }
336
- #bangHSKH th:nth-child(5), #bangHSKH td:nth-child(5),
337
- #bangHSKH th:nth-child(6), #bangHSKH td:nth-child(6) { width: 150px; }
338
- #bangHSKH th:nth-child(7), #bangHSKH td:nth-child(7) { width: 100px; }
339
- #bangHSKH th:nth-child(8), #bangHSKH td:nth-child(8) { width: 100px; }
340
-
341
- /* Cột checkbox */
342
- #bangHSKH th:nth-child(9),
343
- #bangHSKH td:nth-child(9),
344
- #bangHSKH th:nth-child(10),
345
- #bangHSKH td:nth-child(10),
346
- #bangHSKH th:nth-child(11),
347
- #bangHSKH td:nth-child(11),
348
- #bangHSKH th:nth-child(12),
349
- #bangHSKH td:nth-child(12) {
350
- width: 40px;
351
- }
352
-
353
- /* Ghi chú rộng */
354
- #bangHSKH th:nth-child(13), #bangHSKH td:nth-child(13) { width: 250px; }
355
-
356
- /* Tô màu cả dòng khi checkbox Full được tích */
357
- #bangHSKH tr.full-checked {
358
- background-color: #c6f6d5 !important; /* xanh nhạt */
359
  }
 
259
  outline: none;
260
  background-color: #f0f8ff;
261
  }
262
+ <style>
263
+ /* Tùy chỉnh bảng DataTables */
264
+ table.dataTable {
265
+ font-size: 14px;
266
+ border-collapse: collapse;
267
+ width: 100%;
268
+ }
269
 
270
+ table.dataTable th,
271
+ table.dataTable td {
272
+ padding: 8px 12px;
273
+ text-align: left;
274
+ border: 1px solid #ccc;
275
+ }
276
 
277
+ table.dataTable thead th {
278
+ background-color: #2b6cb0;
279
+ color: white;
280
+ font-weight: bold;
281
+ text-align: center;
282
+ vertical-align: middle;
283
+ }
284
 
285
+ table.dataTable thead tr:nth-child(2) th {
286
+ background-color: #4682b4;
287
+ color: white;
288
+ }
 
 
 
289
 
290
+ table.dataTable tbody tr:nth-child(even) {
291
+ background-color: #f9f9f9;
292
+ }
 
293
 
294
+ table.dataTable tbody tr:hover {
295
+ background-color: #f1f7ff;
296
+ }
297
 
298
+ /* Input trong bảng chỉnh sửa */
299
+ .input-cell {
300
+ border: none;
301
+ background: transparent;
302
+ width: 100%;
303
+ font-size: 14px;
304
+ }
305
+
306
+ .input-cell:focus {
307
+ background: #fff8dc;
308
+ outline: 1px solid #2b6cb0;
309
+ }
310
+ </style>
311
+ .checkbox-cell {
312
+ width: 18px;
313
+ height: 18px;
314
+ accent-color: #2b6cb0;
315
  }
316
 
317
+ td:has(.checkbox-cell:checked) {
318
+ background-color: #c6f6d5 !important; /* Xanh nhạt */
 
 
 
 
319
  }
320
 
321
+ td:has(.checkbox-cell:not(:checked)) {
322
+ background-color: #fed7d7 !important; /* Đỏ nhạt */
323
+ }
324
+ .checkbox-full, .checkbox-cell {
325
+ width: 16px;
326
+ height: 16px;
327
+ accent-color: #007bff;
328
+ }
329
+ /* Màu nền cho cả dòng theo checkbox FULL */
330
+ tr.full-row {
331
+ background-color: #d2f8d2 !important; /* Xanh nhạt khi Full được tick */
332
  }
333
 
334
+ tr.not-full-row {
335
+ background-color: #fde2e2 !important; /* Đỏ nhạt khi Full chưa tick */
336
+ }
337
+ td:has(input[type="checkbox"]:checked) {
338
+ background-color: #d2f8d2 !important;
339
+ }
340
+ td:has(input[type="checkbox"]:not(:checked)) {
341
+ background-color: #fde2e2 !important;
 
342
  }
343
 
344
+ #bangHSKH td, #bangHSKH th {
345
+ white-space: normal !important; /* ✅ Cho phép xuống dòng */
346
+ word-wrap: break-word;
 
 
347
  vertical-align: middle;
348
+ text-align: center;
349
+ padding: 8px;
350
+ font-size: 13px;
351
+ }
352
+ .input-cell {
353
+ min-width: 120px;
354
+ max-width: 300px;
355
+ width: 100%;
356
  white-space: normal;
357
+ word-break: break-word;
358
  }
359
+ .checkbox-cell {
360
+ display: block;
361
+ margin: auto;
362
+ }
363
+ table.dataTable td {
364
+ white-space: normal !important;
365
+ word-break: break-word;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
366
  }