add edit form to Person entity
This commit is contained in:
1
.env
1
.env
@@ -1,2 +1,3 @@
|
||||
VITE_AUTH_URL=http://localhost:8080
|
||||
VITE_SECURITY_REST_URL=http://localhost:8081/security
|
||||
VITE_GATEWAY_REST_URL=http://localhost:8081/core/api/admin
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
module.exports = {
|
||||
extends: [
|
||||
"eslint:recommended",
|
||||
"plugin:react/recommended",
|
||||
"plugin:react/jsx-runtime",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:react-hooks/recommended",
|
||||
"prettier",
|
||||
],
|
||||
ignorePatterns: ["dist", ".eslintrc.cjs"],
|
||||
parser: "@typescript-eslint/parser",
|
||||
env: {
|
||||
browser: true,
|
||||
es2021: true,
|
||||
},
|
||||
settings: {
|
||||
react: {
|
||||
version: "detect",
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Admin, Resource } from "react-admin";
|
||||
import { Layout } from "./Layout";
|
||||
import { AdminDashboard, PersonList, PersonShow } from "@admin";
|
||||
import { AdminDashboard, PersonList, PersonShow, PersonEdit } from '@admin';
|
||||
import { authProvider, dataProvider } from "@core";
|
||||
|
||||
export const App = () => (
|
||||
@@ -15,6 +15,7 @@ export const App = () => (
|
||||
options={{ label: "Users" }}
|
||||
list={PersonList}
|
||||
show={PersonShow}
|
||||
edit={PersonEdit}
|
||||
/>
|
||||
</Admin>
|
||||
);
|
||||
|
||||
77
src/admin-components/resources/person/edit.tsx
Normal file
77
src/admin-components/resources/person/edit.tsx
Normal 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>
|
||||
);
|
||||
};
|
||||
@@ -1,3 +1,4 @@
|
||||
export { PersonList } from './list.tsx';
|
||||
export { PersonShow } from './show.tsx';
|
||||
export { PersonEdit } from './edit.tsx';
|
||||
export * from './components';
|
||||
|
||||
Reference in New Issue
Block a user