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/CardClassroom/index.tsx b/src/Components/Card/CardClassroom/index.tsx index a556948..4a4eaac 100644 --- a/src/Components/Card/CardClassroom/index.tsx +++ b/src/Components/Card/CardClassroom/index.tsx @@ -10,19 +10,23 @@ import { Container } from "./style"; import pessoas from "../../../Assets/images/pessoasgray.svg"; import { AplicationContext } from "../../../Context/Aplication/context"; -import { ROLE } from "../../../Controller/controllerGlobal"; +import { ROLE, Status } from "../../../Controller/controllerGlobal"; import { menuItem } from "../../../Services/localstorage"; import styles from "../../../Styles"; import { PropsAplicationContext } from "../../../Types/types"; +import IconStatus from "./../../../Assets/images/published_with_changes.svg"; + const CardClassroom = ({ title, meetingCount, registrationCount, id, + status }: { title: string; meetingCount?: number; + status?: string registrationCount?: number; id: number; }) => { @@ -56,21 +60,21 @@ const CardClassroom = ({ {(propsAplication.user?.role === ROLE.ADMIN || propsAplication.user?.role === ROLE.COORDINATORS) && ( -
{ - e.stopPropagation(); - setVisible(true); - }} - > - -
- )} +
{ + e.stopPropagation(); + setVisible(true); + }} + > + +
+ )} @@ -78,6 +82,25 @@ const CardClassroom = ({

Participantes: {registrationCount}

+ + + + + Status: {" "} + {status === Status.PENDING ? ( +

Pendente

+ ) : status === Status.APPROVED ? ( +

Finalizado

+ ) : status === Status.REPROVED ? ( +

Reprovado

+ ) : null} +
+
+
-
- {status === statuGlobal.APPROVED - ? "Aprovado" - : status === statuGlobal.PENDING - ? "Pendente" - : status === statuGlobal.REPROVED - ? "Reprovado" - : ""} + {StatusEnum[status]}

{subtitle}

diff --git a/src/Components/Card/CardRegistration/style.tsx b/src/Components/Card/CardRegistration/style.tsx index 139c7fe..2556d64 100644 --- a/src/Components/Card/CardRegistration/style.tsx +++ b/src/Components/Card/CardRegistration/style.tsx @@ -8,6 +8,10 @@ export const Container = styled.div` border: 1.22px solid rgba(219, 230, 255, 1); background: ${styles.colors.colorCard}; + height: 100%; + display: flex; + flex-direction: column; + justify-content: center; border-radius: 16px; @@ -17,6 +21,16 @@ export const Container = styled.div` font-size: ${styles.typography.font.extraSmall}; } + .status { + display: inline-block; /* Permite que a largura seja ajustada pelo conteúdo */ + padding: 10px; /* Espaçamento interno */ + border: 1px solid #ccc; /* Borda para destacar o div */ + min-width: 150px; /* Largura mínima */ + max-width: 300px; /* Largura máxima */ + word-wrap: break-word; /* Quebra o texto se ele ultrapassar a largura máxima */ + text-align: center; + } + `; interface StatusProps { diff --git a/src/Components/Card/CardSchedule/style.tsx b/src/Components/Card/CardSchedule/style.tsx index 6447ae2..cfb458d 100644 --- a/src/Components/Card/CardSchedule/style.tsx +++ b/src/Components/Card/CardSchedule/style.tsx @@ -5,6 +5,10 @@ export const Container = styled.div` color: ${styles.colors.grayClear}; font-size: ${styles.typography.font.extraSmall}; justify-content: space-between; + height: 100%; + display: flex; + flex-direction: column; + justify-content: center; .boxQuantity { display: flex; diff --git a/src/Components/Card/CardTs/style.tsx b/src/Components/Card/CardTs/style.tsx index dbd6c68..6914f40 100644 --- a/src/Components/Card/CardTs/style.tsx +++ b/src/Components/Card/CardTs/style.tsx @@ -8,6 +8,10 @@ export const Container = styled.div` border: 1.22px solid rgba(219, 230, 255, 1); background: ${styles.colors.colorCard}; + height: 100%; + display: flex; + flex-direction: column; + justify-content: center; border-radius: 16px; diff --git a/src/Context/Classroom/state.tsx b/src/Context/Classroom/state.tsx index 660869f..2c26fa1 100644 --- a/src/Context/Classroom/state.tsx +++ b/src/Context/Classroom/state.tsx @@ -29,7 +29,7 @@ export const ClassroomState = () => { const { requestCreateClassroomMutation, requestChangeClassroomMutation, requestDeleteClassroomMutation, requestUpdateClassroomMutation } = ControllerClassroom() - const UpdateClassroom = (body: {name: string}, id: number) => { + const UpdateClassroom = (body: {name: string, status: string}, id: number) => { requestUpdateClassroomMutation.mutate({data: body, id: id}) } diff --git a/src/Context/Classroom/type.ts b/src/Context/Classroom/type.ts index 9bddcbe..5820eb2 100644 --- a/src/Context/Classroom/type.ts +++ b/src/Context/Classroom/type.ts @@ -8,6 +8,7 @@ export interface ClassroomTypes { UpdateClassroom: ( body: { name: string; + status: string }, id: number ) => void; diff --git a/src/Context/Project/ProjectOne/context.tsx b/src/Context/Project/ProjectOne/context.tsx index 531811c..079479b 100644 --- a/src/Context/Project/ProjectOne/context.tsx +++ b/src/Context/Project/ProjectOne/context.tsx @@ -5,11 +5,11 @@ import { ProjectOneTypes } from "./type"; export const ProjectOneContext = createContext(null); const ProjectOneProvider = ({ children }: { children: React.ReactNode }) => { - const { isLoading, project, updateProject, rulerProject } = ProjectOneState(); + const { isLoading, project, updateProject, rulerProject, deleteProject } = ProjectOneState(); return ( {children} diff --git a/src/Context/Project/ProjectOne/state.tsx b/src/Context/Project/ProjectOne/state.tsx index a43deb9..cc2b330 100644 --- a/src/Context/Project/ProjectOne/state.tsx +++ b/src/Context/Project/ProjectOne/state.tsx @@ -8,7 +8,7 @@ export const ProjectOneState = () => { const { id } = useParams(); const { data, isLoading } = useFetchRequestProjectOne(parseInt(id!)); const [project, setProject] = useState(); - const { requestUpdateprojectMutation, requestRulerprojectMutation } = + const { requestUpdateprojectMutation, requestRulerprojectMutation, requestDeleteprojectMutation } = ProjectController(); useEffect(() => { @@ -21,6 +21,10 @@ export const ProjectOneState = () => { requestUpdateprojectMutation.mutate({ data: data, id: id }); }; + const deleteProject = (id: number) => { + requestDeleteprojectMutation.mutate({ id: id }); + }; + const rulerProject = (file: File, id: number) => { const formData = new FormData(); @@ -32,6 +36,7 @@ export const ProjectOneState = () => { project, isLoading, updateProject, - rulerProject + rulerProject, + deleteProject }; }; diff --git a/src/Context/Project/ProjectOne/type.tsx b/src/Context/Project/ProjectOne/type.tsx index df9c447..3873adf 100644 --- a/src/Context/Project/ProjectOne/type.tsx +++ b/src/Context/Project/ProjectOne/type.tsx @@ -5,6 +5,7 @@ export interface ProjectOneTypes { isLoading: boolean; updateProject: (data: UpdateProject, id: number) => void; rulerProject: (file: File, id: number) => void + deleteProject: (id: number) => void } export interface ApiProject { diff --git a/src/Controller/controllerGlobal.tsx b/src/Controller/controllerGlobal.tsx index a27f3d9..da74fc3 100644 --- a/src/Controller/controllerGlobal.tsx +++ b/src/Controller/controllerGlobal.tsx @@ -1,5 +1,5 @@ import axios from "axios"; -import { Buffer } from 'buffer'; +import { Buffer } from 'buffer'; export const gerarIdAleatorio = (tamanho: number) => { @@ -24,15 +24,15 @@ export function formatarData(data: string): string { export function converterData(data: string) { // Divide a string pelo separador "/" const partes = data.split('/'); - + // As partes serão: partes[0] = dia, partes[1] = mês, partes[2] = ano const dia = partes[0]; const mes = partes[1]; const ano = partes[2]; - + // Reorganiza no formato YYYY-MM-DD const dataFormatada = `${ano}-${mes}-${dia}`; - + return dataFormatada; } @@ -51,12 +51,29 @@ export const VerifyColor = (color_race_number: number) => { }; export const getStatus = (id: string) => { + const status = getStatusList(); + return status.find((props) => props.id === id); +}; + +export const getStatusList = () => { const status = [ { id: Status.APPROVED, name: "Aprovado" }, { id: Status.REPROVED, name: "Reprovado" }, - { id: Status.PENDING, name: "Pedente" }, + { id: Status.PENDING, name: "Pendente" }, + { id: Status.PENDING_DOCUMENTATION, name: "Pendente de documentação" }, + { id: Status.PENDING_TERM, name: "Pendente de termo" }, + ]; - return status.find((props) => props.id === id); + return status; +}; + + +export const getStatusClassroomList = () => { + const status = [ + { id: Status.APPROVED, name: "Aprovado" }, + { id: Status.PENDING, name: "Pendente" }, + ]; + return status; }; export var typesex = [ @@ -78,6 +95,17 @@ export const Status = { APPROVED: "APPROVED", PENDING: "PENDING", REPROVED: "REPROVED", + PENDING_TERM: "PENDING_TERM", + PENDING_DOCUMENTATION: "PENDING_DOCUMENTATION" +}; + + +export const StatusEnum: any = { + APPROVED: "Aprovado", + PENDING: "Pendente", + REPROVED: "Reprovado", + PENDING_TERM: "Pend. de termo", + PENDING_DOCUMENTATION: "Pend. de documentação" }; export const ROLE = { diff --git a/src/Pages/Classroom/ClassroomOne/RegistrationList/Registration/index.tsx b/src/Pages/Classroom/ClassroomOne/RegistrationList/Registration/index.tsx index e1a7204..555248e 100644 --- a/src/Pages/Classroom/ClassroomOne/RegistrationList/Registration/index.tsx +++ b/src/Pages/Classroom/ClassroomOne/RegistrationList/Registration/index.tsx @@ -2,6 +2,7 @@ import { Form, Formik } from "formik"; import { Button } from "primereact/button"; import { useContext } from "react"; import { useParams } from "react-router-dom"; +import avatar from "../../../../../Assets/images/avatar.svg"; import ContentPage from "../../../../../Components/ContentPage"; import DropdownComponent from "../../../../../Components/Dropdown"; import MaskInput from "../../../../../Components/InputMask"; @@ -12,14 +13,13 @@ import RegistartionDetailsProvider, { } from "../../../../../Context/Classroom/Registration/context"; import { RegistrationDetailsTypes } from "../../../../../Context/Classroom/Registration/type"; import { - Status, color_race, - typesex, + getStatusList, + typesex } from "../../../../../Controller/controllerGlobal"; import { useFetchRequestClassroomOne } from "../../../../../Services/Classroom/query"; import { Padding } from "../../../../../Styles/styles"; import { Avatar } from "../../../../Beneficiaries/BeneficiariesEdit"; -import avatar from "../../../../../Assets/images/avatar.svg" const Registration = () => { @@ -70,11 +70,9 @@ const RegistrationPage = () => { name="status" placerholder="Status" optionsLabel="name" - options={[ - { id: Status.APPROVED, name: "Aprovado" }, - { id: Status.REPROVED, name: "Reprovado" }, - { id: Status.PENDING, name: "Pedente" }, - ]} + options={ + getStatusList() + } /> {" "} diff --git a/src/Pages/Classroom/ClassroomOne/Report/index.tsx b/src/Pages/Classroom/ClassroomOne/Report/index.tsx index 9b216a1..a6c7fe6 100644 --- a/src/Pages/Classroom/ClassroomOne/Report/index.tsx +++ b/src/Pages/Classroom/ClassroomOne/Report/index.tsx @@ -4,11 +4,10 @@ import { DataTable } from "primereact/datatable"; import { useParams } from "react-router-dom"; import Present from "../../../../Assets/images/status-approved.svg"; import NotPresent from "../../../../Assets/images/status-desapproved.svg"; +import ContentPage from "../../../../Components/ContentPage"; import { useFetchRequestClassroomReport } from "../../../../Services/Classroom/query"; -import { Container, Row } from "../../../../Styles/styles"; import color from "../../../../Styles/colors"; import { ReportClassroom } from "./Pdf"; -import ContentPage from "../../../../Components/ContentPage"; const Report = () => { return ; diff --git a/src/Pages/Classroom/ClassroomOne/index.tsx b/src/Pages/Classroom/ClassroomOne/index.tsx index f524fca..94c09db 100644 --- a/src/Pages/Classroom/ClassroomOne/index.tsx +++ b/src/Pages/Classroom/ClassroomOne/index.tsx @@ -9,13 +9,14 @@ import meeting from "../../../Assets/images/school_teacher.svg"; import TextInput from "../../../Components/TextInput"; import ContentPage from "../../../Components/ContentPage"; +import DropdownComponent from "../../../Components/Dropdown"; import Loading from "../../../Components/Loading"; import { AplicationContext } from "../../../Context/Aplication/context"; import ClassroomProvider, { ClassroomContext, } from "../../../Context/Classroom/context"; import { ClassroomTypes } from "../../../Context/Classroom/type"; -import { ROLE } from "../../../Controller/controllerGlobal"; +import { getStatusClassroomList, ROLE } from "../../../Controller/controllerGlobal"; import { useFetchRequestClassroomOne } from "../../../Services/Classroom/query"; import { Column, Padding, Row } from "../../../Styles/styles"; import { PropsAplicationContext } from "../../../Types/types"; @@ -50,31 +51,47 @@ const ClassroomOnePage = () => { <> {classroom ? ( props.id === classroom?.status) }} onSubmit={(values) => { - props.UpdateClassroom(values, parseInt(id!)); + props.UpdateClassroom({ name: values.name, status: values.status?.id! }, parseInt(id!)); setEdit(false); }} > {({ values, handleChange }) => { + return (
- - - -