"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var react_router_dom_1 = require("react-router-dom");
var routes_1 = require("../../../../apiClient/routes");
var AddToCartIcon_1 = require("./AddToCartIcon");
var axios_1 = require("axios");
var ProductListItem = /** @class */ (function (_super) {
    __extends(ProductListItem, _super);
    function ProductListItem() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ProductListItem.prototype.render = function () {
        var _a = this.props, product = _a.product, onAddToCartClick = _a.onAddToCartClick;
        return (React.createElement(React.Fragment, null,
            React.createElement("article", { className: "col-lg-3 col-md-4 col-sm-6" },
                React.createElement("div", { className: "featured__item" },
                    React.createElement("div", { className: "featured__item__pic set-bg" },
                        React.createElement(react_router_dom_1.Link, { to: "/product/".concat(product.id) },
                            React.createElement("img", { title: "Klikn\u011Bte pro zobrazen\u00ED detailu produktu", src: product.productImageIDs.length > 0
                                    ? "".concat(axios_1.default.defaults.baseURL + (0, routes_1.ProductImageController_GetImage)(product.productImageIDs[0].toString()))
                                    : "/img/featured/feature-1.jpg" })),
                        product.availableQuantity > 0
                            ? React.createElement(AddToCartIcon_1.AddToCartIcon, { onAddToCartClick: onAddToCartClick, product: product })
                            : null),
                    React.createElement("div", { className: "featured__item__text" },
                        React.createElement("h6", null,
                            React.createElement(react_router_dom_1.Link, { to: "/product/".concat(product.id) }, product.name)),
                        React.createElement("h5", null,
                            product.reducedPrice !== undefined && product.reducedPrice > 0 && product.reducedPrice < product.price
                                ? product.reducedPrice.toFixed(2)
                                : product.price.toFixed(2),
                            " K\u010D s DPH"))))));
    };
    return ProductListItem;
}(React.Component));
exports.default = ProductListItem;
//# sourceMappingURL=ProductListItem.js.map