Skip to content

Commit

Permalink
Merge pull request #225 from entur/WTK-1832-personal-accounts
Browse files Browse the repository at this point in the history
Personal vs notification accounts
  • Loading branch information
testower authored Dec 14, 2023
2 parents d927fcb + ada88ed commit f05dcbc
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion src/modals/ModalCreateUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ import SelectField from 'material-ui/SelectField';
import MenuItem from 'material-ui/MenuItem';
import ResponsiblitySetList from './ResponsiblitySetList';
import UserRespSetPopover from './UserRespSetPopover';
import {
FormControl,
FormLabel,
RadioGroup,
FormControlLabel,
Radio
} from '@material-ui/core';

const initialState = {
user: {
Expand All @@ -33,7 +40,8 @@ const initialState = {
phone: '',
firstName: '',
lastName: ''
}
},
personal_account: true
},
isAddingResponsibilitySet: false,
temptResponsibilitySet: '',
Expand Down Expand Up @@ -96,6 +104,17 @@ class ModalCreateUser extends React.Component {
});
}

handleChangeIsPersonalAccount(value) {
const { user } = this.state;
this.setState({
...this.state,
user: {
...user,
personal_account: value === 'personal_account'
}
});
}

validateBy(type, value) {
const emailRe = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
const usernameRe = /^[a-zA-Z-. ]*$/;
Expand Down Expand Up @@ -188,6 +207,28 @@ class ModalCreateUser extends React.Component {
flexDirection: 'column'
}}
>
<FormControl>
<RadioGroup
defaultValue="personal_account"
value={
user.personal_account
? 'personal_account'
: 'notification_account'
}
onChange={(e, value) => this.handleChangeIsPersonalAccount(value)}
>
<FormControlLabel
value="personal_account"
control={<Radio />}
label="Personal account"
/>
<FormControlLabel
value="notification_account"
control={<Radio />}
label="Notification account"
/>
</RadioGroup>
</FormControl>
<TextField
hintText="Username"
floatingLabelText="Username"
Expand Down

0 comments on commit f05dcbc

Please sign in to comment.