// Detail Pembelian
@@ -74,7 +80,7 @@ export default class CheckoutVouchers extends React.Component {
-
})
+
})
{/*
*/}
diff --git a/src/common/pages/Vouchers/ItemCard/index.js b/src/common/pages/Vouchers/ItemCard/index.js
index 0fd52e6..79a60f5 100644
--- a/src/common/pages/Vouchers/ItemCard/index.js
+++ b/src/common/pages/Vouchers/ItemCard/index.js
@@ -28,16 +28,16 @@ export class ItemCard extends React.Component {
render() {
const {data = {}} = this.props;
- let image = ''
- if(data.images.logo.includes('http')){
- image = data.images.logo;
- }else{
- image = this.http.appendImagePath(data.images.logo);
+
+ let image = get(data, 'images.logo', '');
+
+ if (!image.includes('http')) {
+ image = this.http.appendImagePath(image);
}
return (
-
+
{data.name}
)
diff --git a/src/common/pages/Vouchers/Modal/index.js b/src/common/pages/Vouchers/Modal/index.js
index 6d271ad..84e99a6 100644
--- a/src/common/pages/Vouchers/Modal/index.js
+++ b/src/common/pages/Vouchers/Modal/index.js
@@ -1,13 +1,16 @@
import React from 'react';
import {inject, observer} from 'mobx-react';
-import {Link} from 'react-router';
+import {Link, withRouter} from 'react-router';
import { Modal, Button, Alert, Select } from 'antd';
import './style.scss';
import { Route } from 'react-router-dom'
import {LINKS} from "../../../routes";
import NumberFormat from 'react-number-format';
+import get from 'lodash.get';
const Option = Select.Option;
+
+@withRouter
@inject('appstate')
@observer
export default class ModalVouchersComponent extends React.Component {
@@ -26,17 +29,25 @@ export default class ModalVouchersComponent extends React.Component {
this.vouchersStore = props.appstate.vouchers;
}
- componentDidMount() {}
+ componentDidMount() {
+ const {item} = this.props.appstate;
+
+ item.getDetail(this.props.data.id);
+ }
render() {
+ const {item} = this.props.appstate;
const {data = {}, isVisible = false, onOk = () => {}, onCancel = () => {}, title='Modal'} = this.props;
- let image = ''
- if(data.images.logo.includes('http')){
- image = data.images.logo;
- }else{
- image = this.http.appendImagePath(data.images.logo);
+ let image = get(data, 'images.logo', '');
+
+ if (!image.includes('http')) {
+ image = this.http.appendImagePath(image);
}
+ // console.log(item.selectedData);
+
+ const additional_data = get(data, 'additional_data', {}) || {};
+
return (
{data.description}
- {(data.additional_data.information != null) &&
Information
- {data.additional_data.information}
+ {additional_data.information}
} type="success" />}
@@ -88,11 +99,10 @@ export default class ModalVouchersComponent extends React.Component {
placeholder="Please Select your Option"
optionFilterProp="children"
onChange={(value) => {
- this.setState({selectedOption: value})
- this.setState({hidden: 'none'})
+ this.setState({selectedOption: value});
+ this.setState({hidden: 'none'});
// console.log('onChange',value);
- const points = data.sku.filter(item => item.id == value);
- console.log(points[0].price,'points',points[0].name);
+ const points = item.selectedData.sku.filter(item => item.id == value);
this.setState({
skuName :points[0].name,
skuPrice : points[0].price,
@@ -104,9 +114,27 @@ export default class ModalVouchersComponent extends React.Component {
this.setState({hidden: 'inline'})
}}
>
- {data.sku.map((item, index) => {
- return