update warning billing sign

This commit is contained in:
A R
2026-04-14 22:19:23 +07:00
parent a6af3d5f3f
commit ec2f340e13
5 changed files with 914 additions and 463 deletions
+5 -5
View File
@@ -23,8 +23,8 @@
"@capacitor/cli": "^8.0.0",
"@tailwindcss/postcss": "^4",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"@vercel/speed-insights": "^1.3.1",
"babel-plugin-react-compiler": "1.0.0",
"cross-env": "^7.0.3",
@@ -2611,9 +2611,9 @@
}
},
"node_modules/@types/react": {
"version": "19.2.7",
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.7.tgz",
"integrity": "sha512-MWtvHrGZLFttgeEj28VXHxpmwYbor/ATPYbBfSFZEIRK0ecCFLl2Qo55z52Hss+UV9CRN7trSeq1zbgx7YDWWg==",
"version": "19.2.14",
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.14.tgz",
"integrity": "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==",
"dev": true,
"license": "MIT",
"dependencies": {
+3 -3
View File
@@ -40,8 +40,8 @@
"@capacitor/cli": "^8.0.0",
"@tailwindcss/postcss": "^4",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"@vercel/speed-insights": "^1.3.1",
"babel-plugin-react-compiler": "1.0.0",
"cross-env": "^7.0.3",
@@ -52,4 +52,4 @@
"tailwindcss": "^4",
"typescript": "^5"
}
}
}
@@ -441,6 +441,13 @@ const INACBG_Admin_Ruangan = ({
const totalKlaim = data.total_klaim || 0;
setTotalKlaimOriginal(totalKlaim);
console.log(`💰 Set totalKlaimOriginal: ${totalKlaim}`);
// Seed liveBillingSign dari nilai tersimpan di DB, supaya display awal sesuai dengan BE
// Akan di-overwrite otomatis oleh useEffect saat user mengubah kode INACBG
if (data.billing_sign) {
setLiveBillingSign(data.billing_sign);
console.log(`🎨 Seeded liveBillingSign from DB: ${data.billing_sign}`);
}
// DONT set totalKlaimBPJS here - biarkan useEffect calculate yang set nilai dengan benar
// Jadi jangan: setTotalKlaimBPJS(totalKlaim);
@@ -777,15 +784,15 @@ const INACBG_Admin_Ruangan = ({
const percentage = (totalTarifRS / totalKlaimBPJS) * 100;
console.log(`📊 Percentage: ${percentage.toFixed(2)}% `);
if (percentage <= 25) {
console.log("✅ Returning: Hijau (<=25%)");
return "Hijau"; // Tarif RS <=25% dari Klaim BPJS Efektif = AMAN
} else if (percentage <= 50) {
console.log("✅ Returning: Kuning (26-50%)");
return "Kuning"; // 26%-50% = PERLU PERHATIAN
if (percentage <= 70) {
console.log("✅ Returning: Hijau (<=70%)");
return "Hijau"; // Tarif RS <=70% dari Klaim BPJS Efektif = AMAN
} else if (percentage > 70 && percentage <= 99) {
console.log("✅ Returning: Kuning (71-99%)");
return "Kuning"; // 71%-99% = PERLU PERHATIAN
} else {
console.log("✅ Returning: Merah (>50%)");
return "Merah"; // >50% = WASPADA
console.log("✅ Returning: Merah (>99%)");
return "Merah"; // >99% = WASPADA
}
};
@@ -1581,9 +1588,9 @@ rounded - lg text - left transition - all
} `}
>
{liveBillingSign === "" && "Belum bisa dihitung (isi data klaim & tarif dulu)"}
{liveBillingSign === "Hijau" && "Hijau - AMAN (<= 25%)"}
{liveBillingSign === "Kuning" && "Kuning - PERHATIAN (26% - 50%)"}
{liveBillingSign === "Merah" && "Merah - WASPADA (> 50%)"}
{liveBillingSign === "Hijau" && "Hijau - AMAN (<= 70%)"}
{liveBillingSign === "Kuning" && "Kuning - PERHATIAN (71% - 99%)"}
{liveBillingSign === "Merah" && "Merah - WASPADA (>= 100%)"}
</div>
</div>
File diff suppressed because it is too large Load Diff
@@ -188,17 +188,18 @@ const RiwayatBillingPasien = ({ onLogout, userRole, onEdit, selectedRuangan }: R
};
// Hitung warning sign secara dinamis berdasarkan current tarif RS vs existing klaim
// This ensures warning updates even if INACBG hasn't been input yet
// Threshold harus konsisten dengan calculateBillingSign di billing-pasien & INACBG_Admin_Ruangan:
// <=70% = Hijau, 71-99% = Kuning, >=100% = Merah
const calculateDynamicWarningSign = (totalTarifRS: number | undefined, totalKlaim: number | undefined): string => {
if (!totalTarifRS || !totalKlaim || totalTarifRS <= 0 || totalKlaim <= 0) {
return ""; // No data to calculate
}
const percentage = (totalTarifRS / totalKlaim) * 100;
if (percentage <= 25) {
if (percentage <= 70) {
return "Hijau"; // Safe
} else if (percentage <= 50) {
} else if (percentage <= 99) {
return "Kuning"; // Warning
} else {
return "Merah"; // Alert