import { Component, EventEmitter, Input, Output } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "../../../../../ui-kit/tooltip/tooltip.directive";
import * as i2 from "../../../../../ui-kit/formgroup/cs-switch/cs-switch.component";
import * as i3 from "@angular/forms";
export class ChoiceSettingsPanelComponent {
    set Score(score) {
        if (score === undefined) {
            this.score = this.defaultScore ? this.defaultScore : 1;
        }
        else {
            this.score = score;
        }
        this.changeScore(this.score);
        this.isFailedChange.emit(this.isFailed ? this.isFailed : false);
    }
    constructor() {
        this.isFailedChange = new EventEmitter();
        this.scoreChange = new EventEmitter();
    }
    ngOnInit() {
    }
    changeScore(evt) {
        this.scoreChange.emit(evt);
    }
    changeFailed(evt) {
        if (evt === false) {
            this.score = this.defaultScore ? this.defaultScore : 1;
            // if (this.color === '#c60022') {
            //   this.color = '#000000';
            // }
            this.scoreChange.emit(this.score);
        }
        else {
            this.score = this.negativeScore ? this.negativeScore : 0;
            // this.color = '#c60022';
            this.scoreChange.emit(this.score);
        }
        this.isFailedChange.emit(evt);
    }
    scoreManger(mode) {
        if (mode === '+') {
            this.score = this.score + 1;
        }
        else if (mode === '-') {
            if (this.score > 0) {
                this.score = this.score - 1;
            }
        }
        this.scoreChange.emit(this.score);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ChoiceSettingsPanelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ChoiceSettingsPanelComponent, selector: "app-choice-settings-panel", inputs: { defaultScore: "defaultScore", negativeScore: "negativeScore", isFailed: "isFailed", Score: ["score", "Score"], scoreVisible: "scoreVisible" }, outputs: { isFailedChange: "isFailedChange", scoreChange: "scoreChange" }, ngImport: i0, template: "<div  class=\"reponse-choice vx-d-flex vx-align-center vx-justify-end vx-mt-1\">\n    <div class=\"choice-item vx-d-flex vx-align-center vx-p-2\">\n        <span class=\"text vx-fs-11 vx-fw-500 vx-label-txt vx-tt-uppercase vx-mr-2\">ADD SCORE:</span>\n        <button (click)=\"scoreManger('-')\" class=\"minus-btn vx-fs-14 vx-fw-600 vx-paragraph-txt vx-p-0 vx-m-0 vx-ml-1 vx-mr-1 vx-d-flex vx-align-center\">-</button>\n        <input type=\"number\"type=\"number\" [(ngModel)]='score' (ngModelChange)=\"changeScore($event)\" min=\"0\"\n        oninput=\"this.value = Math.abs(this.value)\"/>\n        <button (click)=\"scoreManger('+')\" class=\"plus-btn vx-fs-14 vx-fw-600 vx-paragraph-txt vx-p-0 vx-m-0 vx-ml-1 vx-mr-1 vx-d-flex vx-align-center\">+</button>\n    </div>\n    <div class=\"choice-item vx-d-flex vx-align-center vx-p-2 vx-ml-1\">\n        <span class=\"text vx-fs-11 vx-fw-500 vx-label-txt vx-tt-uppercase vx-mr-5\">SET AS A FAILED RESPONSE?</span>\n        <i class=\"icons info vx-fs-14 vx-txt-blue vx-ml-1 vx-mr-2\" appTooltip=\"If this response choice is 'Set as a failed response' VComply would automatically flag it as an exception when selected by the respondent. This can help identify areas for improvement and in the development of corrective action plans.\" placement=\"bottom-right\" delay=\"0\" type=\"white\" [tooltipMandatory]=\"true\">&#xeb16;</i>\n        <app-cs-switch [(ngValue)]='isFailed' (ngValueChange)=\"changeFailed($event)\"></app-cs-switch>\n    </div>\n</div>", styles: ["@import\"https://cdn.v-comply.com/design-system/css/icons/icons.css\";@import\"https://cdn.v-comply.com/design-system/css/mixin/mixin.css\";@import\"https://cdn.v-comply.com/design-system/css/display/display.css\";@import\"https://cdn.v-comply.com/design-system/css/alignment/alignment.css\";@import\"https://cdn.v-comply.com/design-system/css/color/color.css\";@import\"https://cdn.v-comply.com/design-system/css/text/text.css\";@import\"https://cdn.v-comply.com/design-system/css/width/width.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin-top.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin-bottom.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin-left.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin-right.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding-top.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding-bottom.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding-left.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding-right.css\";.reponse-choice .choice-item{background:#f8f8f8;border-radius:.25rem;height:2rem}.reponse-choice .choice-item button.minus-btn,.reponse-choice .choice-item button.plus-btn{background:transparent;border:none;border-radius:0}.reponse-choice .choice-item input[type=number]{background:#fff;border:1px solid #DBDBDB;border-radius:.125rem;color:#747576;font-size:11px;padding:0 .25rem;margin:0 .25rem;height:1.25rem;width:2.75rem;text-align:center;outline:none}.reponse-choice .choice-item i.info{cursor:pointer}\n"], dependencies: [{ kind: "directive", type: i1.ToolTipDirective, selector: "[appTooltip]", inputs: ["appTooltip", "placement", "type", "tooltipMandatory", "showTooltip", "animate"] }, { kind: "component", type: i2.CsSwitchComponentUI, selector: "app-cs-switch", inputs: ["disabled", "ngValue", "value", "tooltipMessage", "position"], outputs: ["ngValueChange"] }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ChoiceSettingsPanelComponent, decorators: [{
            type: Component,
            args: [{ selector: 'app-choice-settings-panel', template: "<div  class=\"reponse-choice vx-d-flex vx-align-center vx-justify-end vx-mt-1\">\n    <div class=\"choice-item vx-d-flex vx-align-center vx-p-2\">\n        <span class=\"text vx-fs-11 vx-fw-500 vx-label-txt vx-tt-uppercase vx-mr-2\">ADD SCORE:</span>\n        <button (click)=\"scoreManger('-')\" class=\"minus-btn vx-fs-14 vx-fw-600 vx-paragraph-txt vx-p-0 vx-m-0 vx-ml-1 vx-mr-1 vx-d-flex vx-align-center\">-</button>\n        <input type=\"number\"type=\"number\" [(ngModel)]='score' (ngModelChange)=\"changeScore($event)\" min=\"0\"\n        oninput=\"this.value = Math.abs(this.value)\"/>\n        <button (click)=\"scoreManger('+')\" class=\"plus-btn vx-fs-14 vx-fw-600 vx-paragraph-txt vx-p-0 vx-m-0 vx-ml-1 vx-mr-1 vx-d-flex vx-align-center\">+</button>\n    </div>\n    <div class=\"choice-item vx-d-flex vx-align-center vx-p-2 vx-ml-1\">\n        <span class=\"text vx-fs-11 vx-fw-500 vx-label-txt vx-tt-uppercase vx-mr-5\">SET AS A FAILED RESPONSE?</span>\n        <i class=\"icons info vx-fs-14 vx-txt-blue vx-ml-1 vx-mr-2\" appTooltip=\"If this response choice is 'Set as a failed response' VComply would automatically flag it as an exception when selected by the respondent. This can help identify areas for improvement and in the development of corrective action plans.\" placement=\"bottom-right\" delay=\"0\" type=\"white\" [tooltipMandatory]=\"true\">&#xeb16;</i>\n        <app-cs-switch [(ngValue)]='isFailed' (ngValueChange)=\"changeFailed($event)\"></app-cs-switch>\n    </div>\n</div>", styles: ["@import\"https://cdn.v-comply.com/design-system/css/icons/icons.css\";@import\"https://cdn.v-comply.com/design-system/css/mixin/mixin.css\";@import\"https://cdn.v-comply.com/design-system/css/display/display.css\";@import\"https://cdn.v-comply.com/design-system/css/alignment/alignment.css\";@import\"https://cdn.v-comply.com/design-system/css/color/color.css\";@import\"https://cdn.v-comply.com/design-system/css/text/text.css\";@import\"https://cdn.v-comply.com/design-system/css/width/width.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin-top.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin-bottom.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin-left.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin-right.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding-top.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding-bottom.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding-left.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding-right.css\";.reponse-choice .choice-item{background:#f8f8f8;border-radius:.25rem;height:2rem}.reponse-choice .choice-item button.minus-btn,.reponse-choice .choice-item button.plus-btn{background:transparent;border:none;border-radius:0}.reponse-choice .choice-item input[type=number]{background:#fff;border:1px solid #DBDBDB;border-radius:.125rem;color:#747576;font-size:11px;padding:0 .25rem;margin:0 .25rem;height:1.25rem;width:2.75rem;text-align:center;outline:none}.reponse-choice .choice-item i.info{cursor:pointer}\n"] }]
        }], ctorParameters: function () { return []; }, propDecorators: { defaultScore: [{
                type: Input
            }], negativeScore: [{
                type: Input
            }], isFailed: [{
                type: Input
            }], Score: [{
                type: Input,
                args: ['score']
            }], scoreVisible: [{
                type: Input
            }], isFailedChange: [{
                type: Output
            }], scoreChange: [{
                type: Output
            }] } });
//# sourceMappingURL=data:application/json;base64, 