Skip to content

Commit

Permalink
in editing balance is not restricted to remaining
Browse files Browse the repository at this point in the history
  • Loading branch information
ap-justin committed Sep 11, 2024
1 parent 78524ed commit 33516a4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/pages/Admin/Charity/Dashboard/MoveFundForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ export function MoveFundForm(props: IMoveFundForm) {
(n) =>
n
.min(0, "can't be negative")
.max(props.balance, "can't be more than balance")
.max(
props.effect === "append"
? props.balance
: props.balance + (props.initAmount ?? 0),
"can't be more than balance"
)
),
})
),
Expand Down Expand Up @@ -71,7 +76,8 @@ export function MoveFundForm(props: IMoveFundForm) {
</p>
<Field className="grid">
<Label className="font-semibold mb-1">
Amount <span className="text-red">*</span>
{props.effect === "override" ? "Edit amount" : "Amount"}
<span className="text-red"> *</span>
</Label>
<Input
placeholder="e.g. $ 100"
Expand Down

0 comments on commit 33516a4

Please sign in to comment.