quintodrome/ui/src/user/UserEdit.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

37 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-01-19 17:39:37 -09:00
import React from 'react'
import {
TextInput,
BooleanInput,
DateField,
PasswordInput,
Edit,
required,
2020-01-20 05:54:29 -09:00
email,
2020-01-19 17:39:37 -09:00
SimpleForm,
2020-04-27 19:22:17 -08:00
useTranslate,
2020-01-19 17:39:37 -09:00
} from 'react-admin'
import { Title } from '../common'
2020-01-19 17:39:37 -09:00
const UserTitle = ({ record }) => {
2020-04-27 19:22:17 -08:00
const translate = useTranslate()
const resourceName = translate('resources.user.name', { smart_count: 1 })
return <Title subTitle={`${resourceName} ${record ? record.name : ''}`} />
}
2020-01-19 17:39:37 -09:00
const UserEdit = (props) => (
<Edit title={<UserTitle />} {...props}>
2020-01-19 17:39:37 -09:00
<SimpleForm>
2020-01-20 05:54:29 -09:00
<TextInput source="userName" validate={[required()]} />
2020-01-19 17:39:37 -09:00
<TextInput source="name" validate={[required()]} />
2020-01-26 18:17:58 -09:00
<TextInput source="email" validate={[email()]} />
2020-01-19 17:39:37 -09:00
<PasswordInput source="password" validate={[required()]} />
<BooleanInput source="isAdmin" initialValue={false} />
<DateField source="lastLoginAt" showTime />
{/*<DateField source="lastAccessAt" showTime />*/}
<DateField source="updatedAt" showTime />
<DateField source="createdAt" showTime />
2020-01-19 17:39:37 -09:00
</SimpleForm>
</Edit>
)
export default UserEdit