define(["core"],function(a){return a.create_module("outletLayer",function(h){var d,c,e,f,b,g=false; return{init:function(){d=this;c=h.getContainer();b=h.find(".outletTable tbody")[0]; h.library({name:"polling"},h);h.library({name:"lightBox"},h);e=this.library.lightBox.init(c); h.listen({"show-outletLayer":d.l_initLightBox,polling:d.library.polling.listen}); f=d.getJSONSettings();},destroy:function(){d=null;},getJSONSettings:function(){if(typeof settings==="object"){return settings; }else{a.log("ERRORS settings.additionalItems is not an object");return{};}},l_initLightBox:function(){if(!g){d.ajax_getAjaxData(); }e.open();},removeRows:function(){var i=h.find("tr");h.foreach(i,function(j){if(j>0){i[j].parentNode.removeChild(i[j]); }});},ajax_getAjaxData:function(){h.ajax({url:f.outletLayerURL,type:"GET",data:null,cache:true,dataType:"json",success:d.handleAjaxResponse,timeout:70000}); },handleAjaxResponse:function(j){var i=(typeof j==="object")?j:[];d.buildOutletTable(i); d.library.polling.end();},buildOutletTable:function(i){var j="firstRow";h.foreach(i,function(){var k=h.create_element("tr",{"class":j,children:[h.create_element("td",{text:this.name}),h.create_element("td",{"class":"col2 nowrap",text:this.fee}),h.create_element("td",{"class":"nowrap",text:this.total})]}); b.appendChild(k);j=="";});g=true;}};});});