Skip to content

Commit 560f8da

Browse files
committed
feat: display "Benefit issued to" field on dashboard child cards (DC-117)
1 parent 37d7925 commit 560f8da

3 files changed

Lines changed: 22 additions & 10 deletions

File tree

src/SEBT.Portal.Api/Models/Household/HouseholdDataResponseMapper.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,23 @@ public static HouseholdDataResponse ToResponse(this HouseholdData domain)
2222
{
2323
Email = domain.Email,
2424
Phone = domain.Phone,
25-
Applications = domain.Applications.Select(ToResponse).ToList(),
25+
Applications = domain.Applications.Select(a => ToResponse(a, domain.BenefitIssuanceType)).ToList(),
2626
AddressOnFile = domain.AddressOnFile?.ToResponse(),
2727
UserProfile = domain.UserProfile?.ToResponse(),
2828
BenefitIssuanceType = domain.BenefitIssuanceType
2929
};
3030
}
3131

32-
private static ApplicationResponse ToResponse(this Application domain)
32+
private static ApplicationResponse ToResponse(
33+
this Application domain,
34+
Core::SEBT.Portal.Core.Models.Household.BenefitIssuanceType householdIssuanceType)
3335
{
36+
// If application-level IssuanceType isn't set, inherit from the
37+
// household-level BenefitIssuanceType (both enums share the same int values)
38+
var issuanceType = domain.IssuanceType != Core::SEBT.Portal.Core.Models.Household.IssuanceType.Unknown
39+
? domain.IssuanceType
40+
: (Core::SEBT.Portal.Core.Models.Household.IssuanceType)(int)householdIssuanceType;
41+
3442
return new ApplicationResponse
3543
{
3644
ApplicationNumber = domain.ApplicationNumber,
@@ -46,7 +54,7 @@ private static ApplicationResponse ToResponse(this Application domain)
4654
CardDeactivatedAt = domain.CardDeactivatedAt,
4755
Children = domain.Children.Select(ToResponse).ToList(),
4856
ChildrenOnApplication = domain.ChildrenOnApplication,
49-
IssuanceType = domain.IssuanceType
57+
IssuanceType = issuanceType
5058
};
5159
}
5260

src/SEBT.Portal.Infrastructure/Repositories/MockHouseholdRepository.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,11 @@ private static HouseholdData CreateCopy(HouseholdData source, PiiVisibility piiV
517517
CardMailedAt = a.CardMailedAt,
518518
CardActivatedAt = a.CardActivatedAt,
519519
CardDeactivatedAt = a.CardDeactivatedAt,
520-
IssuanceType = a.IssuanceType,
520+
// If application-level issuance type isn't set, inherit from the
521+
// household-level BenefitIssuanceType (both enums share the same values)
522+
IssuanceType = a.IssuanceType != IssuanceType.Unknown
523+
? a.IssuanceType
524+
: (IssuanceType)(int)source.BenefitIssuanceType,
521525
Children = a.Children.Select(c => new Child
522526
{
523527
CaseNumber = c.CaseNumber,

src/SEBT.Portal.Web/src/features/household/components/ChildCard/ChildCard.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,6 @@ export function ChildCard({ child, application, id, defaultExpanded = true }: Ch
6363
data-testid="accordion-content"
6464
>
6565
<dl className="margin-0">
66-
{cardTypeKey && (
67-
<>
68-
<dt className="text-bold margin-top-2">{t('cardTableHeadingCardType')}</dt>
69-
<dd className="margin-left-0">{t(cardTypeKey)}</dd>
70-
</>
71-
)}
7266
{benefitIssueDate && (
7367
<>
7468
<dt className="text-bold margin-top-2">{t('cardTableHeadingIssued')}</dt>
@@ -81,6 +75,12 @@ export function ChildCard({ child, application, id, defaultExpanded = true }: Ch
8175
<dd className="margin-left-0">{formatDate(benefitExpirationDate, i18n.language)}</dd>
8276
</>
8377
)}
78+
{cardTypeKey && (
79+
<>
80+
<dt className="text-bold margin-top-2">{t('cardTableHeadingCardType')}</dt>
81+
<dd className="margin-left-0">{t(cardTypeKey)}</dd>
82+
</>
83+
)}
8484
{showCardLast4 && last4DigitsOfCard && (
8585
<>
8686
<dt className="text-bold margin-top-2">{t('cardTableHeadingCardNumber')}</dt>

0 commit comments

Comments
 (0)