"use strict";
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SubHeaderListingContainer = void 0;
var react_1 = __importDefault(require("react"));
var web_1 = require("@unform/web");
var web_2 = require("../../../Select/web");
var web_3 = require("../../../Button/web");
var web_4 = require("../../../TagsFilters/web");
var SubHeaderListingContainer_style_1 = require("./SubHeaderListingContainer.style");
function SubHeaderListingContainer(props) {
    var tagsFilters = props.tagsFilters, tagsFiltersRef = props.tagsFiltersRef, viewList = props.viewList;
    var filters = viewList.filters;
    return (react_1.default.createElement(SubHeaderListingContainer_style_1.SubHeaderListingContainerStyle, null,
        react_1.default.createElement(ResultsInfo, __assign({}, props)),
        tagsFilters && (react_1.default.createElement("div", { className: "tags-filter-container" },
            react_1.default.createElement(web_4.TagsFilters, __assign({ ref: tagsFiltersRef }, tagsFilters, { filters: filters }))))));
}
exports.SubHeaderListingContainer = SubHeaderListingContainer;
function ResultsInfo(props) {
    var _a;
    var formSortRef = props.formSortRef, openFilters = props.openFilters, sortOptions = props.sortOptions, _b = props.showCountListing, showCountListing = _b === void 0 ? true : _b, viewList = props.viewList;
    var setSort = viewList.setSort, filters = viewList.filters, resourcesTotal = viewList.resourcesTotal, searching = viewList.searching, starting = viewList.starting;
    var page = (_a = filters.page) !== null && _a !== void 0 ? _a : 1;
    var pageCountStart = (page - 1) * 20 + 1;
    pageCountStart = resourcesTotal ? pageCountStart : 0;
    var pageCountEnd = (page - 1) * 20 + 20;
    pageCountEnd = pageCountEnd > resourcesTotal ? resourcesTotal : pageCountEnd;
    return (react_1.default.createElement("div", { className: "results-info" },
        react_1.default.createElement("div", { className: "text-results" }, showCountListing && (react_1.default.createElement("span", { className: ((searching || starting) && 'text-skeleton') + " text-non-skeleton" },
            react_1.default.createElement("b", null, pageCountStart),
            "-",
            react_1.default.createElement("b", null, pageCountEnd),
            " de ",
            react_1.default.createElement("b", null, resourcesTotal),
            " resultados"))),
        react_1.default.createElement("div", { className: "btn-filter-row" },
            react_1.default.createElement(web_3.Button, { className: "btn-filter", onClick: openFilters, "data-cy": "open-mobile-filters", type: "button" }, "Editar Filtros")),
        sortOptions && (react_1.default.createElement("div", { className: "sort" },
            react_1.default.createElement(web_1.Form, { onSubmit: function () { }, initialData: filters, ref: formSortRef },
                react_1.default.createElement(web_2.Select, { name: "sort", onChange: function (e) { return setSort(e.target.value); }, "data-cy": "sort-filters", options: sortOptions }))))));
}
//# sourceMappingURL=SubHeaderListingContainer.js.map