fix feed initial balance and report button

This commit is contained in:
Alberto-Audrix committed 2026-09-01 08:38:16 +07:00
1 parent 30a736641f
commit 569d7c6bb6
9 files changed
+135 -24

No files matched your search

+9 -3
View File
@@ -4,18 +4,24 @@ import { formatNumber } from '../../utils/format.ts';
interface FeedSaldoCardProps {
latest: Karung | null;
feedInitialBalance: number;
cycleStartDate: string;
displayDate: string;
}
const FeedSaldoCard: React.FC<FeedSaldoCardProps> = ({ latest, cycleStartDate, displayDate }) => {
const FeedSaldoCard: React.FC<FeedSaldoCardProps> = ({
latest,
feedInitialBalance,
cycleStartDate,
displayDate,
}) => {
const saldoData = useMemo(() => {
const inbound = latest?.in_total ?? 0;
const inbound = latest?.in_total ?? feedInitialBalance;
const feedUse = latest?.feed_use_total ?? 0;
const keluar = latest?.out_total ?? 0;
const saldo = inbound - feedUse - keluar;
return { inbound, feedUse, keluar, saldo };
}, [latest]);
}, [latest, feedInitialBalance]);
const formatDateRange = useMemo(() => {
const formatDate = (iso: string) =>