| | |
| | | import NbChart from "./NbChart"; |
| | | import NbList from "./NbList"; |
| | | import NbCard from "./NbCard"; |
| | | import { orderBy } from 'lodash'; |
| | | import NbPie from './NbPie'; |
| | | |
| | | const styles = { |
| | |
| | | const [statistic, setStatistic] = useState({}); |
| | | const [stock, setStock] = useState([]); |
| | | const [deadStock, setDeadStock] = useState([]); |
| | | const [locUsage, setLocUsages] = useState([]); |
| | | |
| | | useEffect(() => { |
| | | getDashBoardHeader() |
| | | getRecentTrands() |
| | | getRecentStocks() |
| | | getRecentUsage() |
| | | |
| | | }, []) |
| | | |
| | |
| | | const { code, msg, data } = res?.data; |
| | | if (code === 200) { |
| | | setDeadStock(data?.records); |
| | | } else { |
| | | notify(msg, { type: 'error', messageArgs: { _: msg } }); |
| | | } |
| | | }).catch((error) => { |
| | | notify(error.message, { type: 'error', messageArgs: { _: error.message } }); |
| | | }) |
| | | } |
| | | |
| | | const getRecentUsage = () => { |
| | | request.post("/loc/pie/list").then(res => { |
| | | const { code, msg, data } = res?.data; |
| | | console.log(data); |
| | | console.log(code); |
| | | if (code === 200) { |
| | | setLocUsages(data?.data) |
| | | } else { |
| | | notify(msg, { type: 'error', messageArgs: { _: msg } }); |
| | | } |
| | |
| | | <NbChart orders={stock} /> |
| | | </Box> |
| | | <Spacer /> |
| | | <Box sx={{ display: 'flex' }}> |
| | | <Box sx={{ display: 'flex', justifyContent: 'space-between' }}> |
| | | <NbList deadStock={deadStock} /> |
| | | <NbPie /> |
| | | <NbPie locUsage={locUsage} /> |
| | | </Box> |
| | | <Spacer /> |
| | | |
| | | </Grid> |
| | | <Grid item md={4}> |
| | | <Box sx={{ display: 'flex' }}> |