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

Replace useDispatch in Patient Files (src/Components/Patient/) #7078

Merged
merged 57 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
d565e1d
replaced useDispatch in patientHome
konavivekramakrishna Jan 22, 2024
e7c51d4
Merge branch 'develop' of https://github.com/coronasafe/care_fe into …
konavivekramakrishna Jan 22, 2024
4ef2da5
replace usedispatch in patientfiler and managepatinet
konavivekramakrishna Jan 22, 2024
486dd60
add patientfilter
konavivekramakrishna Jan 22, 2024
595de99
replace useDispatch in dailyroundslistdetials
konavivekramakrishna Jan 22, 2024
8ad1857
Merge branch 'develop' of https://github.com/konavivekramakrishna/car…
konavivekramakrishna Jan 22, 2024
e780d36
Merge branch 'develop' into fix#6546
konavivekramakrishna Jan 22, 2024
390e340
replaced useDispatch in sampleDetails
konavivekramakrishna Jan 23, 2024
afb3b7a
Merge branch 'fix#6546' of https://github.com/konavivekramakrishna/ca…
konavivekramakrishna Jan 23, 2024
acfc8a7
replace useDispatch in sampleFilters
konavivekramakrishna Jan 23, 2024
72db334
replace useDispatch in samplePreview
konavivekramakrishna Jan 23, 2024
dc3ff5e
sampleTestCard
konavivekramakrishna Jan 23, 2024
8962075
replace useDispatch in sampleTest
konavivekramakrishna Jan 23, 2024
78d87df
replace useDispatch in sampleViewAdmin
konavivekramakrishna Jan 23, 2024
67aca82
replace useDispatch in shiftCreate
konavivekramakrishna Jan 23, 2024
d043709
fix
konavivekramakrishna Jan 23, 2024
706de33
fix
konavivekramakrishna Jan 23, 2024
f906dfa
Merge branch 'develop' into fix#6546
konavivekramakrishna Jan 25, 2024
a885971
revert managePatients and patientFilter useDispatch
konavivekramakrishna Jan 25, 2024
5814d0a
Merge branch 'develop' into fix#6546
konavivekramakrishna Jan 25, 2024
c27f35f
replace useDispatch in managePatients
konavivekramakrishna Jan 25, 2024
590ac63
Merge branch 'fix#6546' of https://github.com/konavivekramakrishna/ca…
konavivekramakrishna Jan 25, 2024
e8231f2
fix
konavivekramakrishna Jan 25, 2024
43f4ace
fix
konavivekramakrishna Jan 25, 2024
a6e7d24
replace useDispatch in PatientFilter
konavivekramakrishna Jan 25, 2024
eddaf24
fix prefetch
konavivekramakrishna Jan 26, 2024
e8384aa
minor fix
konavivekramakrishna Jan 27, 2024
668b40c
add trailing slashes to api's
konavivekramakrishna Jan 27, 2024
c6289fb
fix based on review
konavivekramakrishna Jan 27, 2024
625846d
Update package-lock.json
konavivekramakrishna Jan 27, 2024
0ff3bb8
Update package-lock.json
konavivekramakrishna Jan 27, 2024
f416531
replace reload
konavivekramakrishna Jan 29, 2024
087d460
implement paginated list
konavivekramakrishna Jan 29, 2024
5e59631
fix types
konavivekramakrishna Jan 29, 2024
59321fd
Merge branch 'develop' into fix#6546
konavivekramakrishna Jan 30, 2024
a8d895f
rm Timeline from paginatedList
konavivekramakrishna Jan 30, 2024
922d015
Update button styling in CommentsSection component
konavivekramakrishna Jan 30, 2024
65a56c7
Fix API paths in Redux file
konavivekramakrishna Jan 30, 2024
d1ae751
Update API paths
konavivekramakrishna Jan 30, 2024
20ee185
Merge branch 'develop' into fix#6546
konavivekramakrishna Jan 31, 2024
574f899
Merge branch 'develop' into fix#6546
rithviknishad Feb 5, 2024
d4dead8
remove unused actions
rithviknishad Feb 5, 2024
3d70518
Merge branch 'develop' into fix#6546
konavivekramakrishna Feb 5, 2024
27453dd
Merge branch 'develop' into fix#6546
nihal467 Feb 6, 2024
aa1a722
Merge branch 'develop' into fix#6546
konavivekramakrishna Feb 7, 2024
2650e60
fix eslint
konavivekramakrishna Feb 7, 2024
e61ecfc
Merge branch 'develop' into fix#6546
konavivekramakrishna Feb 7, 2024
14cb574
fix daily rounds and filters
konavivekramakrishna Feb 7, 2024
4bf5832
Merge branch 'develop' into fix#6546
konavivekramakrishna Feb 7, 2024
3512d22
fix sample view admin
konavivekramakrishna Feb 8, 2024
bbd616f
fix shifting
konavivekramakrishna Feb 8, 2024
c285c99
fix based on review
konavivekramakrishna Feb 11, 2024
fb87fbd
Merge branch 'develop' into fix#6546
konavivekramakrishna Feb 11, 2024
604426e
Merge branch 'develop' into fix#6546
konavivekramakrishna Feb 13, 2024
0664487
minor fix
konavivekramakrishna Feb 13, 2024
9a09d57
fix lint
konavivekramakrishna Feb 13, 2024
3334cfc
Merge branch 'develop' into fix#6546
nihal467 Feb 14, 2024
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
78 changes: 28 additions & 50 deletions src/Components/Patient/DailyRoundListDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,75 +1,53 @@
import { lazy, useCallback, useState } from "react";
import { useDispatch } from "react-redux";
import { lazy, useState } from "react";
import {
CONSCIOUSNESS_LEVEL,
CURRENT_HEALTH_CHANGE,
SYMPTOM_CHOICES,
} from "../../Common/constants";
import { statusType, useAbortableEffect } from "../../Common/utils";
import { getConsultationDailyRoundsDetails } from "../../Redux/actions";
import { DailyRoundsModel } from "./models";
import Page from "../Common/components/Page";
import ButtonV2 from "../Common/components/ButtonV2";
import { formatDateTime } from "../../Utils/utils";
import useQuery from "../../Utils/request/useQuery";
import routes from "../../Redux/api";
const Loading = lazy(() => import("../Common/Loading"));
const symptomChoices = [...SYMPTOM_CHOICES];
const currentHealthChoices = [...CURRENT_HEALTH_CHANGE];

export const DailyRoundListDetails = (props: any) => {
const { facilityId, patientId, consultationId, id } = props;
const dispatch: any = useDispatch();
const [dailyRoundListDetailsData, setDailyRoundListDetails] =
useState<DailyRoundsModel>({});
const [isLoading, setIsLoading] = useState(false);

const fetchpatient = useCallback(
async (status: statusType) => {
setIsLoading(true);
const res = await dispatch(
getConsultationDailyRoundsDetails({ consultationId, id })
);
if (!status.aborted) {
if (res && res.data) {
const currentHealth = currentHealthChoices.find(
(i) => i.text === res.data.current_health
);
const { loading: isLoading } = useQuery(routes.getDailyReport, {
pathParams: { consultationId, id },
onResponse: ({ res, data }) => {
if (res && data) {
const currentHealth = currentHealthChoices.find(
(i) => i.text === data.current_health
);

const data: DailyRoundsModel = {
...res.data,
temperature: Number(res.data.temperature)
? res.data.temperature
: "",
additional_symptoms_text: "",
medication_given:
Object.keys(res.data.medication_given).length === 0
? []
: res.data.medication_given,
current_health: currentHealth
? currentHealth.desc
: res.data.current_health,
};
if (res.data.additional_symptoms?.length) {
const symptoms = res.data.additional_symptoms.map(
(symptom: number) => {
const option = symptomChoices.find((i) => i.id === symptom);
return option ? option.text.toLowerCase() : symptom;
}
);
data.additional_symptoms_text = symptoms.join(", ");
}
setDailyRoundListDetails(data);
const tdata: DailyRoundsModel = {
...data,
temperature: Number(data.temperature) ? data.temperature : "",
additional_symptoms_text: "",
medication_given: data.medication_given ?? [],

current_health: currentHealth
? currentHealth.desc
: data.current_health,
};
if (data.additional_symptoms?.length) {
const symptoms = data.additional_symptoms.map((symptom: number) => {
const option = symptomChoices.find((i) => i.id === symptom);
return option ? option.text.toLowerCase() : symptom;
});
tdata.additional_symptoms_text = symptoms.join(", ");
}
setIsLoading(false);
setDailyRoundListDetails(tdata);
}
},
[consultationId, dispatch, id]
);
useAbortableEffect(
(status: statusType) => {
fetchpatient(status);
},
[dispatch, fetchpatient]
);
});

if (isLoading) {
return <Loading />;
Expand Down
Loading
Loading