Fix the dashboard
This commit is contained in:
parent
20e661d599
commit
5bf50ab372
@ -28,7 +28,6 @@ const [userType, setUserType] = useState("");
|
|||||||
show: itemPerPage,
|
show: itemPerPage,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(res.data);
|
|
||||||
setuser(res.data?.user);
|
setuser(res.data?.user);
|
||||||
setleaveData(res.data?.leave);
|
setleaveData(res.data?.leave);
|
||||||
setUserType(res.data?.userType);
|
setUserType(res.data?.userType);
|
||||||
|
@ -50,28 +50,38 @@ const Dashboard = () => {
|
|||||||
// console.log(res.data)
|
// console.log(res.data)
|
||||||
setRetaildistributor(res.data.total_data);
|
setRetaildistributor(res.data.total_data);
|
||||||
};
|
};
|
||||||
// //2nd
|
//2nd
|
||||||
// const [category, setCategory] = useState([]);
|
const [category, setCategory] = useState(null);
|
||||||
// const getAllCategory = async () => {
|
const getAllCategory = async () => {
|
||||||
// let res = await axios.get(`/api/category/getCategories`, {
|
let res = await axios.get(`/api/category/getCategories`, {
|
||||||
// headers: {
|
headers: {
|
||||||
// Authorization: `Bearer ${token}`,
|
Authorization: `Bearer ${token}`,
|
||||||
// },
|
},
|
||||||
// });
|
});
|
||||||
// // console.log(res.data);
|
// console.log(res.data);
|
||||||
// setCategory(res?.data?.categories);
|
setCategory(res?.data?.total_data);
|
||||||
// };
|
};
|
||||||
// //3rd
|
// //3rd
|
||||||
// const [product, setProduct] = useState([]);
|
const [product, setProduct] = useState(null);
|
||||||
// const getAllProduct = async () => {
|
const getAllProduct = async () => {
|
||||||
// let res = await axios.get(`/api/product/getAll/user/`, {
|
let res = await axios.get(`/api/product/getAll/user/`, {
|
||||||
// headers: {
|
headers: {
|
||||||
// Authorization: `Bearer ${token}`,
|
Authorization: `Bearer ${token}`,
|
||||||
// },
|
},
|
||||||
// });
|
});
|
||||||
// // console.log(res.data);
|
// console.log(res.data);
|
||||||
// setProduct(res?.data?.product);
|
setProduct(res?.data?.total_data);
|
||||||
// };
|
};
|
||||||
|
const [Brand, setBrand] = useState(null);
|
||||||
|
const getAllBrands = async () => {
|
||||||
|
let res = await axios.get(`/api/brand/getBrands`, {
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${token}`,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
// console.log(res.data);
|
||||||
|
setBrand(res?.data?.total_data);
|
||||||
|
};
|
||||||
// // 3rd
|
// // 3rd
|
||||||
// const [Requests, setRequests] = useState([]);
|
// const [Requests, setRequests] = useState([]);
|
||||||
// const getAllRequests = async () => {
|
// const getAllRequests = async () => {
|
||||||
@ -152,8 +162,9 @@ const Dashboard = () => {
|
|||||||
getAllsalescoordinator();
|
getAllsalescoordinator();
|
||||||
getAllterritorymanager();
|
getAllterritorymanager();
|
||||||
getAllretaildistributor();
|
getAllretaildistributor();
|
||||||
// getAllCategory();
|
getAllCategory();
|
||||||
// getAllProduct();
|
getAllProduct();
|
||||||
|
getAllBrands();
|
||||||
// getAllRequests();
|
// getAllRequests();
|
||||||
}, [token]);
|
}, [token]);
|
||||||
return (
|
return (
|
||||||
@ -163,9 +174,9 @@ const Dashboard = () => {
|
|||||||
salescoordinator={salescoordinator}
|
salescoordinator={salescoordinator}
|
||||||
territorymanager={territorymanager}
|
territorymanager={territorymanager}
|
||||||
retaildistributor={retaildistributor}
|
retaildistributor={retaildistributor}
|
||||||
// category={category}
|
category={category}
|
||||||
// product={product}
|
product={product}
|
||||||
// Requests={Requests}
|
Brand={Brand}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -18,7 +18,15 @@ import axios from "axios";
|
|||||||
{
|
{
|
||||||
/* <BeatLoader color="#36d7b7" /> */
|
/* <BeatLoader color="#36d7b7" /> */
|
||||||
}
|
}
|
||||||
const WidgetsDropdown = ({ users,salescoordinator,territorymanager,retaildistributor }) => {
|
const WidgetsDropdown = ({
|
||||||
|
users,
|
||||||
|
salescoordinator,
|
||||||
|
territorymanager,
|
||||||
|
retaildistributor,
|
||||||
|
Brand,
|
||||||
|
product,
|
||||||
|
category,
|
||||||
|
}) => {
|
||||||
// const WidgetsDropdown = ({ users, category, product, Requests }) => {
|
// const WidgetsDropdown = ({ users, category, product, Requests }) => {
|
||||||
// const token = isAutheticated();
|
// const token = isAutheticated();
|
||||||
// const [orders, setOrders] = useState([]);
|
// const [orders, setOrders] = useState([]);
|
||||||
@ -127,7 +135,8 @@ const WidgetsDropdown = ({ users,salescoordinator,territorymanager,retaildistrib
|
|||||||
// const formattedmonth = `${month} ${year}`;
|
// const formattedmonth = `${month} ${year}`;
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<h4>Principal Distributor</h4>
|
<h4>Users</h4>
|
||||||
|
{/* <h4>Principal Distributor</h4> */}
|
||||||
<CRow>
|
<CRow>
|
||||||
<CCol sm={6} lg={3}>
|
<CCol sm={6} lg={3}>
|
||||||
<CWidgetStatsA
|
<CWidgetStatsA
|
||||||
@ -137,9 +146,9 @@ const WidgetsDropdown = ({ users,salescoordinator,territorymanager,retaildistrib
|
|||||||
title="Total Principal Distributor"
|
title="Total Principal Distributor"
|
||||||
/>
|
/>
|
||||||
</CCol>
|
</CCol>
|
||||||
</CRow>
|
{/* </CRow> */}
|
||||||
<h4>Retail Distributor</h4>
|
{/* <h4>Retail Distributor</h4> */}
|
||||||
<CRow>
|
{/* <CRow> */}
|
||||||
<CCol sm={6} lg={3}>
|
<CCol sm={6} lg={3}>
|
||||||
<CWidgetStatsA
|
<CWidgetStatsA
|
||||||
className="mb-4"
|
className="mb-4"
|
||||||
@ -148,9 +157,9 @@ const WidgetsDropdown = ({ users,salescoordinator,territorymanager,retaildistrib
|
|||||||
title="Total Reatil Distributor"
|
title="Total Reatil Distributor"
|
||||||
/>
|
/>
|
||||||
</CCol>
|
</CCol>
|
||||||
</CRow>
|
{/* </CRow> */}
|
||||||
<h4>Sales Coordinator</h4>
|
{/* <h4>Sales Coordinator</h4> */}
|
||||||
<CRow>
|
{/* <CRow> */}
|
||||||
<CCol sm={6} lg={3}>
|
<CCol sm={6} lg={3}>
|
||||||
<CWidgetStatsA
|
<CWidgetStatsA
|
||||||
className="mb-4"
|
className="mb-4"
|
||||||
@ -159,9 +168,9 @@ const WidgetsDropdown = ({ users,salescoordinator,territorymanager,retaildistrib
|
|||||||
title="Total Sales Coordinator"
|
title="Total Sales Coordinator"
|
||||||
/>
|
/>
|
||||||
</CCol>
|
</CCol>
|
||||||
</CRow>
|
{/* </CRow> */}
|
||||||
<h4>Territory Manager</h4>
|
{/* <h4>Territory Manager</h4> */}
|
||||||
<CRow>
|
{/* <CRow> */}
|
||||||
<CCol sm={6} lg={3}>
|
<CCol sm={6} lg={3}>
|
||||||
<CWidgetStatsA
|
<CWidgetStatsA
|
||||||
className="mb-4"
|
className="mb-4"
|
||||||
@ -235,14 +244,22 @@ const WidgetsDropdown = ({ users,salescoordinator,territorymanager,retaildistrib
|
|||||||
|
|
||||||
/> */}
|
/> */}
|
||||||
{/* </CCol> */}
|
{/* </CCol> */}
|
||||||
{/* </CRow>
|
{/* </CRow> */}
|
||||||
<h4>Products and Categories</h4>
|
<h4>Products, Categories and Brands</h4>
|
||||||
<CRow>
|
<CRow>
|
||||||
<CCol sm={6} lg={3}>
|
<CCol sm={6} lg={3}>
|
||||||
<CWidgetStatsA
|
<CWidgetStatsA
|
||||||
className="mb-4"
|
className="mb-4"
|
||||||
color="primary"
|
color="primary"
|
||||||
value={<>{category.length}</>}
|
value={<>{product}</>}
|
||||||
|
title="Total products"
|
||||||
|
/>
|
||||||
|
</CCol>
|
||||||
|
<CCol sm={6} lg={3}>
|
||||||
|
<CWidgetStatsA
|
||||||
|
className="mb-4"
|
||||||
|
color="primary"
|
||||||
|
value={<>{category}</>}
|
||||||
title="Total Categories"
|
title="Total Categories"
|
||||||
/>
|
/>
|
||||||
</CCol>
|
</CCol>
|
||||||
@ -250,12 +267,12 @@ const WidgetsDropdown = ({ users,salescoordinator,territorymanager,retaildistrib
|
|||||||
<CWidgetStatsA
|
<CWidgetStatsA
|
||||||
className="mb-4"
|
className="mb-4"
|
||||||
color="primary"
|
color="primary"
|
||||||
value={<>{product.length}</>}
|
value={<>{Brand}</>}
|
||||||
title="Total products"
|
title="Total Brands"
|
||||||
/>
|
/>
|
||||||
</CCol>
|
</CCol>
|
||||||
</CRow>
|
</CRow>
|
||||||
<h4>Orders</h4>
|
{/* <h4>Orders</h4>
|
||||||
<CRow>
|
<CRow>
|
||||||
<CCol sm={6} lg={3}>
|
<CCol sm={6} lg={3}>
|
||||||
<CWidgetStatsA
|
<CWidgetStatsA
|
||||||
|
Loading…
Reference in New Issue
Block a user