Skip to content

Commit 919d5e1

Browse files
authored
Merge pull request #1419 from Northeastern-Electric-Racing/1292-finance-fixes-expense-types-should-be-displayed-with-their-code
1292 finance fixes expense types should be displayed with their code
2 parents 1fbc869 + ec52051 commit 919d5e1

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* See the LICENSE file in the repository root folder for details.
44
*/
55

6+
import { expenseTypePipe } from '../../../utils/pipes';
67
import { Edit } from '@mui/icons-material';
78
import CheckIcon from '@mui/icons-material/Check';
89
import ConfirmationNumberIcon from '@mui/icons-material/ConfirmationNumber';
@@ -118,7 +119,7 @@ const ReimbursementRequestDetailsView: React.FC<ReimbursementRequestDetailsViewP
118119
<VerticalDetailDisplay label="Refund Source" content={`${reimbursementRequest.account}`} />
119120
</Grid>
120121
<Grid item sm={6} xs={12}>
121-
<VerticalDetailDisplay label="Expense Type" content={`${reimbursementRequest.expenseType.name}`} />
122+
<VerticalDetailDisplay label="Expense Type" content={expenseTypePipe(reimbursementRequest.expenseType)} />
122123
</Grid>
123124
<Grid item sm={6} xs={12}>
124125
<VerticalDetailDisplay label="Date Delivered" content={dateUndefinedPipe(reimbursementRequest.dateDelivered)} />

src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementFormView.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import NERSuccessButton from '../../../components/NERSuccessButton';
2929
import { ReimbursementRequestFormInput } from './ReimbursementRequestForm';
3030
import { useState } from 'react';
3131
import { useToast } from '../../../hooks/toasts.hooks';
32+
import { expenseTypePipe } from '../../../utils/pipes';
3233

3334
interface ReimbursementRequestFormViewProps {
3435
allVendors: Vendor[];
@@ -195,7 +196,7 @@ const ReimbursementRequestFormView: React.FC<ReimbursementRequestFormViewProps>
195196
>
196197
{allExpenseTypes.map((expenseType) => (
197198
<MenuItem key={expenseType.expenseTypeId} value={expenseType.expenseTypeId}>
198-
{expenseType.name}
199+
{expenseTypePipe(expenseType)}
199200
</MenuItem>
200201
))}
201202
</Select>

src/frontend/src/utils/pipes.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* See the LICENSE file in the repository root folder for details.
44
*/
55

6-
import { WbsNumber, User, wbsPipe, WbsElement } from 'shared';
6+
import { WbsNumber, User, wbsPipe, WbsElement, ExpenseType } from 'shared';
77

88
/**
99
* Pipes:
@@ -85,6 +85,10 @@ export const numberParamPipe = (param: string | null) => {
8585
}
8686
};
8787

88+
export const expenseTypePipe = (expenseType: ExpenseType) => {
89+
return `${expenseType.code} - ${expenseType.name}`;
90+
};
91+
8892
/** Display timeline status in readable form
8993
* E.G. VERY_BEHIND -> Very Behind
9094
*/

0 commit comments

Comments
 (0)