import Box from '@mui/material/Box'; import type { CardProps } from '@mui/material/Card'; import Card from '@mui/material/Card'; import IconButton from '@mui/material/IconButton'; import Link from '@mui/material/Link'; import ListItemText from '@mui/material/ListItemText'; import MenuItem from '@mui/material/MenuItem'; import MenuList from '@mui/material/MenuList'; import { usePopover } from 'minimal-shared/hooks'; import { CustomPopover } from 'src/components/custom-popover'; import { Iconify } from 'src/components/iconify'; import { Image } from 'src/components/image'; import { RouterLink } from 'src/routes/components'; import type { ITourItem } from 'src/types/tour'; import { fCurrency } from 'src/utils/format-number'; import { fDateRangeShortLabel, fDateTime } from 'src/utils/format-time'; // ---------------------------------------------------------------------- type Props = CardProps & { tour: ITourItem; editHref: string; detailsHref: string; onDelete: () => void; }; export function TourItem({ tour, editHref, detailsHref, onDelete, sx, ...other }: Props) { const menuActions = usePopover(); const renderRating = () => ( {tour.ratingNumber} ); const renderPrice = () => ( {!!tour.priceSale && ( {fCurrency(tour.priceSale)} )} {fCurrency(tour.price)} ); const renderImages = () => ( {renderPrice()} {renderRating()} {tour.images[0]} {tour.images[1]} {tour.images[2]} ); const renderTexts = () => ( ({ p: theme.spacing(2.5, 2.5, 2, 2.5) })]} primary={`Posted date: ${fDateTime(tour.createdAt)}`} secondary={ {tour.name} } slotProps={{ primary: { sx: { typography: 'caption', color: 'text.disabled' }, }, secondary: { noWrap: true, component: 'h6', sx: { mt: 1, color: 'text.primary', typography: 'subtitle1' }, }, }} /> ); const renderInfo = () => ( ({ gap: 1.5, display: 'flex', position: 'relative', flexDirection: 'column', p: theme.spacing(0, 2.5, 2.5, 2.5), }), ]} > {[ { icon: , label: tour.destination, }, { icon: , label: fDateRangeShortLabel(tour.available.startDate, tour.available.endDate), }, { icon: , label: `${tour.bookers.length} Booked`, }, ].map((item) => ( {item.icon} {item.label} ))} ); const renderMenuActions = () => (
  • menuActions.onClose()}> View
  • menuActions.onClose()}> Edit
  • { menuActions.onClose(); onDelete(); }} sx={{ color: 'error.main' }} > Delete
    ); return ( <> {renderImages()} {renderTexts()} {renderInfo()} {renderMenuActions()} ); }