Skip to content
Extraits de code Groupes Projets
Valider 59683aca rédigé par aminaGourram's avatar aminaGourram
Parcourir les fichiers

Update Dashbord Live manager

parent 54093d58
Branches
2 requêtes de fusion!121MYD-346 "Update Dashboard Admin / Live manager",!120Up date Live Manager
Pipeline #2208 en échec avec l'étape
in 3 minutes et 47 secondes
import { _mock } from "./_mock";
import { format } from 'date-fns';
// APP
// ----------------------------------------------------------------------
export const _appRelated = [
......@@ -193,6 +193,20 @@ export const _BestSalesProduct = [...Array(5)].map((_, index) => {
avatarUrl: _mock.image.product(index),
};
});
const generateRandomDate = () => {
const today = new Date();
const pastDate = new Date();
pastDate.setDate(today.getDate() - Math.floor(Math.random() * 30));
return format(pastDate, 'yyyy-MM-dd'); // Format de date ajusté selon vos besoins
};
export const _BestSalesProduct1 = [
{ date: generateRandomDate(), totalAmount: _mock.number.price(1) * 3 },
{ date: generateRandomDate(), totalAmount: _mock.number.price(2) * 3 },
{ date: generateRandomDate(), totalAmount: _mock.number.price(3) * 3 },
{ date: generateRandomDate(), totalAmount: _mock.number.price(4) * 3 },
{ date: generateRandomDate(), totalAmount: _mock.number.price(5) * 3 },
];
export const _ecommerceLatestProducts = [...Array(5)].map((_, index) => {
const colors = (index === 0 && [
......
import React from 'react';
import Table from "@mui/material/Table";
import Avatar from "@mui/material/Avatar";
import TableRow from "@mui/material/TableRow";
......@@ -24,10 +25,16 @@ type RowProps = {
totalAmount: number;
};
type SalesData = {
date: string;
totalAmount: number;
};
interface Props extends CardProps {
title?: string;
subheader?: string;
tableData: RowProps[];
tableData1: SalesData[];
tableLabels: any;
}
......@@ -35,6 +42,7 @@ export default function BestSalesProduct({
title,
subheader,
tableData,
tableData1,
tableLabels,
...other
}: Props) {
......@@ -51,6 +59,9 @@ export default function BestSalesProduct({
{tableData.map((row) => (
<EcommerceBestSalesmanRow key={row.id} row={row} />
))}
{tableData1.map((row, index) => (
<SalesDataRow key={index} row={row} />
))}
</TableBody>
</Table>
</Scrollbar>
......@@ -69,12 +80,11 @@ function EcommerceBestSalesmanRow({ row }: EcommerceBestSalesmanRowProps) {
return (
<TableRow>
<TableCell sx={{ display: "flex", alignItems: "center" }}>
<Avatar alt={row.name} src={row.avatarUrl} sx={{ mr: 2 }} />
<Avatar alt={row.name} src={row.avatarUrl} sx={{ mr: 2 }} />
{row.name}
</TableCell>
<TableCell>{row.category}</TableCell>
<TableCell align="right">{fCurrency(row.totalAmount)}</TableCell>
......@@ -95,3 +105,16 @@ function EcommerceBestSalesmanRow({ row }: EcommerceBestSalesmanRowProps) {
</TableRow>
);
}
type SalesDataRowProps = {
row: SalesData;
};
function SalesDataRow({ row }: SalesDataRowProps) {
return (
<TableRow>
<TableCell>{row.date}</TableCell>
<TableCell align="right">{fCurrency(row.totalAmount)}</TableCell>
</TableRow>
);
}
......@@ -11,7 +11,7 @@ import AppWidgetSummary from "../../cart/statistics/statistics-widget-summary";
import AnalyticsAbandonedCarts from "../../cart/statistics/Analytics-AbandonedCarts";
import AnalyticsNetSales from "../../cart/statistics/ProductRateChart";
import BestSalesProduct from "../../cart/statistics/Best-salesProduct";
import { _BestSalesProduct } from "@/shared/_mock";
import { _BestSalesProduct, _BestSalesProduct1 } from "@/shared/_mock";
import { useTheme } from "@mui/material/styles";
......@@ -94,18 +94,7 @@ export default function AllStatisticsView() {
showEuroSymbol={true}
/>
</Grid>
<Grid item xs={12} sm={6} md={4}>
<AppWidgetSummary
title="Nombre Total de Lives"
percent={0.2}
total={4876}
color={theme.palette.secondary.light}
chart={{
colors: [theme.palette.warning.dark, theme.palette.warning.dark],
series: [20, 41, 63, 33, 28, 35, 50, 46, 11, 26],
}}
/>
</Grid>
<Grid item xs={12} sm={6} md={4}>
<AppWidgetSummary
......@@ -172,18 +161,14 @@ export default function AllStatisticsView() {
/>
</Grid>
<Grid xs={12} md={6} lg={18}>
<BestSalesProduct
title="Tableau dernier session de live"
tableData={_BestSalesProduct}
tableLabels={[
{ id: "date", label: " Date de la session de live" },
{ id: "name", label: "Nom du produit" },
{ id: "totalAmount", label: "Chiffre D'affaire", align: "right" },
{ id: "rank", label: "Rank", align: "right" },
]}
/>
</Grid>
<BestSalesProduct
title="Tableau dernier session de live"
tableData1={_BestSalesProduct1}
tableLabels={[
{ id: "date", label: " Date de la session de live" },
{ id: "totalAmount", label: "Chiffre D'affaire", align: "right" },
]} tableData={[]} />
</Grid>
</Grid>
</Container>
);
......
......@@ -13,7 +13,7 @@ import OrderChartReturns from "./order-chart-returns";
import OrderMontantChart from "./order-chart";
import OrderCommandChart from "./OrderCommandChart";
import AnalyticsRefundReason from "./analytics-refund-reason";
import AppWidgetSummary from "./statistics-widget-summary";
import AppWidgetSummary from "../../cart/statistics/statistics-widget-summary";
import { useTheme } from "@mui/material/styles";
import BestSalesProduct from "../../cart/statistics/Best-salesProduct";
import { _BestSalesProduct } from "@/shared/_mock";
......@@ -269,18 +269,7 @@ export default function AllStatisticsView() {
/>
</Grid>
</Grid>
<Grid xs={12} md={6} lg={8}>
<BestSalesProduct
title="Les Produits les plus vendus"
tableData={_BestSalesProduct}
tableLabels={[
{ id: "name", label: "Produits" },
{ id: "category", label: "Catégorie" },
{ id: "totalAmount", label: "Chiffre D'affaire", align: "right" },
{ id: "rank", label: "Rank", align: "right" },
]}
/>
</Grid>
</Container>
);
......
0% ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter