Skip to content

Commit

Permalink
fix : removed in communication item reason label if type is different…
Browse files Browse the repository at this point in the history
… from reminder
  • Loading branch information
prwozny committed Sep 20, 2024
1 parent caac210 commit 07fee98
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/ui/SurveyUnit/Communication/CommunicationItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import DirectionsWalkIcon from '@mui/icons-material/DirectionsWalk';
import Divider from '@mui/material/Divider';
import D from 'i18n';
import { formatDate } from '../../../utils/functions/date';
import { HEALTHY_COMMUNICATION_REQUEST_STATUS } from '../../../utils/constants';
import { HEALTHY_COMMUNICATION_REQUEST_STATUS, reasonRadioValues } from '../../../utils/constants';
import {
communicationReasonEnum,
communicationTypeEnum,
findCommunicationMediumLabelByValue,
findCommunicationReasonLabelByValue,
findCommunicationStatusLabelByValue,
Expand Down Expand Up @@ -42,7 +44,10 @@ export function CommunicationItem({

const mediumLabel = findCommunicationMediumLabelByValue(surveyUnitCommunicationTemplate.medium);
const typeLabel = findCommunicationTypeLabelByValue(surveyUnitCommunicationTemplate.type);
const reasonLabel = findCommunicationReasonLabelByValue(communication.reason);
const reasonLabel =
surveyUnitCommunicationTemplate.type !== communicationTypeEnum.COMMUNICATION_NOTICE.value
? `, ${findCommunicationReasonLabelByValue(communication.reason)}`
: '';

const lastStatusLabel = findCommunicationStatusLabelByValue(lastStatus.status);
const formattedDate = formatDate(lastStatus.date);
Expand All @@ -63,7 +68,7 @@ export function CommunicationItem({
{formatDate(firstStatus.date, true)}
</Typography>
<Typography color="textPrimary" variant="s">
{` | ${mediumLabel} - ${typeLabel}, ${reasonLabel}`}
{` | ${mediumLabel} - ${typeLabel}${reasonLabel}`}
</Typography>
</div>
</Row>
Expand Down

0 comments on commit 07fee98

Please sign in to comment.