import { Component } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "primeng-lts/dialog";
import * as i2 from "primeng-lts/dropdown";
import * as i3 from "@angular/forms";
import * as i4 from "primeng-lts/inputtextarea";
import * as i5 from "primeng-lts/api";
import * as i6 from "primeng-lts/button";
import * as i7 from "@angular/common";
function AlFeedbackComponent_button_9_Template(rf, ctx) { if (rf & 1) {
    var _r2 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 9);
    i0.ɵɵlistener("click", function AlFeedbackComponent_button_9_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r2); var ctx_r1 = i0.ɵɵnextContext(); return ctx_r1.toogleFeedbackDialog(); });
    i0.ɵɵelementStart(1, "p");
    i0.ɵɵtext(2, "Submit feedback");
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} }
var _c0 = function () { return { "width": "60%" }; };
var AlFeedbackComponent = /** @class */ (function () {
    function AlFeedbackComponent() {
        this.reasons = [
            { label: 'Select a reason', value: null },
            { label: "Reason 1", value: 1 },
            { label: "Reason 2", value: 2 },
            { label: "Reason 3", value: 3 },
            { label: "Reason 4", value: 4 }
        ];
        this.showFeedbackDialog = false;
        this.feedbackText = null;
        this.showFeedbackOption = false;
    }
    AlFeedbackComponent.prototype.show = function () {
        this.showFeedbackOption = true;
    };
    AlFeedbackComponent.prototype.hide = function () {
        this.showFeedbackOption = false;
    };
    AlFeedbackComponent.prototype.toogleFeedbackDialog = function () {
        this.showFeedbackDialog = !this.showFeedbackDialog;
        this.resetInputs();
    };
    AlFeedbackComponent.prototype.isDisabledSubmit = function () {
        var disabled = true;
        if (this.feedbackText && this.feedbackText !== "" && this.feedbackReason) {
            disabled = false;
        }
        return disabled;
    };
    AlFeedbackComponent.prototype.submitFeedback = function () {
        this.toogleFeedbackDialog();
    };
    AlFeedbackComponent.prototype.resetInputs = function () {
        this.feedbackText = null;
        this.feedbackReason = {};
    };
    /** @nocollapse */ AlFeedbackComponent.ɵfac = function AlFeedbackComponent_Factory(t) { return new (t || AlFeedbackComponent)(); };
    /** @nocollapse */ AlFeedbackComponent.ɵcmp = i0.ɵɵdefineComponent({ type: AlFeedbackComponent, selectors: [["al-feedback"]], decls: 10, vars: 10, consts: [["header", "What feedback would you like to give us?", "modal", "modal", "showEffect", "fade", 3, "visible", "draggable", "visibleChange"], [1, "feedback-dropdown-container"], [3, "options", "ngModel", "ngModelChange"], [1, "feedback-textarea-container"], ["pInputTextarea", "", "placeholder", "Your Message", "autoResize", "autoResize", 3, "ngModel", "ngModelChange"], [1, "ui-dialog-buttonpane", "ui-helper-clearfix"], ["pButton", "", "type", "button", "label", "I DON'T WANT TO GIVE FEEDBACK", 3, "click"], ["pButton", "", "type", "button", "label", "SUBMIT", 1, "primaryAction", 3, "disabled", "click"], ["pButton", "", "type", "button", "class", "feedback-button primaryAction", 3, "click", 4, "ngIf"], ["pButton", "", "type", "button", 1, "feedback-button", "primaryAction", 3, "click"]], template: function AlFeedbackComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "p-dialog", 0);
            i0.ɵɵlistener("visibleChange", function AlFeedbackComponent_Template_p_dialog_visibleChange_0_listener($event) { return ctx.showFeedbackDialog = $event; });
            i0.ɵɵelementStart(1, "div", 1);
            i0.ɵɵelementStart(2, "p-dropdown", 2);
            i0.ɵɵlistener("ngModelChange", function AlFeedbackComponent_Template_p_dropdown_ngModelChange_2_listener($event) { return ctx.feedbackReason = $event; });
            i0.ɵɵelementEnd();
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(3, "div", 3);
            i0.ɵɵelementStart(4, "textarea", 4);
            i0.ɵɵlistener("ngModelChange", function AlFeedbackComponent_Template_textarea_ngModelChange_4_listener($event) { return ctx.feedbackText = $event; });
            i0.ɵɵelementEnd();
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(5, "p-footer");
            i0.ɵɵelementStart(6, "div", 5);
            i0.ɵɵelementStart(7, "button", 6);
            i0.ɵɵlistener("click", function AlFeedbackComponent_Template_button_click_7_listener() { return ctx.toogleFeedbackDialog(); });
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(8, "button", 7);
            i0.ɵɵlistener("click", function AlFeedbackComponent_Template_button_click_8_listener() { return ctx.submitFeedback(); });
            i0.ɵɵelementEnd();
            i0.ɵɵelementEnd();
            i0.ɵɵelementEnd();
            i0.ɵɵelementEnd();
            i0.ɵɵtemplate(9, AlFeedbackComponent_button_9_Template, 3, 0, "button", 8);
        } if (rf & 2) {
            i0.ɵɵstyleMap(i0.ɵɵpureFunction0(9, _c0));
            i0.ɵɵproperty("visible", ctx.showFeedbackDialog)("draggable", false);
            i0.ɵɵadvance(2);
            i0.ɵɵproperty("options", ctx.reasons)("ngModel", ctx.feedbackReason);
            i0.ɵɵadvance(2);
            i0.ɵɵproperty("ngModel", ctx.feedbackText);
            i0.ɵɵadvance(4);
            i0.ɵɵproperty("disabled", ctx.isDisabledSubmit());
            i0.ɵɵadvance(1);
            i0.ɵɵproperty("ngIf", ctx.showFeedbackOption);
        } }, directives: [i1.Dialog, i2.Dropdown, i3.NgControlStatus, i3.NgModel, i3.DefaultValueAccessor, i4.InputTextarea, i5.Footer, i6.ButtonDirective, i7.NgIf], styles: [".feedback-dropdown-container[_ngcontent-%COMP%]{margin:0 20px 20px}.feedback-textarea-container[_ngcontent-%COMP%]{height:180px;margin:20px}.feedback-textarea-container[_ngcontent-%COMP%]   textarea[_ngcontent-%COMP%]{width:100%}.feedback-button[_ngcontent-%COMP%]{position:fixed;top:90%;left:83%;border-radius:50px;height:41px;width:auto}.feedback-button[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]{margin:11px}"] });
    return AlFeedbackComponent;
}());
export { AlFeedbackComponent };
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(AlFeedbackComponent, [{
        type: Component,
        args: [{
                selector: 'al-feedback',
                templateUrl: './al-feedback.component.html',
                styleUrls: ['./al-feedback.component.scss']
            }]
    }], null, null); })();
//# sourceMappingURL=data:application/json;base64, 