Skip to content

Commit

Permalink
Merge branch 'main' into IA-3685_IA-811-Allow-filtering-groups-by-pro…
Browse files Browse the repository at this point in the history
…ject-and-by-source-and-version
  • Loading branch information
butofleury committed Dec 18, 2024
2 parents a88f494 + 8e14c0e commit 881d285
Show file tree
Hide file tree
Showing 89 changed files with 1,941 additions and 492 deletions.
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ services:
WFP_EMAIL_RECIPIENTS_NEW_ACCOUNT:
DISABLE_PASSWORD_LOGINS:
MAINTENANCE_MODE:
SERVER_URL: # Limit logging in dev to not overflow terminal
SERVER_URL:
SUPERSET_URL:
SUPERSET_ADMIN_USERNAME:
SUPERSET_ADMIN_PASSWORD:
logging: &iaso_logging
driver: 'json-file'
options:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const useStyles = () => {
string,
SxProps<Theme>
>),
height: 400,
minWidth: 200,
marginBottom: 0,
position: 'relative',
Expand Down Expand Up @@ -65,7 +64,6 @@ export const MarkerMap: FunctionComponent<Props> = ({
const { formatMessage } = useSafeIntl();

const styles: Record<string, SxProps<Theme>> = useStyles();

const boundsOptions: Record<string, [number, number] | number> = {
padding: [50, 50],
maxZoom: maxZoom || currentTile.maxZoom,
Expand All @@ -89,7 +87,12 @@ export const MarkerMap: FunctionComponent<Props> = ({
);
if (latitude === undefined || longitude === undefined) return null;
return (
<Box sx={styles.mapContainer} height={mapHeight}>
<Box
sx={{
...styles.mapContainer,
height: mapHeight,
}}
>
{!isMarkerInside && (
<Box sx={styles.alertContainer}>
<Alert severity="warning" sx={styles.alert}>
Expand Down
45 changes: 19 additions & 26 deletions hat/assets/js/apps/Iaso/components/tables/PaperTableRow.tsx
Original file line number Diff line number Diff line change
@@ -1,46 +1,39 @@
import { TableCell, TableRow } from '@mui/material';
import { makeStyles } from '@mui/styles';
import { TableCell, TableRow, Theme } from '@mui/material';
import { LoadingSpinner } from 'bluesquare-components';
import classNames from 'classnames';
import React, { FunctionComponent } from 'react';
import { SxStyles } from '../../types/general';
import { NumberCell } from '../Cells/NumberCell';

const useStyles = makeStyles(theme => ({
withBorder: {
// @ts-ignore
borderRight: `1px solid ${theme.palette.ligthGray.border}`,
},
boldTitle: {
fontWeight: 'bold',
},
}));

type RowProps = {
label?: string;
value?: string | number;
value?: string | number | React.ReactNode;
isLoading?: boolean;
withLeftCellBorder?: boolean;
boldLeftCellText?: boolean;
className?: string;
withoutPadding?: boolean;
};

const styles: SxStyles = {
label: (theme: Theme) => ({
fontWeight: 'bold',
// @ts-ignore
borderRight: `1px solid ${theme.palette.ligthGray.border}`,
}),
cellNoPadding: {
padding: 0,
},
};

export const PaperTableRow: FunctionComponent<RowProps> = ({
label,
value,
isLoading = false,
withLeftCellBorder = true,
boldLeftCellText = true,
className,
withoutPadding = false,
}) => {
const classes = useStyles();
const borderClass = withLeftCellBorder ? classes.withBorder : '';
const boldTitle = boldLeftCellText ? classes.boldTitle : '';
return (
<TableRow className={className}>
<TableCell className={classNames(borderClass, boldTitle)}>
{label}
</TableCell>
<TableCell>
<TableCell sx={styles.label}>{label}</TableCell>
<TableCell sx={withoutPadding ? styles.cellNoPadding : {}}>
{isLoading && (
<LoadingSpinner
fixed={false}
Expand All @@ -49,7 +42,7 @@ export const PaperTableRow: FunctionComponent<RowProps> = ({
size={25}
/>
)}
{!isLoading && typeof value === 'string' && value}
{!isLoading && typeof value !== 'number' && value}
{!isLoading && typeof value === 'number' && (
<NumberCell value={value as number | undefined} />
)}
Expand Down
1 change: 1 addition & 0 deletions hat/assets/js/apps/Iaso/constants/urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ export const baseRouteConfigs: Record<string, RouteConfig> = {
'userRoles',
'withLocation',
'projectIds',
'source_version_id',
'paymentStatus',
...paginationPathParams,
'paymentIds',
Expand Down
4 changes: 3 additions & 1 deletion hat/assets/js/apps/Iaso/domains/app/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,8 @@
"iaso.pages.errors.text": "Text content is required",
"iaso.pages.errors.url": "Url is required",
"iaso.pages.errors.urlNotValid": "Url is not valid",
"iaso.pages.superset": "Superset",
"iaso.pages.superset_dashboard_id": "Dashboard ID",
"iaso.pages.title": "Embedded links",
"iaso.payments.createLot": "Create a new lot of payments",
"iaso.payments.download_payments": "Download payments",
Expand Down Expand Up @@ -1575,4 +1577,4 @@
"trypelim.permissions.zones": "Zones",
"trypelim.permissions.zones_edit": "Edit zones",
"trypelim.permissions.zones_shapes_edit": "Edit zone shapes"
}
}
4 changes: 3 additions & 1 deletion hat/assets/js/apps/Iaso/domains/app/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,8 @@
"iaso.pages.errors.text": "Le contenu est requis",
"iaso.pages.errors.url": "L'url est un champ requis",
"iaso.pages.errors.urlNotValid": "L'url n'est pas valide",
"iaso.pages.superset": "Superset",
"iaso.pages.superset_dashboard_id": "Identifiant du tableau de bord",
"iaso.pages.title": "Liens intégrés",
"iaso.payments.createLot": "Créer un nouveau lot de paiements",
"iaso.payments.download_payments": "Télécharger les paiements",
Expand Down Expand Up @@ -1574,4 +1576,4 @@
"trypelim.permissions.zones": "Zones",
"trypelim.permissions.zones_edit": "Edit zones",
"trypelim.permissions.zones_shapes_edit": "Editer les contours géographiques des zones de santé"
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import { makeStyles } from '@mui/styles';
import {
commonStyles,
IconButton,
LinkButton,
useSafeIntl,
} from 'bluesquare-components';
import React, { FunctionComponent } from 'react';
import { commonStyles, IconButton, useSafeIntl } from 'bluesquare-components';

import MESSAGES from '../messages';
import { Grid } from '@mui/material';
import WidgetPaper from '../../../components/papers/WidgetPaperComponent';
import { baseUrls } from '../../../constants/urls';
import MESSAGES from '../messages';
import { Beneficiary } from '../types/beneficiary';
import { Field } from '../types/fields';
import { BeneficiaryBaseInfoContents } from './BeneficiaryBaseInfoContents';
import WidgetPaper from '../../../components/papers/WidgetPaperComponent';

const useStyles = makeStyles(theme => ({
...commonStyles(theme),
Expand All @@ -19,22 +25,53 @@ type Props = {
beneficiary: Beneficiary;
fields: Field[];
withLinkToBeneficiary?: boolean;
hasDuplicates?: boolean;
duplicateUrl?: string;
};

const BeneficiaryTitle: FunctionComponent<{
hasDuplicates: boolean;
duplicateUrl?: string;
}> = ({ hasDuplicates, duplicateUrl }) => {
const { formatMessage } = useSafeIntl();
return hasDuplicates && duplicateUrl ? (
<Grid container>
<Grid item xs={6}>
{formatMessage(MESSAGES.beneficiaryInfo)}
</Grid>
<Grid item xs={6} justifyContent="flex-end" container>
<LinkButton to={duplicateUrl}>
{formatMessage(MESSAGES.seeDuplicates)}
</LinkButton>
</Grid>
</Grid>
) : (
formatMessage(MESSAGES.beneficiaryInfo)
);
};

export const BeneficiaryBaseInfo: FunctionComponent<Props> = ({
beneficiary,
fields,
withLinkToBeneficiary = false,
hasDuplicates = false,
duplicateUrl,
}) => {
const { formatMessage } = useSafeIntl();
const classes: Record<string, string> = useStyles();
const widgetContents = <BeneficiaryBaseInfoContents fields={fields} />;

const title = (
<BeneficiaryTitle
hasDuplicates={hasDuplicates}
duplicateUrl={duplicateUrl}
/>
);

if (withLinkToBeneficiary) {
return (
<WidgetPaper
className={classes.infoPaper}
title={formatMessage(MESSAGES.beneficiaryInfo)}
title={title}
IconButton={IconButton}
iconButtonProps={{
url: `/${baseUrls.entityDetails}/entityId/${beneficiary.id}`,
Expand All @@ -47,10 +84,7 @@ export const BeneficiaryBaseInfo: FunctionComponent<Props> = ({
);
}
return (
<WidgetPaper
className={classes.infoPaper}
title={formatMessage(MESSAGES.beneficiaryInfo)}
>
<WidgetPaper className={classes.infoPaper} title={title}>
{widgetContents}
</WidgetPaper>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
/* eslint-disable react/require-default-props */
import { Box, Table, TableBody } from '@mui/material';
import { makeStyles } from '@mui/styles';
import React, { FunctionComponent } from 'react';
import { commonStyles } from 'bluesquare-components';
import { Field } from '../types/fields';
import React, { FunctionComponent } from 'react';
import { PaperTableRow } from '../../../components/tables/PaperTableRow';
import { Field } from '../types/fields';

const useStyles = makeStyles(theme => ({
...commonStyles(theme),
infoPaperBox: { minHeight: '100px' },
infoPaperBox: {
minHeight: '100px',
// @ts-ignore
borderTop: `1px solid ${theme.palette.ligthGray.border}`,
},
}));

type Props = {
Expand All @@ -29,6 +33,7 @@ export const BeneficiaryBaseInfoContents: FunctionComponent<Props> = ({
label={field.label}
value={field.value}
key={field.key}
withoutPadding={field.type === 'geopoint'}
/>
))}
</TableBody>
Expand Down
Loading

0 comments on commit 881d285

Please sign in to comment.