Skip to content

Commit 6f83d3e

Browse files
committed
tranferir turma texto
1 parent 8d24fe9 commit 6f83d3e

File tree

3 files changed

+69
-54
lines changed

3 files changed

+69
-54
lines changed

.env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
REACT_APP_API_PATH=http://localhost:3000/
2-
# REACT_APP_API_PATH=https://br-ipti-beneficiarios.azurewebsites.net/
1+
# REACT_APP_API_PATH=http://localhost:3000/
2+
REACT_APP_API_PATH=https://br-ipti-beneficiarios.azurewebsites.net/

src/Pages/Beneficiaries/BeneficiariesCreate/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ const RegistrationPage = () => {
292292
</div>
293293
</div>{" "}
294294
<Padding padding="8px" />
295-
<h3>Projeto *</h3>
295+
<h3>Mtricula *</h3>
296296
<Padding padding="8px" />
297297
<div className="grid">
298298
<div className="col-12 md:col-6">

src/Pages/Classroom/ClassroomOne/ModalChangeClaassroom/index.tsx

Lines changed: 66 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -8,64 +8,79 @@ import { ClassroomContext } from "../../../../Context/Classroom/context";
88
import { ClassroomTypes } from "../../../../Context/Classroom/type";
99
import { useContext } from "react";
1010
import { useParams } from "react-router-dom";
11+
import * as Yup from "yup";
1112

1213
const ModalChange = ({
13-
onHide,
14-
visible,
14+
onHide,
15+
visible,
1516
}: {
16-
onHide(): void;
17-
visible?: boolean | undefined;
17+
onHide(): void;
18+
visible?: boolean | undefined;
1819
}) => {
19-
const { id } = useParams();
20+
const { id } = useParams();
2021

21-
const props = useContext(ClassroomContext) as ClassroomTypes;
22+
const props = useContext(ClassroomContext) as ClassroomTypes;
2223

23-
const { data: tsOneRequest } = useFetchRequestTsLists(undefined)
24+
const { data: tsOneRequest } = useFetchRequestTsLists(undefined);
2425

25-
return (
26-
<Dialog
27-
onHide={onHide}
28-
visible={visible}
29-
style={{ width: window.innerWidth < 800 ? "80vw" : "50vw" }}
30-
>
31-
<Formik
32-
initialValues={{
33-
idProject: ""
34-
}}
35-
onSubmit={(values) => {
36-
props.ChangeClassroom({idClassroom: id!, idProject: values.idProject})
37-
onHide();
38-
}}
39-
>
40-
{({ values, handleChange }) => {
41-
return (
42-
<Form>
43-
<div className="grid">
44-
<div className="col-12 md:col-6">
45-
<label>Escolha um projeto</label>
46-
<Padding />
47-
<DropdownComponent
48-
value={values.idProject}
49-
options={tsOneRequest?.project}
50-
placerholder="Digite um nome"
51-
onChange={handleChange}
52-
optionsValue="id"
53-
name="idProject"
54-
/>
55-
</div>
56-
</div>{" "}
57-
<Padding padding="16px" />
58-
<Column style={{ width: "100%" }}>
59-
<Row id="end">
60-
<Button label="Salvar" />
61-
</Row>
62-
</Column>
63-
</Form>
64-
);
65-
}}
66-
</Formik>
67-
</Dialog>
68-
);
26+
const schema = Yup.object().shape({
27+
idProject: Yup.string().nullable().required("Projeto é obrigatório"),
28+
});
29+
30+
return (
31+
<Dialog
32+
onHide={onHide}
33+
visible={visible}
34+
header="Transferir turma"
35+
style={{ width: window.innerWidth < 800 ? "80vw" : "50vw" }}
36+
>
37+
<Formik
38+
initialValues={{
39+
idProject: "",
40+
}}
41+
validationSchema={schema}
42+
onSubmit={(values) => {
43+
props.ChangeClassroom({
44+
idClassroom: id!,
45+
idProject: values.idProject,
46+
});
47+
onHide();
48+
}}
49+
>
50+
{({ values, handleChange, errors, touched }) => {
51+
return (
52+
<Form>
53+
<div className="grid">
54+
<div className="col-12 md:col-6">
55+
<label>Escolha um projeto</label>
56+
<Padding />
57+
<DropdownComponent
58+
value={values.idProject}
59+
options={tsOneRequest?.project}
60+
placerholder="Digite um nome"
61+
onChange={handleChange}
62+
optionsValue="id"
63+
name="idProject"
64+
/>
65+
{errors.idProject && touched.idProject ? (
66+
<div style={{ color: "red", marginTop: "8px" }}>
67+
{errors.idProject}
68+
</div>
69+
) : null}
70+
</div>
71+
</div>{" "}
72+
<Padding padding="16px" />
73+
<Column style={{ width: "100%" }}>
74+
<Row id="end">
75+
<Button label="Salvar" />
76+
</Row>
77+
</Column>
78+
</Form>
79+
);
80+
}}
81+
</Formik>
82+
</Dialog>
83+
);
6984
};
7085

7186
export default ModalChange;

0 commit comments

Comments
 (0)