/*! phoscon-app 2024-05-27 */

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 ShutdownGwHandlerView=Backbone.View.extend({template:_.template(document.getElementById("shutdown-gw-template").innerHTML),el:"#shutdownGwModal",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")},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.closeBtn.innerText=translate("btn_cancel"),this.nextBtn.classList.remove("hidden"),this.closeBtn.classList.remove("btn-primary"),this.logoutBtn.classList.add("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.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="page3"]').classList.add("active-page"),this.closeBtn.innerText=translate("text_okay"),this.closeBtn.classList.add("btn-primary"),this.nextBtn.classList.add("hidden"),this.footer.classList.add("danger")}});