Skip to content

Commit

Permalink
OP-1817: hide validity dates if historical data not requested (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
olewandowski1 authored Feb 26, 2024
1 parent 879cde7 commit 855e890
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions src/components/PayerSearcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ const PayerSearcher = (props) => {
}, []);

const getHeaders = useCallback(
() => [
(filters) => [
"payer.name",
"payer.type",
"payer.address",
"payer.region",
"payer.district",
"payer.validityFrom",
"payer.validityTo",
filters?.showHistory?.value ? "payer.validityFrom" : null,
filters?.showHistory?.value ? "payer.validityTo" : null,
"",
],
[],
Expand All @@ -79,25 +79,24 @@ const PayerSearcher = (props) => {
(p) => p.address,
(p) => formatLocation(p.location?.parent ?? p.location),
(p) => formatLocation(p.location?.parent ? p.location : null),
(p) => formatDateFromISO(p.validityFrom),
(p) => formatDateFromISO(p.validityTo),
(p) =>
!filters.showHistory?.value ? (
<div className={classes.horizontalButtonContainer}>
<Tooltip title={formatMessage("PayerSearcher.openNewTab")}>
<IconButton onClick={() => onDoubleClick(p, true)}>
<TabIcon />
(p) => (filters?.showHistory?.value ? formatDateFromISO(p.validityFrom) : null),
(p) => (filters?.showHistory?.value ? formatDateFromISO(p.validityTo) : null),
(p) => (
<div className={classes.horizontalButtonContainer}>
<Tooltip title={formatMessage("PayerSearcher.openNewTab")}>
<IconButton onClick={() => onDoubleClick(p, true)}>
<TabIcon />
</IconButton>
</Tooltip>
{canDelete(p) && (
<Tooltip title={formatMessage("PayerSearcher.deletePayerTooltip")}>
<IconButton onClick={() => setPayerToDelete(p)}>
<DeleteIcon />
</IconButton>
</Tooltip>
{canDelete(p) && (
<Tooltip title={formatMessage("PayerSearcher.deletePayerTooltip")}>
<IconButton onClick={() => setPayerToDelete(p)}>
<DeleteIcon />
</IconButton>
</Tooltip>
)}
</div>
) : null,
)}
</div>
),
];
}, []);
return (
Expand Down

0 comments on commit 855e890

Please sign in to comment.