"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 formik_1 = require("formik");
var DeliveryAndPaymentTypeForm = /** @class */ (function (_super) {
    __extends(DeliveryAndPaymentTypeForm, _super);
    function DeliveryAndPaymentTypeForm() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    DeliveryAndPaymentTypeForm.prototype.render = function () {
        var _a = this.props, errors = _a.errors, handleChange = _a.handleChange, onDeliveryTypeChange = _a.onDeliveryTypeChange, onPaymentTypeChange = _a.onPaymentTypeChange, setFieldTouched = _a.setFieldTouched, setFieldValue = _a.setFieldValue, showSelectPaymentType = _a.showSelectPaymentType, touched = _a.touched;
        return (React.createElement(React.Fragment, null,
            React.createElement("div", { className: "row", style: { marginBottom: "24px" } },
                React.createElement("div", { className: "col-lg-6 col-md-6" },
                    React.createElement("h4", null, "Zp\u016Fsob dopravy"),
                    this.props.deliveryTypes.map(function (item) {
                        return (React.createElement("div", { className: "form-check", key: item.id },
                            React.createElement("label", { className: "form-check-label" },
                                React.createElement(formik_1.Field, { type: "radio", value: item.id.toString(), name: "deliveryTypePicked", onChange: function (event) {
                                        setFieldTouched("deliveryTypePicked");
                                        setFieldValue("paymentTypePicked", '2', false);
                                        handleChange(event);
                                        onDeliveryTypeChange(item);
                                    }, className: "form-check-input" }), "".concat(item.name, " (").concat(item.fee, " K\u010D)"))));
                    }),
                    (errors === null || errors === void 0 ? void 0 : errors.deliveryTypePicked) && (touched === null || touched === void 0 ? void 0 : touched.deliveryTypePicked) && React.createElement("label", { className: "error-message" }, errors.deliveryTypePicked)),
                React.createElement("div", { className: "col-lg-6 col-md-6" }, showSelectPaymentType == true
                    ? React.createElement(React.Fragment, null,
                        React.createElement("h4", null, "Zp\u016Fsob platby"),
                        this.props.paymentTypes.map(function (item) {
                            return (React.createElement("div", { className: "form-check", key: item.id },
                                React.createElement("label", { className: "form-check-label" },
                                    React.createElement(formik_1.Field, { type: "radio", value: item.id.toString(), name: "paymentTypePicked", onChange: function (event) {
                                            setFieldTouched("paymentTypePicked");
                                            handleChange(event);
                                            onPaymentTypeChange(item);
                                        }, className: "form-check-input" }), "".concat(item.name, " (").concat(item.fee, " K\u010D)"))));
                        }),
                        (errors === null || errors === void 0 ? void 0 : errors.paymentTypePicked) && (touched === null || touched === void 0 ? void 0 : touched.paymentTypePicked) && React.createElement("label", { className: "error-message" }, errors.paymentTypePicked))
                    : null))));
    };
    return DeliveryAndPaymentTypeForm;
}(React.Component));
exports.default = DeliveryAndPaymentTypeForm;
//# sourceMappingURL=DeliveryAndPaymentTypeForm.js.map