Files
2026-06-11 13:14:59 +07:00

1801 lines
61 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Karung Counter Dashboard</title>
<script>
(function () {
try {
const savedTheme = localStorage.getItem('karung-dashboard-theme') || 'futuristic';
document.documentElement.dataset.theme = savedTheme;
} catch (error) {
document.documentElement.dataset.theme = 'futuristic';
}
}());
</script>
<style>
:root {
--font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
--page-bg: radial-gradient(circle at top left, rgba(34, 211, 238, 0.22), transparent 34%),
radial-gradient(circle at top right, rgba(255, 0, 128, 0.2), transparent 30%),
linear-gradient(135deg, #020617 0%, #07111f 48%, #05010f 100%);
--surface: linear-gradient(145deg, rgba(5, 12, 24, 0.84), rgba(11, 17, 32, 0.74));
--surface-strong: rgba(3, 7, 18, 0.94);
--surface-soft: rgba(8, 18, 34, 0.78);
--surface-hover: rgba(13, 33, 54, 0.86);
--text: #dffaff;
--heading: #ffffff;
--muted: #9db8c7;
--border: rgba(103, 232, 249, 0.38);
--accent: #00f5ff;
--accent-strong: #8ffbff;
--accent-soft: rgba(0, 245, 255, 0.14);
--accent-two: #ff2f92;
--tuang: #ff2f92;
--masuk: #00f5ff;
--balance: #46ff9f;
--warning: #f59e0b;
--danger: #f43f5e;
--button-text: #001014;
--input-bg: rgba(3, 7, 18, 0.88);
--table-header: rgba(3, 7, 18, 0.98);
--table-row: rgba(5, 12, 24, 0.54);
--shadow: 0 28px 90px rgba(0, 0, 0, 0.54);
--glow: 0 0 22px rgba(0, 245, 255, 0.42), 0 0 54px rgba(255, 47, 146, 0.2);
--radius-lg: 14px;
--radius-md: 10px;
--radius-sm: 8px;
}
html[data-theme="futuristic"] {
--font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}
html[data-theme="dark"] {
--font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
--page-bg: radial-gradient(circle at top, rgba(59, 130, 246, 0.12), transparent 34%), #0f172a;
--surface: rgba(15, 23, 42, 0.88);
--surface-strong: rgba(15, 23, 42, 0.98);
--surface-soft: rgba(30, 41, 59, 0.78);
--surface-hover: rgba(51, 65, 85, 0.82);
--text: #e2e8f0;
--heading: #f8fafc;
--muted: #94a3b8;
--border: rgba(148, 163, 184, 0.2);
--accent: #60a5fa;
--accent-strong: #93c5fd;
--accent-soft: rgba(96, 165, 250, 0.14);
--accent-two: #818cf8;
--tuang: #f87171;
--masuk: #60a5fa;
--balance: #4ade80;
--button-text: #07111f;
--input-bg: rgba(15, 23, 42, 0.9);
--table-header: rgba(15, 23, 42, 0.98);
--shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
--glow: 0 0 0 rgba(0, 0, 0, 0);
}
html[data-theme="simple"] {
--font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
--page-bg: #f3f4f6;
--surface: #ffffff;
--surface-strong: #ffffff;
--surface-soft: #f9fafb;
--surface-hover: #f3f4f6;
--text: #111827;
--heading: #111827;
--muted: #6b7280;
--border: #e5e7eb;
--accent: #2563eb;
--accent-strong: #1d4ed8;
--accent-soft: #eff6ff;
--accent-two: #64748b;
--tuang: #dc2626;
--masuk: #0284c7;
--balance: #059669;
--button-text: #ffffff;
--input-bg: #ffffff;
--table-header: #f9fafb;
--table-row: #ffffff;
--shadow: 0 10px 32px rgba(15, 23, 42, 0.08);
--glow: none;
}
html[data-theme="light"] {
--font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
--page-bg: radial-gradient(circle at top left, rgba(59, 130, 246, 0.14), transparent 34%),
radial-gradient(circle at top right, rgba(20, 184, 166, 0.12), transparent 28%),
#eef6ff;
--surface: rgba(255, 255, 255, 0.88);
--surface-strong: #ffffff;
--surface-soft: rgba(248, 250, 252, 0.9);
--surface-hover: #f1f5f9;
--text: #0f172a;
--heading: #0f172a;
--muted: #64748b;
--border: rgba(15, 23, 42, 0.1);
--accent: #0891b2;
--accent-strong: #0e7490;
--accent-soft: rgba(8, 145, 178, 0.1);
--accent-two: #7c3aed;
--tuang: #e11d48;
--masuk: #0284c7;
--balance: #059669;
--button-text: #ffffff;
--input-bg: #ffffff;
--table-header: #f8fafc;
--table-row: rgba(255, 255, 255, 0.8);
--shadow: 0 18px 60px rgba(15, 23, 42, 0.12);
--glow: 0 0 34px rgba(8, 145, 178, 0.14);
}
html[data-theme="classic"] {
--font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
--page-bg: #f5f5f5;
--surface: #ffffff;
--surface-strong: #ffffff;
--surface-soft: #f8f9fa;
--surface-hover: #f8f9fa;
--text: #333333;
--heading: #2c3e50;
--muted: #7f8c8d;
--border: #dddddd;
--accent: #3498db;
--accent-strong: #2c3e50;
--accent-soft: rgba(52, 152, 219, 0.12);
--accent-two: #667eea;
--tuang: #e74c3c;
--masuk: #27ae60;
--balance: #27ae60;
--button-text: #ffffff;
--input-bg: #ffffff;
--table-header: #34495e;
--table-row: #ffffff;
--shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
--glow: none;
--radius-lg: 10px;
--radius-md: 10px;
--radius-sm: 8px;
}
* {
box-sizing: border-box;
}
html {
min-height: 100%;
}
body {
min-height: 100vh;
margin: 0;
font-family: var(--font-family);
color: var(--text);
background: var(--page-bg);
background-attachment: fixed;
}
body::before {
position: fixed;
inset: 0;
z-index: -1;
pointer-events: none;
content: "";
background-image:
linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px),
linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
background-size: 56px 56px;
mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent 72%);
}
body::after {
position: fixed;
inset: 0;
z-index: -1;
pointer-events: none;
content: "";
opacity: 0;
}
html[data-theme="futuristic"] body::before {
opacity: 0.95;
background-image:
linear-gradient(rgba(0, 245, 255, 0.12) 1px, transparent 1px),
linear-gradient(90deg, rgba(0, 245, 255, 0.1) 1px, transparent 1px),
linear-gradient(115deg, transparent 0 48%, rgba(255, 47, 146, 0.12) 49% 51%, transparent 52% 100%);
background-size: 46px 46px, 46px 46px, 220px 220px;
mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent 86%);
}
html[data-theme="futuristic"] body::after {
opacity: 1;
background:
repeating-linear-gradient(
to bottom,
transparent 0,
transparent 8px,
rgba(0, 245, 255, 0.035) 9px
),
linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent 48%);
mix-blend-mode: screen;
}
html[data-theme="simple"] body::before,
html[data-theme="light"] body::before {
opacity: 0.35;
}
html[data-theme="classic"] body::before,
html[data-theme="classic"] body::after {
display: none;
}
button,
input,
select {
font: inherit;
}
button {
cursor: pointer;
}
[hidden] {
display: none !important;
}
.dashboard-shell {
width: min(1480px, calc(100% - 32px));
margin: 0 auto;
padding: 28px 0 44px;
}
.hero-panel,
.selected-cycle,
.section,
.metric-card,
.camera-item,
.table-card {
border: 1px solid var(--border);
background: var(--surface);
box-shadow: var(--shadow);
backdrop-filter: blur(20px);
}
html[data-theme="futuristic"] .hero-panel,
html[data-theme="futuristic"] .selected-cycle,
html[data-theme="futuristic"] .section,
html[data-theme="futuristic"] .metric-card,
html[data-theme="futuristic"] .camera-item,
html[data-theme="futuristic"] .table-card,
html[data-theme="futuristic"] .theme-card,
html[data-theme="futuristic"] .cycle-stat,
html[data-theme="futuristic"] .signal-column {
position: relative;
border-color: rgba(0, 245, 255, 0.48);
box-shadow:
inset 0 0 0 1px rgba(255, 255, 255, 0.04),
0 0 0 1px rgba(255, 47, 146, 0.18),
0 0 24px rgba(0, 245, 255, 0.2),
0 0 42px rgba(255, 47, 146, 0.13),
var(--shadow);
}
html[data-theme="futuristic"] .hero-panel::before,
html[data-theme="futuristic"] .selected-cycle::before,
html[data-theme="futuristic"] .section::before,
html[data-theme="futuristic"] .metric-card::before,
html[data-theme="futuristic"] .table-card::before,
html[data-theme="futuristic"] .theme-card::before {
position: absolute;
inset: 8px;
pointer-events: none;
content: "";
border: 1px solid rgba(255, 255, 255, 0.06);
clip-path: polygon(0 0, 70px 0, 70px 1px, 1px 1px, 1px 70px, 0 70px, 0 0, 100% 0, 100% 100%, calc(100% - 70px) 100%, calc(100% - 70px) calc(100% - 1px), calc(100% - 1px) calc(100% - 1px), calc(100% - 1px) calc(100% - 70px), 100% calc(100% - 70px));
}
.hero-panel {
position: relative;
overflow: hidden;
display: grid;
grid-template-columns: minmax(0, 1fr) 280px;
gap: 24px;
align-items: stretch;
padding: 28px;
border-radius: var(--radius-lg);
box-shadow: var(--shadow), var(--glow);
}
html[data-theme="futuristic"] .hero-panel {
border-width: 2px;
background:
linear-gradient(110deg, rgba(255, 255, 255, 0.09), transparent 18% 64%, rgba(0, 245, 255, 0.12)),
var(--surface);
}
.hero-panel::after {
position: absolute;
right: -120px;
top: -120px;
width: 280px;
height: 280px;
border-radius: 50%;
content: "";
background: radial-gradient(circle, var(--accent-soft), transparent 68%);
}
html[data-theme="futuristic"] .hero-panel::after {
inset: 0;
width: auto;
height: auto;
border-radius: 0;
background:
linear-gradient(90deg, rgba(0, 245, 255, 0.18), transparent 28%),
linear-gradient(135deg, transparent 0 66%, rgba(255, 47, 146, 0.16) 67% 72%, transparent 73% 100%);
opacity: 0.72;
}
.hero-content {
position: relative;
z-index: 1;
}
.eyebrow {
display: inline-flex;
align-items: center;
gap: 8px;
margin: 0 0 14px;
color: var(--accent-strong);
font-size: 12px;
font-weight: 800;
letter-spacing: 0.18em;
text-transform: uppercase;
}
.eyebrow::before {
width: 9px;
height: 9px;
border-radius: 999px;
content: "";
background: var(--accent);
box-shadow: 0 0 18px var(--accent);
}
html[data-theme="futuristic"] .eyebrow::after {
min-height: 26px;
padding: 0 10px;
color: var(--balance);
border: 1px solid rgba(70, 255, 159, 0.38);
border-radius: 999px;
content: "SECURE_ONLINE";
background: rgba(70, 255, 159, 0.08);
box-shadow: 0 0 18px rgba(70, 255, 159, 0.16);
}
h1,
h2,
h3,
p {
margin-top: 0;
}
h1 {
max-width: 780px;
margin-bottom: 12px;
color: var(--heading);
font-size: clamp(34px, 5vw, 64px);
line-height: 0.95;
letter-spacing: -0.05em;
}
html[data-theme="futuristic"] h1 {
text-shadow: 0 0 18px rgba(0, 245, 255, 0.28), 0 0 30px rgba(255, 47, 146, 0.18);
}
.hero-copy {
max-width: 700px;
margin-bottom: 0;
color: var(--muted);
font-size: 16px;
line-height: 1.7;
}
.theme-card {
position: relative;
z-index: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
min-height: 168px;
padding: 18px;
border: 1px solid var(--border);
border-radius: var(--radius-md);
background: var(--surface-strong);
}
.theme-card label,
.selected-cycle-label,
.metric-label,
.form-group label {
color: var(--muted);
font-size: 12px;
font-weight: 800;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.theme-select,
.selected-cycle-select,
.settings-input,
.edit-input {
width: 100%;
color: var(--text);
border: 1px solid var(--border);
background: var(--input-bg);
outline: none;
transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
.theme-select,
.selected-cycle-select,
.settings-input {
min-height: 46px;
padding: 0 14px;
border-radius: 14px;
}
.theme-select:focus,
.selected-cycle-select:focus,
.settings-input:focus,
.edit-input:focus {
border-color: var(--accent);
box-shadow: 0 0 0 4px var(--accent-soft);
}
.theme-hint {
margin: 14px 0 0;
color: var(--muted);
font-size: 13px;
line-height: 1.5;
}
.selected-cycle {
display: grid;
grid-template-columns: minmax(280px, 1.15fr) minmax(0, 2fr);
gap: 18px;
margin-top: 22px;
padding: 22px;
border-radius: var(--radius-lg);
}
.selected-cycle h2,
.section h2 {
margin-bottom: 8px;
color: var(--heading);
font-size: clamp(22px, 3vw, 32px);
letter-spacing: -0.03em;
}
.panel-subtitle,
.settings-hint,
.filter-note {
color: var(--muted);
font-size: 14px;
line-height: 1.6;
}
.selected-cycle-form {
display: flex;
gap: 10px;
margin-top: 14px;
}
.selected-cycle-button,
.settings-button,
.edit-button {
display: inline-flex;
align-items: center;
justify-content: center;
min-height: 42px;
padding: 0 16px;
color: var(--button-text);
border: 0;
border-radius: 14px;
background: linear-gradient(135deg, var(--accent), var(--accent-strong));
font-weight: 800;
transition: transform 160ms ease, opacity 160ms ease, box-shadow 160ms ease;
}
html[data-theme="futuristic"] .selected-cycle-button,
html[data-theme="futuristic"] .settings-button,
html[data-theme="futuristic"] .edit-button {
color: #031016;
border: 1px solid rgba(143, 251, 255, 0.65);
border-radius: 6px;
text-transform: uppercase;
letter-spacing: 0.08em;
box-shadow: 0 0 18px rgba(0, 245, 255, 0.28);
}
.selected-cycle-button:hover,
.settings-button:hover,
.edit-button:hover {
transform: translateY(-1px);
box-shadow: 0 12px 26px var(--accent-soft);
}
.selected-cycle-details {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 14px;
}
.cycle-stat {
min-height: 104px;
padding: 18px;
border: 1px solid var(--border);
border-radius: var(--radius-md);
background: var(--surface-soft);
}
html[data-theme="futuristic"] .cycle-stat,
html[data-theme="futuristic"] .signal-column {
background:
linear-gradient(180deg, rgba(0, 245, 255, 0.08), transparent 42%),
var(--surface-soft);
}
.selected-cycle-value {
display: block;
margin-top: 8px;
color: var(--heading);
font-size: clamp(18px, 2.2vw, 28px);
font-weight: 900;
word-break: break-word;
}
.metric-grid,
.cards {
display: grid;
grid-template-columns: repeat(7, minmax(0, 1fr));
gap: 14px;
margin: 22px 0;
}
.metric-card,
.card {
position: relative;
overflow: hidden;
min-height: 150px;
padding: 20px;
border-radius: var(--radius-md);
background: var(--surface);
}
html[data-theme="futuristic"] .metric-card {
border-width: 2px;
background:
linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 22%),
var(--surface);
}
.metric-card::after,
.card::after {
position: absolute;
inset: auto -40px -60px auto;
width: 140px;
height: 140px;
border-radius: 50%;
content: "";
background: var(--accent-soft);
}
html[data-theme="futuristic"] .metric-card::after {
inset: auto 14px 14px 14px;
width: auto;
height: 8px;
border-radius: 999px;
background: linear-gradient(90deg, var(--metric-accent, var(--accent)) 38%, transparent 38%);
border: 1px solid rgba(255, 255, 255, 0.14);
box-shadow: 0 0 14px var(--metric-accent, var(--accent));
}
.metric-card.tuang {
--metric-accent: var(--tuang);
}
.metric-card.masuk {
--metric-accent: var(--masuk);
}
.metric-card.balance {
--metric-accent: var(--balance);
}
.metric-card.neutral {
--metric-accent: var(--accent-two);
}
.metric-label,
.card h3 {
display: block;
margin-bottom: 14px;
color: var(--muted);
}
.metric-value,
.card .value {
position: relative;
z-index: 1;
color: var(--heading);
font-size: clamp(30px, 4vw, 44px);
font-weight: 950;
letter-spacing: -0.05em;
}
html[data-theme="futuristic"] .metric-value,
html[data-theme="futuristic"] .selected-cycle-value,
html[data-theme="futuristic"] .karung-count {
text-shadow: 0 0 16px rgba(0, 245, 255, 0.3);
}
.metric-card .text-value,
.card .text-value {
font-size: clamp(22px, 3vw, 32px);
word-break: break-word;
}
.metric-accent {
position: absolute;
inset: 0 auto 0 0;
width: 4px;
background: var(--metric-accent, var(--accent));
box-shadow: 0 0 22px var(--metric-accent, var(--accent));
}
.section {
margin-bottom: 22px;
padding: 22px;
border-radius: var(--radius-lg);
}
.section-header,
.table-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 18px;
margin-bottom: 18px;
}
.section-kicker {
display: block;
margin-bottom: 8px;
color: var(--accent-strong);
font-size: 12px;
font-weight: 900;
letter-spacing: 0.14em;
text-transform: uppercase;
}
html[data-theme="futuristic"] .section-kicker,
html[data-theme="futuristic"] .metric-label,
html[data-theme="futuristic"] .selected-cycle-label,
html[data-theme="futuristic"] .form-group label,
html[data-theme="futuristic"] .theme-card label {
color: #a9bdc8;
text-shadow: 0 0 12px rgba(0, 245, 255, 0.18);
}
.date-chip,
.historical-toggle-label,
.badge {
display: inline-flex;
align-items: center;
justify-content: center;
min-height: 30px;
padding: 0 12px;
border: 1px solid var(--border);
border-radius: 999px;
background: var(--accent-soft);
color: var(--accent-strong);
font-size: 12px;
font-weight: 900;
letter-spacing: 0.08em;
text-transform: uppercase;
white-space: nowrap;
}
.realtime-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 16px;
}
.signal-column {
padding: 18px;
border: 1px solid var(--border);
border-radius: var(--radius-md);
background: var(--surface-soft);
}
.signal-column h3 {
margin-bottom: 14px;
color: var(--heading);
font-size: 18px;
}
.camera-list {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
gap: 12px;
}
.camera-item {
padding: 16px;
border-radius: var(--radius-sm);
background: var(--surface-strong);
box-shadow: none;
}
.camera-item .camera-name {
margin-bottom: 8px;
color: var(--muted);
font-size: 12px;
font-weight: 700;
word-break: break-word;
}
.camera-item .karung-count {
color: var(--heading);
font-size: 24px;
font-weight: 900;
letter-spacing: -0.04em;
}
.no-data {
margin: 0;
padding: 28px;
color: var(--muted);
text-align: center;
border: 1px dashed var(--border);
border-radius: var(--radius-sm);
background: var(--surface-soft);
}
.historical-section {
overflow: hidden;
}
.historical-summary {
display: flex;
justify-content: space-between;
align-items: center;
gap: 18px;
list-style: none;
cursor: pointer;
}
.historical-summary::-webkit-details-marker {
display: none;
}
.historical-summary h2 {
margin-bottom: 0;
}
.historical-toggle-label::after {
content: "Expand";
}
.historical-section[open] .historical-toggle-label::after {
content: "Collapse";
}
.historical-content {
margin-top: 20px;
}
.table-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 16px;
}
.table-card {
padding: 18px;
border-radius: var(--radius-md);
box-shadow: none;
}
.table-title {
margin-bottom: 0;
color: var(--heading);
font-size: 20px;
}
.action-buttons {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: flex-end;
gap: 8px;
}
.save-button {
background: linear-gradient(135deg, var(--balance), #86efac);
}
.save-button:disabled {
cursor: not-allowed;
opacity: 0.45;
transform: none;
box-shadow: none;
}
.edit-status {
width: 100%;
color: var(--muted);
font-size: 12px;
font-weight: 800;
text-align: right;
}
.edit-status.has-changes {
color: var(--warning);
}
.table-scroll {
overflow-x: auto;
border: 1px solid var(--border);
border-radius: var(--radius-sm);
}
table {
width: 100%;
min-width: 520px;
border-collapse: collapse;
background: var(--table-row);
}
th,
td {
padding: 14px 16px;
text-align: left;
border-bottom: 1px solid var(--border);
}
th {
color: var(--muted);
background: var(--table-header);
font-size: 12px;
font-weight: 900;
letter-spacing: 0.1em;
text-transform: uppercase;
}
tbody tr {
transition: background-color 160ms ease;
}
tbody tr:hover {
background: var(--surface-hover);
}
tbody tr:last-child td {
border-bottom: 0;
}
.camera-cell {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
color: var(--heading);
font-weight: 800;
}
.badge-tuang {
color: var(--tuang);
background: rgba(251, 113, 133, 0.12);
}
.badge-masuk {
color: var(--masuk);
background: rgba(56, 189, 248, 0.12);
}
.edit-input {
min-width: 96px;
padding: 10px 12px;
border-radius: 12px;
font-weight: 800;
}
.edit-input:disabled {
color: var(--muted);
cursor: not-allowed;
opacity: 0.72;
}
.edit-input.is-changed {
border-color: var(--warning);
background: rgba(245, 158, 11, 0.14);
}
.settings-form {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
gap: 14px;
align-items: end;
}
.form-group {
display: flex;
flex-direction: column;
gap: 8px;
}
.settings-button {
min-height: 46px;
}
html[data-theme="classic"] body {
padding: 20px;
}
html[data-theme="classic"] .dashboard-shell {
width: 100%;
max-width: 1400px;
padding: 0;
}
html[data-theme="classic"] .hero-panel {
display: block;
padding: 0;
border: 0;
background: transparent;
box-shadow: none;
text-align: center;
}
html[data-theme="classic"] .hero-panel::after,
html[data-theme="classic"] .eyebrow,
html[data-theme="classic"] .hero-copy {
display: none;
}
html[data-theme="classic"] h1 {
max-width: none;
margin-bottom: 30px;
color: #333333;
font-size: 32px;
line-height: 1.2;
letter-spacing: 0;
}
html[data-theme="classic"] .theme-card {
align-items: flex-start;
min-height: auto;
margin: 0 0 30px auto;
padding: 15px;
border: 0;
border-left: 4px solid var(--accent);
background: #f8f9fa;
box-shadow: var(--shadow);
text-align: left;
}
html[data-theme="classic"] .theme-card label,
html[data-theme="classic"] .selected-cycle-label,
html[data-theme="classic"] .metric-label,
html[data-theme="classic"] .form-group label {
color: #2c3e50;
font-size: 12px;
font-weight: 600;
letter-spacing: 0;
text-transform: none;
}
html[data-theme="classic"] .theme-hint {
margin-top: 6px;
}
html[data-theme="classic"] .theme-select,
html[data-theme="classic"] .selected-cycle-select,
html[data-theme="classic"] .settings-input,
html[data-theme="classic"] .edit-input {
color: #333333;
border: 1px solid #cccccc;
border-radius: 5px;
background: #ffffff;
}
html[data-theme="classic"] .selected-cycle {
display: block;
margin: 0 0 30px;
padding: 18px 20px;
color: #ffffff;
border: 0;
background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
box-shadow: var(--shadow);
}
html[data-theme="classic"] .selected-cycle h2 {
color: #ffffff;
font-size: 20px;
letter-spacing: 0;
}
html[data-theme="classic"] .section-kicker,
html[data-theme="classic"] .panel-subtitle {
display: none;
}
html[data-theme="classic"] .selected-cycle-details {
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
margin-top: 12px;
gap: 12px;
}
html[data-theme="classic"] .cycle-stat {
min-height: auto;
padding: 0;
border: 0;
background: transparent;
}
html[data-theme="classic"] .selected-cycle .selected-cycle-label {
display: block;
margin-bottom: 4px;
color: #ffffff;
opacity: 0.8;
}
html[data-theme="classic"] .selected-cycle-value {
margin-top: 0;
color: #ffffff;
font-size: 18px;
font-weight: 700;
}
html[data-theme="classic"] .selected-cycle-button {
min-height: auto;
padding: 8px 12px;
border-radius: 5px;
background: #27ae60;
}
html[data-theme="classic"] .selected-cycle-button:hover {
background: #219653;
}
html[data-theme="classic"] .metric-grid,
html[data-theme="classic"] .cards {
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 20px;
margin: 0 0 30px;
}
html[data-theme="classic"] .metric-card,
html[data-theme="classic"] .card {
min-height: auto;
padding: 20px;
color: #ffffff;
border: 0;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
text-align: center;
}
html[data-theme="classic"] .metric-card::after,
html[data-theme="classic"] .card::after,
html[data-theme="classic"] .metric-accent {
display: none;
}
html[data-theme="classic"] .metric-card.tuang {
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}
html[data-theme="classic"] .metric-card.masuk {
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}
html[data-theme="classic"] .metric-card.balance {
background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}
html[data-theme="classic"] .metric-label,
html[data-theme="classic"] .metric-value,
html[data-theme="classic"] .card h3,
html[data-theme="classic"] .card .value {
color: #ffffff;
}
html[data-theme="classic"] .metric-label,
html[data-theme="classic"] .card h3 {
margin-bottom: 10px;
opacity: 0.9;
font-size: 14px;
}
html[data-theme="classic"] .metric-value,
html[data-theme="classic"] .card .value {
font-size: 36px;
font-weight: 700;
letter-spacing: 0;
}
html[data-theme="classic"] .metric-card .text-value,
html[data-theme="classic"] .card .text-value {
font-size: 24px;
}
html[data-theme="classic"] .section {
margin-bottom: 30px;
padding: 20px;
border: 0;
background: #ffffff;
box-shadow: var(--shadow);
}
html[data-theme="classic"] .section h2 {
margin-bottom: 20px;
padding-bottom: 10px;
color: #2c3e50;
border-bottom: 3px solid #3498db;
font-size: 24px;
letter-spacing: 0;
}
html[data-theme="classic"] .section-header,
html[data-theme="classic"] .table-header {
margin-bottom: 15px;
}
html[data-theme="classic"] .realtime-grid {
grid-template-columns: 1fr;
}
html[data-theme="classic"] .signal-column,
html[data-theme="classic"] .table-card {
padding: 0;
border: 0;
background: transparent;
}
html[data-theme="classic"] .signal-column + .signal-column {
margin-top: 30px;
}
html[data-theme="classic"] .signal-column h3,
html[data-theme="classic"] .table-title {
color: #2c3e50;
}
html[data-theme="classic"] .camera-list {
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 15px;
}
html[data-theme="classic"] .camera-item {
padding: 15px;
border: 2px solid #e0e0e0;
background: #ffffff;
}
html[data-theme="classic"] .camera-item .camera-name {
color: #666666;
font-size: 12px;
}
html[data-theme="classic"] .camera-item .karung-count {
color: #2c3e50;
font-size: 24px;
}
html[data-theme="classic"] .historical-toggle-label,
html[data-theme="classic"] .date-chip {
min-height: auto;
padding: 8px 12px;
border: 0;
border-radius: 5px;
background: #3498db;
color: #ffffff;
letter-spacing: 0;
text-transform: none;
}
html[data-theme="classic"] .table-grid {
grid-template-columns: 1fr;
}
html[data-theme="classic"] .table-card + .table-card {
margin-top: 22px;
}
html[data-theme="classic"] .table-scroll {
border: 0;
border-radius: 0;
}
html[data-theme="classic"] table {
min-width: 0;
margin-top: 20px;
}
html[data-theme="classic"] th,
html[data-theme="classic"] td {
padding: 12px 15px;
}
html[data-theme="classic"] th {
color: #ffffff;
background: #34495e;
letter-spacing: 0;
text-transform: none;
}
html[data-theme="classic"] .badge {
min-height: auto;
padding: 5px 10px;
border: 0;
border-radius: 5px;
font-size: 12px;
letter-spacing: 0;
}
html[data-theme="classic"] .badge-tuang {
color: #d63031;
background: #ffeaa7;
}
html[data-theme="classic"] .badge-masuk {
color: #00b894;
background: #a8e6cf;
}
html[data-theme="classic"] .settings-form {
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 15px;
}
html[data-theme="classic"] .settings-button,
html[data-theme="classic"] .edit-button {
min-height: auto;
padding: 11px 16px;
border-radius: 5px;
background: #2c3e50;
font-weight: 600;
}
html[data-theme="classic"] .settings-button:hover,
html[data-theme="classic"] .edit-button:hover {
background: #1f2d3a;
}
@media (max-width: 1200px) {
.metric-grid,
.cards {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
.table-grid {
grid-template-columns: 1fr;
}
.settings-form {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@media (max-width: 860px) {
.dashboard-shell {
width: min(100% - 20px, 760px);
padding-top: 10px;
}
.hero-panel,
.selected-cycle {
grid-template-columns: 1fr;
padding: 20px;
}
.selected-cycle-details,
.realtime-grid {
grid-template-columns: 1fr;
}
.metric-grid,
.cards {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@media (max-width: 620px) {
h1 {
font-size: 38px;
}
.metric-grid,
.cards,
.settings-form {
grid-template-columns: 1fr;
}
.section-header,
.historical-summary,
.table-header,
.selected-cycle-form {
flex-direction: column;
align-items: stretch;
}
.action-buttons {
justify-content: stretch;
}
.edit-button,
.selected-cycle-button,
.settings-button {
width: 100%;
}
.edit-status {
text-align: left;
}
}
</style>
</head>
<body>
<div class="dashboard-shell">
<header class="hero-panel">
<div class="hero-content">
<p class="eyebrow">Karung telemetry</p>
<h1>Karung Counter Dashboard</h1>
<p class="hero-copy">
Monitor realtime JSON counters, active cycle totals, balance movement, and editable database history from one responsive control surface.
</p>
</div>
<div class="theme-card">
<div>
<label for="theme-select">Theme mode</label>
<p class="theme-hint">Choose the dashboard style. Your selection is saved on this browser.</p>
</div>
<select id="theme-select" class="theme-select" aria-label="Select dashboard theme">
<option value="futuristic">Futuristic</option>
<option value="dark">Dark</option>
<option value="simple">Simple</option>
<option value="light">Light</option>
<option value="classic">Classic 20260603</option>
</select>
</div>
</header>
<section class="selected-cycle" aria-labelledby="active-cycle-title">
<div>
<span class="section-kicker">Active cycle</span>
<h2 id="active-cycle-title">Cycle Command Center</h2>
<p class="panel-subtitle">Switch the active cycle and keep every total aligned to the selected date range.</p>
<form class="selected-cycle-form" action="{{ url_for('select_dashboard_cycle') }}" method="post">
<select class="selected-cycle-select" name="cycle_name" required>
{% for cycle in cycle_options %}
<option value="{{ cycle.cycle_name }}" {% if cycle.cycle_name == dashboard_settings.cycle_name %}selected{% endif %}>{{ cycle.cycle_name }}</option>
{% endfor %}
</select>
<button class="selected-cycle-button" type="submit">Pilih</button>
</form>
</div>
<div class="selected-cycle-details">
<div class="cycle-stat">
<span class="selected-cycle-label">Cycle Name</span>
<span class="selected-cycle-value">{{ dashboard_settings.cycle_name }}</span>
</div>
<div class="cycle-stat">
<span class="selected-cycle-label">Range</span>
<span class="selected-cycle-value">{{ dashboard_settings.cycle_start or 'awal data' }} - {{ dashboard_settings.cycle_end or 'akhir data' }}</span>
</div>
<div class="cycle-stat">
<span class="selected-cycle-label">Saldo Awal</span>
<span class="selected-cycle-value">{{ dashboard_settings.saldo_awal }}</span>
</div>
<div class="cycle-stat">
<span class="selected-cycle-label">Timezone</span>
<span class="selected-cycle-value">{{ cutoff_metadata.timezone_label }}</span>
</div>
<div class="cycle-stat">
<span class="selected-cycle-label">Cutoff Tuang</span>
<span class="selected-cycle-value">{{ dashboard_settings.tuang_cutoff_time }}</span>
</div>
<div class="cycle-stat">
<span class="selected-cycle-label">Cutoff Masuk</span>
<span class="selected-cycle-value">{{ dashboard_settings.masuk_cutoff_time }}</span>
</div>
</div>
</section>
<section class="metric-grid" aria-label="Dashboard summary">
<article class="metric-card neutral">
<span class="metric-accent"></span>
<span class="metric-label">Cycle Name</span>
<div class="metric-value text-value">{{ dashboard_settings.cycle_name }}</div>
</article>
<article class="metric-card tuang">
<span class="metric-accent"></span>
<span class="metric-label">Karung Tuang Hari Ini</span>
<div id="tuang-json-total" class="metric-value">{{ tuang_json_total }}</div>
</article>
<article class="metric-card masuk">
<span class="metric-accent"></span>
<span class="metric-label">Karung Masuk Hari Ini</span>
<div id="masuk-json-total" class="metric-value">{{ masuk_json_total }}</div>
</article>
<article class="metric-card tuang">
<span class="metric-accent"></span>
<span class="metric-label">Total Tuang Siklus</span>
<div class="metric-value">{{ tuang_db_total }}</div>
</article>
<article class="metric-card masuk">
<span class="metric-accent"></span>
<span class="metric-label">Total Masuk Siklus</span>
<div class="metric-value">{{ masuk_db_total }}</div>
</article>
<article class="metric-card balance">
<span class="metric-accent"></span>
<span class="metric-label">Saldo Awal</span>
<div class="metric-value">{{ dashboard_settings.saldo_awal }}</div>
</article>
<article class="metric-card balance">
<span class="metric-accent"></span>
<span class="metric-label">Saldo Akhir</span>
<div class="metric-value">{{ saldo_akhir }}</div>
</article>
</section>
<section class="section" aria-labelledby="realtime-title">
<div class="section-header">
<div>
<span class="section-kicker">Realtime JSON</span>
<h2 id="realtime-title">Data Hari Ini</h2>
<p class="panel-subtitle">Live camera totals refreshed from the active sections API.</p>
</div>
<span class="date-chip" id="current-json-date">{{ current_date }}</span>
</div>
<div class="realtime-grid">
<div class="signal-column">
<h3>Karung Tuang</h3>
<div id="tuang-json-list" class="camera-list" {% if not tuang_json_data %}hidden{% endif %}>
{% for camera, data in tuang_json_data.items() %}
<div class="camera-item">
<div class="camera-name">{{ camera }}</div>
<div class="karung-count">{{ data.karung|default(0) }} karung</div>
</div>
{% endfor %}
</div>
<p id="tuang-json-empty" class="no-data" {% if tuang_json_data %}hidden{% endif %}>Tidak ada data karung tuang untuk hari ini</p>
</div>
<div class="signal-column">
<h3>Karung Masuk</h3>
<div id="masuk-json-list" class="camera-list" {% if not masuk_json_data %}hidden{% endif %}>
{% for camera, data in masuk_json_data.items() %}
<div class="camera-item">
<div class="camera-name">{{ camera }}</div>
<div class="karung-count">{{ data.karung|default(0) }} karung</div>
</div>
{% endfor %}
</div>
<p id="masuk-json-empty" class="no-data" {% if masuk_json_data %}hidden{% endif %}>Tidak ada data karung masuk untuk hari ini</p>
</div>
</div>
</section>
<details class="section historical-section" open>
<summary class="historical-summary">
<div>
<span class="section-kicker">Database history</span>
<h2>Data Historis</h2>
<p class="panel-subtitle">
Siklus aktif: {{ dashboard_settings.cycle_name }}. Rentang: {{ dashboard_settings.cycle_start }} sampai {{ dashboard_settings.cycle_end }}.
</p>
</div>
<span class="historical-toggle-label"></span>
</summary>
<div class="historical-content">
<div class="table-grid">
<div class="table-card">
<div class="table-header">
<h3 class="table-title">Karung Tuang</h3>
{% if tuang_db_data %}
<div class="action-buttons">
<button class="edit-button" type="button" onclick="enableTableEditor('tuang')">Edit</button>
<button id="tuang-save" class="edit-button save-button" form="tuang-edit-form" type="submit" disabled>Simpan</button>
<span id="tuang-edit-status" class="edit-status"></span>
</div>
{% endif %}
</div>
{% if tuang_db_data %}
<form id="tuang-edit-form" action="{{ url_for('edit_db_rows', db_name='tuang') }}" method="post">
<div class="table-scroll">
<table>
<thead>
<tr>
<th>Camera Name</th>
<th>Tanggal</th>
<th>Jumlah Karung</th>
</tr>
</thead>
<tbody>
{% for item in tuang_db_data %}
<tr>
<td>
<span class="camera-cell"><span class="badge badge-tuang">TUANG</span> {{ item.camera_name }}</span>
</td>
<td>{{ item.display_date }}</td>
<td>
<input class="edit-input count tuang-counter-input" type="number" name="counter_value_{{ item.id }}" value="{{ item.counter_value }}" data-original-value="{{ item.counter_value }}" min="0" step="1" required disabled>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</form>
{% else %}
<p class="no-data">Tidak ada data historis karung tuang</p>
{% endif %}
</div>
<div class="table-card">
<div class="table-header">
<h3 class="table-title">Karung Masuk</h3>
{% if masuk_db_data %}
<div class="action-buttons">
<button class="edit-button" type="button" onclick="enableTableEditor('masuk')">Edit</button>
<button id="masuk-save" class="edit-button save-button" form="masuk-edit-form" type="submit" disabled>Simpan</button>
<span id="masuk-edit-status" class="edit-status"></span>
</div>
{% endif %}
</div>
{% if masuk_db_data %}
<form id="masuk-edit-form" action="{{ url_for('edit_db_rows', db_name='masuk') }}" method="post">
<div class="table-scroll">
<table>
<thead>
<tr>
<th>Camera Name</th>
<th>Tanggal</th>
<th>Jumlah Karung</th>
</tr>
</thead>
<tbody>
{% for item in masuk_db_data %}
<tr>
<td>
<span class="camera-cell"><span class="badge badge-masuk">MASUK</span> {{ item.camera_name }}</span>
</td>
<td>{{ item.date }}</td>
<td>
<input class="edit-input count masuk-counter-input" type="number" name="counter_value_{{ item.id }}" value="{{ item.counter_value }}" data-original-value="{{ item.counter_value }}" min="0" step="1" required disabled>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</form>
{% else %}
<p class="no-data">Tidak ada data historis karung masuk</p>
{% endif %}
</div>
</div>
</div>
</details>
<section class="section" aria-labelledby="settings-title">
<div class="section-header">
<div>
<span class="section-kicker">Cycle settings</span>
<h2 id="settings-title">Pengaturan Siklus</h2>
<p class="panel-subtitle">Data historis hanya menampilkan data dalam rentang siklus.</p>
</div>
</div>
<form class="settings-form" action="{{ url_for('update_dashboard_settings') }}" method="post">
<div class="form-group">
<label for="cycle_name">Cycle Name</label>
<input id="cycle_name" class="settings-input" type="text" name="cycle_name" value="{{ dashboard_settings.cycle_name }}" required>
</div>
<div class="form-group">
<label for="cycle_start">Cycle Start</label>
<input id="cycle_start" class="settings-input" type="date" name="cycle_start" value="{{ cycle_start_picker_value }}" required>
</div>
<div class="form-group">
<label for="cycle_end">Cycle End</label>
<input id="cycle_end" class="settings-input" type="date" name="cycle_end" value="{{ cycle_end_picker_value }}" required>
</div>
<div class="form-group">
<label for="saldo_awal">Saldo Awal</label>
<input id="saldo_awal" class="settings-input" type="number" name="saldo_awal" value="{{ dashboard_settings.saldo_awal }}" min="0" step="1" required>
</div>
<div class="form-group">
<label for="tuang_cutoff_time">Karung Tuang Cutoff</label>
<select id="tuang_cutoff_time" class="settings-input" name="tuang_cutoff_time" required>
{% for cutoff_time in cutoff_time_options %}
<option value="{{ cutoff_time }}" {% if cutoff_time == dashboard_settings.tuang_cutoff_time %}selected{% endif %}>{{ cutoff_time }}</option>
{% endfor %}
</select>
</div>
<div class="form-group">
<label for="masuk_cutoff_time">Karung Masuk Cutoff</label>
<select id="masuk_cutoff_time" class="settings-input" name="masuk_cutoff_time" required>
{% for cutoff_time in cutoff_time_options %}
<option value="{{ cutoff_time }}" {% if cutoff_time == dashboard_settings.masuk_cutoff_time %}selected{% endif %}>{{ cutoff_time }}</option>
{% endfor %}
</select>
</div>
<div class="form-group">
<label for="local_timezone">Timezone Indonesia</label>
<select id="local_timezone" class="settings-input" name="local_timezone" required>
{% for timezone_name, timezone_label in timezone_options.items() %}
<option value="{{ timezone_name }}" {% if timezone_name == dashboard_settings.local_timezone %}selected{% endif %}>{{ timezone_label }}</option>
{% endfor %}
</select>
</div>
<button class="settings-button" type="submit">Simpan Pengaturan</button>
</form>
</section>
</div>
<script>
const THEME_STORAGE_KEY = 'karung-dashboard-theme';
const DASHBOARD_THEMES = ['futuristic', 'dark', 'simple', 'light', 'classic'];
function setDashboardTheme(theme) {
const selectedTheme = DASHBOARD_THEMES.includes(theme) ? theme : 'futuristic';
document.documentElement.dataset.theme = selectedTheme;
try {
localStorage.setItem(THEME_STORAGE_KEY, selectedTheme);
} catch (error) {
return selectedTheme;
}
return selectedTheme;
}
function initializeThemeSelector() {
const themeSelect = document.getElementById('theme-select');
if (!themeSelect) {
return;
}
const activeTheme = setDashboardTheme(document.documentElement.dataset.theme);
themeSelect.value = activeTheme;
themeSelect.addEventListener('change', (event) => {
setDashboardTheme(event.target.value);
});
}
function updateTableEditorStatus(tableKey) {
const counterInputs = document.querySelectorAll(`.${tableKey}-counter-input`);
const statusElement = document.getElementById(`${tableKey}-edit-status`);
if (!statusElement) {
return;
}
const changedCount = Array.from(counterInputs).filter((counterInput) => {
const isChanged = counterInput.value !== counterInput.dataset.originalValue;
counterInput.classList.toggle('is-changed', isChanged);
return isChanged;
}).length;
statusElement.classList.toggle('has-changes', changedCount > 0);
statusElement.textContent = changedCount > 0
? `${changedCount} perubahan belum disimpan`
: 'Mode edit aktif';
}
function enableTableEditor(tableKey) {
const counterInputs = document.querySelectorAll(`.${tableKey}-counter-input`);
const saveButton = document.getElementById(`${tableKey}-save`);
counterInputs.forEach((counterInput) => {
counterInput.disabled = false;
counterInput.oninput = () => updateTableEditorStatus(tableKey);
});
saveButton.disabled = false;
updateTableEditorStatus(tableKey);
if (counterInputs.length > 0) {
counterInputs[0].focus();
counterInputs[0].select();
}
}
function escapeHtml(value) {
return String(value)
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#039;');
}
function formatDisplayDate(isoDate) {
const [year, month, day] = isoDate.split('-');
if (!year || !month || !day) {
return isoDate;
}
return `${day}-${month}-${year}`;
}
function renderJsonCounterList(listElement, emptyElement, items) {
if (!items || items.length === 0) {
listElement.innerHTML = '';
listElement.hidden = true;
emptyElement.hidden = false;
return;
}
listElement.innerHTML = items.map((item) => {
const cameraName = escapeHtml(item.camera_name || '');
const karungCount = Number(item.karung || 0);
return `
<div class="camera-item">
<div class="camera-name">${cameraName}</div>
<div class="karung-count">${karungCount} karung</div>
</div>
`;
}).join('');
listElement.hidden = false;
emptyElement.hidden = true;
}
async function refreshRealtimeJsonData() {
try {
const response = await fetch('{{ url_for("get_active_cycle_sections") }}', {
headers: {
'Accept': 'application/json',
},
});
if (!response.ok) {
return;
}
const payload = await response.json();
const todaySection = payload.data.sections.today;
document.getElementById('current-json-date').textContent = todaySection.date_label || formatDisplayDate(todaySection.date);
document.getElementById('tuang-json-total').textContent = todaySection.totals.tuang;
document.getElementById('masuk-json-total').textContent = todaySection.totals.masuk;
renderJsonCounterList(
document.getElementById('tuang-json-list'),
document.getElementById('tuang-json-empty'),
todaySection.tuang
);
renderJsonCounterList(
document.getElementById('masuk-json-list'),
document.getElementById('masuk-json-empty'),
todaySection.masuk
);
} catch (error) {
console.error('Gagal memperbarui data realtime JSON.', error);
}
}
initializeThemeSelector();
refreshRealtimeJsonData();
setInterval(refreshRealtimeJsonData, 3000);
</script>
</body>
</html>