Skip to content

Commit

Permalink
Remove default selection of patient category
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashesh3 committed Sep 26, 2023
1 parent 2973d6e commit a336f5f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/Components/Facility/ConsultationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const initForm: FormDetails = {
facility: "",
admitted: "false",
admitted_to: "",
category: "Comfort",
category: "",
admission_date: new Date(),
discharge_date: null,
referred_to: "",
Expand Down Expand Up @@ -373,8 +373,8 @@ export const ConsultationForm = (props: any) => {
admitted_to: res.data.admitted_to ? res.data.admitted_to : "",
category: res.data.category
? PATIENT_CATEGORIES.find((i) => i.text === res.data.category)
?.id ?? "Comfort"
: "Comfort",
?.id ?? ""
: "",
patient_no: res.data.patient_no ?? "",
OPconsultation: res.data.consultation_notes,
is_telemedicine: `${res.data.is_telemedicine}`,
Expand Down
18 changes: 12 additions & 6 deletions src/Components/Patient/DailyRounds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const initForm: any = {
other_symptoms: "",
physical_examination_info: "",
other_details: "",
patient_category: "Comfort",
patient_category: "",
current_health: 0,
recommend_discharge: false,
action: null,
Expand Down Expand Up @@ -142,14 +142,14 @@ export const DailyRounds = (props: any) => {
);

if (!status.aborted) {
if (res && res.data) {
if (res?.data) {
const data = {
...res.data,
patient_category: res.data.patient_category
? PATIENT_CATEGORIES.find(
(i) => i.text === res.data.patient_category
)?.id || "Comfort"
: "Comfort",
)?.id ?? ""
: "",
rhythm:
(res.data.rhythm &&
RHYTHM_CHOICES.find((i) => i.text === res.data.rhythm)?.id) ||
Expand Down Expand Up @@ -186,8 +186,8 @@ export const DailyRounds = (props: any) => {
patient_category: res.data.patient_category
? PATIENT_CATEGORIES.find(
(i) => i.text === res.data.patient_category
)?.id || "Comfort"
: "Comfort",
)?.id ?? ""
: "",
rhythm:
(res.data.rhythm &&
RHYTHM_CHOICES.find((i) => i.text === res.data.rhythm)?.id) ||
Expand All @@ -205,6 +205,12 @@ export const DailyRounds = (props: any) => {
let invalidForm = false;
Object.keys(state.form).forEach((field) => {
switch (field) {
case "patient_category":
if (!state.form[field]) {
errors[field] = "Please select a category";
invalidForm = true;
}
return;
case "other_symptoms":
if (
state.form.additional_symptoms?.includes(9) &&
Expand Down

0 comments on commit a336f5f

Please sign in to comment.