Skip to content

Commit

Permalink
Replace checkbox by button
Browse files Browse the repository at this point in the history
  • Loading branch information
Omkar76 committed Dec 6, 2023
1 parent b5f1165 commit 8806f5b
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/Components/Patient/DailyRounds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ import BloodPressureFormField, {
} from "../Common/BloodPressureFormField";
import { SymptomsSelect } from "../Common/SymptomsSelect";
import TemperatureFormField from "../Common/TemperatureFormField";
import { Cancel, Submit } from "../Common/components/ButtonV2";
import ButtonV2, { Cancel, Submit } from "../Common/components/ButtonV2";
import Page from "../Common/components/Page";
import CheckBoxFormField from "../Form/FormFields/CheckBoxFormField";
import RangeAutocompleteFormField from "../Form/FormFields/RangeAutocompleteFormField";
import { SelectFormField } from "../Form/FormFields/SelectFormField";
import TextAreaFormField from "../Form/FormFields/TextAreaFormField";
Expand All @@ -49,7 +48,7 @@ const initForm: any = {
admitted_to: "",
taken_at: null,
rounds_type: "NORMAL",
clone_last: null,
clone_last: false,
systolic: null,
diastolic: null,
pulse: null,
Expand Down Expand Up @@ -192,7 +191,7 @@ export const DailyRounds = (props: any) => {
RHYTHM_CHOICES.find((i) => i.text === res.data.rhythm)?.id) ||
"0",
temperature: parseFloat(res.data.temperature),
clone_last: res.data.count > 0 ? true : false,
clone_last: false,
},
});
}
Expand Down Expand Up @@ -451,17 +450,25 @@ export const DailyRounds = (props: any) => {
</div>

{!id && hasPreviousLog && (
<CheckBoxFormField
{...field("clone_last")}
label="Copy values from previous log?"
/>
<ButtonV2
className="mb-6"
onClick={(e) => {
e.preventDefault();
dispatch({
type: "set_form",
form: { ...state.form, clone_last: true },
});
}}
>
Copy values from previous log
</ButtonV2>
)}
{state.form.clone_last === true && (
{state.form.clone_last && (
<p className="rounded border border-green-800 bg-gray-200 p-2 text-green-800">
Field values will be copied from previous log update
</p>
)}
{(state.form.clone_last === false || id) && (
{!state.form.clone_last && (
<div className="grid grid-cols-1 gap-x-6 md:grid-cols-2">
<TextAreaFormField
{...field("physical_examination_info")}
Expand Down

0 comments on commit 8806f5b

Please sign in to comment.