From 6082f8c087ca2f6b4a2a9f0dedf2884cdf26a1e8 Mon Sep 17 00:00:00 2001 From: TI JONNY Date: Thu, 19 Dec 2024 17:04:22 -0300 Subject: [PATCH] date registration --- .env | 4 ++-- .../Card/CardRegistration/index.tsx | 2 +- .../BeneficiaresCreate/state.tsx | 3 ++- .../Beneficiaries/BeneficiaresCreate/type.ts | 1 + .../Beneficiaries/BeneficiaresEdit/state.tsx | 3 ++- .../Beneficiaries/BeneficiaresEdit/type.ts | 1 + src/Context/Classroom/Registration/state.tsx | 4 ++-- src/Context/Classroom/Registration/type.tsx | 2 ++ .../BeneficiariesCreate/index.tsx | 15 ++++++++++++++ .../Beneficiaries/BeneficiariesEdit/index.tsx | 20 +++++++++++++++++-- .../Beneficiaries/BeneficiariesList/index.tsx | 2 +- 11 files changed, 47 insertions(+), 10 deletions(-) diff --git a/.env b/.env index 7c3a28b..77602a0 100644 --- a/.env +++ b/.env @@ -1,2 +1,2 @@ -# REACT_APP_API_PATH=http://localhost:3000/ -REACT_APP_API_PATH=https://br-ipti-beneficiarios.azurewebsites.net/ \ No newline at end of file +REACT_APP_API_PATH=http://localhost:3000/ +# REACT_APP_API_PATH=https://br-ipti-beneficiarios.azurewebsites.net/ \ No newline at end of file diff --git a/src/Components/Card/CardRegistration/index.tsx b/src/Components/Card/CardRegistration/index.tsx index 73b4196..f7108c3 100644 --- a/src/Components/Card/CardRegistration/index.tsx +++ b/src/Components/Card/CardRegistration/index.tsx @@ -81,7 +81,7 @@ const CardRegistration = ({
{ number: "", complement: "", state: undefined, - city: undefined + city: undefined, + date_registration: new Date(Date.now()) }; diff --git a/src/Context/Beneficiaries/BeneficiaresCreate/type.ts b/src/Context/Beneficiaries/BeneficiaresCreate/type.ts index 5daf8d2..f57d9ff 100644 --- a/src/Context/Beneficiaries/BeneficiaresCreate/type.ts +++ b/src/Context/Beneficiaries/BeneficiaresCreate/type.ts @@ -18,6 +18,7 @@ export interface BeneficiariesCreateType { project: number | undefined, deficiency_description: string | undefined kinship: string + date_registration: string | undefined | any }; tsOne: Tsone | undefined; project: any | undefined; diff --git a/src/Context/Beneficiaries/BeneficiaresEdit/state.tsx b/src/Context/Beneficiaries/BeneficiaresEdit/state.tsx index f7f986d..9462f00 100644 --- a/src/Context/Beneficiaries/BeneficiaresEdit/state.tsx +++ b/src/Context/Beneficiaries/BeneficiaresEdit/state.tsx @@ -74,7 +74,8 @@ export const BeneficiariesEditState = () => { number: registrations?.number ?? "", complement: registrations?.complement ?? "", state: registrations?.state_fk ?? "", - city: registrations?.city_fk ?? "" + city: registrations?.city_fk ?? "", + date_registration: new Date(registrations?.date_registration) ?? "" }; const CreateRegisterClassroom = (data: CreateRegistrationClassroomType) => { diff --git a/src/Context/Beneficiaries/BeneficiaresEdit/type.ts b/src/Context/Beneficiaries/BeneficiaresEdit/type.ts index e06abba..f969786 100644 --- a/src/Context/Beneficiaries/BeneficiaresEdit/type.ts +++ b/src/Context/Beneficiaries/BeneficiaresEdit/type.ts @@ -44,6 +44,7 @@ export interface Registration { neighborhood: any city_fk: any state_fk: any + date_registration: any register_term: RegisterTerm[] register_classroom: RegisterClassroom[] } diff --git a/src/Context/Classroom/Registration/state.tsx b/src/Context/Classroom/Registration/state.tsx index d3cd740..1a00dc6 100644 --- a/src/Context/Classroom/Registration/state.tsx +++ b/src/Context/Classroom/Registration/state.tsx @@ -37,8 +37,8 @@ export const RegistrationClassroomState = () => { responsable_telephone: registration?.registration.responsable_telephone, status: getStatus(registration?.status!), deficiency_description: registration?.registration.deficiency_description, - kinship: registration?.registration.kinship - + kinship: registration?.registration.kinship, + date_registration: registration?.registration.date_registration ?? "" }; const handleUpdateRegistration = (data: UpdateRegister, id: number) => { diff --git a/src/Context/Classroom/Registration/type.tsx b/src/Context/Classroom/Registration/type.tsx index 7a19088..4319a15 100644 --- a/src/Context/Classroom/Registration/type.tsx +++ b/src/Context/Classroom/Registration/type.tsx @@ -30,6 +30,7 @@ export interface UpdateRegister registration_classroom_id?: number deficiency_description: any kinship: string | undefined | null + date_registration: any } export interface RegistrationType { avatar_url: string @@ -60,4 +61,5 @@ export interface Registration { updatedAt: string kinship: string register_term?: any + date_registration: any } diff --git a/src/Pages/Beneficiaries/BeneficiariesCreate/index.tsx b/src/Pages/Beneficiaries/BeneficiariesCreate/index.tsx index a787910..2f644a9 100644 --- a/src/Pages/Beneficiaries/BeneficiariesCreate/index.tsx +++ b/src/Pages/Beneficiaries/BeneficiariesCreate/index.tsx @@ -376,6 +376,21 @@ const RegistrationPage = () => { ) : null}
) : null} + {values.project &&
+ + + + {errors.date_registration && touched.date_registration ? ( +
+ {String(errors.date_registration)} +
+ ) : null} +
} {" "}

Endereço

diff --git a/src/Pages/Beneficiaries/BeneficiariesEdit/index.tsx b/src/Pages/Beneficiaries/BeneficiariesEdit/index.tsx index 9c4e5eb..cca3e83 100644 --- a/src/Pages/Beneficiaries/BeneficiariesEdit/index.tsx +++ b/src/Pages/Beneficiaries/BeneficiariesEdit/index.tsx @@ -32,6 +32,7 @@ import ModalCreateRegisterClassroom from "./ModalCreateRegisterClassroom"; import { validaCPF } from "../../../Controller/controllerValidCPF"; import ModalAddTerm from "./ModalAddTerm"; import Icon from "../../../Components/Icon"; +import CalendarComponent from "../../../Components/Calendar"; const BeneficiariesEdit = () => { @@ -160,7 +161,7 @@ const BeneficiariesEditPage = () => { }} > {({ values, handleChange, errors, touched, setFieldValue }) => { - + console.log(values) const errorArray = getErrorsAsArray(errors); return (
@@ -303,6 +304,21 @@ const BeneficiariesEditPage = () => { ) : null} +
+ + + + {errors.date_registration && touched.date_registration ? ( +
+ {String(errors.date_registration)} +
+ ) : null} +
{" "}
@@ -399,7 +415,7 @@ const BeneficiariesEditPage = () => {

Termo

- + { body={(rowData) => { return <>{formatarData(rowData.createdAt)}; }} - header="Data de criação" + header="Data de matricula" >