Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create user #96

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
9dca33b
add popup add user
sanglevinh Aug 3, 2023
3d2c27f
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 3, 2023
d62f6b4
change roleId to role_id
sanglevinh Aug 3, 2023
1d26011
add params sort and filter
sanglevinh Aug 3, 2023
275826f
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 3, 2023
c6b0567
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 3, 2023
cde3064
create user
sanglevinh Aug 3, 2023
1b983f1
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 3, 2023
90e7b27
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 4, 2023
11ce676
fix bug email already alert succes
sanglevinh Aug 4, 2023
2dffbd3
fix loading
sanglevinh Aug 4, 2023
069c695
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 4, 2023
3d7894e
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 4, 2023
32a04af
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 4, 2023
42821f5
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 4, 2023
5cae5be
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 4, 2023
038f65b
use enum in switch case
sanglevinh Aug 4, 2023
6a93499
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 4, 2023
e15efa9
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 4, 2023
56bea57
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 4, 2023
508b571
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 4, 2023
49b64b3
fix indent
sanglevinh Aug 4, 2023
b6c2902
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 7, 2023
c050311
Merge branch 'develop-main' into feature/account_manager_add_account
sanglevinh Aug 7, 2023
bf45b65
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 8, 2023
544d4f2
Merge branch 'feature/account_manager' into feature/account_manager_a…
sanglevinh Aug 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/src/@types/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const enum ROLE {
export enum ROLE {
ADMIN = 1,
DATA_MANAGER = 10,
OPERATOR = 20,
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/api/users/UsersApiDTO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export type UserDTO = {
export type AddUserDTO = {
email: string
password: string
name: string
role_id: number
}

export type ListUsersQueryDTO = {
Expand Down
61 changes: 61 additions & 0 deletions frontend/src/components/common/InputError.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { InputProps, styled, Typography } from '@mui/material'

interface InputErrorProps extends InputProps {
errorMessage: string
value?: string
}

const InputError =
({
errorMessage,
onChange,
value,
type,
onBlur,
name,
}: InputErrorProps) => {
return (
<>
<Input
autoComplete="Off"
error={!!errorMessage}
onChange={onChange}
value={value}
type={type}
name={name}
onBlur={onBlur}
/>
<TextError>{errorMessage}</TextError>
</>
)
}

const Input = styled('input', {
shouldForwardProp: (props) => props !== 'error',
})<{ error: boolean }>(({ error }) => {
return {
width: 250,
height: 24,
borderRadius: 4,
border: '1px solid',
borderColor: error ? 'red' : '#d9d9d9',
padding: '5px 10px',
marginBottom: 15,
transition: 'all 0.3s',
outline: 'none',
':focus, :hover': {
borderColor: '#1677ff',
},
}
})

const TextError = styled(Typography)({
fontSize: 12,
minHeight: 18,
color: 'red',
lineHeight: '14px',
margin: '-14px 0px 0px 305px',
wordBreak: 'break-word',
})

export default InputError
73 changes: 73 additions & 0 deletions frontend/src/components/common/SelectError.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import {
MenuItem,
Select,
SelectChangeEvent,
styled,
Typography,
} from '@mui/material'
import { FC, FocusEvent } from 'react'

type SelectErrorProps = {
value?: string
onChange?: (value: SelectChangeEvent, child: React.ReactNode) => void
onBlur?: (event: FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void
errorMessage: string
name?: string
options: string[]
}

const SelectError: FC<SelectErrorProps> =
({
value,
onChange,
onBlur,
errorMessage,
options,
name,
}) => {
return (
<>
<SelectModal
name={name}
value={value}
onChange={
onChange as (
value: SelectChangeEvent<unknown>,
child: React.ReactNode,
) => void
}
onBlur={onBlur}
error={!!errorMessage}
>
{options.map((item: string) => {
return (
<MenuItem key={item} value={item}>
{item}
</MenuItem>
)
})}
</SelectModal>
<TextError>{errorMessage}</TextError>
</>
)
}

const SelectModal = styled(Select, {
shouldForwardProp: (props) => props !== 'error',
})<{ error: boolean }>(({ theme, error }) => ({
width: 272,
marginBottom: '15px',
border: '1px solid #d9d9d9',
borderColor: error ? 'red' : '#d9d9d9',
borderRadius: 4,
}))

const TextError = styled(Typography)({
fontSize: 12,
minHeight: 18,
color: 'red',
lineHeight: '14px',
margin: '-14px 0px 0px 305px',
wordBreak: 'break-word',
})
export default SelectError
Loading