Fix ESLint issues
This commit is contained in:
parent
91e5d8af31
commit
5aa954dca2
@ -63,7 +63,7 @@ export class MovementApi {
|
|||||||
limit?: number;
|
limit?: number;
|
||||||
}
|
}
|
||||||
): Promise<Movement[]> {
|
): Promise<Movement[]> {
|
||||||
let filtersS = new URLSearchParams();
|
const filtersS = new URLSearchParams();
|
||||||
if (filters) {
|
if (filters) {
|
||||||
if (filters.amount_min)
|
if (filters.amount_min)
|
||||||
filtersS.append("amount_min", filters.amount_min.toString());
|
filtersS.append("amount_min", filters.amount_min.toString());
|
||||||
|
@ -65,7 +65,7 @@ export function AttachInboxEntryToMovementDialog(p: {
|
|||||||
</Typography>
|
</Typography>
|
||||||
{Number.isFinite(p.entry.amount) &&
|
{Number.isFinite(p.entry.amount) &&
|
||||||
value !== undefined &&
|
value !== undefined &&
|
||||||
p.entry.amount !== value?.amount && (
|
p.entry.amount !== value.amount && (
|
||||||
<Alert severity="warning">Amount mismatch!</Alert>
|
<Alert severity="warning">Amount mismatch!</Alert>
|
||||||
)}
|
)}
|
||||||
<Button
|
<Button
|
||||||
|
@ -13,7 +13,7 @@ export function AttachMultipleInboxEntriesDialog(p: {
|
|||||||
entries: InboxEntry[];
|
entries: InboxEntry[];
|
||||||
movements: Movement[][];
|
movements: Movement[][];
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
onSelected: (mapping: Array<number | undefined>) => void;
|
onSelected: (mapping: (number | undefined)[]) => void;
|
||||||
}): React.ReactElement {
|
}): React.ReactElement {
|
||||||
const handleSubmit = () => {};
|
const handleSubmit = () => {};
|
||||||
return (
|
return (
|
||||||
|
@ -78,14 +78,14 @@ export function UpdateMovementDialog(p: {
|
|||||||
label="Amount"
|
label="Amount"
|
||||||
variant="standard"
|
variant="standard"
|
||||||
style={style}
|
style={style}
|
||||||
onChange={(a) =>
|
onChange={(a) => {
|
||||||
setMovement((m) => {
|
setMovement((m) => {
|
||||||
return {
|
return {
|
||||||
...m,
|
...m,
|
||||||
account_id: a ?? 0,
|
account_id: a,
|
||||||
};
|
};
|
||||||
})
|
});
|
||||||
}
|
}}
|
||||||
/>
|
/>
|
||||||
{/* Date input */}
|
{/* Date input */}
|
||||||
<DateInput
|
<DateInput
|
||||||
@ -94,14 +94,14 @@ export function UpdateMovementDialog(p: {
|
|||||||
label="Movement date"
|
label="Movement date"
|
||||||
value={movement.time}
|
value={movement.time}
|
||||||
style={style}
|
style={style}
|
||||||
onValueChange={(t) =>
|
onValueChange={(t) => {
|
||||||
setMovement((m) => {
|
setMovement((m) => {
|
||||||
return {
|
return {
|
||||||
...m,
|
...m,
|
||||||
time: t ?? 0,
|
time: t ?? 0,
|
||||||
};
|
};
|
||||||
})
|
});
|
||||||
}
|
}}
|
||||||
/>
|
/>
|
||||||
{/* Label input */}
|
{/* Label input */}
|
||||||
<TextInput
|
<TextInput
|
||||||
@ -109,14 +109,14 @@ export function UpdateMovementDialog(p: {
|
|||||||
placeholder={`Movement label`}
|
placeholder={`Movement label`}
|
||||||
label="Movement label"
|
label="Movement label"
|
||||||
value={movement.label}
|
value={movement.label}
|
||||||
onValueChange={(l) =>
|
onValueChange={(l) => {
|
||||||
setMovement((m) => {
|
setMovement((m) => {
|
||||||
return {
|
return {
|
||||||
...m,
|
...m,
|
||||||
label: l ?? "",
|
label: l ?? "",
|
||||||
};
|
};
|
||||||
})
|
});
|
||||||
}
|
}}
|
||||||
size={ServerApi.Config.constraints.movement_label}
|
size={ServerApi.Config.constraints.movement_label}
|
||||||
/>
|
/>
|
||||||
{/* Amount input */}
|
{/* Amount input */}
|
||||||
@ -126,14 +126,14 @@ export function UpdateMovementDialog(p: {
|
|||||||
label="Amount"
|
label="Amount"
|
||||||
style={style}
|
style={style}
|
||||||
value={movement.amount}
|
value={movement.amount}
|
||||||
onValueChange={(l) =>
|
onValueChange={(l) => {
|
||||||
setMovement((m) => {
|
setMovement((m) => {
|
||||||
return {
|
return {
|
||||||
...m,
|
...m,
|
||||||
amount: l,
|
amount: l,
|
||||||
};
|
};
|
||||||
})
|
});
|
||||||
}
|
}}
|
||||||
/>
|
/>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
|
@ -393,7 +393,7 @@ function MovementsTable(p: {
|
|||||||
/>
|
/>
|
||||||
<span style={{ flex: 1 }}></span>
|
<span style={{ flex: 1 }}></span>
|
||||||
<Tooltip title="Refresh table">
|
<Tooltip title="Refresh table">
|
||||||
<IconButton onClick={() => p.needReload(false)}>
|
<IconButton onClick={() => { p.needReload(false); }}>
|
||||||
<RefreshIcon />
|
<RefreshIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
@ -89,7 +89,7 @@ export function InboxRoute(): React.ReactElement {
|
|||||||
<div style={{ display: "flex", flexDirection: "column", flex: 1 }}>
|
<div style={{ display: "flex", flexDirection: "column", flex: 1 }}>
|
||||||
<div style={{ flex: 1, display: "flex", flexDirection: "column" }}>
|
<div style={{ flex: 1, display: "flex", flexDirection: "column" }}>
|
||||||
<AsyncWidget
|
<AsyncWidget
|
||||||
loadKey={loadKey.current + String(includeAttached)}
|
loadKey={`${loadKey.current}/${includeAttached}`}
|
||||||
load={load}
|
load={load}
|
||||||
errMsg="Failed to load the content of inbox!"
|
errMsg="Failed to load the content of inbox!"
|
||||||
build={() => (
|
build={() => (
|
||||||
@ -277,7 +277,7 @@ function InboxTable(p: {
|
|||||||
setAttachMultipleMovements(undefined);
|
setAttachMultipleMovements(undefined);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlePerformAttachMultiple = (mapping: Array<number | undefined>) => {
|
const handlePerformAttachMultiple = (mapping: (number | undefined)[]) => {
|
||||||
console.info(attachMultipleEntries, attachMultipleMovements, mapping);
|
console.info(attachMultipleEntries, attachMultipleMovements, mapping);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -392,7 +392,7 @@ function InboxTable(p: {
|
|||||||
editable: false,
|
editable: false,
|
||||||
getActions: (params) => {
|
getActions: (params) => {
|
||||||
return [
|
return [
|
||||||
<Tooltip title="Attach entry to movement">
|
<Tooltip key="attach" title="Attach entry to movement">
|
||||||
<GridActionsCellItem
|
<GridActionsCellItem
|
||||||
key={`attach-${params.row.id}`}
|
key={`attach-${params.row.id}`}
|
||||||
icon={<SearchIcon />}
|
icon={<SearchIcon />}
|
||||||
@ -447,7 +447,11 @@ function InboxTable(p: {
|
|||||||
/>
|
/>
|
||||||
<span style={{ flex: 1 }}></span>
|
<span style={{ flex: 1 }}></span>
|
||||||
<Tooltip title="Refresh table">
|
<Tooltip title="Refresh table">
|
||||||
<IconButton onClick={() => p.onReload(false)}>
|
<IconButton
|
||||||
|
onClick={() => {
|
||||||
|
p.onReload(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
<RefreshIcon />
|
<RefreshIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
@ -483,7 +487,7 @@ function InboxTable(p: {
|
|||||||
},
|
},
|
||||||
columns: {
|
columns: {
|
||||||
columnVisibilityModel: {
|
columnVisibilityModel: {
|
||||||
movement_id: p.showMovements!!,
|
movement_id: p.showMovements!,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
|
@ -36,7 +36,7 @@ export function MovementWidget(p: { movement: Movement }): React.ReactElement {
|
|||||||
height: "100%",
|
height: "100%",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{p.movement!.amount > 0 ? (
|
{p.movement.amount > 0 ? (
|
||||||
<CallReceivedIcon color="success" />
|
<CallReceivedIcon color="success" />
|
||||||
) : (
|
) : (
|
||||||
<CallMadeIcon color="error" />
|
<CallMadeIcon color="error" />
|
||||||
@ -51,15 +51,15 @@ export function MovementWidget(p: { movement: Movement }): React.ReactElement {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span style={{ height: "1em", lineHeight: 1 }}>
|
<span style={{ height: "1em", lineHeight: 1 }}>
|
||||||
{p.movement?.label}
|
{p.movement.label}
|
||||||
</span>
|
</span>
|
||||||
<span style={{ display: "flex", alignItems: "center", lineHeight: 1 }}>
|
<span style={{ display: "flex", alignItems: "center", lineHeight: 1 }}>
|
||||||
<AmountWidget amount={p.movement!.amount} />
|
<AmountWidget amount={p.movement.amount} />
|
||||||
<span style={{ width: "0.5em" }} />
|
<span style={{ width: "0.5em" }} />
|
||||||
•
|
•
|
||||||
<span style={{ width: "0.5em" }} />
|
<span style={{ width: "0.5em" }} />
|
||||||
<AccountIconWidget account={accounts.get(p.movement!.account_id)!} />
|
<AccountIconWidget account={accounts.get(p.movement.account_id)!} />
|
||||||
{accounts.get(p.movement!.account_id)?.name}
|
{accounts.get(p.movement.account_id)?.name}
|
||||||
<span style={{ width: "0.5em" }} />
|
<span style={{ width: "0.5em" }} />
|
||||||
• <span style={{ width: "0.5em" }} />
|
• <span style={{ width: "0.5em" }} />
|
||||||
{fmtDateFromTime(p.movement.time)}
|
{fmtDateFromTime(p.movement.time)}
|
||||||
|
@ -133,19 +133,19 @@ export function SelectMovementWidget(p: {
|
|||||||
|
|
||||||
<div style={{ flex: 1 }}>
|
<div style={{ flex: 1 }}>
|
||||||
<AsyncWidget
|
<AsyncWidget
|
||||||
loadKey={
|
loadKey={`${loadKey.current}/${accountId}/${JSON.stringify(
|
||||||
loadKey.current + "/" + accountId + "/" + JSON.stringify(filters)
|
filters
|
||||||
}
|
)}`}
|
||||||
load={load}
|
load={load}
|
||||||
errMsg="Failed to load the list of movements!"
|
errMsg="Failed to load the list of movements!"
|
||||||
build={() => {
|
build={() => {
|
||||||
if (list === null)
|
if (list === undefined)
|
||||||
return (
|
return (
|
||||||
<Typography style={{ textAlign: "center", padding: "20px" }}>
|
<Typography style={{ textAlign: "center", padding: "20px" }}>
|
||||||
Select an account to begin research.
|
Select an account to begin research.
|
||||||
</Typography>
|
</Typography>
|
||||||
);
|
);
|
||||||
if (list?.length === 0)
|
if (list.length === 0)
|
||||||
return (
|
return (
|
||||||
<Typography style={{ textAlign: "center", padding: "20px" }}>
|
<Typography style={{ textAlign: "center", padding: "20px" }}>
|
||||||
No result.
|
No result.
|
||||||
@ -154,11 +154,13 @@ export function SelectMovementWidget(p: {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{list?.map((entry) => (
|
{list.map((entry) => (
|
||||||
<ListItem>
|
<ListItem key={entry.id}>
|
||||||
<ListItemButton
|
<ListItemButton
|
||||||
selected={entry.id === p.value}
|
selected={entry.id === p.value}
|
||||||
onClick={() => p.onChange(entry)}
|
onClick={() => {
|
||||||
|
p.onChange(entry);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<MovementWidget movement={entry} />
|
<MovementWidget movement={entry} />
|
||||||
</ListItemButton>
|
</ListItemButton>
|
||||||
|
@ -21,13 +21,15 @@ export function AccountInput(p: {
|
|||||||
<Select
|
<Select
|
||||||
value={current}
|
value={current}
|
||||||
label={p.label ?? ""}
|
label={p.label ?? ""}
|
||||||
onChange={(e) => p.onChange(Number(e.target.value))}
|
onChange={(e) => {
|
||||||
|
p.onChange(Number(e.target.value));
|
||||||
|
}}
|
||||||
size="small"
|
size="small"
|
||||||
style={p.style}
|
style={p.style}
|
||||||
variant={p.variant}
|
variant={p.variant}
|
||||||
>
|
>
|
||||||
{accounts.list.list.map((a) => (
|
{accounts.list.list.map((a) => (
|
||||||
<MenuItem value={a.id}>
|
<MenuItem key={a.id} value={a.id}>
|
||||||
<span
|
<span
|
||||||
style={{
|
style={{
|
||||||
display: "inline-flex",
|
display: "inline-flex",
|
||||||
|
@ -49,8 +49,7 @@ export function AmountInput(p: {
|
|||||||
// Empty field
|
// Empty field
|
||||||
if (a?.length === 0 || a === undefined) p.onValueChange(NaN);
|
if (a?.length === 0 || a === undefined) p.onValueChange(NaN);
|
||||||
// Input number
|
// Input number
|
||||||
else if ((a?.length ?? 0) > 0 && !Number.isNaN(parsed))
|
else if (a.length > 0 && !Number.isNaN(parsed)) p.onValueChange(parsed);
|
||||||
p.onValueChange(parsed);
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user