-
Notifications
You must be signed in to change notification settings - Fork 646
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
Replaced older components in ResourceUpdateDetails page with Shadcn component #10202
Closed
NikhilA8606
wants to merge
126
commits into
ohcnetwork:issues/#10048/Upgrading-old-UI-components-with-new-ones
from
NikhilA8606:issues/#10048/Upgrading-old-UI-components-with-new-ones
Closed
Changes from 2 commits
Commits
Show all changes
126 commits
Select commit
Hold shift + click to select a range
9bae571
Fixed alignment of components in mobile view (#10038)
manmeetnagii df5fc1e
Bump @radix-ui/react-toast from 1.2.4 to 1.2.5 (#10116)
dependabot[bot] d0aceea
Bump @sentry/browser from 8.50.0 to 8.51.0 (#10117)
dependabot[bot] 75164fd
switched to ubuntu-24.04-arm runners (#10026)
tellmeY18 363ef98
Fix : Date field overflow in exception form in mobile view (#10112)
Mahendar0701 c0e0c56
Bump @rollup/rollup-linux-arm64-gnu from 4.30.1 to 4.31.0 (#10065)
dependabot[bot] 1dc821b
Fix: Incorrect Icon in Patient nav bar | Facility switcher hovering a…
Rishith25 19141a3
Added Skeleton Loader for Care public page | Adjusted the roundness o…
Rishith25 923423f
Fix: Unwanted scrolling and spacing on availability page (#10130)
rajku-dev 1a1afd6
Added `date-field` reusable component; Migrated old DateFormFields to…
NikhilA8606 e60b48b
fixes dob formatting of patient registration (#10135)
rithviknishad a9a2a05
fix unintended error message in questionnaire (#10151)
rithviknishad 55217c6
Bump @rollup/rollup-linux-x64-gnu from 4.30.1 to 4.32.0 (#10141)
dependabot[bot] 4c0991e
Add renovate.json (#10132)
renovate[bot] ba3ca88
Change `organizations_remove` route method to DELETE (#10159)
rajku-dev 4cc0e21
Update dependency vite to v5.4.12 [SECURITY] (#10152)
renovate[bot] e43fe7d
Update dependency @tailwindcss/forms to v0.5.10 (#10161)
renovate[bot] 7e10ba0
Upgrade to `Eslint` v9 (#10102)
AdityaJ2305 b88e7d0
Update dependency @tailwindcss/forms to v0.5.10 (#10168)
renovate[bot] 5624f9a
Update dependency vite to v5.4.12 [SECURITY] (#10167)
renovate[bot] c51ef57
Update dependency @types/node to v22.10.10 (#10163)
renovate[bot] 0c06afc
Update dependency @tailwindcss/typography to v0.5.16 (#10162)
renovate[bot] 0acf586
Fix dev server (#10174)
sainak 30e057d
Added required field validation and scroll before submit for questio…
Jacobjeevan 131111f
reset questionnaire errors (#10177)
Jacobjeevan acbb262
Update renovate config (#10184)
rithviknishad 0b053f6
Update all dependencies (minor, patch) (#10185)
renovate[bot] 41d4c29
Replaced old components in Resource Details Update page to shadcn com…
NikhilA8606 0f82aa0
Replace older components in ResourceDetailsUpdate page with shadcn co…
NikhilA8606 dad3637
Prefill Structured Data; Add Edit Links for Structured (#9992)
gigincg e6f6859
Trigger default filters apply logic only when there are no search par…
rithviknishad 4d1ace2
fixes year_of_birth post patient registration success (#10206)
rithviknishad 8cc177e
New Cypress Test for Creation Of Questionnaire (#10210)
nihal467 e17cd88
Remove Query Invalidation after Questionnaire Batch Request
gigincg 4ae8e8b
changed latitude longitude type to a number in facility create form (…
khavinshankar a481488
added i18n support for plugins (#10182)
khavinshankar 6834157
Confirm Alert for Patient Registration (#10205)
Jacobjeevan 892dc4a
Render multi line text in Questionnaire Response (#10216)
rajku-dev 4a30d79
Bump lucide-react from 0.473.0 to 0.474.0 (#10209)
dependabot[bot] 58234fd
Update all dependencies (minor, patch) (#10222)
renovate[bot] 6a665ab
disable dependabot updates in favour of renovate (#10223)
rithviknishad e18ef85
Update actions/github-script action to v7 (#10193)
renovate[bot] 40cc96e
Update actions/checkout action to v4 (#10189)
renovate[bot] f8693d8
fixed inputs focus issue in plugs when a dialog is child of dropdown …
khavinshankar 1ffff23
Update dependency marked to v15 (#10225)
renovate[bot] 153926a
Fix: Adjust Image Upload Button Width in Edit Cover Photo and Avatar …
modamaan 2e681c6
Update actions/stale action to v9 (#10194)
renovate[bot] d586d13
added dpg badge to readme (#10134)
shivankacker 230b483
Switch to `PhoneInput` (#10214)
rithviknishad b476406
Remove 'discharge' from MedicationAdministration category types (#10232)
rithviknishad c0197cd
Enhance Practitioner Selection in Book Appointment Page (#10236)
rithviknishad 99eb563
Remove slot type selection from schedule template forms (#10238)
rithviknishad 2b8aaa0
Refactor Token Slot Button into Reusable Component (#10244)
rithviknishad 8d0999f
prevent showing callout when slots are negative (#10242)
rithviknishad 9858102
Follow Up: Upgrade `Eslint` version to v9 (#10180)
AdityaJ2305 ee9cfdb
Update dependency eslint-config-prettier to v10 (#10197)
renovate[bot] 5b6ddea
Fixes incorrect count in appointments column when search query is pre…
rithviknishad 1d8fc2f
Remove status change dropdown from AppointmentActions component (#10248)
rithviknishad 1568bfd
Update all dependencies (minor, patch) (#10245)
renovate[bot] 0c3342f
Disable Unnecessary Browser Pop-up on Patient Registration Form (#10251)
AdityaJ2305 25cdaf6
Patient Age and Facility Location Edits (#10260)
Jacobjeevan 5cd4b17
Fix Layout Overflow on Appointment and Patient Details Pages for Mobi…
modamaan 33c322e
Fix: Facility Creation Form: Pincode Autofill Overwrites Pre-filled G…
Rishith25 34a4a29
Update dependency prettier-plugin-tailwindcss to v0.6.11 (#10179)
renovate[bot] 19ae5be
Update all dependencies (minor, patch) (#10268)
renovate[bot] 3dd7132
Update dependency vite-plugin-pwa to ^0.21.0 (#10188)
renovate[bot] ee73c80
Update docker/setup-buildx-action action to v3 (#10271)
renovate[bot] 881610a
Update docker/build-push-action action to v6 (#10270)
renovate[bot] d9689df
Update leonsteinhaeuser/project-beta-automations action to v2 (#10274)
renovate[bot] 9b6dcbd
Feat: Display total no. of entities with heading in Organization (#10…
AdityaJ2305 dcf2bb9
Patient Detail Tabs: Org List Access (#10121)
Jacobjeevan 933fff1
Replaced all TextAreaForm component with Textarea shadcn ui component…
NikhilA8606 2e770cd
Update prince-chrismc/label-merge-conflicts-action action to v3 (#10276)
renovate[bot] 3976382
Update dependency sonner to v1.7.3 (#10281)
renovate[bot] b949c64
Add Real-Time Validation for `CreateUserForm` and Standardize UI Acr…
AdityaJ2305 3bdb1ee
Fix: Adjust spacing and overflow behavior in FileUploadDialog compone…
DonXavierdev bd0557b
Fix the accessibility issue by adding DialogTitle to DialogContent an…
modamaan fcd08c8
Update dependency ubuntu to v24 (#10229)
renovate[bot] bcd3c7b
Fix type edit in QuestionnaireEditor
gigincg 4d4aa18
Add location pages
bodhish 50cb157
Add facility settings routes and layout
bodhish 7ba933c
Nested Routes for Facility Settings; Org to Departments
gigincg 36d7ac7
Update dependency undici to v5.28.5
bodhish cdf4e46
patient registration in multiple combination (#10287)
nihal467 284f1a2
Reorganize Facility Settings
gigincg db0a8d6
Simplify GeneralSettings to use FacilityHome component
bodhish 5edb84e
Update theme color; update icons; remove unused assets (#10292)
rithviknishad e35cc72
Add overview page
bodhish 81a6257
Refactor Facility Settings; Location Organizations
gigincg b834ee4
added * to all mandatory fields in resource create (#10314)
nihal467 023208b
Expand the cypress to search a patient and create an encounter (#10317)
nihal467 febfcae
Fix: View Facility Redirection in public page is broken (#10318)
AdityaJ2305 6be23f5
Update all dependencies (minor, patch) (#10290)
renovate[bot] fd9f145
showing "-" in the emergency contact person field to represent the fi…
Prakhar29Sharma 34c7b68
fixed the redirection in organisation (#10328)
nihal467 3f238c5
Fix: Use headers.set() instead of headers.append() in makeHeaders (#1…
rithviknishad 54a474a
Set theme color to white in vite PWA manifest (#10321)
rithviknishad 5abeec2
Expose dev server to host (#10330)
rithviknishad 8645c58
Remove automatic picker show for date and time inputs (#10331)
rithviknishad 928bfc6
fix Page in location: infer location.mode;
gigincg b4e9216
Rm whatsapp phone number, hide email for updates (#10334)
Jacobjeevan e4b291a
Dob/Age and Lat/Log Override (#10280)
Jacobjeevan 71439ba
Remove pin-code autofill feature (#10291)
rithviknishad c9a3764
fix responsiveness of date field and gender in public patient registr…
rithviknishad 4694c21
Make autocompletes mobile friendly (#10336)
rithviknishad a7fca70
Add empty parent parameter to location and organization list queries
bodhish db35974
removed hard corded values in the appointments (#10337)
nihal467 e8d5348
Refactor location list views with reusable LocationCard component
bodhish 55d5790
fix: Align and format cards in Health Profile (#10298)
ashwinpraveengo 2298ed5
Fix Camera Capture and Upload Workflow (#10326)
rajku-dev 44b728b
Fix: Resource Letter printing issue (#10230)
AdityaJ2305 7b61652
Remove index-based numbering from appointments table row (#10338)
rithviknishad 46caeff
Patient Updates Tab, Structured responses filter by Encounter (#10329)
amjithtitus09 1c41bf8
Location Update fix (#10339)
amjithtitus09 5a7bdb8
Resources redesign (#10308)
Jacobjeevan 4d9e7d0
ResourceUpdates Bug Fix (#10341)
Jacobjeevan 3461004
Update dependency jsdom to v26 (#10224)
renovate[bot] 0ab906c
Update dependency tailwind-merge to v3 (#10300)
renovate[bot] b6ea55d
Update all dependencies (minor, patch) (#10343)
renovate[bot] 6f77a69
Cleanup: Remove unnecessary GitHub workflows and update linter Node.j…
rithviknishad 4f295a0
Replaced older components in the useFileManager with shadcn component…
NikhilA8606 66104a8
Update all dependencies (minor, patch) (#10346)
renovate[bot] 893bef5
Replace diary_free with dairy_free (#10187)
mdimado 9379baa
Update github/ossar-action to v1 (#10153)
renovate[bot] 313f0b5
fix missing wave image files (#10357)
rithviknishad 722677b
Completed all required changes in ResourceDetailsUpdate
NikhilA8606 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
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 |
---|---|---|
@@ -1,22 +1,27 @@ | ||
import { t } from "i18next"; | ||
import { navigate, useQueryParams } from "raviger"; | ||
import { useReducer, useState } from "react"; | ||
import { useEffect, useReducer, useState } from "react"; | ||
import { toast } from "sonner"; | ||
|
||
import Card from "@/CAREUI/display/Card"; | ||
|
||
import Autocomplete, { AutoCompleteOption } from "@/components/ui/autocomplete"; | ||
import { Button } from "@/components/ui/button"; | ||
import { Input } from "@/components/ui/input"; | ||
import { Label } from "@/components/ui/label"; | ||
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; | ||
import { | ||
Select, | ||
SelectContent, | ||
SelectItem, | ||
SelectTrigger, | ||
} from "@/components/ui/select"; | ||
import { Textarea } from "@/components/ui/textarea"; | ||
|
||
import CircularProgress from "@/components/Common/CircularProgress"; | ||
import { FacilitySelect } from "@/components/Common/FacilitySelect"; | ||
import Loading from "@/components/Common/Loading"; | ||
import Page from "@/components/Common/Page"; | ||
import UserAutocomplete from "@/components/Common/UserAutocompleteFormField"; | ||
import { FieldLabel } from "@/components/Form/FormFields/FormField"; | ||
import RadioFormField from "@/components/Form/FormFields/RadioFormField"; | ||
import { SelectFormField } from "@/components/Form/FormFields/SelectFormField"; | ||
import TextAreaFormField from "@/components/Form/FormFields/TextAreaFormField"; | ||
import TextFormField from "@/components/Form/FormFields/TextFormField"; | ||
import { FieldChangeEvent } from "@/components/Form/FormFields/Utils"; | ||
import { UserModel } from "@/components/Users/models"; | ||
|
||
|
@@ -27,6 +32,8 @@ import { RESOURCE_CHOICES } from "@/common/constants"; | |
import routes from "@/Utils/request/api"; | ||
import request from "@/Utils/request/request"; | ||
import useTanStackQueryInstead from "@/Utils/request/useQuery"; | ||
import { FacilityData } from "@/types/facility/facility"; | ||
import facilityApi from "@/types/facility/facilityApi"; | ||
import { UpdateResourceRequest } from "@/types/resourceRequest/resourceRequest"; | ||
|
||
interface resourceProps { | ||
|
@@ -64,6 +71,31 @@ export const ResourceDetailsUpdate = (props: resourceProps) => { | |
const [qParams, _] = useQueryParams(); | ||
const [isLoading, setIsLoading] = useState(true); | ||
const [assignedUser, SetAssignedUser] = useState<UserModel>(); | ||
const [data, setData] = useState<AutoCompleteOption[]>([]); | ||
const query = { | ||
limit: 50, | ||
offset: 0, | ||
search_text: "", | ||
all: true, | ||
facility_type: 1510, | ||
exclude_user: "", | ||
}; | ||
useEffect(() => { | ||
const retriveData = async () => { | ||
const { data } = await request(facilityApi.getAllFacilities, { query }); | ||
const facilities: AutoCompleteOption[] = []; | ||
data?.results!.map((facility: FacilityData) => { | ||
facilities.push({ | ||
label: facility.name, | ||
value: facility.id, | ||
}); | ||
}); | ||
setData(facilities); | ||
}; | ||
|
||
retriveData(); | ||
}, [data]); | ||
|
||
const resourceFormReducer = (state = initialState, action: any) => { | ||
switch (action.type) { | ||
case "set_form": { | ||
|
@@ -124,12 +156,6 @@ export const ResourceDetailsUpdate = (props: resourceProps) => { | |
dispatch({ type: "set_form", form }); | ||
}; | ||
|
||
const setFacility = (selected: any, name: string) => { | ||
const form = { ...state.form }; | ||
form[name] = selected; | ||
dispatch({ type: "set_form", form }); | ||
}; | ||
|
||
const { data: resourceDetails } = useTanStackQueryInstead( | ||
routes.getResourceDetails, | ||
{ | ||
|
@@ -156,7 +182,7 @@ export const ResourceDetailsUpdate = (props: resourceProps) => { | |
status: state.form.status, | ||
origin_facility: state.form.origin_facility?.id, | ||
assigned_facility: state.form?.assigned_facility?.id, | ||
emergency: [true, "true"].includes(state.form.emergency), | ||
emergency: state.form.emergency, | ||
title: state.form.title, | ||
reason: state.form.reason, | ||
assigned_to: state.form.assigned_to, | ||
|
@@ -200,22 +226,34 @@ export const ResourceDetailsUpdate = (props: resourceProps) => { | |
<Card className="flex w-full flex-col"> | ||
<div className="grid grid-cols-1 gap-4 md:grid-cols-2"> | ||
<div className="md:col-span-1"> | ||
<SelectFormField | ||
label="Status" | ||
name="status" | ||
<Label className="text-gray-700 mt-2 mb-3">{t("status")}</Label> | ||
<Select | ||
value={state.form.status} | ||
options={resourceStatusOptions} | ||
onChange={handleChange} | ||
optionLabel={(option) => option} | ||
/> | ||
onValueChange={(value) => | ||
handleChange({ name: "status", value }) | ||
} | ||
> | ||
<SelectTrigger className="mt-2"> | ||
<span>{state.form.status || "Select an option"}</span> | ||
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. missing i18n translations btw |
||
</SelectTrigger> | ||
<SelectContent> | ||
{resourceStatusOptions.map((option, index) => ( | ||
<SelectItem key={index} value={option}> | ||
{option} | ||
</SelectItem> | ||
))} | ||
</SelectContent> | ||
</Select> | ||
</div> | ||
<div className="md:col-span-1"> | ||
<div className=""> | ||
<Label className="text-gray-700 mt-2 mb-2"> | ||
{t("assigned_to")} | ||
</Label> | ||
{assignedUserLoading ? ( | ||
<CircularProgress /> | ||
) : ( | ||
<UserAutocomplete | ||
label="Assigned To" | ||
value={assignedUser === null ? undefined : assignedUser} | ||
onChange={handleOnSelect} | ||
error="" | ||
|
@@ -226,56 +264,82 @@ export const ResourceDetailsUpdate = (props: resourceProps) => { | |
</div> | ||
|
||
<div> | ||
<FieldLabel> | ||
What facility would you like to assign the request to | ||
</FieldLabel> | ||
<FacilitySelect | ||
multiple={false} | ||
name="assigned_facility" | ||
facilityType={1510} | ||
selected={state.form.assigned_facility_object} | ||
setSelected={(obj) => | ||
setFacility(obj, "assigned_facility_object") | ||
<Label className="text-gray-700 -mt-3 mb-3"> | ||
{t("facility_assign_request")} | ||
</Label> | ||
<Autocomplete | ||
options={data} | ||
value={state.form.assigned_facility} | ||
onChange={(value) => | ||
handleChange({ name: "assigned_facility", value }) | ||
} | ||
errors={state.errors.assigned_facility} | ||
placeholder="Select Facility" | ||
/> | ||
</div> | ||
|
||
<div className="md:col-span-2"> | ||
<TextFormField | ||
<Label className="text-gray-700 mb-3 mt-1"> | ||
{t("request_title")} | ||
</Label> | ||
<Input | ||
name="title" | ||
type="text" | ||
label="Request Title*" | ||
placeholder="Type your title here" | ||
value={state.form.title} | ||
onChange={handleChange} | ||
error={state.errors.title} | ||
onChange={(e) => | ||
handleChange({ name: e.target.name, value: e.target.value }) | ||
} | ||
/> | ||
{state.errors.title && ( | ||
<p className="text-red-500 text-sm mt-2"> | ||
{state.errors.emergency} | ||
</p> | ||
)} | ||
</div> | ||
|
||
<div className="md:col-span-2"> | ||
<TextAreaFormField | ||
<Label className="text-gray-700 mb-3 mt-1"> | ||
{t("request_reason")} | ||
</Label> | ||
<Textarea | ||
rows={5} | ||
name="reason" | ||
placeholder="Type your description here" | ||
value={state.form.reason} | ||
onChange={handleChange} | ||
label="Reason of Request*" | ||
error={state.errors.reason} | ||
onChange={(e) => | ||
handleChange({ name: e.target.name, value: e.target.value }) | ||
} | ||
/> | ||
{state.errors.reason && ( | ||
<p className="text-red-500 text-sm mt-2"> | ||
{state.errors.emergency} | ||
</p> | ||
)} | ||
</div> | ||
|
||
<div> | ||
<RadioFormField | ||
<Label className="text-gray-700 mb-3 mt-1"> | ||
{t("is_this_an_emergency")} | ||
</Label> | ||
<RadioGroup | ||
name="emergency" | ||
onChange={handleChange} | ||
label={"Is this an emergency?"} | ||
options={[true, false]} | ||
optionLabel={(o) => (o ? "Yes" : "No")} | ||
optionValue={(o) => String(o)} | ||
value={String(state.form.emergency)} | ||
error={state.errors.emergency} | ||
/> | ||
onValueChange={(value) => | ||
handleChange({ name: "emergency", value: value === "true" }) | ||
} | ||
> | ||
<div className="flex items-center space-x-2"> | ||
<RadioGroupItem value="true" /> | ||
<Label>{t("yes")}</Label> | ||
<RadioGroupItem value="false" /> | ||
<Label>{t("no")}</Label> | ||
</div> | ||
</RadioGroup> | ||
{state.errors.emergency && ( | ||
<p className="text-red-500 text-sm mt-2"> | ||
{state.errors.emergency} | ||
</p> | ||
)} | ||
</div> | ||
|
||
<div className="mt-4 flex flex-col justify-between gap-2 md:col-span-2 md:flex-row"> | ||
|
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 |
---|---|---|
|
@@ -18,7 +18,7 @@ import { | |
PopoverTrigger, | ||
} from "@/components/ui/popover"; | ||
|
||
interface AutoCompleteOption { | ||
export interface AutoCompleteOption { | ||
label: string; | ||
value: string; | ||
} | ||
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. this change won't be needed once the previously mentioned thing is done |
||
|
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.
Let's not use
request
+useEffect
+useState
. Let's useuseQuery
instead to achieve data fetching.Refer: https://docs.ohc.network/docs/care/development/data-fetching-in-care/