Files
karung-web-admin/templates/index.html
T

1893 lines
63 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: block;
padding: 0 0 20px;
border: 0;
background: transparent;
box-shadow: none;
}
.hero-content h1 {
margin-bottom: 0;
}
.dashboard-toolbar {
display: flex;
flex-wrap: wrap;
align-items: end;
gap: 14px 18px;
margin: 18px 0 24px;
padding: 16px 18px;
border: 1px solid var(--border);
border-radius: var(--radius-md);
background: var(--surface-strong);
}
.toolbar-group {
display: grid;
gap: 6px;
min-width: 180px;
flex: 1 1 180px;
}
.toolbar-group-end {
margin-left: auto;
flex: 0 1 220px;
}
.toolbar-group label {
color: var(--muted);
font-size: 12px;
font-weight: 800;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.toolbar-select {
width: 100%;
min-height: 42px;
padding: 0 14px;
color: var(--text);
border: 1px solid var(--border);
border-radius: 12px;
background: var(--input-bg);
outline: none;
}
.toolbar-select:focus {
border-color: var(--accent);
box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}
.cycle-summary-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
gap: 14px;
margin-top: 16px;
}
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: flex-start;
gap: 12px;
min-height: 168px;
padding: 18px;
border: 1px solid var(--border);
border-radius: var(--radius-md);
background: var(--surface-strong);
}
.selector-stack {
display: grid;
gap: 12px;
}
.theme-card label,
.selected-cycle-label,
.metric-label {
color: var(--muted);
font-size: 12px;
font-weight: 800;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.theme-select {
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 {
min-height: 46px;
padding: 0 14px;
border-radius: 14px;
}
.theme-select: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;
gap: 18px;
margin-top: 22px;
padding: 22px;
border-radius: var(--radius-lg);
}
.selected-cycle-header {
display: grid;
gap: 8px;
}
.selected-cycle h2,
.section h2 {
margin-bottom: 8px;
color: var(--heading);
font-size: clamp(22px, 3vw, 32px);
letter-spacing: -0.03em;
}
.panel-subtitle,
.filter-note {
color: var(--muted);
font-size: 14px;
line-height: 1.6;
}
.selected-cycle-details {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 14px;
}
.kandang-cycle-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 14px;
}
.kandang-cycle-card {
display: grid;
gap: 8px;
}
.kandang-cycle-meta {
color: var(--muted);
font-size: 13px;
line-height: 1.5;
}
.feed-balance-section {
margin-top: 22px;
padding-top: 22px;
border-top: 1px solid var(--border);
}
.feed-balance-section h3 {
margin-bottom: 14px;
color: var(--heading);
font-size: 18px;
}
.feed-balance-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
gap: 14px;
}
.feed-balance-card {
display: grid;
gap: 10px;
min-height: 120px;
padding: 18px;
border: 1px solid var(--border);
border-radius: var(--radius-md);
background: var(--surface-soft);
}
.feed-balance-value {
color: var(--heading);
font-size: 28px;
font-weight: 700;
line-height: 1.1;
}
.feed-balance-meta {
color: var(--muted);
font-size: 13px;
line-height: 1.5;
}
.feed-balance-status {
display: inline-flex;
align-items: center;
width: fit-content;
padding: 6px 10px;
border-radius: 999px;
font-size: 12px;
font-weight: 700;
letter-spacing: 0.04em;
text-transform: uppercase;
}
.feed-balance-status.match {
color: #166534;
background: rgba(34, 197, 94, 0.16);
}
.feed-balance-status.mismatch {
color: #991b1b;
background: rgba(239, 68, 68, 0.16);
}
.feed-balance-status.pending {
color: #92400e;
background: rgba(245, 158, 11, 0.16);
}
.feed-balance-date {
color: var(--heading);
font-size: 18px;
font-weight: 600;
}
.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;
}
.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);
}
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"] .dashboard-toolbar {
margin: 0 0 24px;
padding: 14px 16px;
border: 1px solid #dddddd;
border-radius: 8px;
background: #f8f9fa;
box-shadow: var(--shadow);
text-align: left;
}
html[data-theme="classic"] .toolbar-group label {
color: #2c3e50;
font-size: 12px;
font-weight: 600;
letter-spacing: 0;
text-transform: none;
}
html[data-theme="classic"] .toolbar-select {
color: #333333;
border: 1px solid #cccccc;
border-radius: 5px;
background: #ffffff;
}
html[data-theme="classic"] .theme-card {
display: none;
}
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: 18px;
color: #333333;
font-size: 32px;
line-height: 1.2;
letter-spacing: 0;
}
html[data-theme="classic"] .selected-cycle-label,
html[data-theme="classic"] .metric-label {
color: #2c3e50;
font-size: 12px;
font-weight: 600;
letter-spacing: 0;
text-transform: none;
}
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,
html[data-theme="classic"] .cycle-summary-grid {
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"] .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;
}
@media (max-width: 1200px) {
.metric-grid,
.cards {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
.table-grid {
grid-template-columns: 1fr;
}
}
@media (max-width: 860px) {
.dashboard-shell {
width: min(100% - 20px, 760px);
padding-top: 10px;
}
.hero-panel,
.selected-cycle,
.dashboard-toolbar {
grid-template-columns: 1fr;
padding: 20px;
}
.toolbar-group,
.toolbar-group-end {
min-width: 100%;
margin-left: 0;
flex-basis: 100%;
}
.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 {
grid-template-columns: 1fr;
}
.section-header,
.historical-summary,
.table-header {
flex-direction: column;
align-items: stretch;
}
}
</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 database history from one responsive control surface.
</p>
</div>
</header>
<div class="dashboard-toolbar" aria-label="Dashboard filters">
<div class="toolbar-group">
<label for="kandang-select">Kandang</label>
<select id="kandang-select" class="toolbar-select" aria-label="Select kandang">
{% for option in kandang_options %}
<option value="{{ option.k_index }}" data-kandang-id="{{ option.kandang_id }}" {% if option.k_index == selected_k_index %}selected{% endif %}>
{{ option.label }}
</option>
{% endfor %}
</select>
</div>
<div class="toolbar-group">
<label for="cycle-select">Cycle</label>
<select id="cycle-select" class="toolbar-select" aria-label="Select cycle"></select>
</div>
<div class="toolbar-group toolbar-group-end">
<label for="theme-select">Theme</label>
<select id="theme-select" class="toolbar-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>
</div>
<section class="selected-cycle" aria-labelledby="active-cycle-title">
<div class="selected-cycle-header">
<span class="section-kicker">Active cycle</span>
<h2 id="active-cycle-title">Cycle Command Center</h2>
</div>
{% if selected_cycle %}
<div class="cycle-summary-grid">
<div class="cycle-stat">
<span class="selected-cycle-label">Kandang</span>
<span class="selected-cycle-value">
{% if selected_cycle.k_index %}K{{ selected_cycle.k_index }}{% endif %}{% if selected_cycle.kandang_name %} · {{ selected_cycle.kandang_name }}{% endif %}
</span>
</div>
<div class="cycle-stat">
<span class="selected-cycle-label">Status</span>
<span class="selected-cycle-value">{{ selected_cycle.status or '-' }}</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>
{% else %}
<p class="no-data">Tidak ada data siklus kandang yang tersedia.</p>
{% endif %}
</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 id="metric-cycle-name" class="metric-value text-value">{{ selected_cycle.cycle_name if selected_cycle else 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 id="metric-tuang-db-total" 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 id="metric-masuk-db-total" 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 id="metric-saldo-awal" class="metric-value">{{ display_saldo_awal }}</div>
</article>
<article class="metric-card balance">
<span class="metric-accent"></span>
<span class="metric-label">Saldo Akhir</span>
<div id="metric-saldo-akhir" 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>
<div class="feed-balance-section" aria-labelledby="feed-balance-title">
<h3 id="feed-balance-title">Saldo Awal Pakan</h3>
<div id="feed-balance-list" class="feed-balance-grid" {% if not feed_initial_balances %}hidden{% endif %}>
{% for item in feed_initial_balances %}
<div class="feed-balance-card">
<span class="selected-cycle-label">{{ item.source }}</span>
<span class="feed-balance-value">{{ item.feed_initial_balance }} karung</span>
<span class="feed-balance-date">{{ item.feed_initial_balance_date or 'belum diatur' }}</span>
<span class="feed-balance-meta">
IoT {{ item.source }}:
{% if item.iot_value is not none %}{{ item.iot_value }} karung{% else %}belum ada data{% endif %}
</span>
{% if item.verification_status == 'match' %}
<span class="feed-balance-status match">Cocok dengan IoT</span>
{% elif item.verification_status == 'mismatch' %}
<span class="feed-balance-status mismatch">Tidak cocok dengan IoT</span>
{% elif item.verification_status == 'no_date' %}
<span class="feed-balance-status pending">Tanggal belum diatur</span>
{% else %}
<span class="feed-balance-status pending">Belum ada data IoT</span>
{% endif %}
</div>
{% endfor %}
</div>
<p id="feed-balance-empty" class="no-data" {% if feed_initial_balances %}hidden{% endif %}>Tidak ada data saldo awal pakan untuk kandang ini</p>
</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 per kandang (K1 = Kandang 1, K2 = Kandang 2, dst). Data historis difilter sesuai siklus masing-masing kandang.
</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>
</div>
{% if tuang_db_data %}
<div class="table-scroll">
<table>
<thead>
<tr>
<th>Nama</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.source }}</span>
</td>
<td>{{ item.display_date }}</td>
<td>{{ item.counter_value }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% 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>
</div>
{% if masuk_db_data %}
<div class="table-scroll">
<table>
<thead>
<tr>
<th>Nama</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.source }}</span>
</td>
<td>{{ item.display_date }}</td>
<td>{{ item.counter_value }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p class="no-data">Tidak ada data historis karung masuk</p>
{% endif %}
</div>
</div>
</div>
</details>
</div>
<script>
const THEME_STORAGE_KEY = 'karung-dashboard-theme';
const KANDANG_STORAGE_KEY = 'karung-dashboard-kandang';
const CYCLE_STORAGE_KEY = 'karung-dashboard-cycle';
const DASHBOARD_THEMES = ['futuristic', 'dark', 'simple', 'light', 'classic'];
const CYCLES_BY_KANDANG = {{ cycles_by_kandang | tojson }};
const INITIAL_SELECTION = {
kIndex: {{ selected_k_index | tojson }},
cycleId: {{ selected_cycle_id | tojson }},
};
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 getSelectedKandangId() {
const kandangSelect = document.getElementById('kandang-select');
if (!kandangSelect || kandangSelect.selectedOptions.length === 0) {
return null;
}
return kandangSelect.selectedOptions[0].dataset.kandangId || null;
}
function populateCycleOptions(kandangId, selectedCycleId) {
const cycleSelect = document.getElementById('cycle-select');
if (!cycleSelect) {
return;
}
const cycles = CYCLES_BY_KANDANG[String(kandangId)] || [];
cycleSelect.innerHTML = cycles.map((cycle) => {
const label = `${cycle.cycle_start || 'awal data'} - ${cycle.cycle_end || 'akhir data'}${cycle.status ? ` (${cycle.status})` : ''}`;
const selected = String(cycle.id) === String(selectedCycleId) ? 'selected' : '';
return `<option value="${cycle.id}" ${selected}>${escapeHtml(label)}</option>`;
}).join('');
cycleSelect.disabled = cycles.length === 0;
}
function navigateToSelection(kIndex, cycleId) {
if (!kIndex) {
return;
}
try {
localStorage.setItem(KANDANG_STORAGE_KEY, String(kIndex));
if (cycleId) {
localStorage.setItem(CYCLE_STORAGE_KEY, String(cycleId));
}
} catch (error) {
// Ignore storage errors.
}
const params = new URLSearchParams();
params.set('k_index', String(kIndex));
if (cycleId) {
params.set('cycle_id', String(cycleId));
}
window.location.search = params.toString();
}
function initializeKandangSelectors() {
const kandangSelect = document.getElementById('kandang-select');
const cycleSelect = document.getElementById('cycle-select');
if (!kandangSelect || !cycleSelect) {
return;
}
const urlParams = new URLSearchParams(window.location.search);
let kIndex = urlParams.get('k_index');
let cycleId = urlParams.get('cycle_id');
if (!kIndex) {
try {
kIndex = localStorage.getItem(KANDANG_STORAGE_KEY);
cycleId = localStorage.getItem(CYCLE_STORAGE_KEY);
} catch (error) {
kIndex = null;
cycleId = null;
}
}
if (kIndex && String(kIndex) !== String(INITIAL_SELECTION.kIndex)) {
navigateToSelection(kIndex, cycleId || INITIAL_SELECTION.cycleId);
return;
}
populateCycleOptions(getSelectedKandangId(), INITIAL_SELECTION.cycleId);
kandangSelect.addEventListener('change', () => {
const nextKandangId = getSelectedKandangId();
const cycles = CYCLES_BY_KANDANG[String(nextKandangId)] || [];
const nextCycleId = cycles.length ? cycles[0].id : null;
navigateToSelection(kandangSelect.value, nextCycleId);
});
cycleSelect.addEventListener('change', () => {
navigateToSelection(kandangSelect.value, cycleSelect.value);
});
}
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 sourceName = escapeHtml(item.source || '');
const karungCount = Number(item.karung || 0);
return `
<div class="camera-item">
<div class="camera-name">${sourceName}</div>
<div class="karung-count">${karungCount} karung</div>
</div>
`;
}).join('');
listElement.hidden = false;
emptyElement.hidden = true;
}
function getFeedBalanceStatusLabel(status) {
if (status === 'match') {
return { className: 'match', label: 'Cocok dengan IoT' };
}
if (status === 'mismatch') {
return { className: 'mismatch', label: 'Tidak cocok dengan IoT' };
}
if (status === 'no_date') {
return { className: 'pending', label: 'Tanggal belum diatur' };
}
return { className: 'pending', label: 'Belum ada data IoT' };
}
function renderFeedInitialBalances(items) {
const listElement = document.getElementById('feed-balance-list');
const emptyElement = document.getElementById('feed-balance-empty');
if (!listElement || !emptyElement) {
return;
}
if (!items || items.length === 0) {
listElement.innerHTML = '';
listElement.hidden = true;
emptyElement.hidden = false;
return;
}
listElement.innerHTML = items.map((item) => {
const sourceName = escapeHtml(item.source || '');
const balanceValue = Number(item.feed_initial_balance || 0);
const balanceDate = escapeHtml(item.feed_initial_balance_date || 'belum diatur');
const iotValue = item.iot_value;
const iotLabel = iotValue === null || iotValue === undefined
? 'belum ada data'
: `${Number(iotValue)} karung`;
const status = getFeedBalanceStatusLabel(item.verification_status);
return `
<div class="feed-balance-card">
<span class="selected-cycle-label">${sourceName}</span>
<span class="feed-balance-value">${balanceValue} karung</span>
<span class="feed-balance-date">${balanceDate}</span>
<span class="feed-balance-meta">IoT ${sourceName}: ${escapeHtml(iotLabel)}</span>
<span class="feed-balance-status ${status.className}">${status.label}</span>
</div>
`;
}).join('');
listElement.hidden = false;
emptyElement.hidden = true;
}
async function refreshRealtimeJsonData() {
try {
const kandangSelect = document.getElementById('kandang-select');
const cycleSelect = document.getElementById('cycle-select');
const params = new URLSearchParams();
if (kandangSelect && kandangSelect.value) {
params.set('k_index', kandangSelect.value);
}
if (cycleSelect && cycleSelect.value) {
params.set('cycle_id', cycleSelect.value);
}
const query = params.toString();
const endpoint = query
? `{{ url_for("get_active_cycle_sections") }}?${query}`
: '{{ url_for("get_active_cycle_sections") }}';
const response = await fetch(endpoint, {
headers: {
'Accept': 'application/json',
},
});
if (!response.ok) {
return;
}
const payload = await response.json();
const todaySection = payload.data.sections.today;
const selectedCycle = payload.data.cycle || {};
const totals = payload.data.totals || {};
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;
document.getElementById('metric-cycle-name').textContent = selectedCycle.name || '';
document.getElementById('metric-tuang-db-total').textContent = totals.tuang_db_total ?? 0;
document.getElementById('metric-masuk-db-total').textContent = totals.masuk_db_total ?? 0;
document.getElementById('metric-saldo-awal').textContent = totals.saldo_awal ?? 0;
document.getElementById('metric-saldo-akhir').textContent = totals.saldo_akhir ?? 0;
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
);
renderFeedInitialBalances(payload.data.feed_initial_balances || []);
} catch (error) {
console.error('Gagal memperbarui data realtime JSON.', error);
}
}
initializeThemeSelector();
initializeKandangSelectors();
refreshRealtimeJsonData();
setInterval(refreshRealtimeJsonData, 3000);
</script>
</body>
</html>