Skip to content

Commit

Permalink
Merge branch 'hotfix/0.1.0.fix-docs'
Browse files Browse the repository at this point in the history
  • Loading branch information
alcfernandes committed Apr 10, 2020
2 parents e3ec214 + 3979a57 commit 63aefa0
Show file tree
Hide file tree
Showing 4 changed files with 221 additions and 128 deletions.
46 changes: 45 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,45 @@
# SME-PTRF-FrontEnd
# SME-PTRF-FrontEnd
========

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

License: MIT

Versão: 0.1.0


## Release Notes

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


### Para desenvolver

I) Clone o repositório.
```console
$ git clone https://github.com/prefeiturasp/SME-PTRF-FrontEnd.git front
$ cd front
```

II. Instale as dependências.
```console
$ npm i
```

III. Configure a instância com o .env
```console
$ cp env_sample .env
```

IV. Execute os testes.
```console
$ npm test
```

V. Execute a aplicação.
```console
$ npm start
```
268 changes: 141 additions & 127 deletions src/componentes/SidebarLeft/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,133 +17,147 @@ import { SidebarContext } from '../../context/Sidebar'

import { useHistory } from 'react-router-dom'

import { USUARIO_NOME, ASSOCIACAO_NOME } from '../../services/auth.service';
import { USUARIO_NOME, ASSOCIACAO_NOME } from '../../services/auth.service'

export const SidebarLeft = () => {
const sidebarStatus = useContext(SidebarContext);
let history = useHistory();

const onToggle= () =>{
sidebarStatus.setSideBarStatus(!sidebarStatus.sideBarStatus)
}

return (
<>
<SideNav
id="sideBarLeft"
className="sideNavCustomizado"
expanded = {sidebarStatus.sideBarStatus}
onSelect={(selected) => {

const to = '/' + selected;
if (history.location.pathname !== to) {
history.push(to);
}
}}
onToggle={onToggle}
>
<SideNav.Toggle />
<SideNav.Nav defaultSelected="painel">
<NavItem
navitemClassName="navItemCustomizado"
>
<NavIcon>
<FontAwesomeIcon style={{fontSize: "25px"}} className={sidebarStatus.sideBarStatus ? "escondeItem" : ""} src={IconeMenuDadosDaAssociacao} icon={faUser}/>
</NavIcon>
<NavText>
<div className="container-nome-instituicao mt-n4 mb-4">{localStorage.getItem(ASSOCIACAO_NOME)}</div>
</NavText>
</NavItem>

<NavItem
navitemClassName="navItemCustomizado"
>
<NavIcon>
<FontAwesomeIcon style={{fontSize: "25px"}} className={sidebarStatus.sideBarStatus ? "escondeItem" : ""} src={IconeMenuDadosDaAssociacao} icon={faSchool}/>
</NavIcon>
<NavText>
<div className="container-nome-instituicao mt-n4 mb-4"><span className="border border-white rounded-pill px-4 py-1">{localStorage.getItem(USUARIO_NOME)? localStorage.getItem(USUARIO_NOME).split(" ")[0]: ''}</span></div>
</NavText>
</NavItem>

<NavItem eventKey="dashboard">
<NavIcon>
<img src={IconeMenuPainel} alt=""/>
</NavIcon>
<NavText>
Painel
</NavText>
</NavItem>
<NavItem eventKey="lista-de-despesas">
<NavIcon>
<img src={IconeMenuGastosDaEscola} alt=""/>
</NavIcon>
<NavText>
Gastos da Escola
</NavText>
</NavItem>


<NavItem eventKey="lista-de-receitas">
<NavIcon>
<img src={IconeMenuCreditosDaEscola} alt=""/>
</NavIcon>
<NavText>
Créditos da escola
</NavText>
</NavItem>

<NavItem eventKey="cadastro-de-despesa">
<NavIcon>
<img src={IconeMenuCadastroDeDespesa} alt=""/>
</NavIcon>
<NavText>
Cadastro de despesa
</NavText>
</NavItem>
import { Versao } from '../Versao'

<NavItem eventKey="cadastro-de-credito">
<NavIcon>
<img src={IconeMenuCadastroDeCredito} alt=""/>
</NavIcon>
<NavText>
Cadastro de crédito
</NavText>
</NavItem>

<NavItem eventKey="prestacaoDeContas">
<NavIcon>
<img src={IconeMenuPrestacaoDeContas} alt=""/>
</NavIcon>
<NavText>
Prestação de contas
</NavText>
</NavItem>

<NavItem eventKey="dadosAssociacao">
<NavIcon>
<img src={IconeMenuDadosDaAssociacao} alt=""/>
</NavIcon>
<NavText>
Dados da Associação
</NavText>
</NavItem>
<NavItem
navitemClassName= {!sidebarStatus.sideBarStatus ? "escondeItem" : "navItemCustomizado"}
>
<NavIcon>

</NavIcon>
<NavText>
<div className="container-nome-instituicao mt-n4 mb-4"><img src={LogoSP} alt=""/></div>
</NavText>
</NavItem>


</SideNav.Nav>
</SideNav>
</>

);
export const SidebarLeft = () => {
const sidebarStatus = useContext(SidebarContext)
let history = useHistory()

const onToggle = () => {
sidebarStatus.setSideBarStatus(!sidebarStatus.sideBarStatus)
}

return (
<>
<SideNav
id="sideBarLeft"
className="sideNavCustomizado"
expanded={sidebarStatus.sideBarStatus}
onSelect={(selected) => {
const to = '/' + selected
if (history.location.pathname !== to) {
history.push(to)
}
}}
onToggle={onToggle}
>
<SideNav.Toggle />
<SideNav.Nav defaultSelected="painel">
<NavItem navitemClassName="navItemCustomizado">
<NavIcon>
<FontAwesomeIcon
style={{ fontSize: '25px' }}
className={sidebarStatus.sideBarStatus ? 'escondeItem' : ''}
src={IconeMenuDadosDaAssociacao}
icon={faUser}
/>
</NavIcon>
<NavText>
<div className="container-nome-instituicao mt-n4 mb-4">
{localStorage.getItem(ASSOCIACAO_NOME)}
</div>
</NavText>
</NavItem>

<NavItem navitemClassName="navItemCustomizado">
<NavIcon>
<FontAwesomeIcon
style={{ fontSize: '25px' }}
className={sidebarStatus.sideBarStatus ? 'escondeItem' : ''}
src={IconeMenuDadosDaAssociacao}
icon={faSchool}
/>
</NavIcon>
<NavText>
<div className="container-nome-instituicao mt-n4 mb-4">
<span className="border border-white rounded-pill px-4 py-1">
{localStorage.getItem(USUARIO_NOME)
? localStorage.getItem(USUARIO_NOME).split(' ')[0]
: ''}
</span>
</div>
</NavText>
</NavItem>

<NavItem eventKey="dashboard">
<NavIcon>
<img src={IconeMenuPainel} alt="" />
</NavIcon>
<NavText>Painel</NavText>
</NavItem>
<NavItem eventKey="lista-de-despesas">
<NavIcon>
<img src={IconeMenuGastosDaEscola} alt="" />
</NavIcon>
<NavText>Gastos da Escola</NavText>
</NavItem>

<NavItem eventKey="lista-de-receitas">
<NavIcon>
<img src={IconeMenuCreditosDaEscola} alt="" />
</NavIcon>
<NavText>Créditos da escola</NavText>
</NavItem>

<NavItem eventKey="cadastro-de-despesa">
<NavIcon>
<img src={IconeMenuCadastroDeDespesa} alt="" />
</NavIcon>
<NavText>Cadastro de despesa</NavText>
</NavItem>

<NavItem eventKey="cadastro-de-credito">
<NavIcon>
<img src={IconeMenuCadastroDeCredito} alt="" />
</NavIcon>
<NavText>Cadastro de crédito</NavText>
</NavItem>

<NavItem eventKey="prestacaoDeContas">
<NavIcon>
<img src={IconeMenuPrestacaoDeContas} alt="" />
</NavIcon>
<NavText>Prestação de contas</NavText>
</NavItem>

<NavItem eventKey="dadosAssociacao">
<NavIcon>
<img src={IconeMenuDadosDaAssociacao} alt="" />
</NavIcon>
<NavText>Dados da Associação</NavText>
</NavItem>
<NavItem
navitemClassName={
!sidebarStatus.sideBarStatus
? 'escondeItem'
: 'navItemCustomizado'
}
>
<NavIcon></NavIcon>
<NavText>
<div className="container-nome-instituicao mt-n4 mb-4">
<img src={LogoSP} alt="" />
</div>
</NavText>
</NavItem>
<NavItem
navitemClassName={
!sidebarStatus.sideBarStatus
? 'escondeItem'
: 'navItemCustomizado'
}
>
<NavIcon></NavIcon>
<NavText>
<div>
<Versao />
</div>
</NavText>
</NavItem>
</SideNav.Nav>
</SideNav>
</>
)
}

26 changes: 26 additions & 0 deletions src/componentes/Versao/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React, { Component } from 'react'
import { getVersaoApi } from '../../services/Core.service'

export class Versao extends Component {
constructor(props) {
super(props)

this.state = {
versaoApi: '',
versaoFront: '',
}
}
async componentDidMount() {
const versaoApi = await getVersaoApi()

const pjson = require('../../../package.json')
const versaoFront = pjson.version

this.setState({ versaoApi, versaoFront })
}
render() {
return (
<span>{`${this.state.versaoFront} (API:${this.state.versaoApi})`}</span>
)
}
}
9 changes: 9 additions & 0 deletions src/services/Core.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import api from './Api'

const authHeader = {
'Content-Type': 'application/json',
}

export const getVersaoApi = async () => {
return (await api.get(`api/versao`, authHeader)).data['versao']
}

0 comments on commit 63aefa0

Please sign in to comment.