From e0a3f9795c68a25842a5f57bfd3f4e0dead18e3e Mon Sep 17 00:00:00 2001 From: enggar_ganteng Date: Mon, 28 Jan 2019 16:10:16 +0700 Subject: [PATCH] dashboard diperbarui --- package-lock.json | 39 ++- src/common/pages/App/index.js | 18 +- src/common/pages/Dashboard/index.js | 445 +++++++++++--------------- src/common/pages/Dashboard/style.scss | 2 +- src/common/pages/Vouchers/index.js | 20 -- 5 files changed, 217 insertions(+), 307 deletions(-) diff --git a/package-lock.json b/package-lock.json index 67fd6a3..8747ffd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5746,10 +5746,6 @@ "resolved": "https://registry.npmjs.org/expect.js/-/expect.js-0.2.0.tgz", "integrity": "sha1-EChTPSwcNj90pnlv9X7AUg3tK+E=" }, - "exploder": { - "version": "git://github.com/cezary/exploder.git#721e1a2f777ff5dafe853981ca21b8874aae1fb0", - "from": "git://github.com/cezary/exploder.git" - }, "express": { "version": "4.16.4", "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz", @@ -6433,11 +6429,13 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true + "bundled": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -6450,15 +6448,18 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "concat-map": { "version": "0.0.1", - "bundled": true + "bundled": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -6561,7 +6562,8 @@ }, "inherits": { "version": "2.0.3", - "bundled": true + "bundled": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -6571,6 +6573,7 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -6583,17 +6586,20 @@ "minimatch": { "version": "3.0.4", "bundled": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true + "bundled": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -6610,6 +6616,7 @@ "mkdirp": { "version": "0.5.1", "bundled": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -6682,7 +6689,8 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true + "bundled": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -6692,6 +6700,7 @@ "once": { "version": "1.4.0", "bundled": true, + "optional": true, "requires": { "wrappy": "1" } @@ -6797,6 +6806,7 @@ "string-width": { "version": "1.0.2", "bundled": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -14067,8 +14077,11 @@ "version": "0.1.0", "resolved": "https://registry.npmjs.org/react-gif/-/react-gif-0.1.0.tgz", "integrity": "sha1-/A21vUnTHdRRnIVRAp+zXTtk04E=", - "requires": { - "exploder": "git://github.com/cezary/exploder.git#721e1a2f777ff5dafe853981ca21b8874aae1fb0" + "dependencies": { + "exploder": { + "version": "git://github.com/cezary/exploder.git#721e1a2f777ff5dafe853981ca21b8874aae1fb0", + "from": "git://github.com/cezary/exploder.git#721e1a2f777ff5dafe853981ca21b8874aae1fb0" + } } }, "react-google-charts": { diff --git a/src/common/pages/App/index.js b/src/common/pages/App/index.js index 31fedb0..1d7d528 100644 --- a/src/common/pages/App/index.js +++ b/src/common/pages/App/index.js @@ -47,6 +47,7 @@ import { Route as RouteDOM } from 'react-router-dom' import WalletComponent from "./WalletComponent"; import {APP_TYPE} from "../../config/app"; + faker.locale = 'id_ID'; @inject("appstate") @observer @@ -71,7 +72,7 @@ export default class App extends React.Component { .location .pathname .split('/') - .map(path => startcase(path)) + .map(path => startcase(path)), }; this.defaultState = Object.assign({}, this.state); this.user = props.appstate.user; @@ -363,6 +364,7 @@ export default class App extends React.Component { + @@ -403,42 +405,38 @@ export default class App extends React.Component { } className={(this.state.selectedMenu === '/app/dashboard') ? "menuAkunItem active" : 'menuAkunItem'}>Home - } className={(this.state.selectedMenu === '/app/flight') ? "menuAkunItem active" : 'menuAkunItem'}>Flight } className={(this.state.selectedMenu === '/app/hotel') ? "menuAkunItem active" : 'menuAkunItem'}>Hotel } className={(this.state.selectedMenu === '/app/car') ? "menuAkunItem active" : 'menuAkunItem'}>Car } className={(this.state.selectedMenu === '/app/shop') ? "menuAkunItem active" : 'menuAkunItem'}>Shop + className="menuAkun">Shop */} } + .bind(this, '/app/vouchers')} + to={LINKS.VOUCHERS} + >Vouchers diff --git a/src/common/pages/Dashboard/index.js b/src/common/pages/Dashboard/index.js index e108610..28ed52b 100644 --- a/src/common/pages/Dashboard/index.js +++ b/src/common/pages/Dashboard/index.js @@ -1,14 +1,14 @@ import React from "react"; -import {inject, observer} from "mobx-react"; +import { inject, observer } from "mobx-react"; 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 { 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 { Icon, Button, notification, Table, Tooltip as TooltipAntd, Col, Row, } from 'antd'; import DC from 'decimal.js-light'; import { Paper, @@ -26,11 +26,11 @@ import { import Grid from '@material-ui/core/Grid'; import EmptyComponent from '../EmptyComponent'; import * as _ from 'lodash'; -import {grey400, darkBlack, lightBlack, black} from 'material-ui/styles/colors'; +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 { 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'; @@ -40,11 +40,12 @@ 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 { 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"; const { LineChart, @@ -66,31 +67,43 @@ const { @observer export default class DashboardComponent extends React.Component { - constructor(props){ + constructor(props) { super(props); this.state = { isOpened: false, + modalTopup: false, data: { name: '', - image: '', + background_color_1:'', + background_color_2:'', + images: { + logo:'' + }, description: '', - additional_information: '', - background_color: '', - option: [ + additional_data: { + information:'' + }, + sku: [ { - value: '', - cost: '' + id:'', + name: '', + price: '' }, ] }, }; + this.vouchersStore = props.appstate.vouchers; } - componentDidMount(){ - + componentDidMount() { + this.vouchersStore.getList(); } - render(){ + setModalTopup = (bool) => { + this.setState({modalTopup: bool}); + }; + + render() { const settings = { arrows: true, infinite: true, @@ -100,268 +113,174 @@ export default class DashboardComponent extends React.Component { fade: true }; - const data = [ - { - name: 'KFC', - images: { - logo: 'https://ecs7.tokopedia.net/img/recharge/operator/kfc-box_150px_74px.png' - }, - description: 'KFC merupakan restoran cepat saji yang menyediakan ayam goreng serta berbagai menu pilihan lainnya seperti burger, sup, dan salad. Dengan rasa yang renyah dan gurih, siapa pun dijamin ketagihan dengan ayam goreng yang satu ini.', - additional_information: 'Voucher ini berlaku hingga 29 hari setelah pembelian.', - background_color: 'linear-gradient(rgb(214, 18, 53), rgb(100, 23, 24))', - option: [ - { - value: 'Rp. 50.000', - cost: '50 Points' - }, - { - value: 'Rp. 100.000', - cost: '100 Points' - }, - { - value: 'Super Besar 1', - cost: '34 Points' - }, - { - value: 'Super Besar 2', - cost: '49 Points' - }, - ] - }, - { - name: 'Grab', - images: { - logo: 'https://ecs7.tokopedia.net/img/recharge/operator/grab_150px_74px.png' - }, - description: 'Grab adalah platform transportasi terkemuka di Asia Tenggara. Kami percaya setiap orang harus bisa pergi ke mana saja dan percaya bahwa mereka dapat memesan perjalanan yang aman.', - additional_information: 'Voucher ini berlaku hingga 28 Februari 2019. Voucher ini hanya bisa digunakan untuk layanan GrabCar, GrabBike, dan GrabExpress. ', - background_color: 'linear-gradient(rgb(0, 174, 66), rgb(0, 93, 36))', - option: [ - { - value: 'Rp. 10.000', - cost: '10 Points' - }, - { - value: 'Rp. 20.000', - cost: '20 Points' - }, - { - value: 'Rp. 50.000', - cost: '50 Points' - }, - { - value: 'Rp. 100.000', - cost: '100 Points' - }, - ] - }, - { - name: 'OYO Hotel', - images: { - logo: 'https://ecs7.tokopedia.net/img/recharge/operator/oyo_150px_74px.png' - }, - description: 'OYO Hotel adalah jaringan hotel terbesar di Asia Selatan dan terdapat di 11 negara dengan lebih dari 12,000 hotel tersebar di seluruh dunia.', - additional_information: 'Voucher ini berlaku hingga 31 Januari 2019.', - background_color: 'linear-gradient(rgb(253, 234, 225), rgb(255, 138, 98))', - option: [ - { - value: 'Rp. 75.000', - cost: '25 Points' - }, - ] - }, - { - name: 'Carrefour', - images: { - logo: 'https://ecs7.tokopedia.net/img/recharge/operator/carrefour_150px_74px.png' - }, - description: 'Carrefour membantu semua orang agar dapat menikmati kualitas hidup yang lebih baik setiap harinya. Menyediakan berbagai kebutuhan harian sekaligus bulanan, sebagai tujuan utama berbelanja keluarga dengan memberikan pelayanan dan produk berkualitas dimanapun dan kapanpun.', - additional_information: 'Voucher ini berlaku hingga 29 hari setelah pembelian.', - background_color: 'linear-gradient(rgb(236, 249, 250), rgb(73, 176, 228))', - option: [ - { - value: 'Rp. 100.000', - cost: '100 Points' - }, - { - value: 'Rp. 200.000', - cost: '200 Points' - }, - ] - }, - { - name: "Domino's Pizza", - images: { - logo: 'https://ecs7.tokopedia.net/img/recharge/operator/dominos_150px_74px.png' - }, - description: "Domino's Pizza adalah pemimpin Pizza delivery di dunia. Dengan 130 toko yang tersebar di Jabodetabek, Bali, Bandung, Serang, dan Sukabumi, Domino’s menyajikan pizza paling lezat dengan harga terbaik untuk jutaan pelanggan. Domino’s juga mengantarkan pizza hangat dengan jaminan 30 menit sampai.", - additional_information: "Voucher ini berlaku hingga 29 hari setelah pembelian", - background_color: 'linear-gradient(rgb(11, 110, 174), rgb(2, 61, 96))', - option: [ - { - value: 'Rp. 100.000', - cost: '90 Points' - }, - { - value: 'Rp. 200.000', - cost: '180 Points' - }, - ] - }, - { - name: 'Timezone', - images: { - logo: 'https://ecs7.tokopedia.net/img/recharge/operator/new-timezone_150px_74px.png', - }, - description: 'Timezone merupakan tempat permainan semua keluarga di Indonesia. Beragam permainan menarik yang disediakan untuk memberikan pengalaman yang menyenangkan bagi setiap pengunjung. Selain permainan – permainan yang cukup menarik dan sensasi berbeda, pengunjung yang hadir ke Timezone juga berkesempatan mendapatkan hadiah-hadiah menarik dari mesin-mesin yang dimainkan ataupun souvenir, boneka dari tiket yang ditukarkan', - additional_information: 'Voucher ini berlaku hingga 29 hari setelah pembelian.', - background_color: 'linear-gradient(rgb(255, 118, 90), rgb(255, 40, 12))', - option: [ - { - value: 'Value Voucher Rp 200.000 (Saldo Rp 150.000 & Free Games Rp 50.000)', - cost: '135 Points' - }, - { - value: 'Value Voucher Rp 500.000 (Saldo Rp 300.000 & Free Games Rp 200.000)', - cost: '285 Points' - }, - ] - }, - { - name: 'Bakmi GM', - images: { - logo: 'https://ecs7.tokopedia.net/img/recharge/operator/bakmigm_150px_74px.png' - }, - description: 'BAKMI GM dirancang khusus untuk memberikan rasa yang lezat, yang dibuat dari bahan baku pilihan dan disajikan dengan harga yang ekonomis. Tersedia lebih dari 50 menu yang dapat dipilih oleh pelanggan, dengan menu Bakmi Special GM dan Pangsit Goreng yang menjadi favorit pelanggan.', - additional_information: 'Voucher ini berlaku hingga 11 Januari 2019.', - background_color: 'linear-gradient(rgb(254, 239, 73), rgb(241, 186, 54))', - option: [ - { - value: 'Rp. 50.000', - cost: '47 Points' - }, - { - value: 'Rp. 100.000', - cost: '94 Points' - }, - ] - }, - { - name: 'CFC', - images: { - logo: 'https://ecs7.tokopedia.net/img/recharge/operator/cfc_150px_74px.png' - }, - description: 'CFC merupakan salah satu brand fast food yang tersebar di berbagai daerah di Indonesia. CFC menyediakan berbagai menu makanan dan minuman yang praktis dan bervariasi sesuai dengan selera keluarga Indonesia. Mulai dari berbagai menu berbahan dasar ayam seperti : Crispy Fried Chicken, Chicken Strips, Chicken Pop, Chicken Burger, Ayam Geprek, hingga Nasi Goreng, Spaghetti, Ice blended, Calblend Float, dan masih banyak lagi.', - additional_information: 'Voucher ini berlaku hingga 29 hari setelah pembelian. Maksimal penggunaan 3 e-Voucher dalam 1 kali transaksi', - background_color: 'linear-gradient(rgb(255, 255, 255), rgb(192, 192, 192))', - option: [ - { - value: 'Rp. 50.000', - cost: '44 Points' - }, - ] - }, - ]; + return ( +
+
+
+
+
+ {this.props.appstate.wallet.data.wallet == 0 ? ( +
+ +

Voucher

+
+
+ + {/* this.setModalTopup(true)}> + Add Voucher + + */} +
+
+
+ ) : ''} + + {this.props.appstate.wallet.data.wallet == 0 ? ( +
+ +

Profile

+
Please complete your profile
+ +
+
+ ) : ''} - return( -
-
- -
- + + {this.props.appstate.wallet.data.wallet == 0 ? ( +
+ +

Credit Card

+
Please add your credit card
+ +
+
+ ) : ''} +
-
- -
-
- -
-
- -
-
- -
- +
-
- - + + + +
+
+
-
-
-

- Popular Items + +

+
+ +
+
+ +
+
+ +
+
+ +
+ +
+ +
+ + +
+
+
+

+ Popular Items

- - - + + + +
-
- - -
-
-
-

- New Products + + +
+
+
+

+ New Products

- - - + + + +
-

- - -
-
-
-

- Voucher & Gift Card + + +
+
+
+

+ Voucher & Gift Card

- - {data.map((item, index) => { - return ( this.setState({isOpened: true, data: item})} key={index} span={6}> - - ) - })} - + + { + ( this.vouchersStore.list.length > 0) ? + this.vouchersStore.list.map((item, index) => { + return ( this.setState({isOpened: true, data: item})} key={index} span={6}> + + ) + }) + : ( + + ) + } + - {/* this.setState({isOpened: false})}*/} - {/*onCancel={() => this.setState({isOpened: false})}*/} - {/*/>*/} + this.setState({isOpened: false})} + onCancel={() => this.setState({isOpened: false})} + /> +
-

+ - {/* - xs=12 sm=6 - - - xs=12 sm=6 - - - xs=3 sm=3 - - - xs=3 sm=3 - - - xs=3 sm=3 - - - xs=3 sm=3 - */} - +
+ this.setModalTopup(false)} onCancel={() => this.setModalTopup(false)} isVisible={this.state.modalTopup} />
); } diff --git a/src/common/pages/Dashboard/style.scss b/src/common/pages/Dashboard/style.scss index 6732ead..c117212 100644 --- a/src/common/pages/Dashboard/style.scss +++ b/src/common/pages/Dashboard/style.scss @@ -91,7 +91,7 @@ .value { - font-size: 1.8rem; + font-size: 1rem; letter-spacing: 1px; line-height: 1.2; display: inline-block; diff --git a/src/common/pages/Vouchers/index.js b/src/common/pages/Vouchers/index.js index e242667..bc73652 100644 --- a/src/common/pages/Vouchers/index.js +++ b/src/common/pages/Vouchers/index.js @@ -28,12 +28,6 @@ export default class VouchersComponent extends React.Component { additional_data: { information:'' }, - // option: [ - // { - // value: '', - // cost: '' - // }, - // ], sku: [ { id:'', @@ -49,7 +43,6 @@ export default class VouchersComponent extends React.Component { componentDidMount() { this.vouchersStore.getList(); - console.log('res list component',this.vouchersStore.getList()) } render() { @@ -74,19 +67,6 @@ export default class VouchersComponent extends React.Component { ) } - - - {/* { - (data.length > 0) ? - data.map((item, index) => { - return ( this.setState({isOpened: true, data: item})} key={index} span={6}> - - ) - }) - : ( - - ) - } */}