Skip to content
Extraits de code Groupes Projets
Valider 6d29fff9 rédigé par sanaa daoudi's avatar sanaa daoudi
Parcourir les fichiers

add review section

parent 8ee9260c
Branches
1 requête de fusion!91add review section
......@@ -34,6 +34,7 @@ import {
_sector,
_zone,
_supplier,
_commentaire,
} from "./assets";
// Fonctions pour générer des couleurs et des tailles aléatoires
......@@ -90,6 +91,7 @@ export const _mock = {
phoneNumber: (index: number) => _phoneNumbers[index],
fullAddress: (index: number) => _fullAddress[index],
origine: (index: number) => _origine[index],
commentaire: (index: number) => _commentaire[index],
// Name
firstName: (index: number) => _firstNames[index],
lastName: (index: number) => _lastNames[index],
......
......@@ -44,31 +44,12 @@ export const ETAT_REVIEW = [
];
export const _reviews = [...Array(20)].map((_, index) => {
const shipping = 10;
const discount = 10;
const taxes = 10;
const origine = _mock.origine(index);
const items =
(index % 2 && ITEMS.slice(0, 1)) ||
(index % 3 && ITEMS.slice(1, 3)) ||
ITEMS;
const totalQuantity = items.reduce(
(accumulator, item) => accumulator + item.quantity,
0
);
const subTotal = items.reduce(
(accumulator, item) => accumulator + item.price * item.quantity,
0
);
const totalAmount = subTotal - shipping - discount + taxes;
const commentaire = _mock.commentaire(index);
const items = {
name: _mock.productName(index),
};
const customer = {
id: _mock.id(index),
name: _mock.fullName(index),
......@@ -77,55 +58,17 @@ export const _reviews = [...Array(20)].map((_, index) => {
numberphone: _mock.phoneNumber(index),
};
const delivery = {
shipAdress: "19034 Verna Unions Apt. 164 - Honolulu, RI",
ville: "SAINT-MARCELLIN-EN-FOREZ",
codePostal: 87535,
};
const history = {
orderTime: _mock.time(1),
paymentTime: _mock.time(2),
deliveryTime: _mock.time(3),
completionTime: _mock.time(4),
timeline: [
{ title: "Delivery successful", time: _mock.time(1) },
{ title: "Transporting to [2]", time: _mock.time(2) },
{ title: "Transporting to [1]", time: _mock.time(3) },
{
title: "The shipping unit has picked up the goods",
time: _mock.time(4),
},
{ title: "Order has been created", time: _mock.time(5) },
],
};
return {
id: _mock.id(index),
orderNumber: `#601${index}`,
createdAt: _mock.time(index),
taxes,
origine,
commentaire,
items,
history,
subTotal,
shipping,
discount,
customer,
delivery,
totalAmount,
totalQuantity,
shippingAddress: {
fullAddress: "19034 Verna Unions Apt. 164 - Honolulu, RI",
villeShip: "SAINT-MARCELLIN-EN-FOREZ",
codePostal: 87535,
modeExpedition: "Mondial Relay",
trackingNumber: "SPX037739199373",
},
payment: {
cardType: "Virement bancaire",
cardNumber: "**** **** **** 5678",
},
status: ReviewStatus[index % ReviewStatus.length],
};
});
});
\ No newline at end of file
......@@ -207,6 +207,32 @@ export const _origine = [
'site',
'Live',
];
export const _commentaire = [
'10 Essential Tips for Healthy Living',
'The Ultimate Guide to Productivity Hacks',
'Exploring the Hidden Gems of [Destination]',
'How to Master the Art of Public Speaking',
'The Future of Artificial Intelligence: Trends and Insights',
'Delicious Recipes for a Vegan Diet',
"A Beginner's Guide to Investing in Stocks",
'The Impact of Social Media on Society',
'10 Must-Visit Destinations for Adventure Travelers',
'The Benefits of Mindfulness Meditation',
'The Importance of Mental Health Awareness',
'Building a Strong Personal Brand: Tips and Strategies',
'10 Effective Strategies for Digital Marketing Success',
'Unveiling the Secrets of Successful Entrepreneurs',
'The Rise of Remote Work and its Impact on the Workforce',
'The Art of Landscape Photography: Techniques and Inspiration',
'Understanding Blockchain Technology and its Potential Applications',
'How to Create Engaging Content for Social Media',
'The Role of Artificial Intelligence in Healthcare',
'10 Home Organization Hacks for a Clutter-Free Space',
'Exploring the History and Culture of [City/Region]',
'The Power of Positive Thinking: Transform Your Mindset',
'The Influence of Music on Mood and Emotions',
'Travel Photography Tips: Capturing Memories Around the World',
];
// ----------------------------------------------------------------------
export const _booleans = [
......
......@@ -10,6 +10,7 @@ export type UseTableProps = {
defaultDense?: boolean;
defaultOrder?: 'asc' | 'desc';
defaultOrderBy?: string;
defaultReviewBy?: string;
defaultSelected?: string[];
defaultRowsPerPage?: number;
defaultCurrentPage?: number;
......
......@@ -21,6 +21,7 @@ import { ConfirmDialog } from '../../../components/custom-dialog';
import CustomPopover, { usePopover } from '../../../components/custom-popover';
import { IReviewItem, IReviewStatus } from '../../../types/review';
import {IProductReview}from '../../../types/product';
import { TextField } from '@mui/material';
// ----------------------------------------------------------------------
......@@ -42,7 +43,7 @@ export default function ReviewTableRow({
onDeleteRow,
onEditRow,
}: Props) {
const { items, status: initialStatus, orderNumber, createdAt, customer, totalQuantity, origine } = row;
const { status: initialStatus, orderNumber, createdAt, customer, commentaire, items} = row;
const [status, setStatus] = useState(initialStatus);
const confirm = useBoolean();
......@@ -85,11 +86,11 @@ export default function ReviewTableRow({
{orderNumber}
</Box>
</TableCell>
<TableCell > {commentaire} </TableCell>
<TableCell sx={{ display: 'flex', alignItems: 'center' }}>
<ListItemText
primary={customer.name}
secondary={customer.email}
primaryTypographyProps={{ typography: 'body2' }}
secondaryTypographyProps={{
component: 'span',
......@@ -97,7 +98,7 @@ export default function ReviewTableRow({
}}
/>
</TableCell>
<TableCell > {items.name}</TableCell>
<TableCell>
<ListItemText
primary={fDate(createdAt)}
......@@ -111,9 +112,7 @@ export default function ReviewTableRow({
/>
</TableCell>
<TableCell align="center"> {totalQuantity} </TableCell>
<TableCell align="center"> {origine} </TableCell>
<TableCell>
<Label
variant="soft"
......@@ -155,7 +154,7 @@ export default function ReviewTableRow({
fullWidth
name="comment"
variant="outlined"
placeholder="Écrire un avis ici..."
placeholder=" Écrire une réponse..."
/>
</Box>
......
......@@ -97,22 +97,10 @@ export default function ReviewTableToolbar({
<IconButton onClick={popover.onOpen}>
<Iconify icon="eva:more-vertical-fill" />
</IconButton>
</Stack>
</Stack>
<CustomPopover open={popover.open} onClose={popover.onClose} arrow="right-top" sx={{ width: 140 }}>
<MenuItem onClick={popover.onClose}>
<Iconify icon="solar:printer-minimalistic-bold" />
Print
</MenuItem>
<MenuItem onClick={popover.onClose}>
<Iconify icon="solar:export-bold" />
Export
</MenuItem>
</CustomPopover>
</>
);
}
......@@ -2,41 +2,10 @@
import { useState } from "react";
import Container from "@mui/material/Container";
import { Box, Button, Link, Typography, Checkbox, FormControlLabel, Accordion, AccordionSummary, AccordionDetails, FormGroup, Grid } from '@mui/material';
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import { Typography, Checkbox, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Paper, Switch } from '@mui/material';
import { paths } from "../../../../routes/paths";
import { useSettingsContext } from "../../../components/settings";
import CustomBreadcrumbs from "../../../../components/custom-breadcrumbs";
import { IOrderTableFilters } from "../../../types/order";
// ----------------------------------------------------------------------
interface IOrderStatusOption {
value: string;
label: string;
}
const STATUS_OPTIONS: IOrderStatusOption[] = [
{ value: 'all', label: 'All' },
// Add other status options as needed
];
const TABLE_HEAD = [
{ id: "orderNumber", label: "Order", width: 116 },
{ id: "name", label: "Customer" },
{ id: "createdAt", label: "Date", width: 140 },
{ id: "totalQuantity", label: "Items", width: 120, align: "center" },
{ id: "origine", label: "Origine", width: 120, align: "center" },
{ id: "totalAmount", label: "Price", width: 140 },
{ id: "status", label: "Status", width: 110 },
{ id: "", width: 88 },
];
const defaultFilters: IOrderTableFilters = {
name: "",
status: "all",
startDate: null,
endDate: null,
};
// ----------------------------------------------------------------------
......@@ -44,9 +13,9 @@ export default function ReviewListView() {
const settings = useSettingsContext();
const [preferences, setPreferences] = useState({
technical: false,
statistics: true,
marketing: false,
paypal: true,
card: true,
bank: true,
});
const handlePreferenceChange = (event: { target: { name: any; checked: any; }; }) => {
......@@ -57,81 +26,83 @@ export default function ReviewListView() {
}));
};
return (
<>
<Container maxWidth={settings.themeStretch ? false : "lg"}>
<CustomBreadcrumbs
heading="Configuration"
links={[
{
name: "dashboard",
href: paths.dashboard.root,
},
{
name: "Commentaires",
href: paths.dashboard.order.all_orders,
},
{
name: "Configuration",
},
]}
sx={{
mb: { xs: 3, md: 5 },
}}
/>
<Grid
container
justifyContent="flex-end"
style={{ marginBottom: "16px" }}
>
</Grid>
<Accordion>
<AccordionSummary expandIcon={<ExpandMoreIcon />}>
<FormControlLabel
control={<Checkbox name="statistics" checked={preferences.statistics} onChange={handlePreferenceChange} />}
label="Autoriser les commentaires"
/>
</AccordionSummary>
<AccordionDetails>
<Typography variant="body2">
Permettre aux utilisateurs de laisser des commentaires sur le site web
</Typography>
</AccordionDetails>
</Accordion>
{preferences.statistics && (
<>
<Accordion>
<AccordionSummary expandIcon={<ExpandMoreIcon />}>
<FormControlLabel
control={<Checkbox name="marketing" checked={preferences.marketing} onChange={handlePreferenceChange} />}
label="Autoriser les notifications"
/>
</AccordionSummary>
<AccordionDetails>
<Typography variant="body2">
Permettre aux utilisateurs de recevoir des notifications marketing
</Typography>
</AccordionDetails>
</Accordion>
<Accordion>
<AccordionSummary expandIcon={<ExpandMoreIcon />}>
<FormControlLabel
control={<Checkbox name="technical" checked={preferences.technical} onChange={handlePreferenceChange} />}
label="Approuver un avis automatique"
return (
<Container maxWidth={settings.themeStretch ? false : "lg"}>
<CustomBreadcrumbs
heading="Configuration"
links={[
{
name: "dashboard",
href: paths.dashboard.root,
},
{
name: "Commentaires",
href: paths.dashboard.order.all_orders,
},
{
name: "Configuration",
},
]}
sx={{
mb: { xs: 3, md: 5 },
}}
/>
<TableContainer component={Paper}>
<Table>
<TableHead>
<TableRow>
<TableCell>Nom</TableCell>
<TableCell align="center">Activé</TableCell>
<TableCell>Description</TableCell>
</TableRow>
</TableHead>
<TableBody>
<TableRow key="PayPal">
<TableCell>Autoriser les commentaires sur le site</TableCell>
<TableCell align="center">
<Switch
checked={preferences.paypal}
onChange={handlePreferenceChange}
name="paypal"
color="primary"
/>
</AccordionSummary>
<AccordionDetails>
<Typography variant="body2">
Approuver automatiquement certains avis
</Typography>
</AccordionDetails>
</Accordion>
</>
)}
</Container>
</>
</TableCell>
<TableCell> Cette option permet d'activer ou de désactiver la fonctionnalité de commentaires sur le site. Lorsqu'elle est activée, les visiteurs peuvent laisser des commentaires sur les articles. Si elle est désactivée, cette fonctionnalité sera masquée pour les utilisateurs.</TableCell>
</TableRow>
{preferences.paypal && (
<>
<TableRow key="Carte Bancaire">
<TableCell>Autoriser les notifications pour admin </TableCell>
<TableCell align="center">
<Switch
checked={preferences.card}
onChange={handlePreferenceChange}
name="card"
color="primary"
/>
</TableCell>
<TableCell> Cette option permet d'activer ou de désactiver les notifications pour les administrateurs. Lorsqu'elle est activée, les administrateurs recevront des notifications pour de nouveaux commentaires. Si elle est désactivée, les administrateurs ne recevront pas ces notifications.</TableCell>
</TableRow>
<TableRow key="Virement Bancaire">
<TableCell>Approuver les commentaires automatiquement</TableCell>
<TableCell align="center">
<Switch
checked={preferences.bank}
onChange={handlePreferenceChange}
name="bank"
color="primary"
/>
</TableCell>
<TableCell> Si cette option est activée, tous les commentaires laissés par les utilisateurs seront automatiquement approuvés et publiés sur le site sans nécessiter une intervention manuelle de l'administrateur. Cela permet d'accélérer le processus de publication des commentaires. </TableCell>
</TableRow>
</>
)}
</TableBody>
</Table>
</TableContainer>
</Container>
);
}
......@@ -66,10 +66,10 @@ const STATUS_OPTIONS: IReviewStatusOption[] = [
const TABLE_HEAD = [
{ id: "ReviewNumber", label: "Review" , align: 'left'},
{ id: "name", label: "Auteur / autrice", align: 'left' },
{ id: "createdAt", label: "Date", align: 'left'},
{ id: "totalQuantity", label: "Produit", align: 'left' },
{ id: "origine", label: "Commentaire" , align: 'left' },
{ id: "commentaire", label: "Commentaire" , align: 'left' },
{ id: "name", label: "utilisateur", align: 'left' },
{ id: "name", label: "Produit", align: 'left' },
{ id: "createdAt", label: "Date", align: 'left'},
{ id: "status", label: "Status", align: 'left' },
{ id: "" ,label: '', align: 'right'},
];
......@@ -250,7 +250,7 @@ export default function ReviewListView() {
'default'
}
>
{tab.value === 'all' ? tableData.length : tableData.filter(order => order.status === tab.value).length}
{tab.value === 'all' ? tableData.length : tableData.filter(review => review.status === tab.value).length}
</Label>
}
......
......@@ -71,18 +71,10 @@ export type IReviewProductItem = {
export type IReviewItem = {
id: string;
taxes: number;
status: string;
origine: string;
shipping: number;
discount: number;
subTotal: number;
commentaire: string;
orderNumber: string;
totalAmount: number;
totalQuantity: number;
history: IReviewHistory;
customer: IReviewCustomer;
delivery: IReviewDelivery;
items: IReviewProductItem[];
items: IReviewProductItem;
createdAt: Date;
};
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