| @ -1,6 +1,6 @@ | |||||
| const dbCategorias = _db.query( | const dbCategorias = _db.query( | ||||
| `select categoria.tipo | `select categoria.tipo | ||||
| from categoria | |||||
| from categoria | |||||
| `) | `) | ||||
| _out.json(dbCategorias) | _out.json(dbCategorias) | ||||
| @ -0,0 +1 @@ | |||||
| _out.json(_val.map().set("result", true)) | |||||
| @ -0,0 +1,37 @@ | |||||
| import React from 'react'; | |||||
| import { Layout, Menu, Breadcrumb } from 'antd'; | |||||
| import ProdsTabela from '../ProdsTabela/index.jsx'; | |||||
| const { Header, Content, Footer } = Layout; | |||||
| const BarraNavegacao = () => { | |||||
| return ( | |||||
| <Layout> | |||||
| <Header style={{ position: 'fixed', zIndex: 1, width: '100%' }}> | |||||
| <div className="logo" /> | |||||
| <Menu theme="dark" mode="horizontal" defaultSelectedKeys={['1']}> | |||||
| <Menu.Item key="1">Produtos</Menu.Item> | |||||
| <Menu.Item key="2">nav 2</Menu.Item> | |||||
| <Menu.Item key="3">nav 3</Menu.Item> | |||||
| </Menu> | |||||
| </Header> | |||||
| <Content className="site-layout" style={{ padding: '0 50px', marginTop: 64 }}> | |||||
| <Breadcrumb style={{ margin: '16px 0' }}>-- | |||||
| <Breadcrumb.Item>Gestor de Farmácias</Breadcrumb.Item> | |||||
| <Breadcrumb.Item>Produtos</Breadcrumb.Item> | |||||
| </Breadcrumb> | |||||
| <div className="site-layout-background" style={{ padding: 24, minHeight: 380 }} key="1"> | |||||
| <ProdsTabela /> | |||||
| </div> | |||||
| </Content> | |||||
| <Footer style={{ textAlign: 'center' }}>Gestor de Farmácias ©2021</Footer> | |||||
| </Layout> | |||||
| ); | |||||
| } | |||||
| export default BarraNavegacao; | |||||
| @ -0,0 +1,57 @@ | |||||
| import React, { useState, useEffect } from "react"; | |||||
| import { Table, Tag, Space } from 'antd'; | |||||
| import _service from '@netuno/service-client'; | |||||
| const ProdsTabela = () => { | |||||
| const [data, setData] = useState([]); | |||||
| useEffect(() => { | |||||
| _service({ | |||||
| url: "produtos", | |||||
| success: (response) => { | |||||
| setData(response.json) | |||||
| }, | |||||
| fail: (e) => { | |||||
| console.log("Service Error", e); | |||||
| } | |||||
| }); | |||||
| }, []); | |||||
| const columns = [ | |||||
| { | |||||
| title: 'Nome', | |||||
| dataIndex: 'nome', | |||||
| key: 'name', | |||||
| render: text => <a>{text}</a>, | |||||
| }, | |||||
| { | |||||
| title: 'Categoria', | |||||
| dataIndex: 'categoria', | |||||
| key: 'categoria', | |||||
| }, | |||||
| { | |||||
| title: 'Stock', | |||||
| dataIndex: 'stock', | |||||
| key: 'stock', | |||||
| }, | |||||
| { | |||||
| title: 'Preço', | |||||
| dataIndex: 'preco', | |||||
| key: 'preco', | |||||
| }]; | |||||
| return ( | |||||
| <div > | |||||
| <h2>Tabela de Produtos-</h2> | |||||
| <Table columns={columns} dataSource={data} /> | |||||
| </div> | |||||
| ); | |||||
| } | |||||
| export default ProdsTabela; | |||||