import { __decorate } from "tslib";
import { Component, ViewChild, Input } from "@angular/core";
import { BsModalService, BsModalRef } from "ngx-bootstrap/modal";
let ExhibitModal = class ExhibitModal {
    constructor(modalService) {
        this.modalService = modalService;
        this.currentTab = 0;
        this.exhibitData = [];
        this.exhibitContent = null;
        this.isExhibit = 0;
        this.index = 0;
    }
    set questionCurrentData(value) {
        /** template2 ---> initializing template type and creatig todo list. */
        if (value) {
            this.isExhibit = value.isExhibit || (value.exhibitData && value.exhibitData.length > 0);
            this.exhibitData = value.exhibitData ? value.exhibitData : [];
            this.exhibitContent =
                this.exhibitData.length > 0
                    ? this.exhibitData[0].content
                    : '<h4 class="text-center"><strong>Exhibit data not found...!!</strong></h4>';
        }
    }
    moveToExhibitContent(index, content) {
        this.exhibitContent =
            content.content.length > 0
                ? content.content
                : '<h4 class="text-center"><strong>Exhibit data not found...!!</strong></h4>';
        switch (this.examEngineType) {
            case "QP":
                this.currentTab = index;
                this.index = index;
                break;
            case "USMLE":
                this.currentTab = index;
                this.index = index;
                break;
            case "NCLEX":
                this.index = index;
                break;
            default:
                console.log("Something went wrong --->> Engine is ", this.examEngineType);
        }
    }
    openModal() {
        this.exhibitContent =
            this.exhibitData[0].content.length > 0
                ? this.exhibitData[0].content
                : '<h4 class="text-center"><strong>Exhibit data not found...!!</strong></h4>';
        switch (this.examEngineType) {
            case "QP":
                this.currentTab = 0;
                this.qpExhibitModal.show();
                break;
            case "USMLE":
                this.currentTab = 0;
                this.qpExhibitModal.show();
                break;
            case "NCLEX":
                this.index = 0;
                this.nclexModal.show();
                break;
            default:
        }
    }
    changeTab(index, content) {
        this.exhibitContent =
            content.content.length > 0
                ? content.content
                : '<h4 class="text-center"><strong>Exhibit data not found...!!</strong></h4>';
        this.index = index;
    }
};
ExhibitModal.ctorParameters = () => [
    { type: BsModalService }
];
__decorate([
    Input()
], ExhibitModal.prototype, "examEngineType", void 0);
__decorate([
    ViewChild("nclexExhibitModal", { static: false })
], ExhibitModal.prototype, "nclexModal", void 0);
__decorate([
    ViewChild("qpExhibitModal", { static: false })
], ExhibitModal.prototype, "qpExhibitModal", void 0);
__decorate([
    Input()
], ExhibitModal.prototype, "selectedTheme", void 0);
__decorate([
    Input()
], ExhibitModal.prototype, "fontSize", void 0);
__decorate([
    Input("questionDetails")
], ExhibitModal.prototype, "questionCurrentData", null);
ExhibitModal = __decorate([
    Component({
        selector: "app-exhibit-modal",
        template: "<ng-container *ngIf=\"isExhibit\">\n  <div\n    class=\"wk-layout-50-50 mb20 exhibit-add-btn\"\n    *ngIf=\"examEngineType == 'QP' || examEngineType == 'USMLE'\"\n  >\n    <div class=\"wk-layout-item text-right\">\n      <button class=\"wkqp-button wk-button-primary\" (click)=\"openModal()\">\n        Exhibit\n      </button>\n    </div>\n  </div>\n  <div *ngIf=\"examEngineType == 'NCLEX'\">\n    <button\n      type=\"button\"\n      class=\"btn btn-primary exhibit-btn-margin\"\n      (click)=\"openModal()\"\n    >\n      Exhibit\n    </button>\n  </div>\n  <div\n    class=\"hor-line\"\n    *ngIf=\"examEngineType == 'QP' || examEngineType == 'USMLE'\"\n  ></div>\n</ng-container>\n\n<!-- QP Exhibit modal -->\n<div\n  bsModal\n  #qpExhibitModal=\"bs-modal\"\n  class=\"modal fade exhibit-preview-modal\"\n  [id]=\"examEngineType == 'USMLE' ? 'usmle-exhibit-wrapper' : 'qp-modal'\"\n  tabindex=\"-1\"\n  role=\"dialog\"\n  aria-labelledby=\"dialog-sizes-name1\"\n  [config]=\"{ backdrop: true }\"\n>\n  <div\n    class=\"modal-dialog modal-lg\"\n    [class.usmle-exhitbit-modal]=\"examEngineType == 'USMLE'\"\n  >\n    <div class=\"modal-content\">\n      <div class=\"modal-header\">\n        <h3 id=\"dialog-sizes-name1\" class=\"modal-title pull-left\">\n          Exhibit Question\n        </h3>\n        <a\n          class=\"qp-modal-close\"\n          (click)=\"qpExhibitModal.hide()\"\n          [ngStyle]=\"{\n            color: selectedTheme == true ? 'black' : '#474747'\n          }\"\n        >\n          <span class=\"wk-icon-close-outline\"></span>\n        </a>\n      </div>\n      <div class=\"hor-line\"></div>\n      <div class=\"modal-body\">\n        <div>\n          <tabset class=\"exhibit-preview\">\n            <tab\n              *ngFor=\"let tab of exhibitData; let i = index\"\n              [heading]=\"tab.title\"\n            >\n              <span [innerHTML]=\"tab?.content\"></span>\n            </tab>\n          </tabset>\n        </div>\n        <ng-template #emptyContent>\n          <div class=\"exhibit-content-div\" [innerHTML]=\"exhibitContent\">\n            <h4 style=\"text-align: center\">\n              <strong>Exhibit data not found...!!</strong>\n            </h4>\n          </div>\n        </ng-template>\n      </div>\n    </div>\n  </div>\n</div>\n\n<!-- NCLEX Echibit modal -->\n<div\n  class=\"modal fade\"\n  id=\"nclex-modal\"\n  bsModal\n  #nclexExhibitModal1=\"bs-modal\"\n  [config]=\"{ backdrop: false }\"\n  tabindex=\"-1\"\n  role=\"dialog\"\n  aria-labelledby=\"dialog-static-name\"\n>\n  <div class=\"modal-dialog\">\n    <div class=\"modal-content\">\n      <div class=\"modal-body\">\n        <button\n          type=\"button\"\n          class=\"close pull-right close-round-btn\"\n          aria-label=\"Close\"\n          (click)=\"nclexExhibitModal1.hide()\"\n        >\n          <span class=\"wk-icon-close-outline close-icon\"></span>\n        </button>\n        <div\n          class=\"exhibit-tabs\"\n          *ngIf=\"exhibitData.length > 0; else emptyContent\"\n        >\n          <!-- <tabset #staticTabs>\n                  <tab heading=\"Static title\"><div class=\"exhibit-content-div\"></div></tab>\n                  <tab heading=\"Static Title 1\"><div class=\"exhibit-content-div\"></div></tab>\n                  <tab heading=\"Static Title 2\"><div class=\"exhibit-content-div\"></div></tab>\n                  <tab heading=\"Static Title 3\"><div class=\"exhibit-content-div\"></div></tab>\n                </tabset> -->\n\n          <ul class=\"nav nav-tabs nclex-exhibit-tabs\">\n            <li\n              [class.test-wrapper]=\"currentTab != i\"\n              class=\"padding-1vh\"\n              *ngFor=\"let tab of exhibitData; let i = index\"\n              [ngClass]=\"{\n                'active-tab nclextab-width': currentTab == i,\n                'li-responsive': exhibitData.length > 3,\n                'bg-eee': currentTab != i\n              }\"\n              (click)=\"moveToExhibitContent(i, tab)\"\n              style=\"border-radius: 2px; \"\n            >\n              <a class=\"text-container\">{{ tab.title }}</a>\n            </li>\n          </ul>\n          <div class=\"exhibit-content-div\" [innerHTML]=\"exhibitContent\"></div>\n        </div>\n        <ng-template #emptyContent>\n          <div class=\"exhibit-content-div\" [innerHTML]=\"exhibitContent\">\n            <h4 style=\"text-align: center\">\n              <strong>Exhibit data not found...!!</strong>\n            </h4>\n          </div>\n        </ng-template>\n      </div>\n    </div>\n  </div>\n</div>\n\n<!-- NCLEX Echibit modal -->\n<div\n  class=\"modal fade\"\n  bsModal\n  id=\"nclex-modal\"\n  #nclexExhibitModal=\"bs-modal\"\n  [config]=\"{ backdrop: false }\"\n  tabindex=\"-1\"\n  role=\"dialog\"\n  aria-labelledby=\"dialog-static-name\"\n>\n  <div class=\"modal-dialog\">\n    <div class=\"modal-content\">\n      <div class=\"modal-body\">\n        <button\n          type=\"button\"\n          class=\"close pull-right close-round-btn\"\n          aria-label=\"Close\"\n          (click)=\"nclexExhibitModal.hide()\"\n        >\n          <span class=\"wk-icon-close-outline close-icon\"></span>\n        </button>\n        <div style=\"height: 40vh;\">\n          <ul class=\"tabs\">\n            <li\n              class=\"tab\"\n              *ngFor=\"let tab of exhibitData; let i = index\"\n              [class.seleted-tab]=\"index == i\"\n            >\n              <input\n                type=\"radio\"\n                name=\"tabs\"\n                checked=\"checked\"\n                id=\"tab{{ i + 1 }}\"\n                (change)=\"changeTab(i, tab)\"\n              />\n              <label\n                for=\"tab{{ i + 1 }}\"\n                [class.seleted-tab-content]=\"index == i\"\n                [class.unselected-tab]=\"index != i\"\n                >{{ tab.title }}</label\n              >\n              <div\n                style=\"height: 34vh;overflow: auto\"\n                id=\"tab-content{{ i + 1 }}\"\n                class=\"content wxhibit-cont\"\n                [innerHTML]=\"exhibitContent\"\n              ></div>\n            </li>\n          </ul>\n        </div>\n      </div>\n    </div>\n  </div>\n</div>\n",
        styles: [".modal-lg{width:600px;min-width:600px}.modal-header{min-height:auto;background-color:#fff!important;border-bottom:1px solid #e5e5e5!important;padding:15px!important;height:65px!important}.modal-content{border-radius:0;border:0;height:auto!important;max-height:calc(100vh - 30px)!important}.modal-content .modal-body{float:left;width:100%;background-color:#fff}.exhibit-preview-modal .modal-lg{width:100%;max-width:75rem}.exhibit-preview-modal .modal-body{min-height:472px}.exhibit-preview-modal .modal-body .tab-content{height:400px;overflow-y:auto;border:1px solid #a3a3a3;padding:15px;border-top:0}.exhibit-preview-modal .wk-icon-close-outline:before{font-size:30px}.exhibit-preview-modal .wk-icon-close-outline{position:relative;left:7px;cursor:pointer}.exhibit-preview-modal .wk-layout-50-50{max-width:100%}.exhibit-add-btn{border-bottom:1px solid #a3a3a3;padding-bottom:20px}"]
    })
], ExhibitModal);
export { ExhibitModal };
//# sourceMappingURL=data:application/json;base64, 