Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lista de Acessos Gerais #28

Merged
merged 6 commits into from
Oct 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions front-end/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ import EditTodoDirec from "./components/direcedit-access";
import ListaPorteiro from "./components/lista-acessos-porteiro";
import logo from "./logo.png";


import AcessosGerais from "./listaAcessos";

class App extends Component {
render() {
return (
Expand All @@ -44,6 +47,11 @@ class App extends Component {
<Route path="/listaportaria" component={ListaPorteiro} />
<Route path="/criaracesso" component={CriarAcesso} />
<Route path="/acessosaceitos" component={AcessosAceitos} />

<Route path="/acessosrejeitados" component={AcessosRejeitados} />
<Route path="/acessosgerais" component={AcessosGerais} />


<Route path="/acessosrejeitados" component={AcessosRejeitados} />

</div>
Expand Down
159 changes: 159 additions & 0 deletions front-end/src/listaAcessos.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@

import React, {useEffect, useState} from 'react';
import ReactDOM from 'react-dom';
import 'antd/dist/antd.css';
import './index.css';
import { Table, Divider, Tag } from 'antd';

import axios from 'axios';
import { Button, notification, Icon } from 'antd';

const columns = [
{
title: 'Descrição',
dataIndex: 'todo_description',
key: 'todo_description',
},
{
title: 'Responsável',
dataIndex: 'todo_responsible',
key: 'todo_responsible',
render: text => <a>{text}</a>,
},
{
title: 'Prioridade',
key: 'todo_priority',
dataIndex: 'todo_priority',
render: tags => (
<span>
{tags.map(tag => {
let color = 'volcano';
if (!tag.localeCompare("alta")) {
color = 'magenta';
}
if (!tag.localeCompare("média")) {
color = 'gold';
}
if (!tag.localeCompare("baixa")) {
color = 'cyan';
}
return (
<Tag color={color} key={tag}>
{tag.toUpperCase()}
</Tag>
);
})}
</span>
),
},
{
title: 'Data',
dataIndex: 'todo_date',
key: 'todo_date',
},
{
title: 'Horário',
dataIndex: 'todo_horario',
key: 'todo_horario',
},
{
title: 'Sala',
dataIndex: 'todo_room',
key: 'todo_room',
},
{
title: 'Status',
key: 'tags',
dataIndex: 'tags',
render: tags => (
<span>
{tags.map(tag => {
let color = 'volcano';
if (!tag.localeCompare("rejeitado")) {
color = 'red';
}
if (!tag.localeCompare("aceito")) {
color = 'green';
}
if (!tag.localeCompare("solicitado")) {
color = 'orange';
}
return (
<Tag color={color} key={tag}>
{tag.toUpperCase()}
</Tag>
);
})}
</span>
),
},
];

/*
//insere fake data para visualização
const data = [
{
key: '1',
todo_description: 'John Brown estudar',
todo_responsible: 'Joe Black',
todo_priority: ['média'],
todo_date: '30/09/19',
todo_horario: '16:55',
todo_room: 'B005',
tags: ['solicitado'],
},
{
key: '2',
todo_description: 'Milenia Blank projeto',
todo_responsible: 'Sidney Lake',
todo_priority: ['alta'],
todo_date: '28/09/19',
todo_horario: '14:25',
todo_room: 'C102',
tags: ['aceito'],
},
{
key: '3',
todo_description: 'Joseph River balbúrdia',
todo_responsible: 'Sidney Lake',
todo_priority: ['baixa'],
todo_date: '24/09/19',
todo_horario: '18:32',
todo_room: 'H107',
tags: ['rejeitado'],
},
];
*/


export default function listaAcessos() {
const[acessos, setAcessos] = useState('');

useEffect(
() => {
axios.get('http://localhost:4000/geral/')
.then(response => {
setAcessos(response);
})
.catch( (error) => {
console.log(error);
notification.open({
message: 'Atenção!',
description:
'Algo deu errado!',
icon: <Icon type="meh" style={{ color: '#108ee9' }} />,
});
})
},
[]
)

return (
<div>
<Table columns={columns} dataSource={data} />
</div>
)
}

//ReactDOM.render(<Table columns={columns} dataSource={data} />, document.getElementById('container'));

62 changes: 51 additions & 11 deletions front-end/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1039,9 +1039,9 @@
"@types/react" "*"

"@types/react@*":
version "16.9.11"
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.9.11.tgz#70e0b7ad79058a7842f25ccf2999807076ada120"
integrity sha512-UBT4GZ3PokTXSWmdgC/GeCGEJXE5ofWyibCcecRLUVN2ZBpXQGVgQGtG2foS7CrTKFKlQVVswLvf7Js6XA/CVQ==
version "16.9.4"
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.9.4.tgz#de8cf5e5e2838659fb78fa93181078469eeb19fc"
integrity sha512-ItGNmJvQ0IvWt8rbk5PLdpdQhvBVxAaXI9hDlx7UMd8Ie1iMIuwMNiKeTfmVN517CdplpyXvA22X4zm4jGGZnw==
dependencies:
"@types/prop-types" "*"
csstype "^2.2.0"
Expand Down Expand Up @@ -1359,6 +1359,7 @@ antd@^3.19.2:
version "3.24.3"
resolved "https://registry.yarnpkg.com/antd/-/antd-3.24.3.tgz#103e31a1a287166566db9ea16450588314367265"
integrity sha512-yr4kV8lUdYNCOj5+TjIufLGYF0naTfNiAJV0JWqh9RzRGapGVES928K/2gyF7Ow3da6ZlsgxtO1P25exbvDlSw==

dependencies:
"@ant-design/create-react-context" "^0.2.4"
"@ant-design/icons" "~2.1.1"
Expand Down Expand Up @@ -4886,6 +4887,18 @@ hoist-non-react-statics@^3.3.0:
dependencies:
react-is "^16.7.0"

hoist-non-react-statics@^2.3.1, hoist-non-react-statics@^2.5.0:
version "2.5.5"
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz#c5903cf409c0dfd908f388e619d86b9c1174cb47"
integrity sha512-rqcy4pJo55FTTLWt+bU8ukscqHeE/e9KWvsOW2b/a3afxQZhwkQdT1rPPCJ0rYXdj4vNcasY8zHTH+jF/qStxw==

hoist-non-react-statics@^3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.0.tgz#b09178f0122184fb95acf525daaecb4d8f45958b"
integrity sha512-0XsbTXxgiaCDYDIWFcwkmerZPSwywfUqYmwT4jzewKTQSWoE6FCMoUVOeBJWK3E/CrWbxRG3m5GzY4lnIwGRBA==
dependencies:
react-is "^16.7.0"

home-or-tmp@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8"
Expand Down Expand Up @@ -5351,6 +5364,7 @@ is-buffer@^2.0.2:
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.4.tgz#3e572f23c8411a5cfd9557c849e3665e0b290623"
integrity sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==


is-callable@^1.1.4:
version "1.1.4"
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75"
Expand Down Expand Up @@ -5664,6 +5678,22 @@ isomorphic-fetch@^2.1.1:
node-fetch "^1.0.1"
whatwg-fetch ">=0.10.0"


isomorphic-fetch@^2.1.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9"
integrity sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=
dependencies:
node-fetch "^1.0.1"
whatwg-fetch ">=0.10.0"

isomorphic-fetch@^2.1.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9"
integrity sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=
dependencies:
node-fetch "^1.0.1"
whatwg-fetch ">=0.10.0"
isstream@~0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"
Expand Down Expand Up @@ -6576,12 +6606,27 @@ lodash.throttle@^4.0.0:
resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4"
integrity sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ=


lodash.throttle@^4.0.0:
version "4.1.1"
resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4"
integrity sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ=

lodash.throttle@^4.0.0:
version "4.1.1"
resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4"
integrity sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ=
lodash.uniq@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=

"lodash@>=3.5 <5", lodash@^4.0.0, lodash@^4.16.5, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.4, lodash@^4.17.5, lodash@~4.17.10:
"lodash@>=3.5 <5", lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.4, lodash@^4.17.5:
version "4.17.11"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"


lodash@^4.16.5, lodash@^4.17.13:
version "4.17.15"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==
Expand Down Expand Up @@ -8988,7 +9033,6 @@ rc-resize-observer@^0.1.0:
classnames "^2.2.1"
rc-util "^4.11.1"
resize-observer-polyfill "^1.5.1"

rc-select@~9.2.0:
version "9.2.1"
resolved "https://registry.yarnpkg.com/rc-select/-/rc-select-9.2.1.tgz#0fbf47a933c36e1e6ef76c88fab32f58029e6a01"
Expand Down Expand Up @@ -9359,7 +9403,7 @@ react-slick@~0.25.2:
lodash.debounce "^4.0.8"
resize-observer-polyfill "^1.5.0"

react@^16.6.3:
react@^16.6.3
version "16.11.0"
resolved "https://registry.yarnpkg.com/react/-/react-16.11.0.tgz#d294545fe62299ccee83363599bf904e4a07fdbb"
integrity sha512-M5Y8yITaLmU0ynd0r1Yvfq98Rmll6q8AxaEe88c8e7LxO8fZ2cNgmFt0aGAS9wzf1Ao32NKXtCl+/tVVtkxq6g==
Expand Down Expand Up @@ -9923,11 +9967,7 @@ selfsigned@^1.9.1:
version "5.7.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==

semver@^6.1.2, semver@^6.3.0:
version "6.3.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
r

semver@~5.3.0:
version "5.3.0"
Expand Down