Skip to content

Commit

Permalink
Merge branch 'release/0.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
alcfernandes committed Apr 29, 2020
2 parents 63aefa0 + b1b283b commit 230fe59
Show file tree
Hide file tree
Showing 40 changed files with 1,465 additions and 525 deletions.
37 changes: 26 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,60 @@
# SME-PTRF-FrontEnd

========

Front da aplicação *SIG.Escola* da Secretaria de Educação da cidade de São Paulo.
Front da aplicação _SIG.Escola_ da Secretaria de Educação da cidade de São Paulo.

License: MIT

Versão: 0.1.0

Versão: 0.2.0

## Release Notes

### 0.2.0 - 28/04/2020 - Entregas da Sprint 3

- Confirmação de repasses pela Associação
- Alerta na despesa sobre o uso de especificações do Sistema de Bens Patrimoniais Móveis do PMSP
- Filtros diversos para consulta de despesas
- Filtros diversos para consulta de receitas
- Cadastro de Associações
- Registro de fornecedores usados
- Painel de Ações da Associação

### 0.1.0 - 07/04/2020 - Entregas da Sprint 2
* Autenticação de usuário
* Cadastro de despesas
* Cadastro de receitas

- Autenticação de usuário
- Cadastro de despesas
- Cadastro de receitas

### Para desenvolver

I) Clone o repositório.
I) Clone o repositório.

```console
$ git clone https://github.com/prefeiturasp/SME-PTRF-FrontEnd.git front
$ cd front
```

II. Instale as dependências.
II. Instale as dependências.

```console
$ npm i
```

III. Configure a instância com o .env
III. Configure a instância com o .env

```console
$ cp env_sample .env
```

IV. Execute os testes.
IV. Execute os testes.

```console
$ npm test
```

V. Execute a aplicação.
V. Execute a aplicação.

```console
$ npm start
```
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ptrf",
"version": "0.1.0",
"version": "0.2.0",
"private": true,
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.27",
Expand All @@ -24,6 +24,7 @@
"react-currency-input": "^1.3.6",
"react-datepicker": "^2.14.1",
"react-dom": "^16.13.1",
"react-loading": "^2.0.3",
"react-number-format": "^4.4.1",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.0",
Expand Down
9 changes: 5 additions & 4 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />

<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">

<title>PTRF</title>
</head>
<body>
<noscript>Você precisa habilitar o JavaScript para executar este aplicativo.</noscript>
<div id="root"></div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
</body>
</html>
4 changes: 4 additions & 0 deletions src/assets/css/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ body {
}
}

h2.subtitulo-itens-painel-out {
font-size: 18px;
}

.page-content h1.titulo-itens-painel {
font-size: 24px;
}
Expand Down
128 changes: 128 additions & 0 deletions src/componentes/Associacao/DadosDaAssociacao/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
import React, {useEffect, useState} from "react";
import {getAssociacao, alterarAssociacao} from "../../../services/Associacao.service";
import {CancelarModalAssociacao, SalvarModalAssociacao} from "../../../utils/Modais";

export const DadosDaAsssociacao = () => {

const [stateAssociacao, setStateAssociacao] = useState(undefined);
const [showModalReceitasCancelar, setShowModalReceitasCancelar] = useState(false);
const [showModalReceitasSalvar, setShowModalReceitasSalvar] = useState(false);

useEffect(()=> {
buscaAssociacao();
}, [])

const buscaAssociacao = async () => {
const associacao = await getAssociacao();
setStateAssociacao(associacao)
}

const handleSubmit = async (event) => {
event.preventDefault();
const payload = {
"nome": stateAssociacao.nome,
"presidente_associacao_nome": stateAssociacao.presidente_associacao_nome,
"presidente_associacao_rf": "",
"presidente_conselho_fiscal_nome": stateAssociacao.presidente_conselho_fiscal_nome,
"presidente_conselho_fiscal_rf": ""
}

try {
const response = await alterarAssociacao(payload);
if (response.status === 200) {
console.log("Operação realizada com sucesso!");
onShowModalSalvar()
} else {
console.log(response)
return
}
} catch (error) {
console.log(error)
return
}
}

const handleChange = (name, value) => {
setStateAssociacao({
...stateAssociacao,
[name]: value
});
}

const onHandleClose = () => {
setShowModalReceitasCancelar(false);
}

const onCancelarAssociacaoTrue = () => {
setShowModalReceitasCancelar(false);
buscaAssociacao();
}

const onShowModalCancelar = () => {
setShowModalReceitasCancelar(true);
}

const onSalvarAssociacaoTrue = () => {
setShowModalReceitasSalvar(false);
}

const onShowModalSalvar = () => {
setShowModalReceitasSalvar(true);
}

return (
<>
{stateAssociacao !== undefined ? (
<div className="row">
<div className="col-12">
<form onSubmit={handleSubmit}>
<div className="form-row">
<div className="form-group col-md-6">
<label htmlFor="nome"><strong>Nome da Associação</strong></label>
<input value={stateAssociacao && stateAssociacao.nome ? stateAssociacao.nome : ""} onChange={(e)=>handleChange(e.target.name, e.target.value)} name="nome" id="nome" type="text" className="form-control" />
</div>

<div className="form-group col-md-6">
<label htmlFor="codigo_eol"><strong>Código EOL da Unidade Escolar</strong></label>
<input readOnly={true} value={setStateAssociacao && stateAssociacao.unidade.codigo_eol ? stateAssociacao.unidade.codigo_eol : ""} onChange={(e)=>handleChange(e.target.name, e.target.value)} name="codigo_eol" id="codigo_eol" type="text" className="form-control" />
</div>
</div>

<div className="form-row">
<div className="form-group col-md-6">
<label htmlFor="dre"><strong>Diretoria Regional de Educação</strong></label>
<input readOnly={true} value={stateAssociacao && stateAssociacao.unidade.dre.nome ? stateAssociacao.unidade.dre.nome : "" } onChange={(e)=>handleChange(e.target.name, e.target.value)} name="dre" id="dre" type="text" className="form-control" />
</div>

<div className="form-group col-md-6">
<label htmlFor="cnpj"><strong>Número do CNPJ</strong></label>
<input readOnly={true} value={stateAssociacao.cnpj} onChange={(e)=>handleChange(e.target.name, e.target.value)} name="cnpj" id="cnpj" type="text" className="form-control" />
</div>
</div>

<div className="form-row">
<div className="form-group col-md-6">
<label htmlFor="presidente_associacao_nome"><strong>Presidente da APM</strong></label>
<input value={stateAssociacao.presidente_associacao_nome ? stateAssociacao.presidente_associacao_nome : ""} onChange={(e)=>handleChange(e.target.name, e.target.value)} name="presidente_associacao_nome" id="presidente_associacao_nome" type="text" className="form-control" />
</div>

<div className="form-group col-md-6">
<label htmlFor="presidente_conselho_fiscal_nome"><strong>Presidente do Conselho Fiscal</strong></label>
<input value={stateAssociacao.presidente_conselho_fiscal_nome} onChange={(e)=>handleChange(e.target.name, e.target.value)} name="presidente_conselho_fiscal_nome" id="presidente_conselho_fiscal_nome" type="text" className="form-control" />
</div>
</div>
<div className="d-flex justify-content-end pb-3">
<button onClick={onShowModalCancelar} type="reset" className="btn btn btn-outline-success mt-2">Cancelar </button>
<button type="submit" className="btn btn-success mt-2 ml-2">Salvar</button>
</div>
</form>
</div>
</div>
): null}
<section>
<CancelarModalAssociacao show={showModalReceitasCancelar} handleClose={onHandleClose} onCancelarTrue={onCancelarAssociacaoTrue}/>
<SalvarModalAssociacao show={showModalReceitasSalvar} handleClose={onHandleClose} onCancelarTrue={onSalvarAssociacaoTrue} />
</section>
</>
);
}
79 changes: 79 additions & 0 deletions src/componentes/Dashborard/DashboardCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import React, {useEffect, useState} from "react";
import "./dashboard.scss"
import "../../paginas/404/pagina-404.scss"
import {MsgImgLadoDireito} from "../Mensagens/MsgImgLadoDireito";
import Img404 from "../../assets/img/img-404.svg"
import {exibeDataPT_BR, exibeDateTimePT_BR, exibeValorFormatadoPT_BR} from "../../utils/ValidacoesAdicionaisFormularios";
import Loading from "../../utils/Loading";

export const DashboardCard = ({acoesAssociacao}) => {

const [loading, setLoading] = useState(true);

useEffect(()=> {
setInterval(() => {
setLoading(false);
}, 1000);
}, [])

return (
<>
{
loading ? (
<Loading
corGrafico="black"
corFonte="dark"
marginTop="0"
marginBottom="0"
/>
) : null
}
{!loading && acoesAssociacao.info_acoes && acoesAssociacao.info_acoes.length > 0 ? (
<div className="row row-cols-1 row-cols-md-2">
{acoesAssociacao.info_acoes.map((acao, index) =>
<div key={index} className="col mb-4 container-dashboard-card">
<div className="card h-100">
<div className="card-header bg-white">
{acao.acao_associacao_nome ? (
<span><strong>{acao.acao_associacao_nome}</strong> </span>
) : null }
</div>
<div className="card-body">
<div className='row'>
<div className="col-12 col-md-5 align-self-center">
<div className="col-12 container-lado-esquerdo pt-1 pb-1">
<p className="pt-1 mb-1" >Custeio: <strong>{exibeValorFormatadoPT_BR(acao.saldo_atual_custeio)}</strong></p>
<p className="pt-1 mb-1">Capital: <strong>{exibeValorFormatadoPT_BR(acao.saldo_atual_capital)}</strong></p>
<p className="pt-1 pb-1 mb-0">Total: <strong>{exibeValorFormatadoPT_BR(acao.saldo_atual_total)}</strong></p>
</div>
</div>
<div className="col-12 col-md-7 container-lado-direito align-self-center ">
<p className="pt-1 mb-1" >Saldo reprogramado: <strong>{exibeValorFormatadoPT_BR(acao.saldo_reprogramado)}</strong></p>
<p className="pt-1 mb-1">Repasses no período: <strong>{exibeValorFormatadoPT_BR(acao.repasses_no_periodo)}</strong></p>
<p className="pt-1 pb-1 mb-0">Despesa declarada: <strong>{exibeValorFormatadoPT_BR(acao.despesas_no_periodo)}</strong></p>
{acao.acao_associacao_nome.trim() === "PTRF" ? (
<p className="pt-1 pb-1 mb-0">Próx. repasse a partir de: <strong>{exibeDataPT_BR(acoesAssociacao.data_prevista_repasse)}</strong></p>
) : null }
</div>
</div>
</div>
</div>
</div>
)}
</div>
):
!loading ? (
<>
<MsgImgLadoDireito
texto='A sua escola não possui ações ativas nesse período.'
img={Img404}
/>
</>
) : null
}
<div className="d-flex justify-content-end pb-3 mt-5">
<p className="ultima-atualizacao">Última atualização: {exibeDateTimePT_BR(acoesAssociacao.ultima_atualizacao)}</p>
</div>
</>
);
}
33 changes: 33 additions & 0 deletions src/componentes/Dashborard/dashboard.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.container-dashboard-card {

}
.container-lado-esquerdo{
background-color: #F3F3F3;
font-size: 14px;
color: #00585E;
border-radius: 3px;
}

.container-lado-direito{
font-size: 12px;
color: #42474A;
}

.ultima-atualizacao{
font-weight: 500;
font-style: italic;
font-size: 14px;
}

// Fontes
.fonte-12 {
font-size: 12px !important;
}

.fonte-14 {
font-size: 14px;
}

.fonte-16 {
font-size: 16px;
}
10 changes: 10 additions & 0 deletions src/componentes/Dashborard/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from "react";
import {DashboardCard} from "./DashboardCard";

export const Dashboard = ({acoesAssociacao}) => {
return (
<DashboardCard
acoesAssociacao={acoesAssociacao}
/>
);
}
Loading

0 comments on commit 230fe59

Please sign in to comment.