add edit form to Person entity

This commit is contained in:
2025-01-15 14:27:53 +01:00
parent e51e2701b3
commit b6d7471408
5 changed files with 81 additions and 22 deletions

View File

@@ -0,0 +1,77 @@
import React from "react";
import {
BooleanField, BooleanInput,
DateInput,
Edit,
Labeled,
SimpleForm,
TextInput,
} from 'react-admin';
import { Box, Card, CardContent, CardHeader, Stack } from "@mui/material";
export const PersonEdit = () => {
return (
<Edit>
<SimpleForm>
<Card sx={{ width: "100%", m: 1 }}>
<CardHeader title="General info" />
<CardContent>
<Stack
sx={{
flexWrap: "wrap",
justifyContent: "flex-start",
alignItems: "center",
}}
direction="row"
columnGap={5}
rowGap={2}
>
<Labeled label="Name">
<Stack direction="row" gap={1}>
<TextInput sx={{ textTransform: "" }} source="title" />
<TextInput source="firstName" />
<TextInput source="lastName" />
</Stack>
</Labeled>
<TextInput source="email" fullWidth="false" />
<BooleanInput
source="userAccess"
label="Access to the Platform"
/>
<Labeled label="Position">
<TextInput source="jobPosition" />
</Labeled>
<Labeled label="Phone number">
<TextInput source="phoneNumber" />
</Labeled>
<Labeled label="Mobile number">
<TextInput source="mobileNumber" />
</Labeled>
<Box />
</Stack>
</CardContent>
</Card>
<Card sx={{ width: "100%", m: 1 }}>
<CardHeader title="Platform info" />
<CardContent>
<Stack
sx={{ justifyContent: "flex-start", alignItems: "center" }}
direction="row"
gap={5}
>
<Labeled label="Last changes date">
<DateInput source="updateDate" />
</Labeled>
<Labeled label="User Access Active From">
<DateInput source="userAccessFrom" />
</Labeled>
<Labeled label="User Access Active To">
<DateInput source="userAccessTo" />
</Labeled>
</Stack>
</CardContent>
</Card>
</SimpleForm>
</Edit>
);
};

View File

@@ -1,3 +1,4 @@
export { PersonList } from './list.tsx';
export { PersonShow } from './show.tsx';
export { PersonEdit } from './edit.tsx';
export * from './components';