From aa466486c19cc1492c471177e43cb08f1f8a14c8 Mon Sep 17 00:00:00 2001 From: Yasmim Rosa Date: Tue, 12 Dec 2023 23:46:17 -0300 Subject: [PATCH] =?UTF-8?q?abrir=20per=C3=ADodo=20de=20matr=C3=ADcula?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/index.js | 2 + backend/migrations/registrationPeriod.js | 11 +-- backend/models/schemas/RegistrationPeriod.js | 5 - backend/views/routes/RegistrationPeriod.js | 7 ++ .../src/pages/RegistrationPeriod/index.js | 99 +++++++++++++++++++ .../src/pages/RegistrationPeriod/styles.js | 10 ++ frontend/src/routes/index.js | 9 +- 7 files changed, 128 insertions(+), 15 deletions(-) create mode 100644 backend/views/routes/RegistrationPeriod.js create mode 100644 frontend/src/pages/RegistrationPeriod/index.js create mode 100644 frontend/src/pages/RegistrationPeriod/styles.js diff --git a/backend/index.js b/backend/index.js index 6a549189..05c8778a 100644 --- a/backend/index.js +++ b/backend/index.js @@ -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(); @@ -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; diff --git a/backend/migrations/registrationPeriod.js b/backend/migrations/registrationPeriod.js index 5ee75fa7..f01e01a9 100644 --- a/backend/migrations/registrationPeriod.js +++ b/backend/migrations/registrationPeriod.js @@ -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) { diff --git a/backend/models/schemas/RegistrationPeriod.js b/backend/models/schemas/RegistrationPeriod.js index 3e59fe24..ffe6f106 100644 --- a/backend/models/schemas/RegistrationPeriod.js +++ b/backend/models/schemas/RegistrationPeriod.js @@ -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, diff --git a/backend/views/routes/RegistrationPeriod.js b/backend/views/routes/RegistrationPeriod.js new file mode 100644 index 00000000..6bff088c --- /dev/null +++ b/backend/views/routes/RegistrationPeriod.js @@ -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; diff --git a/frontend/src/pages/RegistrationPeriod/index.js b/frontend/src/pages/RegistrationPeriod/index.js new file mode 100644 index 00000000..77fef995 --- /dev/null +++ b/frontend/src/pages/RegistrationPeriod/index.js @@ -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 ( + + +
+ +
+ + + PERÍODO DE MATRÍCULA + + +
+ + Data de Início + + + Hora de Ínicio + + + Data de Fim + + + Hora de Fim + + + + +
+ +
+ +
+