You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

56 lines
1.4 KiB

import React, { useState, useEffect } from "react";
import Table from 'antd/lib/table';
import Button from 'antd/lib/button';
import notification from 'antd/lib/notification';
import JanelaStock from "./JanelaStock/index.jsx";
import Service from "../../utils/Service";
const TabelaLoja = () => {
const [data, setData] = useState([]);
const [ produtosLoja, setProdutosLoja ] = useState(null);
const [ loading, setLoading ] = useState(false);
useEffect(() => {
Service.call({
url: `lojas`,
setData,
setLoading,
errorTitle: 'Tabela de Pessoas',
errorMessage: 'Houve uma falha ao carregar a tabela das pessoas...'
});
}, [ ]);
const columns = [
{
title: "Lojas",
dataIndex: "mercearia"
},
{
title: "Stock de Lojas",
render: (text, record, index) => (
<div>
{ <Button onClick={ () => setProdutosLoja(record) } >Ver Stock</Button>}
</div>
)
}
];
return <>
{ !!produtosLoja && <JanelaStock
loja={produtosLoja}
onClose={ () => setProdutosLoja(null) }
/> }
<Table dataSource={data} { ...{ columns, loading} } />
</>;
};
export default TabelaLoja;