items vouchers sudah nempel ke belakang

This commit is contained in:
enggar_ganteng 2019-01-06 01:40:19 +07:00
parent 68ea6966cf
commit 346b306f5f
3 changed files with 43 additions and 18 deletions

View File

@ -31,7 +31,7 @@ export class ItemCard extends React.Component {
return ( return (
<Card className={'itemCard'}> <Card className={'itemCard'}>
<img className={'imageCard'} src={data.image} /> <img className={'imageCard'} src={this.http.appendImagePath(data.images.logo)} />
<p className={'titleCard'}>{data.name}</p> <p className={'titleCard'}>{data.name}</p>
</Card> </Card>
) )

View File

@ -14,10 +14,11 @@ export default class ModalVouchersComponent extends React.Component {
super(props); super(props);
this.props = props; this.props = props;
this.state = { this.state = {
selectedOption: '0 Points', selectedOption: '0',
hidden:'inline' hidden:'inline'
}; };
this.defaultState = Object.assign({}, this.state); this.defaultState = Object.assign({}, this.state);
this.http = props.appstate.http;
} }
componentDidMount() {} componentDidMount() {}
@ -47,12 +48,12 @@ export default class ModalVouchersComponent extends React.Component {
flexDirection: 'column', flexDirection: 'column',
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
background: data.background_color || '#aaa', background: `linear-gradient(${data.background_color_1}, ${data.background_color_2})` || '#aaa',
// height: 500, // background: data.background_color || '#aaa',
flex: 0.3 flex: 0.3
}}> }}>
<img className={'imageModal'} src={data.image} /> <img className={'imageModal'} src={this.http.appendImagePath(data.images.logo)} />
<p className={'titleModal'}>{data.name}</p> <p className={'titleModal'}>{data.name} }</p>
</div> </div>
<div style={{ <div style={{
display: 'flex', display: 'flex',
@ -62,10 +63,10 @@ export default class ModalVouchersComponent extends React.Component {
}}> }}>
<p className={'descriptionModal'} >{data.description}</p> <p className={'descriptionModal'} >{data.description}</p>
{(data.additional_information.length > 0) && <Alert className={'informationAlertModal'} message={ {(data.additional_data.information != null) && <Alert className={'informationAlertModal'} message={
<div className={'informationContainerModal'}> <div className={'informationContainerModal'}>
<p className={'informationTitleModal'}>Information</p> <p className={'informationTitleModal'}>Information</p>
<p className={'informationBodyModal'}>{data.additional_information}</p> <p className={'informationBodyModal'}>{data.additional_data.information}</p>
</div> </div>
} type="success" />} } type="success" />}
@ -85,14 +86,14 @@ export default class ModalVouchersComponent extends React.Component {
console.log(this.state.hidden,'onDropdownVisibleChange') console.log(this.state.hidden,'onDropdownVisibleChange')
}} }}
> >
{data.option.map((item, index) => { {data.sku.map((item, index) => {
return <Option value={item.cost}><div style={{display:'flex',justifyContent:'space-between', width:'100%'}}><span>{item.value}</span> <span style={{color:'#FF6F00', display:this.state.hidden}}>{item.cost}</span></div></Option> return <Option value={item.price}><div style={{display:'flex',justifyContent:'space-between', width:'100%'}}><span>{item.name}</span> <span style={{color:'#FF6F00', display:this.state.hidden}}>{item.price}</span></div></Option>
})} })}
</Select> </Select>
<div className={'costContainerModal'}> <div className={'costContainerModal'}>
<div className={'costLeftPaneModal'}> <div className={'costLeftPaneModal'}>
<p className={'costTitleModal'}>Cost</p> <p className={'costTitleModal'}>Points</p>
<p className={'costValueModal'}>{this.state.selectedOption}</p> <p className={'costValueModal'}>{this.state.selectedOption}</p>
</div> </div>
<div className={'costRightPaneModal'}> <div className={'costRightPaneModal'}>

View File

@ -19,14 +19,25 @@ export default class VouchersComponent extends React.Component {
isOpened: false, isOpened: false,
data: { data: {
name: '', name: '',
image: '', background_color_1:'',
background_color_2:'',
images: {
logo:''
},
description: '', description: '',
additional_information: '', additional_data: {
background_color: '', information:''
option: [ },
// option: [
// {
// value: '',
// cost: ''
// },
// ],
sku: [
{ {
value: '', name: '',
cost: '' price: ''
}, },
] ]
}, },
@ -198,6 +209,19 @@ export default class VouchersComponent extends React.Component {
<Row gutter={10}> <Row gutter={10}>
{ {
( this.vouchersStore.list.length > 0) ?
this.vouchersStore.list.map((item, index) => {
return (<Col onClick={() => this.setState({isOpened: true, data: item})} key={index} span={6}>
<ItemCard data={item}/>
</Col>)
})
: (
<EmptyComponent type="default4" header="" content="There is no voucher in sight"/>
)
}
{/* {
(data.length > 0) ? (data.length > 0) ?
data.map((item, index) => { data.map((item, index) => {
return (<Col onClick={() => this.setState({isOpened: true, data: item})} key={index} span={6}> return (<Col onClick={() => this.setState({isOpened: true, data: item})} key={index} span={6}>
@ -207,7 +231,7 @@ export default class VouchersComponent extends React.Component {
: ( : (
<EmptyComponent type="default4" header="" content="There is no voucher in sight"/> <EmptyComponent type="default4" header="" content="There is no voucher in sight"/>
) )
} } */}
</Row> </Row>
<ModalVouchersComponent <ModalVouchersComponent