-
Notifications
You must be signed in to change notification settings - Fork 477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds support for searching user type in user creation form #7332
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
bc3d2ca
fixes responsive design in patient details
Ashutosh0602 f67a927
fixes username validation
Ashutosh0602 6564585
fixes button resposive of user card
Ashutosh0602 d19d06a
fix in searching user type
Ashutosh0602 6e85db4
Revert "fixes button resposive of user card"
Ashutosh0602 cb71fc4
Revert "fixes username validation"
Ashutosh0602 b91541e
Revert "fixes responsive design in patient details"
Ashutosh0602 61f7b6d
fixes searching user types
Ashutosh0602 217eee7
removed comment and any type
Ashutosh0602 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -41,6 +41,7 @@ import routes from "../../Redux/api"; | |||||
import request from "../../Utils/request/request"; | ||||||
import useQuery from "../../Utils/request/useQuery"; | ||||||
import CareIcon from "../../CAREUI/icons/CareIcon"; | ||||||
import AutocompleteFormField from "../Form/FormFields/Autocomplete"; | ||||||
|
||||||
const Loading = lazy(() => import("../Common/Loading")); | ||||||
|
||||||
|
@@ -266,6 +267,20 @@ export const UserAdd = (props: UserProps) => { | |||||
}, | ||||||
}); | ||||||
|
||||||
const { loading: isStateLoading } = useQuery(routes.statesList, { | ||||||
onResponse: ({ data }) => { | ||||||
if (!data) { | ||||||
return; | ||||||
} | ||||||
|
||||||
if (userIndex <= USER_TYPES.indexOf("StateAdmin")) { | ||||||
setStates([authUser.state_object!]); | ||||||
} else { | ||||||
setStates(data.results); | ||||||
} | ||||||
}, | ||||||
}); | ||||||
|
||||||
const { loading: isLocalbodyLoading } = useQuery( | ||||||
routes.getAllLocalBodyByDistrict, | ||||||
{ | ||||||
|
@@ -282,17 +297,6 @@ export const UserAdd = (props: UserProps) => { | |||||
} | ||||||
); | ||||||
|
||||||
const { loading: isStateLoading } = useQuery(routes.statesList, { | ||||||
onResponse: (result) => { | ||||||
if (!result || !result.res || !result.data) return; | ||||||
if (userIndex <= USER_TYPES.indexOf("StateAdmin")) { | ||||||
setStates([authUser.state_object!]); | ||||||
} else { | ||||||
setStates(result.data.results); | ||||||
} | ||||||
}, | ||||||
}); | ||||||
|
||||||
const handleDateChange = (e: FieldChangeEvent<Date>) => { | ||||||
if (dayjs(e.value).isValid()) { | ||||||
dispatch({ | ||||||
|
@@ -328,7 +332,7 @@ export const UserAdd = (props: UserProps) => { | |||||
setSelectedFacility(selected as FacilityModel[]); | ||||||
const form = { ...state.form }; | ||||||
form.facilities = selected | ||||||
? (selected as FacilityModel[]).map((i) => i.id ?? -1) | ||||||
? (selected as FacilityModel[]).map((i) => parseInt(i.id as string) ?? -1) | ||||||
: []; | ||||||
dispatch({ type: "set_form", form }); | ||||||
}; | ||||||
|
@@ -583,10 +587,6 @@ export const UserAdd = (props: UserProps) => { | |||||
} | ||||||
}; | ||||||
|
||||||
if (isLoading) { | ||||||
return <Loading />; | ||||||
} | ||||||
|
||||||
const field = (name: string) => { | ||||||
return { | ||||||
id: name, | ||||||
|
@@ -597,14 +597,18 @@ export const UserAdd = (props: UserProps) => { | |||||
}; | ||||||
}; | ||||||
|
||||||
if (isLoading) { | ||||||
return <Loading />; | ||||||
} | ||||||
|
||||||
return ( | ||||||
<Page | ||||||
title={headerText} | ||||||
options={ | ||||||
<Link | ||||||
href="https://school.coronasafe.network/targets/12953" | ||||||
href="https://school.coronasafe.network/targets/12953 " | ||||||
className="inline-block rounded border border-gray-600 bg-gray-50 px-4 py-2 text-gray-600 transition hover:bg-gray-100" | ||||||
target="_blank" | ||||||
target="_blank " | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was this changed?
Suggested change
|
||||||
> | ||||||
<CareIcon icon="l-info-circle" className="text-lg" /> Need Help? | ||||||
</Link> | ||||||
|
@@ -631,13 +635,15 @@ export const UserAdd = (props: UserProps) => { | |||||
showAll={false} | ||||||
/> | ||||||
</div> | ||||||
<SelectFormField | ||||||
|
||||||
<AutocompleteFormField | ||||||
{...field("user_type")} | ||||||
required | ||||||
label="User Type" | ||||||
options={userTypes} | ||||||
placeholder="Search for a user type..." | ||||||
options={userTypes ?? []} | ||||||
optionLabel={(o) => o.role + (o.readOnly ? " (Read Only)" : "")} | ||||||
optionValue={(o) => o.id} | ||||||
required | ||||||
/> | ||||||
|
||||||
{state.form.user_type === "Doctor" && ( | ||||||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While saving the file extra space removed.
Is this making any conflict?