import { Component, EventEmitter, Input, Output } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "../summary-question-details/summary-question-details.component";
import * as i2 from "@angular/common";
export class SummaryQuestionComponent {
    constructor() {
        this.status = "";
        this.onUpdate = new EventEmitter();
        this.questions = [];
    }
    ngOnInit() {
        if (!this.isGroupSection) {
            this.data.groups.map((group) => {
                if (!group.isReferenced && group.isEnabled) {
                    group.questions.forEach((question) => {
                        if (!question.isReferenced && !question.isHidden) {
                            this.questions.push(question);
                        }
                    });
                }
            });
        }
        else {
            // find questions by section id
            if (this.data.groupedSections && this.data.groupedSections.length > 0) {
                this.data.groupedSections.forEach((sectionOnGroup) => {
                    let sectionFound = this.fullData.sections.find((section) => {
                        if (section.uuid === sectionOnGroup.sectionId) {
                            return section;
                        }
                    });
                    if (sectionFound) {
                        sectionFound.groups.map((group) => {
                            if (!group.isReferenced && group.isEnabled) {
                                group.questions.forEach((question) => {
                                    if (!question.isReferenced && !question.isHidden) {
                                        this.questions.push(question);
                                    }
                                });
                            }
                        });
                    }
                });
            }
        }
    }
    getQuestions() {
        return this.questions;
    }
    update(id) { this.onUpdate.emit(id); }
}
SummaryQuestionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: SummaryQuestionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
SummaryQuestionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: SummaryQuestionComponent, selector: "app-summary-question", inputs: { data: "data", fullData: "fullData", isGroupSection: "isGroupSection", status: "status" }, outputs: { onUpdate: "onUpdate" }, ngImport: i0, template: "<!-- <ion-card>\n  <ion-card-header>\n    <ion-card-title>{{data?.title}}</ion-card-title>\n    <div>\n      <ion-button *ngIf=\"data.correction\" (click)=\"update(data.uuid)\" size=\"small\">\n        <ion-icon \n          matTooltip=\"Esta secci\u00F3n tiene elementos por corregir\"\n          matTooltipPosition=\"above\"\n          style=\"color: #ef0f0f;\"\n          name=\"warning\"\n        ></ion-icon>\n      </ion-button>\n\n      <ion-button\n        (click)=\"update(data.uuid)\" \n        [disabled]=\"status != formEstatusEnum.fillingInProgress && status != formEstatusEnum.upgrade && status != formEstatusEnum.hasIssues\"\n        size=\"small\"\n      >\n        <ion-icon\n          matTooltip=\"Esta secci\u00F3n tiene elementos por corregir\"\n          matTooltipPosition=\"above\"\n          style=\"color: #ef0f0f;\"\n          name=\"create\"\n        ></ion-icon>\n      </ion-button>\n  </div>\n  </ion-card-header>\n\n  <ion-card-content>\n    <div style=\"text-align: justify;padding-bottom: 10px;\"><strong>{{data?.subheading}}</strong></div>\n    <div *ngFor=\"let group of data.groups\" class=\"form-row\"> \n      <div *ngIf=\"!group.isReferenced && group.isEnabled\">\n        <div *ngIf=\"group.title\" class=\"group-title-container\">\n          <label class=\"group-title\">{{group.title}}</label>\n        </div>\n        <div *ngFor=\"let question of group.questions\" class=\"form-row\">\n          \n          <div *ngIf=\"!question.isHidden && !question.isReferenced\">\n            <label *ngIf=\"question.inputType != 'File' && question.inputType != 'Table'\" class=\"cardInputLabel\">{{question.name}}</label>\n            <div *ngIf=\"question.inputType != 'File' && question.inputType != 'Table'\" appearance=\"outline\" style=\"width: 100%\">\n                <div *ngIf=\"question.inputType == 'Fecha'\" class=\"cardInputInLabel\">{{question.value | date}}</div>\n                <div *ngIf=\"question.inputType != 'Fecha'\" class=\"cardInputInLabel\">{{question.value}}</div>      \n            </div>\n            <div *ngIf=\"question.inputType == 'File'\" style=\"margin-bottom: 10px;\">\n              Pregunta tipo archivo\n            </div>\n\n            <div *ngIf=\"question.inputType == 'Table'\" style=\"margin-bottom: 10px;\">\n              Pregunta tipo Tabla\n            </div>\n          </div>\n\n        </div>\n      </div>\n    </div>\n  </ion-card-content>\n</ion-card> -->\n\n<div class=\"question-container\">\n  <div class=\"input-question\" *ngFor=\"let question of questions\">\n    <app-summary-question-details [question]=\"question\"></app-summary-question-details>\n  </div>\n</div>", styles: ["ion-label{font-weight:500;color:#000!important}.question-container{padding-left:15px;padding-right:15px;padding-bottom:10px}ion-item{border-bottom:1px solid #404040;--highlight-background: none}.item-interactive.item-has-focus{--highlight-background: transparent}.input-question{padding-bottom:5px}ion-input{font-weight:700}\n"], components: [{ type: i1.SummaryQuestionDetailsComponent, selector: "app-summary-question-details", inputs: ["question"] }], directives: [{ type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: SummaryQuestionComponent, decorators: [{
            type: Component,
            args: [{ selector: 'app-summary-question', template: "<!-- <ion-card>\n  <ion-card-header>\n    <ion-card-title>{{data?.title}}</ion-card-title>\n    <div>\n      <ion-button *ngIf=\"data.correction\" (click)=\"update(data.uuid)\" size=\"small\">\n        <ion-icon \n          matTooltip=\"Esta secci\u00F3n tiene elementos por corregir\"\n          matTooltipPosition=\"above\"\n          style=\"color: #ef0f0f;\"\n          name=\"warning\"\n        ></ion-icon>\n      </ion-button>\n\n      <ion-button\n        (click)=\"update(data.uuid)\" \n        [disabled]=\"status != formEstatusEnum.fillingInProgress && status != formEstatusEnum.upgrade && status != formEstatusEnum.hasIssues\"\n        size=\"small\"\n      >\n        <ion-icon\n          matTooltip=\"Esta secci\u00F3n tiene elementos por corregir\"\n          matTooltipPosition=\"above\"\n          style=\"color: #ef0f0f;\"\n          name=\"create\"\n        ></ion-icon>\n      </ion-button>\n  </div>\n  </ion-card-header>\n\n  <ion-card-content>\n    <div style=\"text-align: justify;padding-bottom: 10px;\"><strong>{{data?.subheading}}</strong></div>\n    <div *ngFor=\"let group of data.groups\" class=\"form-row\"> \n      <div *ngIf=\"!group.isReferenced && group.isEnabled\">\n        <div *ngIf=\"group.title\" class=\"group-title-container\">\n          <label class=\"group-title\">{{group.title}}</label>\n        </div>\n        <div *ngFor=\"let question of group.questions\" class=\"form-row\">\n          \n          <div *ngIf=\"!question.isHidden && !question.isReferenced\">\n            <label *ngIf=\"question.inputType != 'File' && question.inputType != 'Table'\" class=\"cardInputLabel\">{{question.name}}</label>\n            <div *ngIf=\"question.inputType != 'File' && question.inputType != 'Table'\" appearance=\"outline\" style=\"width: 100%\">\n                <div *ngIf=\"question.inputType == 'Fecha'\" class=\"cardInputInLabel\">{{question.value | date}}</div>\n                <div *ngIf=\"question.inputType != 'Fecha'\" class=\"cardInputInLabel\">{{question.value}}</div>      \n            </div>\n            <div *ngIf=\"question.inputType == 'File'\" style=\"margin-bottom: 10px;\">\n              Pregunta tipo archivo\n            </div>\n\n            <div *ngIf=\"question.inputType == 'Table'\" style=\"margin-bottom: 10px;\">\n              Pregunta tipo Tabla\n            </div>\n          </div>\n\n        </div>\n      </div>\n    </div>\n  </ion-card-content>\n</ion-card> -->\n\n<div class=\"question-container\">\n  <div class=\"input-question\" *ngFor=\"let question of questions\">\n    <app-summary-question-details [question]=\"question\"></app-summary-question-details>\n  </div>\n</div>", styles: ["ion-label{font-weight:500;color:#000!important}.question-container{padding-left:15px;padding-right:15px;padding-bottom:10px}ion-item{border-bottom:1px solid #404040;--highlight-background: none}.item-interactive.item-has-focus{--highlight-background: transparent}.input-question{padding-bottom:5px}ion-input{font-weight:700}\n"] }]
        }], ctorParameters: function () { return []; }, propDecorators: { data: [{
                type: Input
            }], fullData: [{
                type: Input
            }], isGroupSection: [{
                type: Input
            }], status: [{
                type: Input
            }], onUpdate: [{
                type: Output
            }] } });
//# sourceMappingURL=data:application/json;base64, 