diff --git a/frontend/public/locales/en/common.json b/frontend/public/locales/en/common.json index ec71fe0fe7be1cd7f191a75f605637404dd87a1a..cd2b3cd9f8faa461a5cb4778fecc8c10416a32bb 100644 --- a/frontend/public/locales/en/common.json +++ b/frontend/public/locales/en/common.json @@ -39,8 +39,11 @@ }, "guestInfo": { "contactInfo": "Contact information", + "contactInfoBody": "A guest is only considered active if at least one identification number has been verified.", + "contactInfoTableText": "Contact information and identification", "roleInfoHead": "Roles and periods", - "roleInfoBody": "You can only change roles that you have given" + "roleInfoTableText": "Guest roles", + "roleInfoBody": "You can only change roles that you have given." }, "guest": { "headerText": "Add new role and period.", diff --git a/frontend/public/locales/nb/common.json b/frontend/public/locales/nb/common.json index 1444a73b11e60f1e42865f38b6bc645161b430cf..cf4b742bb194c3660d08d4b69fb29159b4b4230c 100644 --- a/frontend/public/locales/nb/common.json +++ b/frontend/public/locales/nb/common.json @@ -39,8 +39,11 @@ }, "guestInfo": { "contactInfo": "Kontaktinformasjon", + "contactInfoBody": "For at ein gjest skal reknast som aktiv må minst ett identifikasjonsnummer vere godkjend.", + "contactInfoTableText": "Kontaktinformasjon og identifikasjon", "roleInfoHead": "Roller og perioder", - "roleInfoBody": "Du kan bare endre på gjesteroller som du er vert for" + "roleInfoBody": "Du kan endre på tidsperioden, men kun på gjesteroller som du er vert for.", + "roleInfoTableText": "Gjesteroller" }, "guest": { "headerText": "Legg til ny rolle og periode", diff --git a/frontend/public/locales/nn/common.json b/frontend/public/locales/nn/common.json index 6ba68cb561c26ad6f9a8d57d2346481286a366db..3edb7b514c44d6f809f7919ad9a1f8c89097b51a 100644 --- a/frontend/public/locales/nn/common.json +++ b/frontend/public/locales/nn/common.json @@ -40,8 +40,11 @@ }, "guestInfo": { "contactInfo": "Kontaktinformasjon", + "contactInfoBody": "For at en gjest skal regnes som aktiv må minst ett identifikasjonsnummer være godkjent.", + "contactInfoTableText": "Kontaktinformasjon og identifikasjon", + "roleInfoTableText": "Gjesteroller", "roleInfoHead": "Roller og periodar", - "roleInfoBody": "Du kan berre endre på gjesteroller som du er vert for" + "roleInfoBody": "Du kan endre på tidsperioden, men berre på gjesteroller som du er vert for." }, "guest": { "headerText": "Legg til ny rolle og periode", diff --git a/frontend/src/components/identityLine/index.tsx b/frontend/src/components/identityLine/index.tsx index 55e84d37e5b2660ff56c7c893916e11ad50898ec..646f97605a750ee2a399faf3b34aaba112dd5cf3 100644 --- a/frontend/src/components/identityLine/index.tsx +++ b/frontend/src/components/identityLine/index.tsx @@ -5,6 +5,7 @@ import { useState } from 'react' import { submitJsonOpts } from 'utils' import CheckIcon from '@mui/icons-material/Check' import { useTranslation } from 'react-i18next' +import { styled } from '@mui/system' interface IdentityLineProps { text: string @@ -12,6 +13,11 @@ interface IdentityLineProps { reloadGuest: () => void reloadGuests: () => void } + +const StyledTableCell = styled(TableCell)({ + border: 'none', +}) + const IdentityLine = ({ text, identity, @@ -32,9 +38,11 @@ const IdentityLine = ({ } return ( <TableRow> - <TableCell align="left">{text}</TableCell> - <TableCell align="left">{identity ? identity.value : ''}</TableCell> - <TableCell> + <StyledTableCell align="left">{text}</StyledTableCell> + <StyledTableCell align="left"> + {identity ? identity.value : ''} + </StyledTableCell> + <StyledTableCell> {!identity.verified_at ? ( <div> <Button @@ -56,7 +64,7 @@ const IdentityLine = ({ ) : ( <CheckIcon sx={{ fill: (theme) => theme.palette.success.main }} /> )} - </TableCell> + </StyledTableCell> </TableRow> ) } diff --git a/frontend/src/components/roleLine/index.tsx b/frontend/src/components/roleLine/index.tsx index 583fdf03dd1706545e683dff368d5e58f5cb8c3c..8d9763c8a5b93f62202bcf3ac316f429f0bcd60d 100644 --- a/frontend/src/components/roleLine/index.tsx +++ b/frontend/src/components/roleLine/index.tsx @@ -1,4 +1,5 @@ -import { Button, TableCell, TableRow } from '@mui/material' +import { Button, TableRow, styled } from '@mui/material' +import TableCellMui from '@mui/material/TableCell' import { Role } from 'interfaces' import { useTranslation } from 'react-i18next' import { Link } from 'react-router-dom' @@ -8,6 +9,11 @@ interface RoleLineProps { role: Role pid: string } + +const TableCell = styled(TableCellMui)({ + border: 'none', +}) + const RoleLine = ({ role, pid }: RoleLineProps) => { const [t, i18n] = useTranslation('common') console.log(role) @@ -16,13 +22,13 @@ const RoleLine = ({ role, pid }: RoleLineProps) => { <TableCell align="left"> {i18n.language === 'en' ? role.name_en : role.name_nb} </TableCell> + <TableCell align="left"> + {i18n.language === 'en' ? role.ou_en : role.ou_nb} + </TableCell> <TableCell component="th" scope="row"> {role.start_date ? format(role.start_date, 'yyyy-MM-dd') : null} -{' '} {format(role.end_date, 'yyyy-MM-dd')} </TableCell> - <TableCell align="left"> - {i18n.language === 'en' ? role.ou_en : role.ou_nb} - </TableCell> <TableCell> <Button variant="contained" diff --git a/frontend/src/hooks/useGuest/index.tsx b/frontend/src/hooks/useGuest/index.tsx index 62cf6e5b20f101c275c5cf478021f419611ddb45..e8051a49fff8709747b64a63490fdc09e90c37c6 100644 --- a/frontend/src/hooks/useGuest/index.tsx +++ b/frontend/src/hooks/useGuest/index.tsx @@ -10,6 +10,7 @@ const useGuest = (pid: string) => { email: '', fnr: null, passport: null, + feide_id: null, mobile: '', active: false, registered: false, @@ -31,6 +32,7 @@ const useGuest = (pid: string) => { mobile: rjson.mobile, fnr: parseIdentity(rjson.fnr), passport: parseIdentity(rjson.passport), + feide_id: rjson.feide_id, active: rjson.active, registered: rjson.registered, verified: rjson.verified, diff --git a/frontend/src/hooks/useGuests/index.tsx b/frontend/src/hooks/useGuests/index.tsx index 34de36ff949a3f4d04525595008fb4c98a6c8f99..bd074843789b56a57ff0696be36e4cc13693b0a4 100644 --- a/frontend/src/hooks/useGuests/index.tsx +++ b/frontend/src/hooks/useGuests/index.tsx @@ -19,6 +19,7 @@ const useGuests = () => { mobile: person.mobile, fnr: parseIdentity(person.fnr), passport: parseIdentity(person.passport), + feide_id: person.feide_id, active: person.active, roles: person.roles.map((role) => parseRole(role)), registered: person.registered, diff --git a/frontend/src/interfaces/index.ts b/frontend/src/interfaces/index.ts index ff8f15f2fd98049e1e14675df685966e4147f3d2..04121b7ba73c675676d598ab9ebf478da6e510ac 100644 --- a/frontend/src/interfaces/index.ts +++ b/frontend/src/interfaces/index.ts @@ -6,6 +6,7 @@ export type Guest = { mobile: string fnr: Identity | null passport: Identity | null + feide_id: string | null active: boolean registered: boolean verified: boolean @@ -34,6 +35,7 @@ export interface FetchedGuest { mobile: string fnr: FetchedIdentity | null passport: FetchedIdentity | null + feide_id: string | null active: boolean registered: boolean verified: boolean diff --git a/frontend/src/routes/components/sponsorInfoButtons.tsx b/frontend/src/routes/components/sponsorInfoButtons.tsx index 62a5319bc697929ba3633fbd996edc276a629fd2..73e1e02b11b88fc0ceb632b95130288d0a338fbc 100644 --- a/frontend/src/routes/components/sponsorInfoButtons.tsx +++ b/frontend/src/routes/components/sponsorInfoButtons.tsx @@ -21,18 +21,24 @@ export default function SponsorInfoButtons({ flexDirection: 'row', justifyContent: 'space-evenly', marginBottom: '2rem', + fontSize: '22px', }} > <IconButton sx={{ - alignItems: 'center', + display: 'flex', flexDirection: 'column', - typography: 'caption', + alignItems: 'center', + fontSize: '22px', }} component={Link} to={to} > - <ArrowBackIcon /> + <ArrowBackIcon + sx={{ + fontSize: '80px', + }} + /> {t('button.back')} </IconButton> <Box @@ -40,25 +46,21 @@ export default function SponsorInfoButtons({ display: 'flex', flexDirection: 'column', alignItems: 'center', + textDecorationLine: 'underline', + fontSize: '22px', }} > <PersonOutlineRoundedIcon - fontSize="large" sx={{ - borderRadius: '2rem', + fontSize: '80px', + borderRadius: '4rem', borderStyle: 'solid', borderColor: (theme: Theme) => theme.palette.secondary.main, fill: 'white', backgroundColor: (theme: Theme) => theme.palette.secondary.main, }} /> - <Box - sx={{ - typography: 'caption', - }} - > - {name} - </Box> + {name} </Box> </Box> ) diff --git a/frontend/src/routes/sponsor/guest/guestInfo/index.tsx b/frontend/src/routes/sponsor/guest/guestInfo/index.tsx index 744a28ce99a4d3d856063100ab34ecff3ba02d41..23ca061aa5913752d5dfce461ec4cdbaba45431c 100644 --- a/frontend/src/routes/sponsor/guest/guestInfo/index.tsx +++ b/frontend/src/routes/sponsor/guest/guestInfo/index.tsx @@ -7,11 +7,6 @@ import { Button, Table, TableBody, - TableCell, - TableContainer, - TableHead, - TableRow, - Paper, Box, Dialog, DialogTitle, @@ -19,6 +14,11 @@ import { DialogActions, TextField, } from '@mui/material' +import { styled } from '@mui/system' +import TableCellMui from '@mui/material/TableCell' +import TableContainerMui from '@mui/material/TableContainer' +import TableHeadMui from '@mui/material/TableHead' +import TableRowMui from '@mui/material/TableRow' import { Guest } from 'interfaces' import SponsorInfoButtons from 'routes/components/sponsorInfoButtons' import { useEffect, useState } from 'react' @@ -80,6 +80,45 @@ type Email = { email: string } +const TableHeadCell = styled(TableCellMui)({ + fontWeight: 'bold', + border: 'none', +}) + +const TableHead = styled(TableHeadMui)(({ theme }) => ({ + borderTop: '0', + borderLeft: '0', + borderRight: '0', + borderBottom: '3px solid', + borderColor: theme.palette.secondary.main, + borderRadius: '0', +})) + +const TableRow = styled(TableRowMui)({ + borderTop: '0', + borderLeft: '0', + borderRight: '0', + borderBottom: '0px solid', + borderColor: 'black', + borderRadius: '0', +}) +const TableCell = styled(TableCellMui)({ + borderBottom: 'none', +}) + +const TableContainer = styled(TableContainerMui)({ + marginBottom: '0.8rem', + borderRadius: '1%', + borderStyle: 'solid', + borderColor: 'black', + borderWidth: '2px', + boxShadow: 'none', + paddingLeft: '50px', + paddingRight: '50px', + paddingTop: '25px', + paddingBottom: '25px', +}) + export default function GuestInfo({ guest, updateEmail, @@ -168,13 +207,16 @@ export default function GuestInfo({ <Page> <SponsorInfoButtons to="/sponsor" name={`${guest.first} ${guest.last}`} /> <h2>{t('guestInfo.contactInfo')}</h2> - <TableContainer sx={{ marginBottom: '0.8rem' }} component={Paper}> + <p>{t('guestInfo.contactInfoBody')}</p> + <TableContainer> <Table sx={{ minWidth: 650 }} aria-label="simple table"> - <TableHead sx={{ backgroundColor: 'secondary.light' }}> + <TableHead> <TableRow> - <TableCell align="left">{t('guestInfo.contactInfo')}</TableCell> - <TableCell /> - <TableCell /> + <TableHeadCell align="left"> + {t('guestInfo.contactInfoTableText')} + </TableHeadCell> + <TableHeadCell /> + <TableHeadCell /> </TableRow> </TableHead> <TableBody> @@ -247,6 +289,15 @@ export default function GuestInfo({ </TableCell> <TableCell /> </TableRow> + <TableRow> + <TableCell align="left">{t('input.mobilePhone')}</TableCell> + <TableCell align="left">{guest.mobile}</TableCell> + </TableRow> + <TableRow> + <TableCell align="left">{t('feideId')}</TableCell> + <TableCell align="left">{guest.feide_id}</TableCell> + </TableRow> + <IdentityLine text={t('input.nationalIdNumber')} identity={guest.fnr} @@ -259,10 +310,6 @@ export default function GuestInfo({ reloadGuest={reloadGuest} reloadGuests={reloadGuests} /> - <TableRow> - <TableCell align="left">{t('input.mobilePhone')}</TableCell> - <TableCell align="left">{guest.mobile}</TableCell> - </TableRow> </TableBody> </Table> </TableContainer> @@ -273,21 +320,28 @@ export default function GuestInfo({ > {t('button.save')} </Button> - <h2>{t('guestInfo.roleInfoHead')}</h2> - <h3>{t('guestInfo.roleInfoBody')}</h3> + <p>{t('guestInfo.roleInfoBody')}</p> - <TableContainer component={Paper}> + <TableContainer> <Table sx={{ minWidth: 650 }} aria-label="simple table"> - <TableHead sx={{ backgroundColor: 'secondary.light' }}> + <TableHead> <TableRow> - <TableCell align="left">{t('common:role')}</TableCell> - <TableCell align="left">{t('common:period')}</TableCell> - <TableCell align="left">{t('common:ou')}</TableCell> - <TableCell align="left">{t('common:choice')}</TableCell> + <TableHeadCell align="left"> + {t('guestInfo.roleInfoTableText')} + </TableHeadCell> + <TableHeadCell align="left" /> + <TableHeadCell align="left" /> + <TableHeadCell align="left" /> </TableRow> </TableHead> <TableBody> + <TableRow> + <TableHeadCell align="left">{t('common:role')}</TableHeadCell> + <TableHeadCell align="left">{t('common:ou')}</TableHeadCell> + <TableHeadCell align="left">{t('common:period')}</TableHeadCell> + <TableHeadCell align="left" /> + </TableRow> {guest.roles.map((role) => ( <RoleLine key={role.id} pid={pid} role={role} /> ))} diff --git a/greg/api/serializers/person.py b/greg/api/serializers/person.py index c7d1e085d633167ef0363836d0bd55f012f60ea7..a92a9d576e7c04ea6cb35b2fe3f47fd3e7ee5b7c 100644 --- a/greg/api/serializers/person.py +++ b/greg/api/serializers/person.py @@ -42,6 +42,7 @@ class SpecialPersonSerializer(serializers.ModelSerializer): mobile = SerializerMethodField(source="private_mobile", read_only=True) fnr = SpecialIdentitySerializer(read_only=True) passport = SpecialIdentitySerializer(read_only=True) + feide_id = SerializerMethodField(source="feide_id", read_only=True) active = SerializerMethodField(source="active", read_only=True) registered = BooleanField(source="is_registered", read_only=True) verified = BooleanField(source="is_verified", read_only=True) @@ -56,6 +57,9 @@ class SpecialPersonSerializer(serializers.ModelSerializer): def get_active(self, obj): return obj.is_registered and obj.is_verified + def get_feide_id(self, obj): + return obj.feide_id and obj.feide_id.value + class Meta: model = Person fields = [ @@ -66,6 +70,7 @@ class SpecialPersonSerializer(serializers.ModelSerializer): "fnr", "email", "passport", + "feide_id", "active", "registered", "verified",