From be9d46977805cafe19f7ef3e34c0858bde2f95d1 Mon Sep 17 00:00:00 2001 From: rodrigotiscareno Date: Sun, 7 Apr 2024 14:18:02 -0400 Subject: [PATCH] fixes for placeholders --- backend/python/app/resources/visit_dto.py | 5 +++++ backend/python/app/rest/visit_routes.py | 9 ++++++++- .../app/services/implementations/visit_service.py | 11 +++++------ frontend/src/APIClients/VisitAPIClient.ts | 1 + frontend/src/components/pages/VisitPage.tsx | 15 +++++++++++++++ 5 files changed, 34 insertions(+), 7 deletions(-) diff --git a/backend/python/app/resources/visit_dto.py b/backend/python/app/resources/visit_dto.py index 44957bfac..a37a40173 100644 --- a/backend/python/app/resources/visit_dto.py +++ b/backend/python/app/resources/visit_dto.py @@ -3,6 +3,11 @@ def __init__(self, **kwargs): self.user_id = kwargs.get("user_id") self.childInformation = kwargs.get("childInformation") self.visitTimestamp = kwargs.get("visitTimestamp") + self.visit_supervision = kwargs.get("visit_supervision") + self.location = kwargs.get("location") + self.visit_day = kwargs.get("visit_day") + self.start_time = kwargs.get("start_time") + self.end_time = kwargs.get("end_time") self.attendance = kwargs.get("attendance") self.transportation = kwargs.get("transportation") self.notes = kwargs.get("notes") diff --git a/backend/python/app/rest/visit_routes.py b/backend/python/app/rest/visit_routes.py index b4276be48..baf015b90 100644 --- a/backend/python/app/rest/visit_routes.py +++ b/backend/python/app/rest/visit_routes.py @@ -20,9 +20,16 @@ def create_visit(): "user_id": data.get("user_i_d"), "childInformation": data.get("child_details"), "visitTimestamp": data.get("visit_details", {}).get("visit_date"), + "location": data.get("visit_details", {}).get("location"), + "visit_day": data.get("visit_details", {}).get("visit_day"), + "visit_supervision": data.get("visit_details", {}) + .get("visit_supervision") + .upper(), + "start_time": data.get("visit_details", {}).get("start_time"), + "end_time": data.get("visit_details", {}).get("end_time"), "attendance": data.get("attendance_entries"), "transportation": data.get("transportation_entries"), - "notes": "placeholder for notes", # TODO: data.get("notes"), + "notes": data.get("transportation_entries").get("entries")[0].get("notes"), "childAndFamilySupportWorker": data.get("child_details", {}).get( "child_service_worker" ), diff --git a/backend/python/app/services/implementations/visit_service.py b/backend/python/app/services/implementations/visit_service.py index 1b9fc9323..73a676ce6 100644 --- a/backend/python/app/services/implementations/visit_service.py +++ b/backend/python/app/services/implementations/visit_service.py @@ -11,7 +11,6 @@ def __init__(self, logger): self.logger = logger def create_visit(self, visit: VisitDTO): - print(visit.__dict__, "visit") try: attendance_sheet = AttendanceSheets( family_name=visit.childInformation["family_name"], @@ -25,11 +24,11 @@ def create_visit(self, visit: VisitDTO): attendance_record = AttendanceRecords( attendance_sheet_id=attendance_sheet.id, visit_date=visit.visitTimestamp, - visit_day="visit_day_placeholder", - visit_supervision="PARTIAL", - start_time="start_time_placeholder", - end_time="end_time_placeholder", - location=visit.notes, + visit_day=visit.visit_day, + visit_supervision=visit.visit_supervision, + start_time=visit.start_time, + end_time=visit.end_time, + location=visit.location, notes=visit.notes, ) db.session.add(attendance_record) diff --git a/frontend/src/APIClients/VisitAPIClient.ts b/frontend/src/APIClients/VisitAPIClient.ts index 4cabee5e8..256847266 100644 --- a/frontend/src/APIClients/VisitAPIClient.ts +++ b/frontend/src/APIClients/VisitAPIClient.ts @@ -33,6 +33,7 @@ interface Visit { gaurdian: string; name: string; duration: string; + notes: string; }[]; } diff --git a/frontend/src/components/pages/VisitPage.tsx b/frontend/src/components/pages/VisitPage.tsx index f91098807..33c22041e 100644 --- a/frontend/src/components/pages/VisitPage.tsx +++ b/frontend/src/components/pages/VisitPage.tsx @@ -24,6 +24,18 @@ const Visit = (): React.ReactElement => { const { caseId } = useParams<{ caseId: string}>(); const caseNumber: number = parseInt(caseId, 10); + const [visitNotes, setVisitNotes] = useState(''); + + const handleNotesChange = (note: string) => { + let updatedEntries = [...transportationEntries.entries]; + + if (updatedEntries.length > 0) { + updatedEntries[0] = { ...updatedEntries[0], notes: note }; + } + + setTransportationEntries({ ...transportationEntries, entries: updatedEntries }); + }; + const DEFAULT_CHILD_DETAILS = { familyName: "", children: [], @@ -66,6 +78,7 @@ const Visit = (): React.ReactElement => { gaurdian: "", name: "", duration: "", + notes: "", }, ], }; @@ -228,6 +241,8 @@ const Visit = (): React.ReactElement => { placeholder="Note any additional information in regards to this visit." height="10rem" paddingBottom="7rem" + value={visitNotes} + onChange={handleNotesChange} />