Ext.form.ClearableComboBox=Ext.extend(Ext.form.ComboBox,{initComponent:function(){Ext.form.ClearableComboBox.superclass.initComponent.call(this);this.triggerConfig={tag:"span",cls:"x-form-twin-triggers",cn:[{tag:"img",src:Ext.BLANK_IMAGE_URL,cls:"x-form-trigger"},{tag:"img",src:Ext.BLANK_IMAGE_URL,cls:"x-form-trigger x-form-clear-trigger"}]}},getTrigger:function(A){return this.triggers[A]},initTrigger:function(){var A=this.trigger.select(".x-form-trigger",true);this.wrap.setStyle("overflow","hidden");var B=this;A.each(function(D,F,C){D.hide=function(){var G=B.wrap.getWidth();this.dom.style.display="none";B.el.setWidth(G-B.trigger.getWidth())};D.show=function(){var G=B.wrap.getWidth();this.dom.style.display="";B.el.setWidth(G-B.trigger.getWidth())};var E="Trigger"+(C+1);if(this["hide"+E]){D.dom.style.display="none"}D.on("click",this["on"+E+"Click"],this,{preventDefault:true});D.addClassOnOver("x-form-trigger-over");D.addClassOnClick("x-form-trigger-click")},this);this.triggers=A.elements},onTrigger1Click:function(){this.onTriggerClick()},onTrigger2Click:function(){this.reset()}});Ext.form.CustomActionComboBox=Ext.extend(Ext.form.ComboBox,{initComponent:function(){Ext.form.CustomActionComboBox.superclass.initComponent.call(this);this.triggerConfig={tag:"span",cls:"x-form-twin-triggers",cn:[{tag:"img",src:Ext.BLANK_IMAGE_URL,cls:"x-form-trigger"},{tag:"img",src:Ext.BLANK_IMAGE_URL,cls:"x-form-trigger x-form-add-trigger"}]}},getTrigger:function(A){return this.triggers[A]},customAction:function(){alert("ahoj")},initTrigger:function(){var A=this.trigger.select(".x-form-trigger",true);this.wrap.setStyle("overflow","hidden");var B=this;A.each(function(D,F,C){D.hide=function(){var G=B.wrap.getWidth();this.dom.style.display="none";B.el.setWidth(G-B.trigger.getWidth())};D.show=function(){var G=B.wrap.getWidth();this.dom.style.display="";B.el.setWidth(G-B.trigger.getWidth())};var E="Trigger"+(C+1);if(this["hide"+E]){D.dom.style.display="none"}D.on("click",this["on"+E+"Click"],this,{preventDefault:true});D.addClassOnOver("x-form-trigger-over");D.addClassOnClick("x-form-trigger-click")},this);this.triggers=A.elements},onTrigger1Click:function(){this.onTriggerClick()},onTrigger2Click:function(){this.customAction()}});Ext.namespace("Ext.ux","Ext.ux.grid");Ext.ux.grid.Search=function(A){Ext.apply(this,A,{position:"bottom",searchText:"Search",searchTipText:"Type a text to search and press Enter",iconCls:"ux-icon-search",checkIndexes:"all",disableIndexes:[],dateFormat:undefined,mode:"remote",paramNames:{fields:"fields",query:"query"}});Ext.ux.grid.Search.superclass.constructor.call(this)};Ext.extend(Ext.ux.grid.Search,Ext.util.Observable,{init:function(A){this.grid=A;A.onRender=A.onRender.createSequence(this.onRender,this);A.reconfigure=A.reconfigure.createSequence(this.reconfigure,this)},onRender:function(){var B=this.grid;var A="bottom"==this.position?B.bottomToolbar:B.topToolbar;this.menu=new Ext.menu.Menu();A.add({text:this.searchText,menu:this.menu,iconCls:this.iconCls});this.field=new Ext.form.TwinTriggerField({width:this.width,selectOnFocus:undefined===this.selectOnFocus?true:this.selectOnFocus,trigger1Class:"x-form-clear-trigger",trigger2Class:"x-form-search-trigger",onTrigger1Click:this.onTriggerClear.createDelegate(this),onTrigger2Click:this.onTriggerSearch.createDelegate(this)});this.field.on("render",function(){this.field.el.dom.qtip=this.searchTipText;var C=new Ext.KeyMap(this.field.el,[{key:Ext.EventObject.ENTER,scope:this,fn:this.onTriggerSearch},{key:Ext.EventObject.ESC,scope:this,fn:this.onTriggerClear}]);C.stopEvent=true},this,{single:true});A.add(this.field);this.reconfigure()},onTriggerClear:function(){this.field.setValue("");this.field.focus();this.onTriggerSearch()},onTriggerSearch:function(){var C=this.field.getValue();var B=this.grid.store;if("local"===this.mode){B.clearFilter();if(C){B.filterBy(function(E){var D=false;this.menu.items.each(function(G){if(!G.checked||D){return }var H=E.get(G.dataIndex);H=H instanceof Date?H.format(this.dateFormat||E.fields.get(G.dataIndex).dateFormat):H;var F=new RegExp(C,"gi");D=F.test(H)},this);if(D){return true}return D},this)}else{}}else{if(B.lastOptions){B.lastOptions.params[B.paramNames.start]=0}var A=[];this.menu.items.each(function(D){if(D.checked){A.push(D.dataIndex)}});delete (B.baseParams[this.paramNames.fields]);delete (B.baseParams[this.paramNames.query]);delete (B.lastOptions.params[this.paramNames.fields]);delete (B.lastOptions.params[this.paramNames.query]);if(A.length){B.baseParams[this.paramNames.fields]=Ext.encode(A);B.baseParams[this.paramNames.query]=C}B.reload()}},reconfigure:function(){var B=this.menu;B.removeAll();var A=this.grid.colModel;Ext.each(A.config,function(D){var C=false;if(D.header){Ext.each(this.disableIndexes,function(E){C=C?C:E===D.dataIndex});if(!C){B.add(new Ext.menu.CheckItem({text:D.header,hideOnClick:false,checked:"all"===this.checkIndexes,dataIndex:D.dataIndex}))}}},this);if(this.checkIndexes instanceof Array){Ext.each(this.checkIndexes,function(D){var C=B.items.find(function(E){return E.dataIndex===D});if(C){C.setChecked(true,true)}},this)}}});Ext.form.ColorField=function(A){Ext.form.ColorField.superclass.constructor.call(this,A)};Ext.extend(Ext.form.ColorField,Ext.form.TriggerField,{invalidText:'This is not a valid color - it must be in a the hex format "#1A2B3C"',triggerClass:"x-form-color-trigger",defaultAutoCreate:{tag:"input",type:"text",size:"10",maxlength:"7",autocomplete:"off"},maskRe:/[#a-f0-9]/i,regex:/^#([a-f0-9]{3}|[a-f0-9]{6})$/i,validateValue:function(B){if(!Ext.form.ColorField.superclass.validateValue.call(this,B)){return false}if(B.length<1){return true}var A=this.parseColor(B);if(!B||(A==false)){this.markInvalid(this.invalidText);return false}return true},validateBlur:function(){return !this.menu||!this.menu.isVisible()},getValue:function(){return Ext.form.ColorField.superclass.getValue.call(this)||""},setValue:function(A){Ext.form.ColorField.superclass.setValue.call(this,this.formatColor(A))},parseColor:function(A){return(!A||(A.substring(0,1)!="#"))?false:true},formatColor:function(A){if(A&&(this.parseColor(A)==false)){A="#"+A}return A},menuListeners:{select:function(A,B){this.setValue(B)},show:function(){this.onFocus()},hide:function(){this.focus();var A=this.menuListeners;this.menu.un("select",A.select,this);this.menu.un("show",A.show,this);this.menu.un("hide",A.hide,this)}},colors:false,onTriggerClick:function(){if(this.disabled){return }if(this.menu==null){this.menu=new Ext.menu.ColorMenu()}this.menu.on(Ext.apply({},this.menuListeners,{scope:this}));if(this.colors){this.menu.palette.colors=this.colors}this.menu.show(this.el,"tl-bl?")}});Ext.grid.CheckColumn=function(A){Ext.apply(this,A);if(!this.id){this.id=Ext.id()}this.renderer=this.renderer.createDelegate(this)};Ext.grid.CheckColumn.prototype={init:function(A){this.grid=A;this.grid.on("render",function(){var B=this.grid.getView();B.mainBody.on("mousedown",this.onMouseDown,this)},this)},onMouseDown:function(D,C){if(C.className&&C.className.indexOf("x-grid3-cc-"+this.id)!=-1){D.stopEvent();var B=this.grid.getView().findRowIndex(C);var A=this.grid.store.getAt(B);A.set(this.dataIndex,!A.data[this.dataIndex])}},renderer:function(B,C,A){C.css+=" x-grid3-check-col-td";return'<div class="x-grid3-check-col'+(B?"-on":"")+" x-grid3-cc-"+this.id+'"><span style="visibility:hidden;">'+(B?"checked":"")+"</span>&#160;</div>"}};Ext.namespace("echarter");echarter.adminApp=function(){var B;var BW;var A3;var BX;var An;var Q;var P;var BU;var l;var u;var AS;var AF;var Bu;var Au;var Bv;var i;var J;var AN;var AL;var B1;var A1;var CB;var Ai;var CQ;var CP;var AV;var Bc;var g;var Ab;var Ac;var CT;var E;var p;var AX;var AZ;var A6;var As;var B3;var Ak;var BH;var BI;var BD;var A2;var Ba;var CJ;var AB;var y;var x;var w;var v;var t;var r;var q;var o;var AQ;var CF;var e;var c;var a;var Z;var Y;var X;var W;var U;var T;var AP;var CE;var AO;var CD;var BE;var CW;var b;var A4;var B0;var j;var Ao;var Bz;var BM;var Bn;var BQ;var S;var BC;var AD;var CM;var n;var Av;var Be;var O;var BK=false;var M;var A0;var Bh;var AC=false;var Ar;var CH;var I;var BO=false;var AK;var Bs;var CS;var Aj=false;var BT;var V;var AU;var CN=false;var AT;var Bf;var CI;var H=false;var BZ=false;var f;var z;var K;var Bd=false;var BR;var Bj;var CG;var AJ=false;var L;var B4;var Am;var F=false;var BY="0";orderSheetSeasonsAheadQuery="0";var BV=true;var Bq;var AR;var Bp;var A8=false;var R;var AW;var Az;var Bw;var A9=false;var CU;var B6;var AM;var Ay;var Bg=false;var m;var BB;var Bb=false;var Af;var Ag;var BJ=false;var Aa;var A7=false;var AI=true;var A;var Bm;var BF;var Ae;var B8;var AY;var Bl;var Bk;var AG;var Ad;var CY=new Array();var BP=new Array();var Bx=0;var CK=0;var At=new Array();var Bi="1";var AE;var CR;var CX;var A5;var CL;var BN;var CO;var C;var BL;var CV;var Al="season";var AA=30;var B5=true;var BG=false;var B2=0;var CA=1000;Ext.override(Ext.form.Checkbox,{setBoxLabel:function(CZ){if(this.labelEl){this.labelEl.update(CZ)}}});function B7(){var CZ=BE.selModel.selections.keys;if(CZ.length>0){if(Al.indexOf("order_sheet_season_")>=0){Ext.MessageBox.confirm(CX.zpravaStr,"Opravdu chcete stornovat označené objednávky?",CC)}else{Ext.MessageBox.confirm(CX.zpravaStr,CX.deleteStr,CC)}}else{Ext.MessageBox.alert(CX.zpravaStr,CX.selOne)}}function Br(){var Cb=BE.selModel.selections.items;var Ca=BE.selModel.selections.keys;var CZ=Ext.encode(Ca);Ext.Ajax.request({url:A5+"/apiIn.php",params:{what:"delete_check",product_id:CU,gridContains:Al,keys:CZ},callback:function(Cd,Cg,Cc){if(Cg){var Cf=Ext.util.JSON.decode(Cc.responseText);var Ce="";B2=Cf.del_count;if(B2>0){Ce="<br /><br /><br />"+CX.weightCheckStr.replace(/<% weightCnt %>/,B2)}Ext.MessageBox.confirm(CX.zpravaStr,CX.deleteStr+Ce,CC)}else{Ext.MessageBox.confirm(CX.zpravaStr,CX.deleteStr,CC)}},failure:function(Cc,Cd){Ext.MessageBox.confirm(CX.zpravaStr,CX.deleteStr,CC)}})}function CC(CZ){if(CZ=="yes"){var Cc=BE.selModel.selections.items;var Cb=BE.selModel.selections.keys;var Ca=Ext.encode(Cb);Ext.Ajax.request({waitMsg:CX.deleting,url:A5+"/apiIn.php",params:{what:"delete",product_id:CU,gridContains:Al,keys:Ca},callback:function(Ce,Cg,Cd){if(Cg){var Cf=Ext.util.JSON.decode(Cd.responseText);if(Cf.del_count==1){s=Cf.del_count+" "+CX.recDeleted1+"."}else{if(Cf.del_count<5){s=Cf.del_count+" "+CX.recDeleted4+"."}else{s=Cf.del_count+" "+CX.recDeletedMore+"."}}ss=CX[Al];if(B5){Ext.msger.msg(ss,s,CZ)}document.getElementById("south").innerHTML="<p><b>"+ss+":</b> "+s+"</p>"+document.getElementById("south").innerHTML}else{Ext.MessageBox.alert(CX.errTryAgain+" [Q304]",Cd.responseText)}},failure:function(Cd,Ce){Ext.MessageBox.alert(CX.warnStr,"Oops...")},success:function(Cd,Ce){BE.selModel.clearSelections();BE.store.reload()}})}}function BA(Cc){var Cb=BE.selModel.selections.items;var Ca=BE.selModel.selections.keys;var CZ=Ext.encode(Ca);Ext.Ajax.request({waitMsg:CX.actualisingStr,url:A5+"/apiIn.php",params:{what:"changeordersheetstate",state:Cc,keys:CZ},callback:function(Ce,Cg,Cd){if(Cg){var Cf=Ext.util.JSON.decode(Cd.responseText);if(Cf.del_count==1){s=Cf.del_count+" "+CX.recSynced1+"."}else{if(Cf.del_count<5){s=Cf.del_count+" "+CX.recSynced4+"."}else{s=Cf.del_count+" "+CX.recSyncedMore+"."}}ss=CX[Al];if(B5){Ext.msger.msg(ss,s)}document.getElementById("south").innerHTML="<p><b>"+ss+":</b> "+s+"</p>"+document.getElementById("south").innerHTML}else{Ext.MessageBox.alert(CX.errTryAgain+" [Q304]",Cd.responseText)}},failure:function(Cd,Ce){Ext.MessageBox.alert(CX.warnStr,"Oops...")},success:function(Cd,Ce){BE.selModel.clearSelections();BE.store.reload()}})}function Ah(CZ){Ext.Ajax.request({waitMsg:CX.actualisingStr,url:A5+"/apiIn.php",params:{what:"save",record:Al,data:CZ},callback:function(Cb,Cd,Ca){if(Cd){var Cc=Ext.util.JSON.decode(Ca.responseText);if(Cc.del_count==1){s=Cc.del_count+" "+CX.recSynced1+"."}else{if(Cc.del_count<5){s=Cc.del_count+" "+CX.recSynced4+"."}else{s=Cc.del_count+" "+CX.recSyncedMore+"."}}ss=CX[Al];if(Al=="order_sheet_products"){ss+=" "+R}if(B5){Ext.msger.msg(ss,s)}document.getElementById("south").innerHTML="<p><b>"+ss+":</b> "+s+"</p>"+document.getElementById("south").innerHTML}else{Ext.MessageBox.alert(CX.errTryAgain+" [Q304]",Ca.responseText)}},failure:function(Ca,Cb){Ext.MessageBox.alert(CX.warnStr,"Oops...")},success:function(Ca,Cb){BE.selModel.clearSelections();BE.store.reload()}})}function N(CZ){return CZ?CZ.dateFormat("M d, Y H:i:s"):""}function D(CZ){return CZ?CZ.dateFormat("j.n.Y H:i:s"):""}function By(CZ){return CZ?CZ.dateFormat("j.n."):""}function Bo(CZ){return CZ?CZ.dateFormat("M d, Y"):""}function Aw(CZ){return CZ}function BS(Cb){var Ca="";for(var CZ=0;CZ<Cb.length;CZ++){Ca+="*"}return Ca}function Ap(CZ){if(isNaN(CZ)){return"--"}CZ=(Math.round((CZ-0)*100))/100;CZ=(CZ==Math.floor(CZ))?CZ+".00":((CZ*10==Math.floor(CZ*10))?CZ+"0":CZ);CZ=String(CZ);var Cd=CZ.split(".");var Cc=Cd[0];var Ca=Cd[1]?"."+Cd[1]:".00";var Cb=/(\d+)(\d{3})/;while(Cb.test(Cc)){Cc=Cc.replace(Cb,"$1 $2")}CZ=Cc+Ca;if(CZ.charAt(0)=="-"){return CZ.substr(1)}return CZ}function Bt(CZ){if(CZ>0){return'<span style="color:green">'+CZ+"%</span>"}else{return CZ}}function h(CZ){return"<a href=\"javascript:echarter.adminApp.setDatasPub('distributor','"+CZ+"')\">"+CZ+"</a>"}var Ax=Ext.form;var Aq=new Ext.grid.CheckboxSelectionModel();function d(Cd,Cb){if((BE.selModel.getCount()==1)&&(typeof (BE.selModel.selections.keys[0])=="string")){b.enable();BC.enable();A4.enable();B0.enable();Bk.enable();Ad.enable()}else{b.disable();BC.disable();A4.disable();B0.disable();Bk.disable();Ad.disable()}if(BE.selModel.getCount()>0){if(Al.indexOf("order_sheet_season_")>=0){var Cc=BE.selModel.selections.items;var CZ=0;for(var Ca=0;Ca<Cc.length;Ca++){CZ+=Cc[Ca].get("price_to_submit_date")}Ao.items.each(function(Ce){if(Ce.id=="totalcountorders"){Ce.setText("&sum; "+Ap(CZ)+" Kč")}},Ao)}BQ.enable();if((Al.indexOf("order_sheet_season_")>=0)&&(Bi!=0)){var Cc=BE.selModel.selections.items;BF.enable();for(var Ca=0;Ca<Cc.length;Ca++){if(Cc[Ca].get("state")!=1){BF.disable()}}}else{BF.enable()}AY.enable();Bl.enable();B8.enable()}else{if(Al.indexOf("order_sheet_season_")>=0){Ao.items.each(function(Ce){if(Ce.id=="totalcountorders"){Ce.setText("&sum; "+Ap(0)+" Kč")}},Ao)}BQ.disable();BF.disable();AY.disable();Bl.disable();B8.disable()}}function B9(Cc,Cf,Cb){At[Al]=CW.field.getValue();if(Cb!=true){CY[Bx]=Cc;if(Cf){BP[Bx]=Cf}else{BP[Bx]=false}Bx+=1;CK=Bx;if(Bx>1){Ak.items.get("backwards").enable();Ak.items.get("forwards").disable()}}Bm.hide();B8.hide();AY.hide();Bl.hide();BF.show();Bm.disable();BF.disable();Ae.show();Bk.hide();Ad.hide();AG.disable();AG.hide();b.disable();A4.disable();B0.disable();BQ.disable();AY.disable();B8.disable();Bl.disable();b.hide();BC.hide();A4.hide();B0.hide();BM.hide();Bn.hide();BQ.hide();A.hide();j.enable();j.show();Ao.hide();Bz.hide();S.unbind(BE.store);BE.setTitle(CX[Cc]);switch(Cc){case"product":if(!Aj){Bs.load()}if(!H){Bf.load()}B0.show();BE.reconfigure(z,f);Al="product";break;case"discount":BE.reconfigure(CH,Ar);Al="discount";break;case"location":BE.reconfigure(Bs,AK);Al="location";break;case"season":BE.reconfigure(Be,Av);Al="season";break;case"currency":BE.reconfigure(V,BT);Al="currency";break;case"distributor":BE.reconfigure(Bf,AT);Al="distributor";break;case"product_price":if(!CN){V.load()}var Ca="";if((z.getById(Cf).get("code_flag")==1)||(z.getById(Cf).get("code_flag")=="1")){Ca="L"}AM.proxy.url=A5+"/apiOut.php?what=product_price&product_id="+Cf;BE.setTitle(CX.priceStr+" "+CX.assignedToProdStr+" "+z.getById(Cf).get("name")+Ca+" ("+Cf+")");BE.reconfigure(AM,B6);Al="product_price";CU=Cf;break;case"order_sheet_docs":j.hide();BF.hide();Ae.hide();Ad.show();AR.proxy.url=A5+"/apiOut.php?what=order_sheet_docs&order_sheet_id="+Cf;BE.setTitle("Dokumenty vygenerované k objednávce číslo "+Cf);BE.reconfigure(AR,Bq);Al="order_sheet_docs";R=Cf;break}if(Cc.indexOf("order_sheet_season_")>=0){if(!CN){V.load()}if(!Aj){Bs.load()}var Ce="";if(BY!="0"){var CZ="orderSheetStateStrs"+BY;Ce=" ("+CX[CZ]+")"}var Cd="";if(orderSheetSeasonsAheadQuery!="0"){var CZ="orderSheetSeasonsAheadStrs"+orderSheetSeasonsAheadQuery;Cd=CX.onlyStr+" "+CX[CZ]}else{Cd=CX["orderStr"]}BE.setTitle(Cd+": "+CX[Cc]+Ce);B4.proxy.url=A5+"/apiOut.php?what=order_sheet&seasonId="+Cc.substring(1+Cc.lastIndexOf("_"))+"&state="+BY;BE.reconfigure(B4,L);Al=Cc;BF.hide();j.hide();BC.show();if(Bi!=0){Ae.hide()}AY.show();Bl.show();B8.show();Ao.show()}CW.field.setValue(At[Al]);BE.store.fireEvent("datachanged",BE.store);BE.store.load({params:{start:0,limit:AA}});S.bind(BE.store);BE.getView().fitColumns()}function k(CZ){AA=CZ;S.pageSize=CZ;BE.store.load({params:{start:0,limit:AA}});Ext.Ajax.request({url:A5+"/apiIn.php?what=adminconfig&paging="+CZ,success:function(){if(B5){Ext.msger.msg("",CX.configSaved)}},failure:function(){}})}function AH(Cc){if(Cc!=undefined){var Cb=Cc.substring(1,3);var Ca=Cc.substring(3,5);var CZ=Cc.substring(5,7);return(parseInt(Cb,16)+parseInt(Ca,16)+parseInt(CZ,16))/3}}function G(){CL=new Ext.grid.CheckColumn({header:CX.selectionHdr,dataIndex:"selected",width:45,fixed:true});BN=new Ext.form.ColorField({hiddenName:"color",showHexValue:true});Af=Ext.data.Record.create([{name:"id",type:"float"},{name:"name",type:"string"},{name:"modifier_id",type:"string"},{name:"description",type:"string"},{name:"modified_on",type:"date",dateFormat:"Y-m-d H:i:s"}]);Ag=new Ext.data.Store({proxy:new Ext.data.ScriptTagProxy({url:A5+"/apiOut.php?what=distributor"}),reader:new Ext.data.JsonReader({root:"rslt",id:"id",totalProperty:"total"},Af),baseParams:{start:0,limit:AA},remoteSort:false,sortInfo:{field:"name",direction:"ASC"}});Ag.on("load",function(){BJ=true});Aa=new Ext.data.Store({proxy:new Ext.data.ScriptTagProxy({url:A5+"/apiOut.php?what=distributor"}),reader:new Ext.data.JsonReader({root:"rslt",id:"id",totalProperty:"total"},Af),remoteSort:false,sortInfo:{field:"name",direction:"ASC"}});Aa.on("load",function(){A7=true});CQ=new Ext.form.ClearableComboBox({id:"combodis1",fieldLabel:"Agentura",name:"for_distributor",valueField:"id",displayField:"name",store:Aa,typeAhead:false,editable:false,triggerAction:"all",emptyText:"Vyberte agenturu..",lazyRender:true,hideLabel:true,hidden:true,anchor:"100%",selectOnFocus:true});CP=new Ext.form.CustomActionComboBox({id:"combodis2",fieldLabel:"Zákazník",name:"for_customer",valueField:"id",displayField:"name",store:Aa,typeAhead:false,editable:false,triggerAction:"all",emptyText:"Koncový zákazník..",lazyRender:true,hideLabel:true,hidden:true,anchor:"100%",customAction:function(){B1.show()},selectOnFocus:true,listeners:{select:function(Di,Dh,Dj){DM.findById("client_name").setValue(Dh.data["id"]+" - "+Dh.data["name"])}}});m=Ext.data.Record.create([{name:"id",type:"float"},{name:"lang_id",type:"float"},{name:"cze",type:"string"},{name:"eng",type:"string"},{name:"modifier_id",type:"string"},{name:"description",type:"string"},{name:"modified_on",type:"date",dateFormat:"Y-m-d H:i:s"}]);BB=new Ext.data.Store({proxy:new Ext.data.ScriptTagProxy({url:A5+"/apiOut.php?what=location"}),reader:new Ext.data.JsonReader({root:"rslt",totalProperty:"total"},m),baseParams:{start:0,limit:AA},remoteSort:false,sortInfo:{field:"id",direction:"ASC"}});BB.on("load",function(){Bb=true});function Cj(){if(u!=null){var Dm=AF.getValue().format("U")+AF.getValue().format("Z");var Dn=Bu.getValue().format("U")+Bu.getValue().format("Z");var Dh=Math.abs(Dm-Dn)<6*24*60*60?"1":"0";var Dj=0;for(var Dk in u){var Dl=u[Dk];if((Dl["price_type"]==Dh)&&((Dl["date_to"]>=Dn)||(Dl["date_to"]==null))&&(((Dl["date_from"]<=Dm)||(Dl["date_from"]==null)))){if(Di==undefined){var Di=Dl["sort"];Dj=Dl["value"]}if(Di<Dl["sort"]){var Di=Dl["sort"];Dj=Dl["value"]}}}if(Dj!=0){if(Dh==0){return(Math.abs(Dm-Dn)+1*24*60*60)*1*Dj/(7*24*60*60)}else{return(Math.abs(Dm-Dn)+1*24*60*60)*1*Dj/(24*60*60)}}else{return"N/A"}}else{return"N/A"}}function DR(Dh){var Dj={};for(var Di=0;Di<Dh.length;Di++){Dj[Dh[Di]]=""}return Dj}function DY(Di){if(AS!=""){var Dh=[];Dh=DR(AS.split(","));if(Di in Dh){return false}}return true}var Cp=true;var DL=true;CB=new Ext.form.ComboBox({id:"setlocfrom",fieldLabel:"Odkud",name:"location_from",valueField:"id",displayField:"cze",store:BB,typeAhead:false,editable:false,triggerAction:"all",emptyText:"Vyberte lokaci..",lazyRender:true,selectOnFocus:true,msgTarget:"under",anchor:"100%",listeners:{select:function(Di,Dh,Dj){this.clearInvalid();Cp=true;if(!DY(Dh.data["id"])){this.markInvalid("Do této lokace je nutné zajistit převoz této lodi po pevnině.");Cp=false}DM.findById("locchng_charge").setValue(Ai.getValue()!=CB.getValue());AF.fireEvent("change",AF,AF.getValue(),AF.getValue())},blur:function(Dh){this.clearInvalid();Cp=true;if(!DY(this.getValue())){this.markInvalid("Do této lokace je nutné zajistit převoz této lodi po pevnině.");Cp=false}}}});Ai=new Ext.form.ComboBox({id:"setlocto",fieldLabel:"Kam",name:"location_to",valueField:"id",displayField:"cze",store:BB,typeAhead:false,editable:false,triggerAction:"all",emptyText:"Vyberte lokaci..",lazyRender:true,selectOnFocus:true,msgTarget:"under",anchor:"100%",listeners:{select:function(Di,Dh,Dj){this.clearInvalid();DL=true;if(!DY(Dh.data["id"])){this.markInvalid("Do této lokace je nutné zajistit převoz této lodi po pevnině.");DL=false}DM.findById("locchng_charge").setValue(Ai.getValue()!=CB.getValue());Bu.fireEvent("change",Bu,Bu.getValue(),Bu.getValue())},blur:function(Dh){this.clearInvalid();DL=true;if(!DY(this.getValue())){this.markInvalid("Do této lokace je nutné zajistit převoz této lodi po pevnině.");DL=false}}}});var Cx=false;var C2=true;var Cf=true;AF=new Ext.form.DateField({id:"setdatefrom",xtype:"datefield",format:"d-m-Y",minValue:"01-01-2009",fieldLabel:"Odjezd",name:"date_from",msgTarget:"under",listeners:{change:function(Dl,Dj,Di){this.clearInvalid();C2=true;this.blur();if((BU.loc!=0)&&(CB.getValue()!=0)){if(CB.getValue()!=BU.loc){if((Dj.format("U")-BU.date.format("U"))<60*60*24*6){AF.markInvalid("Není jisté, zda se podaří loď na zadané místo za zvolenou dobu dopravit.")}}}if((Bu.getValue().format("U")-AF.getValue().format("U"))<0){AF.markInvalid("Datum příjezdu je starší než datum odjezdu.")}if(!Cx){Cx=true;Bu.fireEvent("change",Bu,Bu.getValue(),Bu.getValue())}else{Cx=false}if((C2==true)&&(Cf==true)&&(CB.getValue()!=0)&&(Ai.getValue()!=0)&&(DL==true)&&(Cp==true)){DM.buttons[0].enable()}else{DM.buttons[0].disable()}if((Bi==0)&&(CB.getValue()!=0)&&(Ai.getValue()!=0)&&((Bu.getValue().format("U")-AF.getValue().format("U"))>=0)){DM.buttons[0].enable()}DM.findById("2weeks_discount").setValue(((Bu.getValue().format("U")+Bu.getValue().format("Z"))-(AF.getValue().format("U")+AF.getValue().format("Z")))>=13*24*60*60);DM.findById("3weeks_discount").setValue(((Bu.getValue().format("U")+Bu.getValue().format("Z"))-(AF.getValue().format("U")+AF.getValue().format("Z")))>=20*24*60*60);var Dm=1;if(DM.findById("2weeks_discount").getValue()==true){Dm-=0.05}if(DM.findById("3weeks_discount").getValue()==true){Dm-=0.05}for(var Dk=0;Dk<n.count;Dk++){if(DM.findById("discount_id_"+n.data[Dk].id).getValue()==true){Dm-=n.data[Dk].value/100}}if(Dm<0.85){Dm=0.85}var Dh=0;if(DM.findById("locchng_charge").getValue()==true){Dh+=CA}Au.setText("Konečná cena: "+Ap(Math.round(Cj()*Dm+Dh))+" Kč")},invalid:function(Dh,Di){C2=false}},menuListeners:{select:function(Dj,Di){var Dh=this.getValue();this.setValue(Di);this.fireEvent("change",this,Di,Dh)}},anchor:"100%"});Bu=new Ext.form.DateField({id:"setdateto",xtype:"datefield",format:"d-m-Y",minValue:"01-01-2009",fieldLabel:"Příjezd",name:"date_to",msgTarget:"under",listeners:{change:function(Dj,Di,Dh){this.clearInvalid();Cf=true;this.blur();if((l.loc!=0)&&(Ai.getValue()!=0)){if(Ai.getValue()==CB.getValue()){if((Ai.getValue()!=l.loc)&&((l.date.format("U")-Di.format("U"))<=60*60*24*6)){Bu.markInvalid("Není jisté, zda se podaří loď dopravit na začátek její další akce.")}}else{if(Math.abs(AF.getValue().format("U")-Di.format("U"))<60*60*24*6){Bu.markInvalid("Není jisté, zda se s lodí dokážete dostat do cílové stanice.")}else{if((Ai.getValue()!=l.loc)&&((l.date.format("U")-Di.format("U"))<=60*60*24*6)){Bu.markInvalid("Není jisté, zda se podaří loď dopravit na začátek její další akce.")}}}}else{if((Ai.getValue()!=0)&&(CB.getValue()!=0)){if(Math.abs(AF.getValue().format("U")-Di.format("U"))<60*60*24*6){if(Ai.getValue()!=CB.getValue()){Bu.markInvalid("Není jisté, zda se s lodí dokážete dostat do cílové stanice.")}}}}if((Bu.getValue().format("U")-AF.getValue().format("U"))<0){Bu.markInvalid("Datum příjezdu je starší než datum odjezdu.")}if(!Cx){Cx=true;AF.fireEvent("change",AF,AF.getValue(),AF.getValue())}else{Cx=false}},invalid:function(Dh,Di){Cf=false}},menuListeners:{select:function(Dj,Di){var Dh=this.getValue();this.setValue(Di);this.fireEvent("change",this,Di,Dh)}},anchor:"100%"});var DU=new Ext.Button({text:"Objednat"});Au=new Ext.form.Label({labelAlign:"left",border:false,columnWidth:1,xtype:"label",id:"label1",style:"text-align:center;font-size:12px;font-weight:bold",fieldLabel:"fieldlabel",hideLabel:true,anchor:"100%"});var Cg=[new Ext.form.Checkbox({xtype:"checkbox",id:"2weeks_discount",boxLabel:'<span class="pricedisplay2">5%</span> sleva za pronájem nad 2 týdny',fieldLabel:"fieldlabel",hideLabel:true,checked:true,disabled:true,anchor:"100%"}),new Ext.form.Checkbox({xtype:"checkbox",id:"3weeks_discount",boxLabel:'<span class="pricedisplay2">5%</span> sleva za pronájem nad 3 týdny',fieldLabel:"fieldlabel",hideLabel:true,checked:true,disabled:true,anchor:"100%"})];for(var Da=0;Da<n.count;Da++){Cg[Cg.length]=new Ext.form.Checkbox({xtype:"checkbox",id:"discount_id_"+n.data[Da].id,boxLabel:'<span class="pricedisplay2">'+n.data[Da].value+"%</span> "+n.data[Da].text,fieldLabel:"fieldlabel",hideLabel:true,anchor:"100%",listeners:{check:function(Dh,Dj,Di){Bu.fireEvent("change",Bu,Bu.getValue(),Bu.getValue())}}})}var DM=new Ext.FormPanel({id:"orderFormPanel",labelAlign:"right",frame:true,layout:"fit",labelWidth:60,bodyStyle:"padding:5px 5px 0",width:500,items:[{xtype:"fieldset",title:"Místa a časy",autoHeight:true,items:[{layout:"column",border:false,items:[{border:false,columnWidth:0.5,layout:"form",items:[CB,AF]},{border:false,columnWidth:0.5,layout:"form",items:[Ai,Bu]}]}]},{xtype:"fieldset",title:"Slevy a příplatky",autoHeight:true,items:[{layout:"column",border:false,items:[{border:false,columnWidth:0.5,layout:"form",items:Cg},{border:false,columnWidth:0.5,layout:"form",items:[new Ext.form.Checkbox({xtype:"checkbox",id:"locchng_charge",boxLabel:'<span class="pricedisplay">1000 Kč</span> jiná cílová základna',fieldLabel:"",hideLabel:true,checked:true,disabled:false,anchor:"100%",listeners:{check:function(Dh,Dj,Di){Bu.fireEvent("change",Bu,Bu.getValue(),Bu.getValue())}}})]}]}]},{xtype:"fieldset",title:"Ceny",autoHeight:true,items:[{layout:"column",border:false,items:[Au]}]},{collapsible:false,collapsed:false,xtype:"fieldset",title:"Ostatní",autoHeight:true,items:[{layout:"column",border:false,labelWidth:90,items:[{border:false,columnWidth:0.5,layout:"form",labelWidth:60,items:[CQ,{xtype:"textfield",id:"client_name",fieldLabel:"Klient",emptyText:"Jméno/číslo klienta",anchor:"100%"}]},{border:false,columnWidth:0.5,layout:"form",items:[CP,{xtype:"combo",id:"transit",typeAhead:false,editable:false,triggerAction:"all",transform:"transitcombo",lazyRender:true,fieldLabel:"Dovoz / odvoz",anchor:"100%"}]}]},new Ext.form.TextArea({id:"description",height:70,hideLabel:true,emptyText:"Místo pro poznámku k objednávce či provozovateli charteru..",anchor:"100%"}),new Ext.form.Hidden({id:"product_id"}),new Ext.form.Hidden({id:"location_id_from"}),new Ext.form.Hidden({id:"location_id_to"}),new Ext.form.Hidden({id:"season_id"}),new Ext.form.Hidden({id:"for_distributor_id"}),new Ext.form.Hidden({id:"for_customer_id"})]}],url:A5+"/apiIn.php?what=sendorder",buttons:[{text:"Objednat",handler:function(){DM.findById("location_id_to").setValue(Ai.getValue());DM.findById("location_id_from").setValue(CB.getValue());DM.findById("for_distributor_id").setValue(CQ.getValue());DM.findById("for_customer_id").setValue(CP.getValue());DM.form.submit({waitMsg:CX.submittingStr,waitTitle:CX.pleaseWaitStr,success:function(Dh,Di){Bv.store.load({params:{start:0,limit:AA}});Bv.view.refresh(true);Bc.hide();Ext.MessageBox.alert(CX.zpravaStr,"Objednávka úspěšně založena.")},failure:function(Dh,Di){Bv.store.load({params:{start:0,limit:AA}});Bv.view.refresh(true);Bc.hide();Ext.MessageBox.alert("","Chyba! Zkuste to prosím znovu.")}})}},{text:"Zrušit",handler:function(Dh){Bc.hide()}}]});function Cc(Dh){if(Dh>0){return'<span style="color:green;">'+Dh+"</span>"}else{if(Dh<0){return'<span style="color:red;">'+Dh+"</span>"}}return Dh}function Df(Dj,Di,Dh){var Dk=Dj.split("^");Di.css+=" td-"+Dk[0];Di.attr='ext:qtip="'+Dk[1]+'"';if(Dk[0]!="ww"){if(Dk[2]!=" &nbsp; &nbsp;"){return Dk[2]}else{return""}}else{return""}}function DJ(Dj,Di,Dh){Di.attr='ext:qtip="'+Dh.data["cze"]+'"';return Dj}B=CX.ssd;BW=CX.sed;A3=new Date(Date.parseDate(B,"Y-m-d H"));BX=new Date(Date.parseDate(BW,"Y-m-d H"));An=new Date(Date.parseDate(A3.format("U")-(A3.format("N")+1)*24*60*60,"U"));Q=new Date(Date.parseDate(A3.format("U")-(A3.format("N")+1)*24*60*60,"U"));P=new Date(Date.parseDate(A3.format("U")-(A3.format("N")+1)*24*60*60,"U"));var Ci=new Array();Ci[0]={header:"Jméno lodi",sortable:true,locked:true,width:200,dataIndex:"name",renderer:DJ};var DK=new Array();DK[0]={header:"Sezóna "+CX.activeSeasonName,locked:true};var Ce=new Array();Ce[0]={name:"id",type:"float"};Ce[1]={name:"lang_id",type:"float"};Ce[2]={name:"name",type:"string"};Ce[3]={name:"description",type:"string"};Ce[4]={name:"modifier_id",type:"string"};Ce[5]={name:"created_on",type:"date",dateFormat:"Y-m-d H:i:s"};Ce[6]={name:"modified_on",type:"date",dateFormat:"Y-m-d H:i:s"};Ce[7]={name:"cze",type:"string"};Ce[8]={name:"restricted_locations",type:"string"};var Cu=0;var Da=0;var DZ=0;if(An.format("U")<=A3.format("U")){Da++}while(An.format("U")<BX.format("U")){Q=new Date(Date.parseDate(An.format("U")+7*24*60*60,"U"));if((Q.format("n")!=An.format("n"))&&(An.format("U")>A3.format("U"))){Cu+=Da;DK[DK.length]={header:An.format("F"),colspan:Da,align:"center"};Da=0}P=new Date(Date.parseDate(An.format("U")+6*24*60*60,"U"));Ci[Ci.length]={header:An.format("j."),width:25,menuDisabled:true,resizable:false,sortable:false,locked:false,fixed:true,renderer:Df,tooltip:"Týden "+An.format("j.n.")+" - "+P.format("j.n."),dataIndex:"col_id_"+DZ};An=new Date(Date.parseDate(An.format("U")+7*24*60*60,"U"));Ce[Ce.length]={name:"col_id_"+DZ,type:"string"};Ce[Ce.length]={name:"leb_id_"+DZ,type:"string"};Ce[Ce.length]={name:"rib_id_"+DZ,type:"string"};Ce[Ce.length]={name:"lel_id_"+DZ,type:"float"};Ce[Ce.length]={name:"ril_id_"+DZ,type:"float"};Ce[Ce.length]={name:"lev_id_"+DZ,type:"string"};Ce[Ce.length]={name:"riv_id_"+DZ,type:"string"};Da++;DZ++}var DG=new Ext.grid.LockingColumnModel({columns:Ci,rows:[DK]});CG=Ext.data.Record.create(Ce);Bj=new Ext.data.Store({proxy:new Ext.data.ScriptTagProxy({url:A5+"/apiOut.php?what=products_charter"}),reader:new Ext.data.JsonReader({root:"rslt",id:"id",totalProperty:"total"},CG),remoteSort:true});Bj.on("load",function(){AJ=true;if(Bj.getTotalCount()<=AA){Bj.remoteSort=false}else{Bj.remoteSort=true}});Bv=new Ext.grid.LockingGridPanel({store:Bj,cm:DG,loadMask:{msg:CX.loadingMsg},stripeRows:false,viewConfig:{forceFit:false},trackMouseOver:true,height:350,width:600,sm:new Ext.ux.grid.MultiCellSelectionModel(),plugins:[new Ext.ux.plugins.LockedGroupHeaderGrid()]});Bv.addListener("mouseup",function(Dk){if(Bi>=2){Bv.selModel.clearSelections();return false}var Dj=Bv.selModel.getSelections();if(Dj.length>0){var Ds="";var Dq=true;var Di="";var Dl="";Dj.each(function(Dt){if(Di==""){Di=Dt}else{if(Di.col>Dt.col){Di=Dt}}if(Dl==""){Dl=Dt}else{if(Dl.col<Dt.col){Dl=Dt}}});Dj.each(function(Du){var Dt=Du.record.data[Du.dataIndex];var Dv=Dt.split("^");var Dw=Dv[0];if(Di!=Dl){if(Du==Di){if(Dw.charAt(1)!="w"){Dq=false}}else{if(Du==Dl){if(Dw.charAt(0)!="w"){Dq=false}}else{if(Dw!="ww"){Dq=false}}}}else{if((Dw.charAt(1)!="w")&&(Dw.charAt(0)!="w")){Dq=false}}if(Ds==""){Ds=Du.cell[0]}else{if(Du.cell[0]!=Ds){Dq=false}}if(Du.cell[1]==0){Dq=false}});if(Dq==true){var Dm=Dl.dataIndex.replace(/col_id/,"leb_id");var Dp=Di.dataIndex.replace(/col_id/,"rib_id");var Dn=Di.dataIndex.replace(/col_id/,"lel_id");var Dr=Di.dataIndex.replace(/col_id/,"ril_id");var Dh=Dl.dataIndex.replace(/col_id/,"riv_id");var Do=Di.dataIndex.replace(/col_id/,"lev_id");if(CB.getValue()!=""){CB.clearValue()}if(Ai.getValue()!=""){Ai.clearValue()}if(Di.record.data[Dn]!=0){CB.setValue(Di.record.data[Dn])}if(Di.record.data[Dr]!=0){Ai.setValue(Di.record.data[Dr])}BU={date:Date.parseDate(Di.record.data[Dm],"d-m-Y"),loc:Di.record.data[Dn]};l={date:Date.parseDate(Di.record.data[Dp],"d-m-Y"),loc:Di.record.data[Dr]};u=Di.record.json["prices"];AS=Di.record.data["restricted_locations"];AF.setMinValue(Date.parseDate(Dl.record.data[Dm],"d-m-Y"));Bu.setMinValue(Date.parseDate(Dl.record.data[Dm],"d-m-Y"));AF.setMaxValue(Date.parseDate(Di.record.data[Dp],"d-m-Y"));Bu.setMaxValue(Date.parseDate(Di.record.data[Dp],"d-m-Y"));AF.setValue(Date.parseDate(Di.record.data[Do],"d-m-Y"));Bu.setValue(Date.parseDate(Dl.record.data[Dh],"d-m-Y"));CQ.setValue("");CP.setValue("");Bc.setTitle("Objednávka lodi "+Di.record.data["name"]);if((Di.record.data["description"]*1)>=7){CA=2000}else{CA=1000}DM.findById("client_name").setValue("");DM.findById("description").setValue("");if(DM.findById("transit")!=undefined){DM.findById("transit").setValue("0")}DM.findById("product_id").setValue(Di.record.data["id"]);DM.findById("season_id").setValue(1);Bc.show();DM.findById("locchng_charge").setBoxLabel('<span class="pricedisplay">'+CA+" Kč</span> jiná cílová základna");CB.fireEvent("blur",CB.getValue());Ai.fireEvent("blur",Ai.getValue());Bu.fireEvent("change",Bu,Bu.getValue(),Bu.getValue());DM.findById("locchng_charge").setValue(Ai.getValue()!=CB.getValue());DM.findById("locchng_charge").setBoxLabel('<span class="pricedisplay">'+CA+" Kč</span> jiná cílová základna")}else{Bv.selModel.clearSelections();AF.value="";Bu.value="";AF.minValue="";Bu.minValue="";AF.maxValue="";Bu.maxValue=""}}});Bv.render("gridx-div");var Ck=new Ax.TextField({id:"dscCze",allowBlank:false});var DW=new Ax.TextField({id:"dscEng",allowBlank:false});var Cz=new Ax.TextField({id:"dscDsc",allowBlank:true,maxLength:45});var DC=new Ax.DateField({id:"dscDt1",format:"d-m-Y",minValue:"01-01-2006"});var DA=new Ax.DateField({id:"dscDt2",format:"d-m-Y",minValue:"01-01-2006"});var Cb=new Ax.NumberField({id:"dscVal",allowBlank:true,allowNegative:false,maxValue:100});I=Ext.data.Record.create([{name:"id",type:"float"},{name:"lang_id",type:"float"},{name:"cze",type:"string"},{name:"eng",type:"string"},{name:"date_from",type:"date",dateFormat:"Y-m-d H:i:s"},{name:"date_to",type:"date",dateFormat:"Y-m-d H:i:s"},{name:"value",type:"float"},{name:"modifier_id",type:"string"},{name:"description",type:"string"},{name:"modified_on",type:"date",dateFormat:"Y-m-d H:i:s"}]);CH=new Ext.data.Store({proxy:new Ext.data.ScriptTagProxy({url:A5+"/apiOut.php?what=discount"}),reader:new Ext.data.JsonReader({root:"rslt",id:"id",totalProperty:"total"},I),remoteSort:true});CH.on("load",function(){BO=true;if(CH.getTotalCount()<=AA){CH.remoteSort=false}else{CH.remoteSort=true}});Ar=new Ext.grid.ColumnModel([Aq,{header:CX.czeTitleHdr,dataIndex:"cze",width:200,editor:Ck},{header:CX.engTitleHdr,dataIndex:"eng",width:200,editor:DW},{header:CX.discountHdr,dataIndex:"value",width:95,renderer:Bt,editor:Cb},{header:CX.fromDateHdr,dataIndex:"date_from",width:95,renderer:Bo,editor:DC},{header:CX.toDateHdr,dataIndex:"date_to",width:95,renderer:Bo,editor:DA},{header:CX.descHdr,dataIndex:"description",width:100,editor:Cz},{header:CX.modHdr,dataIndex:"modifier_id",width:55},{header:CX.lastModHdr,dataIndex:"modified_on",width:95,renderer:N}]);Ar.defaultSortable=true;var C1=new Ax.TextField({id:"locCze",allowBlank:false});var Ca=new Ax.TextField({id:"locEng",allowBlank:false});var DF=new Ax.TextField({id:"locDsc",allowBlank:true,maxLength:45});CS=Ext.data.Record.create([{name:"id",type:"float"},{name:"lang_id",type:"float"},{name:"cze",type:"string"},{name:"eng",type:"string"},{name:"modifier_id",type:"string"},{name:"description",type:"string"},{name:"modified_on",type:"date",dateFormat:"Y-m-d H:i:s"}]);Bs=new Ext.data.Store({proxy:new Ext.data.ScriptTagProxy({url:A5+"/apiOut.php?what=location"}),reader:new Ext.data.JsonReader({root:"rslt",id:"id",totalProperty:"total"},CS),remoteSort:true});Bs.on("load",function(){Aj=true;if(Bs.getTotalCount()<=AA){Bs.remoteSort=false}else{Bs.remoteSort=true}});AK=new Ext.grid.ColumnModel([Aq,{header:CX.czeTitleHdr,dataIndex:"cze",width:200,editor:C1},{header:CX.engTitleHdr,dataIndex:"eng",width:200,editor:Ca},{header:CX.descHdr,dataIndex:"description",width:100,editor:DF},{header:CX.modHdr,dataIndex:"modifier_id",width:55},{header:CX.lastModHdr,dataIndex:"modified_on",width:95,renderer:N}]);AK.defaultSortable=true;var Db=new Ax.TextField({id:"seaCze",allowBlank:false});var DE=new Ax.TextField({id:"seaEng",allowBlank:false});var Ch=new Ax.TextField({id:"seaDsc",allowBlank:true,maxLength:45});var Cw=new Ax.DateField({id:"seaDt1",format:"d-m-Y",minValue:"01-01-2006"});var Cv=new Ax.DateField({id:"seaDt2",format:"d-m-Y",minValue:"01-01-2006"});var Ct=new Ax.DateField({id:"seaDt3",format:"d-m-Y",minValue:"01-01-2006"});var Cs=new Ax.DateField({id:"seaDt4",format:"d-m-Y",minValue:"01-01-2006"});O=Ext.data.Record.create([{name:"id",type:"float"},{name:"lang_id",type:"float"},{name:"cze",type:"string"},{name:"eng",type:"string"},{name:"start_date",type:"date",dateFormat:"Y-m-d H:i:s"},{name:"end_date",type:"date",dateFormat:"Y-m-d H:i:s"},{name:"preorder_start_date",type:"date",dateFormat:"Y-m-d H:i:s"},{name:"preorder_end_date",type:"date",dateFormat:"Y-m-d H:i:s"},{name:"modifier_id",type:"string"},{name:"description",type:"string"},{name:"modified_on",type:"date",dateFormat:"Y-m-d H:i:s"}]);Be=new Ext.data.Store({proxy:new Ext.data.ScriptTagProxy({url:A5+"/apiOut.php?what=season"}),reader:new Ext.data.JsonReader({root:"rslt",id:"id",totalProperty:"total"},O),remoteSort:true,sortInfo:{field:"cze",direction:"ASC"}});Be.on("load",function(){BK=true;if(Be.getTotalCount()<=AA){Be.remoteSort=false}else{Be.remoteSort=true}});Av=new Ext.grid.ColumnModel([Aq,{header:CX.czeTitleHdr,dataIndex:"cze",width:200,editor:Db},{header:CX.engTitleHdr,dataIndex:"eng",width:200,editor:DE},{header:CX.startDateHdr,dataIndex:"start_date",width:95,renderer:Bo,editor:Cw},{header:CX.endDateHdr,dataIndex:"end_date",width:95,renderer:Bo,editor:Cv},{header:CX.preorderStartDateHdr,dataIndex:"preorder_start_date",width:95,renderer:Bo,editor:Ct},{header:CX.preorderEndDateHdr,dataIndex:"preorder_end_date",width:95,renderer:Bo,editor:Cs},{header:CX.descHdr,dataIndex:"description",width:100,editor:Ch},{header:CX.modHdr,dataIndex:"modifier_id",width:55},{header:CX.lastModHdr,dataIndex:"modified_on",width:95,renderer:N}]);Av.defaultSortable=true;Bh=Ext.data.Record.create([{name:"id",type:"float"},{name:"lang_id",type:"float"},{name:"cze",type:"string"},{name:"eng",type:"string"},{name:"start_date",type:"date",dateFormat:"Y-m-d H:i:s"},{name:"end_date",type:"date",dateFormat:"Y-m-d H:i:s"},{name:"preorder_start_date",type:"date",dateFormat:"Y-m-d H:i:s"},{name:"preorder_end_date",type:"date",dateFormat:"Y-m-d H:i:s"},{name:"modifier_id",type:"string"},{name:"description",type:"string"},{name:"modified_on",type:"date",dateFormat:"Y-m-d H:i:s"}]);A0=new Ext.data.Store({proxy:new Ext.data.ScriptTagProxy({url:A5+"/apiOut.php?what=season"}),reader:new Ext.data.JsonReader({root:"rslt",id:"id",totalProperty:"total"},Bh),remoteSort:true,sortInfo:{field:"cze",direction:"ASC"}});A0.on("load",function(){AC=true;if(A0.getTotalCount()<=AA){A0.remoteSort=false}else{A0.remoteSort=true}});M=new Ext.grid.ColumnModel([Aq,{header:CX.czeTitleHdr,dataIndex:"cze",width:200},{header:CX.engTitleHdr,dataIndex:"eng",width:200},{header:CX.modHdr,dataIndex:"modifier_id",width:55},{header:CX.lastModHdr,dataIndex:"modified_on",width:95,renderer:N}]);M.defaultSortable=false;var Cq=new Ax.TextField({id:"curCze",allowBlank:false});var Dd=new Ax.TextField({id:"curEng",allowBlank:false});var C6=new Ax.TextField({id:"curDsc",allowBlank:true,maxLength:45});AU=Ext.data.Record.create([{name:"id",type:"float"},{name:"lang_id",type:"float"},{name:"cze",type:"string"},{name:"eng",type:"string"},{name:"symbol",type:"string"},{name:"formatting",type:"string"},{name:"modifier_id",type:"string"},{name:"description",type:"string"},{name:"modified_on",type:"date",dateFormat:"Y-m-d H:i:s"}]);V=new Ext.data.Store({proxy:new Ext.data.ScriptTagProxy({url:A5+"/apiOut.php?what=currency"}),reader:new Ext.data.JsonReader({root:"rslt",id:"id",totalProperty:"total"},AU),remoteSort:true});V.on("load",function(){CN=true;if(V.getTotalCount()<=AA){V.remoteSort=false}else{V.remoteSort=true}});BT=new Ext.grid.ColumnModel([Aq,{header:CX.czeTitleHdr,dataIndex:"cze",width:200,editor:Cq},{header:CX.engTitleHdr,dataIndex:"eng",width:200,editor:Dd},{header:CX.symbolHdr,dataIndex:"symbol",width:50,editor:new Ax.TextField({allowBlank:true,maxLength:2})},{header:CX.formattingHdr,dataIndex:"formatting",width:100,editor:new Ax.TextField({allowBlank:true,maxLength:10})},{header:CX.descHdr,dataIndex:"description",width:100,editor:C6},{header:CX.modHdr,dataIndex:"modifier_id",width:55},{header:CX.lastModHdr,dataIndex:"modified_on",width:95,renderer:N}]);BT.defaultSortable=true;var Dg=new Ax.TextField({id:"disPwd",allowBlank:false,inputType:"password"});var Cr=new Ax.TextField({id:"disNam",allowBlank:true,maxLength:45});var C9=new Ax.TextField({id:"disEma",allowBlank:true,maxLength:45});var C5=new Ax.TextField({id:"disBnk",allowBlank:true,maxLength:50});var C4=new Ax.TextArea({id:"disAd1",allowBlank:false,grow:true});var C3=new Ax.TextArea({id:"disAd2",allowBlank:true,grow:true});var Cl=new Ax.TextField({id:"disIco",allowBlank:true,maxLength:20});var Dc=new Ax.TextField({id:"disDic",allowBlank:true,maxLength:12});var DI=new Ax.TextField({id:"disDsc",allowBlank:true,maxLength:45});var DO=new Ax.ComboBox({id:"disTyp",typeAhead:true,triggerAction:"all",transform:"distribtyp",lazyRender:true,listClass:"x-combo-list-small"});var Cm=new Ext.form.ColorField({hiddenName:"color",showHexValue:true});CI=Ext.data.Record.create([{name:"id",type:"float"},{name:"name",type:"string"},{name:"password",type:"string"},{name:"email",type:"string"},{name:"ico",type:"string"},{name:"dic",type:"string"},{name:"bank_account",type:"string"},{name:"address",type:"string"},{name:"address_delivery",type:"string"},{name:"distributor_type",type:"float"},{name:"modifier_id",type:"string"},{name:"rgb",type:"string"},{name:"modified_on",type:"date",dateFormat:"Y-m-d H:i:s"}]);Bf=new Ext.data.Store({proxy:new Ext.data.ScriptTagProxy({url:A5+"/apiOut.php?what=distributor"}),reader:new Ext.data.JsonReader({root:"rslt",id:"id",totalProperty:"total"},CI),remoteSort:true});Bf.on("load",function(){H=true;if(Bf.getTotalCount()<=AA){Bf.remoteSort=false}else{Bf.remoteSort=true}});Bf.on("clear",function(){H=false});AT=new Ext.grid.ColumnModel([Aq,{header:CX.distribNrHdr,dataIndex:"id",width:80},{header:CX.distribNameHdr,dataIndex:"name",width:200,editor:Cr},{header:CX.distribResetPwdHdr,dataIndex:"password",width:100,editor:Dg,renderer:BS},{header:CX.emailHdr,dataIndex:"email",width:100,editor:C9},{header:"IČO",dataIndex:"ico",width:100,editor:Cl},{header:"DIČ",dataIndex:"dic",width:100,editor:Dc},{header:"Bankovní spojení",dataIndex:"bank_account",width:100,editor:C5},{header:"Fakturační adresa",dataIndex:"address",width:200,editor:C4},{header:"Doručovací adresa",dataIndex:"address_delivery",width:200,editor:C3},{header:"Typ",dataIndex:"distributor_type",width:150,editor:DO,renderer:function(Dh){switch(Dh){case 0:return"provozovatel";case 1:return"agentura";case 2:return"koncový zákazník";case 3:return"ostatní";case"0":return"provozovatel";case"1":return"agentura";case"2":return"koncový zákazník";case"3":return"ostatní"}}},{header:CX.colorHdr,dataIndex:"rgb",width:70,fixed:true,renderer:function(Dh){if((Dh!="")&&(Dh!=undefined)){val=Dh;if(AH(val)>AH("#808080")){return'<div style="color:black;background-color:'+val+';width:100%;">&nbsp;'+val+"</div>"}else{return'<div style="color:white;background-color:'+val+';width:100%;">&nbsp;'+val+"</div>"}}else{return""}},editor:Cm},{header:CX.modHdr,dataIndex:"modifier_id",width:55},{header:CX.lastModHdr,dataIndex:"modified_on",width:95,renderer:N}]);AT.defaultSortable=true;var DB=new Ax.TextArea({id:"proCze",allowBlank:false,grow:true});var Co=new Ax.TextArea({id:"proEng",allowBlank:false,grow:true});var DQ=new Ax.TextField({id:"proDsc",allowBlank:true,maxLength:45});var Cy=new Ax.TextField({id:"proNam",allowBlank:true,maxLength:64});var CZ=new Ext.ux.Andrie.Select({id:"proDlc",typeAhead:false,triggerAction:"all",lazyRender:true,store:Bs,displayField:CX.currLangKey,valueField:"id",multiSelect:true});var DX=new Ax.ClearableComboBox({id:"proDis",typeAhead:false,triggerAction:"all",lazyRender:true,store:Bf,displayField:"name",valueField:"id"});K=Ext.data.Record.create([{name:"id",type:"float"},{name:"lang_id",type:"float"},{name:"name",type:"string"},{name:"cze",type:"string"},{name:"eng",type:"string"},{name:"distributor_id",type:"float"},{name:"restricted_locations",type:"string"},{name:"modifier_id",type:"string"},{name:"description",type:"string"},{name:"modified_on",type:"date",dateFormat:"Y-m-d H:i:s"}]);z=new Ext.data.Store({proxy:new Ext.data.ScriptTagProxy({url:A5+"/apiOut.php?what=product"}),reader:new Ext.data.JsonReader({root:"rslt",id:"id",totalProperty:"total"},K),remoteSort:true});z.on("load",function(){Bd=true;if(z.getTotalCount()<=AA){z.remoteSort=false}else{z.remoteSort=true}});f=new Ext.grid.ColumnModel([Aq,{header:CX.prodNamHdr,dataIndex:"name",width:200,editor:Cy},{header:CX.czeTitleHdr,dataIndex:"cze",width:200,editor:DB},{header:CX.engTitleHdr,dataIndex:"eng",width:200,editor:Co},{header:"Vlastník produktu",dataIndex:"distributor_id",width:200,editor:DX,renderer:function(Dh){if((Dh)&&(Dh!="0")){if(Bf.getById(Dh)){return Bf.getById(Dh).get("name")}else{return Dh}}else{return""}}},{header:CX.descHdr,dataIndex:"description",width:100,editor:DQ},{header:"Lokace s omezením",dataIndex:"restricted_locations",width:200,editor:CZ,renderer:function(Dm){if(Dm){var Di=[],Dj=Dm.split(String(","));for(var Dk=0,Dh=Dj.length;Dk<Dh;Dk++){var Dl=Dj[Dk];var Dn=Dl;if(Bs.getById(Dl)){Dl=Bs.getById(Dl).get(CX.currLangKey)}if(Dl!=""){Di.push(Dl)}}return Di.join(this.separator||",")}else{return }}},{header:CX.modHdr,dataIndex:"modifier_id",width:55},{header:CX.lastModHdr,dataIndex:"modified_on",width:95,renderer:N}]);f.defaultSortable=true;var DH=new Ax.ClearableComboBox({id:"pprDis",typeAhead:false,triggerAction:"all",lazyRender:true,store:Bf,displayField:"id",valueField:"id"});var DV=new Ax.ComboBox({id:"pprCur",typeAhead:false,triggerAction:"all",lazyRender:true,store:V,displayField:CX.currLangKey,valueField:"id"});var De=new Ax.NumberField({id:"pprSrt",allowBlank:false,allowNegative:false});var Cn=new Ax.NumberField({id:"pprVal",allowBlank:false,allowNegative:false});var C8=new Ax.TextField({id:"pprDsc",allowBlank:true,maxLength:45});var DP=new Ax.DateField({id:"pprDt1",format:"d-m-Y",minValue:"01-01-2006"});var DN=new Ax.DateField({id:"pprDt2",format:"d-m-Y",minValue:"01-01-2006"});var DD=new Ax.ComboBox({id:"pprTyp",typeAhead:true,triggerAction:"all",transform:"pricetyp",lazyRender:true,listClass:"x-combo-list-small"});Ay=Ext.data.Record.create([{name:"id",type:"float"},{name:"product_id",type:"float"},{name:"distributor_id",type:"float"},{name:"currency_id",type:"float"},{name:"value",type:"float"},{name:"sort",type:"float"},{name:"price_type",type:"float"},{name:"date_from",type:"date",dateFormat:"Y-m-d H:i:s"},{name:"date_to",type:"date",dateFormat:"Y-m-d H:i:s"},{name:"modifier_id",type:"string"},{name:"description",type:"string"},{name:"modified_on",type:"date",dateFormat:"Y-m-d H:i:s"}]);AM=new Ext.data.Store({proxy:new Ext.data.ScriptTagProxy({url:A5+"/apiOut.php?what=product_price"}),reader:new Ext.data.JsonReader({root:"rslt",id:"id",totalProperty:"total"},Ay),remoteSort:true});AM.on("load",function(){Bg=true;if(AM.getTotalCount()<=AA){AM.remoteSort=false}else{AM.remoteSort=true}});B6=new Ext.grid.ColumnModel([Aq,{header:CX.currencyHdr,dataIndex:"currency_id",width:200,editor:DV,renderer:function(Dh){if(Dh){if(V.getById(Dh)){return V.getById(Dh).get(CX.currLangKey)}else{return Dh}}else{return }}},{header:CX.distributorHdr,dataIndex:"distributor_id",width:200,editor:DH,renderer:function(Dh){if((Dh)&&(Dh!="0")){if(Bf.getById(Dh)){return Bf.getById(Dh).get("id")}else{return Dh}}else{return""}}},{header:CX.valueHdr,dataIndex:"value",width:100,align:"right",editor:Cn},{header:"Typ ceny",dataIndex:"price_type",width:100,editor:DD,renderer:function(Dh){switch(Dh){case 0:return"týdenní";case 1:return"denní";case"0":return"týdenní";case"1":return"denní"}}},{header:CX.fromDateHdr,dataIndex:"date_from",width:95,renderer:Bo,editor:DP},{header:CX.toDateHdr,dataIndex:"date_to",width:95,renderer:Bo,editor:DN},{header:CX.sortHdr,dataIndex:"sort",width:80,align:"right",editor:De},{header:CX.descHdr,dataIndex:"description",width:100,renderer:function(Dl,Dk,Dh,Dm,Dj,Di){Dk.attr='ext:qtip="'+CX.MOCToolTip+'"';return Dl},editor:C8},{header:CX.modHdr,dataIndex:"modifier_id",width:55},{header:CX.lastModHdr,dataIndex:"modified_on",width:95,renderer:N}]);B6.defaultSortable=true;var DT=new Ax.NumberField({id:"orsPrc",allowBlank:false,allowNegative:false});var DS=new Ax.NumberField({id:"orsPrd",allowBlank:false,allowNegative:false});var Cd=new Ax.DateField({id:"orsDt1",format:"j.n."});var C7=new Ax.TextField({id:"orsNam",allowBlank:true,maxLength:45});Am=Ext.data.Record.create([{name:"id",type:"float"},{name:"currency_id",type:"float"},{name:"product_id",type:"float"},{name:"distributor_id",type:"float"},{name:"date_from",type:"date",dateFormat:"Y-m-d H:i:s"},{name:"date_to",type:"date",dateFormat:"Y-m-d H:i:s"},{name:"date_option",type:"date",dateFormat:"Y-m-d H:i:s"},{name:"location_id_from",type:"float"},{name:"location_id_to",type:"float"},{name:"state",type:"float"},{name:"price_to_submit_date",type:"float"},{name:"submit_date",type:"date",dateFormat:"Y-m-d H:i:s"},{name:"client_name",type:"string"},{name:"description",type:"string"},{name:"transit",type:"string"},{name:"pr_name",type:"string"},{name:"di_name",type:"string"},{name:"modifier_id",type:"string"},{name:"modified_on",type:"date",dateFormat:"Y-m-d H:i:s"}]);B4=new Ext.data.Store({proxy:new Ext.data.ScriptTagProxy({url:A5+"/apiOut.php?what=order_sheet"}),reader:new Ext.data.JsonReader({root:"rslt",id:"id",totalProperty:"total"},Am),remoteSort:true});B4.on("load",function(){F=true;if(B4.getTotalCount()<=AA){B4.remoteSort=false}else{B4.remoteSort=true}});L=new Ext.grid.ColumnModel([Aq,{header:CX.orderSheetIdHdr,dataIndex:"id",width:100},{header:"Loď",dataIndex:"pr_name",width:100},{header:"Odkud",dataIndex:"location_id_from",width:100,renderer:function(Dh){if(Dh){if(Bs.getById(Dh)){return Bs.getById(Dh).get(CX.currLangKey)}else{return Dh}}else{return }}},{header:"Kam",dataIndex:"location_id_to",width:100,renderer:function(Dh){if(Dh){if(Bs.getById(Dh)){return Bs.getById(Dh).get(CX.currLangKey)}else{return Dh}}else{return }}},{header:"Odjezd",dataIndex:"date_from",width:95,renderer:By},{header:"Příjezd",dataIndex:"date_to",width:95,renderer:By},{header:CX.distributorHdr,dataIndex:"di_name",width:100},{header:CX.stateHdr,dataIndex:"state",width:100,renderer:function(Di){if(Di!="0"){var Dh=new Array();Dh[1]="green";Dh[2]="red";Dh[3]="gray";return'<span style="color:'+Dh[Di]+'">'+CX["orderSheetStateStrsS"+Di]+"</span>"}}},{header:"Datum objednání",dataIndex:"submit_date",width:95,renderer:D},{header:"Cena",dataIndex:"price_to_submit_date",align:"right",width:100,renderer:Ap},{header:CX.currencyHdr,dataIndex:"currency_id",width:100,renderer:function(Dh){if(Dh){if(V.getById(Dh)){return V.getById(Dh).get(CX.currLangKey)}else{return Dh}}else{return }}},{header:"Opce do",dataIndex:"date_option",width:95,renderer:By,editor:Cd},{header:CX.descHdr,dataIndex:"description",width:100,renderer:function(Dj,Di,Dh){Di.attr='ext:qtip="'+Dj+'"';return Dj}},{header:"Jméno klienta",dataIndex:"client_name",width:100},{header:"Transit osob",dataIndex:"transit",width:50},{header:CX.modHdr,dataIndex:"modifier_id",width:55,hidden:true},{header:CX.lastModHdr,dataIndex:"modified_on",width:95,renderer:N,hidden:true}]);L.defaultSortable=true;Bp=Ext.data.Record.create([{name:"id",type:"string"},{name:"name",type:"string"},{name:"document_type",type:"string"},{name:"created_on",type:"date",dateFormat:"Y-m-d H:i:s"}]);AR=new Ext.data.Store({proxy:new Ext.data.ScriptTagProxy({url:A5+"/apiOut.php?what=order_sheet_docs"}),reader:new Ext.data.JsonReader({root:"rslt",id:"id",totalProperty:"total"},Bp),remoteSort:true});AR.on("load",function(){A8=true;if(AR.getTotalCount()<=AA){AR.remoteSort=false}else{AR.remoteSort=true}});Bq=new Ext.grid.ColumnModel([Aq,{header:"Jméno souboru",dataIndex:"name",width:100},{header:"Typ dokumentu",dataIndex:"document_type",width:100},{header:"Datum vytvoření",dataIndex:"created_on",width:95,renderer:N}]);Bq.defaultSortable=true;S=new Ext.PagingToolbar({pageSize:AA,store:Be,width:440,mode:"remote",style:"border-width:0px;border-style:solid;border-color:transparent;background-image:url();background-color:transparent;",displayInfo:true,displayMsg:CX.showingStr1+" {0} - {1} "+CX.showingStr2+" {2}",emptyMsg:CX.showingStr3});b=new Ext.Toolbar({disabled:true,style:"border-width:0px;border-style:solid;border-color:transparent;background-image:url();background-color:transparent;",buttons:[{tooltip:CX.detailStr,text:CX.detailStr,iconCls:"detail",handler:function(Dh){B9("order_sheet_products",BE.selModel.selections.keys[0])}}]});b.hide();BC=new Ext.Toolbar({disabled:true,style:"border-width:0px;border-style:solid;border-color:transparent;background-image:url();background-color:transparent;",buttons:[{tooltip:"Zobrazit přehled vygenerovaých dokumentů ke zvolené objednávce",text:"Dokumenty",iconCls:"detail",handler:function(Dh){B9("order_sheet_docs",BE.selModel.selections.keys[0])}}]});BC.hide();A4=new Ext.Toolbar({disabled:true,style:"border-width:0px;border-style:solid;border-color:transparent;background-image:url();background-color:transparent;",buttons:["-",{tooltip:CX.dist2StoresTTStr,text:CX.dist2StoresStr,iconCls:"detail",handler:function(Dh){B9("store",BE.selModel.selections.keys[0])}}]});A4.hide();B0=new Ext.Toolbar({disabled:true,style:"border-width:0px;border-style:solid;border-color:transparent;background-image:url();background-color:transparent;",buttons:["-",{tooltip:CX.prodLocTTStr,text:CX.location,iconCls:"locations",handler:function(Dh){B9("products_locations",BE.selModel.selections.keys[0])}},{tooltip:CX.prodPriceTTStr,text:CX.priceStr,iconCls:"prices",handler:function(Dh){B9("product_price",BE.selModel.selections.keys[0])}}]});B0.hide();BM=new Ext.Toolbar({disabled:false,style:"border-width:0px;border-style:solid;border-color:transparent;background-image:url();background-color:transparent;",buttons:[{tooltip:CX.lockOrderTT,text:CX.lockStr,iconCls:"lock",handler:function(Dh){BA(2)}}]});BM.hide();Bn=new Ext.Toolbar({disabled:false,style:"border-width:0px;border-style:solid;border-color:transparent;background-image:url();background-color:transparent;",buttons:[{tooltip:CX.unlockOrderTT,text:CX.unlockStr,iconCls:"unlock",handler:function(Dh){BA(1)}}]});Bn.hide();BQ=new Ext.Toolbar({disabled:false,style:"border-width:0px;border-style:solid;border-color:transparent;background-image:url();background-color:transparent;",buttons:["-",CX.changeItemsState,{tooltip:CX.confirmItemsTT,text:"",iconCls:"accept",handler:function(Dh){jsonData="[";for(Da=0;Da<BE.store.getCount();Da++){record=BE.store.getAt(Da);if(BE.selModel.isSelected(record)){record.data["state"]=1;jsonData+=Ext.util.JSON.encode(record.data)+","}}if(jsonData.length>1){if(AI){jsonData='{"rslt":'+jsonData.substring(0,jsonData.length-1)+'],"setState":"1","gridContains":"order_sheet_prods_grouped"}'}else{jsonData='{"rslt":'+jsonData.substring(0,jsonData.length-1)+'],"gridContains":"'+Al+'"}'}Ah(jsonData)}else{if(B5){Ext.msger.msg("",CX.nothing2Save)}jsonData=""}BE.store.fireEvent("datachanged",BE.store)}},{tooltip:CX.naItemsTT,text:"",iconCls:"na",handler:function(Dh){jsonData="[";for(Da=0;Da<BE.store.getCount();Da++){record=BE.store.getAt(Da);if(BE.selModel.isSelected(record)){record.data["state"]=2;jsonData+=Ext.util.JSON.encode(record.data)+","}}if(jsonData.length>1){if(AI){jsonData='{"rslt":'+jsonData.substring(0,jsonData.length-1)+'],"setState":"1","gridContains":"order_sheet_prods_grouped"}'}else{jsonData='{"rslt":'+jsonData.substring(0,jsonData.length-1)+'],"gridContains":"'+Al+'"}'}Ah(jsonData)}else{if(B5){Ext.msger.msg("",CX.nothing2Save)}jsonData=""}BE.store.fireEvent("datachanged",BE.store)}},{tooltip:CX.unknownItemsTT,text:"",iconCls:"unknown",handler:function(Dh){jsonData="[";for(Da=0;Da<BE.store.getCount();Da++){record=BE.store.getAt(Da);if(BE.selModel.isSelected(record)){record.data["state"]=0;jsonData+=Ext.util.JSON.encode(record.data)+","}}if(jsonData.length>1){if(AI){jsonData='{"rslt":'+jsonData.substring(0,jsonData.length-1)+'],"setState":"1","gridContains":"order_sheet_prods_grouped"}'}else{jsonData='{"rslt":'+jsonData.substring(0,jsonData.length-1)+'],"gridContains":"'+Al+'"}'}Ah(jsonData)}else{if(B5){Ext.msger.msg("",CX.nothing2Save)}jsonData=""}BE.store.fireEvent("datachanged",BE.store)}}]});BQ.hide();Ao=new Ext.Toolbar({disabled:false,style:"border-width:0px;border-style:solid;border-color:transparent;background-image:url();background-color:transparent;",buttons:[{tooltip:CX.orderSheetStateTTStrs1,text:CX.orderSheetStateStrs1,toggleGroup:"order",enableToggle:true,pressed:BY=="1",handler:function(Dh){if(Dh.pressed){BY="1";B9(Al,false,true)}else{BY="0";B9(Al,false,true)}}},{tooltip:CX.orderSheetStateTTStrs2,text:CX.orderSheetStateStrs2,toggleGroup:"order",enableToggle:true,pressed:BY=="2",handler:function(Dh){if(Dh.pressed){BY="2";B9(Al,false,true)}else{BY="0";B9(Al,false,true)}}},{tooltip:CX.orderSheetStateTTStrs3,text:CX.orderSheetStateStrs3,toggleGroup:"order",enableToggle:true,pressed:BY=="3",handler:function(Dh){if(Dh.pressed){BY="3";B9(Al,false,true)}else{BY="0";B9(Al,false,true)}}},"-",new Ext.Button({id:"totalcountorders",xtype:"tbtext",text:"&sum; 0.00 Kč",tooltip:"Celková cena označených objednávek",handler:function(Dh){Ext.MessageBox.alert(CX.zpravaStr,"Celková cena označených objednávek: "+Dh.text.slice(6))}}),"-"]});Ao.hide();Bz=new Ext.Toolbar({disabled:false,style:"border-width:0px;border-style:solid;border-color:transparent;background-image:url();background-color:transparent;",buttons:[{tooltip:CX.tribeTT,text:CX.tribeStr,toggleGroup:"tribe",enableToggle:true,pressed:BV,handler:function(Dh){if(Dh.pressed){BV=true;B9(Al,false,true)}else{BV=false;B9(Al,false,true)}}},"-"]});Bz.hide();A=new Ext.Toolbar({disabled:false,style:"border-width:0px;border-style:solid;border-color:transparent;background-image:url();background-color:transparent;",buttons:[{tooltip:CX.groupProdsStr,text:CX.groupProdsStr,enableToggle:true,pressed:AI,handler:function(Dh){if(Dh.pressed){AI=true;B9(Al,R,true)}else{AI=false;B9(Al,R,true)}}}]});A.hide();j=new Ext.Toolbar({disabled:true,style:"border-width:0px;border-style:solid;border-color:transparent;background-image:url();background-color:transparent;",buttons:[{text:CX.addRec,iconCls:"add",handler:function(){switch(Al){case"location":var Dk=new CS({id:"0",lang_id:"0",cze:"Nová lokace",eng:"New location",description:"",modifier_id:"",modified_on:""});break;case"product":var Dk=new K({id:"0",lang_id:"0",cze:"Nový produkt",eng:"New product",name:"",description:"",modifier_id:"",modified_on:""});break;case"discount":var Dj=new Date();var Di=new Date();var Dk=new I({id:"0",lang_id:"0",cze:"Nová sleva",eng:"New discount",date_from:Dj,date_to:Di,value:"0",description:"",modifier_id:"",modified_on:""});break;case"season":var Dj=new Date();var Di=new Date();var Dh=new Date();var Dl=new Date();var Dk=new O({id:"0",lang_id:"0",cze:"Nová sezóna",eng:"New season",start_date:Dj,end_date:Di,preorder_start_date:Dh,preorder_end_date:Dl,description:"",modifier_id:"",modified_on:""});break;case"currency":var Dk=new AU({id:"0",lang_id:"0",cze:"Nová měna",eng:"New currency",symbol:"",formatting:"",description:"",modifier_id:"",modified_on:""});break;case"distributor":var Dk=new CI({id:"",name:"Distributor",password:"",email:"",ico:"",dic:"",address:"",address_delivery:"",distributor_type:"1",modifier_id:"",modified_on:""});break;case"product_price":var Dk=new Ay({id:"0",product_id:CU,value:"",currency_id:"",price_type:"0",distributor_id:"0",sort:AM.getCount()+1,description:"",modifier_id:"",modified_on:""});break}if(Al.indexOf("products_season_")>=0){var Dk=new K({id:"0",lang_id:"0",season_id:Al.substring(1+Al.lastIndexOf("_")),cze:"Název; Popis",eng:"Title; Description",code_flag:"0",section_id:"",collection_id:"",category_id:"",name:"",clss:"",composition:"",description:"",modifier_id:"",modified_on:""})}BE.stopEditing();BE.store.insert(0,Dk);BE.startEditing(0,0)}}]});j.hide();CW=new Ext.ux.grid.Search({mode:"remote",searchText:CX.searchStr,searchTipText:CX.searchTipStr,iconCls:false,dateFormat:"m/d/Y",disableIndexes:[""]});Bm=new Ext.Button({text:CX.actionPrice,id:"actionPriceButt",iconCls:"priceAdd",handler:function(){p.show()}});AG=new Ext.Button({text:CX.assignTradesmanStr,id:"assignTradesmanButt",iconCls:"assign_tradesman",handler:function(){Ab.show()}});B8=new Ext.Button({text:CX.returnOrder,id:"returnOrderSheetButt",iconCls:"return",handler:function(){BA(1)}});AY=new Ext.Button({text:CX.confirmOrder,id:"confirmOrderSheetButt",iconCls:"accept",handler:function(){BA(2)}});Bk=new Ext.Button({text:CX.generateXMLStr,id:"generateXMLButt",iconCls:"generate_xml",handler:function(){if(Al=="order_sheet_products"){window.location=A5+"/admin/export/"+R}else{window.location=A5+"/admin/export/"+BE.selModel.selections.keys[0]}}});Ad=new Ext.Button({text:"Získat soubor",id:"downloadPDFButt",iconCls:"get_pdf",handler:function(){window.open(A5+"/assets/generated/"+BE.selModel.selections.keys[0])}});BF=new Ext.Button({text:CX.delSel,id:"deleteButt",iconCls:"remove",handler:function(){B7()}});Bl=new Ext.Button({text:"Stornovat označené",id:"stornoOrderSheetButt",iconCls:"remove",handler:function(){B7()}});Ae=new Ext.Button({id:"saveButt",text:CX.saveStr,iconCls:"save",handler:function(){jsonData="[";for(Da=0;Da<BE.store.getCount();Da++){record=BE.store.getAt(Da);if((record.data.newRecord)||(record.dirty)||(record.data["id"]==0)||(record.data["uid"]==0)){jsonData+=Ext.util.JSON.encode(record.data)+","}}if(jsonData.length>1){if((AI)&&(Al=="order_sheet_products")){jsonData='{"rslt":'+jsonData.substring(0,jsonData.length-1)+'],"gridContains":"order_sheet_prods_grouped"}'}else{jsonData='{"rslt":'+jsonData.substring(0,jsonData.length-1)+'],"gridContains":"'+Al+'"}'}Ah(jsonData)}else{if(B5){Ext.msger.msg("",CX.nothing2Save)}jsonData=""}}});BE=new Ext.grid.EditorGridPanel({store:A0,cm:M,sm:Aq,region:"center",id:"topic-grid",loadMask:{msg:CX.loadingMsg},viewConfig:{forceFit:true},title:CX.season,frame:false,trackMouseOver:true,plugins:[CW],clicksToEdit:2,tbar:[j,b,BC,B0,BM,Bn,BQ,"-",S],buttonAlign:"left",buttons:[Ae,BF,Ad,Bl,AY,B8,Bm,Bk],bbar:[Bz,Ao,A]});BE.selModel.on("selectionchange",d);Ba=new Ext.tree.TreePanel({animate:true,containerScroll:true,rootVisible:false,split:true,title:CX.settingsStr,autoScroll:true,iconCls:"nav",border:false,margins:"5 0 5 5"});CJ=new Ext.tree.TreeNode({text:CX.settingsStr,allowDrag:false,allowDrop:false});Ba.setRootNode(CJ);AB=new Ext.tree.TreeNode({text:"Slevy",cls:"album-node",allowDrag:false});AB.addListener("click",function(Di,Dh){B9("discount")});v=new Ext.tree.TreeNode({text:CX.prodStr,cls:"album-node",allowDrag:false});v.addListener("click",function(Di,Dh){B9("product")});x=new Ext.tree.TreeNode({text:"Lokace",cls:"album-node",allowDrag:false});x.addListener("click",function(Di,Dh){B9("location")});w=new Ext.tree.TreeNode({text:CX.distributor,cls:"album-node",allowDrag:false});w.addListener("click",function(Di,Dh){B9("distributor")});r=new Ext.tree.TreeNode({text:CX.season,cls:"album-node",allowDrag:false});r.addListener("click",function(Di,Dh){B9("season")});q=new Ext.tree.TreeNode({text:CX.currency,cls:"album-node",allowDrag:false});q.addListener("click",function(Di,Dh){B9("currency")});CJ.appendChild(AB,v,x,w,r,q);AO=new Ext.tree.TreePanel({animate:true,containerScroll:true,rootVisible:false,split:true,title:CX.orderStr,autoScroll:true,iconCls:"order",border:false,margins:"5 0 5 5"});CD=new Ext.tree.TreeNode({text:CX.orderStr,allowDrag:false,allowDrop:false});AO.setRootNode(CD);for(var Da=0;Da<CM.count;Da++){var C0=new Ext.tree.TreeNode({text:CM.data[Da].text,cls:"album-node",allowDrag:false});s=CM.data[Da].id;C0.addListener("click",function(Dj){var Dh=false;for(var Di=0;Di<CM.count;Di++){if(CM.data[Di].text==Dj.text){Dh=CM.data[Di].id}}B9("order_sheet_season_"+Dh)});CD.appendChild(C0)}A2=new Ext.menu.Menu({items:[{text:CX.vypnutoStr,id:"paging_10000",checked:AA==10000,group:"theme",handler:function(){k(10000)}},{text:"20 "+CX.recPerPage,id:"paging_20",checked:AA==20,group:"theme",handler:function(){k(20)}},{text:"30 "+CX.recPerPage,id:"paging_30",checked:AA==30,group:"theme",handler:function(){k(30)}},{text:"40 "+CX.recPerPage,id:"paging_40",checked:AA==40,group:"theme",handler:function(){k(40)}},{text:"50 "+CX.recPerPage,id:"paging_50",checked:AA==50,group:"theme",handler:function(){k(50)}}]});BD=new Ext.menu.Menu({items:[{text:"Čeština",id:"lang_cze",checked:CX.currLangKey=="cze",group:"lang",checkHandler:function(){window.location=A5+"/cze/admin"}},{text:"English",id:"lang_eng",checked:CX.currLangKey=="eng",group:"lang",checkHandler:function(){window.location=A5+"/eng/admin"}}]});BI=new Ext.menu.Menu({id:"mainMenu",items:[{text:CX.loudMsgsStr,id:"loud_msgs",checked:B5,checkHandler:function(Dh){B5=!B5;Ext.Ajax.request({url:A5+"/apiIn.php?what=adminconfig&loud="+B5,success:function(){if(B5){Ext.msger.msg("",CX.configSaved)}},failure:function(){}})}},{text:CX.pagingStr,menu:A2},"-",{id:"xchngpass",text:CX.chngPassStr,handler:function(){i.show()}},"-",{id:"logout",text:CX.logoutStr,iconCls:"logout",handler:function(){while(B3.findById("west-panel").items.getCount()>1){B3.findById("west-panel").items.remove(B3.findById("west-panel").items.last())}B3.findById("west-panel").hide();A6.show();BE.hide();B3.hide();AZ.show();Ext.Ajax.request({url:A5+"/apiOut.php?what=adminout",success:function(){if(B5){Ext.msger.msg(CX.goodbyeStr,CX.logoutOkStr)}As.form.setValues({pwd:""});if(Bi=="0"){window.location.reload()}},failure:function(){As.form.setValues({pwd:""})}})}}]});BH=new Ext.menu.Menu({id:"mainMenu2",items:[{text:CX.importProdStr,iconCls:"productAdd",checkHandler:function(){}},{text:CX.importPriceStr,iconCls:"productAdd",checkHandler:function(){}}]});Ak=new Ext.Toolbar({});Ak.render("north");Ak.add({text:CX.mainMenuStr,iconCls:"bmenu",menu:BI},"-",{id:"charteropen",text:"Rezervace "+CX.activeSeasonName,iconCls:"locations",disabled:false,hidden:CX.activeSeasonName=="",handler:function(){Bv.store.load({params:{start:0,limit:AA}});if(!Bb){BB.load()}Bv.view.refresh(true);AV.show()}},new Ext.Toolbar.Separator({id:"hideableseparator",xtype:"tbseparator",hidden:CX.activeSeasonName==""}),{id:"backwards",text:CX.backStr,iconCls:"back",disabled:true,handler:function(){B9(CY[Bx-2],BP[Bx-2],true);Bx=Bx-1;if(Bx-1<=0){Ak.items.get("backwards").disable()}Ak.items.get("forwards").enable()}},{id:"forwards",text:CX.forwStr,iconCls:"forw",disabled:true,handler:function(){if(CK-1<Bx){B9(CY[CK-1],BP[CK-1],true)}else{B9(CY[Bx],BP[Bx],true)}Bx=Bx+1;if(Bx>=CK){Ak.items.get("forwards").disable()}Ak.items.get("backwards").enable()}},{id:"helps",text:CX.helpStr,iconCls:"help",style:"position:absolute;right:0px;top:2px",handler:function(){window.open(A5+"/assets/documents/man/man"+(Bi!="0"?"":Bi)+".html")}});B3=new Ext.Viewport({layout:"border",bufferResize:true,items:[{region:"north",collapsible:false,collapsed:false,border:false,frame:false,style:"border-left-width:1px;border-right-width:1px;border-top-width:1px;height:25px;",items:[Ak]},{region:"south",contentEl:"south",autoHide:true,split:true,height:150,minSize:100,maxSize:500,collapsible:true,collapsed:true,title:CX.systemMsgsStr,margins:"0 0 0 0",autoScroll:true,tbar:[{text:CX.clearLog,iconCls:"remove",handler:function(){document.getElementById("south").innerHTML="";s="<p><b>"+CX.systemMsgsStr+":</b> "+CX.clearedStr+"</p>";if(B5){Ext.msger.msg("",s)}}}]},{region:"west",id:"west-panel",title:CX.leftPanelTitle,split:true,width:200,minSize:175,maxSize:400,collapsible:true,layout:"accordion",layoutConfig:{animate:true},items:[AO]},BE]});B3.on("resize",function(){B3.doLayout()});As=new Ext.form.FormPanel({id:"loginformpanel",baseCls:"x-plain",labelWidth:110,url:A5+"/apiOut.php?what=admincheck",defaultType:"textfield",items:[{fieldLabel:CX.idStr,name:"id",id:"loginId",anchor:"100%"},{fieldLabel:CX.passStr,inputType:"password",id:"loginPwd",name:"pwd",anchor:"100%"}]});A6=new Ext.Window({id:"loginwindow",title:CX.loginStr,iconCls:"logout",width:300,height:140,minWidth:280,minHeight:130,layout:"fit",plain:true,modal:true,bodyStyle:"padding:5px;",buttonAlign:"center",items:As,closable:false,buttons:[{text:CX.loginButStr,handler:function(Dh){As.form.submit({waitMsg:CX.authStr,waitTitle:CX.pleaseWaitStr,success:function(Di,Dj){if(Dj.result.level!=""){Bi=Dj.result.level}AE=new Array();if(Bi=="0"){AE=[["0"],["1"]]}else{AE=[["1"]]}CR.loadData(AE);if(Bi<2){if(Dj.result.adminconfig!=undefined){if(Dj.result.adminconfig.paging!=""){AA=Dj.result.adminconfig.paging*1;A2.items.get("paging_10000").checked=AA==10000;A2.items.get("paging_20").checked=AA==20;A2.items.get("paging_30").checked=AA==30;A2.items.get("paging_40").checked=AA==40;A2.items.get("paging_50").checked=AA==50}}S.pageSize=AA;CY=new Array();BP=new Array();Bx=0;CK=0;Ak.items.get("backwards").disable();Ak.items.get("forwards").disable();if(CM.data.length>0){B9("order_sheet_season_"+CM.data[0].id)}BE.store.on("load",function(){BE.getView().fitColumns()});B5=true;BI.items.get("loud_msgs").checked=true;if(Dj.result.adminconfig!=undefined){if(Dj.result.adminconfig.loud=="false"){B5=false;BI.items.get("loud_msgs").checked=false}}if(B5){Ext.msger.msg(CX.welcomeTitle,CX.welcomeStr)}A6.hide();AZ.hide();B3.show();B3.findById("west-panel").show();BE.show();while(B3.findById("west-panel").items.getCount()>1){B3.findById("west-panel").items.remove(B3.findById("west-panel").items.last())}B3.doLayout();if(Bi=="0"){B3.findById("west-panel").items.add(Ba);CQ.hideLabel=false;CP.hideLabel=false;CQ.show();CP.show()}addedtree=B3.findById("west-panel").items.add(AO);if(Bi!="0"){addedtree.expand(false)}B3.doLayout();AV.maximizable=true;AV.maximized=false;AV.closable=true}else{Bv.store.load({params:{start:0,limit:AA}});AV.maximized=true;AV.maximizable=false;AV.closable=false;Bv.view.refresh(true);AV.show()}},failure:function(){Ext.MessageBox.alert(CX.errTitleStr,CX.wrongIdOrPwd)}})}},{text:"Vstup bez přihlášení",handler:function(Dh){As.findById("loginId").setValue("7");As.findById("loginPwd").setValue("cumil");As.form.submit({waitMsg:CX.authStr,waitTitle:CX.pleaseWaitStr,success:function(Di,Dj){if(Dj.result.level!=""){Bi=Dj.result.level}AE=new Array();if(Bi=="0"){AE=[["0"],["1"]]}else{AE=[["1"]]}CR.loadData(AE);Bv.store.load({params:{start:0,limit:AA}});AV.maximized=true;AV.maximizable=false;AV.closable=false;Bv.view.refresh(true);AV.show()},failure:function(){Ext.MessageBox.alert(CX.errTitleStr,CX.wrongIdOrPwd)}})}}]});AZ=new Ext.Viewport({items:[A6]});B3.findById("west-panel").hide();A6.show();BE.hide();B3.hide();AZ.show();Ext.Ajax.request({url:A5+"/apiOut.php?what=adminin",callback:function(Di,Dk,Dh){if(Dk){var Dj=Ext.util.JSON.decode(Dh.responseText);if(Dj.success){if(Dj.level!=""){Bi=Dj.level}AE=new Array();if(Bi=="0"){AE=[["0"],["1"]]}else{AE=[["1"]]}CR.loadData(AE);if(Bi<2){if(Dj.adminconfig!=undefined){if(Dj.adminconfig.paging!=""){AA=Dj.adminconfig.paging*1;A2.items.get("paging_10000").checked=AA==10000;A2.items.get("paging_20").checked=AA==20;A2.items.get("paging_30").checked=AA==30;A2.items.get("paging_40").checked=AA==40;A2.items.get("paging_50").checked=AA==50}}S.pageSize=AA;if(CM.data.length>0){B9("order_sheet_season_"+CM.data[0].id)}BE.store.on("load",function(){BE.getView().fitColumns()});B5=true;BI.items.get("loud_msgs").checked=true;if(Dj.adminconfig!=undefined){if(Dj.adminconfig.loud=="false"){B5=false;BI.items.get("loud_msgs").checked=false}}A6.hide();AZ.hide();B3.show();B3.findById("west-panel").show();BE.show();while(B3.findById("west-panel").items.getCount()>1){B3.findById("west-panel").items.remove(B3.findById("west-panel").items.last())}B3.doLayout();if(Bi=="0"){B3.findById("west-panel").items.add(Ba);CQ.hideLabel=false;CP.hideLabel=false;CQ.show();CP.show()}B3.findById("west-panel").items.add(AO);B3.doLayout()}else{Bv.store.load({params:{start:0,limit:AA}});AV.maximized=true;AV.maximizable=false;AV.closable=false;Bv.view.refresh(true);AV.show()}if(B5){Ext.msger.msg(CX.welcomeTitle,CX.welcomeStr)}}else{B3.findById("west-panel").hide();A6.show();BE.hide();B3.hide();AZ.show()}}},success:function(Dh,Di){},failure:function(Dh,Di){}});AX=new Ext.form.FormPanel({id:"outpriceForm",baseCls:"x-plain",labelAlign:"right",labelWidth:80,url:"save-form.php",defaultType:"textfield",items:[{id:"outpriceFormF1",fieldLabel:CX.platnostOdStr,xtype:"datefield",dateFormat:"M d, Y",name:"from",anchor:"100%"},{id:"outpriceFormF2",xtype:"datefield",dateFormat:"M d, Y",fieldLabel:CX.platnostDoStr,name:"to",anchor:"100%"},{id:"outpriceFormF4",fieldLabel:CX.outpriceInStr+" %",xtype:"numberfield",maxValue:100,allowNegative:true,name:"percent",anchor:"100%"},{id:"outpriceFormF5",xtype:"numberfield",allowNegative:false,fieldLabel:CX.priceInStr+" Kč",name:"price_1",anchor:"100%"},{id:"outpriceFormF6",xtype:"numberfield",allowNegative:false,fieldLabel:CX.priceInStr+" Euro",name:"price_2",anchor:"100%"}]});p=new Ext.Window({id:"outpriceWindow",title:CX.automaticOutpriceStr,width:300,height:230,minWidth:250,minHeight:230,layout:"fit",plain:true,modal:true,bodyStyle:"padding:5px;",buttonAlign:"center",items:AX,closable:true,closeAction:"hide",buttons:[{text:CX.outpriceStr},{text:CX.cancelStr,handler:function(){p.hide()}}]});J=new Ext.form.FormPanel({baseCls:"x-plain",id:"chngPassForm",labelAlign:"right",labelWidth:165,url:A5+"/apiIn.php?what=adminxchngpass",defaultType:"textfield",items:[{id:"curpass",inputType:"password",fieldLabel:CX.currentPwdStr,name:"oldpwd",anchor:"100%"},{id:"newpass",inputType:"password",fieldLabel:CX.newPwdStr,name:"pwd",anchor:"100%"},{id:"newpassconfirm",inputType:"password",fieldLabel:CX.reNewPwdStr,name:"pwd2",anchor:"100%"}]});i=new Ext.Window({id:"xchngpassForm",title:CX.chngPassFrmTitle,width:320,height:170,minWidth:300,minHeight:170,layout:"fit",plain:true,modal:true,bodyStyle:"padding:5px;",buttonAlign:"center",items:J,closable:true,closeAction:"hide",buttons:[{text:CX.chngPassButtStr,id:"f3b1",handler:function(){J.form.submit({waitMsg:CX.submittingStr,waitTitle:CX.pleaseWaitStr,success:function(Dh,Di){i.hide();Ext.MessageBox.alert(CX.zpravaStr,CX.pwdChangedStr);J.form.setValues({oldpwd:"",pwd:"",pwd2:""});i.setTitle(CX.chngPassFrmTitle)},failure:function(Dh,Di){i.setTitle(CX.chngPassFrmTitle+' - <span class="error">'+CX.errStrLCase+"!</span>")}})}},{text:CX.cancelStr,id:"f3b2",handler:function(){i.hide();J.form.setValues({oldpwd:"",pwd:"",pwd2:""});i.setTitle(CX.chngPassFrmTitle)}}]});AE=new Array();CR=new Ext.data.SimpleStore({fields:["val"],data:AE});AL=new Ext.form.FormPanel({baseCls:"x-plain",id:"newAdminForm",labelAlign:"right",labelWidth:190,url:A5+"/apiIn.php?what=adminadd",defaultType:"textfield",items:[{id:"nid",inputType:"textfield",fieldLabel:CX.enterNewAdminIDStr,name:"newid",anchor:"100%",maxLength:20},{id:"newpass",inputType:"password",fieldLabel:CX.newPwdStr,name:"pwd",anchor:"100%"},{id:"newpassconfirm",inputType:"password",fieldLabel:CX.reNewPwdStr,name:"pwd2",anchor:"100%"},new Ext.form.ComboBox({id:"newadminlevel",fieldLabel:CX.adminLevelStr,name:"nalevel",displayField:"val",valueField:"val",store:CR,typeAhead:true,mode:"local",triggerAction:"all",emptyText:CX.pickLevelStr,lazyRender:true,selectOnFocus:true,anchor:"100%"})]});AN=new Ext.Window({id:"newAdminWindow",iconCls:"userAdd",title:CX.newAccount,width:420,height:200,minWidth:420,minHeight:200,layout:"fit",plain:true,modal:true,bodyStyle:"padding:5px;",buttonAlign:"center",items:AL,closable:true,closeAction:"hide",buttons:[{text:CX.makeNewAdminStr,id:"f4b1",handler:function(){AL.form.submit({waitMsg:CX.submittingStr,waitTitle:CX.pleaseWaitStr,success:function(Dh,Di){AN.hide();Ext.MessageBox.alert(CX.zpravaStr,CX.newAdminMadeStr);AL.form.setValues({newid:"",pwd:"",pwd2:"",nalevel:""});AN.setTitle(CX.newAccount)},failure:function(Dh,Di){AN.setTitle(CX.newAccount+' - <span class="error">'+CX.errStrLCase+"!</span>")}})}},{text:CX.cancelStr,id:"f4b2",handler:function(){AN.hide();AL.form.setValues({newid:"",pwd:"",pwd2:"",nalevel:""});AN.setTitle(CX.newAccount)}}]});A1=new Ext.form.FormPanel({baseCls:"x-plain",id:"newCustomerForm",labelAlign:"right",labelWidth:100,url:A5+"/apiIn.php?what=customeradd",defaultType:"textfield",items:[{inputType:"textfield",fieldLabel:"Jméno",name:"name",anchor:"99%",maxLength:45,allowBlank:false},{inputType:"textfield",fieldLabel:"E-mail",name:"email",anchor:"99%",maxLength:45},{inputType:"textfield",fieldLabel:"IČO",name:"ico",anchor:"99%",maxLength:20},{inputType:"textfield",fieldLabel:"DIČ",name:"dic",anchor:"99%",maxLength:20},{inputType:"textfield",fieldLabel:"Bankovní spojení",name:"bank_account",anchor:"99%",maxLength:50},{xtype:"textarea",fieldLabel:"Fakturační adresa",name:"address",anchor:"99%"},{xtype:"textarea",fieldLabel:"Doručovací adresa",name:"address_delivery",anchor:"99%"},{xtype:"hidden",name:"distributor_type",value:"2"}]});B1=new Ext.Window({id:"newCustomerWindow",iconCls:"userAdd",title:"Přidání nového koncového zákazníka",width:420,height:400,minWidth:420,minHeight:400,layout:"fit",plain:true,modal:true,bodyStyle:"padding:5px;",buttonAlign:"center",items:A1,closable:true,closeAction:"hide",buttons:[{text:"Přidat zákazníka",id:"fXb1",handler:function(){A1.form.submit({waitMsg:CX.submittingStr,waitTitle:CX.pleaseWaitStr,success:function(Dh,Di){CP.store.addListener("load",function(Dk,Dm,Dn){CP.setValue(Di.result.id);var Dl=0;for(var Dj=0;Dj<Dm.length;Dj++){if(Dm[Dj].id==Di.result.id){Dl=Dj}}CP.fireEvent("select",CP,Dm[Dl],Di.result.id)});CP.store.reload();B1.hide();A1.form.setValues({name:"",address:"",bank_account:"",email:"",address_delivery:"",ico:"",dic:""});B1.setTitle("Přidání nového koncového zákazníka")},failure:function(Dh,Di){B1.setTitle('Přidání nového koncového zákazníka - <span class="error">'+CX.errStrLCase+"!</span>")}})}},{text:CX.cancelStr,id:"fXb2",handler:function(){B1.hide();A1.form.setValues({name:"",address:"",bank_account:"",email:"",address_delivery:"",ico:"",dic:""});B1.setTitle("Přidání nového koncového zákazníka")}}]});E=Ext.data.Record.create([{name:"id",type:"string"},{name:"level",type:"float"},{name:"password_hash",type:"string"},{name:"modifier_id",type:"string"},{name:"modified_on",type:"date",dateFormat:"Y-m-d H:i:s"}]);CT=new Ext.data.Store({proxy:new Ext.data.ScriptTagProxy({url:A5+"/apiOut.php?what=modifier"}),reader:new Ext.data.JsonReader({root:"rslt",totalProperty:"total"},E),baseParams:{start:0,limit:AA},remoteSort:false,sortInfo:{field:"id",direction:"ASC"}});Ac=new Ext.form.FormPanel({baseCls:"x-plain",id:"assignTradesmanForm",labelAlign:"right",labelWidth:120,url:A5+"/apiIn.php?what=assigntradesman",defaultType:"textfield",items:[new Ext.form.ComboBox({id:"tradesmanid",fieldLabel:CX.chooseTradesmanStr,name:"tradesman",displayField:"id",valueField:"id",store:CT,typeAhead:false,triggerAction:"all",emptyText:CX.pickTradesmanStr,lazyRender:true,selectOnFocus:true,anchor:"100%"}),{id:"data_ids",inputType:"hidden",fieldLabel:"",name:"ids",anchor:"100%"}]});Ab=new Ext.Window({id:"assignTradesmanWindow",iconCls:"assign_tradesman",title:CX.assignTradesman,width:320,height:150,minWidth:320,minHeight:150,layout:"fit",plain:true,modal:true,bodyStyle:"padding:5px;",buttonAlign:"center",items:Ac,closable:true,closeAction:"hide",buttons:[{text:CX.assignTradesmanStr,id:"f5b1",handler:function(){var Di=BE.selModel.selections.keys;var Dh=Ext.encode(Di);Ac.form.setValues({data_ids:Dh});Ac.form.submit({waitMsg:CX.submittingStr,waitTitle:CX.pleaseWaitStr,success:function(Dj,Dk){Ab.hide();Ab.setTitle(CX.assignTradesman);if(BE.selModel.getCount()==1){s=BE.selModel.getCount()+" "+CX.recSynced1+"."}else{if(BE.selModel.getCount()<5){s=BE.selModel.getCount()+" "+CX.recSynced4+"."}else{s=BE.selModel.getCount()+" "+CX.recSyncedMore+"."}}Cu=CX[Al];if(B5){Ext.msger.msg(Cu,s)}document.getElementById("south").innerHTML="<p><b>"+Cu+":</b> "+s+"</p>"+document.getElementById("south").innerHTML;BE.selModel.clearSelections();BE.store.reload()},failure:function(Dj,Dk){Ab.setTitle(CX.assignTradesman+' - <span class="error">'+CX.errStrLCase+"!</span>")}})}},{text:CX.cancelStr,id:"f5b2",handler:function(){Ab.hide();Ab.setTitle(CX.assignTradesman)}}]});Bc=new Ext.Window({id:"defineOrderWindow",iconCls:"pageAdd",title:"Objednávka lodi Titanic",layout:"fit",plain:true,modal:true,bodyStyle:"padding:5px;",width:530,height:510,items:DM,closable:true,closeAction:"hide",resizable:true});Bc.addListener("beforehide",function(Dh){Bv.selModel.clearSelections()});AV=new Ext.Window({id:"charterWindow",iconCls:"locations",title:"Charter "+CX.activeSeasonName,width:720,height:600,minWidth:420,minHeight:200,layout:"fit",plain:true,modal:true,bodyStyle:"padding:5px;",buttonAlign:"center",items:Bv,closable:true,maximizable:true,closeAction:"hide",buttons:[{text:"Aktualizovat",id:"fchb1",handler:function(){Bv.store.reload()}},{text:"Zavřít",id:"fchb2",handler:function(){if(Bi<=1){BE.store.reload();AV.hide()}else{while(B3.findById("west-panel").items.getCount()>1){B3.findById("west-panel").items.remove(B3.findById("west-panel").items.last())}B3.findById("west-panel").hide();A6.show();BE.hide();AV.hide();B3.hide();AZ.show();Ext.Ajax.request({url:A5+"/apiOut.php?what=adminout",success:function(){if(B5){Ext.msger.msg(CX.goodbyeStr,CX.logoutOkStr)}As.form.setValues({pwd:""});window.location.reload()},failure:function(){As.form.setValues({pwd:""})}})}}}]})}return{damnSels:"",damnStore:"",init:function(){Ext.DatePicker.prototype.startDay=6;Ext.state.Manager.setProvider(new Ext.state.CookieProvider());Ext.QuickTips.init();Ext.apply(Ext.QuickTips.getQuickTip(),{showDelay:20,dismissDelay:50000,trackMouse:true,maxWidth:250});G()},setDatasPub:function(CZ,Ca){B9(CZ,Ca)},setStaticStrings:function(CZ){CX=Ext.util.JSON.decode(CZ)},setTree3:function(CZ){AD=Ext.util.JSON.decode(CZ)},setTree4:function(CZ){CM=Ext.util.JSON.decode(CZ)},setDsc:function(CZ){n=Ext.util.JSON.decode(CZ)},setBaseUrl:function(CZ){A5=CZ},doSels:function(){this.damnSels=Bv.selModel.getSelections();this.damnStore=Bj}}}()