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

import{serviceSend}from"./settings-gateway-machine.js";import{states,events}from"./settings-gateway-constants.js";import{removeClassFromAll,updateDateTime,getNetworkId}from"./settings-gateway-functions.js";export const RestartGwHandlerView=Backbone.View.extend({template:_.template(document.getElementById("restart-gw-template").innerHTML),el:"#restartGwModal",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")},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.closeBtn.innerText=translate("btn_cancel"),this.nextBtn.classList.remove("hidden"),this.closeBtn.classList.remove("btn-primary"),this.close.classList.remove("hidden"),this.footer.classList.remove("danger"),this.footer.classList.remove("success")},page2:function(){let elemList=this.el.querySelectorAll(".page");removeClassFromAll(elemList,"active-page"),this.el.querySelector('[data-page="page2"]').classList.add("active-page"),this.close.classList.add("hidden"),this.closeBtn.classList.add("invisible"),this.nextBtn.classList.add("invisible")},page3:function(){let elemList=this.el.querySelectorAll(".page");removeClassFromAll(elemList,"active-page"),this.el.querySelector('[data-page="page3"]').classList.add("active-page"),this.closeBtn.classList.remove("invisible"),this.nextBtn.classList.remove("invisible"),this.nextBtn.classList.remove("disabled"),this.closeBtn.innerText=translate("text_okay"),this.closeBtn.classList.add("btn-primary"),this.close.classList.remove("hidden"),this.nextBtn.classList.add("hidden"),this.footer.classList.add("success")},page4:function(){let elemList=this.el.querySelectorAll(".page");removeClassFromAll(elemList,"active-page"),this.el.querySelector('[data-page="page4"]').classList.add("active-page"),this.closeBtn.classList.remove("invisible"),this.nextBtn.classList.remove("invisible"),this.closeBtn.innerText=translate("text_okay"),this.closeBtn.classList.add("btn-primary"),this.close.classList.remove("hidden"),this.nextBtn.classList.add("hidden"),this.footer.classList.add("danger")}});