Skip to content

Commit

Permalink
Bug fixes on frontend about visitation data handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Vaaranan Yogalingam authored and Vaaranan Yogalingam committed May 2, 2024
1 parent e036585 commit 7ebeb1f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
37 changes: 18 additions & 19 deletions frontend/src/components/pages/VisitPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,28 @@ const Visit = (): React.ReactElement => {
const { caseId } = useParams<{ caseId: string}>();
const caseNumber: number = parseInt(caseId, 10);

// Visting Member

const DEDAULT_TRANSPORTATION_DETAILS = {
entries: [
{
gaurdian: "",
name: "",
duration: "",
notes: "",
},
],
};

const [visitNotes, setVisitNotes] = useState('');
const [transportationEntries, setTransportationEntries] =
useState<TransportationEntries>(DEDAULT_TRANSPORTATION_DETAILS);

const handleNotesChange = (note: string) => {
let updatedEntries = [...transportationEntries.entries];
const handleNotesChange = () => {
const updatedEntries = [...transportationEntries.entries];

if (updatedEntries.length > 0) {
updatedEntries[0] = { ...updatedEntries[0], notes: note };
updatedEntries[0] = { ...updatedEntries[0], notes: visitNotes };
}

setTransportationEntries({ ...transportationEntries, entries: updatedEntries });
Expand Down Expand Up @@ -70,19 +85,6 @@ const Visit = (): React.ReactElement => {
],
};

// Visting Member

const DEDAULT_TRANSPORTATION_DETAILS = {
entries: [
{
gaurdian: "",
name: "",
duration: "",
notes: "",
},
],
};

// Transportation
const [childDetails, setChildDetails] = useState<ChildDetails>(
DEFAULT_CHILD_DETAILS,
Expand All @@ -96,9 +98,6 @@ const Visit = (): React.ReactElement => {
DEFAULT_ATTENDANCE_DETAILS,
);

const [transportationEntries, setTransportationEntries] =
useState<TransportationEntries>(DEDAULT_TRANSPORTATION_DETAILS);

const scrollToHeader = (headerId: string) => {
const headerElement = document.getElementById(headerId);

Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/visit/TransportationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export type TransportationDetails = {
gaurdian: string;
name: string;
duration: string;
notes: string;
};

export type TransportationEntries = {
Expand Down

0 comments on commit 7ebeb1f

Please sign in to comment.