/*! phoscon-app 2023-07-31 */

import{serviceSend}from"./settings-gateway-machine.js";import{states,events}from"./settings-gateway-constants.js";import{removeClassFromAll}from"./settings-gateway-functions.js";export const ResetHandlerView=Backbone.View.extend({template:_.template(document.getElementById("reset-gateway-template").innerHTML),el:"#resetGatewayModal",initialize:function(){this.el.innerHTML=this.template(app.config),this.nextBtn=this.el.querySelector(".btn-next"),this.closeBtn=this.el.querySelector(".btn-close"),this.logoutBtn=this.el.querySelector(".btn-logout"),this.close=this.el.querySelector(".close"),this.footer=this.el.querySelector(".modal-footer"),this.resetInfo=this.el.querySelector("#reset-status")},events:{"click .btn-next":function(){serviceSend(events.NEXT_PRESSED)},"click .btn-close":function(){serviceSend(events.CLOSE_PRESSED)},"click .btn-logout":function(){logout()},"click .close":function(){serviceSend(events.CLOSE_PRESSED)}},render:function(){return this},show:function(){this.el.classList.add("show")},hide:function(){this.el.classList.remove("show")},page1:function(){let elemList=this.el.querySelectorAll(".page");removeClassFromAll(elemList,"active-page"),this.el.querySelector('[data-page="page1"]').classList.add("active-page"),this.footer.classList.add("danger"),this.nextBtn.innerText=translate("text_reset"),this.closeBtn.innerText=translate("btn_cancel"),this.closeBtn.classList.remove("btn-primary"),this.nextBtn.classList.remove("hidden"),this.nextBtn.classList.add("btn-danger")},page2:function(){let elemList=this.el.querySelectorAll(".page");removeClassFromAll(elemList,"active-page"),this.el.querySelector('[data-page="page2"]').classList.add("active-page"),this.footer.classList.remove("danger"),this.nextBtn.classList.remove("btn-danger"),this.nextBtn.classList.add("invisible"),this.close.classList.add("hidden"),this.closeBtn.classList.add("invisible")},page3:function(){let elemList=this.el.querySelectorAll(".page");removeClassFromAll(elemList,"active-page"),this.el.querySelector('[data-page="page3ok"]').classList.add("active-page"),this.footer.classList.add("success"),this.logoutBtn.classList.remove("hidden"),this.closeBtn.classList.remove("invisible"),this.closeBtn.classList.add("hidden"),this.nextBtn.classList.remove("invisible"),this.nextBtn.classList.add("hidden"),"other"===app.config.attributes.system&&this.resetInfo.classList.remove("hidden")},page4:function(){let elemList=this.el.querySelectorAll(".page");removeClassFromAll(elemList,"active-page"),this.el.querySelector('[data-page="page4fail"]').classList.add("active-page"),this.footer.classList.add("danger"),this.closeBtn.innerText=translate("text_done"),this.closeBtn.classList.remove("invisible"),this.closeBtn.classList.add("btn-primary"),this.nextBtn.classList.remove("invisible"),this.nextBtn.classList.add("hidden"),this.close.classList.remove("hidden")}});