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

3
.gitignore vendored
View File

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

View File

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

View File

@@ -56,6 +56,7 @@ export const receiveCustomerDetails = (json) => ({
export const fetchCartCount = () => { export const fetchCartCount = () => {
return dispatch => { return dispatch => {
<<<<<<< HEAD
dispatch(requestShopCartCount()); dispatch(requestShopCartCount());
//TODO : fetch cart count from woocommerce (requires plugin) //TODO : fetch cart count from woocommerce (requires plugin)
dispatch(receiveShopCartCount(0)); dispatch(receiveShopCartCount(0));
@@ -68,6 +69,17 @@ export const fetchCartCount = () => {
client.onError(error, dispatch); 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) => { export const fetchShopPackages = (cl, search) => {
return dispatch => { return dispatch => {
dispatch(requestShopPackages()); dispatch(requestShopPackages());
let searchParam = search ? '?search=' +search : ''
return client.fetch({ return client.fetch({
url: `${API_SERVER}/coMarket/api/getShopPackages`, url: `${API_SERVER}/wp-json/wc/v2/products` + searchParam,
method: 'post', // TODO: Add comercialLead parameter after the support for it is added on backend
data: {
idCommercialLead: (cl && cl.value) || 0, // method: 'post',
search // data: {
} // idCommercialLead: (cl && cl.value) || 0,
}) // search
// }
})
.then(response => { .then(response => {
if(response.data && response.data.packages){ if (response.data) {
dispatch(recieveShopPackages(response.data.packages)) dispatch(recieveShopPackages(response.data))
} }
}) })
.catch(error => { .catch(error => {
@@ -63,22 +66,23 @@ const generateClOptions = (commercialLeads) => {
export const fetchShopCommercialLeads = () => { export const fetchShopCommercialLeads = () => {
return dispatch => { return dispatch => {
dispatch(requestShopCommercialLeads()); dispatch(requestShopCommercialLeads());
return client.fetch({url: `${API_SERVER}/coMarket/api/getAllCommercialLeads`}) // TODO: FetchcomercialLead after the support for it is added on backend
.then(response => { // return client.fetch({url: `${API_SERVER}/coMarket/api/getAllCommercialLeads`})
if(response.data && response.data.commercialLeads){ // .then(response => {
const clOptions = generateClOptions(response.data.commercialLeads); // if(response.data && response.data.commercialLeads){
dispatch(recieveShopCommercialLeads(clOptions)); const clOptions = generateClOptions([{ "idCommercialLead": 14, "commercialLeadName": "Coor Service Management", "mail": "rikard@co-ideation.com" }]);
if (clOptions.length) { dispatch(recieveShopCommercialLeads(clOptions));
dispatch(selectCommercialLead(clOptions[0])); if (clOptions.length) {
dispatch(fetchShopPackages(clOptions[0])); dispatch(selectCommercialLead(clOptions[0]));
} dispatch(fetchShopPackages(clOptions[0]));
} }
})
.catch(error => {
client.onError(error, dispatch);
});
} }
// })
// .catch(error => {
// client.onError(error, dispatch);
// });
} }
// }
export const selectCommercialLead = (cl) => ({ export const selectCommercialLead = (cl) => ({
type: SELECT_SHOP_COMMERCIAL_LEAD, type: SELECT_SHOP_COMMERCIAL_LEAD,

View File

@@ -62,6 +62,7 @@ export const validateAccessToken = (token) => {
}) })
.catch(error => { .catch(error => {
localStorage.removeItem('accessToken');
htmlClient.onError(error, dispatch); htmlClient.onError(error, dispatch);
}); });
} }
@@ -161,6 +162,7 @@ const validateRefreshToken = () => {
export const getModules = () => { export const getModules = () => {
return dispatch => { return dispatch => {
dispatch(requestModules()); dispatch(requestModules());
<<<<<<< HEAD
//TODO : check how to solve modules, don't hardocde values //TODO : check how to solve modules, don't hardocde values
const modules={ const modules={
modules:{ modules:{
@@ -233,6 +235,77 @@ export const getModules = () => {
htmlClient.onError(error, dispatch); 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 && !isLoading) &&
shopPackages.map((shopPackage, mapKey) => <ShopItem key={shopPackage.idPackage} shopPackages.map((shopPackage, mapKey) => <ShopItem key={shopPackage.id}
idCommercialLead={selectedCommercialLead.value} idCommercialLead={selectedCommercialLead.value}
shopPackage={shopPackage}/>) shopPackage={shopPackage}/>)
} }
</Row> </Row>
</WiaasBox> </WiaasBox>
</Col> </Col>a
</Row> </Row>
</div> </div>
); );

View File

@@ -14,10 +14,10 @@ class ShopItem extends Component {
return ( return (
<Col xl="3" lg="4" md="6" sm="12" xs="12"> <Col xl="3" lg="4" md="6" sm="12" xs="12">
<Card className="shop-package-item"> <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> <CardBody>
<CardTitle className="shop-package-title"> <CardTitle className="shop-package-title">
<Link to={`/co-market/${idCommercialLead}/${shopPackage.idPackage}`}> <Link to={`/co-market/${idCommercialLead}/${shopPackage.id}`}>
{this.getShopItemPackageTitle(shopPackage.name)} {this.getShopItemPackageTitle(shopPackage.name)}
</Link> </Link>
</CardTitle> </CardTitle>
@@ -30,7 +30,7 @@ class ShopItem extends Component {
<span className={'flag-icon flag-icon-' + shopPackage.countryCode}></span> <span className={'flag-icon flag-icon-' + shopPackage.countryCode}></span>
</div> </div>
<div className="shop-package-details-btn-layer"> <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> <Button className="shop-package-details-btn">{coMarketTexts.buttons.DETAILS}</Button>
</Link> </Link>
</div> </div>