Connected and enabled co-maket

This commit is contained in:
Nedim Uka
2018-08-08 14:40:00 +02:00
parent 5d84f53ea7
commit 0b899c09af
7 changed files with 202 additions and 126 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
/log
*.env
!environment.env
.idea

View File

@@ -4300,21 +4300,19 @@
"bundled": true,
"optional": true,
"requires": {
"delegates": "1.0.0",
"readable-stream": "2.3.6"
"delegates": "^1.0.0",
"readable-stream": "^2.0.6"
}
},
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"optional": true
"bundled": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"optional": true,
"requires": {
"balanced-match": "1.0.0",
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
@@ -4325,18 +4323,15 @@
},
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"optional": true
"bundled": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"optional": true
"bundled": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"optional": true
"bundled": true
},
"core-util-is": {
"version": "1.0.2",
@@ -4371,7 +4366,7 @@
"bundled": true,
"optional": true,
"requires": {
"minipass": "2.2.4"
"minipass": "^2.2.1"
}
},
"fs.realpath": {
@@ -4384,14 +4379,14 @@
"bundled": true,
"optional": true,
"requires": {
"aproba": "1.2.0",
"console-control-strings": "1.1.0",
"has-unicode": "2.0.1",
"object-assign": "4.1.1",
"signal-exit": "3.0.2",
"string-width": "1.0.2",
"strip-ansi": "3.0.1",
"wide-align": "1.1.2"
"aproba": "^1.0.3",
"console-control-strings": "^1.0.0",
"has-unicode": "^2.0.0",
"object-assign": "^4.1.0",
"signal-exit": "^3.0.0",
"string-width": "^1.0.1",
"strip-ansi": "^3.0.1",
"wide-align": "^1.1.0"
}
},
"glob": {
@@ -4399,12 +4394,12 @@
"bundled": true,
"optional": true,
"requires": {
"fs.realpath": "1.0.0",
"inflight": "1.0.6",
"inherits": "2.0.3",
"minimatch": "3.0.4",
"once": "1.4.0",
"path-is-absolute": "1.0.1"
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.0.4",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"has-unicode": {
@@ -4417,7 +4412,7 @@
"bundled": true,
"optional": true,
"requires": {
"safer-buffer": "2.1.2"
"safer-buffer": "^2.1.0"
}
},
"ignore-walk": {
@@ -4425,7 +4420,7 @@
"bundled": true,
"optional": true,
"requires": {
"minimatch": "3.0.4"
"minimatch": "^3.0.4"
}
},
"inflight": {
@@ -4433,14 +4428,13 @@
"bundled": true,
"optional": true,
"requires": {
"once": "1.4.0",
"wrappy": "1.0.2"
"once": "^1.3.0",
"wrappy": "1"
}
},
"inherits": {
"version": "2.0.3",
"bundled": true,
"optional": true
"bundled": true
},
"ini": {
"version": "1.3.5",
@@ -4450,9 +4444,8 @@
"is-fullwidth-code-point": {
"version": "1.0.0",
"bundled": true,
"optional": true,
"requires": {
"number-is-nan": "1.0.1"
"number-is-nan": "^1.0.0"
}
},
"isarray": {
@@ -4463,23 +4456,20 @@
"minimatch": {
"version": "3.0.4",
"bundled": true,
"optional": true,
"requires": {
"brace-expansion": "1.1.11"
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
"bundled": true,
"optional": true
"bundled": true
},
"minipass": {
"version": "2.2.4",
"bundled": true,
"optional": true,
"requires": {
"safe-buffer": "5.1.1",
"yallist": "3.0.2"
"safe-buffer": "^5.1.1",
"yallist": "^3.0.0"
}
},
"minizlib": {
@@ -4487,13 +4477,12 @@
"bundled": true,
"optional": true,
"requires": {
"minipass": "2.2.4"
"minipass": "^2.2.1"
}
},
"mkdirp": {
"version": "0.5.1",
"bundled": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@@ -4508,9 +4497,9 @@
"bundled": true,
"optional": true,
"requires": {
"debug": "2.6.9",
"iconv-lite": "0.4.21",
"sax": "1.2.4"
"debug": "^2.1.2",
"iconv-lite": "^0.4.4",
"sax": "^1.2.4"
}
},
"node-pre-gyp": {
@@ -4518,16 +4507,16 @@
"bundled": true,
"optional": true,
"requires": {
"detect-libc": "1.0.3",
"mkdirp": "0.5.1",
"needle": "2.2.0",
"nopt": "4.0.1",
"npm-packlist": "1.1.10",
"npmlog": "4.1.2",
"rc": "1.2.7",
"rimraf": "2.6.2",
"semver": "5.5.0",
"tar": "4.4.1"
"detect-libc": "^1.0.2",
"mkdirp": "^0.5.1",
"needle": "^2.2.0",
"nopt": "^4.0.1",
"npm-packlist": "^1.1.6",
"npmlog": "^4.0.2",
"rc": "^1.1.7",
"rimraf": "^2.6.1",
"semver": "^5.3.0",
"tar": "^4"
}
},
"nopt": {
@@ -4535,8 +4524,8 @@
"bundled": true,
"optional": true,
"requires": {
"abbrev": "1.1.1",
"osenv": "0.1.5"
"abbrev": "1",
"osenv": "^0.1.4"
}
},
"npm-bundled": {
@@ -4549,8 +4538,8 @@
"bundled": true,
"optional": true,
"requires": {
"ignore-walk": "3.0.1",
"npm-bundled": "1.0.3"
"ignore-walk": "^3.0.1",
"npm-bundled": "^1.0.1"
}
},
"npmlog": {
@@ -4558,16 +4547,15 @@
"bundled": true,
"optional": true,
"requires": {
"are-we-there-yet": "1.1.4",
"console-control-strings": "1.1.0",
"gauge": "2.7.4",
"set-blocking": "2.0.0"
"are-we-there-yet": "~1.1.2",
"console-control-strings": "~1.1.0",
"gauge": "~2.7.3",
"set-blocking": "~2.0.0"
}
},
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"optional": true
"bundled": true
},
"object-assign": {
"version": "4.1.1",
@@ -4577,9 +4565,8 @@
"once": {
"version": "1.4.0",
"bundled": true,
"optional": true,
"requires": {
"wrappy": "1.0.2"
"wrappy": "1"
}
},
"os-homedir": {
@@ -4597,8 +4584,8 @@
"bundled": true,
"optional": true,
"requires": {
"os-homedir": "1.0.2",
"os-tmpdir": "1.0.2"
"os-homedir": "^1.0.0",
"os-tmpdir": "^1.0.0"
}
},
"path-is-absolute": {
@@ -4616,10 +4603,10 @@
"bundled": true,
"optional": true,
"requires": {
"deep-extend": "0.5.1",
"ini": "1.3.5",
"minimist": "1.2.0",
"strip-json-comments": "2.0.1"
"deep-extend": "^0.5.1",
"ini": "~1.3.0",
"minimist": "^1.2.0",
"strip-json-comments": "~2.0.1"
},
"dependencies": {
"minimist": {
@@ -4634,13 +4621,13 @@
"bundled": true,
"optional": true,
"requires": {
"core-util-is": "1.0.2",
"inherits": "2.0.3",
"isarray": "1.0.0",
"process-nextick-args": "2.0.0",
"safe-buffer": "5.1.1",
"string_decoder": "1.1.1",
"util-deprecate": "1.0.2"
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
},
"rimraf": {
@@ -4648,7 +4635,7 @@
"bundled": true,
"optional": true,
"requires": {
"glob": "7.1.2"
"glob": "^7.0.5"
}
},
"safe-buffer": {
@@ -4683,11 +4670,10 @@
"string-width": {
"version": "1.0.2",
"bundled": true,
"optional": true,
"requires": {
"code-point-at": "1.1.0",
"is-fullwidth-code-point": "1.0.0",
"strip-ansi": "3.0.1"
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
"strip-ansi": "^3.0.0"
}
},
"string_decoder": {
@@ -4695,14 +4681,14 @@
"bundled": true,
"optional": true,
"requires": {
"safe-buffer": "5.1.1"
"safe-buffer": "~5.1.0"
}
},
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
"requires": {
"ansi-regex": "2.1.1"
"ansi-regex": "^2.0.0"
}
},
"strip-json-comments": {
@@ -4715,13 +4701,13 @@
"bundled": true,
"optional": true,
"requires": {
"chownr": "1.0.1",
"fs-minipass": "1.2.5",
"minipass": "2.2.4",
"minizlib": "1.1.0",
"mkdirp": "0.5.1",
"safe-buffer": "5.1.1",
"yallist": "3.0.2"
"chownr": "^1.0.1",
"fs-minipass": "^1.2.5",
"minipass": "^2.2.4",
"minizlib": "^1.1.0",
"mkdirp": "^0.5.0",
"safe-buffer": "^5.1.1",
"yallist": "^3.0.2"
}
},
"util-deprecate": {
@@ -4734,7 +4720,7 @@
"bundled": true,
"optional": true,
"requires": {
"string-width": "1.0.2"
"string-width": "^1.0.2"
}
},
"wrappy": {

View File

@@ -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
}
}

View File

@@ -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);
// 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);
});
}
// })
// .catch(error => {
// client.onError(error, dispatch);
// });
}
// }
export const selectCommercialLead = (cl) => ({
type: SELECT_SHOP_COMMERCIAL_LEAD,

View File

@@ -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
}
}

View File

@@ -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>
);

View File

@@ -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>