Add package bundles

This commit is contained in:
Almira Krdzic
2018-08-26 15:41:08 +02:00
parent 6017ae8cf3
commit 5ac3bfff36
9 changed files with 90 additions and 30 deletions

View File

@@ -9,6 +9,8 @@ import {
RECIEVE_SHOP_COMMERCIAL_LEADS,
SELECT_SHOP_COMMERCIAL_LEAD
} from '../../constants/coMarketConstants';
import { fromWCPackage } from '../../helpers/PackageHelper';
const client = new HtmlClient();
const requestShopPackages = () => ({
@@ -37,7 +39,7 @@ export const fetchShopPackages = (cl, search) => {
})
.then(response => {
if (response.data) {
dispatch(recieveShopPackages(response.data))
dispatch(recieveShopPackages(response.data.map(wcPackage => fromWCPackage(wcPackage))))
}
})
.catch(error => {

View File

@@ -14,7 +14,10 @@ class ShopItem extends Component {
return (
<Col xl="3" lg="4" md="6" sm="12" xs="12">
<Card className="shop-package-item">
<div className="shop-image-photo" style={{'backgroundImage': 'url("'+(shopPackage.images[0].src || 'static/img/no-photo-package.jpg') +'")'}}></div>
<div
className="shop-image-photo"
style={{'backgroundImage': `url(${shopPackage.image})`}}
/>
<CardBody>
<CardTitle className="shop-package-title">
<Link to={`/co-market/${idCommercialLead}/${shopPackage.id}`}>

View File

@@ -0,0 +1,16 @@
const DEFAULT_PACKAGE_IMG = 'static/img/no-photo-package.jpg';
export const fromWCPackage = wcPackage => {
return {
id: wcPackage.id,
reference: wcPackage.slug,
image: wcPackage.images[0].src || DEFAULT_PACKAGE_IMG,
name: wcPackage.name,
country: 'Sweden',
countryCode: 'se',
currency: 'SEK',
documents: [],
shortDescription: wcPackage.description,
}
};