One Hat Cyber Team
  • Dir : ~/usr/local/psa/admin/cp/public/javascript/app/
  • View File Name : aha.js
    ${this.lmsg("voteBetterHint")}
    `,buttons:[{title:this.lmsg("voteButtonOk"),id:"aha-vote-button-ok",class:"action",handler:this.handleVoteButton.bind(this)},{title:i.Locale.getSection("components.buttons").lmsg("cancel"),id:"aha-vote-button-cancel",handler(e,t){t.hide()}}],...e})}_initComponentElement(){super._initComponentElement(),(0,i.render)(this._componentElement.querySelector("#aha-rating"),[0,1,2,3,4,5,6,7,8,9,10].map((e=>(0,i.createElement)("label",{class:`nps-survey__score nps-survey__score--${e}`,onclick:this.checkPossibleSendVote.bind(this)},[(0,i.createElement)("input",{type:"radio",name:"nps-survey-option",value:e}),(0,i.createElement)("span",{class:"nps-survey__score-label"})]))))}hide(){super.hide(),this.voted||(this.checkPossibleSendVote()||this.getFeedbackGood()||this.getFeedbackBetter()?this.sendVote():this.sendHide())}handleVoteButton(){this.checkPossibleSendVote()&&(this.voted=!0,this.sendVote(),this.hide(),new a)}checkPossibleSendVote(){const e=this._componentElement.querySelector(".nps-survey"),t=this.getRate();if(t){e.classList.remove("error");const t=e.querySelector(".field-errors");t&&t.parentNode.removeChild(t)}else{e.classList.add("error");e.querySelector(".field-errors")||(0,i.render)(e,`${this.lmsg("voteRequire")}`)}return t}sendVote(){i.api.post((0,i.prepareUrl)("/admin/aha/vote"),{voted:this.voted||!1,rate:this.getRate(),feedbackGood:this.getFeedbackGood(),feedbackBetter:this.getFeedbackBetter(),dialogAtPage:window.location.pathname})}sendHide(){i.api.post((0,i.prepareUrl)("/admin/aha/hide"))}getRate(){const e=this._componentElement.querySelector(`#${this.getId()}-form input[name=nps-survey-option]:checked`);return e?e.value:""}getFeedbackGood(){return this._componentElement.querySelector("#aha-good").value.trim()}getFeedbackBetter(){return this._componentElement.querySelector("#aha-better").value.trim()}}class a extends i.Popup{_initConfiguration(e){this.setLocale(i.Locale.getSection("components.aha"));const t=[{title:this.lmsg("thankButtonClose"),class:"action",handler(e,t){t.hide()}}],s=`

    ${this.lmsg("thankHint")}

    `;super._initConfiguration({id:"thank-dialog",title:this.lmsg("thankTitle"),closeButtonEnabled:!0,hideOnEscape:!0,content:s,buttons:t,...e})}}const o=e=>new n(e)}}]); //# sourceMappingURL=aha.js.map?3970222c785cb21fda2b