-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Search and Filter definition for Instrument Picker done.
- Loading branch information
1 parent
92493cd
commit 3fa8944
Showing
7 changed files
with
79 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...ionary/questionaryComponents/InstrumentPicker/InstrumentPickerSearchCriteriaComponent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { Grid, TextField, Autocomplete } from '@mui/material'; | ||
import React, { useState } from 'react'; | ||
|
||
import { | ||
Call, | ||
InstrumentWithAvailabilityTime, | ||
QuestionFilterCompareOperator, | ||
} from 'generated/sdk'; | ||
import { useCallData } from 'hooks/call/useCallData'; | ||
|
||
import { SearchCriteriaInputProps } from '../../../proposal/SearchCriteriaInputProps'; | ||
|
||
function InstrumentPickerSearchCriteriaComponent({ | ||
onChange, | ||
callId, | ||
}: SearchCriteriaInputProps) { | ||
const [value, setValue] = useState<InstrumentWithAvailabilityTime | null>( | ||
null | ||
); | ||
|
||
const { call } = useCallData(callId); | ||
|
||
return ( | ||
<Grid container spacing={2}> | ||
<Grid item xs={12}> | ||
<Autocomplete | ||
id="answer" | ||
options={call?.instruments ?? []} | ||
getOptionLabel={(option) => option.name as string} | ||
renderInput={(params) => ( | ||
<TextField {...params} margin="none" label="Answer" /> | ||
)} | ||
onChange={(_event, newValue) => { | ||
setValue(newValue); | ||
if (!newValue) return; | ||
onChange( | ||
QuestionFilterCompareOperator.EQUALS, | ||
newValue.id as Call['id'] | ||
); | ||
}} | ||
value={value} | ||
data-cy="value" | ||
/> | ||
</Grid> | ||
</Grid> | ||
); | ||
} | ||
|
||
export default InstrumentPickerSearchCriteriaComponent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters