Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
Feat/add email to group (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrund-tsi authored Oct 1, 2021
1 parent 8139e68 commit af4fb3f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@ export const useGetGroups = (onSuccess?: () => void, onError?: (error: any) => v

const removeEmpty = (group: IGroupDetails): IGroupDetails => {
if (group) {
group.email = group.email || undefined;
group.website = group.website || undefined;
group.openingHours = group.openingHours || undefined;
group.appointmentRequired = group.appointmentRequired || false;
Expand Down
13 changes: 13 additions & 0 deletions src/components/modals/group-modal.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const emptyGroup: IGroupDetails = {
searchPortalConsent: false,
parentGroup: '',
website: '',
email: '',
appointmentRequired: false,
openingHours: ''
}
Expand Down Expand Up @@ -190,6 +191,7 @@ const GroupModal = (props: any) => {
const ngroup: IGroupDetails = { ...group, [name]: value };

if (value === false) {
ngroup.email = '';
ngroup.website = '';
ngroup.openingHours = '';
ngroup.appointmentRequired = false;
Expand Down Expand Up @@ -304,6 +306,17 @@ const GroupModal = (props: any) => {

<Collapse in={group.searchPortalConsent}>
<div>
< FormGroupInput controlId='formEmailInput' title={t('translation:email-address')}
value={group?.email ? group.email : ''}
onChange={(evt: any) => {
updateGroupProp('email', evt.target.value);
props.resetError();
}}
type='email'
pattern={utils.pattern.eMail}
minLength={5}
maxLength={255}
/>
< FormGroupInput controlId='formPocWebsite' title={t('translation:searchPortalWebsite')} placeholder={t('translation:searchPortalWebsitePlaceholder')}
value={websiteValue}
dropdown={dropdownItems}
Expand Down
4 changes: 2 additions & 2 deletions src/components/modules/group-table.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ const GroupTable = (props: any) => {
const [confirmTitle, setConfirmTitle] = React.useState('');
const [confirmHandle, setConfirmHandle] = React.useState<() => void>();
const [groupIsReady, setGroupIsReady] = React.useState(false);

const [
bGroups,
refreshGroups,
createGroup,
updateGroup,
deleteGroup
] = useGetGroups(()=> setGroupIsReady(true), props.handleError);
] = useGetGroups(() => setGroupIsReady(true), props.handleError);


React.useEffect(() => {
Expand Down
1 change: 1 addition & 0 deletions src/misc/user.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export interface IGroupDetails {
pocId: string,
searchPortalConsent: boolean,
website?: string,
email?: string,
openingHours?: string,
appointmentRequired?: boolean,
parentGroup?: string,
Expand Down

0 comments on commit af4fb3f

Please sign in to comment.