Add account type
This commit is contained in:
@@ -10,6 +10,8 @@ import { MoneyMgrWebRouteContainer } from "../widgets/MoneyMgrWebRouteContainer"
|
||||
import { TimeWidget } from "../widgets/TimeWidget";
|
||||
import DeleteIcon from "@mui/icons-material/DeleteOutlined";
|
||||
import { useConfirm } from "../hooks/context_providers/ConfirmDialogProvider";
|
||||
import { AccountWidget } from "../widgets/AccountWidget";
|
||||
import { ServerApi } from "../api/ServerApi";
|
||||
|
||||
export function AccountsRoute(): React.ReactElement {
|
||||
const alert = useAlert();
|
||||
@@ -88,6 +90,35 @@ export function AccountsRoute(): React.ReactElement {
|
||||
|
||||
const columns: GridColDef<(typeof list)[number]>[] = [
|
||||
{ field: "id", headerName: "ID", flex: 1 },
|
||||
{
|
||||
field: "type",
|
||||
headerName: "Type",
|
||||
flex: 2,
|
||||
editable: true,
|
||||
type: "singleSelect",
|
||||
valueOptions: ServerApi.Config.accounts_types.map((v) => {
|
||||
return { label: v.label, value: v.code };
|
||||
}),
|
||||
renderCell(params) {
|
||||
return (
|
||||
<span
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
justifyContent: "start",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<AccountWidget account={params.row} />
|
||||
{
|
||||
ServerApi.Config.accounts_types.find(
|
||||
(t) => t.code === params.row.type
|
||||
)!.label
|
||||
}
|
||||
</span>
|
||||
);
|
||||
},
|
||||
},
|
||||
{ field: "name", headerName: "Name", flex: 6, editable: true },
|
||||
{
|
||||
field: "time_create",
|
||||
@@ -159,7 +190,10 @@ export function AccountsRoute(): React.ReactElement {
|
||||
return setDefaultAccount(updated);
|
||||
}
|
||||
|
||||
if (updated.name !== original.name) {
|
||||
if (
|
||||
updated.name !== original.name ||
|
||||
updated.type !== original.type
|
||||
) {
|
||||
return updateAccount(updated);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user