Add package bundles
This commit is contained in:
@@ -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 => {
|
||||
|
||||
@@ -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}`}>
|
||||
|
||||
16
frontend/src/helpers/PackageHelper.js
Normal file
16
frontend/src/helpers/PackageHelper.js
Normal 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,
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user