// ** React Imports import { SyntheticEvent, useState } from 'react' // ** MUI Import import Box from '@mui/material/Box' import Tab from '@mui/material/Tab' import Card from '@mui/material/Card' import TabList from '@mui/lab/TabList' import Table from '@mui/material/Table' import TabPanel from '@mui/lab/TabPanel' import Avatar from '@mui/material/Avatar' import TabContext from '@mui/lab/TabContext' import TableRow from '@mui/material/TableRow' import TableBody from '@mui/material/TableBody' import TableCell from '@mui/material/TableCell' import TableHead from '@mui/material/TableHead' import CardHeader from '@mui/material/CardHeader' import TableContainer from '@mui/material/TableContainer' // ** Icon Imports import Icon from 'src/@core/components/icon' // ** Custom Components Imports import OptionsMenu from 'src/@core/components/option-menu' // ** Util Import import { hexToRGBA } from 'src/@core/utils/hex-to-rgba' interface TabAvatarType { imgWidth: number category: string imgHeight: number } interface TabContentType { price: string total: string imgAlt: string imgSrc: string product: string quantity: number } interface TabContentDataType { watch: TabContentType[] mobile: TabContentType[] desktop: TabContentType[] console: TabContentType[] } const tabAvatars: TabAvatarType[] = [ { imgWidth: 30, imgHeight: 58, category: 'mobile' }, { imgWidth: 52, imgHeight: 42, category: 'desktop' }, { imgWidth: 60, imgHeight: 42, category: 'console' }, { imgWidth: 44, imgHeight: 50, category: 'watch' } ] const tabContentData: TabContentDataType = { mobile: [ { quantity: 2, price: '$849', total: '$1,698', imgAlt: 'samsung-s22', product: 'Samsung s22', imgSrc: '/images/cards/samsung-s22.png' }, { quantity: 1, price: '$599', total: '$599', imgAlt: 'apple-iPhone-13-pro', product: 'Apple iPhone 13 Pro', imgSrc: '/images/cards/apple-iPhone-13-pro.png' }, { quantity: 4, price: '$399', total: '$1,596', imgAlt: 'oneplus-9-pro', product: 'Oneplus 9 Pro', imgSrc: '/images/cards/oneplus-9-pro.png' }, { quantity: 3, price: '$450', total: '$1,350', imgAlt: 'google-pixel-6', product: 'Google Pixel 6', imgSrc: '/images/cards/google-pixel-6.png' } ], desktop: [ { quantity: 2, price: '$849', total: '$1,698', imgAlt: 'apple-mac-mini', product: 'Apple Mac Mini', imgSrc: '/images/cards/apple-mac-mini.png' }, { quantity: 4, price: '$599', total: '$2,396', imgAlt: 'hp-envy-x360', product: 'Newest HP Envy x360', imgSrc: '/images/cards/hp-envy-x360.png' }, { quantity: 1, price: '$399', total: '$399', imgAlt: 'dell-inspiron-3000', product: 'Dell Inspiron 3000', imgSrc: '/images/cards/dell-inspiron-3000.png' }, { quantity: 3, price: '$450', total: '$1,350', imgAlt: 'apple-iMac-4k', product: 'Apple iMac 4k', imgSrc: '/images/cards/apple-iMac-4k.png' } ], console: [ { quantity: 1, price: '$599', total: '$599', imgAlt: 'sony-play-station-5', product: 'Sony Play Station 5', imgSrc: '/images/cards/sony-play-station-5.png' }, { quantity: 3, price: '$489', total: '$1,467', imgAlt: 'xbox-series-x', product: 'XBOX Series X', imgSrc: '/images/cards/xbox-series-x.png' }, { quantity: 4, price: '$335', total: '$1,340', imgAlt: 'nintendo-switch', product: 'Nintendo Switch', imgSrc: '/images/cards/nintendo-switch.png' }, { quantity: 8, price: '$14', total: '$112', imgAlt: 'sup-game-box-400', product: 'SUP Game Box 400', imgSrc: '/images/cards/sup-game-box-400.png' } ], watch: [ { quantity: 2, price: '$202', total: '$404', imgAlt: 'samsung-watch-4', product: 'Samsung Watch 4', imgSrc: '/images/cards/samsung-watch-4.png' }, { quantity: 1, price: '$399', total: '$399', imgAlt: 'apple-watch-7', product: 'Apple Watch 7', imgSrc: '/images/cards/apple-watch-7.png' }, { quantity: 3, price: '$59', total: '$177', imgAlt: 'amazon-echo-dot', product: 'Amazon Echo Dot', imgSrc: '/images/cards/amazon-echo-dot.png' }, { quantity: 1, price: '$139', total: '$139', imgAlt: 'gramin-verve', product: 'Gramin Verve', imgSrc: '/images/cards/gramin-verve.png' } ] } const RenderTabContent = ({ data }: { data: TabContentType[] }) => { return ( `${theme.spacing(2.5)} !important` } }}> Image Product Name Qty Price Total {data.map((row: TabContentType, index: number) => ( `${theme.spacing(1.5)} !important` }, '&:first-child .MuiTableCell-body': { pt: theme => `${theme.spacing(3)} !important` }, '&:last-child .MuiTableCell-body': { pb: theme => `${theme.spacing(3)} !important` } }} > {row.product} {row.quantity} {row.price} {row.total} ))}
) } const CardTopReferralSources = () => { // ** State const [value, setValue] = useState('mobile') const handleChange = (event: SyntheticEvent, newValue: string) => { setValue(newValue) } const RenderTabAvatar = ({ data }: { data: TabAvatarType }) => ( value === data.category ? `2px solid ${theme.palette.primary.main}` : `2px dashed ${theme.palette.divider}` }} /> ) return ( } /> } /> } /> } /> } /> value === 'add' ? `2px solid ${theme.palette.primary.main}` : `2px dashed ${theme.palette.divider}` }} > hexToRGBA(theme.palette.secondary.main, 0.12) }} > } /> ) } export default CardTopReferralSources