Skip to content

Commit 0661d71

Browse files
committed
#1577: Fixed logic issue and added styling
1 parent e9c01cc commit 0661d71

2 files changed

Lines changed: 14 additions & 9 deletions

File tree

src/frontend/src/pages/FinancePage/ReimbursementRequestDetailPage/ReimbursementRequestDetailsView.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import {
3131
} from '../../../utils/pipes';
3232
import {
3333
imageDownloadUrl,
34+
imageFileUrl,
3435
imagePreviewUrl,
3536
isReimbursementRequestAdvisorApproved,
3637
isReimbursementRequestSaboSubmitted
@@ -147,7 +148,7 @@ const ReimbursementRequestDetailsView: React.FC<ReimbursementRequestDetailsViewP
147148
<Grid item xs={6} textAlign={'center'} mt={-2}>
148149
<Typography fontSize={50}>Total Cost</Typography>
149150
</Grid>
150-
<Grid xs={6} mt={-2} sx={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
151+
<Grid xs={6} mt={-2} sx={{ display: 'flex', alignItems: 'center' }}>
151152
<Typography fontSize={50}>{`$${centsToDollar(reimbursementRequest.totalCost)}`}</Typography>
152153
</Grid>
153154
</Grid>
@@ -175,15 +176,17 @@ const ReimbursementRequestDetailsView: React.FC<ReimbursementRequestDetailsViewP
175176
return (
176177
<Box sx={{ maxHeight: `250px`, overflow: reimbursementRequest.receiptPictures.length > 0 ? 'auto' : 'none' }}>
177178
<Typography variant="h5">Receipts</Typography>
178-
{reimbursementRequest.receiptPictures.map((receipt) => {
179+
{reimbursementRequest.receiptPictures.map((receipt, index, arr) => {
179180
return (
180-
<Box>
181-
<Link href={receipt.googleFileId} target="_blank" underline="hover" fontSize={19}>
182-
{receipt.name}
183-
</Link>
184-
<IconButton href={imageDownloadUrl(receipt.googleFileId)}>
185-
<DownloadIcon />
186-
</IconButton>
181+
<Box sx={{ mb: arr.length !== index + 1 ? 5 : 0 }}>
182+
<Box sx={{ width: '50%', display: 'flex', justifyContent: 'space-between', alignItems: 'flex-end' }}>
183+
<Link href={imageFileUrl(receipt.googleFileId)} target="_blank" underline="hover">
184+
{receipt.name}
185+
</Link>
186+
<IconButton href={imageDownloadUrl(receipt.googleFileId)}>
187+
<DownloadIcon />
188+
</IconButton>
189+
</Box>
187190
<iframe
188191
style={{ height: `200px`, width: '50%' }}
189192
src={imagePreviewUrl(receipt.googleFileId)}

src/frontend/src/utils/reimbursement-request.utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ export const getReimbursementRequestDateSubmittedToSabo = (reimbursementRequest:
9090

9191
export const imagePreviewUrl = (googleFileId: string) => `https://drive.google.com/file/d/${googleFileId}/preview`;
9292

93+
export const imageFileUrl = (googleFileId: string) => `https://drive.google.com/file/d/${googleFileId}`;
94+
9395
export const imageDownloadUrl = (googleFileId: string) => `https://drive.google.com/uc?export=download&id=${googleFileId}`;
9496

9597
export const getRefundRowData = (refund: Reimbursement) => {

0 commit comments

Comments
 (0)