Skip to content

Commit

Permalink
consultation depth-2
Browse files Browse the repository at this point in the history
  • Loading branch information
hrit2773 committed Apr 24, 2024
1 parent 7475b94 commit 9546232
Show file tree
Hide file tree
Showing 5 changed files with 221 additions and 112 deletions.
2 changes: 1 addition & 1 deletion src/Components/Common/SymptomsSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const SymptomsSelect = (props: FormFieldBaseProps<number[]>) => {
<FormField field={field}>
<MultiSelectMenuV2
id={field.id}
options={SYMPTOM_CHOICES}
options={SYMPTOM_CHOICES.filter((sym) => sym.id !== 1)}
disabled={props.disabled}
placeholder="Select symptoms"
optionLabel={(option) => option.text}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,35 +373,76 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
<div className="text-sm font-semibold uppercase">
Consultation Update
</div>
<div className="my-4 flex flex-wrap items-center gap-2">
{props.consultationData.symptoms?.map(
(symptom, index) => (
<Chip
key={index}
text={
SYMPTOM_CHOICES.find(
(choice) => choice.id === symptom,
)?.text ?? "Err. Unknown"
}
size="small"
/>
),
)}
</div>
{props.consultationData.other_symptoms && (
<div className="capitalize">
<div className="text-xs font-semibold">
Other Symptoms:
</div>
{props.consultationData.other_symptoms}
{props.consultationData.symptoms_with_dates?.length ? (
<div className=" my-3 flex flex-col gap-4">
{props.consultationData.symptoms_with_dates.map(
(tl) => (
<div className="flex flex-col gap-4">
<div>
<span className="text-xs font-semibold leading-relaxed text-gray-800">
from {formatDate(tl.date)}
</span>
</div>
<div className=" flex flex-wrap gap-3">
{tl.symptoms.map((symptom, idx) => (
<Chip
key={idx}
text={
SYMPTOM_CHOICES.find(
(choice) => choice.id === symptom,
)?.text ?? "Err. Unknown"
}
size="small"
/>
))}
</div>
</div>
),
)}
{props.consultationData.other_symptoms && (
<div className="capitalize">
<div className="text-xs font-semibold">
Other Symptoms:
</div>
{props.consultationData.other_symptoms}
</div>
)}
</div>
) : (
<>
<div className="my-4 flex flex-wrap items-center gap-2">
{props.consultationData.symptoms?.map(
(symptom, index) => (
<Chip
key={index}
text={
SYMPTOM_CHOICES.find(
(choice) => choice.id === symptom,
)?.text ?? "Err. Unknown"
}
size="small"
/>
),
)}
</div>
{props.consultationData.other_symptoms && (
<div className="capitalize">
<div className="text-xs font-semibold">
Other Symptoms:
</div>
{props.consultationData.other_symptoms}
</div>
)}
<span className="text-xs font-semibold leading-relaxed text-gray-800">
from{" "}
{props.consultationData.symptoms_onset_date
? formatDate(
props.consultationData.symptoms_onset_date,
)
: "--/--/----"}
</span>
</>
)}
<span className="text-xs font-semibold leading-relaxed text-gray-800">
from{" "}
{props.consultationData.symptoms_onset_date
? formatDate(props.consultationData.symptoms_onset_date)
: "--/--/----"}
</span>
</div>
</div>
</div>
Expand Down
3 changes: 3 additions & 0 deletions src/Components/Facility/ConsultationDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ export const ConsultationDetails = (props: any) => {
});
data.symptoms_text = symptoms.join(", ");
}
if (res.data.symptoms_with_dates.length) {
data.symptoms_text = "symptoms";
}
if (facilityId != data.facility || patientId != data.patient) {
navigate(
`/facility/${data.facility}/patient/${data.patient}/consultation/${data?.id}`,
Expand Down
Loading

0 comments on commit 9546232

Please sign in to comment.