From 534cb8978b4d6195b196ae8c956fb72faa9e6221 Mon Sep 17 00:00:00 2001 From: rodrigotiscareno Date: Sun, 28 Jan 2024 14:26:43 -0500 Subject: [PATCH 01/23] routing --- frontend/src/components/pages/CaseOverview.tsx | 5 +++++ frontend/src/components/pages/VisitPage.tsx | 5 +++-- frontend/src/constants/Routes.ts | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/pages/CaseOverview.tsx b/frontend/src/components/pages/CaseOverview.tsx index 70b83213f..ad2584dc6 100644 --- a/frontend/src/components/pages/CaseOverview.tsx +++ b/frontend/src/components/pages/CaseOverview.tsx @@ -74,6 +74,10 @@ const CaseOverviewBody = (): React.ReactElement => { history.push("/intake"); }; + const goToVisitation = () => { + history.push(`/visits/${caseNumber}`) + } + const goToHomepage = () => { history.push("/"); }; @@ -384,6 +388,7 @@ const CaseOverviewBody = (): React.ReactElement => { right="4" borderColor={colors.blue[300]} backgroundColor={colors.blue[100]} + onClick={goToVisitation} >
diff --git a/frontend/src/components/pages/VisitPage.tsx b/frontend/src/components/pages/VisitPage.tsx index 59799401f..c8621e1fc 100644 --- a/frontend/src/components/pages/VisitPage.tsx +++ b/frontend/src/components/pages/VisitPage.tsx @@ -1,4 +1,5 @@ import React, { useState } from "react"; +import {useParams} from 'react-router-dom' import { Box, Button, @@ -20,8 +21,8 @@ import OptionalLabel from "../intake/OptionalLabel"; import VisitFormFooter from "../visit/VisitFormFooter"; const Visit = (): React.ReactElement => { - // url is /visit/caseId/visitId, commented for now to avoid lint - // const params = useParams(); + const { caseId } = useParams<{ caseId: string}>(); + const caseNumber: number = parseInt(caseId, 10); const DEFAULT_CHILD_DETAILS = { familyName: "", diff --git a/frontend/src/constants/Routes.ts b/frontend/src/constants/Routes.ts index 324dbb9f2..72454be63 100644 --- a/frontend/src/constants/Routes.ts +++ b/frontend/src/constants/Routes.ts @@ -1,6 +1,6 @@ export const HOME_PAGE = "/"; export const INTAKE_PAGE = "/intake"; -export const VISIT_PAGE = "/visit/:caseId/:visitId"; +export const VISIT_PAGE = "/visit/:caseId"; export const LOGIN_PAGE = "/login"; export const SIGNUP_PAGE = "/signup"; export const CASES_PAGE = "/cases/:status"; From d0d0d14aa1a07bf9aa57a84c548dbe1c4a0f9607 Mon Sep 17 00:00:00 2001 From: rodrigotiscareno Date: Sun, 28 Jan 2024 14:32:23 -0500 Subject: [PATCH 02/23] tweak --- frontend/src/components/pages/CaseOverview.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/pages/CaseOverview.tsx b/frontend/src/components/pages/CaseOverview.tsx index ad2584dc6..0c599c833 100644 --- a/frontend/src/components/pages/CaseOverview.tsx +++ b/frontend/src/components/pages/CaseOverview.tsx @@ -75,7 +75,7 @@ const CaseOverviewBody = (): React.ReactElement => { }; const goToVisitation = () => { - history.push(`/visits/${caseNumber}`) + history.push(`/visit/${caseNumber}`) } const goToHomepage = () => { From d8a01e9acf4b86d6a3126234cb5b00de44b666d5 Mon Sep 17 00:00:00 2001 From: Jenny Vong Date: Sun, 28 Jan 2024 17:04:11 -0500 Subject: [PATCH 03/23] Link and Integrate PUT Case Submission Pt. 1 (#237) * cases put/delete request --- backend/python/app/__init__.py | 22 ++++----- backend/python/app/rest/intake_routes.py | 5 +- ...f8bf_condense_goals_and_concerns_models.py | 1 + ...7_create_intake_goals_association_table.py | 1 + ...08-14_6d3ed0c1b66e_added_default_column.py | 1 + ..._ccabdb62cbef_add_date_columns_to_goals.py | 1 + ...ce2b_update_intake_and_caregivers_enums.py | 1 + ...69_differentiate_caregiver_and_provider.py | 1 + ...11-02_5fff1dc51c07_remove_address_table.py | 1 + ...-11-07_12e97fac48b2_update_intake_model.py | 1 + ...b1b7_update_familial_concern_and_child_.py | 1 + ...f135715-intake_models_initial_migration.py | 1 + ...30_a46d44436397_create_attendance_model.py | 1 + ...23-02-16_823354eaef0b_attendance_models.py | 1 + ...3f1_change_attendance_sheet_and_record_.py | 1 + ...784b7a2d1114_fix_attendance_model_typos.py | 1 + ...hange_instances_of_attending_parent_to_.py | 1 + ...b23310db98a_modify_child_service_worker.py | 1 + ...e7_remove_kinship_and_foster_placement_.py | 1 + ..._a7f5c5731635_remove_kinship_and_foster.py | 1 + .../2023-06-01_3c7ee24004d0_merging.py | 1 + .../2023-06-01_e5d9b1c73228_remove.py | 1 + ...de8d_added_lead_access_worker_name_and_.py | 1 + ...02_73b155c137af_autoincrement_intake_id.py | 1 + ...a2298b0d2_added_model_for_visit_cadence.py | 1 + ...1d_added_caregiver_id_to_visit_cadence_.py | 1 + ...4a_get_rid_of_intake_id_column_in_goals.py | 1 + ...a0e2_add_intake_id_column_to_goals_and_.py | 1 + ...ff64a1fd_update_attendance_sheet_fields.py | 1 + .../2023-10-10_bef4bdd6cc2b_merging.py | 1 + .../2023-10-11_2e3a95429cdf_merging.py | 1 + ...a_add_relationship_to_child_enum_values.py | 1 + ...pdate_daytime_contact_model_with_child_.py | 1 + ...f_change_attendance_model_to_snake_case.py | 1 + ..._3df009c5afd2_make_email_field_optional.py | 1 + ...28_4df756383780_fix_transportation_typo.py | 1 + ...7ce63_fixing_daytime_contact_and_child_.py | 1 + ...3-11-28_a52b5c1d2560_change_child_model.py | 1 + ...28_c08705245bb9_change_attendance_model.py | 1 + ...967a_make_permitted_individuals_fields_.py | 1 + ...23-12-12_5a6a8146dbb6_merging_two_heads.py | 1 + ...pdate_caregiver_relationship_enum_part_.py | 1 + ...23-12-12_839076ab9712_merging_two_heads.py | 1 + ...pdate_caregiver_relationship_enum_part_.py | 1 + backend/python/requirements.txt | 4 +- frontend/src/APIClients/IntakeAPIClient.ts | 3 ++ .../components/common/FilteredCaseDisplay.tsx | 1 + .../src/components/dashboard/CaseCard.tsx | 12 ++++- .../components/dashboard/FilteredSection.tsx | 2 + .../src/components/dashboard/StatusModal.tsx | 47 ++++++++++++++++--- frontend/src/components/pages/CasesPage.tsx | 1 + frontend/src/components/pages/HomePage.tsx | 2 + frontend/src/types/CasesContextTypes.ts | 1 + 53 files changed, 117 insertions(+), 25 deletions(-) diff --git a/backend/python/app/__init__.py b/backend/python/app/__init__.py index b3ed4b7df..e69c99e5d 100644 --- a/backend/python/app/__init__.py +++ b/backend/python/app/__init__.py @@ -48,17 +48,17 @@ def create_app(config_name): CORS(app) if os.getenv("FLASK_CONFIG") != "production": - app.config[ - "SQLALCHEMY_DATABASE_URI" - ] = "postgresql://{username}:{password}@{host}:5432/{db}".format( - username=os.getenv("POSTGRES_USER"), - password=os.getenv("POSTGRES_PASSWORD"), - host=os.getenv("DB_HOST"), - db=( - os.getenv("POSTGRES_DB_TEST") - if app.config["TESTING"] - else os.getenv("POSTGRES_DB_DEV") - ), + app.config["SQLALCHEMY_DATABASE_URI"] = ( + "postgresql://{username}:{password}@{host}:5432/{db}".format( + username=os.getenv("POSTGRES_USER"), + password=os.getenv("POSTGRES_PASSWORD"), + host=os.getenv("DB_HOST"), + db=( + os.getenv("POSTGRES_DB_TEST") + if app.config["TESTING"] + else os.getenv("POSTGRES_DB_DEV") + ), + ) ) else: app.config["SQLALCHEMY_DATABASE_URI"] = os.getenv("DATABASE_URL") diff --git a/backend/python/app/rest/intake_routes.py b/backend/python/app/rest/intake_routes.py index fd9409812..0bc4fd33c 100644 --- a/backend/python/app/rest/intake_routes.py +++ b/backend/python/app/rest/intake_routes.py @@ -419,12 +419,11 @@ def run_undos(): return jsonify(new_intake.__dict__), 201 -@blueprint.route("/", methods=["DELETE"], strict_slashes=False) -def delete_intake(): +@blueprint.route("/", methods=["DELETE"], strict_slashes=False) +def delete_intake(intake_id): """ Delete intake by intake_id specified through a query parameter """ - intake_id = int(request.args.get("intake_id")) if intake_id: if type(intake_id) is not int: diff --git a/backend/python/migrations/versions/2022-07-03_57f14d8ff8bf_condense_goals_and_concerns_models.py b/backend/python/migrations/versions/2022-07-03_57f14d8ff8bf_condense_goals_and_concerns_models.py index d59b39773..9c11a37ae 100644 --- a/backend/python/migrations/versions/2022-07-03_57f14d8ff8bf_condense_goals_and_concerns_models.py +++ b/backend/python/migrations/versions/2022-07-03_57f14d8ff8bf_condense_goals_and_concerns_models.py @@ -5,6 +5,7 @@ Create Date: 2022-07-03 16:30:10.319400 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2022-07-17_8298e2141907_create_intake_goals_association_table.py b/backend/python/migrations/versions/2022-07-17_8298e2141907_create_intake_goals_association_table.py index a98139836..b935ca25b 100644 --- a/backend/python/migrations/versions/2022-07-17_8298e2141907_create_intake_goals_association_table.py +++ b/backend/python/migrations/versions/2022-07-17_8298e2141907_create_intake_goals_association_table.py @@ -5,6 +5,7 @@ Create Date: 2022-07-17 16:22:16.826045 """ + import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql diff --git a/backend/python/migrations/versions/2022-08-14_6d3ed0c1b66e_added_default_column.py b/backend/python/migrations/versions/2022-08-14_6d3ed0c1b66e_added_default_column.py index 28d31c162..152f4b4dd 100644 --- a/backend/python/migrations/versions/2022-08-14_6d3ed0c1b66e_added_default_column.py +++ b/backend/python/migrations/versions/2022-08-14_6d3ed0c1b66e_added_default_column.py @@ -5,6 +5,7 @@ Create Date: 2022-08-14 00:54:06.072893 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2022-08-14_ccabdb62cbef_add_date_columns_to_goals.py b/backend/python/migrations/versions/2022-08-14_ccabdb62cbef_add_date_columns_to_goals.py index ee3edfe4a..504d56854 100644 --- a/backend/python/migrations/versions/2022-08-14_ccabdb62cbef_add_date_columns_to_goals.py +++ b/backend/python/migrations/versions/2022-08-14_ccabdb62cbef_add_date_columns_to_goals.py @@ -5,6 +5,7 @@ Create Date: 2022-08-14 15:18:03.547810 """ + import datetime import sqlalchemy as sa diff --git a/backend/python/migrations/versions/2022-09-25_7343e3f6ce2b_update_intake_and_caregivers_enums.py b/backend/python/migrations/versions/2022-09-25_7343e3f6ce2b_update_intake_and_caregivers_enums.py index e2466b0ba..93775a74e 100644 --- a/backend/python/migrations/versions/2022-09-25_7343e3f6ce2b_update_intake_and_caregivers_enums.py +++ b/backend/python/migrations/versions/2022-09-25_7343e3f6ce2b_update_intake_and_caregivers_enums.py @@ -5,6 +5,7 @@ Create Date: 2022-09-25 16:52:01.734435 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2022-10-30_94d5d0cd2d69_differentiate_caregiver_and_provider.py b/backend/python/migrations/versions/2022-10-30_94d5d0cd2d69_differentiate_caregiver_and_provider.py index a35bfbf52..4cf7b16c2 100644 --- a/backend/python/migrations/versions/2022-10-30_94d5d0cd2d69_differentiate_caregiver_and_provider.py +++ b/backend/python/migrations/versions/2022-10-30_94d5d0cd2d69_differentiate_caregiver_and_provider.py @@ -5,6 +5,7 @@ Create Date: 2022-10-30 22:34:24.739232 """ + import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql diff --git a/backend/python/migrations/versions/2022-11-02_5fff1dc51c07_remove_address_table.py b/backend/python/migrations/versions/2022-11-02_5fff1dc51c07_remove_address_table.py index 35f7a9dd6..cdde56369 100644 --- a/backend/python/migrations/versions/2022-11-02_5fff1dc51c07_remove_address_table.py +++ b/backend/python/migrations/versions/2022-11-02_5fff1dc51c07_remove_address_table.py @@ -5,6 +5,7 @@ Create Date: 2022-11-02 03:45:09.921896 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2022-11-07_12e97fac48b2_update_intake_model.py b/backend/python/migrations/versions/2022-11-07_12e97fac48b2_update_intake_model.py index 863d46ea4..912c94420 100644 --- a/backend/python/migrations/versions/2022-11-07_12e97fac48b2_update_intake_model.py +++ b/backend/python/migrations/versions/2022-11-07_12e97fac48b2_update_intake_model.py @@ -5,6 +5,7 @@ Create Date: 2022-11-07 00:37:45.389536 """ + import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql diff --git a/backend/python/migrations/versions/2022-11-23_2ba84d84b1b7_update_familial_concern_and_child_.py b/backend/python/migrations/versions/2022-11-23_2ba84d84b1b7_update_familial_concern_and_child_.py index 4f9c83e62..95b51789a 100644 --- a/backend/python/migrations/versions/2022-11-23_2ba84d84b1b7_update_familial_concern_and_child_.py +++ b/backend/python/migrations/versions/2022-11-23_2ba84d84b1b7_update_familial_concern_and_child_.py @@ -5,6 +5,7 @@ Create Date: 2022-11-23 08:00:22.511433 """ + import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql diff --git a/backend/python/migrations/versions/2022_06_24-f5b6bf135715-intake_models_initial_migration.py b/backend/python/migrations/versions/2022_06_24-f5b6bf135715-intake_models_initial_migration.py index c708f9a2b..e3890557c 100644 --- a/backend/python/migrations/versions/2022_06_24-f5b6bf135715-intake_models_initial_migration.py +++ b/backend/python/migrations/versions/2022_06_24-f5b6bf135715-intake_models_initial_migration.py @@ -5,6 +5,7 @@ Create Date: 2022-06-24 03:07:26.431170 """ + import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql diff --git a/backend/python/migrations/versions/2023-01-30_a46d44436397_create_attendance_model.py b/backend/python/migrations/versions/2023-01-30_a46d44436397_create_attendance_model.py index da7c7536d..d1a79e2c8 100644 --- a/backend/python/migrations/versions/2023-01-30_a46d44436397_create_attendance_model.py +++ b/backend/python/migrations/versions/2023-01-30_a46d44436397_create_attendance_model.py @@ -5,6 +5,7 @@ Create Date: 2023-01-30 01:40:22.922458 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2023-02-16_823354eaef0b_attendance_models.py b/backend/python/migrations/versions/2023-02-16_823354eaef0b_attendance_models.py index 6c1399c0e..0ce262e31 100644 --- a/backend/python/migrations/versions/2023-02-16_823354eaef0b_attendance_models.py +++ b/backend/python/migrations/versions/2023-02-16_823354eaef0b_attendance_models.py @@ -5,6 +5,7 @@ Create Date: 2023-02-16 01:54:56.208611 """ + import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql diff --git a/backend/python/migrations/versions/2023-02-24_f6669088b3f1_change_attendance_sheet_and_record_.py b/backend/python/migrations/versions/2023-02-24_f6669088b3f1_change_attendance_sheet_and_record_.py index 8380ec7e2..abc76c02f 100644 --- a/backend/python/migrations/versions/2023-02-24_f6669088b3f1_change_attendance_sheet_and_record_.py +++ b/backend/python/migrations/versions/2023-02-24_f6669088b3f1_change_attendance_sheet_and_record_.py @@ -5,6 +5,7 @@ Create Date: 2023-02-24 04:17:41.827535 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2023-03-02_784b7a2d1114_fix_attendance_model_typos.py b/backend/python/migrations/versions/2023-03-02_784b7a2d1114_fix_attendance_model_typos.py index c4754f503..bbede88cb 100644 --- a/backend/python/migrations/versions/2023-03-02_784b7a2d1114_fix_attendance_model_typos.py +++ b/backend/python/migrations/versions/2023-03-02_784b7a2d1114_fix_attendance_model_typos.py @@ -5,6 +5,7 @@ Create Date: 2023-03-02 05:16:56.522409 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2023-03-16_e8d276dc89aa_change_instances_of_attending_parent_to_.py b/backend/python/migrations/versions/2023-03-16_e8d276dc89aa_change_instances_of_attending_parent_to_.py index 766d391d9..cdb324b7f 100644 --- a/backend/python/migrations/versions/2023-03-16_e8d276dc89aa_change_instances_of_attending_parent_to_.py +++ b/backend/python/migrations/versions/2023-03-16_e8d276dc89aa_change_instances_of_attending_parent_to_.py @@ -5,6 +5,7 @@ Create Date: 2023-03-16 00:59:37.963426 """ + import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql diff --git a/backend/python/migrations/versions/2023-04-05_bb23310db98a_modify_child_service_worker.py b/backend/python/migrations/versions/2023-04-05_bb23310db98a_modify_child_service_worker.py index d86dca777..dc0006ca2 100644 --- a/backend/python/migrations/versions/2023-04-05_bb23310db98a_modify_child_service_worker.py +++ b/backend/python/migrations/versions/2023-04-05_bb23310db98a_modify_child_service_worker.py @@ -5,6 +5,7 @@ Create Date: 2023-04-05 22:58:08.214445 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2023-05-28_58c30491ece7_remove_kinship_and_foster_placement_.py b/backend/python/migrations/versions/2023-05-28_58c30491ece7_remove_kinship_and_foster_placement_.py index 5fef9b16a..ea68b5cba 100644 --- a/backend/python/migrations/versions/2023-05-28_58c30491ece7_remove_kinship_and_foster_placement_.py +++ b/backend/python/migrations/versions/2023-05-28_58c30491ece7_remove_kinship_and_foster_placement_.py @@ -5,6 +5,7 @@ Create Date: 2023-05-28 15:38:54.595947 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2023-05-28_a7f5c5731635_remove_kinship_and_foster.py b/backend/python/migrations/versions/2023-05-28_a7f5c5731635_remove_kinship_and_foster.py index bff92623c..64641d3e4 100644 --- a/backend/python/migrations/versions/2023-05-28_a7f5c5731635_remove_kinship_and_foster.py +++ b/backend/python/migrations/versions/2023-05-28_a7f5c5731635_remove_kinship_and_foster.py @@ -5,6 +5,7 @@ Create Date: 2023-05-28 16:02:20.061417 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2023-06-01_3c7ee24004d0_merging.py b/backend/python/migrations/versions/2023-06-01_3c7ee24004d0_merging.py index 673f4f0db..c3ac2c078 100644 --- a/backend/python/migrations/versions/2023-06-01_3c7ee24004d0_merging.py +++ b/backend/python/migrations/versions/2023-06-01_3c7ee24004d0_merging.py @@ -5,6 +5,7 @@ Create Date: 2023-06-01 05:07:54.685490 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2023-06-01_e5d9b1c73228_remove.py b/backend/python/migrations/versions/2023-06-01_e5d9b1c73228_remove.py index 2cfe22e00..90b9700c2 100644 --- a/backend/python/migrations/versions/2023-06-01_e5d9b1c73228_remove.py +++ b/backend/python/migrations/versions/2023-06-01_e5d9b1c73228_remove.py @@ -5,6 +5,7 @@ Create Date: 2023-06-01 05:12:02.004664 """ + import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql diff --git a/backend/python/migrations/versions/2023-06-11_9674564fde8d_added_lead_access_worker_name_and_.py b/backend/python/migrations/versions/2023-06-11_9674564fde8d_added_lead_access_worker_name_and_.py index 9eccaa66f..c64521b73 100644 --- a/backend/python/migrations/versions/2023-06-11_9674564fde8d_added_lead_access_worker_name_and_.py +++ b/backend/python/migrations/versions/2023-06-11_9674564fde8d_added_lead_access_worker_name_and_.py @@ -5,6 +5,7 @@ Create Date: 2023-06-11 16:38:45.286561 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2023-07-02_73b155c137af_autoincrement_intake_id.py b/backend/python/migrations/versions/2023-07-02_73b155c137af_autoincrement_intake_id.py index 1bd90373d..8ad079e1a 100644 --- a/backend/python/migrations/versions/2023-07-02_73b155c137af_autoincrement_intake_id.py +++ b/backend/python/migrations/versions/2023-07-02_73b155c137af_autoincrement_intake_id.py @@ -5,6 +5,7 @@ Create Date: 2023-07-02 16:59:48.480850 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2023-07-14_900a2298b0d2_added_model_for_visit_cadence.py b/backend/python/migrations/versions/2023-07-14_900a2298b0d2_added_model_for_visit_cadence.py index c5032bc2a..0818af04e 100644 --- a/backend/python/migrations/versions/2023-07-14_900a2298b0d2_added_model_for_visit_cadence.py +++ b/backend/python/migrations/versions/2023-07-14_900a2298b0d2_added_model_for_visit_cadence.py @@ -5,6 +5,7 @@ Create Date: 2023-07-14 03:15:10.029336 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2023-07-21_ba551533e51d_added_caregiver_id_to_visit_cadence_.py b/backend/python/migrations/versions/2023-07-21_ba551533e51d_added_caregiver_id_to_visit_cadence_.py index 8ed7a738f..60888d626 100644 --- a/backend/python/migrations/versions/2023-07-21_ba551533e51d_added_caregiver_id_to_visit_cadence_.py +++ b/backend/python/migrations/versions/2023-07-21_ba551533e51d_added_caregiver_id_to_visit_cadence_.py @@ -5,6 +5,7 @@ Create Date: 2023-07-21 02:22:01.341912 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2023-10-03_4efb829c774a_get_rid_of_intake_id_column_in_goals.py b/backend/python/migrations/versions/2023-10-03_4efb829c774a_get_rid_of_intake_id_column_in_goals.py index 96bf01388..e25866717 100644 --- a/backend/python/migrations/versions/2023-10-03_4efb829c774a_get_rid_of_intake_id_column_in_goals.py +++ b/backend/python/migrations/versions/2023-10-03_4efb829c774a_get_rid_of_intake_id_column_in_goals.py @@ -5,6 +5,7 @@ Create Date: 2023-10-03 23:59:41.201736 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2023-10-03_79a4641aa0e2_add_intake_id_column_to_goals_and_.py b/backend/python/migrations/versions/2023-10-03_79a4641aa0e2_add_intake_id_column_to_goals_and_.py index ae51eeb72..2cb39c04c 100644 --- a/backend/python/migrations/versions/2023-10-03_79a4641aa0e2_add_intake_id_column_to_goals_and_.py +++ b/backend/python/migrations/versions/2023-10-03_79a4641aa0e2_add_intake_id_column_to_goals_and_.py @@ -5,6 +5,7 @@ Create Date: 2023-10-03 23:49:32.368445 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2023-10-03_9102ff64a1fd_update_attendance_sheet_fields.py b/backend/python/migrations/versions/2023-10-03_9102ff64a1fd_update_attendance_sheet_fields.py index 83b6a4f74..f941305af 100644 --- a/backend/python/migrations/versions/2023-10-03_9102ff64a1fd_update_attendance_sheet_fields.py +++ b/backend/python/migrations/versions/2023-10-03_9102ff64a1fd_update_attendance_sheet_fields.py @@ -5,6 +5,7 @@ Create Date: 2023-10-03 02:36:39.066166 """ + import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql diff --git a/backend/python/migrations/versions/2023-10-10_bef4bdd6cc2b_merging.py b/backend/python/migrations/versions/2023-10-10_bef4bdd6cc2b_merging.py index e56e6602c..3db6d3acb 100644 --- a/backend/python/migrations/versions/2023-10-10_bef4bdd6cc2b_merging.py +++ b/backend/python/migrations/versions/2023-10-10_bef4bdd6cc2b_merging.py @@ -5,6 +5,7 @@ Create Date: 2023-10-10 00:15:58.591935 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2023-10-11_2e3a95429cdf_merging.py b/backend/python/migrations/versions/2023-10-11_2e3a95429cdf_merging.py index 4e7270b7f..86558b736 100644 --- a/backend/python/migrations/versions/2023-10-11_2e3a95429cdf_merging.py +++ b/backend/python/migrations/versions/2023-10-11_2e3a95429cdf_merging.py @@ -5,6 +5,7 @@ Create Date: 2023-10-11 18:31:26.863225 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2023-10-31_db7c2f31d3ea_add_relationship_to_child_enum_values.py b/backend/python/migrations/versions/2023-10-31_db7c2f31d3ea_add_relationship_to_child_enum_values.py index 75a590d2f..88c59caa2 100644 --- a/backend/python/migrations/versions/2023-10-31_db7c2f31d3ea_add_relationship_to_child_enum_values.py +++ b/backend/python/migrations/versions/2023-10-31_db7c2f31d3ea_add_relationship_to_child_enum_values.py @@ -5,6 +5,7 @@ Create Date: 2023-10-31 11:43:49.965500 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2023-11-21_0d133fb5505d_update_daytime_contact_model_with_child_.py b/backend/python/migrations/versions/2023-11-21_0d133fb5505d_update_daytime_contact_model_with_child_.py index 08be0f13b..3b6e8d450 100644 --- a/backend/python/migrations/versions/2023-11-21_0d133fb5505d_update_daytime_contact_model_with_child_.py +++ b/backend/python/migrations/versions/2023-11-21_0d133fb5505d_update_daytime_contact_model_with_child_.py @@ -5,6 +5,7 @@ Create Date: 2023-11-21 01:44:17.187340 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2023-11-28_1a41a10159ef_change_attendance_model_to_snake_case.py b/backend/python/migrations/versions/2023-11-28_1a41a10159ef_change_attendance_model_to_snake_case.py index 9f0a4bbe4..b41f70181 100644 --- a/backend/python/migrations/versions/2023-11-28_1a41a10159ef_change_attendance_model_to_snake_case.py +++ b/backend/python/migrations/versions/2023-11-28_1a41a10159ef_change_attendance_model_to_snake_case.py @@ -5,6 +5,7 @@ Create Date: 2023-11-28 02:16:59.806258 """ + import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql diff --git a/backend/python/migrations/versions/2023-11-28_3df009c5afd2_make_email_field_optional.py b/backend/python/migrations/versions/2023-11-28_3df009c5afd2_make_email_field_optional.py index e969e9857..0b1f12cd6 100644 --- a/backend/python/migrations/versions/2023-11-28_3df009c5afd2_make_email_field_optional.py +++ b/backend/python/migrations/versions/2023-11-28_3df009c5afd2_make_email_field_optional.py @@ -5,6 +5,7 @@ Create Date: 2023-11-28 00:48:45.924994 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2023-11-28_4df756383780_fix_transportation_typo.py b/backend/python/migrations/versions/2023-11-28_4df756383780_fix_transportation_typo.py index 26111c8b3..1c827923f 100644 --- a/backend/python/migrations/versions/2023-11-28_4df756383780_fix_transportation_typo.py +++ b/backend/python/migrations/versions/2023-11-28_4df756383780_fix_transportation_typo.py @@ -5,6 +5,7 @@ Create Date: 2023-11-28 03:26:29.962052 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2023-11-28_85753f37ce63_fixing_daytime_contact_and_child_.py b/backend/python/migrations/versions/2023-11-28_85753f37ce63_fixing_daytime_contact_and_child_.py index 13eb12c52..8b9d815f2 100644 --- a/backend/python/migrations/versions/2023-11-28_85753f37ce63_fixing_daytime_contact_and_child_.py +++ b/backend/python/migrations/versions/2023-11-28_85753f37ce63_fixing_daytime_contact_and_child_.py @@ -5,6 +5,7 @@ Create Date: 2023-11-28 04:09:25.481353 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2023-11-28_a52b5c1d2560_change_child_model.py b/backend/python/migrations/versions/2023-11-28_a52b5c1d2560_change_child_model.py index 5b6443e46..a77a77d9a 100644 --- a/backend/python/migrations/versions/2023-11-28_a52b5c1d2560_change_child_model.py +++ b/backend/python/migrations/versions/2023-11-28_a52b5c1d2560_change_child_model.py @@ -5,6 +5,7 @@ Create Date: 2023-11-28 03:14:50.318550 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2023-11-28_c08705245bb9_change_attendance_model.py b/backend/python/migrations/versions/2023-11-28_c08705245bb9_change_attendance_model.py index a83ea98ce..9fcd41f29 100644 --- a/backend/python/migrations/versions/2023-11-28_c08705245bb9_change_attendance_model.py +++ b/backend/python/migrations/versions/2023-11-28_c08705245bb9_change_attendance_model.py @@ -5,6 +5,7 @@ Create Date: 2023-11-28 02:26:24.094276 """ + import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql diff --git a/backend/python/migrations/versions/2023-12-08_9403ac64967a_make_permitted_individuals_fields_.py b/backend/python/migrations/versions/2023-12-08_9403ac64967a_make_permitted_individuals_fields_.py index ea8876c4b..8e0efabd0 100644 --- a/backend/python/migrations/versions/2023-12-08_9403ac64967a_make_permitted_individuals_fields_.py +++ b/backend/python/migrations/versions/2023-12-08_9403ac64967a_make_permitted_individuals_fields_.py @@ -5,6 +5,7 @@ Create Date: 2023-12-08 17:17:11.029996 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2023-12-12_5a6a8146dbb6_merging_two_heads.py b/backend/python/migrations/versions/2023-12-12_5a6a8146dbb6_merging_two_heads.py index 751be4466..f42857c9b 100644 --- a/backend/python/migrations/versions/2023-12-12_5a6a8146dbb6_merging_two_heads.py +++ b/backend/python/migrations/versions/2023-12-12_5a6a8146dbb6_merging_two_heads.py @@ -5,6 +5,7 @@ Create Date: 2023-12-12 03:08:38.149095 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2023-12-12_696af69c44f7_update_caregiver_relationship_enum_part_.py b/backend/python/migrations/versions/2023-12-12_696af69c44f7_update_caregiver_relationship_enum_part_.py index 80dfe2eeb..a86a199ef 100644 --- a/backend/python/migrations/versions/2023-12-12_696af69c44f7_update_caregiver_relationship_enum_part_.py +++ b/backend/python/migrations/versions/2023-12-12_696af69c44f7_update_caregiver_relationship_enum_part_.py @@ -5,6 +5,7 @@ Create Date: 2023-12-12 03:33:13.142747 """ + import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql diff --git a/backend/python/migrations/versions/2023-12-12_839076ab9712_merging_two_heads.py b/backend/python/migrations/versions/2023-12-12_839076ab9712_merging_two_heads.py index 4590d5fb4..516b4a8f8 100644 --- a/backend/python/migrations/versions/2023-12-12_839076ab9712_merging_two_heads.py +++ b/backend/python/migrations/versions/2023-12-12_839076ab9712_merging_two_heads.py @@ -5,6 +5,7 @@ Create Date: 2023-12-12 05:42:48.679842 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/migrations/versions/2023-12-12_d280938be955_update_caregiver_relationship_enum_part_.py b/backend/python/migrations/versions/2023-12-12_d280938be955_update_caregiver_relationship_enum_part_.py index cbbf4148c..dd08272b1 100644 --- a/backend/python/migrations/versions/2023-12-12_d280938be955_update_caregiver_relationship_enum_part_.py +++ b/backend/python/migrations/versions/2023-12-12_d280938be955_update_caregiver_relationship_enum_part_.py @@ -5,6 +5,7 @@ Create Date: 2023-12-12 03:34:24.602800 """ + import sqlalchemy as sa from alembic import op diff --git a/backend/python/requirements.txt b/backend/python/requirements.txt index 4e52f7f68..a6946d4b3 100644 --- a/backend/python/requirements.txt +++ b/backend/python/requirements.txt @@ -1,7 +1,7 @@ alembic==1.5.2 appdirs==1.4.4 attrs==21.2.0 -black==23.1.0 +black==24.1.0 CacheControl==0.12.6 cachetools==4.2.1 certifi==2020.12.5 @@ -65,7 +65,7 @@ six==1.15.0 SQLAlchemy==1.3.22 toml==0.10.2 typed-ast==1.4.2 -typing-extensions==3.10.0.0 +typing-extensions==4.0.1 uritemplate==3.0.1 urllib3==1.26.5 Werkzeug==1.0.1 diff --git a/frontend/src/APIClients/IntakeAPIClient.ts b/frontend/src/APIClients/IntakeAPIClient.ts index 6a208074e..08b2b7202 100644 --- a/frontend/src/APIClients/IntakeAPIClient.ts +++ b/frontend/src/APIClients/IntakeAPIClient.ts @@ -8,6 +8,7 @@ interface Intake { user_id: number; case_id: number; intake_status: string; + intake_meeting_notes: string; caseReferral: { referringWorker: string; referringWorkerContact: string; @@ -65,6 +66,7 @@ const search = async (searchParam: string): Promise => { user_id: intake.user_id.toString(), case_id: intake.case_id.toString(), intakeStatus: intake.intake_status, + intakeMeetingNotes: intake.intake_meeting_notes, caseReferral: { referringWorkerName: intake.caseReferral.referringWorker, referringWorkerContact: intake.caseReferral.referringWorkerContact, @@ -173,6 +175,7 @@ const get = async ( user_id: intake.user_id.toString(), case_id: intake.case_id.toString(), intakeStatus: intake.intake_status, + intakeMeetingNotes: intake.intake_meeting_notes, caseReferral: { referringWorkerName: intake.caseReferral.referringWorker, referringWorkerContact: intake.caseReferral.referringWorkerContact, diff --git a/frontend/src/components/common/FilteredCaseDisplay.tsx b/frontend/src/components/common/FilteredCaseDisplay.tsx index aff75c6e1..f35717c3c 100644 --- a/frontend/src/components/common/FilteredCaseDisplay.tsx +++ b/frontend/src/components/common/FilteredCaseDisplay.tsx @@ -43,6 +43,7 @@ const FilteredCaseDisplay = ({ key={caseData.caseId} caseId={caseData.caseId} referringWorker={caseData.referringWorker} + intakeMeetingNotes={caseData.intakeMeetingNotes} date={caseData.date} familyName={caseData.familyName} caseTag={caseData.caseTag} diff --git a/frontend/src/components/dashboard/CaseCard.tsx b/frontend/src/components/dashboard/CaseCard.tsx index d2412ed2b..03bb15cfa 100644 --- a/frontend/src/components/dashboard/CaseCard.tsx +++ b/frontend/src/components/dashboard/CaseCard.tsx @@ -9,6 +9,7 @@ import PermanentDeleteModal from "./PermanentDeleteModal"; export type CaseCardProps = { caseId: number; referringWorker: string; + intakeMeetingNotes: string; date: string; familyName: string; caseTag: CaseStatus; @@ -32,6 +33,7 @@ const colorChange = (value: string) => { const CaseCard = ({ caseId, referringWorker, + intakeMeetingNotes, date, familyName, caseTag, @@ -66,6 +68,10 @@ const CaseCard = ({ } }; + const onClickStatusUpdate = () => { + window.location.reload(); + }; + return ( <> { - // TODO: add deletion logic onClosePermanentDelete(); onCloseStatusModal(); + onClickStatusUpdate(); }} onClose={onClosePermanentDelete} intakeId={caseId} @@ -130,8 +136,10 @@ const CaseCard = ({ {}} + onClick={onClickStatusUpdate} onClose={onCloseStatusModal} onDeleteClick={onOpenPermanentDelete} goToIntake={goToIntake} diff --git a/frontend/src/components/dashboard/FilteredSection.tsx b/frontend/src/components/dashboard/FilteredSection.tsx index 323633244..915613a00 100644 --- a/frontend/src/components/dashboard/FilteredSection.tsx +++ b/frontend/src/components/dashboard/FilteredSection.tsx @@ -75,6 +75,7 @@ const FilteredSection = ({ date={caseData.date} familyName={caseData.familyName} caseTag={caseData.caseTag} + intakeMeetingNotes={caseData.intakeMeetingNotes} /> ))} @@ -89,6 +90,7 @@ const FilteredSection = ({ date={caseData.date} familyName={caseData.familyName} caseTag={caseData.caseTag} + intakeMeetingNotes={caseData.intakeMeetingNotes} /> ))} diff --git a/frontend/src/components/dashboard/StatusModal.tsx b/frontend/src/components/dashboard/StatusModal.tsx index 5cec75f60..50cc62335 100644 --- a/frontend/src/components/dashboard/StatusModal.tsx +++ b/frontend/src/components/dashboard/StatusModal.tsx @@ -16,15 +16,21 @@ import CustomInput from "../common/CustomInput"; import OptionalLabel from "../intake/OptionalLabel"; import { StatusSelectField } from "./StatusSelectField"; import { useStepValueContext } from "../../contexts/IntakeValueContext"; +import IntakeAPIClient from "../../APIClients/IntakeAPIClient"; export type StatusModalProps = { - caseId?: number; + caseId: number; status: string; isOpen: boolean; - onClick: () => void; + onClick: (updatedData: { + changedData: Record; + intakeID: number; + }) => void; onClose: () => void; onDeleteClick: () => void; goToIntake: () => void; + referringWorkerName: string; + intakeNotes: string; }; const StatusModal = ({ @@ -35,10 +41,12 @@ const StatusModal = ({ onClick, onDeleteClick, goToIntake, + referringWorkerName, + intakeNotes, }: StatusModalProps): React.ReactElement => { const [selectedOption, setSelectedOption] = useState(status); - const [workerName, setWorkerName] = useState(""); - const [meetingNotes, setMeetingNotes] = useState(""); + const [workerName, setWorkerName] = useState(referringWorkerName); + const [meetingNotes, setMeetingNotes] = useState(intakeNotes); const handleClearPage = () => { setWorkerName(""); @@ -116,7 +124,6 @@ const StatusModal = ({ Case Submission {/* TODO: Need to be changed for dynamic values */} - Lead: XXX Date: XXX Family Name: XXX @@ -163,7 +170,7 @@ const StatusModal = ({ placeholder={ selectedOption === "ACTIVE" ? "Enter worker name" : "" } - value={workerName} + value={selectedOption === "ACTIVE" ? workerName : ""} onChange={(event) => { setWorkerName(event.target.value); }} @@ -190,9 +197,35 @@ const StatusModal = ({ } + onClick={async () => { + const updatedData: { + changedData: Record; + intakeID: number; + } = { + changedData: { + intake_status: selectedOption, + referring_worker_name: workerName, + intake_meeting_notes: meetingNotes, + }, + intakeID: caseId, + }; + const updatedFrontend: { + changedData: Record; + intakeID: number; + } = { + changedData: { + intakeStatus: selectedOption, + referringWorkerName: workerName, + intakeMeetingNote: meetingNotes, + }, + intakeID: caseId, + }; + await IntakeAPIClient.put(updatedData); + onClick(updatedFrontend); + onClose(); + }} disabled={selectedOption === ""} primaryButtonTitle="Save" - onClick={onClick} isOpen={isOpen} onClose={onClose} unsavedProgressModal={false} diff --git a/frontend/src/components/pages/CasesPage.tsx b/frontend/src/components/pages/CasesPage.tsx index 423655aa4..604f7e072 100644 --- a/frontend/src/components/pages/CasesPage.tsx +++ b/frontend/src/components/pages/CasesPage.tsx @@ -40,6 +40,7 @@ const Cases = (): React.ReactElement | null => { ? intake.case_id : parseInt(intake.case_id, 10), referringWorker: intake.caseReferral.referringWorkerName, + intakeMeetingNotes: intake.intakeMeetingNotes, date: intake.caseReferral.referralDate, familyName: intake.caseReferral.familyName, caseTag: intake.intakeStatus, diff --git a/frontend/src/components/pages/HomePage.tsx b/frontend/src/components/pages/HomePage.tsx index c591365e4..38a619d4d 100644 --- a/frontend/src/components/pages/HomePage.tsx +++ b/frontend/src/components/pages/HomePage.tsx @@ -98,6 +98,7 @@ const Home = (): React.ReactElement => { date: caseData.caseReferral.referralDate, caseTag: caseData.intakeStatus, familyName: caseData.caseReferral.familyName, + intakeMeetingNotes: caseData.intakeMeetingNotes, })); setSearchResults(caseCards); }); @@ -123,6 +124,7 @@ const Home = (): React.ReactElement => { ? intake.case_id : parseInt(intake.case_id, 10), referringWorker: intake.caseReferral.referringWorkerName, + intakeMeetingNotes: intake.intakeMeetingNotes, date: intake.caseReferral.referralDate, familyName: intake.caseReferral.familyName, caseTag: intake.intakeStatus, diff --git a/frontend/src/types/CasesContextTypes.ts b/frontend/src/types/CasesContextTypes.ts index cc2ec78eb..dadb24ab6 100644 --- a/frontend/src/types/CasesContextTypes.ts +++ b/frontend/src/types/CasesContextTypes.ts @@ -4,6 +4,7 @@ export type Case = { user_id: string | number; case_id: string | number; intakeStatus: CaseStatus; + intakeMeetingNotes: string; caseReferral: { referringWorkerName: string; referringWorkerContact: string; From df593f7620dcf28fa563ec8f3fa87d70b8df6405 Mon Sep 17 00:00:00 2001 From: rodrigotiscareno Date: Sun, 25 Feb 2024 11:00:31 -0500 Subject: [PATCH 04/23] checkpoint --- backend/python/app/rest/visit.py | 15 ++-- frontend/src/APIClients/VisitAPIClient.ts | 84 +++++++++++++++++++ frontend/src/components/pages/VisitPage.tsx | 16 +++- .../src/components/visit/AttendanceForm.tsx | 54 ++++++++---- .../src/components/visit/ChildInfoForm.tsx | 67 +++++++-------- .../components/visit/TransportationForm.tsx | 26 +++++- .../src/components/visit/VisitFormFooter.tsx | 40 ++++++++- .../components/visit/VisitTimestampForm.tsx | 31 +++++-- 8 files changed, 260 insertions(+), 73 deletions(-) create mode 100644 frontend/src/APIClients/VisitAPIClient.ts diff --git a/backend/python/app/rest/visit.py b/backend/python/app/rest/visit.py index 189479af8..0f2625793 100644 --- a/backend/python/app/rest/visit.py +++ b/backend/python/app/rest/visit.py @@ -76,14 +76,15 @@ def get_visits(): # create a attendance record @blueprint.route("/", methods=["POST"], strict_slashes=False) # @require_authorization_by_role({"Admin"}) -@validate_request("CreateAttendanceRecordsDTO") +# @validate_request("CreateAttendanceRecordsDTO") def create_attendance_record(): - try: - record = CreateAttendanceRecordsDTO(**request.get_json()) - new_record = attendance_record_service.create_attendance_record(record) - return jsonify(new_record.__dict__), 201 - except Exception as error: - return jsonify(str(error)), 400 + print(request.get_json()) + # try: + # record = CreateAttendanceRecordsDTO(**request.get_json()) + # new_record = attendance_record_service.create_attendance_record(record) + # return jsonify(new_record.__dict__), 201 + # except Exception as error: + # return jsonify(str(error)), 400 @blueprint.route("/", methods=["PUT"], strict_slashes=False) diff --git a/frontend/src/APIClients/VisitAPIClient.ts b/frontend/src/APIClients/VisitAPIClient.ts new file mode 100644 index 000000000..432cd7fee --- /dev/null +++ b/frontend/src/APIClients/VisitAPIClient.ts @@ -0,0 +1,84 @@ +import baseAPIClient from "./BaseAPIClient"; +import AUTHENTICATED_USER_KEY from "../constants/AuthConstants"; +import { getLocalStorageObjProperty } from "../utils/LocalStorageUtils"; +import { Case } from "../types/CasesContextTypes"; + +interface Visit { + user_id: number; + case_id: number; + childDetails: { + familyName: string; + children: string[]; + childServiceWorker: string; + childProtectionWorker: string; + fosterCareCoordinator: string; + }; + visitDetails: { + visitDate: string; + visitDay: string; + visitSupervision: string; + startTime: string; + endTime: string; + location: string; + }; + attendanceEntries: { + visitingMembers: string; + visitorRelationship: string; + description: string; + visitingMemberName: string; + visitAttendance: string; + absenceReason: string; + }[]; + transportationEntries: { + gaurdian: string; + name: string; + duration: string; + }[]; +} + +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any +const post = async (formData: any): Promise => { + console.log(getLocalStorageObjProperty( + AUTHENTICATED_USER_KEY, + "access_token", + ), "Bearer Token"); + const bearerToken = `Bearer ${getLocalStorageObjProperty( + AUTHENTICATED_USER_KEY, + "access_token", + )}`; + try { + const { data } = await baseAPIClient.post("/visit", formData, { + headers: { Authorization: bearerToken }, + }); + return data; + } catch (error) { + return error; + } +}; + +const put = async ({ + changedData, + intakeID, +}: { + changedData: Record; + intakeID: number; +}): Promise => { + const bearerToken = `Bearer ${getLocalStorageObjProperty( + AUTHENTICATED_USER_KEY, + "access_token", + )}`; + try { + const { data } = await baseAPIClient.put( + `/visit/${intakeID}`, + changedData, + { + headers: { Authorization: bearerToken }, + }, + ); + return data; + } catch (error) { + return error; + } +}; + +export default { post, put }; \ No newline at end of file diff --git a/frontend/src/components/pages/VisitPage.tsx b/frontend/src/components/pages/VisitPage.tsx index c8621e1fc..f91098807 100644 --- a/frontend/src/components/pages/VisitPage.tsx +++ b/frontend/src/components/pages/VisitPage.tsx @@ -32,6 +32,8 @@ const Visit = (): React.ReactElement => { fosterCareCoordinator: "", }; + // Attendance Sheet + const DEFAULT_VISIT_DETAILS = { visitDate: "", visitDay: "", @@ -41,6 +43,8 @@ const Visit = (): React.ReactElement => { location: "", }; + // Attendance Records + const DEFAULT_ATTENDANCE_DETAILS = { entries: [ { @@ -54,6 +58,8 @@ const Visit = (): React.ReactElement => { ], }; + // Visting Member + const DEDAULT_TRANSPORTATION_DETAILS = { entries: [ { @@ -64,6 +70,7 @@ const Visit = (): React.ReactElement => { ], }; + // Transportation const [childDetails, setChildDetails] = useState( DEFAULT_CHILD_DETAILS, ); @@ -131,7 +138,7 @@ const Visit = (): React.ReactElement => { gap="8px" >