@@ -34,11 +34,10 @@ import {
3434 IndexCode ,
3535 isHead ,
3636 MAX_FILE_SIZE ,
37+ ProjectPreview ,
3738 ReimbursementProductFormArgs ,
3839 ReimbursementReceiptUploadArgs ,
39- Vendor ,
40- WbsNumber ,
41- wbsPipe
40+ Vendor
4241} from 'shared' ;
4342import { ClearIcon , DatePicker } from '@mui/x-date-pickers' ;
4443import ReimbursementProductTable from './ReimbursementProductTable' ;
@@ -50,7 +49,6 @@ import React, { useState, useEffect, useMemo, useRef } from 'react';
5049import { useToast } from '../../../hooks/toasts.hooks' ;
5150import { Link as RouterLink } from 'react-router-dom' ;
5251import { routes } from '../../../utils/routes' ;
53- import { wbsNumComparator } from 'shared' ;
5452import { codeAndRefundSourceName , accountCodePipe } from '../../../utils/pipes' ;
5553import { imagePreviewUrl } from '../../../utils/reimbursement-request.utils' ;
5654import { useCreateVendor } from '../../../hooks/finance.hooks' ;
@@ -64,9 +62,10 @@ interface ReimbursementRequestFormViewProps {
6462 allVendors : Vendor [ ] ;
6563 allAccountCodes : AccountCode [ ] ;
6664 receiptFiles : ReimbursementReceiptUploadArgs [ ] ;
67- allWbsElements : {
68- wbsNum : WbsNumber ;
69- wbsName : string ;
65+ allProjects : ProjectPreview [ ] ;
66+ projectAutocompleteOptions : {
67+ label : string ;
68+ id : string ;
7069 } [ ] ;
7170 control : Control < ReimbursementRequestFormInput , any > ;
7271 reimbursementProducts : ReimbursementProductFormArgs [ ] ;
@@ -92,7 +91,8 @@ interface ReimbursementRequestFormViewProps {
9291const ReimbursementRequestFormView : React . FC < ReimbursementRequestFormViewProps > = ( {
9392 allVendors,
9493 allAccountCodes,
95- allWbsElements,
94+ allProjects,
95+ projectAutocompleteOptions,
9696 receiptFiles,
9797 reimbursementProducts,
9898 control,
@@ -227,13 +227,6 @@ const ReimbursementRequestFormView: React.FC<ReimbursementRequestFormViewProps>
227227 . reduce ( ( acc : number , product : ReimbursementProductFormArgs ) => acc + Number ( product . cost ) , 0 )
228228 . toFixed ( 2 ) ;
229229
230- const wbsElementAutocompleteOptions = allWbsElements . map ( ( wbsElement ) => ( {
231- label : wbsPipe ( wbsElement . wbsNum ) + ' - ' + wbsElement . wbsName ,
232- id : wbsPipe ( wbsElement . wbsNum )
233- } ) ) ;
234-
235- wbsElementAutocompleteOptions . sort ( ( wbsNum1 , wbsNum2 ) => wbsNumComparator ( wbsNum1 . id , wbsNum2 . id ) ) ;
236-
237230 const { isLoading, isError, error, data : financeDelegates } = useGetFinanceDelegates ( ) ;
238231
239232 if ( isLoading || ! financeDelegates ) {
@@ -850,7 +843,7 @@ const ReimbursementRequestFormView: React.FC<ReimbursementRequestFormViewProps>
850843 reimbursementProducts = { reimbursementProducts }
851844 appendProduct = { reimbursementProductAppend }
852845 removeProduct = { reimbursementProductRemove }
853- wbsElementAutocompleteOptions = { wbsElementAutocompleteOptions }
846+ projectAutocompleteOptions = { projectAutocompleteOptions }
854847 watch = { watch }
855848 register = { register }
856849 setValue = { setValue }
@@ -860,6 +853,7 @@ const ReimbursementRequestFormView: React.FC<ReimbursementRequestFormViewProps>
860853 secondRefundSourceIndexCode = { secondRefundSourcePassed }
861854 firstRefundSourceName = { firstRefundSource . name }
862855 secondRefundSourceName = { secondRefundSource . name }
856+ allProjects = { allProjects }
863857 />
864858 < FormHelperText error > { errors . reimbursementProducts ?. message } </ FormHelperText >
865859 </ FormControl >
0 commit comments