/*! phoscon-app 2024-01-19 */

import{ButtonEvents}from"./state-constants.js";export const ApConfiguredHandlerView=Backbone.View.extend({template:_.template(document.getElementById("ap-configured-template").innerHTML),id:"apConfigured",className:"sub-view",initialize:function(){this.el.innerHTML=this.template(app.wifi),app.apStateElement.appendChild(this.el),this.configBtn=this.el.querySelector(".btn-change-config")},events:{"click .btn-change-config":function(){app.stateEventHandler(ButtonEvents.CHANGE_AP_PRESSED)},"click .btn-deactivate":function(){app.stateEventHandler(ButtonEvents.DEACTIVATE_AP_PRESSED)}},render:function(){let name=app.wifi.get("workingname"),ip=app.wifi.get("ip"),wifi=app.wifi.get("wifi");if(null!==name||"deactivated"===wifi)return app.wifi.get("eth0")?this.configBtn.classList.remove("not-cabled"):this.configBtn.classList.add("not-cabled"),this.el.querySelector(".ap_name").innerHTML=name,this.el.querySelector(".ap_ip").innerHTML=ip,this},show:function(){this.el.classList.add("active-view"),this.render()},hide:function(){this.el.classList.remove("active-view")}});