Skip to content

Commit

Permalink
abrir período de matrícula
Browse files Browse the repository at this point in the history
  • Loading branch information
yaskisoba committed Dec 13, 2023
1 parent 65b168a commit aa46648
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 15 deletions.
2 changes: 2 additions & 0 deletions backend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const learningPathsEnrolmentRoute = require('./views/routes/LearningPathEnrolmen
const logoutRoutes = require('./views/routes/Users');
const sequelize = require('sequelize');
const extractStudentsRoutes = require('./views/routes/Extract');
const registrationPeriod = require('./views/routes/RegistrationPeriod')

require("dotenv").config();
const app = express();
Expand All @@ -21,6 +22,7 @@ app.use('/learningpath', learningPathRoute);
app.use('/api', logoutRoutes);
app.use('/send-file', extractStudentsRoutes);
app.use('/learningpathenrolment', learningPathsEnrolmentRoute);
app.use('/registration-period', registrationPeriod)

let test = process.env.DB_USERNAME;

Expand Down
11 changes: 2 additions & 9 deletions backend/migrations/registrationPeriod.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,8 @@ module.exports = {
await queryInterface.createTable(register, {
co_registration_period: { type: Sequelize.INTEGER, autoIncrement: true, primaryKey: true },
ds_is_open: { type: Sequelize.BOOLEAN, defaultValue: false, allowNull: false},
ds_name: { type: Sequelize.TEXT, allowNull: false},
ds_start: { type: Sequelize.DATE, allowNull: false,
set(value) {
this.setDataValue('ds_start', value ? new Date(value) : null);
}},
ds_end: { type: Sequelize.DATE, allowNull: false,
set(value) {
this.setDataValue('ds_end', value ? new Date(value) : null);
}},
ds_start: { type: Sequelize.STRING, allowNull: false},
ds_end: { type: Sequelize.STRING, allowNull: false},
})
await transaction.commit()
}catch (e) {
Expand Down
5 changes: 0 additions & 5 deletions backend/models/schemas/RegistrationPeriod.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ module.exports = (sequelize, DataTypes) => {
primaryKey: true,
autoIncrement: true
},
name: {
field: "ds_name",
type: DataTypes.TEXT,
allowNull: false
},
isOpen: {
field: "ds_is_open",
type: DataTypes.BOOLEAN,
Expand Down
7 changes: 7 additions & 0 deletions backend/views/routes/RegistrationPeriod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const express = require('express');
const router = express.Router();
const RegistrationPeriodController = require('../../controllers/SuperuserController');

router.post("/create", RegistrationPeriodController.openRegistrationPeriod);

module.exports = router;
99 changes: 99 additions & 0 deletions frontend/src/pages/RegistrationPeriod/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import React from "react";
import { Container, Flex, FormControl, FormLabel, Input, FormHelperText, Text, Center} from "@chakra-ui/react";
import ButtonCadastrar from "../../components/Button";
import { useFormik } from "formik";
import * as yup from "yup";
import axios from "axios";
import { useToast } from "@chakra-ui/react";
import * as C from "./styles";
import Header from "../../components/Header/index.js";
import Footer from "../../components/Footer/index.js";
import { ChakraProvider } from "@chakra-ui/react";

import { Link } from "react-router-dom";



const RegistrationPeriod = () => {
const navigate = useNavigate();
const toast = useToast();

const [showAlert, setShowAlert] = useState(false);
const [isLoading, setIsLoading] = useState(true);


return (
<ChakraProvider>
<Flex direction="column" minH="100vh">
<Header />
<Container flex="1">
<Center paddingTop="5">
<C.titulo>
<Text
textAlign={"center"}
fontSize={"4xl"}
color={"#243A69"}
as={"b"}
>
PERÍODO DE MATRÍCULA
</Text>
</C.titulo>
</Center>
<FormControl marginTop='5vh' marginBottom='3VH'>
<FormLabel color= '#243A69'>Data de Início</FormLabel>
<Input
maxLength={40}
type='date'
size='lg'
isRequired
color='#243A69'
placeholder='Data de Início'
/>

<FormLabel color= '#243A69'>Hora de Ínicio</FormLabel>
<Input
maxLength={40}
type='time'
size='lg'
isRequired
color='#243A69'
placeholder='Hora de Ínicio'
/>

<FormLabel color= '#243A69'>Data de Fim</FormLabel>
<Input
maxLength={40}
type='date'
size='lg'
isRequired
color='#243A69'
placeholder='Data de Fim'
/>

<FormLabel color= '#243A69'>Hora de Fim</FormLabel>
<Input
maxLength={40}
type='time'
size='lg'
isRequired
color='#243A69'
placeholder='Hora de Fim'
/>


</FormControl>
<Center paddingBottom={5}>
<ButtonCadastrar
Text="Cadastrar"
></ButtonCadastrar>
</Center>

</Container>
<Footer />
</Flex>
</ChakraProvider>

);
};

export default RegistrationPeriod;
10 changes: 10 additions & 0 deletions frontend/src/pages/RegistrationPeriod/styles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import styled from "styled-components";

export const titulo = styled.div`
font-size: 150%;
font-weight: 600;
color: #243A69;
margin-left: 20px;
margin-top: 20px;
align: center;
`;
9 changes: 8 additions & 1 deletion frontend/src/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import CreateTrilhas from "../pages/CreateTrilhas";
import ExclusionTrilhas from "../pages/ExclusionTrilhas";
import Recommendations from "../pages/Recommendations";
import SendStudent from "../pages/SendStudents";
import RegistrationPeriod from "../pages/RegistrationPeriod"

const RoutesApp = () => {
const { isAuthenticated, isSuperUser } = useAuth();
Expand All @@ -23,7 +24,7 @@ const RoutesApp = () => {
<Route path="/signup" element={<Signup />} />
<Route path="/" element={<Navigate to="/signin" />} />

{!isSuperUser() ? (
{isSuperUser() ? (
<>
<Route
path="/home"
Expand Down Expand Up @@ -67,6 +68,12 @@ const RoutesApp = () => {
!isAuthenticated() ? <Navigate to="/signin" /> : <Recommendations />
}
/>
<Route
path="/periodo-matriculas"
element={
!isAuthenticated() ? <Navigate to="/signin" /> : <RegistrationPeriod />
}
/>
</>
) : (
<Route
Expand Down

0 comments on commit aa46648

Please sign in to comment.