From e5212feec200c9d7dd7c62da240634e12332a30b Mon Sep 17 00:00:00 2001 From: Maria Clara Oleari Date: Sat, 15 Jun 2024 19:41:22 -0300 Subject: [PATCH 1/2] =?UTF-8?q?Arrumando=20o=20css=20da=20tela=20Calend?= =?UTF-8?q?=C3=A1rio=20e=20Reuniao.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{EDRA_logo_1 1 (2).svg => edraB.svg} | 0 view/src/components/Header/Header.css | 2 +- view/src/components/Kanban/Kanban.css | 16 +- view/src/components/Kanban/index.jsx | 6 +- view/src/components/SideBar/SideBar.css | 2 +- view/src/components/SideBar/index.jsx | 14 +- view/src/components/TablePS/TablePS.css | 3 +- view/src/components/TableProx/TableProx.css | 13 +- view/src/pages/Admin/Admin.css | 18 +- view/src/pages/Admin/index.jsx | 88 +++---- view/src/pages/Calendar/Calendar.css | 65 +++-- view/src/pages/Calendar/index.jsx | 3 +- view/src/pages/Detail/Detail.css | 20 +- view/src/pages/Detail/index.jsx | 22 +- view/src/pages/Divulgation/Divulgation.css | 27 +- view/src/pages/Divulgation/index.jsx | 200 +++++++------- view/src/pages/Documents/index.jsx | 18 +- view/src/pages/Finance/Finance.css | 37 ++- view/src/pages/Finance/index.jsx | 36 +-- view/src/pages/Login/index.jsx | 24 +- view/src/pages/Meeting/Meeting.css | 41 ++- view/src/pages/Meeting/index.jsx | 248 +++++++++--------- .../PasswordRecovery/PasswordRecovery.css | 193 +++++++------- view/src/pages/PasswordRecovery/index.jsx | 34 +-- view/src/pages/Storage/index.jsx | 81 +++--- view/src/queries/documents.js | 52 ++-- view/src/queries/events.js | 52 ++-- view/src/queries/storages.js | 52 ++-- view/src/queries/user.js | 70 ++--- view/src/utils/parseFormData.js | 2 +- 30 files changed, 740 insertions(+), 699 deletions(-) rename view/public/{EDRA_logo_1 1 (2).svg => edraB.svg} (100%) diff --git a/view/public/EDRA_logo_1 1 (2).svg b/view/public/edraB.svg similarity index 100% rename from view/public/EDRA_logo_1 1 (2).svg rename to view/public/edraB.svg diff --git a/view/src/components/Header/Header.css b/view/src/components/Header/Header.css index f8ca14f..dcb209f 100644 --- a/view/src/components/Header/Header.css +++ b/view/src/components/Header/Header.css @@ -18,7 +18,7 @@ header { .navHeader { display: flex; align-items: center; - + } .linksHeader { diff --git a/view/src/components/Kanban/Kanban.css b/view/src/components/Kanban/Kanban.css index ac0762b..7b0a4b3 100644 --- a/view/src/components/Kanban/Kanban.css +++ b/view/src/components/Kanban/Kanban.css @@ -1,14 +1,14 @@ .kanban { text-align: center; margin-left: 120px; - + } .bntTarefa { border: none; background-color: #414191; color: white; - font-size: 16px; + font-size: 15px; padding: 9px 22px; border-radius: 6px; cursor: pointer; @@ -42,6 +42,7 @@ text-align: center; border-radius: 5px; margin-bottom: 10px; + font-size: 13px; } .tarefaItem { @@ -59,6 +60,7 @@ .tarefaItem p { margin: 5px 0; color: black; + font-size: 13px; } .close { @@ -91,7 +93,9 @@ } .separador { - height: 1px; - background-color: black; /* Ou qualquer cor desejada */ - margin: 10px 0; /* Adapte conforme necessário */ - } \ No newline at end of file + height: 1px; + background-color: black; + /* Ou qualquer cor desejada */ + margin: 10px 0; + /* Adapte conforme necessário */ +} \ No newline at end of file diff --git a/view/src/components/Kanban/index.jsx b/view/src/components/Kanban/index.jsx index d3c2699..e8140ff 100644 --- a/view/src/components/Kanban/index.jsx +++ b/view/src/components/Kanban/index.jsx @@ -61,7 +61,7 @@ function Kanban() { setQuem(''); } }; - + const handleRemoveTarefa = (column, index) => { const updatedTarefas = [...tarefas[column]]; @@ -113,8 +113,8 @@ function Kanban() { setCurrentColumn(column); // Define a coluna atual para uso na edição setShowPopup(true); // Mostrar o popup de edição }; - - + + return (
diff --git a/view/src/components/SideBar/SideBar.css b/view/src/components/SideBar/SideBar.css index d9cb310..7e040f7 100644 --- a/view/src/components/SideBar/SideBar.css +++ b/view/src/components/SideBar/SideBar.css @@ -70,4 +70,4 @@ body { height: 35px; margin-bottom: 15px; } -} +} \ No newline at end of file diff --git a/view/src/components/SideBar/index.jsx b/view/src/components/SideBar/index.jsx index f7a9398..b2215f5 100644 --- a/view/src/components/SideBar/index.jsx +++ b/view/src/components/SideBar/index.jsx @@ -7,29 +7,29 @@ function SideBar() {
diff --git a/view/src/components/TablePS/TablePS.css b/view/src/components/TablePS/TablePS.css index 7243adb..66d6328 100644 --- a/view/src/components/TablePS/TablePS.css +++ b/view/src/components/TablePS/TablePS.css @@ -6,13 +6,14 @@ margin-top: 20px; } -.tabelaPS th{ +.tabelaPS th { border: 1px solid black; padding: 8px; text-align: left; width: 20%; } + .tabelaPS td { border: 1px solid black; padding: 8px; diff --git a/view/src/components/TableProx/TableProx.css b/view/src/components/TableProx/TableProx.css index 8d6e876..32a5fac 100644 --- a/view/src/components/TableProx/TableProx.css +++ b/view/src/components/TableProx/TableProx.css @@ -6,25 +6,26 @@ margin-top: 20px; } -.tabelaProx th{ +.tabelaProx th { border: 1px solid black; padding: 8px; text-align: left; } + .tabelaProx td { border: 1px solid black; padding: 8px; text-align: left; } -.tamanhoEvento{ +.tamanhoEvento { width: 45%; } -.tamanhoLocal{ +.tamanhoLocal { width: 25%; } -.tamanhoData{ - width: 30%; -} +.tamanhoData { + width: 30%; +} \ No newline at end of file diff --git a/view/src/pages/Admin/Admin.css b/view/src/pages/Admin/Admin.css index 333c241..c1567d3 100644 --- a/view/src/pages/Admin/Admin.css +++ b/view/src/pages/Admin/Admin.css @@ -3,7 +3,7 @@ top: 50%; left: 50%; transform: translate(-50%, -50%); - background-color: #d2d3e4fa; + background-color: #d2d3e4fa; padding: 20px; width: 550px; border-radius: 8%; @@ -29,7 +29,7 @@ body { left: 9rem; width: 80%; font-family: 'Poppins', monospace; - padding: 20px; + padding: 20px; } .img-text-container { @@ -38,7 +38,7 @@ body { } .fonte { - font-size: 40px; + font-size: 40px; display: flex; margin-left: 20px; margin-top: -2px; @@ -70,17 +70,17 @@ body { } .caixa label { - width: 100px; - margin-right: 10px; + width: 100px; + margin-right: 10px; font-size: 20px; } .caixa input { - flex: 1; + flex: 1; font-size: 20px; background-color: #d2d3e4fa; - border: none; - outline: none; + border: none; + outline: none; } .botao { @@ -156,4 +156,4 @@ body { .memberListContainer button:hover { text-decoration: underline; -} +} \ No newline at end of file diff --git a/view/src/pages/Admin/index.jsx b/view/src/pages/Admin/index.jsx index 20c387d..d7f764e 100644 --- a/view/src/pages/Admin/index.jsx +++ b/view/src/pages/Admin/index.jsx @@ -24,7 +24,7 @@ function Admin() { }; useEffect(() => { - get(); + get(); }, []); const handleRemoveMember = (memberId) => { @@ -52,7 +52,7 @@ function Admin() { {members.map((member) => (
  • setSelectedMember(member)}> - {member.nome} - {member.matricula} + {member.nome} - {member.matricula}
  • ))} - - - -
    + + + + {selectedMember && (
    @@ -120,43 +120,43 @@ function Admin() { type="checkbox" id="telaCalendario" name="checkboxEdiçãoTela" - value="calendario" - /> + value="calendario" + />
    @@ -170,45 +170,45 @@ function Admin() { name="checkboxEdiçãoTela" value="calendario" checked - /> + />
    diff --git a/view/src/pages/Calendar/Calendar.css b/view/src/pages/Calendar/Calendar.css index a4269fc..8be9340 100644 --- a/view/src/pages/Calendar/Calendar.css +++ b/view/src/pages/Calendar/Calendar.css @@ -6,7 +6,6 @@ body { } #paginaCalendar { - background-color: #fdfdfd; display: flex; flex-direction: column; align-items: center; @@ -17,11 +16,13 @@ body { .calendarTitulo { margin-top: 3rem; text-align: center; - font-size: 200%; + font-size: 180%; + margin-bottom: 30px; + margin-left: 80px; } -.calendarSubTitulo{ - margin-top: 3rem; +.calendarSubTitulo { + margin-top: 2rem; text-align: center; font-size: 130%; margin-left: 120px; @@ -30,10 +31,9 @@ body { .calendarCorpo { width: 80%; - background-color: #d2d3e4fa; + background-color: #2683b5a1; padding: 20px; border-radius: 8px; - box-shadow: 0 0 10px rgba(0, 0, 0, 0.336); margin-bottom: 2rem; color: #070606; margin-left: 120px; @@ -49,10 +49,15 @@ body { justify-content: space-between; } -.left, .right { +.left, +.right { width: 48%; } +.day.today.active.event { + background-color: #cbcbda; +} + .calendar { background-color: white; border-radius: 10px; @@ -66,6 +71,7 @@ body { align-items: center; font-size: 1.5rem; margin-bottom: 10px; + cursor: pointer; } .weekdays { @@ -94,17 +100,13 @@ body { cursor: pointer; } -.prev-date, .next-date { +.prev-date, +.next-date { color: #d3d3d3; } .today { - background-color: #ffd700; - border-radius: 50%; -} - -.event { - background-color: #ff6347; + background-color: #414191; border-radius: 50%; } @@ -131,7 +133,8 @@ body { margin-right: 10px; } -.goto-btn, .today-btn { +.goto-btn, +.today-btn { padding: 5px 10px; border: none; background-color: #4caf50; @@ -141,7 +144,7 @@ body { } .today-btn { - background-color: #2196f3; + background-color: #4caf50; } .today-date { @@ -152,11 +155,13 @@ body { } .event-day { - font-size: 1.5rem; + font-size: 20px; + font-weight: bold; } .event-date { - font-size: 1rem; + font-size: 20px; + font-weight: bold; } .events { @@ -167,7 +172,7 @@ body { display: flex; justify-content: space-between; align-items: center; - background-color: #e0e0e0; + background-color: white; padding: 10px; border-radius: 5px; margin-bottom: 10px; @@ -255,33 +260,41 @@ body { cursor: pointer; border-radius: 50%; padding: 5px; + margin-left: 20px; } -.delete-event{ +.delete-event { width: 20px; cursor: pointer; } + .container img { margin-left: 10px; height: 20px; } -.date{ +.date { text-align: center; - font-size: 1.2rem + font-size: 15px; } -.event-month-title{ +.event-month-title { text-align: center; margin-top: 20px; - font-size: 1.5rem + font-size: 20px; +} + +.no-event h3 { + font-weight: normal; + font-size: 15px; + margin-top: 10px; } .events-month .event { display: flex; justify-content: space-between; align-items: center; - background-color: #e0e0e0; + background-color: white; padding: 10px; border-radius: 5px; margin-bottom: 10px; @@ -302,5 +315,5 @@ body { .events-month .no-event { text-align: center; - font-size: 1.2rem; + font-size: 10px; } \ No newline at end of file diff --git a/view/src/pages/Calendar/index.jsx b/view/src/pages/Calendar/index.jsx index b48bd90..6b63210 100644 --- a/view/src/pages/Calendar/index.jsx +++ b/view/src/pages/Calendar/index.jsx @@ -12,7 +12,7 @@ const Calendar = () => { const listMonthEvents = () => { const monthEvents = eventsArr.filter(event => event.month === month + 1 && event.year === year); - + // Ordenar os eventos pela data e hora monthEvents.sort((a, b) => a.day - b.day); monthEvents.forEach(eventObj => { @@ -277,7 +277,6 @@ const Calendar = () => {

    Calendário

    -

    Bem-vindo ao calendário

    diff --git a/view/src/pages/Detail/Detail.css b/view/src/pages/Detail/Detail.css index 0d9d0fc..90a48a0 100644 --- a/view/src/pages/Detail/Detail.css +++ b/view/src/pages/Detail/Detail.css @@ -1,9 +1,9 @@ -.containerDetail{ +.containerDetail { display: flex; flex-direction: column; text-align: left; margin-left: 160px; - gap:190px; + gap: 190px; margin-top: 40px; font-size: 20px; } @@ -15,8 +15,10 @@ transform: translateY(-50%); width: 200px; height: auto; - z-index: -1; /* Define um z-index menor para ficar atrás dos outros elementos */ - opacity: 0.2; /* Opacidade para torná-la transparente */ + z-index: -1; + /* Define um z-index menor para ficar atrás dos outros elementos */ + opacity: 0.2; + /* Opacidade para torná-la transparente */ } @@ -39,7 +41,8 @@ box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); max-width: 300px; width: 100%; - position: relative; /* Para que o posicionamento absoluto do fecharPopup funcione corretamente */ + position: relative; + /* Para que o posicionamento absoluto do fecharPopup funcione corretamente */ } .fecharPopup { @@ -57,7 +60,7 @@ } .conteudo3 button { - background-color: #4CAF50; + background-color: #4CAF50; font-size: 1em; color: white; padding: 10px 20px; @@ -68,6 +71,5 @@ } .conteudo3 button:hover { - background-color: #45a049; -} - + background-color: #45a049; +} \ No newline at end of file diff --git a/view/src/pages/Detail/index.jsx b/view/src/pages/Detail/index.jsx index c098f32..f8e65db 100644 --- a/view/src/pages/Detail/index.jsx +++ b/view/src/pages/Detail/index.jsx @@ -3,7 +3,7 @@ import { useParams } from 'react-router-dom'; import './Detail.css'; import SideBar from '../../components/SideBar'; import { editPassword } from '../../queries/user'; -import Cookies from 'universal-cookie'; +import Cookies from 'universal-cookie'; import axios from 'axios' function Detail() { @@ -13,15 +13,15 @@ function Detail() { const [confirmarSenha, setConfirmarSenha] = useState(''); const [senhaMatch, setSenhaMatch] = useState(true); const cookies = new Cookies(); - + const token = cookies.get('jwtToken'); - axios.post("http://localhost:3000/users/token",{ - token: token - }).then(function (response){ - console.log(response.data); + axios.post("http://localhost:3000/users/token", { + token: token + }).then(function (response) { + console.log(response.data); }); - - + + const handleAlterarSenha = () => { setMostrarPopup(true); }; @@ -33,7 +33,7 @@ function Detail() { setSenhaMatch(true); // Reinicia o estado para que a mensagem de erro desapareça quando o popup for fechado }; - const alterarSenha = async (userId,newData)=> { + const alterarSenha = async (userId, newData) => { try { await editPassword(userId, newData) alert("Senha alterada com sucesso!") @@ -54,9 +54,9 @@ function Detail() { setMostrarPopup(false); setSenhaMatch(true); // Reinicia o estado para que a mensagem de erro desapareça*/ const IdUsuario = 2 //IMPORTANTE !! É preciso definir o id do usuário logado e mandar pra requisição - await alterarSenha(IdUsuario,{ //Precisa arrumar pra mandar o ID de usuário para alterar o cadastro + await alterarSenha(IdUsuario, { //Precisa arrumar pra mandar o ID de usuário para alterar o cadastro "senha": novaSenha, - }) + }) } else { setSenhaMatch(false); // Exibe mensagem de erro } diff --git a/view/src/pages/Divulgation/Divulgation.css b/view/src/pages/Divulgation/Divulgation.css index ac4f9bb..f2c3a48 100644 --- a/view/src/pages/Divulgation/Divulgation.css +++ b/view/src/pages/Divulgation/Divulgation.css @@ -42,11 +42,13 @@ } .circular-imagem { - width: 100px; - height: 100px; - border-radius: 50%; - object-fit: cover; /* Garante que a imagem cubra completamente o elemento */ - overflow: hidden; /* Garante que a imagem não transborde dos limites */ + width: 100px; + height: 100px; + border-radius: 50%; + object-fit: cover; + /* Garante que a imagem cubra completamente o elemento */ + overflow: hidden; + /* Garante que a imagem não transborde dos limites */ margin-left: 60px; margin: 0 auto; } @@ -160,13 +162,11 @@ margin-top: 20px; } -.paragrafo { - -} +.paragrafo {} -.fotosIntegrantes{ +.fotosIntegrantes { margin-top: 10px; - text-align: center; + text-align: center; display: flex; gap: 60px; margin-bottom: 20px; @@ -174,7 +174,8 @@ } .legendaFotos { - margin-top: 20px; - font-size: 12px; /* Tamanho da fonte (ajuste conforme necessário) */ + margin-top: 20px; + font-size: 12px; + /* Tamanho da fonte (ajuste conforme necessário) */ text-align: center; -} +} \ No newline at end of file diff --git a/view/src/pages/Divulgation/index.jsx b/view/src/pages/Divulgation/index.jsx index 4c8ac67..0f1b2f4 100644 --- a/view/src/pages/Divulgation/index.jsx +++ b/view/src/pages/Divulgation/index.jsx @@ -87,121 +87,121 @@ function Divulgation() {

    Lucas Mateus

    - fotoIntegrante -

    Luis Eduardo

    + fotoIntegrante +

    Luis Eduardo

    fotoIntegrante

    Matheus Rodrigues

    - -
    - fotoIntegrante -

    Nathan Henrique

    -
    -
    - fotoIntegrante -

    Pedro Araujo

    -
    -
    -
    -
    - -

    - Nossos drones -

    - iconDrone -
    -
    - iconDroneX -
    -

    - DRONE X -

    -

    - Jorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vulputate libero et velit interdum, ac aliquet odio mattis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. -

    -
    -
    -
    - iconDroneY -
    -

    - DRONE Y -

    -

    - Jorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vulputate libero et velit interdum, ac aliquet odio mattis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. -

    -
    -
    -
    -
    -

    - Processo seletivo -

    - iconLupa -
    -

    - Porque entrar para a EDRA? -

    -

    - Ao ingressar na EDRA, você tem a oportunidade de entender como funcionam os relacionamentos empresariais. Além disso, você cria conexões profissionais que podem moldar seu futuro, estabelecendo uma rede de contatos valiosa. Participar de uma equipe multidisciplinar permite que você faça amizades com pessoas de diversos cursos, enriquecendo ainda mais sua experiência e proporcionando um ambiente de aprendizado colaborativo e dinâmico. Essa vivência prática complementa a formação acadêmica, preparando você para os desafios do mercado de trabalho e ampliando suas perspectivas profissionais. -

    -
    - - +
    + fotoIntegrante +

    Nathan Henrique

    +
    +
    + fotoIntegrante +

    Pedro Araujo

    +
    +
    +
    +
    + +

    + Nossos drones +

    + iconDrone +
    +
    + iconDroneX +
    +

    + DRONE X +

    +

    + Jorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vulputate libero et velit interdum, ac aliquet odio mattis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. +

    +
    -

    - Cronograma do PS -

    - -

    - (*) Atualizado em: 26/06/2024; Caso tenha alterações, mais informações no instagram -

    -
    -
    - -

    - Eventos e competições -

    - iconAgenda +
    + iconDroneY +
    +

    + DRONE Y +

    +

    + Jorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vulputate libero et velit interdum, ac aliquet odio mattis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. +

    -
    - campeonatoX -
    -

    - Campeonato X -

    -

    - Jorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vulputate libero et velit interdum, ac aliquet odio mattis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. -

    -
    +
    +
    +
    +

    + Processo seletivo +

    + iconLupa +
    +

    + Porque entrar para a EDRA? +

    +

    + Ao ingressar na EDRA, você tem a oportunidade de entender como funcionam os relacionamentos empresariais. Além disso, você cria conexões profissionais que podem moldar seu futuro, estabelecendo uma rede de contatos valiosa. Participar de uma equipe multidisciplinar permite que você faça amizades com pessoas de diversos cursos, enriquecendo ainda mais sua experiência e proporcionando um ambiente de aprendizado colaborativo e dinâmico. Essa vivência prática complementa a formação acadêmica, preparando você para os desafios do mercado de trabalho e ampliando suas perspectivas profissionais. +

    +
    + + +
    + +

    + Cronograma do PS +

    + +

    + (*) Atualizado em: 26/06/2024; Caso tenha alterações, mais informações no instagram. +

    +
    +
    + +

    + Eventos e competições +

    + iconAgenda +
    +
    + campeonatoX +
    +

    + Campeonato X +

    +

    + Jorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vulputate libero et velit interdum, ac aliquet odio mattis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. +

    +
    -
    - campeonatoY -
    -

    - CampeonatoY -

    -

    - Jorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vulputate libero et velit interdum, ac aliquet odio mattis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. -

    -
    +
    + campeonatoY +
    +

    + CampeonatoY +

    +

    + Jorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vulputate libero et velit interdum, ac aliquet odio mattis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. +

    +
    -

    - Próximos eventos e competições -

    - -

    - (*) Atualizado em: 26/06/2024. Mais informações no instagram -

    +

    + Próximos eventos e competições +

    + +

    + (*) Atualizado em: 26/06/2024. Mais informações no instagram. +

    -
    +
    ) } diff --git a/view/src/pages/Documents/index.jsx b/view/src/pages/Documents/index.jsx index a22a0fe..ceb3767 100644 --- a/view/src/pages/Documents/index.jsx +++ b/view/src/pages/Documents/index.jsx @@ -6,7 +6,7 @@ import axios from 'axios'; function deletarDoc(id) { console.log(id); - axios.post('http://localhost:3000/documentos/delete',{ + axios.post('http://localhost:3000/documentos/delete', { id: id }); } @@ -42,12 +42,12 @@ function Documents() { const [links, setLinks] = useState([]); const [documentos, setDocs] = useState([]); - useEffect(()=>{ - axios.get("http://localhost:3000/documentos").then(function (response){ - setDocs(response.data); - console.log(documentos); - }); - },[]); + useEffect(() => { + axios.get("http://localhost:3000/documentos").then(function (response) { + setDocs(response.data); + console.log(documentos); + }); + }, []); const handleImageClick = () => { setShowPopup(true); @@ -74,7 +74,7 @@ function Documents() { setLink(''); setDescricao(''); }; - + const handleRemoveLink = (index) => { const updatedLinks = [...links]; @@ -120,7 +120,7 @@ function Documents() { required /> - +
    diff --git a/view/src/pages/Finance/Finance.css b/view/src/pages/Finance/Finance.css index fb8d554..6c03ddb 100644 --- a/view/src/pages/Finance/Finance.css +++ b/view/src/pages/Finance/Finance.css @@ -1,12 +1,4 @@ -body { - font-family: 'Poppins', monospace; - margin: 0; - padding: 0; - box-sizing: border-box; -} - #paginaFinance { - background-color: #fdfdfd; display: flex; flex-direction: column; align-items: center; @@ -17,7 +9,9 @@ body { .financeTitulo { margin-top: 3rem; text-align: center; - font-size: 200%; + font-size: 180%; + margin-bottom: 30px; + margin-left: 80px; } .img-text-container2 { @@ -34,7 +28,8 @@ body { align-items: flex-start; font-size: 1rem; margin: 0 10px; - color: #070606; /* Altere a cor do texto dentro das caixas para preto */ + color: #070606; + /* Altere a cor do texto dentro das caixas para preto */ } .caixa label { @@ -60,7 +55,8 @@ body { margin-left: 120px; } -.financeCorpo h2, .financeCorpo h3 { +.financeCorpo h2, +.financeCorpo h3 { margin: 0 0 1rem 0; } @@ -124,7 +120,9 @@ body { align-self: flex-end; } -.caixa input[type="text"], .caixa input[type="number"], .caixa select { +.caixa input[type="text"], +.caixa input[type="number"], +.caixa select { width: calc(100% - 10px); background-color: #fdfdfd; padding: 10px; @@ -146,7 +144,8 @@ body { } .popup label { - color: black; /* Ensure labels inside popup are black */ + color: black; + /* Ensure labels inside popup are black */ } @@ -159,11 +158,11 @@ body { .financeCorpo li img { cursor: pointer; - height: 20px; - width: 20px; - margin-right: 25px; - margin-top: 15px; - margin-left: 150px; + height: 20px; + width: 20px; + margin-right: 25px; + margin-top: 15px; + margin-left: 150px; } @@ -173,4 +172,4 @@ body { .saida { color: red; -} +} \ No newline at end of file diff --git a/view/src/pages/Finance/index.jsx b/view/src/pages/Finance/index.jsx index c9a3c92..6ce953a 100644 --- a/view/src/pages/Finance/index.jsx +++ b/view/src/pages/Finance/index.jsx @@ -3,25 +3,25 @@ import './Finance.css'; import SideBar from "../../components/SideBar"; import axios from 'axios'; -function criarItem(titulo,valor,tipo,mes,ano){ +function criarItem(titulo, valor, tipo, mes, ano) { let bool; - if (tipo === 'Entrada'){ + if (tipo === 'Entrada') { bool = true; - }else{ + } else { bool = false; } - axios.post("http://localhost:3000/acaos",{ + axios.post("http://localhost:3000/acaos", { titulo: titulo, valor: valor, tipo: bool, mes: mes, ano: ano, - user_id: 1 + user_id: 1 }); } -function deletaItem(id){ - axios.post("http://localhost:3000/acaos/delete",{ +function deletaItem(id) { + axios.post("http://localhost:3000/acaos/delete", { id: id }); } @@ -35,10 +35,10 @@ function Finance() { const [tipo, setTipo] = useState('Entrada'); const [acoes, setAcoes] = useState([]); const [saldo, setSaldo] = useState(0); - const [item,setItem] = useState([]); + const [item, setItem] = useState([]); useEffect(() => { - axios.get("http://localhost:3000/acaos").then(function (response){ + axios.get("http://localhost:3000/acaos").then(function (response) { setItem(response.data); }); saldoTotal(item); @@ -101,11 +101,11 @@ function Finance() { const saldoTotal = (item) => { let total = 0; - item.forEach(acao =>{ - if(acao.tipo){ + item.forEach(acao => { + if (acao.tipo) { total += acao.valor; - }else{ - total-= acao.valor; + } else { + total -= acao.valor; } }); setSaldo(total); @@ -114,9 +114,9 @@ function Finance() { const handleDelete = (index) => { const novaListaAcoes = [...acoes]; const acaoRemovida = novaListaAcoes.splice(index, 1)[0]; - + setAcoes(novaListaAcoes); - + // Atualizar o saldo após a remoção do registro let novoSaldo = saldo; if (acaoRemovida.tipo === 'Entrada') { @@ -136,7 +136,7 @@ function Finance() {
    - +
    - +
    - +
    diff --git a/view/src/pages/Login/index.jsx b/view/src/pages/Login/index.jsx index a16afdb..7a868a6 100644 --- a/view/src/pages/Login/index.jsx +++ b/view/src/pages/Login/index.jsx @@ -28,19 +28,19 @@ function Login() { console.log("Senha:", senha); axios.post("http://localhost:3000/users/login", { - matricula: matricula, - senha: senha - }).then(function (response) { - console.log(response.data); - cookies.set('jwtToken', response.data, { - path: '/', - secure: true, - sameSite: 'None' - }); - - }).catch(function (error) { - console.log(error); + matricula: matricula, + senha: senha + }).then(function (response) { + console.log(response.data); + cookies.set('jwtToken', response.data, { + path: '/', + secure: true, + sameSite: 'None' }); + + }).catch(function (error) { + console.log(error); + }); //window.location.href = '/detail'; diff --git a/view/src/pages/Meeting/Meeting.css b/view/src/pages/Meeting/Meeting.css index 7e9f32e..4557e69 100644 --- a/view/src/pages/Meeting/Meeting.css +++ b/view/src/pages/Meeting/Meeting.css @@ -10,18 +10,36 @@ body { font-size: 200%; } -.documentosTitulo .botao{ +.documentosTitulo .botao { margin-top: 10px; margin-left: 200px; } -.documentosCorpo { +.reunioesCorpo { text-align: left; margin-left: 180px; left: 9rem; width: 80%; font-family: 'Poppins', monospace; - padding: 20px; + padding: 20px; +} + +.presence-table th, td{ + font-size: 12px; +} + +.meeting h2{ +font-size: 20px; +} + +.bntMeeting{ + width: 25px; + height: auto; + margin-right: 10px; +} + +.fonteMeeting{ +font-size: 15px; } .img-text-container { @@ -31,7 +49,7 @@ body { } .fonte { - font-size: 40px; + font-size: 40px; margin-left: 20px; margin-top: -2px; } @@ -54,7 +72,7 @@ body { top: 50%; left: 50%; transform: translate(-50%, -50%); - background-color: #d2d3e4fa; + background-color: #d2d3e4fa; padding: 20px; width: 550px; border-radius: 8%; @@ -84,15 +102,15 @@ body { } .caixa label { - width: 100%; - margin-bottom: 10px; + width: 100%; + margin-bottom: 10px; } .caixa input { font-size: 20px; background-color: #d2d3e4fa; - border: none; - outline: none; + border: none; + outline: none; padding: 10px; } @@ -106,7 +124,8 @@ body { margin-top: 20px; } -.presence-table th, .presence-table td { +.presence-table th, +.presence-table td { border: 1px solid #ddd; padding: 8px; text-align: left; @@ -131,4 +150,6 @@ body { padding: 20px; margin-bottom: 20px; border-radius: 8px; + margin-right: 60px; } + diff --git a/view/src/pages/Meeting/index.jsx b/view/src/pages/Meeting/index.jsx index 2cf9b09..5cbad7e 100644 --- a/view/src/pages/Meeting/index.jsx +++ b/view/src/pages/Meeting/index.jsx @@ -1,10 +1,10 @@ -import React, { useState,useEffect } from "react"; +import React, { useState, useEffect } from "react"; import './Meeting.css'; import SideBar from "../../components/SideBar"; import axios from "axios"; -function criarReuniao(titulo){ - axios.post("http://localhost:3000/reuniaos",{ +function criarReuniao(titulo) { + axios.post("http://localhost:3000/reuniaos", { nome: titulo }); } @@ -22,12 +22,12 @@ function Meeting() { const [reunioes, setMeet] = useState([]); - useEffect(()=>{ - axios.get("http://localhost:3000/reuniaos").then(function (response){ - setMeet(response.data); - }); -},[]); - + useEffect(() => { + axios.get("http://localhost:3000/reuniaos").then(function (response) { + setMeet(response.data); + }); + }, []); + const handleAddMeetingClick = () => { setShowPopup2(true); }; @@ -121,127 +121,127 @@ function Meeting() { <>
    -
    -

    Reuniões

    - - - {showPopup2 && ( -
    -
    - - × - -
    -1 ? handleUpdateMeetingTitle : handleAddMeeting}> - - -
    -
    -
    - )} -
    -
    - {meetings.map((meeting, meetingIndex) => ( -
    -

    handleDoubleClick(meetingIndex)}>{meeting.nome}

    -
    - img-plus handleImageClick(meetingIndex)} /> -

    Adicionar Arquivo

    +
    +

    Reuniões

    + + + {showPopup2 && ( +
    +
    + + × + +
    -1 ? handleUpdateMeetingTitle : handleAddMeeting}> + + +
    +
    -
    - {meeting.files.map((item, fileIndex) => ( -
    -
    - img-trash handleRemoveFile(meetingIndex, fileIndex)} /> -

    - {item.fileName} (Adicionado em: {item.dateAdded}) + )} +

    +
    + {meetings.map((meeting, meetingIndex) => ( +
    +

    handleDoubleClick(meetingIndex)}>{meeting.nome}

    +
    + img-plus handleImageClick(meetingIndex)} /> +

    Adicionar Arquivo

    +
    +
    + {meeting.files.map((item, fileIndex) => ( +
    +
    + img-trash handleRemoveFile(meetingIndex, fileIndex)} /> +

    + {item.fileName} (Adicionado em: {item.dateAdded}) +

    +
    +
    + ))} +
    +
    + {links[meetingIndex] && links[meetingIndex].map((link, index) => ( +
    +

    + img-trash handleRemoveLink(meetingIndex, index)} + /> + {link.descricao}

    -
    - ))} + ))} +
    + + + + + + + + + + {meeting.members.map((member, memberIndex) => ( + + + + + + ))} + +
    NomeMatrículaPresença
    {member.nome}{member.matricula} + handlePresenceChange(meetingIndex, memberIndex)} + /> +
    -
    - {links[meetingIndex] && links[meetingIndex].map((link, index) => ( -
    -

    - img-trash handleRemoveLink(meetingIndex, index)} + ))} + {showPopup && ( +

    +
    + + × + +
    +
    - ))} -
    - - - - - - - - - - {meeting.members.map((member, memberIndex) => ( - - - - - - ))} - -
    NomeMatrículaPresença
    {member.nome}{member.matricula} - handlePresenceChange(meetingIndex, memberIndex)} - /> -
    -
    - ))} - {showPopup && ( -
    -
    - - × - - - - - - + + + + +
    -
    - )} -
    + )} +
    ); diff --git a/view/src/pages/PasswordRecovery/PasswordRecovery.css b/view/src/pages/PasswordRecovery/PasswordRecovery.css index 1306e6d..9198bbc 100644 --- a/view/src/pages/PasswordRecovery/PasswordRecovery.css +++ b/view/src/pages/PasswordRecovery/PasswordRecovery.css @@ -1,98 +1,97 @@ * { - margin: 0; - padding: 0; - box-sizing: border-box; - } - - body { - font-family: 'Poppins', monospace; - } - - .divC { - display: flex; - flex-direction: column; - background-color: #fafafa; - padding: 32px; - border-radius: 32px; - height: auto; - text-align: end; - width: 500px; - } - - form { - display: flex; - flex-direction: column; - gap: 20px; - } - - form input { - border: none; - outline: none; - padding: 13px; - border-bottom: 1px solid black; - background-color: #fdfdfd; - } - - form input::placeholder { - color: gray; - } - - form button { - padding: 16px; - border: none; - background-color: #2683b5; - font-weight: 400; - color: #fdfdfd; - font-size: 16px; - border-radius: 13px; - cursor: pointer; - } - - form button:hover { - text-decoration: underline; - } - - .p { - margin-top: 16px; - font-size: 13px; - color: black; - } - - .title { - font-size: 32px; - color: black; - font-weight: bold; - } - - .sub-title { - font-size: 13px; - padding: 0 0 24px 0; - color: black; - } - - a { - cursor: pointer; - text-decoration: none; - } - - a:hover { - text-decoration: underline; - } - - #paginaPasswordRecovery { - background-color: #007600; - height: 100vh; - display: flex; - justify-content: center; - align-items: center; - } - - .img-setaRecovery { - width: 40px; - display: flex; - margin-top: -40px; - align-items: start; - position: relative; - top: 50px; - } - \ No newline at end of file + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + font-family: 'Poppins', monospace; +} + +.divC { + display: flex; + flex-direction: column; + background-color: #fafafa; + padding: 32px; + border-radius: 32px; + height: auto; + text-align: end; + width: 500px; +} + +form { + display: flex; + flex-direction: column; + gap: 20px; +} + +form input { + border: none; + outline: none; + padding: 13px; + border-bottom: 1px solid black; + background-color: #fdfdfd; +} + +form input::placeholder { + color: gray; +} + +form button { + padding: 16px; + border: none; + background-color: #2683b5; + font-weight: 400; + color: #fdfdfd; + font-size: 16px; + border-radius: 13px; + cursor: pointer; +} + +form button:hover { + text-decoration: underline; +} + +.p { + margin-top: 16px; + font-size: 13px; + color: black; +} + +.title { + font-size: 32px; + color: black; + font-weight: bold; +} + +.sub-title { + font-size: 13px; + padding: 0 0 24px 0; + color: black; +} + +a { + cursor: pointer; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +#paginaPasswordRecovery { + background-color: #007600; + height: 100vh; + display: flex; + justify-content: center; + align-items: center; +} + +.img-setaRecovery { + width: 40px; + display: flex; + margin-top: -40px; + align-items: start; + position: relative; + top: 50px; +} \ No newline at end of file diff --git a/view/src/pages/PasswordRecovery/index.jsx b/view/src/pages/PasswordRecovery/index.jsx index 9a017f8..ec85b86 100644 --- a/view/src/pages/PasswordRecovery/index.jsx +++ b/view/src/pages/PasswordRecovery/index.jsx @@ -4,41 +4,41 @@ import { Link } from 'react-router-dom'; function PasswordRecovery() { -const [email, setEmail] = useState(''); + const [email, setEmail] = useState(''); -const handleEmailChange = (event) => { - setEmail(event.target.value); -} + const handleEmailChange = (event) => { + setEmail(event.target.value); + } -const handleSubmit = (event) =>{ - event.preventDefault(); - console.log("email:", email) + const handleSubmit = (event) => { + event.preventDefault(); + console.log("email:", email) - setEmail(''); + setEmail(''); - alert("email : "+email); -} + alert("email : " + email); + } return (
    - - seta + + seta Esqueceu a senha? Coloque seu e-mail
    -); + ); } export default PasswordRecovery; diff --git a/view/src/pages/Storage/index.jsx b/view/src/pages/Storage/index.jsx index d09e5e8..8352373 100644 --- a/view/src/pages/Storage/index.jsx +++ b/view/src/pages/Storage/index.jsx @@ -1,4 +1,4 @@ -import { useState,useEffect } from 'react'; +import { useState, useEffect } from 'react'; import SideBar from "../../components/SideBar"; import './Storage.css'; import axios from 'axios'; @@ -10,43 +10,43 @@ function editQuantidade(id, qtd) { // Captura a resposta HTML em um elemento temporário let tempElement = document.createElement('div'); tempElement.innerHTML = response.data; - + // Encontra o elemento que contém a quantidade let pQuantidade = tempElement.querySelector('#storage_' + id + ' p:nth-child(2)'); - + // Obtém o texto dentro do elemento

    que contém a quantidade let textoQuantidade = pQuantidade.textContent.trim(); - + // Extrai o número da quantidade let quantidade = parseInt(textoQuantidade.split(':')[1].trim()); - + console.log("Quantidade obtida:", quantidade); - + // Calcula a quantidade final que será enviada na requisição POST let quantity = qtd + quantidade; - if(quantity<0){ + if (quantity < 0) { quantity = 0; } - + // Realiza a requisição POST para editar a quantidade axios.post("http://localhost:3000/storages/edit", { id: id, quantidade: quantity }) - .then(function (response) { - console.log("Quantidade editada com sucesso:", response.data); - }) - .catch(function (error) { - console.error("Erro ao editar quantidade:", error); - }); + .then(function (response) { + console.log("Quantidade editada com sucesso:", response.data); + }) + .catch(function (error) { + console.error("Erro ao editar quantidade:", error); + }); }) .catch(function (error) { console.error("Erro ao obter dados do storage:", error); }); - } +} -function editaItem(id,nome,quantidade,status,user_id){ - axios.post("http://localhost:3000/storages/edit",{ +function editaItem(id, nome, quantidade, status, user_id) { + axios.post("http://localhost:3000/storages/edit", { id: id, nome: nome, quantidade: quantidade, @@ -55,22 +55,22 @@ function editaItem(id,nome,quantidade,status,user_id){ }); } -function deletaItem(id){ - axios.post("http://localhost:3000/storages/delete",{ +function deletaItem(id) { + axios.post("http://localhost:3000/storages/delete", { id: id }); } -function criarEstoque(nome,quantidade,status,user_id){//adicionar o token no userID - axios.post("http://localhost:3000/storages",{ +function criarEstoque(nome, quantidade, status, user_id) {//adicionar o token no userID + axios.post("http://localhost:3000/storages", { nome: nome, quantidade: quantidade, status: status, user_id: user_id - }).catch(function (error){ + }).catch(function (error) { console.log(error); - }).then(function (response){ - console.log("@@@@@@@@@@@@@@@@@@"+response.data); + }).then(function (response) { + console.log("@@@@@@@@@@@@@@@@@@" + response.data); }); } @@ -83,12 +83,13 @@ function Storage() { const [editIndex, setEditIndex] = useState(-1); // Estado para rastrear o índice do item em edição const [itemEstoque, setItem] = useState([]); - useEffect(()=>{ - axios.get("http://localhost:3000/storages").then(function (response){ - setItem(response.data); - }).catch(function (error){ - console.log(error); - });},[]); + useEffect(() => { + axios.get("http://localhost:3000/storages").then(function (response) { + setItem(response.data); + }).catch(function (error) { + console.log(error); + }); + }, []); const handleImageClick = () => { @@ -159,7 +160,7 @@ function Storage() { setLinks(updatedLinks); }; - const handleDoubleClick = (item,index) => { + const handleDoubleClick = (item, index) => { setNome(item.nome); setQuantidade(item.quantidade); setImagemSelecionada(item.status); @@ -232,12 +233,12 @@ function Storage() { type="submit" className='botao' onClick={() => { - if (editIndex > -1) { - editaItem(editIndex, nome, quantidade, imagemSelecionada, 1); - setShowPopup(false); // Chamando outra função junto com editaItem - } else { - criarEstoque(nome, quantidade, imagemSelecionada, 1); - } + if (editIndex > -1) { + editaItem(editIndex, nome, quantidade, imagemSelecionada, 1); + setShowPopup(false); // Chamando outra função junto com editaItem + } else { + criarEstoque(nome, quantidade, imagemSelecionada, 1); + } }}> {editIndex > -1 ? 'Salvar' : 'Adicionar'} @@ -251,15 +252,15 @@ function Storage() {

    - +

    {item.quantidade}

    - +

    handleDoubleClick(item,item.id)}//AXIOS EDIT + onDoubleClick={() => handleDoubleClick(item, item.id)}//AXIOS EDIT style={{ cursor: 'pointer' }} > {item.nome} diff --git a/view/src/queries/documents.js b/view/src/queries/documents.js index ec0cb54..84bf7b8 100644 --- a/view/src/queries/documents.js +++ b/view/src/queries/documents.js @@ -22,31 +22,31 @@ export const getSingleDocument = async (documentId) => { }; export const createDocument = async (data) => { - try { - const document = await server.post(endpoints.document.base, data); - return document; - } catch (error) { - console.log(error); - throw error; - } - }; + try { + const document = await server.post(endpoints.document.base, data); + return document; + } catch (error) { + console.log(error); + throw error; + } +}; - export const editDocument = async (documentId, data) => { - try { - const document = await server.put(endpoints.document.single(documentId), data); - return document; - } catch (error) { - console.log(error); - throw error; - } - }; +export const editDocument = async (documentId, data) => { + try { + const document = await server.put(endpoints.document.single(documentId), data); + return document; + } catch (error) { + console.log(error); + throw error; + } +}; - export const deleteDocument = async (documentId) => { - try { - const document = await server.delete(endpoints.document.single(documentId)); - return document; - } catch (error) { - console.log(error); - throw error; - } - }; \ No newline at end of file +export const deleteDocument = async (documentId) => { + try { + const document = await server.delete(endpoints.document.single(documentId)); + return document; + } catch (error) { + console.log(error); + throw error; + } +}; \ No newline at end of file diff --git a/view/src/queries/events.js b/view/src/queries/events.js index 033ebd3..24de575 100644 --- a/view/src/queries/events.js +++ b/view/src/queries/events.js @@ -22,31 +22,31 @@ export const getSingleEvent = async (eventId) => { }; export const createEvent = async (data) => { - try { - const event = await server.post(endpoints.event.base, data); - return event; - } catch (error) { - console.log(error); - throw error; - } - }; + try { + const event = await server.post(endpoints.event.base, data); + return event; + } catch (error) { + console.log(error); + throw error; + } +}; - export const editEvent = async (eventId, data) => { - try { - const event = await server.put(endpoints.event.single(eventId), data); - return event; - } catch (error) { - console.log(error); - throw error; - } - }; +export const editEvent = async (eventId, data) => { + try { + const event = await server.put(endpoints.event.single(eventId), data); + return event; + } catch (error) { + console.log(error); + throw error; + } +}; - export const deleteEvent = async (eventId) => { - try { - const event = await server.delete(endpoints.event.single(eventId)); - return event; - } catch (error) { - console.log(error); - throw error; - } - }; \ No newline at end of file +export const deleteEvent = async (eventId) => { + try { + const event = await server.delete(endpoints.event.single(eventId)); + return event; + } catch (error) { + console.log(error); + throw error; + } +}; \ No newline at end of file diff --git a/view/src/queries/storages.js b/view/src/queries/storages.js index ef3c381..972f47c 100644 --- a/view/src/queries/storages.js +++ b/view/src/queries/storages.js @@ -22,31 +22,31 @@ export const getSingleStorage = async (storageId) => { }; export const createStorage = async (data) => { - try { - const storage = await server.post(endpoints.storage.base, data); - return storage; - } catch (error) { - console.log(error); - throw error; - } - }; + try { + const storage = await server.post(endpoints.storage.base, data); + return storage; + } catch (error) { + console.log(error); + throw error; + } +}; - export const editStorage = async (storageId, data) => { - try { - const storage = await server.put(endpoints.storage.single(storageId), data); - return storage; - } catch (error) { - console.log(error); - throw error; - } - }; +export const editStorage = async (storageId, data) => { + try { + const storage = await server.put(endpoints.storage.single(storageId), data); + return storage; + } catch (error) { + console.log(error); + throw error; + } +}; - export const deleteStorage = async (storageId) => { - try { - const storage = await server.delete(endpoints.storage.single(storageId)); - return storage; - } catch (error) { - console.log(error); - throw error; - } - }; \ No newline at end of file +export const deleteStorage = async (storageId) => { + try { + const storage = await server.delete(endpoints.storage.single(storageId)); + return storage; + } catch (error) { + console.log(error); + throw error; + } +}; \ No newline at end of file diff --git a/view/src/queries/user.js b/view/src/queries/user.js index a97299a..c867f01 100644 --- a/view/src/queries/user.js +++ b/view/src/queries/user.js @@ -22,41 +22,41 @@ export const getSingleUser = async (userId) => { }; export const createUser = async (data) => { - try { - const user = await server.post(endpoints.user.base, data); - return user; - } catch (error) { - console.log(error); - throw error; - } - }; + try { + const user = await server.post(endpoints.user.base, data); + return user; + } catch (error) { + console.log(error); + throw error; + } +}; - export const editUser = async (userId, data) => { - try { - const user = await server.put(endpoints.user.single(userId), data); - return user; - } catch (error) { - console.log(error); - throw error; - } - }; +export const editUser = async (userId, data) => { + try { + const user = await server.put(endpoints.user.single(userId), data); + return user; + } catch (error) { + console.log(error); + throw error; + } +}; - export const editPassword = async (userId, newPassword) => { - try { - const user = await server.patch(endpoints.user.password(userId), newPassword); - return user; - } catch (error) { - console.log(error); - throw error; - } - }; +export const editPassword = async (userId, newPassword) => { + try { + const user = await server.patch(endpoints.user.password(userId), newPassword); + return user; + } catch (error) { + console.log(error); + throw error; + } +}; - export const deleteUser = async (userId) => { - try { - const user = await server.delete(endpoints.user.single(userId)); - return user; - } catch (error) { - console.log(error); - throw error; - } - }; +export const deleteUser = async (userId) => { + try { + const user = await server.delete(endpoints.user.single(userId)); + return user; + } catch (error) { + console.log(error); + throw error; + } +}; diff --git a/view/src/utils/parseFormData.js b/view/src/utils/parseFormData.js index 445d6b3..8d9f7a4 100644 --- a/view/src/utils/parseFormData.js +++ b/view/src/utils/parseFormData.js @@ -1,4 +1,4 @@ -export const parseFormData = (dados) =>{ +export const parseFormData = (dados) => { const object = {}; dados.forEach((value, key) => object[key] = value); return object From 4a5691615903ec950e5cd06ed095e90f6496abc7 Mon Sep 17 00:00:00 2001 From: jazzer0 Date: Sat, 15 Jun 2024 22:04:15 -0300 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20Exclus=C3=A3o=20da=20tabela=20cargo?= =?UTF-8?q?=20e=20adi=C3=A7=C3=A3o=20da=20tabela=20acesso?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/controllers/cargos_controller.rb | 72 ------------------- backend/app/controllers/users_controller.rb | 34 ++++++--- backend/app/helpers/cargos_helper.rb | 2 - backend/app/models/acesso.rb | 4 ++ backend/app/models/cargo.rb | 3 - backend/app/models/user.rb | 3 +- .../app/views/documentos/_documento.html.erb | 17 ----- .../views/documentos/_documento.json.jbuilder | 2 - backend/app/views/documentos/_form.html.erb | 32 --------- backend/app/views/documentos/edit.html.erb | 10 --- backend/app/views/documentos/index.html.erb | 14 ---- .../app/views/documentos/index.json.jbuilder | 1 - backend/app/views/documentos/new.html.erb | 9 --- backend/app/views/documentos/show.html.erb | 10 --- .../app/views/documentos/show.json.jbuilder | 1 - backend/app/views/eventos/_evento.html.erb | 2 - .../app/views/eventos/_evento.json.jbuilder | 2 - backend/app/views/eventos/_form.html.erb | 17 ----- backend/app/views/eventos/edit.html.erb | 10 --- backend/app/views/eventos/index.html.erb | 14 ---- backend/app/views/eventos/index.json.jbuilder | 1 - backend/app/views/eventos/new.html.erb | 9 --- backend/app/views/eventos/show.html.erb | 10 --- backend/app/views/eventos/show.json.jbuilder | 1 - backend/app/views/reuniaos/_form.html.erb | 32 --------- backend/app/views/reuniaos/_reuniao.html.erb | 17 ----- .../app/views/reuniaos/_reuniao.json.jbuilder | 2 - backend/app/views/reuniaos/edit.html.erb | 10 --- backend/app/views/reuniaos/index.html.erb | 14 ---- .../app/views/reuniaos/index.json.jbuilder | 1 - backend/app/views/reuniaos/new.html.erb | 9 --- backend/app/views/reuniaos/show.html.erb | 10 --- backend/app/views/reuniaos/show.json.jbuilder | 1 - backend/app/views/storages/_form.html.erb | 37 ---------- backend/app/views/storages/_storage.html.erb | 22 ------ .../app/views/storages/_storage.json.jbuilder | 2 - backend/app/views/storages/edit.html.erb | 10 --- backend/app/views/storages/index.html.erb | 14 ---- .../app/views/storages/index.json.jbuilder | 1 - backend/app/views/storages/new.html.erb | 9 --- backend/app/views/storages/show.html.erb | 10 --- backend/app/views/storages/show.json.jbuilder | 1 - backend/config/routes.rb | 2 +- .../migrate/20240521013906_create_cargos.rb | 9 --- .../db/migrate/20240521013908_create_users.rb | 1 - .../migrate/20240615232147_create_acessos.rb | 14 ++++ backend/db/schema.rb | 16 +++-- backend/db/seeds.rb | 39 ++++++++-- .../controllers/cargos_controller_test.rb | 48 ------------- .../test/controllers/users_controller_test.rb | 4 +- backend/test/fixtures/accessos.yml | 17 +++++ .../models/{cargo_test.rb => accesso_test.rb} | 2 +- backend/test/system/users_test.rb | 2 - view/src/pages/CreateAccount/index.jsx | 17 +---- view/src/pages/Detail/index.jsx | 11 ++- view/src/pages/Login/index.jsx | 10 +-- 56 files changed, 121 insertions(+), 553 deletions(-) delete mode 100644 backend/app/controllers/cargos_controller.rb delete mode 100644 backend/app/helpers/cargos_helper.rb create mode 100644 backend/app/models/acesso.rb delete mode 100644 backend/app/models/cargo.rb delete mode 100644 backend/app/views/documentos/_documento.html.erb delete mode 100644 backend/app/views/documentos/_documento.json.jbuilder delete mode 100644 backend/app/views/documentos/_form.html.erb delete mode 100644 backend/app/views/documentos/edit.html.erb delete mode 100644 backend/app/views/documentos/index.html.erb delete mode 100644 backend/app/views/documentos/index.json.jbuilder delete mode 100644 backend/app/views/documentos/new.html.erb delete mode 100644 backend/app/views/documentos/show.html.erb delete mode 100644 backend/app/views/documentos/show.json.jbuilder delete mode 100644 backend/app/views/eventos/_evento.html.erb delete mode 100644 backend/app/views/eventos/_evento.json.jbuilder delete mode 100644 backend/app/views/eventos/_form.html.erb delete mode 100644 backend/app/views/eventos/edit.html.erb delete mode 100644 backend/app/views/eventos/index.html.erb delete mode 100644 backend/app/views/eventos/index.json.jbuilder delete mode 100644 backend/app/views/eventos/new.html.erb delete mode 100644 backend/app/views/eventos/show.html.erb delete mode 100644 backend/app/views/eventos/show.json.jbuilder delete mode 100644 backend/app/views/reuniaos/_form.html.erb delete mode 100644 backend/app/views/reuniaos/_reuniao.html.erb delete mode 100644 backend/app/views/reuniaos/_reuniao.json.jbuilder delete mode 100644 backend/app/views/reuniaos/edit.html.erb delete mode 100644 backend/app/views/reuniaos/index.html.erb delete mode 100644 backend/app/views/reuniaos/index.json.jbuilder delete mode 100644 backend/app/views/reuniaos/new.html.erb delete mode 100644 backend/app/views/reuniaos/show.html.erb delete mode 100644 backend/app/views/reuniaos/show.json.jbuilder delete mode 100644 backend/app/views/storages/_form.html.erb delete mode 100644 backend/app/views/storages/_storage.html.erb delete mode 100644 backend/app/views/storages/_storage.json.jbuilder delete mode 100644 backend/app/views/storages/edit.html.erb delete mode 100644 backend/app/views/storages/index.html.erb delete mode 100644 backend/app/views/storages/index.json.jbuilder delete mode 100644 backend/app/views/storages/new.html.erb delete mode 100644 backend/app/views/storages/show.html.erb delete mode 100644 backend/app/views/storages/show.json.jbuilder delete mode 100644 backend/db/migrate/20240521013906_create_cargos.rb create mode 100644 backend/db/migrate/20240615232147_create_acessos.rb delete mode 100644 backend/test/controllers/cargos_controller_test.rb create mode 100644 backend/test/fixtures/accessos.yml rename backend/test/models/{cargo_test.rb => accesso_test.rb} (63%) diff --git a/backend/app/controllers/cargos_controller.rb b/backend/app/controllers/cargos_controller.rb deleted file mode 100644 index cc1f86c..0000000 --- a/backend/app/controllers/cargos_controller.rb +++ /dev/null @@ -1,72 +0,0 @@ -class CargosController < ApplicationController - before_action :set_cargo, only: %i[ show edit update destroy ] - - # GET /cargos or /cargos.json - def index - @cargos = Cargo.all - end - - # GET /cargos/1 or /cargos/1.json - def show - end - - # GET /cargos/new - def new - @cargo = Cargo.new - end - - # GET /cargos/1/edit - def edit - end - - # POST /cargos or /cargos.json - def create - nome = cargo_params[:nome] - teste = nome - @cargo = Cargo.new(nome: teste) - - respond_to do |format| - if @cargo.save - format.html { redirect_to cargo_url(@cargo), notice: "Cargo was successfully created." } - format.json { render :show, status: :created, location: @cargo } - else - format.html { render :new, status: :unprocessable_entity } - format.json { render json: @cargo.errors, status: :unprocessable_entity } - end - end - end - - # PATCH/PUT /cargos/1 or /cargos/1.json - def update - respond_to do |format| - if @cargo.update(cargo_params) - format.html { redirect_to cargo_url(@cargo), notice: "Cargo was successfully updated." } - format.json { render :show, status: :ok, location: @cargo } - else - format.html { render :edit, status: :unprocessable_entity } - format.json { render json: @cargo.errors, status: :unprocessable_entity } - end - end - end - - # DELETE /cargos/1 or /cargos/1.json - def destroy - @cargo.destroy! - - respond_to do |format| - format.html { redirect_to cargos_url, notice: "Cargo was successfully destroyed." } - format.json { head :no_content } - end - end - - private - # Use callbacks to share common setup or constraints between actions. - def set_cargo - @cargo = Cargo.find(params[:id]) - end - - # Only allow a list of trusted parameters through. - def cargo_params - params.require(:cargo).permit(:nome) - end -end diff --git a/backend/app/controllers/users_controller.rb b/backend/app/controllers/users_controller.rb index 7736901..0fc5862 100644 --- a/backend/app/controllers/users_controller.rb +++ b/backend/app/controllers/users_controller.rb @@ -6,12 +6,14 @@ class UsersController < ApplicationController # GET /users or /users.json def index - @users = User.order(:id).all - render json: @users + @users = User.includes(:acesso).order(:id).all + render json: @users.to_json(include: :acesso) end # GET /users/1 or /users/1.json - def show; end + def show + render json: @user.to_json(include: :acesso) + end def login if User.find_by(matricula: user_params[:matricula]) @@ -46,13 +48,13 @@ def create nome = user_params[:nome] matricula = user_params[:matricula] email = user_params[:email] - cargoID = user_params[:cargo_id] - @user = User.new(nome:, matricula:, email:, senha: hash, cargo_id: cargoID) + @user = User.new(nome:, matricula:, email:, senha: hash) + @user.build_acesso(acesso_params) if @user.save - render json: @user + render json: @user, status: :created else - render json: @user.errors + render json: @user.errors, status: :unprocessable_entity end # respond_to do |format| @@ -70,6 +72,11 @@ def create def update set_user if @user.update(update_params) + if @user.acesso.present? + @user.acesso.update(acesso_params) + else + @user.create_acesso(acesso_params) + end render json: @user, status: :ok else render json: @user.errors, status: :unprocessable_entity @@ -93,7 +100,10 @@ def update_password # DELETE /users/1 or /users/1.json def destroy - @user.destroy! + set_user + @user.destroy + + @user.acesso.destroy if @user.acesso.present? end private @@ -105,11 +115,15 @@ def set_user # Only allow a list of trusted parameters through. def user_params - params.require(:user).permit(:nome, :matricula, :email, :senha, :cargo_id, :token) + params.require(:user).permit(:nome, :matricula, :email, :senha, :token) + end + + def acesso_params + params.require(:acesso).permit(:acesso_documents, :acesso_meetings, :acesso_calendar, :acesso_finance, :acesso_admin) end def update_params - params.require(:user).permit(:nome, :matricula, :email, :cargo_id) + params.require(:user).permit(:nome, :matricula, :email) end def password_params diff --git a/backend/app/helpers/cargos_helper.rb b/backend/app/helpers/cargos_helper.rb deleted file mode 100644 index 20b961d..0000000 --- a/backend/app/helpers/cargos_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module CargosHelper -end diff --git a/backend/app/models/acesso.rb b/backend/app/models/acesso.rb new file mode 100644 index 0000000..b783f8f --- /dev/null +++ b/backend/app/models/acesso.rb @@ -0,0 +1,4 @@ +class Acesso < ApplicationRecord + belongs_to :user + validates :user, presence: true +end diff --git a/backend/app/models/cargo.rb b/backend/app/models/cargo.rb deleted file mode 100644 index a78b63e..0000000 --- a/backend/app/models/cargo.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Cargo < ApplicationRecord - has_many :users -end diff --git a/backend/app/models/user.rb b/backend/app/models/user.rb index 15c24ef..f4230f4 100644 --- a/backend/app/models/user.rb +++ b/backend/app/models/user.rb @@ -1,5 +1,6 @@ class User < ApplicationRecord - belongs_to :cargo + has_one :acesso, dependent: :destroy + accepts_nested_attributes_for :acesso has_many :estoques has_many :eventos has_many :documentos diff --git a/backend/app/views/documentos/_documento.html.erb b/backend/app/views/documentos/_documento.html.erb deleted file mode 100644 index cc33eac..0000000 --- a/backend/app/views/documentos/_documento.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -

    -

    - Nome: - <%= documento.nome %> -

    - -

    - Link: - <%= documento.link %> -

    - -

    - User: - <%= documento.user_id %> -

    - -
    diff --git a/backend/app/views/documentos/_documento.json.jbuilder b/backend/app/views/documentos/_documento.json.jbuilder deleted file mode 100644 index 8950be5..0000000 --- a/backend/app/views/documentos/_documento.json.jbuilder +++ /dev/null @@ -1,2 +0,0 @@ -json.extract! documento, :id, :nome, :link, :user_id, :created_at, :updated_at -json.url documento_url(documento, format: :json) diff --git a/backend/app/views/documentos/_form.html.erb b/backend/app/views/documentos/_form.html.erb deleted file mode 100644 index 229a55f..0000000 --- a/backend/app/views/documentos/_form.html.erb +++ /dev/null @@ -1,32 +0,0 @@ -<%= form_with(model: documento) do |form| %> - <% if documento.errors.any? %> -
    -

    <%= pluralize(documento.errors.count, "error") %> prohibited this documento from being saved:

    - -
      - <% documento.errors.each do |error| %> -
    • <%= error.full_message %>
    • - <% end %> -
    -
    - <% end %> - -
    - <%= form.label :nome, style: "display: block" %> - <%= form.text_field :nome %> -
    - -
    - <%= form.label :link, style: "display: block" %> - <%= form.text_field :link %> -
    - -
    - <%= form.label :user_id, style: "display: block" %> - <%= form.text_field :user_id %> -
    - -
    - <%= form.submit %> -
    -<% end %> diff --git a/backend/app/views/documentos/edit.html.erb b/backend/app/views/documentos/edit.html.erb deleted file mode 100644 index 3369330..0000000 --- a/backend/app/views/documentos/edit.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -

    Editing documento

    - -<%= render "form", documento: @documento %> - -
    - -
    - <%= link_to "Show this documento", @documento %> | - <%= link_to "Back to documentos", documentos_path %> -
    diff --git a/backend/app/views/documentos/index.html.erb b/backend/app/views/documentos/index.html.erb deleted file mode 100644 index 9676801..0000000 --- a/backend/app/views/documentos/index.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -

    <%= notice %>

    - -

    Documentos

    - -
    - <% @documentos.each do |documento| %> - <%= render documento %> -

    - <%= link_to "Show this documento", documento %> -

    - <% end %> -
    - -<%= link_to "New documento", new_documento_path %> diff --git a/backend/app/views/documentos/index.json.jbuilder b/backend/app/views/documentos/index.json.jbuilder deleted file mode 100644 index d4cdd72..0000000 --- a/backend/app/views/documentos/index.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.array! @documentos, partial: "documentos/documento", as: :documento diff --git a/backend/app/views/documentos/new.html.erb b/backend/app/views/documentos/new.html.erb deleted file mode 100644 index 818d357..0000000 --- a/backend/app/views/documentos/new.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -

    New documento

    - -<%= render "form", documento: @documento %> - -
    - -
    - <%= link_to "Back to documentos", documentos_path %> -
    diff --git a/backend/app/views/documentos/show.html.erb b/backend/app/views/documentos/show.html.erb deleted file mode 100644 index 8d8f775..0000000 --- a/backend/app/views/documentos/show.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -

    <%= notice %>

    - -<%= render @documento %> - -
    - <%= link_to "Edit this documento", edit_documento_path(@documento) %> | - <%= link_to "Back to documentos", documentos_path %> - - <%= button_to "Destroy this documento", @documento, method: :delete %> -
    diff --git a/backend/app/views/documentos/show.json.jbuilder b/backend/app/views/documentos/show.json.jbuilder deleted file mode 100644 index 2c1e7a9..0000000 --- a/backend/app/views/documentos/show.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.partial! "documentos/documento", documento: @documento diff --git a/backend/app/views/eventos/_evento.html.erb b/backend/app/views/eventos/_evento.html.erb deleted file mode 100644 index 06ca1fc..0000000 --- a/backend/app/views/eventos/_evento.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -
    -
    diff --git a/backend/app/views/eventos/_evento.json.jbuilder b/backend/app/views/eventos/_evento.json.jbuilder deleted file mode 100644 index 502d58e..0000000 --- a/backend/app/views/eventos/_evento.json.jbuilder +++ /dev/null @@ -1,2 +0,0 @@ -json.extract! evento, :id, :created_at, :updated_at -json.url evento_url(evento, format: :json) diff --git a/backend/app/views/eventos/_form.html.erb b/backend/app/views/eventos/_form.html.erb deleted file mode 100644 index 66bad15..0000000 --- a/backend/app/views/eventos/_form.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -<%= form_with(model: evento) do |form| %> - <% if evento.errors.any? %> -
    -

    <%= pluralize(evento.errors.count, "error") %> prohibited this evento from being saved:

    - -
      - <% evento.errors.each do |error| %> -
    • <%= error.full_message %>
    • - <% end %> -
    -
    - <% end %> - -
    - <%= form.submit %> -
    -<% end %> diff --git a/backend/app/views/eventos/edit.html.erb b/backend/app/views/eventos/edit.html.erb deleted file mode 100644 index 5d9ebf5..0000000 --- a/backend/app/views/eventos/edit.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -

    Editing evento

    - -<%= render "form", evento: @evento %> - -
    - -
    - <%= link_to "Show this evento", @evento %> | - <%= link_to "Back to eventos", eventos_path %> -
    diff --git a/backend/app/views/eventos/index.html.erb b/backend/app/views/eventos/index.html.erb deleted file mode 100644 index f47eb03..0000000 --- a/backend/app/views/eventos/index.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -

    <%= notice %>

    - -

    Eventos

    - -
    - <% @eventos.each do |evento| %> - <%= render evento %> -

    - <%= link_to "Show this evento", evento %> -

    - <% end %> -
    - -<%= link_to "New evento", new_evento_path %> diff --git a/backend/app/views/eventos/index.json.jbuilder b/backend/app/views/eventos/index.json.jbuilder deleted file mode 100644 index 9beb53d..0000000 --- a/backend/app/views/eventos/index.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.array! @eventos, partial: "eventos/evento", as: :evento diff --git a/backend/app/views/eventos/new.html.erb b/backend/app/views/eventos/new.html.erb deleted file mode 100644 index afe563f..0000000 --- a/backend/app/views/eventos/new.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -

    New evento

    - -<%= render "form", evento: @evento %> - -
    - -
    - <%= link_to "Back to eventos", eventos_path %> -
    diff --git a/backend/app/views/eventos/show.html.erb b/backend/app/views/eventos/show.html.erb deleted file mode 100644 index a9211d0..0000000 --- a/backend/app/views/eventos/show.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -

    <%= notice %>

    - -<%= render @evento %> - -
    - <%= link_to "Edit this evento", edit_evento_path(@evento) %> | - <%= link_to "Back to eventos", eventos_path %> - - <%= button_to "Destroy this evento", @evento, method: :delete %> -
    diff --git a/backend/app/views/eventos/show.json.jbuilder b/backend/app/views/eventos/show.json.jbuilder deleted file mode 100644 index ac52af6..0000000 --- a/backend/app/views/eventos/show.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.partial! "eventos/evento", evento: @evento diff --git a/backend/app/views/reuniaos/_form.html.erb b/backend/app/views/reuniaos/_form.html.erb deleted file mode 100644 index fffebc3..0000000 --- a/backend/app/views/reuniaos/_form.html.erb +++ /dev/null @@ -1,32 +0,0 @@ -<%= form_with(model: reuniao) do |form| %> - <% if reuniao.errors.any? %> -
    -

    <%= pluralize(reuniao.errors.count, "error") %> prohibited this reuniao from being saved:

    - -
      - <% reuniao.errors.each do |error| %> -
    • <%= error.full_message %>
    • - <% end %> -
    -
    - <% end %> - -
    - <%= form.label :nome, style: "display: block" %> - <%= form.text_field :nome %> -
    - -
    - <%= form.label :link, style: "display: block" %> - <%= form.text_field :link %> -
    - -
    - <%= form.label :user_id, style: "display: block" %> - <%= form.text_field :user_id %> -
    - -
    - <%= form.submit %> -
    -<% end %> diff --git a/backend/app/views/reuniaos/_reuniao.html.erb b/backend/app/views/reuniaos/_reuniao.html.erb deleted file mode 100644 index 6fc7a9e..0000000 --- a/backend/app/views/reuniaos/_reuniao.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -
    -

    - Nome: - <%= reuniao.nome %> -

    - -

    - Link: - <%= reuniao.link %> -

    - -

    - User: - <%= reuniao.user_id %> -

    - -
    diff --git a/backend/app/views/reuniaos/_reuniao.json.jbuilder b/backend/app/views/reuniaos/_reuniao.json.jbuilder deleted file mode 100644 index 021fc05..0000000 --- a/backend/app/views/reuniaos/_reuniao.json.jbuilder +++ /dev/null @@ -1,2 +0,0 @@ -json.extract! reuniao, :id, :nome, :link, :user_id, :created_at, :updated_at -json.url reuniao_url(reuniao, format: :json) diff --git a/backend/app/views/reuniaos/edit.html.erb b/backend/app/views/reuniaos/edit.html.erb deleted file mode 100644 index a273b2b..0000000 --- a/backend/app/views/reuniaos/edit.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -

    Editing reuniao

    - -<%= render "form", reuniao: @reuniao %> - -
    - -
    - <%= link_to "Show this reuniao", @reuniao %> | - <%= link_to "Back to reuniaos", reuniaos_path %> -
    diff --git a/backend/app/views/reuniaos/index.html.erb b/backend/app/views/reuniaos/index.html.erb deleted file mode 100644 index 9d661b6..0000000 --- a/backend/app/views/reuniaos/index.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -

    <%= notice %>

    - -

    Reuniaos

    - -
    - <% @reuniaos.each do |reuniao| %> - <%= render reuniao %> -

    - <%= link_to "Show this reuniao", reuniao %> -

    - <% end %> -
    - -<%= link_to "New reuniao", new_reuniao_path %> diff --git a/backend/app/views/reuniaos/index.json.jbuilder b/backend/app/views/reuniaos/index.json.jbuilder deleted file mode 100644 index 2214399..0000000 --- a/backend/app/views/reuniaos/index.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.array! @reuniaos, partial: "reuniaos/reuniao", as: :reuniao diff --git a/backend/app/views/reuniaos/new.html.erb b/backend/app/views/reuniaos/new.html.erb deleted file mode 100644 index d61c0ba..0000000 --- a/backend/app/views/reuniaos/new.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -

    New reuniao

    - -<%= render "form", reuniao: @reuniao %> - -
    - -
    - <%= link_to "Back to reuniaos", reuniaos_path %> -
    diff --git a/backend/app/views/reuniaos/show.html.erb b/backend/app/views/reuniaos/show.html.erb deleted file mode 100644 index 2916365..0000000 --- a/backend/app/views/reuniaos/show.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -

    <%= notice %>

    - -<%= render @reuniao %> - -
    - <%= link_to "Edit this reuniao", edit_reuniao_path(@reuniao) %> | - <%= link_to "Back to reuniaos", reuniaos_path %> - - <%= button_to "Destroy this reuniao", @reuniao, method: :delete %> -
    diff --git a/backend/app/views/reuniaos/show.json.jbuilder b/backend/app/views/reuniaos/show.json.jbuilder deleted file mode 100644 index a287548..0000000 --- a/backend/app/views/reuniaos/show.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.partial! "reuniaos/reuniao", reuniao: @reuniao diff --git a/backend/app/views/storages/_form.html.erb b/backend/app/views/storages/_form.html.erb deleted file mode 100644 index 8ca282d..0000000 --- a/backend/app/views/storages/_form.html.erb +++ /dev/null @@ -1,37 +0,0 @@ -<%= form_with(model: storage) do |form| %> - <% if storage.errors.any? %> -
    -

    <%= pluralize(storage.errors.count, "error") %> prohibited this storage from being saved:

    - -
      - <% storage.errors.each do |error| %> -
    • <%= error.full_message %>
    • - <% end %> -
    -
    - <% end %> - -
    - <%= form.label :nome, style: "display: block" %> - <%= form.text_field :nome %> -
    - -
    - <%= form.label :quantidade, style: "display: block" %> - <%= form.number_field :quantidade %> -
    - -
    - <%= form.label :status, style: "display: block" %> - <%= form.text_field :status %> -
    - -
    - <%= form.label :user_id, style: "display: block" %> - <%= form.text_field :user_id %> -
    - -
    - <%= form.submit %> -
    -<% end %> diff --git a/backend/app/views/storages/_storage.html.erb b/backend/app/views/storages/_storage.html.erb deleted file mode 100644 index 8b1963b..0000000 --- a/backend/app/views/storages/_storage.html.erb +++ /dev/null @@ -1,22 +0,0 @@ -
    -

    - Nome: - <%= storage.nome %> -

    - -

    - Quantidade: - <%= storage.quantidade %> -

    - -

    - Status: - <%= storage.status %> -

    - -

    - User: - <%= storage.user_id %> -

    - -
    diff --git a/backend/app/views/storages/_storage.json.jbuilder b/backend/app/views/storages/_storage.json.jbuilder deleted file mode 100644 index afe18c9..0000000 --- a/backend/app/views/storages/_storage.json.jbuilder +++ /dev/null @@ -1,2 +0,0 @@ -json.extract! storage, :id, :nome, :quantidade, :status, :user_id, :created_at, :updated_at -json.url storage_url(storage, format: :json) diff --git a/backend/app/views/storages/edit.html.erb b/backend/app/views/storages/edit.html.erb deleted file mode 100644 index efa6f3e..0000000 --- a/backend/app/views/storages/edit.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -

    Editing storage

    - -<%= render "form", storage: @storage %> - -
    - -
    - <%= link_to "Show this storage", @storage %> | - <%= link_to "Back to storages", storages_path %> -
    diff --git a/backend/app/views/storages/index.html.erb b/backend/app/views/storages/index.html.erb deleted file mode 100644 index 0f50bca..0000000 --- a/backend/app/views/storages/index.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -

    <%= notice %>

    - -

    Storages

    - -
    - <% @storages.each do |storage| %> - <%= render storage %> -

    - <%= link_to "Show this storage", storage %> -

    - <% end %> -
    - -<%= link_to "New storage", new_storage_path %> diff --git a/backend/app/views/storages/index.json.jbuilder b/backend/app/views/storages/index.json.jbuilder deleted file mode 100644 index 88c9f8b..0000000 --- a/backend/app/views/storages/index.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.array! @storages, partial: "storages/storage", as: :storage diff --git a/backend/app/views/storages/new.html.erb b/backend/app/views/storages/new.html.erb deleted file mode 100644 index ec8e147..0000000 --- a/backend/app/views/storages/new.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -

    New storage

    - -<%= render "form", storage: @storage %> - -
    - -
    - <%= link_to "Back to storages", storages_path %> -
    diff --git a/backend/app/views/storages/show.html.erb b/backend/app/views/storages/show.html.erb deleted file mode 100644 index 1d8bdc7..0000000 --- a/backend/app/views/storages/show.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -

    <%= notice %>

    - -<%= render @storage %> - -
    - <%= link_to "Edit this storage", edit_storage_path(@storage) %> | - <%= link_to "Back to storages", storages_path %> - - <%= button_to "Destroy this storage", @storage, method: :delete %> -
    diff --git a/backend/app/views/storages/show.json.jbuilder b/backend/app/views/storages/show.json.jbuilder deleted file mode 100644 index d04dfce..0000000 --- a/backend/app/views/storages/show.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.partial! "storages/storage", storage: @storage diff --git a/backend/config/routes.rb b/backend/config/routes.rb index dde3c58..b8caa1b 100644 --- a/backend/config/routes.rb +++ b/backend/config/routes.rb @@ -1,4 +1,5 @@ Rails.application.routes.draw do + resources :acessos resources :storages resources :eventos resources :reuniaos @@ -14,7 +15,6 @@ resources :tarefas resources :acaos - resources :cargos resources :users # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html diff --git a/backend/db/migrate/20240521013906_create_cargos.rb b/backend/db/migrate/20240521013906_create_cargos.rb deleted file mode 100644 index 35b0f84..0000000 --- a/backend/db/migrate/20240521013906_create_cargos.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateCargos < ActiveRecord::Migration[7.1] - def change - create_table :cargos do |t| - t.string :nome - - t.timestamps - end - end -end diff --git a/backend/db/migrate/20240521013908_create_users.rb b/backend/db/migrate/20240521013908_create_users.rb index 1de544d..f1dd88e 100644 --- a/backend/db/migrate/20240521013908_create_users.rb +++ b/backend/db/migrate/20240521013908_create_users.rb @@ -5,7 +5,6 @@ def change t.string :matricula t.string :email t.string :senha - t.references :cargo, null: false, foreign_key: true t.timestamps end diff --git a/backend/db/migrate/20240615232147_create_acessos.rb b/backend/db/migrate/20240615232147_create_acessos.rb new file mode 100644 index 0000000..063df81 --- /dev/null +++ b/backend/db/migrate/20240615232147_create_acessos.rb @@ -0,0 +1,14 @@ +class CreateAcessos < ActiveRecord::Migration[7.1] + def change + create_table :acessos do |t| + t.references :user, null: false, foreign_key: true + t.boolean :acesso_documents, default: false + t.boolean :acesso_meetings, default: false + t.boolean :acesso_calendar, default: false + t.boolean :acesso_finance, default: false + t.boolean :acesso_admin, default: false + + t.timestamps + end + end +end diff --git a/backend/db/schema.rb b/backend/db/schema.rb index f167cf5..dfe0a6f 100644 --- a/backend/db/schema.rb +++ b/backend/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2024_06_14_215105) do +ActiveRecord::Schema[7.1].define(version: 2024_06_15_232147) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -25,10 +25,16 @@ t.index ["user_id"], name: "index_acaos_on_user_id" end - create_table "cargos", force: :cascade do |t| - t.string "nome" + create_table "acessos", force: :cascade do |t| + t.bigint "user_id", null: false + t.boolean "acesso_documents", default: false + t.boolean "acesso_meetings", default: false + t.boolean "acesso_calendar", default: false + t.boolean "acesso_finance", default: false + t.boolean "acesso_admin", default: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["user_id"], name: "index_acessos_on_user_id" end create_table "documentos", force: :cascade do |t| @@ -95,13 +101,12 @@ t.string "matricula" t.string "email" t.string "senha" - t.bigint "cargo_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.index ["cargo_id"], name: "index_users_on_cargo_id" end add_foreign_key "acaos", "users" + add_foreign_key "acessos", "users" add_foreign_key "documentos", "users" add_foreign_key "eventos", "users" add_foreign_key "reuniaos", "users" @@ -109,5 +114,4 @@ add_foreign_key "reunioes_usuarios", "users" add_foreign_key "storages", "users" add_foreign_key "tarefas", "users" - add_foreign_key "users", "cargos" end diff --git a/backend/db/seeds.rb b/backend/db/seeds.rb index a100880..7a51f1b 100644 --- a/backend/db/seeds.rb +++ b/backend/db/seeds.rb @@ -8,8 +8,37 @@ # MovieGenre.find_or_create_by!(name: genre_name) # end -["Admin", "Membro"].each do |cargo| - Cargo.find_or_create_by!(nome: cargo) -end -cargoAdmin = Cargo.find_by!(nome: "Admin") -User.find_or_create_by!(nome: :admin, matricula: "000000000", email: "teste@aluno.unb.br", senha: BCrypt::Password.create('senha123'), cargo: cargoAdmin) \ No newline at end of file +def find_or_create_user_with_access(user_data) + hashed_password = BCrypt::Password.create(user_data[:senha]) + + user = User.find_or_create_by!(nome: user_data[:nome], matricula: user_data[:matricula]) do |u| + u.email = user_data[:email] + u.senha = hashed_password + end + + user.update(email: user_data[:email], senha: hashed_password) unless user.new_record? + + user.create_acesso(user_data[:acesso]) unless user.acesso.present? + user.acesso.update(user_data[:acesso]) if user.acesso.present? + + user.save! + end + + users = [ + { + nome: 'admin', + matricula: '000000000', + email: 'teste@aluno.unb.br', + senha: 'senha123', + acesso: { + acesso_documents: true, + acesso_meetings: true, + acesso_calendar: true, + acesso_finance: true, + acesso_admin: true + } + } + ] + users.each { |user_data| find_or_create_user_with_access(user_data) } + + puts "Seeded #{User.count} users and #{Acesso.count} access records." \ No newline at end of file diff --git a/backend/test/controllers/cargos_controller_test.rb b/backend/test/controllers/cargos_controller_test.rb deleted file mode 100644 index 70f2ea2..0000000 --- a/backend/test/controllers/cargos_controller_test.rb +++ /dev/null @@ -1,48 +0,0 @@ -require "test_helper" - -class CargosControllerTest < ActionDispatch::IntegrationTest - setup do - @cargo = cargos(:one) - end - - test "should get index" do - get cargos_url - assert_response :success - end - - test "should get new" do - get new_cargo_url - assert_response :success - end - - test "should create cargo" do - assert_difference("Cargo.count") do - post cargos_url, params: { cargo: { nome: @cargo.nome } } - end - - assert_redirected_to cargo_url(Cargo.last) - end - - test "should show cargo" do - get cargo_url(@cargo) - assert_response :success - end - - test "should get edit" do - get edit_cargo_url(@cargo) - assert_response :success - end - - test "should update cargo" do - patch cargo_url(@cargo), params: { cargo: { nome: @cargo.nome } } - assert_redirected_to cargo_url(@cargo) - end - - test "should destroy cargo" do - assert_difference("Cargo.count", -1) do - delete cargo_url(@cargo) - end - - assert_redirected_to cargos_url - end -end diff --git a/backend/test/controllers/users_controller_test.rb b/backend/test/controllers/users_controller_test.rb index 399ad00..0321dd6 100644 --- a/backend/test/controllers/users_controller_test.rb +++ b/backend/test/controllers/users_controller_test.rb @@ -17,7 +17,7 @@ class UsersControllerTest < ActionDispatch::IntegrationTest test "should create user" do assert_difference("User.count") do - post users_url, params: { user: { cargo_id: @user.cargo_id, email: @user.email, matricula: @user.matricula, nome: @user.nome, senha: @user.senha } } + post users_url, params: { user: { email: @user.email, matricula: @user.matricula, nome: @user.nome, senha: @user.senha } } end assert_redirected_to user_url(User.last) @@ -34,7 +34,7 @@ class UsersControllerTest < ActionDispatch::IntegrationTest end test "should update user" do - patch user_url(@user), params: { user: { cargo_id: @user.cargo_id, email: @user.email, matricula: @user.matricula, nome: @user.nome, senha: @user.senha } } + patch user_url(@user), params: { user: {email: @user.email, matricula: @user.matricula, nome: @user.nome, senha: @user.senha } } assert_redirected_to user_url(@user) end diff --git a/backend/test/fixtures/accessos.yml b/backend/test/fixtures/accessos.yml new file mode 100644 index 0000000..c235692 --- /dev/null +++ b/backend/test/fixtures/accessos.yml @@ -0,0 +1,17 @@ +# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + user: one + acesso_documents: false + acesso_meetings: false + acesso_calendar: false + acesso_finance: false + acesso_admin: false + +two: + user: two + acesso_documents: false + acesso_meetings: false + acesso_calendar: false + acesso_finance: false + acesso_admin: false diff --git a/backend/test/models/cargo_test.rb b/backend/test/models/accesso_test.rb similarity index 63% rename from backend/test/models/cargo_test.rb rename to backend/test/models/accesso_test.rb index 8cd33d0..8b38b1b 100644 --- a/backend/test/models/cargo_test.rb +++ b/backend/test/models/accesso_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class CargoTest < ActiveSupport::TestCase +class AccessoTest < ActiveSupport::TestCase # test "the truth" do # assert true # end diff --git a/backend/test/system/users_test.rb b/backend/test/system/users_test.rb index 5de1214..d8eaf7b 100644 --- a/backend/test/system/users_test.rb +++ b/backend/test/system/users_test.rb @@ -14,7 +14,6 @@ class UsersTest < ApplicationSystemTestCase visit users_url click_on "New user" - fill_in "Cargo", with: @user.cargo_id fill_in "Email", with: @user.email fill_in "Matricula", with: @user.matricula fill_in "Nome", with: @user.nome @@ -29,7 +28,6 @@ class UsersTest < ApplicationSystemTestCase visit user_url(@user) click_on "Edit this user", match: :first - fill_in "Cargo", with: @user.cargo_id fill_in "Email", with: @user.email fill_in "Matricula", with: @user.matricula fill_in "Nome", with: @user.nome diff --git a/view/src/pages/CreateAccount/index.jsx b/view/src/pages/CreateAccount/index.jsx index 86adf9c..75898ea 100644 --- a/view/src/pages/CreateAccount/index.jsx +++ b/view/src/pages/CreateAccount/index.jsx @@ -9,7 +9,6 @@ function CreateAccount() { const [registration, setRegistration] = useState(); const [password, setPassword] = useState(); const [confirmPassword, setConfirmPassword] = useState(); - const [role, setRole] = useState(); // Novo estado para armazenar a função do usuário const [errors, setErrors] = useState({ name: '', email: '', @@ -55,10 +54,6 @@ function CreateAccount() { } }; - const handleRoleChange = (e) => { // Função para lidar com a mudança de opção na dropbox - setRole(e.target.value); - }; - const newUser = async (userData) => { try { await createUser(userData) @@ -79,13 +74,12 @@ function CreateAccount() { "matricula": registration, "email": email, "senha": password, - "cargo_id": role }) }; return ( <> - +
    seta @@ -128,17 +122,10 @@ function CreateAccount() { onChange={handleConfirmPasswordChange} /> {errors.password && {errors.password}} - {/* Dropdown para selecionar o cargo */} -
    - +
    ); } diff --git a/view/src/pages/Detail/index.jsx b/view/src/pages/Detail/index.jsx index 741f265..de2063c 100644 --- a/view/src/pages/Detail/index.jsx +++ b/view/src/pages/Detail/index.jsx @@ -3,20 +3,20 @@ import { useParams } from 'react-router-dom'; import './Detail.css'; import SideBar from '../../components/SideBar'; import { editPassword } from '../../queries/user'; -import Cookies from 'universal-cookie'; +// import Cookies from 'universal-cookie'; import axios from 'axios' function Detail() { - const { usuario, matricula, nome, cargo } = useParams(); + const { usuario, matricula, nome} = useParams(); const [mostrarPopup, setMostrarPopup] = useState(false); const [novaSenha, setNovaSenha] = useState(''); const [confirmarSenha, setConfirmarSenha] = useState(''); const [senhaMatch, setSenhaMatch] = useState(true); - const cookies = new Cookies(); + //const cookies = new Cookies(); - const token = cookies.get('jwtToken'); + //const token = cookies.get('jwtToken'); axios.post("http://localhost:3000/users/token",{ - token: token + // token: token }).then(function (response){ console.log(response.data); }); @@ -79,7 +79,6 @@ function Detail() {
    Matrícula: {matricula}
    - Cargo: {cargo}

    diff --git a/view/src/pages/Login/index.jsx b/view/src/pages/Login/index.jsx index a16afdb..ca5cb6a 100644 --- a/view/src/pages/Login/index.jsx +++ b/view/src/pages/Login/index.jsx @@ -1,13 +1,13 @@ -import React, { useState } from 'react'; +import { useState } from 'react'; import './Login.css'; import { Link, Navigate } from 'react-router-dom'; import axios from 'axios' -import Cookies from 'universal-cookie'; +// import Cookies from 'universal-cookie'; function Login() { const [matricula, setMatricula] = useState(''); const [senha, setSenha] = useState(''); - const cookies = new Cookies(); + //const cookies = new Cookies(null, server); const handleMatriculaChange = (event) => { const { value } = event.target; // Checa se o valor esta vazio ou se sao apenas numeros @@ -32,11 +32,11 @@ function Login() { senha: senha }).then(function (response) { console.log(response.data); - cookies.set('jwtToken', response.data, { + /* cookies.set('jwtToken', response.data, { path: '/', secure: true, sameSite: 'None' - }); + }); */ }).catch(function (error) { console.log(error);