"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 axios_1 = require("axios");
var react_router_dom_1 = require("react-router-dom");
var routes_1 = require("../../../../apiClient/routes");
var ShoppingCartListItem = /** @class */ (function (_super) {
    __extends(ShoppingCartListItem, _super);
    function ShoppingCartListItem() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ShoppingCartListItem.prototype.render = function () {
        var _a = this.props, cartItem = _a.cartItem, onAddToCartClick = _a.onAddToCartClick, onRemoveFromCartClick = _a.onRemoveFromCartClick, onDeleteFromCartClick = _a.onDeleteFromCartClick;
        return (React.createElement(React.Fragment, null,
            React.createElement("tr", null,
                React.createElement("td", { className: "shoping__cart__item" },
                    React.createElement("div", { className: "shoping__cart__item__image__wrapper" }, (cartItem.productImageID !== undefined && cartItem.productImageID !== null)
                        ? React.createElement(react_router_dom_1.Link, { to: "/product/".concat(cartItem.productID) },
                            React.createElement("img", { src: axios_1.default.defaults.baseURL + (0, routes_1.ProductImageController_GetImage)(cartItem.productImageID.toString()) }))
                        : React.createElement("img", { src: "img/cart/cart-1.jpg" })),
                    React.createElement(react_router_dom_1.Link, { to: "/product/".concat(cartItem.productID) },
                        React.createElement("h5", null, cartItem.name))),
                React.createElement("td", { className: "shoping__cart__price" },
                    cartItem.price,
                    " K\u010D"),
                React.createElement("td", { className: "shoping__cart__quantity" },
                    React.createElement("div", { className: "quantity" },
                        React.createElement("div", { className: "pro-qty" },
                            React.createElement("i", { onClick: function () { return onRemoveFromCartClick(cartItem.productID, 1); }, className: "fas fa-minus qtybtn" }),
                            React.createElement("input", { type: "text", value: cartItem.amount, readOnly: true }),
                            React.createElement("i", { onClick: function () { return onAddToCartClick(cartItem.productID, 1); }, className: "fas fa-plus qtybtn" })))),
                React.createElement("td", { className: "shoping__cart__total" },
                    Math.round(((cartItem.price * cartItem.amount) + Number.EPSILON) * 100) / 100,
                    " K\u010D"),
                React.createElement("td", { className: "shoping__cart__item__close" },
                    React.createElement("span", { onClick: function () { return onDeleteFromCartClick(cartItem.productID); }, className: "icon_close_alt2", title: "Odebrat produkt" })))));
    };
    return ShoppingCartListItem;
}(React.Component));
exports.default = ShoppingCartListItem;
//# sourceMappingURL=ShoppingCartListItem.js.map