Refine arrival filters and demo date behavior
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
type StationBadge struct {
|
||||
@@ -141,7 +142,10 @@ func GetStationProgress(mcuID int, date string) (map[int][]StationBadge, error)
|
||||
sp.Mcu_StationProgressPreregisterID,
|
||||
sp.Mcu_StationProgressStationName,
|
||||
CASE
|
||||
WHEN sp.Mcu_StationProgressDoneAt IS NOT NULL THEN 'success'
|
||||
WHEN sp.Mcu_StationProgressSource = 'lab'
|
||||
AND sp.Mcu_StationProgressReceiveAt IS NOT NULL THEN 'success'
|
||||
WHEN sp.Mcu_StationProgressSource = 'nonlab'
|
||||
AND sp.Mcu_StationProgressDoneAt IS NOT NULL THEN 'success'
|
||||
WHEN sp.Mcu_StationProgressProcessAt IS NOT NULL
|
||||
OR sp.Mcu_StationProgressReceiveAt IS NOT NULL
|
||||
OR sp.Mcu_StationProgressSamplingAt IS NOT NULL THEN 'warning'
|
||||
@@ -293,6 +297,12 @@ func activeDateOrLatest(dates []string, selected string, fallback string) string
|
||||
}
|
||||
}
|
||||
}
|
||||
today := time.Now().Format("2006-01-02")
|
||||
for _, d := range dates {
|
||||
if d == today {
|
||||
return today
|
||||
}
|
||||
}
|
||||
if len(dates) > 0 {
|
||||
return dates[0]
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
set -euo pipefail
|
||||
|
||||
MCU_ID=9999
|
||||
TODAY="2026-04-30"
|
||||
TODAY="$(date '+%Y-%m-%d')"
|
||||
SPEED="${1:-8}"
|
||||
|
||||
DB() { mysql -u admin -p'Sasone!102938' cpone_dashboard -sN -e "$1" 2>/dev/null; }
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
</section>
|
||||
|
||||
<section class="card p-4">
|
||||
<form method="get" action="{{b "/arrival"}}" class="grid gap-3 md:grid-cols-3">
|
||||
<form id="arrival-filter-form" method="get" action="{{b "/arrival"}}" class="grid gap-3 md:grid-cols-3">
|
||||
<input type="hidden" name="date" value="{{.Date}}"/>
|
||||
<div class="md:col-span-2">
|
||||
<label for="search" class="mb-2 block text-sm font-medium text-slate-600">Search Participant</label>
|
||||
@@ -99,7 +99,7 @@
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section class="card overflow-hidden">
|
||||
<section id="arrival-live-list" class="card overflow-hidden">
|
||||
<div class="flex items-center justify-between border-b border-slate-100 px-5 py-3">
|
||||
<div>
|
||||
<h2 class="text-base font-semibold text-slate-700">Live Arrival List</h2>
|
||||
@@ -206,6 +206,24 @@
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
const arrivalFilterForm = document.getElementById('arrival-filter-form');
|
||||
if (arrivalFilterForm) {
|
||||
arrivalFilterForm.addEventListener('submit', function () {
|
||||
sessionStorage.setItem('arrival-scroll-to-list', '1');
|
||||
});
|
||||
}
|
||||
|
||||
const shouldScrollToList = sessionStorage.getItem('arrival-scroll-to-list') === '1';
|
||||
if (shouldScrollToList) {
|
||||
sessionStorage.removeItem('arrival-scroll-to-list');
|
||||
const listSection = document.getElementById('arrival-live-list');
|
||||
if (listSection) {
|
||||
requestAnimationFrame(function () {
|
||||
listSection.scrollIntoView({ behavior: 'auto', block: 'start' });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const overviewData = {{.OverviewJSON}};
|
||||
const stationData = {{.DepartmentJSON}};
|
||||
const deptColors = ['#f59e0b', '#8b5cf6', '#f97316', '#06b6d4', '#ec4899', '#84cc16', '#14b8a6'];
|
||||
@@ -235,7 +253,8 @@
|
||||
type: 'pie',
|
||||
radius: ['28%', '45%'],
|
||||
center: ['38%', '48%'],
|
||||
label: { color: '#334155', formatter: '{b}' },
|
||||
label: { show: false },
|
||||
labelLine: { show: false },
|
||||
data: [
|
||||
{ value: overviewData.checkedIn || 0, name: 'Checked In' },
|
||||
{ value: overviewData.pending || 0, name: 'Not Check-in Yet' }
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
</section>
|
||||
|
||||
<section class="card p-4">
|
||||
<form method="get" action="{{b "/progress"}}" class="grid gap-3 md:grid-cols-3">
|
||||
<form id="progress-filter-form" method="get" action="{{b "/progress"}}" class="grid gap-3 md:grid-cols-3">
|
||||
<div class="md:col-span-2">
|
||||
<label for="search" class="mb-2 block text-sm font-medium text-slate-600">Search Patient</label>
|
||||
<input id="search" name="search" value="{{.Search}}" type="text" placeholder="Nama atau Employee ID"
|
||||
@@ -96,7 +96,7 @@
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section class="card overflow-hidden">
|
||||
<section id="progress-list" class="card overflow-hidden">
|
||||
<div class="flex items-center justify-between border-b border-slate-100 px-5 py-3">
|
||||
<div>
|
||||
<h2 class="text-base font-semibold text-slate-700">Patient Resume List</h2>
|
||||
@@ -193,4 +193,25 @@
|
||||
</div>
|
||||
{{end}}
|
||||
</section>
|
||||
<script>
|
||||
(function() {
|
||||
const progressFilterForm = document.getElementById('progress-filter-form');
|
||||
if (progressFilterForm) {
|
||||
progressFilterForm.addEventListener('submit', function () {
|
||||
sessionStorage.setItem('progress-scroll-to-list', '1');
|
||||
});
|
||||
}
|
||||
|
||||
const shouldScrollToList = sessionStorage.getItem('progress-scroll-to-list') === '1';
|
||||
if (shouldScrollToList) {
|
||||
sessionStorage.removeItem('progress-scroll-to-list');
|
||||
const listSection = document.getElementById('progress-list');
|
||||
if (listSection) {
|
||||
requestAnimationFrame(function () {
|
||||
listSection.scrollIntoView({ behavior: 'auto', block: 'start' });
|
||||
});
|
||||
}
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
{{end}}
|
||||
|
||||
Reference in New Issue
Block a user