"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        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 antd_1 = require("antd");
var siui_1 = require("@simplus/siui");
var robins_1 = require("../../../robins");
var dashboardTab_1 = require("./dashboardTab");
var TabPane = antd_1.Tabs.TabPane;
var dashboardSections = robins_1.robins.dashboardSections;
var DashboardSection = /** @class */ (function (_super) {
    __extends(DashboardSection, _super);
    function DashboardSection() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     *  ComponentDidMount method to initiate robin get dashboard section request
     */
    DashboardSection.prototype.componentDidMount = function () {
        dashboardSections.get("section " + this.props.id, this.props.id);
    };
    /**
     *  This is the render method
     */
    DashboardSection.prototype.render = function () {
        var section = dashboardSections.getResult("section " + this.props.id) || null;
        if (section) {
            return React.createElement(siui_1.Card, { margin: true, padding: true },
                React.createElement("div", { className: 'dashboard-section-header' },
                    React.createElement("div", { className: 'dashboard-section-title' }, section.title),
                    section.tooltip ?
                        React.createElement(antd_1.Tooltip, { title: section.tooltip },
                            React.createElement(antd_1.Icon, { style: { color: '#909090' }, type: 'info-circle' }))
                        : null),
                section.dashboardTabs.length > 1 ?
                    React.createElement(antd_1.Tabs, { defaultActiveKey: '0' }, section.dashboardTabs.map(function (item, index) {
                        return React.createElement(TabPane, { tab: item.title, key: index },
                            React.createElement(dashboardTab_1.DashboardTab, { id: item.id }));
                    }))
                    : React.createElement(dashboardTab_1.DashboardTab, { className: 'dashboard-tab', id: section.dashboardTabs[0].id }));
        }
        else
            return React.createElement("div", null);
    };
    return DashboardSection;
}(React.Component));
exports.DashboardSection = DashboardSection;
exports.default = DashboardSection;
