import React from "react"; import { inject, observer } from "mobx-react"; import compose from 'recompose/compose'; import withStyles from "@material-ui/core/styles/withStyles"; import withWidth, { isWidthUp } from '@material-ui/core/withWidth'; import QueueAnim from 'rc-queue-anim'; import "./style.scss"; import NumberFormat from 'react-number-format'; import { LINKS } from './../../routes' import { Link } from 'react-router-dom'; import CardAdmin from './CardAdmin'; import CardAgent from './CardAgent'; import moment from 'moment'; import { Icon, Button, notification, Table, Tooltip as TooltipAntd, Col, Row, } from 'antd'; import DC from 'decimal.js-light'; import { Paper, Card, CardActions, CardHeader, CardMedia, CardTitle, CardText, FlatButton, GridList, GridTile, Divider, ListItem, List } from 'material-ui'; import Grid from '@material-ui/core/Grid'; import { default as MuiCard } from '@material-ui/core/Card' import { default as MuiCardContent } from '@material-ui/core/CardContent'; import { default as MuiCardMedia } from '@material-ui/core/CardMedia'; import { default as MuiCardActions } from '@material-ui/core/CardActions'; import { default as MuiCardActionArea } from '@material-ui/core/CardActionArea'; import { default as MuiCardButton } from '@material-ui/core/Button'; import { default as MuiGridList } from '@material-ui/core/GridList'; import { default as MuiGridListTile } from '@material-ui/core/GridListTile'; import { default as MuiButton } from '@material-ui/core/Button'; import { default as MuiDivider } from '@material-ui/core/Divider'; import Hidden from '@material-ui/core/Hidden'; import Chip from '@material-ui/core/Chip'; import { default as MuiGridListTileBar } from '@material-ui/core/GridListTileBar'; import ListSubheader from '@material-ui/core/ListSubheader'; import IconButton from '@material-ui/core/IconButton'; import InfoIcon from '@material-ui/icons/Info'; import EmptyComponent from '../EmptyComponent'; import * as _ from 'lodash'; import { grey400, darkBlack, lightBlack, black } from 'material-ui/styles/colors'; import './style.scss'; import { Carousel } from 'react-responsive-carousel' import { ActionGrade, ContentDrafts, ContentInbox, ContentSend } from "material-ui/svg-icons/index"; import { constant } from "../../config/const"; import Slider from "react-slick"; import 'slick-carousel/slick/slick.css'; import 'slick-carousel/slick/slick-theme.css'; import VoucherComponent from '../Vouchers/index'; import slider1 from '../../../../assets/images/slider/1.jpg'; import slider2 from '../../../../assets/images/slider/2.jpg'; import slider3 from '../../../../assets/images/slider/3.jpg'; import slider4 from '../../../../assets/images/slider/4.jpg'; import slider5 from '../../../../assets/images/slider/5.jpg'; import { ItemCard } from "../Vouchers/ItemCard"; import ModalVouchersComponent from "../Vouchers/Modal"; import PopularItemCardComponent from "./PopularItemCard"; import NewItemCardComponent from "./NewItemCard"; import '../Vouchers/style.scss'; import ModalTopupComponent from "../Wallet/Modal"; import Typography from '@material-ui/core/Typography'; import { styles } from "../RegisterNew/styles"; import get from "lodash.get"; const { LineChart, AreaChart, BarChart, Bar, Line, XAxis, YAxis, ReferenceLine, CartesianGrid, Tooltip, Legend, Area, ResponsiveContainer } = require('recharts/umd/Recharts.min'); @inject('appstate') @observer class DashboardComponent extends React.Component { constructor(props) { super(props); this.state = { isOpened: false, modalTopup: false, data: { name: '', background_color_1: '', background_color_2: '', images: { logo: '' }, description: '', additional_data: { information: '' }, sku: [ { id: '', name: '', price: '' }, ] }, }; this.vouchersStore = props.appstate.vouchers; this.http = props.appstate.http; } componentDidMount() { this.vouchersStore.getList(); } setModalTopup = (bool) => { this.setState({ modalTopup: bool }); }; render() { const { classes } = this.props; const getGridListCols = () => { if (isWidthUp('lg', this.props.width)) { return 4; } if (isWidthUp('md', this.props.width)) { return 3; } if (isWidthUp('sm', this.props.width)) { return 2; } return 1; } const settings = { arrows: true, infinite: true, speed: 500, slidesToShow: 1, slidesToScroll: 1, fade: true }; return (
{this.props.appstate.wallet.data.wallet ? ( Voucher this.setModalTopup(true)}>Add Voucher ) : ''} {this.props.appstate.wallet.data.wallet ? ( Profile Please complete your profile console.log('Edit Profile')}>Edit Profile ) : ''} {this.props.appstate.wallet.data.wallet ? ( Credit Card Please add your credit card console.log('Edit Profile')}>Add Credit Card ) : ''} {/* Voucher & Gift Card {(this.vouchersStore.list.length > 0) ? this.vouchersStore.list.map((item, index) => { let image = get(item, 'images.logo', ''); if (!image.includes('http')) { image = this.http.appendImagePath(image); } return ( {item.name} Ind From: 100 Point this.setState({ isOpened: true, data: item })} size="small"> Redeem ) }) : () } */} Voucher & Gift Card {(this.vouchersStore.list.length > 0) ? this.vouchersStore.list.map((item, index) => { console.log("itemm", item) let image = get(item, 'images.main', ''); if (!image.includes('http')) { image = this.http.appendImagePath(image); } return (
{item.name} Ind From: 100 Point this.setState({ isOpened: true, data: item })} size="small"> Redeem
) }) : () }
{this.state.isOpened && ( this.setState({ isOpened: false })} onCancel={() => this.setState({ isOpened: false })} /> )} this.setModalTopup(false)} onCancel={() => this.setModalTopup(false)} isVisible={this.state.modalTopup} />
); } } export default compose(withStyles(styles), withWidth())(DashboardComponent);