Skip to content
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
Show file tree
Hide file tree
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 Jan 23, 2025
df5fc1e
Bump @radix-ui/react-toast from 1.2.4 to 1.2.5 (#10116)
dependabot[bot] Jan 23, 2025
d0aceea
Bump @sentry/browser from 8.50.0 to 8.51.0 (#10117)
dependabot[bot] Jan 23, 2025
75164fd
switched to ubuntu-24.04-arm runners (#10026)
tellmeY18 Jan 24, 2025
363ef98
Fix : Date field overflow in exception form in mobile view (#10112)
Mahendar0701 Jan 24, 2025
c0e0c56
Bump @rollup/rollup-linux-arm64-gnu from 4.30.1 to 4.31.0 (#10065)
dependabot[bot] Jan 24, 2025
1dc821b
Fix: Incorrect Icon in Patient nav bar | Facility switcher hovering a…
Rishith25 Jan 24, 2025
19141a3
Added Skeleton Loader for Care public page | Adjusted the roundness o…
Rishith25 Jan 24, 2025
923423f
Fix: Unwanted scrolling and spacing on availability page (#10130)
rajku-dev Jan 24, 2025
1a1afd6
Added `date-field` reusable component; Migrated old DateFormFields to…
NikhilA8606 Jan 24, 2025
e60b48b
fixes dob formatting of patient registration (#10135)
rithviknishad Jan 24, 2025
a9a2a05
fix unintended error message in questionnaire (#10151)
rithviknishad Jan 24, 2025
55217c6
Bump @rollup/rollup-linux-x64-gnu from 4.30.1 to 4.32.0 (#10141)
dependabot[bot] Jan 24, 2025
4c0991e
Add renovate.json (#10132)
renovate[bot] Jan 24, 2025
ba3ca88
Change `organizations_remove` route method to DELETE (#10159)
rajku-dev Jan 25, 2025
4cc0e21
Update dependency vite to v5.4.12 [SECURITY] (#10152)
renovate[bot] Jan 25, 2025
e43fe7d
Update dependency @tailwindcss/forms to v0.5.10 (#10161)
renovate[bot] Jan 25, 2025
7e10ba0
Upgrade to `Eslint` v9 (#10102)
AdityaJ2305 Jan 25, 2025
b88e7d0
Update dependency @tailwindcss/forms to v0.5.10 (#10168)
renovate[bot] Jan 25, 2025
5624f9a
Update dependency vite to v5.4.12 [SECURITY] (#10167)
renovate[bot] Jan 25, 2025
c51ef57
Update dependency @types/node to v22.10.10 (#10163)
renovate[bot] Jan 25, 2025
0c06afc
Update dependency @tailwindcss/typography to v0.5.16 (#10162)
renovate[bot] Jan 25, 2025
0acf586
Fix dev server (#10174)
sainak Jan 25, 2025
30e057d
Added required field validation and scroll before submit for questio…
Jacobjeevan Jan 25, 2025
131111f
reset questionnaire errors (#10177)
Jacobjeevan Jan 25, 2025
acbb262
Update renovate config (#10184)
rithviknishad Jan 25, 2025
0b053f6
Update all dependencies (minor, patch) (#10185)
renovate[bot] Jan 25, 2025
41d4c29
Replaced old components in Resource Details Update page to shadcn com…
NikhilA8606 Jan 26, 2025
0f82aa0
Replace older components in ResourceDetailsUpdate page with shadcn co…
NikhilA8606 Jan 26, 2025
dad3637
Prefill Structured Data; Add Edit Links for Structured (#9992)
gigincg Jan 27, 2025
e6f6859
Trigger default filters apply logic only when there are no search par…
rithviknishad Jan 27, 2025
4d1ace2
fixes year_of_birth post patient registration success (#10206)
rithviknishad Jan 27, 2025
8cc177e
New Cypress Test for Creation Of Questionnaire (#10210)
nihal467 Jan 27, 2025
e17cd88
Remove Query Invalidation after Questionnaire Batch Request
gigincg Jan 27, 2025
4ae8e8b
changed latitude longitude type to a number in facility create form (…
khavinshankar Jan 27, 2025
a481488
added i18n support for plugins (#10182)
khavinshankar Jan 27, 2025
6834157
Confirm Alert for Patient Registration (#10205)
Jacobjeevan Jan 28, 2025
892dc4a
Render multi line text in Questionnaire Response (#10216)
rajku-dev Jan 28, 2025
4a30d79
Bump lucide-react from 0.473.0 to 0.474.0 (#10209)
dependabot[bot] Jan 28, 2025
58234fd
Update all dependencies (minor, patch) (#10222)
renovate[bot] Jan 28, 2025
6a665ab
disable dependabot updates in favour of renovate (#10223)
rithviknishad Jan 28, 2025
e18ef85
Update actions/github-script action to v7 (#10193)
renovate[bot] Jan 28, 2025
40cc96e
Update actions/checkout action to v4 (#10189)
renovate[bot] Jan 28, 2025
f8693d8
fixed inputs focus issue in plugs when a dialog is child of dropdown …
khavinshankar Jan 28, 2025
1ffff23
Update dependency marked to v15 (#10225)
renovate[bot] Jan 28, 2025
153926a
Fix: Adjust Image Upload Button Width in Edit Cover Photo and Avatar …
modamaan Jan 28, 2025
2e681c6
Update actions/stale action to v9 (#10194)
renovate[bot] Jan 28, 2025
d586d13
added dpg badge to readme (#10134)
shivankacker Jan 28, 2025
230b483
Switch to `PhoneInput` (#10214)
rithviknishad Jan 28, 2025
b476406
Remove 'discharge' from MedicationAdministration category types (#10232)
rithviknishad Jan 28, 2025
c0197cd
Enhance Practitioner Selection in Book Appointment Page (#10236)
rithviknishad Jan 28, 2025
99eb563
Remove slot type selection from schedule template forms (#10238)
rithviknishad Jan 28, 2025
2b8aaa0
Refactor Token Slot Button into Reusable Component (#10244)
rithviknishad Jan 28, 2025
8d0999f
prevent showing callout when slots are negative (#10242)
rithviknishad Jan 28, 2025
9858102
Follow Up: Upgrade `Eslint` version to v9 (#10180)
AdityaJ2305 Jan 28, 2025
ee9cfdb
Update dependency eslint-config-prettier to v10 (#10197)
renovate[bot] Jan 28, 2025
5b6ddea
Fixes incorrect count in appointments column when search query is pre…
rithviknishad Jan 28, 2025
1d8fc2f
Remove status change dropdown from AppointmentActions component (#10248)
rithviknishad Jan 28, 2025
1568bfd
Update all dependencies (minor, patch) (#10245)
renovate[bot] Jan 28, 2025
0c3342f
Disable Unnecessary Browser Pop-up on Patient Registration Form (#10251)
AdityaJ2305 Jan 28, 2025
25cdaf6
Patient Age and Facility Location Edits (#10260)
Jacobjeevan Jan 29, 2025
5cd4b17
Fix Layout Overflow on Appointment and Patient Details Pages for Mobi…
modamaan Jan 29, 2025
33c322e
Fix: Facility Creation Form: Pincode Autofill Overwrites Pre-filled G…
Rishith25 Jan 29, 2025
34a4a29
Update dependency prettier-plugin-tailwindcss to v0.6.11 (#10179)
renovate[bot] Jan 29, 2025
19ae5be
Update all dependencies (minor, patch) (#10268)
renovate[bot] Jan 29, 2025
3dd7132
Update dependency vite-plugin-pwa to ^0.21.0 (#10188)
renovate[bot] Jan 29, 2025
ee73c80
Update docker/setup-buildx-action action to v3 (#10271)
renovate[bot] Jan 29, 2025
881610a
Update docker/build-push-action action to v6 (#10270)
renovate[bot] Jan 29, 2025
d9689df
Update leonsteinhaeuser/project-beta-automations action to v2 (#10274)
renovate[bot] Jan 29, 2025
9b6dcbd
Feat: Display total no. of entities with heading in Organization (#10…
AdityaJ2305 Jan 29, 2025
dcf2bb9
Patient Detail Tabs: Org List Access (#10121)
Jacobjeevan Jan 29, 2025
933fff1
Replaced all TextAreaForm component with Textarea shadcn ui component…
NikhilA8606 Jan 29, 2025
2e770cd
Update prince-chrismc/label-merge-conflicts-action action to v3 (#10276)
renovate[bot] Jan 29, 2025
3976382
Update dependency sonner to v1.7.3 (#10281)
renovate[bot] Jan 29, 2025
b949c64
Add Real-Time Validation for `CreateUserForm` and Standardize UI Acr…
AdityaJ2305 Jan 30, 2025
3bdb1ee
Fix: Adjust spacing and overflow behavior in FileUploadDialog compone…
DonXavierdev Jan 30, 2025
bd0557b
Fix the accessibility issue by adding DialogTitle to DialogContent an…
modamaan Jan 30, 2025
fcd08c8
Update dependency ubuntu to v24 (#10229)
renovate[bot] Jan 30, 2025
bcd3c7b
Fix type edit in QuestionnaireEditor
gigincg Jan 30, 2025
4d4aa18
Add location pages
bodhish Jan 29, 2025
50cb157
Add facility settings routes and layout
bodhish Jan 30, 2025
7ba933c
Nested Routes for Facility Settings; Org to Departments
gigincg Jan 30, 2025
36d7ac7
Update dependency undici to v5.28.5
bodhish Jan 30, 2025
cdf4e46
patient registration in multiple combination (#10287)
nihal467 Jan 30, 2025
284f1a2
Reorganize Facility Settings
gigincg Jan 30, 2025
db0a8d6
Simplify GeneralSettings to use FacilityHome component
bodhish Jan 30, 2025
5edb84e
Update theme color; update icons; remove unused assets (#10292)
rithviknishad Jan 30, 2025
e35cc72
Add overview page
bodhish Jan 30, 2025
81a6257
Refactor Facility Settings; Location Organizations
gigincg Jan 30, 2025
b834ee4
added * to all mandatory fields in resource create (#10314)
nihal467 Jan 31, 2025
023208b
Expand the cypress to search a patient and create an encounter (#10317)
nihal467 Jan 31, 2025
febfcae
Fix: View Facility Redirection in public page is broken (#10318)
AdityaJ2305 Jan 31, 2025
6be23f5
Update all dependencies (minor, patch) (#10290)
renovate[bot] Jan 31, 2025
fd9f145
showing "-" in the emergency contact person field to represent the fi…
Prakhar29Sharma Jan 31, 2025
34c7b68
fixed the redirection in organisation (#10328)
nihal467 Jan 31, 2025
3f238c5
Fix: Use headers.set() instead of headers.append() in makeHeaders (#1…
rithviknishad Jan 31, 2025
54a474a
Set theme color to white in vite PWA manifest (#10321)
rithviknishad Jan 31, 2025
5abeec2
Expose dev server to host (#10330)
rithviknishad Jan 31, 2025
8645c58
Remove automatic picker show for date and time inputs (#10331)
rithviknishad Jan 31, 2025
928bfc6
fix Page in location: infer location.mode;
gigincg Jan 31, 2025
b4e9216
Rm whatsapp phone number, hide email for updates (#10334)
Jacobjeevan Jan 31, 2025
e4b291a
Dob/Age and Lat/Log Override (#10280)
Jacobjeevan Jan 31, 2025
71439ba
Remove pin-code autofill feature (#10291)
rithviknishad Jan 31, 2025
c9a3764
fix responsiveness of date field and gender in public patient registr…
rithviknishad Jan 31, 2025
4694c21
Make autocompletes mobile friendly (#10336)
rithviknishad Jan 31, 2025
a7fca70
Add empty parent parameter to location and organization list queries
bodhish Jan 31, 2025
db35974
removed hard corded values in the appointments (#10337)
nihal467 Jan 31, 2025
e8d5348
Refactor location list views with reusable LocationCard component
bodhish Jan 31, 2025
55d5790
fix: Align and format cards in Health Profile (#10298)
ashwinpraveengo Jan 31, 2025
2298ed5
Fix Camera Capture and Upload Workflow (#10326)
rajku-dev Jan 31, 2025
44b728b
Fix: Resource Letter printing issue (#10230)
AdityaJ2305 Jan 31, 2025
7b61652
Remove index-based numbering from appointments table row (#10338)
rithviknishad Jan 31, 2025
46caeff
Patient Updates Tab, Structured responses filter by Encounter (#10329)
amjithtitus09 Jan 31, 2025
1c41bf8
Location Update fix (#10339)
amjithtitus09 Jan 31, 2025
5a7bdb8
Resources redesign (#10308)
Jacobjeevan Jan 31, 2025
4d9e7d0
ResourceUpdates Bug Fix (#10341)
Jacobjeevan Jan 31, 2025
3461004
Update dependency jsdom to v26 (#10224)
renovate[bot] Jan 31, 2025
0ab906c
Update dependency tailwind-merge to v3 (#10300)
renovate[bot] Jan 31, 2025
b6ea55d
Update all dependencies (minor, patch) (#10343)
renovate[bot] Jan 31, 2025
6f77a69
Cleanup: Remove unnecessary GitHub workflows and update linter Node.j…
rithviknishad Jan 31, 2025
4f295a0
Replaced older components in the useFileManager with shadcn component…
NikhilA8606 Feb 1, 2025
66104a8
Update all dependencies (minor, patch) (#10346)
renovate[bot] Feb 1, 2025
893bef5
Replace diary_free with dairy_free (#10187)
mdimado Feb 1, 2025
9379baa
Update github/ossar-action to v1 (#10153)
renovate[bot] Feb 1, 2025
313f0b5
fix missing wave image files (#10357)
rithviknishad Feb 1, 2025
722677b
Completed all required changes in ResourceDetailsUpdate
NikhilA8606 Feb 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,7 @@
"facilities": "Facilities",
"facility": "Facility",
"facility_added_successfully": "Facility created successfully",
"facility_assign_request": "What facility would you like to assign the request to",
"facility_consent_requests_page_title": "Patient Consent List",
"facility_district_name": "Facility/District Name",
"facility_district_pincode": "Facility/District/Pincode",
Expand Down
162 changes: 113 additions & 49 deletions src/components/Resource/ResourceDetailsUpdate.tsx
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";

Expand All @@ -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 {
Expand Down Expand Up @@ -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]);
Copy link
Member

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 use useQuery instead to achieve data fetching.

Refer: https://docs.ohc.network/docs/care/development/data-fetching-in-care/


const resourceFormReducer = (state = initialState, action: any) => {
switch (action.type) {
case "set_form": {
Expand Down Expand Up @@ -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,
{
Expand All @@ -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,
Expand Down Expand Up @@ -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>
Copy link
Member

Choose a reason for hiding this comment

The 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=""
Expand All @@ -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">
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/autocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
PopoverTrigger,
} from "@/components/ui/popover";

interface AutoCompleteOption {
export interface AutoCompleteOption {
label: string;
value: string;
}
Copy link
Member

Choose a reason for hiding this comment

The 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

Expand Down
Loading