/*! phoscon-app 2024-10-07 */

import{serviceSend}from"./settings-gateway-machine.js";import{states,events}from"./settings-gateway-constants.js";import{removeClassFromAll}from"./settings-gateway-functions.js";export const ResetHomebridgeHandlerView=Backbone.View.extend({template:_.template(document.getElementById("reset-homebridge-template").innerHTML),el:"#resetHomebridgeModal",initialize:function(){this.el.innerHTML=this.template(app.config),this.nextBtn=this.el.querySelector(".btn-next"),this.closeBtn=this.el.querySelector(".btn-close"),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 .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.remove("success"),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.closeBtn.classList.remove("hidden")},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.add("invisible"),this.closeBtn.classList.add("invisible"),this.close.classList.add("hidden")},page3:function(){let elemList=this.el.querySelectorAll(".page");removeClassFromAll(elemList,"active-page"),this.el.querySelector('[data-page="page3ok"]').classList.add("active-page"),this.closeBtn.innerText=translate("text_done"),this.closeBtn.classList.remove("invisible"),this.closeBtn.classList.add("btn-primary"),this.footer.classList.add("success"),this.nextBtn.classList.remove("invisible"),this.nextBtn.classList.add("hidden"),this.close.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.close.classList.remove("hidden"),this.nextBtn.classList.remove("invisible"),this.nextBtn.classList.add("hidden")}});