@@ -34,10 +34,10 @@ import {
3434 IndexCode ,
3535 isHead ,
3636 MAX_FILE_SIZE ,
37+ Project ,
3738 ReimbursementProductFormArgs ,
3839 ReimbursementReceiptUploadArgs ,
3940 Vendor ,
40- WbsNumber ,
4141 wbsPipe
4242} from 'shared' ;
4343import { ClearIcon , DatePicker } from '@mui/x-date-pickers' ;
@@ -64,9 +64,10 @@ interface ReimbursementRequestFormViewProps {
6464 allVendors : Vendor [ ] ;
6565 allAccountCodes : AccountCode [ ] ;
6666 receiptFiles : ReimbursementReceiptUploadArgs [ ] ;
67- allWbsElements : {
68- wbsNum : WbsNumber ;
69- wbsName : string ;
67+ allWbsElements : Project [ ] ;
68+ wbsElementAutocompleteOptions : {
69+ label : string ;
70+ id : string ;
7071 } [ ] ;
7172 control : Control < ReimbursementRequestFormInput , any > ;
7273 reimbursementProducts : ReimbursementProductFormArgs [ ] ;
@@ -93,6 +94,7 @@ const ReimbursementRequestFormView: React.FC<ReimbursementRequestFormViewProps>
9394 allVendors,
9495 allAccountCodes,
9596 allWbsElements,
97+ wbsElementAutocompleteOptions,
9698 receiptFiles,
9799 reimbursementProducts,
98100 control,
@@ -227,13 +229,6 @@ const ReimbursementRequestFormView: React.FC<ReimbursementRequestFormViewProps>
227229 . reduce ( ( acc : number , product : ReimbursementProductFormArgs ) => acc + Number ( product . cost ) , 0 )
228230 . toFixed ( 2 ) ;
229231
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-
237232 const { isLoading, isError, error, data : financeDelegates } = useGetFinanceDelegates ( ) ;
238233
239234 if ( isLoading || ! financeDelegates ) {
@@ -860,6 +855,7 @@ const ReimbursementRequestFormView: React.FC<ReimbursementRequestFormViewProps>
860855 secondRefundSourceIndexCode = { secondRefundSourcePassed }
861856 firstRefundSourceName = { firstRefundSource . name }
862857 secondRefundSourceName = { secondRefundSource . name }
858+ allWbsElements = { allWbsElements }
863859 />
864860 < FormHelperText error > { errors . reimbursementProducts ?. message } </ FormHelperText >
865861 </ FormControl >
0 commit comments