fix feed initial balance and report button
This commit is contained in:
1 parent
30a736641f
commit
569d7c6bb6
9 files changed
+135
-24
No files matched your search
@@ -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) =>
|
||||
|
||||
Reference in new issue
Block a user