Skip to content

Commit

Permalink
Whitelabel fields
Browse files Browse the repository at this point in the history
  • Loading branch information
rithviknishad committed Nov 27, 2023
1 parent 654123e commit b4c8de2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,10 @@ export const CONSULTATION_SUGGESTION = [
{ id: "OP", text: "OP Consultation" },
{ id: "DC", text: "Domiciliary Care" },
{ id: "DD", text: "Declare Death" },
];
] as const;

export type ConsultationSuggestionValue =
(typeof CONSULTATION_SUGGESTION)[number]["id"];

export const ADMITTED_TO = [
{ id: "1", text: "Isolation" },
Expand Down
20 changes: 14 additions & 6 deletions src/Components/Facility/ConsultationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as Notification from "../../Utils/Notifications.js";
import { BedModel, FacilityModel } from "./models";
import {
CONSULTATION_SUGGESTION,
ConsultationSuggestionValue,
PATIENT_CATEGORIES,
REVIEW_AT_CHOICES,
TELEMEDICINE_ACTIONS,
Expand Down Expand Up @@ -82,7 +83,7 @@ type FormDetails = {
symptoms: number[];
other_symptoms: string;
symptoms_onset_date?: Date;
suggestion: string;
suggestion: ConsultationSuggestionValue;
route_to_facility?: RouteToFacility;
patient: string;
facility: string;
Expand Down Expand Up @@ -1120,7 +1121,7 @@ export const ConsultationForm = (props: any) => {
label="Decision after consultation"
{...selectField("suggestion")}
options={CONSULTATION_SUGGESTION.filter(
({ deprecated }) => !deprecated
(option) => !("deprecated" in option)
)}
/>
</div>
Expand Down Expand Up @@ -1197,11 +1198,18 @@ export const ConsultationForm = (props: any) => {
>
<TextFormField
{...field("encounter_date")}
required
required={["A", "DC", "OP"].includes(
state.form.suggestion
)}
label={
state.form.suggestion === "DC" // TODO: change this for all types of consultations
? "Date & Time of Domiciliary Care commencement"
: "Date & Time of Admission to the Facility"
{
A: "Date & Time of Admission to the Facility",
DC: "Date & Time of Domiciliary Care commencement",
OP: "Date & Time of Out-patient visit",
DD: "Date & Time of Encounter",
HI: "Date & Time of Encounter",
R: "Date & Time of Encounter",
}[state.form.suggestion]
}
type="datetime-local"
value={dayjs(state.form.encounter_date).format(
Expand Down
3 changes: 2 additions & 1 deletion src/Components/Facility/models.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { AssetData } from "../Assets/AssetTypes";
import { UserBareMinimum } from "../Users/models";
import { RouteToFacility } from "../Common/RouteToFacilitySelect";
import { ConsultationDiagnosis, CreateDiagnosis } from "../Diagnosis/types";
import { ConsultationSuggestionValue } from "../../Common/constants";

export interface LocalBodyModel {
name: string;
Expand Down Expand Up @@ -121,7 +122,7 @@ export interface ConsultationModel {
referred_by_external?: string;
transferred_from_location?: LocationModel["id"];
transferred_from_location_object?: LocationModel;
suggestion?: string;
suggestion?: ConsultationSuggestionValue;
patient_no?: string;
route_to_facility?: RouteToFacility;
is_kasp?: boolean;
Expand Down

0 comments on commit b4c8de2

Please sign in to comment.