Connected and enabled co-maket
This commit is contained in:
@@ -56,6 +56,7 @@ export const receiveCustomerDetails = (json) => ({
|
||||
|
||||
export const fetchCartCount = () => {
|
||||
return dispatch => {
|
||||
<<<<<<< HEAD
|
||||
dispatch(requestShopCartCount());
|
||||
//TODO : fetch cart count from woocommerce (requires plugin)
|
||||
dispatch(receiveShopCartCount(0));
|
||||
@@ -68,6 +69,17 @@ export const fetchCartCount = () => {
|
||||
client.onError(error, dispatch);
|
||||
});
|
||||
*/
|
||||
=======
|
||||
// TODO Fetch correct cart count after adding support to cart on API
|
||||
// dispatch(requestShopCartCount());
|
||||
// return client.fetch({url: `${API_SERVER}/cart/api/getCartCount`}).then(response => {
|
||||
// if (typeof response.data !== 'undefined' && 'cartItemsCount' in response.data) {
|
||||
dispatch(receiveShopCartCount(0));
|
||||
// }
|
||||
// }).catch(error => {
|
||||
// client.onError(error, dispatch);
|
||||
// });
|
||||
>>>>>>> 6e0c26d... Connected and enabled co-maket
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,17 +24,20 @@ const recieveShopPackages = (json) => ({
|
||||
export const fetchShopPackages = (cl, search) => {
|
||||
return dispatch => {
|
||||
dispatch(requestShopPackages());
|
||||
let searchParam = search ? '?search=' +search : ''
|
||||
return client.fetch({
|
||||
url: `${API_SERVER}/coMarket/api/getShopPackages`,
|
||||
method: 'post',
|
||||
data: {
|
||||
idCommercialLead: (cl && cl.value) || 0,
|
||||
search
|
||||
}
|
||||
})
|
||||
url: `${API_SERVER}/wp-json/wc/v2/products` + searchParam,
|
||||
// TODO: Add comercialLead parameter after the support for it is added on backend
|
||||
|
||||
// method: 'post',
|
||||
// data: {
|
||||
// idCommercialLead: (cl && cl.value) || 0,
|
||||
// search
|
||||
// }
|
||||
})
|
||||
.then(response => {
|
||||
if(response.data && response.data.packages){
|
||||
dispatch(recieveShopPackages(response.data.packages))
|
||||
if (response.data) {
|
||||
dispatch(recieveShopPackages(response.data))
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
@@ -63,22 +66,23 @@ const generateClOptions = (commercialLeads) => {
|
||||
export const fetchShopCommercialLeads = () => {
|
||||
return dispatch => {
|
||||
dispatch(requestShopCommercialLeads());
|
||||
return client.fetch({url: `${API_SERVER}/coMarket/api/getAllCommercialLeads`})
|
||||
.then(response => {
|
||||
if(response.data && response.data.commercialLeads){
|
||||
const clOptions = generateClOptions(response.data.commercialLeads);
|
||||
dispatch(recieveShopCommercialLeads(clOptions));
|
||||
if (clOptions.length) {
|
||||
dispatch(selectCommercialLead(clOptions[0]));
|
||||
dispatch(fetchShopPackages(clOptions[0]));
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
client.onError(error, dispatch);
|
||||
});
|
||||
// TODO: FetchcomercialLead after the support for it is added on backend
|
||||
// return client.fetch({url: `${API_SERVER}/coMarket/api/getAllCommercialLeads`})
|
||||
// .then(response => {
|
||||
// if(response.data && response.data.commercialLeads){
|
||||
const clOptions = generateClOptions([{ "idCommercialLead": 14, "commercialLeadName": "Coor Service Management", "mail": "rikard@co-ideation.com" }]);
|
||||
dispatch(recieveShopCommercialLeads(clOptions));
|
||||
if (clOptions.length) {
|
||||
dispatch(selectCommercialLead(clOptions[0]));
|
||||
dispatch(fetchShopPackages(clOptions[0]));
|
||||
}
|
||||
}
|
||||
// })
|
||||
// .catch(error => {
|
||||
// client.onError(error, dispatch);
|
||||
// });
|
||||
}
|
||||
// }
|
||||
|
||||
export const selectCommercialLead = (cl) => ({
|
||||
type: SELECT_SHOP_COMMERCIAL_LEAD,
|
||||
|
||||
@@ -62,6 +62,7 @@ export const validateAccessToken = (token) => {
|
||||
|
||||
})
|
||||
.catch(error => {
|
||||
localStorage.removeItem('accessToken');
|
||||
htmlClient.onError(error, dispatch);
|
||||
});
|
||||
}
|
||||
@@ -161,6 +162,7 @@ const validateRefreshToken = () => {
|
||||
export const getModules = () => {
|
||||
return dispatch => {
|
||||
dispatch(requestModules());
|
||||
<<<<<<< HEAD
|
||||
//TODO : check how to solve modules, don't hardocde values
|
||||
const modules={
|
||||
modules:{
|
||||
@@ -233,6 +235,77 @@ export const getModules = () => {
|
||||
htmlClient.onError(error, dispatch);
|
||||
});
|
||||
*/
|
||||
=======
|
||||
let appModules = {
|
||||
modules: {
|
||||
modules: [
|
||||
{
|
||||
id: '15',
|
||||
name: 'Terms',
|
||||
menuName: 'Terms',
|
||||
url: 'terms',
|
||||
isInMenu: '0'
|
||||
},
|
||||
{
|
||||
id: '19',
|
||||
name: 'Cart',
|
||||
menuName: 'Cart',
|
||||
url: 'cart',
|
||||
isInMenu: '0'
|
||||
},
|
||||
{
|
||||
id: '14',
|
||||
name: 'ProfileSettings',
|
||||
menuName: 'ProfileSettings',
|
||||
url: 'profileSettings',
|
||||
isInMenu: '0'
|
||||
},
|
||||
{
|
||||
id: '23',
|
||||
name: 'OrderProjects',
|
||||
menuName: 'OrderProjects',
|
||||
url: 'orderProjects',
|
||||
isInMenu: '0'
|
||||
},
|
||||
{
|
||||
id: '1',
|
||||
name: 'Dashboards',
|
||||
menuName: 'Overview',
|
||||
url: 'dashboards',
|
||||
isInMenu: '1'
|
||||
},
|
||||
{
|
||||
id: '18',
|
||||
name: 'CoMarket',
|
||||
menuName: 'Co-Market',
|
||||
url: 'co-market',
|
||||
isInMenu: '1'
|
||||
}
|
||||
],
|
||||
subModules: {
|
||||
'co-market': [
|
||||
{
|
||||
moduleUrl: 'co-market',
|
||||
menuName: 'Orders',
|
||||
name: 'Orders',
|
||||
url: 'orders'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
return dispatch(recieveModules(appModules));
|
||||
// return htmlClient.fetch({
|
||||
// url: `${API_SERVER}/login/api/getModules`,
|
||||
// })
|
||||
// .then(response => {
|
||||
// dispatch(recieveModules(response.data));
|
||||
// })
|
||||
// .catch(error => {
|
||||
// htmlClient.onError(error, dispatch);
|
||||
// });
|
||||
// return {activeModule : ""}
|
||||
>>>>>>> 6e0c26d... Connected and enabled co-maket
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,13 +40,13 @@ class CoMarketPackagesContainer extends Component {
|
||||
}
|
||||
{
|
||||
(shopPackages && !isLoading) &&
|
||||
shopPackages.map((shopPackage, mapKey) => <ShopItem key={shopPackage.idPackage}
|
||||
shopPackages.map((shopPackage, mapKey) => <ShopItem key={shopPackage.id}
|
||||
idCommercialLead={selectedCommercialLead.value}
|
||||
shopPackage={shopPackage}/>)
|
||||
}
|
||||
</Row>
|
||||
</WiaasBox>
|
||||
</Col>
|
||||
</Col>a
|
||||
</Row>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -14,10 +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={{'background-image': 'url("'+(shopPackage.photo || 'static/img/no-photo-package.jpg') +'")'}}></div>
|
||||
<div className="shop-image-photo" style={{'backgroundImage': 'url("'+(shopPackage.images[0].src || 'static/img/no-photo-package.jpg') +'")'}}></div>
|
||||
<CardBody>
|
||||
<CardTitle className="shop-package-title">
|
||||
<Link to={`/co-market/${idCommercialLead}/${shopPackage.idPackage}`}>
|
||||
<Link to={`/co-market/${idCommercialLead}/${shopPackage.id}`}>
|
||||
{this.getShopItemPackageTitle(shopPackage.name)}
|
||||
</Link>
|
||||
</CardTitle>
|
||||
@@ -30,7 +30,7 @@ class ShopItem extends Component {
|
||||
<span className={'flag-icon flag-icon-' + shopPackage.countryCode}></span>
|
||||
</div>
|
||||
<div className="shop-package-details-btn-layer">
|
||||
<Link id={'shop-package-details-' + shopPackage.idPackage} to={`/co-market/${idCommercialLead}/${shopPackage.idPackage}`}>
|
||||
<Link id={'shop-package-details-' + shopPackage.id} to={`/co-market/${idCommercialLead}/${shopPackage.id}`}>
|
||||
<Button className="shop-package-details-btn">{coMarketTexts.buttons.DETAILS}</Button>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user