Enabled product bundles
This commit is contained in:
@@ -6,6 +6,7 @@ import Workflow from './workflow';
|
||||
import ActionType from '../enums/ActionType';
|
||||
|
||||
export const Wiaas = (props) => {
|
||||
|
||||
const getSidebarItemClass = actionType => {
|
||||
if (actionType === props.actionType) {
|
||||
return 'selected';
|
||||
@@ -37,7 +38,7 @@ export const Wiaas = (props) => {
|
||||
</div>
|
||||
<div id="wiaas-container">
|
||||
{props.actionType === ActionType.LOG_IN && <Login onLogInClicked={props.onLogInClicked}/>}
|
||||
{props.actionType === ActionType.SEND_ORDER && <Order onOrderClicked={props.onOrderClicked} />}
|
||||
{props.actionType === ActionType.SEND_ORDER && <Order products={props.products} onOrderClicked={props.onOrderClicked} />}
|
||||
{props.actionType === ActionType.WORKFLOW && <Workflow onRetrieveWorkflowClicked={props.onRetrieveWorkflowClicked} />}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,8 +2,42 @@ import React from 'react'
|
||||
|
||||
export const Order = (props) => {
|
||||
|
||||
const { products } = props
|
||||
let bundledProductId
|
||||
|
||||
const imageStyle = {
|
||||
width: "50px",
|
||||
height: "50px",
|
||||
};
|
||||
let displayedProducts = products.map(
|
||||
product => {
|
||||
|
||||
if (product.type === "grouped"){
|
||||
bundledProductId = product.id
|
||||
}
|
||||
|
||||
let images = product.images.map(
|
||||
image => {
|
||||
return (
|
||||
<img key={image.id.toString()} style={imageStyle} src={image.src} />
|
||||
)
|
||||
}
|
||||
)
|
||||
return (
|
||||
<div key={product.id.toString()}>
|
||||
{images}
|
||||
{product.name}
|
||||
</div>
|
||||
)
|
||||
|
||||
}
|
||||
)
|
||||
|
||||
return (
|
||||
<button onClick={props.onOrderClicked} > SEND ORDER </button>
|
||||
<div>
|
||||
{displayedProducts}
|
||||
<button onClick={() => props.onOrderClicked(bundledProductId)} > SEND ORDER </button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user