File tree Expand file tree Collapse file tree
src/frontend/src/pages/FinancePage/ReimbursementRequestForm Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -102,8 +102,8 @@ const ReimbursementRequestFormView: React.FC<ReimbursementRequestFormViewProps>
102102 </ FormControl >
103103 ) ;
104104
105- const expenseTypesToAutocomplete = ( expense : ExpenseType ) : { label : string ; id : string } => {
106- return { label : expense . name , id : expense . toString ( ) } ;
105+ const expenseTypesToAutocomplete = ( expenseType : ExpenseType ) : { label : string ; id : string } => {
106+ return { label : expenseType . name , id : expenseType . expenseTypeId } ;
107107 } ;
108108
109109 return (
@@ -194,24 +194,17 @@ const ReimbursementRequestFormView: React.FC<ReimbursementRequestFormViewProps>
194194 name = "expenseTypeId"
195195 control = { control }
196196 render = { ( { field : { onChange, value } } ) => {
197+ const mappedExpenseTypes = allExpenseTypes . map ( expenseTypesToAutocomplete ) ;
197198 return (
198199 < NERAutocomplete
199- options = { allExpenseTypes . map ( expenseTypesToAutocomplete ) }
200- value = {
201- allExpenseTypes
202- . map ( expenseTypesToAutocomplete )
203- . find ( ( expenseType ) => expenseType . label === value ) || null
204- }
200+ options = { mappedExpenseTypes }
201+ value = { mappedExpenseTypes . find ( ( expenseType ) => expenseType . id === value ) || null }
205202 placeholder = "Expense Type"
206203 onChange = { ( _event , newValue ) => {
207- if ( newValue ) {
208- onChange ( newValue . label ) ;
209- } else {
210- onChange ( '' ) ;
211- }
204+ newValue ? onChange ( newValue . id ) : onChange ( '' ) ;
212205 } }
213206 id = { 'expenseType' }
214- size = { undefined }
207+ size = "small"
215208 />
216209 ) ;
217210 } }
You can’t perform that action at this time.
0 commit comments