|
@@ -18,11 +18,12 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
|
|
|
|
|
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
|
|
|
|
|
|
|
|
+function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
|
|
|
|
|
+
|
|
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
|
|
|
|
|
|
var dom = React.createElement;
|
|
var dom = React.createElement;
|
|
|
-
|
|
|
|
|
-var CONFIG = _defineProperty({
|
|
|
|
|
|
|
+var CONFIG = {
|
|
|
"prof-a": {
|
|
"prof-a": {
|
|
|
contactInformation: true,
|
|
contactInformation: true,
|
|
|
productFilter: function productFilter(products) {
|
|
productFilter: function productFilter(products) {
|
|
@@ -40,19 +41,30 @@ var CONFIG = _defineProperty({
|
|
|
categories: [["Higiene", "higiene"], ["Máscaras", "mascaras"], ["Ácido Hialurónico", "acido-hialuronico"], ["Peeling", "peeling"], ["Corporales", "corporales"], ["Hombres", "hombres"], ["Protección Intensiva", "proteccion-intensiva"], ["Monodosis", "monodosis"], ["Activos Concentrados", "activos-concentrados"], ["Protección Solar", "proteccion-solar"]]
|
|
categories: [["Higiene", "higiene"], ["Máscaras", "mascaras"], ["Ácido Hialurónico", "acido-hialuronico"], ["Peeling", "peeling"], ["Corporales", "corporales"], ["Hombres", "hombres"], ["Protección Intensiva", "proteccion-intensiva"], ["Monodosis", "monodosis"], ["Activos Concentrados", "activos-concentrados"], ["Protección Solar", "proteccion-solar"]]
|
|
|
},
|
|
},
|
|
|
"dom-a": {
|
|
"dom-a": {
|
|
|
|
|
+ contactInformation: false,
|
|
|
|
|
+ productFilter: function productFilter(products) {
|
|
|
|
|
+ return Object.keys(products).reduce(function (acc, x) {
|
|
|
|
|
+ var filtered = products[x].filter(function (p) {
|
|
|
|
|
+ var v = p.variants.filter(function (v) {
|
|
|
|
|
+ return v.code < 2000;
|
|
|
|
|
+ });
|
|
|
|
|
+ return v.length || p.category.includes('Protección Solar');
|
|
|
|
|
+ });
|
|
|
|
|
+ return _objectSpread({}, acc, _defineProperty({}, x, filtered));
|
|
|
|
|
+ }, {});
|
|
|
|
|
+ },
|
|
|
|
|
+ prices: true,
|
|
|
|
|
+ categories: [["Higiene", "higiene"], ["Ácido Hialurónico", "acido-hialuronico"], ["Corporales", "corporales"], ["Hombres", "hombres"], ["Protección Intensiva", "proteccion-intensiva"], ["Monodosis", "monodosis"], ["Protección Solar", "proteccion-solar"]]
|
|
|
|
|
+ },
|
|
|
|
|
+ "dom-b": {
|
|
|
contactInformation: false,
|
|
contactInformation: false,
|
|
|
productFilter: function productFilter(products) {
|
|
productFilter: function productFilter(products) {
|
|
|
return products;
|
|
return products;
|
|
|
},
|
|
},
|
|
|
- prices: true
|
|
|
|
|
|
|
+ prices: false,
|
|
|
|
|
+ categories: [["Higiene", "higiene"], ["Ácido Hialurónico", "acido-hialuronico"], ["Corporales", "corporales"], ["Hombres", "hombres"], ["Protección Intensiva", "proteccion-intensiva"], ["Monodosis", "monodosis"], ["Protección Solar", "proteccion-solar"]]
|
|
|
}
|
|
}
|
|
|
-}, "dom-a", {
|
|
|
|
|
- contactInformation: false,
|
|
|
|
|
- productFilter: function productFilter(products) {
|
|
|
|
|
- return products;
|
|
|
|
|
- },
|
|
|
|
|
- prices: false
|
|
|
|
|
-});
|
|
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
var Tag = function Tag(label, key, className) {
|
|
var Tag = function Tag(label, key, className) {
|
|
|
return dom("div", {
|
|
return dom("div", {
|
|
@@ -72,14 +84,17 @@ var Section = function Section(title, paragraph, prepend) {
|
|
|
}, prepend, paragraph));
|
|
}, prepend, paragraph));
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-var Product = function Product(product, key) {
|
|
|
|
|
|
|
+var Product = function Product(product, key, prices) {
|
|
|
return dom("div", {
|
|
return dom("div", {
|
|
|
className: "product-container"
|
|
className: "product-container"
|
|
|
}, dom("div", {
|
|
}, dom("div", {
|
|
|
- className: "row valign-wrapper"
|
|
|
|
|
|
|
+ className: "row"
|
|
|
}, dom("div", {
|
|
}, dom("div", {
|
|
|
class: "col s2"
|
|
class: "col s2"
|
|
|
- }, dom("img", {
|
|
|
|
|
|
|
+ }, prices ? dom("img", {
|
|
|
|
|
+ src: "images/_img/".concat(product.variants[0].img || product.img, ".png"),
|
|
|
|
|
+ className: "responsive-img"
|
|
|
|
|
+ }) : dom("img", {
|
|
|
src: "images/_img/".concat(product.img || product.variants[0].img, ".png"),
|
|
src: "images/_img/".concat(product.img || product.variants[0].img, ".png"),
|
|
|
className: "responsive-img"
|
|
className: "responsive-img"
|
|
|
})), dom("div", {
|
|
})), dom("div", {
|
|
@@ -91,7 +106,19 @@ var Product = function Product(product, key) {
|
|
|
}, dom("p", {
|
|
}, dom("p", {
|
|
|
className: "product-short-desc",
|
|
className: "product-short-desc",
|
|
|
lang: "es"
|
|
lang: "es"
|
|
|
- }, product.shortDesc)))), dom("div", null, product.fullDesc && Section('Descripción', product.fullDesc), product.application && Section('Aplicación', product.application), product.actives && Section('', product.actives.map(function (p) {
|
|
|
|
|
|
|
+ }, product.shortDesc), prices && dom("div", {
|
|
|
|
|
+ className: "product-price"
|
|
|
|
|
+ }, dom("div", {
|
|
|
|
|
+ className: "price-tag"
|
|
|
|
|
+ }, dom("h5", null, dom("span", {
|
|
|
|
|
+ className: "price-symbol"
|
|
|
|
|
+ }, "$"), dom("span", {
|
|
|
|
|
+ className: "price-total"
|
|
|
|
|
+ }, product.variants[0].sellPrice), dom("sup", {
|
|
|
|
|
+ className: "price-decimal"
|
|
|
|
|
+ }, "00"))), dom("div", {
|
|
|
|
|
+ className: "product-size"
|
|
|
|
|
+ }, "Cont. ", product.variants[0].content))))), dom("div", null, product.fullDesc && Section('Descripción', product.fullDesc), product.application && Section('Aplicación', product.application), product.actives && Section('', product.actives.map(function (p) {
|
|
|
return Tag(p);
|
|
return Tag(p);
|
|
|
}), product.ph && Tag("PH ".concat(product.ph), null, 'is-ph'))));
|
|
}), product.ph && Tag("PH ".concat(product.ph), null, 'is-ph'))));
|
|
|
};
|
|
};
|
|
@@ -107,7 +134,7 @@ var Category = function Category(category, products, prices) {
|
|
|
}, products.map(function (p, i) {
|
|
}, products.map(function (p, i) {
|
|
|
return dom("div", {
|
|
return dom("div", {
|
|
|
className: "collection-item"
|
|
className: "collection-item"
|
|
|
- }, Product(p, i));
|
|
|
|
|
|
|
+ }, Product(p, i, prices));
|
|
|
})));
|
|
})));
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -131,6 +158,7 @@ var ToC = function ToC(categories, products) {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
var Vademecum = function Vademecum(categories, products, prices) {
|
|
var Vademecum = function Vademecum(categories, products, prices) {
|
|
|
|
|
+ console.log("prices?", prices);
|
|
|
return categories.map(function (categoryName, i) {
|
|
return categories.map(function (categoryName, i) {
|
|
|
return dom("div", {
|
|
return dom("div", {
|
|
|
key: i
|
|
key: i
|
|
@@ -225,7 +253,7 @@ function (_React$Component) {
|
|
|
_classCallCheck(this, VademecumData);
|
|
_classCallCheck(this, VademecumData);
|
|
|
|
|
|
|
|
_this = _possibleConstructorReturn(this, _getPrototypeOf(VademecumData).call(this, props));
|
|
_this = _possibleConstructorReturn(this, _getPrototypeOf(VademecumData).call(this, props));
|
|
|
- var config = CONFIG["prof-a"];
|
|
|
|
|
|
|
+ var config = CONFIG["dom-a"];
|
|
|
_this.state = {
|
|
_this.state = {
|
|
|
config: config,
|
|
config: config,
|
|
|
categories: config.categories,
|
|
categories: config.categories,
|
|
@@ -243,6 +271,8 @@ function (_React$Component) {
|
|
|
fetch('data/products-by-category.json').then(function (response) {
|
|
fetch('data/products-by-category.json').then(function (response) {
|
|
|
return response.json();
|
|
return response.json();
|
|
|
}).then(this.state.config.productFilter).then(function (data) {
|
|
}).then(this.state.config.productFilter).then(function (data) {
|
|
|
|
|
+ console.log("data", data);
|
|
|
|
|
+
|
|
|
_this2.setState({
|
|
_this2.setState({
|
|
|
products: data
|
|
products: data
|
|
|
});
|
|
});
|
|
@@ -255,7 +285,6 @@ function (_React$Component) {
|
|
|
categories = _this$state.categories,
|
|
categories = _this$state.categories,
|
|
|
products = _this$state.products,
|
|
products = _this$state.products,
|
|
|
config = _this$state.config;
|
|
config = _this$state.config;
|
|
|
- console.log(config.contactInformation);
|
|
|
|
|
|
|
|
|
|
if (products) {
|
|
if (products) {
|
|
|
return dom("div", null, ToC(categories, products), Vademecum(categories, products, config.prices), config.contactInformation && ContactInformation());
|
|
return dom("div", null, ToC(categories, products), Vademecum(categories, products, config.prices), config.contactInformation && ContactInformation());
|