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 (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { Component } from '@angular/core';
import { ComponentHelper } from '../../classes/component-helper';
import { OptionsService } from '../../services/options.service';
import { ToastService } from '../../utils/toast.service';
var FaqsContentEcComponent = /** @class */ (function (_super) {
    __extends(FaqsContentEcComponent, _super);
    function FaqsContentEcComponent(optionsService, toastr) {
        var _this = _super.call(this) || this;
        _this.optionsService = optionsService;
        _this.toastr = toastr;
        _this.empty_faqs = false;
        _this.changeFAQ = function (new_index) { return _this.actual_index = new_index; };
        _this.ecOnConstruct();
        return _this;
    }
    FaqsContentEcComponent.prototype.ngOnInit = function () {
        var _this = this;
        this.optionsService.getFAQ().toPromise().then(function (faqs) {
            console.log('LAS FAQS; ', faqs);
            if (faqs.length > 0) {
                _this.faqs = faqs;
                _this.actual_index = 0;
            }
            else {
                _this.empty_faqs = true;
            }
        }, function (error) {
            console.log(error);
            _this.toastr.show('No fue posible encontrar la sección solicitada');
        }).catch(function (err) { return _this.toastr.show('empty-faqs'); });
        this.ecOnInit();
    };
    FaqsContentEcComponent.ctorParameters = function () { return [
        { type: OptionsService },
        { type: ToastService }
    ]; };
    FaqsContentEcComponent = __decorate([
        Component({
            selector: 'app-faqs-content-ec',
            template: "<section class=\"formulario container\" *ngIf=\"faqs; else loading\">\n\n    <div *ngIf=\"!empty_faqs; else emptyFaqsView\">\n        <div class=\"row w-100 mx-auto my-4 px-3 bb-s bt-md-s py-1\">\n            <strong>{{ 'FAQ' | translate }}</strong>\n        </div>\n\n        <div class=\"row w-100 m-auto\">\n            <div class=\"col-12 col-md-4 col-lg-3 col-xl-2\">\n                <div class=\"nav flex-column nav-pills\" id=\"v-pills-tab\" role=\"tablist\" aria-orientation=\"vertical\">\n                    <a [class]=\"'nav-link radius-0 text-dark bb-solid ' +  (i == 0 ? 'active' : '')\" data-toggle=\"pill\"\n                        role=\"tab\" [id]=\"'v-pills-tab-'+i\" [href]=\"'#v-pills-'+i\" [attr.data-bs-target]=\"'#v-pills-'+i\"\n                        *ngFor=\"let faq of faqs; let i = index\">{{ faq.title | translate }}</a>\n                </div>\n            </div>\n            <div class=\"col-12 col-md-8 col-lg-9 col-xl-10\">\n                <div class=\"tab-content mt-5 mt-md-0\" id=\"v-pills-tabContent\">\n                    <div [class]=\"'tab-pane fade ' +  (i == 0 ? 'show active' : '')\" role=\"tabpanel\"\n                        *ngFor=\"let faq of faqs; let i = index\" [id]=\"'v-pills-'+i\">\n                        <h3>{{ faq.title | translate }}</h3>\n                        <div *ngFor=\"let question of faq.questions\">\n                            <h5><strong>{{ question.question | translate }}</strong></h5>\n                            <p>{{ question.answer | translate }}</p>\n                        </div>\n                    </div>\n                </div>\n\n            </div>\n        </div>\n    </div>\n\n</section>\n\n<ng-template #loading>\n    <div class=\"container\">\n        <div class=\"row\">\n            <div class=\"col-12 align-items-center\">\n                <div class=\"d-flex flex-column jusitfy-content-center align-items-center my-5\">\n                    <app-loading-full-ec></app-loading-full-ec>\n                </div>\n            </div>\n        </div>\n    </div>\n</ng-template>\n\n<ng-template #emptyFaqsView>\n    <div>\n        {{ 'empty_faqs' | translate }}\n    </div>\n</ng-template>",
            styles: [".faqs-container{background-color:#fff;padding:0!important;min-height:60vh}"]
        })
    ], FaqsContentEcComponent);
    return FaqsContentEcComponent;
}(ComponentHelper));
export { FaqsContentEcComponent };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFxcy1jb250ZW50LWVjLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL25nLWVhc3ljb21tZXJjZS8iLCJzb3VyY2VzIjpbImxpYi9lYy1jb21wb25lbnQvZmFxcy1jb250ZW50LWVjL2ZhcXMtY29udGVudC1lYy5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQVUsTUFBTSxlQUFlLENBQUM7QUFDbEQsT0FBTyxFQUFFLGVBQWUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBRWpFLE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUNoRSxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFPekQ7SUFBNEMsMENBQWU7SUFNdEQsZ0NBQXNCLGNBQThCLEVBQVksTUFBb0I7UUFBcEYsWUFDRyxpQkFBTyxTQUVUO1FBSHFCLG9CQUFjLEdBQWQsY0FBYyxDQUFnQjtRQUFZLFlBQU0sR0FBTixNQUFNLENBQWM7UUFGN0UsZ0JBQVUsR0FBRyxLQUFLLENBQUM7UUEyQjFCLGVBQVMsR0FBRyxVQUFDLFNBQVMsSUFBSyxPQUFBLEtBQUksQ0FBQyxZQUFZLEdBQUcsU0FBUyxFQUE3QixDQUE2QixDQUFDO1FBdkJ0RCxLQUFJLENBQUMsYUFBYSxFQUFFLENBQUE7O0lBQ3ZCLENBQUM7SUFFRCx5Q0FBUSxHQUFSO1FBQUEsaUJBa0JDO1FBakJJLElBQ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udGhlbihcbiAgICAgICAgICAgICAgIGZhcXMgPT4ge1xuICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZygnTEFTIEZBUVM7ICcsIGZhcXMpO1xuICAgICAgICAgICAgICAgICAgICBpZiAoZmFxcy5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5mYXFzID0gZmFxcztcbiAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmFjdHVhbF9pbmRleCA9IDA7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5lbXB0eV9mYXFzID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgIGVycm9yID0+IHtcbiAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coZXJyb3IpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnRvYXN0ci5zaG93KCdObyBmdWUgcG9zaWJsZSBlbmNvbnRyYXIgbGEgc2VjY2nDs24gc29saWNpdGFkYScpO1xuICAgICAgICAgICAgICAgfVxuICAgICAgICAgICkuY2F0Y2goZXJyID0+IHRoaXMudG9hc3RyLnNob3coJ2VtcHR5LWZhcXMnKSk7ICAgICBcbiAgICAgICAgdGhpcy5lY09uSW5pdCgpXG5cbiAgICAgfVxuXG4gICAgIGNoYW5nZUZBUSA9IChuZXdfaW5kZXgpID0+IHRoaXMuYWN0dWFsX2luZGV4ID0gbmV3X2luZGV4O1xufSJdfQ==