Skip to content

Commit

Permalink
Merge pull request #1207 from mozzy11/develop
Browse files Browse the repository at this point in the history
update  search bar to redirect to patient History
  • Loading branch information
mozzy11 authored Jul 25, 2024
2 parents 750a241 + 4a8b0bf commit 04ce7a1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 52 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/admin/reflexTests/ReflexStyles.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ body {
margin-left: 0px;
overflow-y: auto;
padding-left: 0px;
width: 330px;
width: 30%;
z-index: 10;
position: absolute;
background-color: #ffffff;
Expand Down
13 changes: 1 addition & 12 deletions frontend/src/components/layout/search/searchBar.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@
border: 2px solid #110f74;
}

.suggestions {
right: -10px;
position: relative;
top: 45px;
}

.patients {
overflow-y: auto;
Expand Down Expand Up @@ -68,9 +63,7 @@
width: 100%;
}

.suggestions {
width: 100%;
}

}

@media (min-width: 769px) and (max-width: 1024px) {
Expand All @@ -86,8 +79,4 @@
.search-input {
width: 75%;
}

.suggestions {
width: 75%;
}
}
39 changes: 1 addition & 38 deletions frontend/src/components/layout/search/searchBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,10 @@ const SearchBar = (props) => {
const [loading, setLoading] = useState(false);
const [patientData, setPatientData] = useState([]);
const intl = useIntl();

const validPatients = patientData.filter(
(patient) => patient.patientID && patient.firstName && patient.lastName,
);

const {
textValue,
filteredSuggestions,
showSuggestions,
onChange: handleAutocompleteChange,
onClick: handleAutocompleteClick,
onKeyDown: handleAutocompleteKeyDown,
activeSuggestion,
onDelete: handleAutocompleteDelete,
setTextValue,
} = useAutocomplete({
value: searchInput,
Expand Down Expand Up @@ -87,18 +77,11 @@ const SearchBar = (props) => {
setLoading(false);
});
} else {
setPatientData([]);
setLoading(false);
}
};

const handleSuggestionClick = (e, id, suggestion) => {
setSearchInput(suggestion.value);
handleAutocompleteClick(e, id, suggestion);
};

const handleSuggestionDelete = (id) => {
handleAutocompleteDelete(id);
};

return (
<Layer className="main">
Expand Down Expand Up @@ -129,26 +112,6 @@ const SearchBar = (props) => {
<FormattedMessage id="label.button.search" />
</Button>
</div>
{showSuggestions && (
<ul className="suggestions">
{filteredSuggestions.map((suggestion, index) => (
<p
key={suggestion.id}
className={
index === activeSuggestion ? "suggestion-active" : ""
}
>
<span
onClick={(e) =>
handleSuggestionClick(e, suggestion.id, suggestion)
}
>
{suggestion.value}
</span>
</p>
))}
</ul>
)}
</Column>

<Column sm={4} md={6} lg={8} xlg={12}>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/layout/search/searchService.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const fetchPatientData = async (query, callback) => {

export const openPatientResults = (patientId) => {
if (patientId) {
window.location.href = "/ModifyOrder?patientId=" + patientId;
window.location.href = "/PatientResults/" + patientId;
}
};

Expand Down

0 comments on commit 04ce7a1

Please sign in to comment.