Fix issue
This commit is contained in:
parent
0758e66d4f
commit
f2a180e69f
@ -30,13 +30,13 @@ export function SelectAccountDialog(p: {
|
|||||||
const accounts = useAccounts();
|
const accounts = useAccounts();
|
||||||
|
|
||||||
const [choice, setChoice] = React.useState<Account | null>(null);
|
const [choice, setChoice] = React.useState<Account | null>(null);
|
||||||
console.log(choice);
|
|
||||||
const submit = () => {
|
const submit = () => {
|
||||||
if (choice) p.onSelected(choice);
|
if (choice) p.onSelected(choice);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={p.open} onClose={p.onClose}>
|
<Dialog open={p.open} onClose={() => p.onClose()}>
|
||||||
<DialogTitle>{p.title}</DialogTitle>
|
<DialogTitle>{p.title}</DialogTitle>
|
||||||
<DialogContent dividers>
|
<DialogContent dividers>
|
||||||
<DialogContentText>{p.description}</DialogContentText>
|
<DialogContentText>{p.description}</DialogContentText>
|
||||||
@ -72,7 +72,7 @@ export function SelectAccountDialog(p: {
|
|||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button onClick={p.onClose}>Cancel</Button>
|
<Button onClick={() => p.onClose()}>Cancel</Button>
|
||||||
<Button onClick={submit} autoFocus disabled={choice === null}>
|
<Button onClick={submit} autoFocus disabled={choice === null}>
|
||||||
{p.confirmButton ?? "Submit"}
|
{p.confirmButton ?? "Submit"}
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -107,17 +107,17 @@ function MovementsTable(p: {
|
|||||||
|
|
||||||
// Change account of movement
|
// Change account of movement
|
||||||
const handleMoveClick = async (movement: Movement) => {
|
const handleMoveClick = async (movement: Movement) => {
|
||||||
const target = await chooseAccount(
|
const targetAccount = await chooseAccount(
|
||||||
"Transfer movement",
|
"Transfer movementd",
|
||||||
`Please select the target account that will receive the movement: ${movement.label} (${movement.amount} €)`,
|
`Please select the target account that will receive the movement: ${movement.label} (${movement.amount} €)`,
|
||||||
"Transfer movement",
|
"Transfer movement",
|
||||||
[accounts.get(movement.account_id)!]
|
[accounts.get(movement.account_id)!]
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!target) return;
|
if (!targetAccount) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
movement.account_id = target.id;
|
movement.account_id = targetAccount.id;
|
||||||
|
|
||||||
await MovementApi.Update(movement);
|
await MovementApi.Update(movement);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user