Skip to content

Commit

Permalink
chore: merges branch 'devel' into 169-buscar-usuario-pelo-email-registro
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasvmx committed Nov 8, 2021
2 parents ac49e68 + 3868708 commit e24e4aa
Show file tree
Hide file tree
Showing 35 changed files with 1,514 additions and 99 deletions.
1 change: 1 addition & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ sonar.projectKey=fga-eps-mds_2021-1-PC-GO-Frontend

sonar.language=js

sonar.sources=./src
sonar.javascript.lcov.reportPaths=./coverage/lcov.info
sonar.testExecutionReportPaths=./test-report.xml
sonar.sourceEncoding=UTF-8
25 changes: 25 additions & 0 deletions src/Components/Departments/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from "react";
import PocketDepartment from "../PocketDepartment";
import { StyledListGroup } from "./style";

const Departments = ({ departments, searchTerm }) => {
return (
<StyledListGroup>
{departments
.filter((val) => {
if (val === "") {
return val;
} else if (
val.name.toLowerCase().includes(searchTerm.toLowerCase())
) {
return val;
}
})
.map((post) => (
<PocketDepartment key={post.id} name={post.name} />
))}
</StyledListGroup>
);
};

export default Departments;
52 changes: 52 additions & 0 deletions src/Components/Departments/style.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import styled from "styled-components";

export const StyledListGroup = styled.ul`
display: contents;
list-style-type: none;
`;
export const StyledListGroupItem = styled.li``;

export const styles = {};

export const StyledBigDiv = styled.div`
width: 100%;
height: 5rem;
border-radius: 15px;
background: #ffffff;
border: 2px solid #000000;
display: inline-block;
align-items: center;
.registerNumber {
width: 16%;
}
.city {
width: 15%;
}
.state {
width: 7%;
}
.requester {
width: 18%;
}
.inclusionDate {
width: 12%;
}
.seiNumber {
width: 15%;
}
.tag {
width: 10%;
}
.extra {
width: 7%;
padding-left: 1.8rem;
}
button {
border: none;
background: transparent;
cursor: pointer;
font-family: Montserrat;
font-style: normal;
font-size: 26px;
}
`;
31 changes: 22 additions & 9 deletions src/Components/Fields/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,32 @@ import React, { useState } from "react";
import PocketFields from "../PocketFields";
import { StyledListGroup } from "./style";

const Fields = ({ process }) => {
const Fields = ({ process, searchTerm }) => {
const [creator, setCreator] = useState("Padrão");

return (
<StyledListGroup>
{process.map((post) => (
<PocketFields
key={post.id}
name={post.name}
description={post.description}
creator={creator}
></PocketFields>
))}
{/* ADicionando lógica que filtra campos */}
{process
.filter((val) => {
if (searchTerm === "") {
return val;
} else if (
val.name.toLowerCase().includes(searchTerm.toLowerCase()) ||
val.description.toLowerCase().includes(searchTerm.toLowerCase())
) {
return val;
}
})
.map((post) => (
// Campo individual de campos
<PocketFields
key={post.id}
name={post.name}
description={post.description}
creator={creator}
></PocketFields>
))}
</StyledListGroup>
);
};
Expand Down
19 changes: 16 additions & 3 deletions src/Components/HeaderWithButtons/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useEffect, useState } from "react";
import {
AdminDiv,
Head,
StyledDropDown,
StyledHeaderImage,
Expand Down Expand Up @@ -52,6 +53,16 @@ const HeaderWithButtons = () => {
window.location.reload();
}

function handleSeeDepartment() {
history.push("/visualizar-departamentos");
window.location.reload();
}

function handleSeeSections() {
history.push("/visualizar-secoes");
window.location.reload();
}

function handleSeeAllUsers() {
history.push("/visualizar-usuarios");
window.location.reload();
Expand All @@ -68,7 +79,7 @@ const HeaderWithButtons = () => {
setName(user?.name);
}
} catch (err) {
console.log(err, "goldfish");
console.log("Erro ao carregar os dados do usuário!", err);
}
}

Expand All @@ -81,6 +92,7 @@ const HeaderWithButtons = () => {
<Head>
<StyledHeaderImage onClick={handleHomePage} src={Logo} />
<StyledOrganizeButtons>
{/* Buttons to redirect in web app */}
<StyledDropDown>
<button>Registros</button>
<div style={{ textAlign: "center" }}>
Expand All @@ -90,9 +102,10 @@ const HeaderWithButtons = () => {
</StyledDropDown>
<StyledDropDown>
<button>Administrador</button>
<div style={{ textAlign: "center" }}>
<div>
<button onClick={handleCreateUser}>Criar Usuário</button>
<button onClick={() => {}}>Criar Departamento</button>
<button onClick={handleSeeDepartment}>Ver Departamentos</button>
<button onClick={handleSeeSections}>Ver Seções</button>
<button onClick={() => {}}>Tag</button>
<button onClick={handleSeeAllFields}>Campos</button>
<button onClick={handleSeeAllUsers}>Listar Usuários</button>
Expand Down
7 changes: 4 additions & 3 deletions src/Components/HeaderWithButtons/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const StyledHeaderImage = styled.img`
`;

export const StyledOrganizeButtons = styled.div`
margin-right: 3rem;
margin-right: 5rem;
button {
color: ${colors.white};
font-style: normal;
Expand All @@ -30,7 +30,7 @@ export const StyledOrganizeButtons = styled.div`
text-align: center;
cursor: pointer;
margin: 0 0 0 40px;
margin: 0 20px;
}
`;

Expand Down Expand Up @@ -60,7 +60,8 @@ export const StyledDropDown = styled.div`
}
:hover {
div {
display: block;
display: flex;
flex-direction: column;
}
}
`;
11 changes: 11 additions & 0 deletions src/Components/PocketDepartment/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from "react";

import { StyledBigDiv } from "./styles";

const PocketDepartment = ({ name }) => (
<StyledBigDiv>
<button class="registerNumber">{name}</button>
</StyledBigDiv>
);

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

export const styles = {};

export const StyledBigDiv = styled.div`
width: 100%;
height: 5rem;
border-radius: 15px;
background: #ffffff;
border: 2px solid #000000;
display: inline-block;
align-items: center;
.registerNumber {
width: 100%;
}
button {
border: none;
background: transparent;
cursor: pointer;
font-family: Montserrat;
font-style: normal;
font-size: 26px;
}
`;
11 changes: 11 additions & 0 deletions src/Components/PocketSection/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from "react";
import { StyledBigDiv } from "./styles";

const PocketSection = ({ name }) => (
// Show all sections per name
<StyledBigDiv>
<button class="registerNumber">{name}</button>
</StyledBigDiv>
);

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

export const styles = {};

export const StyledBigDiv = styled.div`
width: 100%;
height: 5rem;
border-radius: 15px;
background: #ffffff;
border: 2px solid #000000;
display: inline-block;
align-items: center;
.registerNumber {
width: 100%;
}
button {
border: none;
background: transparent;
cursor: pointer;
font-family: Montserrat;
font-style: normal;
font-size: 26px;
}
`;
25 changes: 18 additions & 7 deletions src/Components/PocketUser/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
import React from "react";
import { StyledListGroup, StyledBigDiv, StyledText } from "./style";

const PocketUser = ({ user }) => {
const PocketUser = ({ user, searchTerm }) => {
return (
<StyledListGroup>
{user.map((singleUser) => (
<StyledBigDiv>
<StyledText>{singleUser.name}</StyledText>
<StyledText>{singleUser.email}</StyledText>
</StyledBigDiv>
))}
{user
.filter((val) => {
if (searchTerm === "") {
return val;
} else if (
val.name.toLowerCase().includes(searchTerm.toLowerCase()) ||
val.email.toLowerCase().includes(searchTerm.toLowerCase())
) {
return val;
}
})
.map((singleUser) => (
<StyledBigDiv>
<StyledText>{singleUser.name}</StyledText>
<StyledText>{singleUser.email}</StyledText>
</StyledBigDiv>
))}
</StyledListGroup>
);
};
Expand Down
49 changes: 33 additions & 16 deletions src/Components/Process/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import PocketDocument from "../PocketDocument";
import { StyledListGroup } from "./style";

const Process = ({ process }) => {
const Process = ({ process, searchTerm }) => {
const seiNumberLimit = (seiNumber) => {
if (seiNumber.length < 10) {
return seiNumber;
Expand All @@ -13,22 +13,39 @@ const Process = ({ process }) => {

return (
<StyledListGroup>
{process.map((post) => (
<PocketDocument
key={post.id}
registerNumber={
post.register_number === "" ? "-" : post.register_number
{process
.filter((val) => {
if (searchTerm === "") {
return val;
} else if (
val.state.toLowerCase().includes(searchTerm.toLowerCase()) ||
val.city.toLowerCase().includes(searchTerm.toLowerCase()) ||
val.document_date
.toLowerCase()
.includes(searchTerm.toLowerCase()) ||
val.requester.toLowerCase().includes(searchTerm.toLowerCase()) ||
val.sei_number.toLowerCase().includes(searchTerm.toLowerCase()) ||
val.register_number.toLowerCase().includes(searchTerm.toLowerCase())
) {
return val;
}
requester={post.requester === "" ? "-" : post.requester}
inclusionDate={post.document_date === "" ? "-" : post.document_date}
city={post.city === "" ? "-" : post.city}
state={post.state === "" ? "-" : post.state}
seiNumber={
post.sei_number === "" ? "-" : seiNumberLimit(post.sei_number)
}
registerId={post.id}
></PocketDocument>
))}
})
.map((post) => (
<PocketDocument
key={post.id}
registerNumber={
post.register_number === "" ? "-" : post.register_number
}
requester={post.requester === "" ? "-" : post.requester}
inclusionDate={post.document_date === "" ? "-" : post.document_date}
city={post.city === "" ? "-" : post.city}
state={post.state === "" ? "-" : post.state}
seiNumber={
post.sei_number === "" ? "-" : seiNumberLimit(post.sei_number)
}
registerId={post.id}
></PocketDocument>
))}
</StyledListGroup>
);
};
Expand Down
Loading

0 comments on commit e24e4aa

Please sign in to comment.