Skip to content

Commit

Permalink
Merge pull request #13774 from transcom/B-20978-INT
Browse files Browse the repository at this point in the history
B 20978 int show links for documents for DDASIT and DDDSIT
  • Loading branch information
r-mettler authored Oct 2, 2024
2 parents dec9cea + 76c4fa8 commit 5156e15
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 8 deletions.
44 changes: 36 additions & 8 deletions src/components/Office/ServiceItemDetails/ServiceItemDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ const generateDestinationSITDetailSection = (id, serviceRequestDocUploads, detai
'SIT entry date': details.sitEntryDate ? formatDateWithUTC(details.sitEntryDate, 'DD MMM YYYY') : '-',
})
: null}
{code === 'DDASIT'
? generateDetailText(
{code === 'DDASIT' && (
<>
{generateDetailText(
{
'Original delivery address': originalDeliveryAddress
? formatCityStateAndPostalCode(originalDeliveryAddress)
Expand All @@ -71,8 +72,21 @@ const generateDestinationSITDetailSection = (id, serviceRequestDocUploads, detai
'SIT expiration date': sitEndDate || '-',
},
id,
)
: null}
)}
{!isEmpty(serviceRequestDocUploads) ? (
<div className={styles.uploads}>
<p className={styles.detailType}>Download service item documentation:</p>
{serviceRequestDocUploads.map((file) => (
<div className={styles.uploads}>
<a href={file.url} download>
{trimFileName(file.filename)}
</a>
</div>
))}
</div>
) : null}
</>
)}
{code === 'DDSFSC'
? generateDetailText(
{
Expand All @@ -88,8 +102,9 @@ const generateDestinationSITDetailSection = (id, serviceRequestDocUploads, detai
id,
)
: null}
{code === 'DDDSIT'
? generateDetailText(
{code === 'DDDSIT' && (
<>
{generateDetailText(
{
'Original delivery address': originalDeliveryAddress
? formatCityStateAndPostalCode(originalDeliveryAddress)
Expand All @@ -110,8 +125,21 @@ const generateDestinationSITDetailSection = (id, serviceRequestDocUploads, detai
: '-',
},
id,
)
: null}
)}
{!isEmpty(serviceRequestDocUploads) ? (
<div className={styles.uploads}>
<p className={styles.detailType}>Download service item documentation:</p>
{serviceRequestDocUploads.map((file) => (
<div className={styles.uploads}>
<a href={file.url} download>
{trimFileName(file.filename)}
</a>
</div>
))}
</div>
) : null}
</>
)}
{code === 'DDFSIT' && (
<>
{!isEmpty(sortedCustomerContacts)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ describe('ServiceItemDetails Domestic Destination SIT', () => {

expect(screen.queryByText('SIT departure date:')).not.toBeInTheDocument();
expect(screen.queryByText('16 Mar 2024')).not.toBeInTheDocument();
expect(screen.getByText('Download service item documentation:')).toBeInTheDocument();
const downloadLink = screen.getByText('receipt.pdf');
expect(downloadLink).toBeInstanceOf(HTMLAnchorElement);
});

it('renders DDDSIT details', () => {
Expand All @@ -186,6 +189,9 @@ describe('ServiceItemDetails Domestic Destination SIT', () => {

expect(screen.getByText('SIT departure date:')).toBeInTheDocument();
expect(screen.getByText('16 Mar 2024')).toBeInTheDocument();
expect(screen.getByText('Download service item documentation:')).toBeInTheDocument();
const downloadLink = screen.getByText('receipt.pdf');
expect(downloadLink).toBeInstanceOf(HTMLAnchorElement);
});
it('renders DDDSIT details with - for the final delivery address is service item is in submitted state', () => {
render(
Expand Down

0 comments on commit 5156e15

Please sign in to comment.