')}else e||f.push(this.HTMLFieldLabel(a,d||"edit"));if(a.readonly||"view"===d)f.push('
',this.HTMLField4Many(a,c,{}),"
");else switch(a.type){case i.text:f.push(h.input.text(b,c,a,null,g));break;case i.integer:case i.dec:f.push(h.input.textInt(b,c,a.max,a.min));break;case i.money:f.push('
',h.input.typeFlag("$"),h.input.textInt(b,c),"
");break;case i.bool:f.push(h.input.checkbox(b,c));break;case i.txtm:case i.html:null===a.height?a.height=5:(fHeight=parseInt(a.height,10),1>fHeight&&(a.height=5)),f.push(h.input.textM(b,c,a.maxlength,a.height));break;case i.date:f.push(h.input.date(b,c));break;case i.datetime:f.push(h.input.dateTime(b,c));break;case i.time:f.push(h.input.time(b,c));break;case i.lov:f.push(h.input.select(b,c,"",!0,a.list));break;case i.email:"view"===d?f.push(h.linkEmail(b,c)):f.push('
',h.input.typeFlag(Evol.i18n.sgn_email),h.input.text(b,c,a.maxlength),"
");break;case i.url:f.push("view"===d?h.link(b,c,encodeURI(c),b):h.input.text(b,c,a.maxlength));break;case i.pix:""!==c?f.push('
'):f.push('
',Evol.i18n.nopix,"
"),f.push(h.input.text(b,c,a,null,g));break;case i.color:f.push(h.input.color(b,c))}return"mini"===d&&(f.push("
"),a.width=j),f.join("")},HTMLFieldLabel:function(a,b){var c=[];return c.push(''),this.renderBody(b,this.getFields(),e,d.icon,0,c.selectable),b.push(f),b.push("
"),this.$el.html(b.join("")),this},setPage:function(a){var b=[],c=this.getFields(),d=this.options,e=d.uiModel,f=d.pageSize||20;this.renderBody(b,c,f,e.icon,a,d.selectable),this.$(".evol-many-cards").html(b.join("")),this.$el.trigger("status",this.pageSummary(a,f,this.collection.length,e.entity,e.entities))},renderBody:function(a,b,c,d,e,f){var g,h=this.collection.models,i=0,j=_.min([h.length,i+c]);if(e>0&&(i=e*c,j=_.min([h.length,i+c])),j>0){for(g=i;j>g;g++)this.HTMLItem(a,b,h[g],d,f);a.push(Evol.UI.html.clearer)}else a.push(Evol.UI.HTMLMsg(Evol.i18n.nodata,"","info"))},HTMLItem:function(a,b,c,d,e){var f=this.options.links!==!1;a.push('',Evol.UI.input.button("cancel",Evol.i18n.Cancel,"btn-default"),Evol.UI.input.button("save",Evol.i18n.Save,"btn-primary")),this.model&&this.model.isNew()&&this.options.button_addAnother&&"json"!==b&&a.push(Evol.UI.input.button("save-add",Evol.i18n.SaveAdd,"btn-default")),a.push("
")},_render:function(a,b){var c=this,d=-1,e=-1,f=this.options,g=f.uiModel.elements,h=g.length;a.push('')),d++,a.push('
':'">'),c.renderTab(a,f,b),d==h-1&&a.push("
");break;case"panel":0>e&&(a.push('
'),e=1),c.renderPanel(a,f,"p-"+f.id,b);break;case"panel-list":0>e&&(a.push('
'),e=1),c.renderPanelList(a,f,b)}}),e>0&&a.push("
"),a.push("
"),this._renderButtons(a,b)},renderTabs:function(a,b){var c=!0;a.push('
'),_.each(b,function(b,d){"tab"==b.type&&(c?(a.push(''),c=!1):a.push(" "),a.push('',b.label," "))}),a.push(" ")},renderTab:function(a,b,c){var d=this;a.push('
'),_.each(b.elements,function(b,e){"panel-list"===b.type?d.renderPanelList(a,b,c):d.renderPanel(a,b,b.id||"pl-"+e,c)}),a.push(Evol.UI.html.clearer,"
")},renderPanel:function(a,b,c,d,e){var f=this;if("wiz"===d){var g=_.isUndefined(e)?!1:!e;a.push('')}else a.push('
'):a.push(' pull-left" style="width:',b.width,'%">');a.push('
',Evol.UI.HTMLPanelLabel(b.label,c,"PanelLabel"),'
'),"mini"===d?_.each(b.elements,function(b){a.push(''),f.renderField(a,b,d),a.push("
")}):_.each(b.elements,function(b){"panel-list"==b.type?f.renderPanelList(a,b,d):(a.push(''),f.renderField(a,b,d),a.push("
"))}),a.push(" ")},renderPanelList:function(a,b,c){a.push('
','
',Evol.UI.HTMLPanelLabel(b.label,b.id,"PanelLabel"),'
'),_.each(b.elements,function(b){a.push("",b.label," ")}),"edit"===c&&a.push(" "),a.push(" "),this._renderPanelListBody(a,b,null,c),a.push("
")},_renderPanelListBody:function(a,b,c,d){var e=this,f=b.elements;if(this.model){var g=this.model.get(b.attr);if(g&&g.length>0){var h='
'+Evol.UI.input.buttonsPlusMinus()+" ";return void _.each(g,function(c,g){a.push('
'),"edit"===d?(e._TDsFieldsEdit(a,b.elements,c),a.push(h)):_.each(f,function(b){a.push(""),a.push(c[b.id]?_.escape(Evol.Dico.HTMLField4Many(b,c[b.id],this.hashLov)):Evol.Dico.HTMLField4Many(b,"",this.hashLov)),a.push(" ")}),a.push(" ")})}}a.push(this._TRnodata(f.length,d))},_TRnodata:function(a,b){return['
',Evol.i18n.nodata,"edit"===b?'
':""," "].join("")},_TDsFieldsEdit:function(a,b,c){var d;_.each(b,function(b){d=c[b.id],_.isUndefined(d)&&(d=""),a.push("
",Evol.Dico.HTMLField4One(b,b.id,d,"edit-details",!0)," ")})},renderField:function(a,b,c){var d=this.fieldViewId(b.id),e="";return this.model&&this.model.has(b.id)&&(e="new"!==c?this.model.get(b.id):b.defaultvalue||""),a.push(Evol.Dico.HTMLField4One(b,d,e,c)),this
-},renderFieldLabel:function(a,b,c){a.push(Evol.Dico.HTMLFieldLabel(b,c))},setTitle:function(a){if(this._uTitle){var b=this.options,c=b.titleSelector;if(c&&""!==c){var d,e=b.uiModel.leadfield;return d=a?a:_.isUndefined(e)||""===e?Evol.UI.capitalize(b.uiModel.entities):this.getTitle(),$(c).text(d),this._uTitle=!0,this}this._uTitle=!1}return this},validate:function(a){var b=a?a:this.getFields();return this.clearMessages(),_.isArray(b)?Evol.UI.Validation.checkFields(this.$el,b,this.prefix):(this._subCollecs,this.$el.trigger("action","validate"),!1)},clearErrors:function(){return this.$(".control-group.error").removeClass("control-group error"),this.$(".has-error").removeClass("has-error"),this.$(".text-danger").remove(),this},fieldViewId:function(a){return this.prefix+"-"+a},customize:function(){var a=".evol-field-label>label",b=".evol-pnl .panel-title";return this.custOn?(this.$(a+">i, "+b+">i").remove(),this.custOn=!1):(_.each(this.$(a),function(a){var b=$(a),c=b.attr("for");b.append(Evol.UI.iconCustomize(c,"field"))}),this.$(b).append(Evol.UI.iconCustomize("id","panel")),this.custOn=!0),this},showHelp:function(a,b,c){var d=this.getFields(),e=_.findWhere(d,{id:a});if(e||e.help){var f=c.closest(".evol-fld"),g=f.find(".help-block");g.length>0?g.slideUp(200,function(){g.remove()}):(g=$('
'+_.escape(e.help)+" ").hide(),f.append(g),g.slideDown(200))}return this},clearMessages:function(){return this.$el.trigger("message",null),this.clearErrors()},sendMessage:function(a,b,c){return this.$el.trigger("message",{title:a,content:b,style:c})},click_button:function(a){var b=$(a.currentTarget).data("id");a.stopImmediatePropagation(),this.$el.trigger("action",b)},click_toggle:function(a){var b=$(a.currentTarget),c=b.closest(".panel-heading").next(),d=c.data("expState"),e="glyphicon-chevron-up",f="glyphicon-chevron-down";if(a.preventDefault(),a.stopImmediatePropagation(),a.shiftKey){var g="down"===d?f:e;this.$(".evol-title-toggle."+g).trigger("click")}else"down"===d?(b.closest(".panel").css("height",""),c.slideDown(300).data("expState","up"),b.addClass(e).removeClass(f)):(c.slideUp(300,function(){b.closest(".panel").css("height","40px")}).data("expState","down"),b.removeClass(e).addClass(f));this.$el.trigger("panel.toggle")},click_tab:function(a){var b=a.currentTarget.href,c=b.substring(b.indexOf("#"));a.stopImmediatePropagation(),a.preventDefault(),a.shiftKey?this.$(".tab-content > div").show():this.showTab(c)},click_help:function(a){var b=$(a.currentTarget),c=b.closest("label").attr("for"),d=b.data("type");a.stopImmediatePropagation(),this.showHelp(c,d,b),this.$el.trigger(d+".help",{id:c})},click_customize:function(a){var b=$(a.currentTarget),c=b.data("id"),d=b.data("type");a.stopImmediatePropagation(),Evol.Dico.showDesigner(c,d,b,this),this.$el.trigger(d+".customize",{id:c,type:d})},click_detailsAddDel:function(a){var b=$(a.currentTarget),c=b.data("id"),d=b.closest("tr");if(a.stopImmediatePropagation(),"bPlus"===c){var e=[],f=this.getSubCollecs(),g=d.closest("table").data("mid"),h=f[g]?f[g].elements:null;e.push("
"),this._TDsFieldsEdit(e,h,{}),e.push('',Evol.UI.input.buttonsPlusMinus()," "),$(e.join("")).insertAfter(d),"nodata"===d.data("id")&&d.remove()}else"bMinus"===c&&(0===d.siblings().length&&$(this._TRnodata(d.children().length,"edit")).insertAfter(d),d.remove())}}),Evol.ViewOne.Edit=Evol.ViewOne.extend({viewName:"edit",prefix:"oe"}),Evol.ViewOne.JSON=Evol.ViewOne.extend({events:{"click > .evol-buttons > button":"click_button"},viewName:"json",render:function(){var a=[];if(this.model){var b=JSON.stringify(this.model,null,2);a.push(Evol.UI.input.textMJSON("",b,10))}return this._renderButtons(a,"json"),this.$el.html(a.join("")),this.setData(this.model),this.custOn=!1,this},getData:function(){var a=this._getDOMField().val();return $.parseJSON(a)},setData:function(a){return this._getDOMField().val(JSON.stringify(a,null,2)),this.setTitle()},clear:function(){return this._getDOMField().val(""),this},_getDOMField:function(){return this.$el.children("textarea")}}),Evol.ViewOne.Mini=Evol.ViewOne.extend({events:{"click > .evol-buttons > button":"click_button","click .evol-title-toggle":"click_toggle","click label > .glyphicon-question-sign":"click_help"},viewName:"mini",prefix:"om",getFieldsCondition:function(a){return a.required||a.viewmany||a.viewmini},_render:function(a,b){var c=this.options,d={type:"panel","class":"evol-mini-holder",label:Evol.UI.capitalize(c.uiModel.entity),width:100,elements:this.getFields()};this.renderPanel(a,d,"evol-one-mini",b),this._renderButtons(a,b)}}),Evol.ViewOne.View=Evol.ViewOne.extend({viewName:"view",prefix:"ovw",getData:function(){return{}},setData:function(a){if(!_.isUndefined(a)&&null!==a){var b,c,d=this.getFields(),e=this,f=Evol.Dico.fieldTypes,g="#"+e.prefix+"-",h=this.getSubCollecs();_.each(d,function(d){if(b=e.$(g+d.id),c=a.get(d.id),a)switch(d.type){case f.lov:case f.bool:b.html(Evol.Dico.HTMLField4Many(d,c,e.hashLov));break;case f.url:b.html(Evol.UI.link(d.id,c,c,d.id));break;case f.email:b.html(Evol.UI.linkEmail(d.id,c));break;case f.pix:b.html(c?'
':"
"+Evol.i18n.nopix+"
");break;default:b.text(Evol.Dico.HTMLField4Many(d,c)||" ")}}),h&&_.each(h,function(a){var b=[];e._renderPanelListBody(b,a,c,"view"),e.$('[data-pid="'+a.id+'"] tbody').html(b.join(""))})}return this.setTitle()},clear:function(){var a,b=this.getFields(),c=this,d="#"+c.prefix+"-",e=this.getSubCollecs();return this.clearMessages(),_.each(b,function(b){switch(a=c.$(d+b.id),b.type){case"boolean":a.prop("checked",b.defaultvalue||"");break;default:a.html(b.defaultvalue||"")}}),e&&_.each(e,function(a){c.$('[data-pid="'+a.id+'"] tbody').html(c._TRnodata(a.elements.length,"view"))}),this},_renderButtons:function(a){a.push(Evol.UI.html.clearer,'
',Evol.UI.input.button("cancel",Evol.i18n.Cancel,"btn-default"),Evol.UI.input.button("edit",Evol.i18n.Edit,"btn-primary"),"
")}}),Evol.ViewOne.Wizard=Evol.ViewOne.extend({viewName:"wizard",prefix:"wiz",events:{"click .evo-wiz-bsteps>div,.evo-wiz-buttons>button":"click_nav","click label > .glyphicon-question-sign":"click_help",'click [data-id="bPlus"],[data-id="bMinus"]':"click_detailsAddDel"},stepIndex:function(a){return _.isUndefined(a)?this._stepIdx:a
0?c.hide().eq(--this._stepIdx).show():"next"===b&&this._stepIdx'),_.each(b,function(b,d){a.push('d?"past":"present"),a.push('">',d+1,"
",b.label,"
")}),a.push(" "),this},_renderPanels:function(a,b,c){var d=this;return a.push(''),_.each(b,function(b,e){switch(b.type){case"panel":d.renderPanel(a,b,"p-"+e,c,0===e);break;case"panel-list":d.renderPanelList(a,b,c,0===e)}}),a.push("
"),this},_renderButtons:function(a){return a.push(Evol.UI.html.clearer,'',Evol.UI.input.button("prev",Evol.i18n.prev,"btn-default disabled"),Evol.UI.input.button("next",Evol.i18n.next,"btn-primary"),Evol.UI.input.button("finish",Evol.i18n.finish,"btn-default"),"
"),this},click_nav:function(a){var b=$(a.currentTarget).data("id");if(this.clearMessages(),"finish"===b){var c=this.validate();""===c?this.$el.trigger("action","save"):this.sendMessage(Evol.i18n.validation.incomplete,c,"warning")}else{var d=parseInt(b,10);this._showStep(d,b)}this._refreshBreadcrumb()},_getButtons:function(){if(_.isUndefined(this._buttons)){var a=this.$(".evo-wiz-buttons>button");this._buttons={};for(var b=0;bdiv>div");_.each(b,function(b,c){c>a?$(b).attr("class","badge future"):a>c?$(b).attr("class","badge past"):$(b).attr("class","badge present")})}});var evoLangXpt=Evol.i18n.export;Evol.ViewAction.Export=Backbone.View.extend({viewName:"export",events:{"change .evol-xpt-format":"click_format","change input":"click_preview","click .evol-xpt-more":"click_toggle_sel","click button":"click_button"},options:{model:null,uiModel:null,many:!0,prefix:"tbr"},initialize:function(a){_.extend(this.options,a),this.render();var b=this.$el;return b.addClass("Panel"),this._preview("CSV"),this},render:function(){return this.$el.html(this._renderHTML()),this._preview("CSV"),this},_renderHTML:function(){var a=[],b=Evol.UI,c=this.options,d=c.prefix||"",e=this.getFields();a.push('');var k=d+"evol-xpt-format",l=evoLangXpt.ExportFormats.split("-");return a.push('
',evoLangXpt.ExportFormat," ",b.input.select(k,"","evol-xpt-format",!1,[{id:"CSV",text:l[0]},{id:"TAB",text:l[3]},{id:"HTML",text:l[1]},{id:"JSON",text:l[5]},{id:"SQL",text:l[2]},{id:"XML",text:l[4]}])),k=d+"FLH",a.push('
'),a.push('
'),a.push(b.input.checkbox(k,!0),b.fieldLabelSpan(k,evoLangXpt.ExportFirstLine)),a.push('
'),a.push('
',b.fieldLabel("FLS_evol",evoLangXpt.ExportSeparator),b.input.text(d+"FLS_evol",",",0),"
"),a.push("
"),_.each(["XML","HTML","SQL","JSON"],function(b){a.push('
')}),a.push("
"),a.push("
",evoLangXpt.preview,' '),a.push(''),a.push("
"),a.push('',b.input.button("cancel",Evol.i18n.Cancel,"btn-default"),b.input.button("export",evoLangXpt.DownloadEntity.replace("{0}",this.options.uiModel.entities),"btn btn-primary")),a.join("")},setModel:function(a){this.options.model=a},showFormatOpts:function(a){{var b="#"+(this.options.prefix||"");this.$el}switch(a){case"TAB":a="CSV",this.$('[data-id="csv2"]').hide();break;case"CSV":this.$('[data-id="csv2"]').show();break;case"HTML":case"XML":case"SQL":case"JSON":var c=this.$(b+a);""===c.html()&&c.html(EvoExport["form"+a](this.options.uiModel.entity))}var d=this.$(b+a).show().siblings().hide(),e=d.filter(".evol-FLH");"TAB"===a||"CSV"===a?e.show():e.hide(),EvoExport.cFormat=a},getFields:function(){var a=this.options;return this.fields||(this.fields=Evol.Dico.getFields(a.uiModel,a.fnFilter,a.mode)),this.fields},getTitle:function(){return this.options.many?Evol.i18n.getLabel("export.ExportEntities",this.options.uiModel.entities):Evol.i18n.getLabel("export.ExportEntity",this.options.uiModel.entity)},_preview:function(a){var b=[],c=Evol.Dico.fieldTypes;if(this.model&&this.model.collection){var d=this.model.collection.models,e=this.getFields(),f=this.$(".evol-xpt-flds > fieldset input:checked"),g={},h="#"+this.options.prefix,i=this.$(h+"FLH").prop("checked");switch(_.each(f,function(a){g[a.id.substring(3)]=""}),e=_.filter(e,function(a){return a.id&&_.has(g,a.id)?!0:void 0}),a){case"CSV":case"TAB":case"TXT":var j=e.length-1,k=Evol.UI.trim(this.$(h+"FLS_evol").val());"TAB"==a&&(k=" "),i&&(_.each(e,function(a,c){b.push(a.label),j>c&&b.push(k)}),b.push("\n")),_.each(d,function(a){_.each(e,function(c,d){var e=a.get(c.id);e&&b.push(e),j>d&&b.push(k)}),b.push("\n")}),b.push("\n");break;case"HTML":b.push("
\n"),i&&(b.push("\n"),_.each(e,function(a){b.push("",a.id," ")}),b.push(" \n")),_.each(d,function(a){b.push(""),_.each(e,function(c){var d=a.get(c.id);_.isUndefined(d)||""===d?b.push(" "):b.push("",d," ")}),b.push(" \n")}),b.push("
");break;case"JSON":b.push(JSON.stringify(this.model.toJSON(),null,2));break;case"SQL":var l=e.length-1,m=this.$("#evoxpTRS1").prop("checked"),n=this.$("#evoxpTRS2").prop("checked"),o=this.$("#evoTable").val().replace(/ /g,"_"),p=["INSERT INTO ",o," ("];""===o&&(o=this.options.uiModel.entity.replace(/ /g,"_")),_.each(e,function(a,b){p.push(a.id),l>b&&p.push(", ")}),p.push(")\n VALUES ("),p=p.join(""),m&&b.push("BEGIN TRANSACTION\n"),n&&b.push("SET IDENTITY_INSERT ",o," ON;\n");var q;_.each(d,function(a){b.push(p),_.each(e,function(d,e){switch(q=a.get(d.id),d.type){case c.integer:case c.decimal:case c.money:b.push(q?q:"NULL");break;case c.bool:b.push("boolean"==typeof q?q:"NULL");break;case c.date:case c.datetime:case c.time:_.isUndefined(q)||""===q?b.push("NULL"):b.push('"',q.replace(/"/g,'""'),'"');break;default:_.isUndefined(q)?b.push('""'):b.push('"',q.replace(/"/g,'""'),'"')}l>e&&b.push(", ")}),b.push(");\n")}),n&&b.push("SET IDENTITY_INSERT ",o," OFF;\n"),m&&b.push("COMMIT TRANSACTION\n");break;case"XML":var r,s=this.$("#evoRoot").val()||this.options.uiModel.entity.replace(/ /g,"_");b.push("
\n"),_.each(d,function(a){b.push("<",s," "),_.each(e,function(d){b.push(d.id,'="'),d.type===c.text||d.type===c.txtm?(r=a.get(d.id),_.isUndefined(r)||b.push(r.replace(/"/g,'\\"'))):b.push(a.get(d.id)),b.push('" ')}),b.push(">",s,">\n")}),b.push(" ")}}else b.push(Evol.UI.HTMLMsg(Evol.i18n.nodata,"","info"));this.$(".evol-xpt-val").html(b.join(""))},val:function(a){return _.isUndefined(a)?this._getValue():(this._setValue(a),this)},_ValFields:function(){var a=[],b=this.$(".evol-xpt-flds input:checked");return _.each(b,function(b){a.push(b.attr("id"))}),a},_getValue:function(){var a={format:this._bFormat.val(),fields:this._ValFields(),options:{}},b=this.$(".evol-xpt-para input"),c=b.eq(0),d=!_.isUndefined(c.attr("checked"));return a.options[c.attr("id")]=d,a},click_format:function(a){var b=$(a.currentTarget).val();"XML"===b&&(this.$("#XML").html(EvoExport.formXML(this.options.uiModel.entity)).show().siblings().not(".evol-FLH").hide(),EvoExport.cFormat="XML"),this.showFormatOpts(b),this._preview(b),this.$el.trigger("change.export","format",b)},click_preview:function(){var a=this.$(".evol-xpt-format").val();this._preview(a)},click_toggle_sel:function(a){$(a.currentTarget).hide().next().slideDown()},click_button:function(a){var b=$(a.currentTarget).data("id");this.$el.trigger("action",b)}});var EvoExport={cFormat:"CSV",html_more2:function(a){return['
',a,' '].join("")},formHTML:function(){return""},formXML:function(a){return[EvoExport.html_more2("options"),EvoExport.formEntityName("evoRoot",evoLangXpt.xpXMLroot,a),Evol.UI.fieldLabel("evoxpC2X",evoLangXpt.xpColMap),"
"].join("")},formJSON:function(){return""},formSQL:function(a){return[EvoExport.html_more2("options"),EvoExport.formEntityName("evoTable",evoLangXpt.xpSQLTable,a),"
",Evol.UI.input.checkbox("evoxpTRS2","0"),Evol.UI.fieldLabelSpan("evoxpTRS2",evoLangXpt.xpSQLId),"
","
",Evol.UI.input.checkbox("evoxpTRS1","0"),Evol.UI.fieldLabelSpan("evoxpTRS1",evoLangXpt.xpSQLTrans),"
","
"].join("")},formEntityName:function(a,b,c){return[Evol.UI.fieldLabel(a,b),Evol.UI.input.text(a,c.replace(" ","_"),30)," "].join("")}},evoLang=Evol.i18n.filters,fOps={sEqual:"eq",sNotEqual:"ne",sStart:"sw",sContain:"ct",sFinish:"fw",sInList:"in",sIsNull:"null",sIsNotNull:"nn",sGreater:"gt",sSmaller:"lt",sBetween:"bw"};Evol.ViewAction.Filter=Backbone.View.extend({viewName:"filter",events:{"click .evo-bNew":"click_new","click .evo-bAdd":"click_add","click .evo-bSubmit":"click_submit","click .evo-zfilters>a>button":"click_remove"},options:{fields:[],dateFormat:"mm/dd/yyyy",buttonLabels:!1,submitButton:!1,submitReady:!1},initialize:function(a){return this.options=_.extend(this.options,a),this},render:function(){var a=this.options.buttonLabels,b=this,c=this.$el,d=['
','',evoLang.bNewFilter," "];return this.options.submitButton&&d.push('',evoLang.bSubmit," "),d.push('
','',evoLang.bAddFilter," ",'',evoLang.bCancel," "),this._step=0,c.html(d.join("")),this.options.submitReady&&(this._hValues=$(" ").appendTo(c)),this.options.submitButton&&(this._bSubmit=c.find(".evo-bSubmit").button({text:a})),this._bNew=c.find(".evo-bNew").button({text:a,icons:{secondary:"ui-icon-plusthick"}}),this._bAdd=c.find(".evo-bAdd").button({text:a,icons:{secondary:"ui-icon-check"}}),this._bDel=c.find(".evo-bDel").button({text:a,icons:{secondary:"ui-icon-close"}}).on("click",function(){b._removeEditor()}),this._editor=c.find(".evo-editFilter").on("change","#field",function(a){a.stopPropagation(),b._step>2&&b._editor.find("#value,#value2,.as-Txt").remove(),b._step>1&&(b._editor.find("#operator").remove(),b._bAdd.hide()),b._step=1;var c=$(a.currentTarget).val();if(""!==c){b._field=b._getFieldById(c);var d=b._type=b._field.type;b._setEditorOperator(),(d==Evol.Dico.fieldTypes.lov||d==Evol.Dico.fieldTypes.bool)&&b._setEditorValue()}else b._field=b._type=null}).on("change","#operator",function(a){a.stopPropagation(),b._operator=$(this).val(),b._step>2&&(b._editor.find("#value,#value2,.as-Txt").remove(),b._bAdd.hide(),b._step=2),b._setEditorValue()}).on("change keyup","#value,#value2",function(a){a.stopPropagation();var c=b._type,d=$(this).val(),e=""!==d||c==Evol.Dico.fieldTypes.lov||c==Evol.Dico.fieldTypes.bool;c==Evol.Dico.fieldTypes.number?e=e&&!isNaN(d):b._operator==fOps.sBetween&&(e=""!==b._editor.find("#value").val()&&""!==b._editor.find("#value2").val()),e?(b._bAdd.button("enable"),13==a.which&&b._bAdd.trigger("click")):b._bAdd.button("disable")}).on("click","#checkAll",function(){var a=$(this),b=a.attr("checked"),c=a.siblings();"checked"==b?c.attr("checked",b):c.removeAttr("checked")}),this._filters=c.find(".evo-zfilters").on("click","a",function(){b._editFilter($(this))}).on("click","a>button",function(a){a.stopPropagation();var c=$(this).parent();c.hasClass("ui-state-disabled")||c.fadeOut("slow",function(){c.remove(),b._triggerChange()})}),this},_getFieldById:function(a){if(!this._hash){this._hash={};for(var b=this.options.fields,c=0,d=b.length;d>c;c++)this._hash[b[c].id]=b[c]}return this._hash[a]},_removeEditor:function(){this._editor.empty(),this._bAdd.hide(),this._bDel.hide(),this._enableFilter(null,!1),this._bNew.removeClass("ui-state-active").show().focus(),this._bSubmit&&this._bSubmit.removeClass("ui-state-active").show(),this._step=0,this._field=this._type=this._operator=null},addFilter:function(a){$(['',this._htmlFilter(a)," "].join("")).prependTo(this._filters).data("filter",a).fadeIn();return this._triggerChange(),this},removeFilter:function(a){return this._filters.children().eq(a).remove(),this._triggerChange(),this},_htmlFilter:function(a){var b=['',a.field.label," ",'',a.operator.label," ",'',a.value.label," "];return a.operator.value==fOps.sBetween&&b.push(' ',evoLang.opAnd," ",'',a.value.label2," "),b.push(Evol.UI.html.buttonClose),b.join("")},_enableFilter:function(a){this._cFilter&&(this._cFilter.removeClass("disabled"),a?(this._cFilter.data("filter",a).html(this._htmlFilter(a)),this._cFilter=null,this._triggerChange()):this._cFilter=null)},_editFilter:function(a){var b=a.data("filter"),c=b.field.value,d=b.operator.value,e=b.value;this._enableFilter(null,!1),this._removeEditor(),this._cFilter=a.addClass("disabled"),this._setEditorField(c),this._setEditorOperator(d),d==fOps.sBetween?this._setEditorValue(e.value,e.value2):this._setEditorValue(e.value),this._bAdd.find(".ui-button-text").html(evoLang.bUpdateFilter),this._step=3},_setEditorField:function(a){if(this._step<1){if(this._bNew.stop().hide(),this._bSubmit&&this._bSubmit.stop().hide(),this._bDel.show(),!this._fList){for(var b=this.options.fields,c=[' '],d=0,e=b.length;e>d;d++){var f=b[d];c.push(Evol.UI.input.option(f.id,f.label))}c.push(" "),this._fList=c.join("")}$(this._fList).appendTo(this._editor).focus()}a&&(this._field=this._getFieldById(a),this._type=this._field.type,this._editor.find("#field").val(a)),this._step=1},_setEditorOperator:function(a){var b=Evol.UI,c=b.input.option,d=Evol.Dico.fieldTypes,e=this._type;if(this._step<2){var f=[];switch(e){case d.lov:f.push(b.input.hidden("operator",fOps.sInList)),this._operator=fOps.sInList;break;case d.bool:f.push(b.input.hidden("operator",fOps.sEqual)),this._operator=fOps.sEqual;break;default:switch(f.push(b.input.selectBegin("operator","",!0)),e){case d.date:case d.datetime:case d.time:e==d.time?f.push(c(fOps.sEqual,evoLang.sAt),c(fOps.sNotEqual,evoLang.sNotAt)):f.push(c(fOps.sEqual,evoLang.sOn),c(fOps.sNotEqual,evoLang.sNotOn)),f.push(c(fOps.sGreater,evoLang.sAfter),c(fOps.sSmaller,evoLang.sBefore),c(fOps.sBetween,evoLang.sBetween));break;case d.integer:case d.decimal:case d.money:f.push(c(fOps.sEqual,evoLang.sNumEqual),c(fOps.sNotEqual,evoLang.sNumNotEqual),c(fOps.sGreater,evoLang.sGreater),c(fOps.sSmaller,evoLang.sSmaller));break;default:f.push(c(fOps.sEqual,evoLang.sEqual),c(fOps.sNotEqual,evoLang.sNotEqual),c(fOps.sStart,evoLang.sStart),c(fOps.sContain,evoLang.sContain),c(fOps.sFinish,evoLang.sFinish))}f.push(c(fOps.sIsNull,evoLang.sIsNull),c(fOps.sIsNotNull,evoLang.sIsNotNull)),f.push("")}this._editor.append(f.join(""))}a&&e!=d.lov&&(this._editor.find("#operator").val(a),this._operator=a),this._step=2},_setEditorValue:function(a,b){var c=this._editor,d=Evol.Dico.fieldTypes,e=this._type,f=c.find("#operator").val(),g=!1,h=!0;if(""!==f){if(e==d.lov||f!=fOps.sIsNull&&f!=fOps.sIsNotNull){if(this._step<3){var i=[];switch(g=f==fOps.sBetween,e){case d.lov:i.push(''),this._field.list.length>7&&i.push('(All ) '),i.push(Evol.UI.input.checkboxLOV(this._field.list)),i.push(" ");break;case d.bool:i.push('',Evol.UI.input.radio("value","1",evoLang.yes,"0"!=a,"value1"),Evol.UI.input.radio("value","0",evoLang.no,"0"==a,"value0")," ");break;case d.date:case d.datetime:case d.time:case d.integer:case d.decimal:case d.money:var j=e==d.date?"text":e;i.push(' '),g&&i.push('',evoLang.opAnd," ",' '),h=!1;break;default:i.push(' '),h=!1}c.append(i.join("")),e==d.date&&c.find("#value,#value2").datepicker({dateFormat:this.options.dateFormat})}if(a){var k=c.find("#value");switch(e){case d.lov:k.find("#"+a.split(",").join(",#")).attr("checked","checked");break;case d.bool:k.find("#value"+a).attr("checked","checked");break;default:k.val(a),h=""!==a,g&&(k.next().next().val(b),h=""!==a&&""!==b)}}else h=e==d.lov||e==d.bool}else c.append(Evol.UI.input.hidden("value",""));this._bAdd.button(h?"enable":"disable").show(),this._step=3}},_getEditorData:function(){function a(a){var b=n.split("/");return b.length>2?b[2]+"-"+b[0]+"-"+b[1]:a}var b=this._editor,c=b.find("#field"),d=b.find("#value"),e={field:{label:c.find("option:selected").text(),value:c.val()},operator:{},value:{}},f=e.operator,g=e.value;if(this._type==Evol.Dico.fieldTypes.lov){var h=[],i=[];d.find("input:checked").not("#checkAll").each(function(){h.push(this.value),i.push(this.nextSibling.innerHTML)}),0===h.length?(f.label=evoLang.sIsNull,f.value=fOps.sIsNull,g.label=g.value=""):1==h.length?(f.label=evoLang.sEqual,f.value=fOps.sEqual,g.label='"'+i[0]+'"',g.value=h[0]):(f.label=evoLang.sInList,f.value=fOps.sInList,g.label="("+i.join(", ")+")",g.value=h.join(","))}else if(this._type==Evol.Dico.fieldTypes.bool){f.label=evoLang.sEqual,f.value=fOps.sEqual;var j=d.find("#value1").prop("checked")?1:0;g.label=1==j?evoLang.yes:evoLang.no,g.value=j}else{var k=b.find("#operator"),l=k.val();if(f.label=k.find("option:selected").text(),f.value=l,l==fOps.sIsNull||l==fOps.sIsNotNull)g.label=g.value="";else{var m=Evol.Dico.fieldTypes,n=d.val();switch(this._type){case m.text:g.label=n,g.value=n.toLocaleLowerCase();break;case m.integer:case m.decimal:case m.time:g.label=n,g.value=n;break;case m.date:case m.datetime:g.value=a(n),g.label=n;break;default:g.label=n,g.value=n}l==fOps.sBetween&&(n=d.next().next().val(),g.label2=n,this._type===m.date||this._type===m.datetime?(g.value2=a(n),g.label2=n):g.value2=n)}}return e},_hiddenValue:function(a,b,c){var d=Evol.UI.hidden;a.push(d("fld-"+c,b.field.value),d("op-"+c,b.operator.value),d("val-"+c,b.value.value));var e=b.value.value2;e&&a.push(d("val2-"+c,e))},_setHiddenValues:function(){for(var a=this.val(),b=a.length,c=[Evol.UI.hidden("elem",b)],d=0;b>d;d++)this._hiddenValue(c,a[d],d+1);this._hValues.html(c.join(""))},_triggerChange:function(){this.options.submitReady&&this._setHiddenValues(),this.$el.trigger("filter.change")},val:function(a){if(_.isUndefined(a)){var b=[];return this._filters.find("a").each(function(){b.push($(this).data("filter"))}),b}this._filters.empty();for(var c=0,d=a.length;d>c;c++)this.addFilter(a[c]);return this._triggerChange(),this},valText:function(){var a=[];return this._filters.find("a").each(function(){a.push(this.text)}),a.join(" "+evoLang.opAnd+" ")},clear:function(){return this._cFilter=null,this._removeEditor(),this._filters.empty(),this._triggerChange(),this},length:function(){return this._filters.children().length},click_new:function(){this._step<1&&(this._setEditorField(),this._step=1),this._bAdd.find(".ui-button-text").html(evoLang.bAddFilter)},click_add:function(){var a=this._getEditorData();this._cFilter?this._enableFilter(a,this.options.highlight):this.addFilter(a),this._removeEditor()},click_remove:function(a){a.stopImmediatePropagation(),a.stopPropagation(),$(a.currentTarget).closest("a").remove(),this._triggerChange()},click_submit:function(){this.$el.trigger("submit.filter")}}),Evol.ViewToolbar=Backbone.View.extend({events:{"click .nav a":"click_toolbar","list.navigate >div":"click_navigate","action >div":"action_view","status >div":"status_update","filter.change >div":"change_filter","click .alert-dismissable>button":"clearMessage","message >div":"showMessage"},options:{toolbar:!0,defaultView:"list",style:"panel-info",display:"label",titleSelector:"#title",buttons:{view:!0,edit:!0,mini:!0,wiz:!1,json:!0,list:!0,cards:!0,charts:!0,"new":!0,save:!0,del:!0,filter:!0,"export":!0,group:!1,customize:!1},pageSize:20},modesHash:{view:"View",edit:"Edit",mini:"Mini",wiz:"Wizard",json:"JSON",cards:"Cards",list:"List",charts:"Charts"},views:[],viewsHash:{},curView:null,_group:!1,initialize:function(a){_.extend(this.options,a),this.render(),this.$(".dropdown-toggle").dropdown()},render:function(){this.$el.html(this._toolbarHTML()),this.setView(this.options.defaultView||"list"),this._viewsIcon=this.$(".glyphicon-eye-open")},_toolbarHTML:function(){function a(a,b){return['','',Evol.UI.icon(b),' ',' ";return d.push('"),d.join("")},updateModel:function(){this.refresh()},refresh:function(){return this.viewsHash.list&&this.viewsHash.list.render(),this.viewsHash.cards&&this.viewsHash.cards.render(),this},setView:function(a){var b,c=this.options,d=this.$el,e="evolw-"+a,f=this.$('[data-vid="'+e+'"]'),g=this.curView,h=this._curCollec();if("new"===a)a=this._prevOne?this._prevOne:"edit",this.setView(a),this.model=new c.modelClass,this.model.collection=h,this.newItem(),this.curView.options.mode="new";else if(f.length)this.model=this.curView.model,this.model.collection=h,this.curView=this.viewsHash[a],this.curView.setCollection&&this.curView.setCollection(h),this.model&&!this.model.isNew()?(this.curView.setModel?(!this.curView.collection&&m.collection&&(this.curView.collection=this.model.collection),this.curView.setModel(this.model)):this.curView.model=this.model,this.curView.setTitle&&this.curView.setTitle(),"n"===this.curView.cardinality&&this.curView.setPage&&this.curView.setPage(this.options.pageIndex)):this.curView.clear&&this.curView.clear(),this.$('[data-id="views"] > li').removeClass("evo-sel").filter('[data-id="'+a+'"]').addClass("evo-sel"),f.show().siblings().not(".evo-toolbar,.evo-filters,.clearfix").hide();else{switch(f=$('
'),d.children().not(".evo-toolbar,.evo-filters,.clearfix").hide(),d.append(f),b={el:f,mode:a,model:this.model,collection:h,uiModel:c.uiModel,style:c.style,pageSize:c.pageSize||20,pageIndex:c.pageIndex||0,titleSelector:c.titleSelector},this.$('[data-id="new"]').show(),this.$('[data-id="views"] > li').removeClass("evo-sel").filter('[data-id="'+a+'"]').addClass("evo-sel"),a){case"view":case"edit":case"mini":case"json":case"wiz":g=new Evol.ViewOne[this.modesHash[a]](b).render(),this._prevOne=a;break;case"charts":case"cards":case"list":g=new Evol.ViewMany[this.modesHash[a]](b).render(),this._prevMany=a,g.setTitle(),"charts"!=a&&this.options.pageIndex>0&&g.setPage(this.options.pageIndex||0);break;case"export":g=new Evol.ViewAction.Export(b),f.addClass("panel panel-info").slideDown()}this.curView=g,this.viewsHash[a]=g,$(this.options.titleSelector).html(this.curView.getTitle())}return"n"===this.curView.cardinality?this.showFilter(!1):("wizard"===this.curView.viewName&&this.curView.stepIndex(0),this.hideFilter()),this.setIcons(a),this
-},getView:function(){return this.curView},getToolbarButtons:function(){if(!this._toolbarButtons){var a=this.$(".evo-toolbar li");this._toolbarButtons={ones:a.filter('li[data-cardi="1"]'),manys:a.filter('li[data-cardi="n"]'),edit:a.filter('[data-id="main"]>[data-id="edit"]'),del:a.filter('[data-id="del"]'),save:a.filter('[data-id="save"]'),prevNext:this.$('.evo-toolbar [data-id="prev"],.evo-toolbar [data-id="next"]'),customize:this.$('.evo-toolbar a[data-id="customize"]').parent(),views:this.$('.evo-toolbar [data-id="views"]')}}return this._toolbarButtons},setIcons:function(a){function b(a,b){c(d.ones,a),c(d.manys,b)}var c=Evol.UI.setVisible;if(this.$el){var d=this.getToolbarButtons();if(c(d.customize,"json"!=a),d.prevNext.hide(),c(d.views,"export"!==a),d.del.hide(),this._viewsIcon){var e="glyphicon-eye-open",f="glyphicon-eye-close";"mini"===a||"json"===a?this._viewsIcon.removeClass(e).addClass(f):this._viewsIcon.removeClass(f).addClass(e)}this.model&&this.model.isNew()||"export"===a?(b(!1,!1),this.model.isNew()&&$('.evo-dropdown-icons>li[data-cardi="1"]').show()):"cards"===a||"list"===a||"charts"===a?(this._prevMany=a,b(!1,!0),"charts"===a?this.setStatus(""):this.collection.length>this.options.pageSize&&d.prevNext.show()):(this._prevOne=a,b(!0,!1),d.prevNext.show(),c(d.save,"view"!==a),c(d.edit,"view"===a)),c(d.manys.filter('[data-id="group"]'),"cards"===a)}},showFilter:function(a){if(this._filters)this._filters.$el.show();else{if(!a)return this;var b=this,c=$(Evol.UI.HTMLEmptyPanel("filters","evo-filters","info"));this.$(".evo-toolbar").after(c),this._filters=new Evol.ViewAction.Filter({el:c,fields:Evol.Dico.getFields(this.options.uiModel)}).render(),c.on("change.filter",function(){b.curView.setFilter(b._filters.val()).render()})}return this},hideFilter:function(){return this._filters&&this._filters.$el.hide(),this},toggleFilter:function(){return this._filtersOn=!this._filtersOn,this._filtersOn?this.showFilter(!0):this.hideFilter()},setStatus:function(a){var b=this.$(".evo-toolbar .evo-tb-status");b.html(a)},setData:function(a){return this.curView&&this.curView.setData(a),this},getData:function(){return this.curView?this.curView.getData():null},browse:function(a){var b=this._curCollec(),c=this.curView.model;if(c&&b&&b.length){var d=b.length-1,e=_.indexOf(b.models,c);e="prev"===a?e>0?e-1:d:d>e?e+1:0,c=b.models[e]}else c=null;return this.model=c,this.curView.setModel(c),this.clearMessage(),this},saveItem:function(a){function b(b){a?c.newItem():(c.model=b,c._filteredCollection&&c._filteredCollection.add(b),c.setIcons("edit"),d.setModel(b)),d.setTitle()}var c=this,d=this.curView,e=d.validate();if(""===e){var f=this.options.uiModel.entity;if(this.model.isNew()){var g=this.collection;g?(g.create(this.getData(),{success:function(a){b(a),c.setMessage("Record saved.",Evol.i18n.getLabel("status.added",f,_.escape(d.getTitle())),"success")},error:function(){alert("error")}}),this.options.mode="edit"):alert("Can't save record b/c no collection is specified.")}else this.model.set(this.getData()),this.model.save("","",{success:function(a){b(a),c.setMessage("Record saved.",Evol.i18n.getLabel("status.updated",Evol.UI.capitalize(f),_.escape(d.getTitle())),"success")},error:function(){alert("error")}})}else this.setMessage(Evol.i18n.validation.incomplete,e,"warning");return this},newItem:function(){var a=this.curView;return"view"==a.viewName&&this.setView("view"!==this._prevOne?this._prevOne:"edit"),this.curView.clear().setTitle(Evol.i18n.getLabel("NewEntity",this.options.uiModel.entity,a.getTitle()))},deleteItem:function(){var a=Evol.i18n,b=this.options.uiModel.entity,c=this.curView.getTitle();if("1"===this.curView.cardinality){var d=this.curView.model;if(d&&confirm(a.getLabel("DeleteEntity",b,c))){var e=this,f=this.collection,g=_.indexOf(f.models,d),h=g,i=null;f.length>1&&(h=0===g?1:g0&&confirm(a.getLabel("DeleteEntities",j.length,this.options.uiModel.entities))}},setMessage:function(a,b,c){var d=this.$('[data-id="msg"]');if(d.length){{d.children()}d.attr("class","evo-msg alert alert-"+c+" alert-dismissable"),d.find(">strong").text(a),d.find(">span").html(b),d.show()}else $(Evol.UI.HTMLMsg(a," "+b,c)).insertAfter(this.$el.children()[0]);return this},clearMessage:function(){return this.$('[data-id="msg"]').remove(),this},showMessage:function(a,b){return b?this.setMessage(b.title,b.content,b.style):this.clearMessage()},action_view:function(a,b){switch(b){case"cancel":this.setView("edit"!==this.curView.viewName||this.model.isNew?this._prevMany||"list":"view");break;case"edit":this.setView(b);break;case"export":alert("Sorry, no demo server yet...");break;case"save":case"save-add":this.saveItem("save-add"===b)}},paginate:function(a,b){b&&(a=b);var c=this.options.pageIndex||0;if("prev"===a)c=c>0?c-1:0;else if("next"===a)(c+1)*(this.options.pageSize||20)0&&(c=d)}this.options.pageIndex=c,this.curView.setPage&&this.curView.setPage(c)},status_update:function(a,b){this.setStatus(b)},_curCollec:function(){return this._filteredCollection?this._filteredCollection:this.collection?this.collection:this.model?this.model.collection:new this.options.collectionClass},click_toolbar:function(a){var b=$(a.currentTarget);"A"!==b.tagName&&(b=b.closest("a"));var c=b.data("id");switch(a.preventDefault(),a.stopImmediatePropagation(),c){case"save":this.saveItem(!1);break;case"del":this.deleteItem();break;case"customize":this.curView.customize();break;case"filter":this.toggleFilter();break;case"prev":case"next":"1"===this.curView.cardinality?(this.curView.isDirty&&this.curView.isDirty(),this.browse(c)):"n"===this.curView.cardinality&&this.paginate(c);break;case"new-field":Evol.Dico.showDesigner("","field",b);break;default:c&&""!==c&&this.setView(c)}this.$el.trigger("toolbar."+c)},click_navigate:function(a,b){var c=this.collection.get(b.id);a.stopImmediatePropagation(),this.model=c,this.setView("view"),this.curView.setModel(c)},change_filter:function(){var a,b=this._filters.val();if(b.length){var c=Evol.Dico.filterModels(this.model.collection.models,b);a=this.collectionClass?new collectionClass(c):new Backbone.Collection(c),this._filteredCollection=a;var d=a.length,e=this.collection.length;this.setStatus(d+" / "+e+" "+this.options.uiModel.entities)}else a=this.collection,this._filteredCollection=null,this.setStatus(a.length+" "+this.options.uiModel.entities);this.curView.setCollection(a)}});
\ No newline at end of file
+var Evol=Evol||{};Evol.ViewAction={},Evol.UI={html:{trTableEnd:"",TdTrTableEnd:"",clearer:'
',emptyOption:' ',glyphicon:"glyphicon glyphicon-",required:'* ',buttonClose:'× '},label:function(a,b){return['',b," "].join("")},fieldLabel:function(a,b){return['',this.label(a,b),"
"].join("")},fieldLabelSpan:function(a,b){return['',this.label(a,b)," "].join("")},input:{text:function(a,b,c,d){var e="evo-field form-control "+(d||""),f=[' -1&&(b=b.replace(/"/g,'"')),c&&(_.each(["id","min","max","maxlength","placeholder"],function(a){_.isUndefined(c[a])||f.push('" ',a,'="',c[a])}),c.readonly&&f.push('" ',item,'="',item),e&&""!==e&&f.push('" class="',e)),f.push('">'),f.join("")},textInt:function(a,b,c,d){var e=[' '),e.join("")},textM:function(a,b,c,d){return['"].join("")},textMJSON:function(a,b,c){return['"].join("")},myType:function(a,b,c){return[' '].join("")},date:function(a,b){return this.myType("date",a,b)},dateTime:function(a,b){return this.myType("datetime-local",a,b)},time:function(a,b){return this.myType("time",a,b)},typeFlag:function(a){return''+a+" "},color:function(a,b){return[' '].join("")},checkbox:function(a,b){var c=[' '),c.join("")},checkbox2:function(a,b,c){var d=[' '),d.join("")},checkboxLOV:function(a){var b=[];for(var c in a){var d=a[c];b.push(' ','',d.text," ")}return b.join("")},radio:function(a,b,c,d,e){return[' ',c," "].join("")},lov:function(a,b,c,d){var e=['',c," "];return _.each(d,function(a){e.push(this.option(a.id,a.text))}),e.push(" "),e.join("")},img:function(a,b){return[' '].join("")},hidden:function(a,b){return[' '].join("")},hiddens:function(a){_.each(function(){a.push(' ')})},selectBegin:function(a,b,c){var d=[''];return c&&d.push(Evol.UI.html.emptyOption),d.join("")},select:function(a,b,c,d,e){return[this.selectBegin(a,c,d),this.options(e,b)," "].join("")},option:function(a,b){return['',b," "].join("")},options:function(a,b){var c=Evol.UI.input.option,d=[];return _.each(a,function(a){a.id===b?d.push('',a.text," "):d.push(c(a.id,a.text))}),d.join("")},button:function(a,b,c){return''+b+" "},buttonsPlusMinus:function(){return'
'}},link:function(a,b,c,d){var e=['',b," "),e.join("")},linkEmail:function(a,b){return b?(b=_.escape(b),this.link(a,b,"mailto:"+b)):""},icon:function(a,b){return[' '].join("")},iconCustomize:function(a,b){return Evol.UI.iconId(a,b,"wrench")},iconId:function(a,b,c){return[' '].join("")},HTMLPanelLabel:function(a){return['',Evol.UI.icon("chevron-up","evol-title-toggle"),'
',a," "].join("")},HTMLEmptyPanel:function(a,b,c){return'
'},HTMLMsg:function(a,b,c){return['',this.html.buttonClose,"
",a," ",b,"
"].join("")},formatDate:function(a){if(!_.isUndefined(a)&&null!==a){var b=a.split("-");if(b.length>1)return b[1]+"/"+b[2]+"/"+b[0]}return""},formatTime:function(a){if(!_.isUndefined(a)&&null!==a&&""!==a){var b=a.split(":"),c=parseInt(b[0],10);return c>12?c-12+":"+b[1]+" PM":c+":"+b[1]+" AM"}return""},formatDateTime:function(a){if(!_.isUndefined(a)&&null!==a&&""!==a){var b=a.split("T");return b.length>1?this.formatDate(b[0])+", "+this.formatTime(b[1]):this.formatDate(b[0])}return""},insertCollection:function(a,b){0===a.length&&_.each(b,function(b){a.create(b)})},capitalize:function(a){return a&&a.length>0?a.substring(0,1).toUpperCase()+a.substring(1):""},trim:function(a){return a?a.replace(/^\s+|\s+$/g,""):""},setVisible:function(a,b){b?a.show():a.hide()}},Evol.UI.Charts={URL:"http://chart.apis.google.com/chart",_HTML:function(a,b,c){return['',a,' '].join("")},Pie:function(a,b,c,d){var e=[this.URL,"?chd=t:",b.join(","),"&chl=",c.join("|"),"&cht=p&chds=0,20&chs=360x200"].join("");return this._HTML(a,e,d||"panel-default")},Bars:function(a,b,c,d){var e=_.max(b),f=[this.URL,"?chbh=a&chs=350x200&cht=bvg&chco=3a87ad,d9edf7&chds=0,",e,"&chd=t:",b.join("|"),"&chp=0.05&chts=676767,10.5&chdl=",c.join("|")].join("");return this._HTML(a,f,d)}},Evol.UI.Validation={checkMaxLen:function(a,b){a.value.length>b&&(a.value=a.value.substring(0,b-1))},checkNum:function(a,b){var c,d=a.value;if("i"==b.substring(0,1))c=parseInt(d,10);else{var e=Evol.i18n.LOCALE;("FR"==e||"DA"==e)&&(d=d.replace(",",".")),c=parseFloat(d)}isNaN(c)?a.value="":d!=c&&(a.value=c)},setValidationFlags:function(a,b){var c=a.find(".text-danger");c.length?c.html(b):a.append(''+b+"
"),a.addClass("has-error")},checkFields:function(a,b,c){function d(){var a=Evol.Dico.fieldTypes,b=Evol.UI.trim(n.val());if(""!==b)switch(m.type){case a.integer:case a.email:k[m.type].test(b)||h.setValidationFlags(n.parent(),g(j[m.type]));break;case a.dec:case a.money:var c=k[a.dec+Evol.i18n.LOCALE];null===c&&(c=k[a.dec+"EN"]),c.test(b)||h.setValidationFlags(n.parent(),g(j[m.type]));break;case a.date:case a.datetime:case a.time:""===b||_.isDate(new Date(b))||h.setValidationFlags(n.parent(),g(j[m.type]))}}function e(a){var b,c=a.tagName;return b="SELECT"==c&&a.get(0).selectedIndex>-1?"0"==f.options[a.get(0).selectedIndex].value:""===Evol.UI.trim(a.val())}function g(a,b){var c=a.replace("{0}",m.label);return null!==b&&(c=c.replace("{1}",b)),i.push(c),c}var h=this,i=[],j=Evol.i18n.validation,k={email:/^[\w\.\-]+@[\w\.\-]+\.[\w\.\-]+$/,integer:/^-?\d+$/,decimalEN:/^\d+(\.\d+)?$/,decimalFR:/^\d+(\,\d+)?$/,decimalDA:/^\d+(\,\d+)?$/};for(var l in b){var m=b[l],n=a.find("#"+c+"-"+m.id).eq(0),o="html"==m.type;if(n.length>0){var p,q,r=!0;if(m.required&&e(n,o)?(p=n.parent(),q=g(j.empty),h.setValidationFlags(p,q),r=!1):d(),null!==m.regex&&!_.isUndefined(m.regex)){var s=new RegExp(m.regex);n.val().match(s)||(p=n.parent(),q=g(j.regex,m.label),h.setValidationFlags(n.parent(),q))}if(r){var t=Evol.UI.trim(n.val());""!==t&&(null!==m.max&&parseFloat(t)>m.max&&h.setValidationFlags(n.parent(),g(j.max,m.max)),null!==m.min&&parseFloat(t)0?[j.intro,""].join(""):""}};var Evol=Evol||{};Evol.i18n={LOCALE:"EN",getLabel:function(a,b,c){var d;if(a.indexOf(".")>-1){var e=a.split(".");d=this[e[0]][e[1]]}else d=this[a];return b&&(d=d.replace("{0}",b),c&&(d=d.replace("{1}",c))),d},View:"View",Edit:"Edit",New:"New",NewEntity:"New {0}",NewUpload:"New Upload",Selections:"Selections",Selection:"Selection",Export:"Export",SearchRes:"Search Result",Delete:"Delete",All:"All",DeleteEntity:'Delete {0} "{1}"?',DeleteEntities:"Delete {0} {1}?",Back2SearchResults:"Back to search results",yes:"Yes",no:"No",none:"None",na:"N/A",nodata:"No data available.",nopix:"No picture.",nochart:"No charts available.",badchart:"The data structure doesn't allow for auto-generated charts.",range:"{0} - {1} of {2} {3}",selected:"{0} selected",sgn_money:"$",sgn_email:"@",Save:"Save",SaveAdd:"Save and Add Another",Cancel:"Cancel",NoChange:"No Change",NoX:"No {0}",status:{added:'New {0} "{1}" added.',updated:'{0} "{1}" updated.',deleted:'{0} "{1}" removed.'},validation:{incomplete:"Incomplete information",intro:"You are not finished yet:",empty:'"{0}" must have a value.',email:'"{0}" must be a valid email like "abc@company.com".',integer:'"{0}" must only use numbers.',decimal:'"{0}" must be a valid decimal numbers.',date:'"{0}" must be a valid date, format must be "MM/DD/YYYY" like "12/24/2014".',datetime:'"{0}" must be a valid date/time, format must be "MM/DD/YYYY hh:mm AM/PM" like "12/24/2014 10:30 AM".',time:'"{0}" must be a valid date/time, format must be "hh:mm AM/PM" like "10:30 AM".',max:'"{0}" must be smaller or equal to {1}.',min:'"{0}" must be greater or equal to {1}.',regex:'The value "{0}" is not of the expected format.'},charts:{aByB:"{0} by {1}",aB:"{0}: {1}"},"export":{ExportEntity:"Export {0}",ExportEntities:"Export {0}",preview:"Export Preview",ExportHeader:"Header",ExportSeparator:"Separator",ExportFirstLine:"First line for field names",ExportFormat:"Export format",ExportFields:"Fields to include in the export",IDkey:"ID - Primary Key",AllFields:"Show all fields",ExportFormats:"Comma separated (CSV, TXT, XLS...)-HTML-SQL Insert Statements (SQL)-Tab separated values (TXT)-XML-Javascript Object Notation (JSON)",xpXMLroot:"Element name",xpSQL:"SQL Options",xpSQLTable:"Table name",xpSQLTrans:"Inside transaction",xpSQLId:"Enable identity insert",DownloadEntity:"Download {0}"},filters:{sEqual:"equals",sNotEqual:"not equal",sStart:"starts with",sContain:"contains",sFinish:"finishes with",sInList:"any of",sIsNull:"is empty",sIsNotNull:"is not empty",sBefore:"before",sAfter:"after",sNumEqual:"=",sNumNotEqual:"!=",sGreater:">",sSmaller:"<",sOn:"on",sNotOn:"not on",sAt:"at",sNotAt:"not at",sBetween:"between",opAnd:"and",yes:"Yes",no:"No",bNewFilter:"New filter",bAddFilter:"Add filter",bUpdateFilter:"Update filter",bSubmit:"Submit",bCancel:"Cancel"},prev:"Previous",next:"Next",finish:"Finish !"};var Evol=Evol||{};Evol.Dico={fieldTypes:{text:"text",txtm:"textmultiline",bool:"boolean",dec:"decimal",integer:"integer",date:"date",time:"time",datetime:"datetime",pix:"image",doc:"document",lov:"lov",money:"money",email:"email",color:"color",url:"url"},getFields:function(a,b){function c(a){a&&a.elements&&a.elements.length>0?_.each(a.elements,function(a){"panel-list"!=a.type&&c(a)}):d.push(a)}var d=[];return c(a),_.isFunction(b)&&(d=_.filter(d,b)),d},getFieldTypedValue:function(a,b){var c=Evol.Dico.fieldTypes;switch(a.type){case c.bool:return b.prop("checked");case c.integer:return parseInt(b.val(),10);case c.decimal:case c.money:return parseFloat(b.val());default:return b.val()}},getSubCollecs:function(a){function b(a){"panel-list"===a.type?c[a.attr]=a:"panel"!==a.type&&a.elements&&a.elements.length>0?_.each(a.elements,function(a){"panel-list"===a.type?c[a.attr]=a:"panel"!==a.type&&b(a)}):c[a.attr]=a}var c={};return b(a),c},lovText:function(a,b,c){if(a.list&&a.list.length>0){a.id in c||(c[a.id]={});var d=c[a.id];if(b in d)return d[b];var e=_.find(a.list,function(a){return a.id==b});if(e){var f=e.text;return e.icon&&(f=' '+f),d[b]=f,f}}return""},lovTextNoPix:function(a,b){var c=_.find(a.list,function(a){return a.id==b});return c?c.text:""},isTypeDateOrTime:function(a){return a==EvoDico.fieldTypes.datetime||EvoDico.fieldTypes.date||a==EvoDico.fieldTypes.time},showDesigner:function(a,b,c,d){var e,f,g=$('
');switch(this.getFields(dico_field_ui,function(a){return""==a.get("id")}),b){case"object":break;case"field":f=dico_field_ui,e=d.model;break;case"list":case"tab":case"panel":case"panel-list":}c.closest(".evol-fld").after(g);new Evol.ViewOne.Edit({model:null,uiModel:f,model:e,defaultView:"edit",el:g,style:"panel-primary",size:"S",button_addAnother:!1}).render();return g.on("click","button#save,button#cancel",function(){g.remove()}),this},bbComparator:function(a){return function(b){return b.get(a)}},bbComparatorText:function(a){return function(b,c){return(b.get(a)||"").localeCompare(c.get(a)||"")}},filterModels:function(a,b){return b.length?a.filter(function(a){var c,d=!0;for(c=0,iMax=b.length;iMax>c&&d;c++){var e=b[c],f=e.value.value,g=a.get(e.field.value);switch(_.isUndefined(g)&&(g=""),e.operator.value){case"eq":d=f==g;break;case"ne":d=f!=g;break;case"gt":d=g>f;break;case"lt":d=f>g;break;case"bw":var h=e.value.value2;d=!(f>g||g>h);break;case"sw":d=0===g.toLocaleLowerCase().indexOf(f);break;case"ct":d=g.toLocaleLowerCase().indexOf(f)>-1;break;case"fw":var i=g.length,j=f.length;d=i>j?!1:g.toLocaleLowerCase().substring(j-i)===f;break;case"null":d=""==g||_.isUndefined(g);break;case"nn":d=!(_.isUndefined(g)||""==g);break;case"in":d=_.contains(f.split(","),g);break;case 1:d=g;break;case 0:d=!g}}return d}):a},HTMLField4Many:function(a,b,c){var d=Evol.Dico.fieldTypes;switch(a.type){case d.bool:if("true"===b||"1"==b)return Evol.UI.icon("ok");break;case d.lov:if(""!==b)return Evol.Dico.lovText(a,b,c);break;case d.date:return Evol.UI.formatDate(b);case d.time:return Evol.UI.formatTime(b);case d.datetime:return Evol.UI.formatDateTime(b);case d.pix:if(b&&b.length)return Evol.UI.input.img(a.id,b);break;case d.money:var e=parseFloat(b);if(!isNaN(e))return"$"+e.toFixed(2);break;default:return b}return""},HTMLField4One:function(a,b,c,d,e){var f=[],g=50,h=Evol.UI,i=Evol.Dico.fieldTypes;if("mini"===d){var j=a.width;a.width=100,f.push('',this.HTMLFieldLabel(a,d),'
')}else e||f.push(this.HTMLFieldLabel(a,d||"edit"));if(a.readonly||"view"===d)f.push('
',this.HTMLField4Many(a,c,{}),"
");else switch(a.type){case i.text:f.push(h.input.text(b,c,a,null,g));break;case i.integer:case i.dec:f.push(h.input.textInt(b,c,a.max,a.min));break;case i.money:f.push('
',h.input.typeFlag("$"),h.input.textInt(b,c),"
");break;case i.bool:f.push(h.input.checkbox(b,c));break;case i.txtm:case i.html:null===a.height?a.height=5:(fHeight=parseInt(a.height,10),1>fHeight&&(a.height=5)),f.push(h.input.textM(b,c,a.maxlength,a.height));break;case i.date:f.push(h.input.date(b,c));break;case i.datetime:f.push(h.input.dateTime(b,c));break;case i.time:f.push(h.input.time(b,c));break;case i.lov:f.push(h.input.select(b,c,"",!0,a.list));break;case i.email:"view"===d?f.push(h.linkEmail(b,c)):f.push('
',h.input.typeFlag(Evol.i18n.sgn_email),h.input.text(b,c,a.maxlength),"
");break;case i.url:f.push("view"===d?h.link(b,c,encodeURI(c),b):h.input.text(b,c,a.maxlength));break;case i.pix:""!==c?f.push('
'):f.push('
',Evol.i18n.nopix,"
"),f.push(h.input.text(b,c,a,null,g));break;case i.color:f.push(h.input.color(b,c))}return"mini"===d&&(f.push("
"),a.width=j),f.join("")},HTMLFieldLabel:function(a,b){var c=[];return c.push('',a.label),"view"!=b&&a.required&&c.push(Evol.UI.html.required),a.help&&""!==a.help&&c.push(Evol.UI.icon("question-sign","")),c.push("
"),c.join("")},HTMLFieldLink:function(a,b,c,d,e){var f=[];return e||f.push(''),d&&f.push(' '),f.push(c),e||f.push(" "),f.join("")}};var Evol=Evol||{};Evol.ViewMany=Backbone.View.extend({viewType:"many",cardinality:"n",_hashLov:{},options:{style:"panel-info",pageSize:20,pageIndex:0,autoUpdate:!1,selectable:!1,links:!0},events:{"click .evol-nav-id":"click_navigate","click .evol-sort-icons > i":"click_sort","click .pagination>li":"click_pagination","click .evol-field-label .glyphicon-wrench":"click_customize","change .list-sel":"click_selection",'change [data-id="cbxAll"]':"click_checkall"},initialize:function(a){var b=this;this.options=_.extend(this.options,a),this.mode=this.options.mode||"",this._filter=[],this.options.autoUpdate&&this.collection&&this.collection.on("change",function(){b.render()}),this._custOn=!1},render:function(){var a=this.collection.models;return this.collection.length?(a=Evol.Dico.filterModels(a,this._filter),this._render(a)):this.$el.html(Evol.UI.HTMLMsg(Evol.i18n.nodata,"","info")),this.setTitle()},_render:function(){alert("_render must be overwritten")},_HTMLCheckbox:function(a){return Evol.UI.input.checkbox2(a,!1,"list-sel")},customize:function(){var a=this.$("th>span");return this._custOn?a.find("i").remove():a.append(Evol.UI.iconCustomize("id","field")),this._custOn=!this._custOn,this},setCollection:function(a){return this.collection=a,this.render(),this},getCollection:function(){return this.collection},setFilter:function(a){return this._filter=a,this},getFilter:function(){return this._filter},setTitle:function(){return $(this.options.titleSelector).html(this.getTitle()),this},getTitle:function(){return Evol.UI.capitalize(this.options.uiModel.entities)},getFields:function(){if(!this._fields){this._fields=Evol.Dico.getFields(this.options.uiModel,function(a){return a.viewmany}),this._fieldHash={};var a=this;_.each(this._fields,function(b){a._fieldHash[b.id]=b})}return this._fields},getField:function(a){return this._fieldHash[a]},_HTMLField:function(a,b){return Evol.Dico.HTMLField4Many(a,b,this._fieldHash)},_$Selection:function(){return this.$(".list-sel:checked").not('[data-id="cbxAll"]')},getSelection:function(){return this.options.selectable?_.map(this._$Selection().toArray(),function(a){return $(a).data("id")}):[]},pageSummary:function(a,b,c,d,e){if(0===c)return c+" "+e;if(1===c)return c+" "+d;var f,g=(a||0)*b+1;return f=_.min(1>a?[b,c]:[g+b-1,c]),Evol.i18n.range.replace("{0}",g).replace("{1}",f).replace("{2}",c).replace("{3}",e)},sortList:function(a,b){var c=this.collection,d=Evol.Dico.fieldTypes;_.isUndefined(c)||(c.comparator=a.type==d.text||a.type==d.txtm||a.type==d.email?Evol.Dico.bbComparatorText(a.id):Evol.Dico.bbComparator(a.id),c.sort(),b&&c.models.reverse(),this.setPage?this.setPage(0):this.render(),this.$el.trigger("list.sort",{id:a.id,direction:b?"down":"up"}))},click_navigate:function(a){a.type="list.navigate",this.$el.trigger(a,{id:$(a.currentTarget).closest("[data-mid]").data("mid")})},click_sort:function(a){var b=$(a.currentTarget),c=b.parent().data("fid"),d=this.getField(c),e=b.attr("class").indexOf("-down")>0;this.sortList(d,e),b.addClass("evol-last-sort")},click_pagination:function(a){this.$el.trigger("list.paginate",{id:$(a.currentTarget).closest("li").data("id")})},click_customize:function(a){var b=$(a.currentTarget),c=b.data("id"),d=b.data("type");Evol.Dico.showDesigner(c,d,b),this.$el.trigger(d+".customize",{id:c,type:d})},click_selection:function(a){"cbxAll"===$(a.currentTarget).data("id")||this.$el.trigger("selection")},click_checkall:function(){var a=this.$('[data-id="cbxAll"]').prop("checked");this.$(".list-sel").prop("checked",a),this.$el.trigger("selection")}}),Evol.ViewMany.Cards=Evol.ViewMany.extend({viewName:"cards",customize:function(){var a=this.$("h4 > a.evol-nav-id");return this._custOn?(a.find("i").remove(),this._custOn=!1):(a.append(Evol.UI.iconCustomize("id","field")),this._custOn=!0),this},_render:function(a){var b=[],c=this.options,d=c.uiModel,e=c.pageSize||50,f=this.pageSummary(0,e,a.length,d.entity,d.entities);return b.push(''),this.renderBody(b,this.getFields(),e,d.icon,0,c.selectable),b.push(f),b.push("
"),this.$el.html(b.join("")),this},setPage:function(a){var b=[],c=this.getFields(),d=this.options,e=d.uiModel,f=d.pageSize||20;this.renderBody(b,c,f,e.icon,a,d.selectable),this.$(".evol-many-cards").html(b.join("")),this.$el.trigger("status",this.pageSummary(a,f,this.collection.length,e.entity,e.entities))},renderBody:function(a,b,c,d,e,f){var g,h=this.collection.models,i=0,j=_.min([h.length,i+c]);if(e>0&&(i=e*c,j=_.min([h.length,i+c])),j>0){for(g=i;j>g;g++)this.HTMLItem(a,b,h[g],d,f);a.push(Evol.UI.html.clearer)}else a.push(Evol.UI.HTMLMsg(Evol.i18n.nodata,"","info"))},HTMLItem:function(a,b,c,d,e){var f=this.options.links!==!1;a.push('');for(var g=0;g',e?this._HTMLCheckbox(c.id):"",Evol.Dico.HTMLFieldLink("fg-"+h.id,h,i,d,!f),"
"):a.push("",h.label,": ",i,"
")}a.push("")}}),Evol.ViewMany.Charts=Evol.ViewMany.extend({viewName:"chart",events:{"click .evol-field-label .glyphicon-wrench":"click_customize"},render:function(){var a=[];return this.collection&&this.collection.length>0?(a.push(''),this._HTMLcharts(a,this.options.style),a.push("
")):a.push(Evol.UI.HTMLMsg(Evol.i18n.nodata,"","info")),this.$el.html(a.join("")),this.setTitle()},_HTMLcharts:function(a,b){var c=this,d=Evol.UI,e=Evol.Dico,f=Evol.i18n,g=e.fieldTypes,h=this.options.uiModel,i=this.collection.models,j=e.getFields(h,function(a){return a.type==g.lov||a.type==g.bool||a.type==g.integer});j&&j.length?_.each(j,function(j){var k,l=_.countBy(i,function(a){return a.get(j.id)}),m=l,n=[],o=[];for(var p in m){var q=m[p];k=_.isUndefined(p)?f.na:""===p||"null"===p?f.none:j.type===g.lov?j.list&&j.list.length&&j.list[0].icon?e.lovTextNoPix(j,p):e.lovText(j,p,c._hashLov):j.type===g.bool?"true"===p?f.yes:f.no:p,n.push(q),o.push(k+" ("+q+")")}var r=d.capitalize(h.entities);a.push(j.type===g.lov?d.Charts.Pie(f.getLabel("charts.aByB",r,j.label),n,o,b):d.Charts.Bars(f.getLabel("charts.aB",r,j.label),n,o,b))}):a.push(d.HTMLMsg(f.nochart,f.badchart)),a.push(d.html.clearer)}}),Evol.ViewMany.List=Evol.ViewMany.extend({viewName:"list",_render:function(){var a=[],b=this.options,c=b.selectable,d=this.getFields(),e=b.uiModel,f=b.pageSize||50,g=this.options.links!==!1;a.push('','
'),c&&a.push("",this._HTMLCheckbox("cbxAll")," ");for(var h=0;h "),this._HTMLlistBody(a,d,f,e.icon,0,c),a.push("
"),a.push("
"),this.$el.html(a.join(""))},setPage:function(a){var b=[],c=this.getFields(),d=this.options,e=d.uiModel,f=d.pageSize||20;this._HTMLlistBody(b,c,f,e.icon,a,d.selectable),this.$(".table > tbody").html(b.join("")),this.$el.trigger("status",this.pageSummary(a,f,this.collection.length,e.entity,e.entities))},_HTMLlistBody:function(a,b,c,d,e,f){var g,h=this.collection.models,i=0,j=_.min([h.length,i+c]);if(e>0&&(i=e*c,j=_.min([h.length,i+c])),j>0)for(g=i;j>g;g++)this.HTMLItem(a,b,h[g],d,f)},HTMLItem:function(a,b,c,d,e){var f,g,h=this.options.links!==!1;a.push(''),e&&a.push('',this._HTMLCheckbox(c.id)," ");for(var i=0;i",0===i?Evol.Dico.HTMLFieldLink("fv-"+f.id,f,g,d,!h):g,"");a.push(" ")},_HTMLlistHeader:function(a,b){a.push('',b.labellist||b.label,'',Evol.UI.icon("chevron-up"),Evol.UI.icon("chevron-down")," ")}});var Evol=Evol||{};Evol.ViewOne=Backbone.View.extend({viewType:"one",cardinality:"1",events:{"click .evol-buttons>button":"click_button","click .evol-title-toggle":"click_toggle","click ul.evol-tabs>li>a":"click_tab","click label>.glyphicon-question-sign":"click_help","click .evol-field-label .glyphicon-wrench":"click_customize",'click [data-id="bPlus"],[data-id="bMinus"]':"click_detailsAddDel"},options:{button_addAnother:!1,style:"panel-info",titleSelector:"#title"},initialize:function(a){this.options=_.extend(this.options,a),this.mode=a.mode||this.options.mode||this.viewName,this._uTitle=!_.isUndefined(this.options.titleSelector)&&""!==this.options.titleSelector,this.hashLov={}},render:function(){var a=[];return this._render(a,this.mode),this.$el.html(a.join("")),this.custOn=!1,this._postRender(),this},_postRender:function(){},getFields:function(){if(!this._fields){this._fields=Evol.Dico.getFields(this.options.uiModel,this.getFieldsCondition),this._fieldHash={};var a=this;_.each(this._fields,function(b){a._fieldHash[b.id]=b})}return this._fields},getSubCollecs:function(){return this._subCollecs||(this._subCollecs=Evol.Dico.getSubCollecs(this.options.uiModel)),this._subCollecs},setModel:function(a){return this.model=a,this.clearMessages().setData(a)},getModel:function(){return this.model},setUIModel:function(a){this.options.uiModel=a;var b=this.getData();return this.render().setData(b)},getUIModel:function(){return this.options.uiModel},getTitle:function(){if(this.model){var a=this.options.uiModel.leadfield;return _.isFunction(a)?a(this.model):this.model.get(a)}return Evol.UI.capitalize(this.options.uiModel.entity)},getData:function(){var a=this,b=this.getFields(),c={},d=this.getSubCollecs();return _.each(b,function(b){c[b.id]=a.getFieldValue(b)}),d&&_.each(d,function(b){var d,e,f=a.$('[data-pid="'+b.id+'"] tbody tr').not('[data-id="nodata"]').toArray(),g=[];_.each(f,function(a){d={},e=$(a).children(),_.each(b.elements,function(a,b){d[a.id]=Evol.Dico.getFieldTypedValue(a,e.eq(b).find("input,select,textarea").eq(0))}),g.push(d)}),c[b.attr]=g}),c},setData:function(a){if(!_.isUndefined(a)&&null!==a){var b,c,d=this.getFields(),e=this,f=Evol.Dico.fieldTypes,g="#"+e.prefix+"-",h=this.getSubCollecs();_.each(d,function(d){if(b=e.$(g+d.id),c=a.get(d.id),a)if(d.readonly)b.text(c||"");else switch(d.type){case f.lov:b.children().removeAttr("selected").filter("[value="+c+"]").attr("selected",!0);break;case f.bool:b.prop("checked",c);break;case f.pix:var h=c?' ':''+Evol.i18n.nopix+"
";b.val(c).prev().remove(),b.before(h);break;default:b.val(c)}}),h&&_.each(h,function(a){var b=[];e._renderPanelListBody(b,a,c,"edit"),e.$('[data-pid="'+a.id+'"] tbody').html(b.join(""))})}return this.setTitle()},setFieldValue:function(a,b){return this.$("#"+this.fieldViewId(a)).val(b),this},getFieldValue:function(a){var b=this.$("#"+this.fieldViewId(a.id));return Evol.Dico.getFieldTypedValue(a,b)},clear:function(){var a,b=this.getFields(),c=this,d="#"+c.prefix+"-",e=this.getSubCollecs();return this.clearMessages(),_.each(b,function(b){switch(a=c.$(d+b.id),b.type){case"boolean":a.prop("checked",b.defaultvalue||"");break;default:a.val(b.defaultvalue||"")}}),e&&_.each(e,function(a){c.$('[data-pid="'+a.id+'"] tbody').html(c._TRnodata(a.elements.length,"edit"))}),this},isDirty:function(){return!1},showTab:function(a){var b=this.$(a);return b.length>0&&(b.siblings(".tab-pane").hide(),b.show()),b=this.$('.evol-tabs > li a[href="'+a+'"]').parent(),b.length>0&&(b.siblings("li").removeClass("active"),b.addClass("active")),this.$el.trigger("tab.show"),this},_renderButtons:function(a,b){a.push(Evol.UI.html.clearer,'',Evol.UI.input.button("cancel",Evol.i18n.Cancel,"btn-default"),Evol.UI.input.button("save",Evol.i18n.Save,"btn-primary")),this.model&&this.model.isNew()&&this.options.button_addAnother&&"json"!==b&&a.push(Evol.UI.input.button("save-add",Evol.i18n.SaveAdd,"btn-default")),a.push("
")},_render:function(a,b){var c=this,d=-1,e=-1,f=this.options,g=f.uiModel.elements,h=g.length;a.push(''),_.each(g,function(f,i){switch(f.type){case"tab":e>0&&(a.push("
"),e=-1),0>d&&(a.push(Evol.UI.html.clearer),c.renderTabs(a,g),a.push('')),d++,a.push('
':'">'),c.renderTab(a,f,b),d==h-1&&a.push("
");break;case"panel":0>e&&(a.push('
'),e=1),c.renderPanel(a,f,"p-"+f.id,b);break;case"panel-list":0>e&&(a.push('
'),e=1),c.renderPanelList(a,f,b)}}),e>0&&a.push("
"),a.push("
"),this._renderButtons(a,b)},renderTabs:function(a,b){var c=!0;a.push('
'),_.each(b,function(b,d){"tab"==b.type&&(c?(a.push(''),c=!1):a.push(" "),a.push('',b.label," "))}),a.push(" ")},renderTab:function(a,b,c){var d=this;a.push('
'),_.each(b.elements,function(b,e){"panel-list"===b.type?d.renderPanelList(a,b,c):d.renderPanel(a,b,b.id||"pl-"+e,c)}),a.push(Evol.UI.html.clearer,"
")},renderPanel:function(a,b,c,d,e){var f=this;if("wiz"===d){var g=_.isUndefined(e)?!1:!e;a.push('')}else a.push('
'):a.push(' pull-left" style="width:',b.width,'%">');a.push('
',Evol.UI.HTMLPanelLabel(b.label,c,"PanelLabel"),'
'),"mini"===d?_.each(b.elements,function(b){a.push(''),f.renderField(a,b,d),a.push("
")}):_.each(b.elements,function(b){"panel-list"==b.type?f.renderPanelList(a,b,d):(a.push(''),f.renderField(a,b,d),a.push("
"))}),a.push(" ")},renderPanelList:function(a,b,c){a.push('
','
',Evol.UI.HTMLPanelLabel(b.label,b.id,"PanelLabel"),'
'),_.each(b.elements,function(b){a.push("",b.label," ")}),"edit"===c&&a.push(" "),a.push(" "),this._renderPanelListBody(a,b,null,c),a.push("
")},_renderPanelListBody:function(a,b,c,d){var e=this,f=b.elements;if(this.model){var g=this.model.get(b.attr);if(g&&g.length>0){var h='
'+Evol.UI.input.buttonsPlusMinus()+" ";return void _.each(g,function(c,g){a.push('
'),"edit"===d?(e._TDsFieldsEdit(a,b.elements,c),a.push(h)):_.each(f,function(b){a.push(""),a.push(c[b.id]?_.escape(Evol.Dico.HTMLField4Many(b,c[b.id],this.hashLov)):Evol.Dico.HTMLField4Many(b,"",this.hashLov)),a.push(" ")}),a.push(" ")})}}a.push(this._TRnodata(f.length,d))},_TRnodata:function(a,b){return['
',Evol.i18n.nodata,"edit"===b?'
':""," "].join("")},_TDsFieldsEdit:function(a,b,c){var d;_.each(b,function(b){d=c[b.id],_.isUndefined(d)&&(d=""),a.push("
",Evol.Dico.HTMLField4One(b,b.id,d,"edit-details",!0)," ")})},renderField:function(a,b,c){var d=this.fieldViewId(b.id),e="";
+return this.model&&this.model.has(b.id)&&(e="new"!==c?this.model.get(b.id):b.defaultvalue||""),a.push(Evol.Dico.HTMLField4One(b,d,e,c)),this},renderFieldLabel:function(a,b,c){a.push(Evol.Dico.HTMLFieldLabel(b,c))},setTitle:function(a){if(this._uTitle){var b=this.options,c=b.titleSelector;if(c&&""!==c){var d,e=b.uiModel.leadfield;return d=a?a:_.isUndefined(e)||""===e?Evol.UI.capitalize(b.uiModel.entities):this.getTitle(),$(c).text(d),this._uTitle=!0,this}this._uTitle=!1}return this},validate:function(a){var b=a?a:this.getFields();return this.clearMessages(),_.isArray(b)?Evol.UI.Validation.checkFields(this.$el,b,this.prefix):(this._subCollecs,this.$el.trigger("action","validate"),!1)},clearErrors:function(){return this.$(".control-group.error").removeClass("control-group error"),this.$(".has-error").removeClass("has-error"),this.$(".text-danger").remove(),this},fieldViewId:function(a){return this.prefix+"-"+a},customize:function(){var a=".evol-field-label>label",b=".evol-pnl .panel-title";return this.custOn?(this.$(a+">i, "+b+">i").remove(),this.custOn=!1):(_.each(this.$(a),function(a){var b=$(a),c=b.attr("for");b.append(Evol.UI.iconCustomize(c,"field"))}),this.$(b).append(Evol.UI.iconCustomize("id","panel")),this.custOn=!0),this},showHelp:function(a,b,c){var d=this.getFields(),e=_.findWhere(d,{id:a});if(e||e.help){var f=c.closest(".evol-fld"),g=f.find(".help-block");g.length>0?g.slideUp(200,function(){g.remove()}):(g=$('
'+_.escape(e.help)+" ").hide(),f.append(g),g.slideDown(200))}return this},clearMessages:function(){return this.$el.trigger("message",null),this.clearErrors()},sendMessage:function(a,b,c){return this.$el.trigger("message",{title:a,content:b,style:c})},click_button:function(a){var b=$(a.currentTarget).data("id");a.stopImmediatePropagation(),this.$el.trigger("action",b)},click_toggle:function(a){var b=$(a.currentTarget),c=b.closest(".panel-heading").next(),d=c.data("expState"),e="glyphicon-chevron-up",f="glyphicon-chevron-down";if(a.preventDefault(),a.stopImmediatePropagation(),a.shiftKey){var g="down"===d?f:e;this.$(".evol-title-toggle."+g).trigger("click")}else"down"===d?(b.closest(".panel").css("height",""),c.slideDown(300).data("expState","up"),b.addClass(e).removeClass(f)):(c.slideUp(300,function(){b.closest(".panel").css("height","40px")}).data("expState","down"),b.removeClass(e).addClass(f));this.$el.trigger("panel.toggle")},click_tab:function(a){var b=a.currentTarget.href,c=b.substring(b.indexOf("#"));a.stopImmediatePropagation(),a.preventDefault(),a.shiftKey?this.$(".tab-content > div").show():this.showTab(c)},click_help:function(a){var b=$(a.currentTarget),c=b.closest("label").attr("for"),d=b.data("type");a.stopImmediatePropagation(),this.showHelp(c,d,b),this.$el.trigger(d+".help",{id:c})},click_customize:function(a){var b=$(a.currentTarget),c=b.data("id"),d=b.data("type");a.stopImmediatePropagation(),Evol.Dico.showDesigner(c,d,b,this),this.$el.trigger(d+".customize",{id:c,type:d})},click_detailsAddDel:function(a){var b=$(a.currentTarget),c=b.data("id"),d=b.closest("tr");if(a.stopImmediatePropagation(),"bPlus"===c){var e=[],f=this.getSubCollecs(),g=d.closest("table").data("mid"),h=f[g]?f[g].elements:null;e.push("
"),this._TDsFieldsEdit(e,h,{}),e.push('',Evol.UI.input.buttonsPlusMinus()," "),$(e.join("")).insertAfter(d),"nodata"===d.data("id")&&d.remove()}else"bMinus"===c&&(0===d.siblings().length&&$(this._TRnodata(d.children().length,"edit")).insertAfter(d),d.remove())}}),Evol.ViewOne.Edit=Evol.ViewOne.extend({viewName:"edit",prefix:"oe"}),Evol.ViewOne.JSON=Evol.ViewOne.extend({events:{"click > .evol-buttons > button":"click_button"},viewName:"json",render:function(){var a=[];if(this.model){var b=JSON.stringify(this.model,null,2);a.push(Evol.UI.input.textMJSON("",b,10))}return this._renderButtons(a,"json"),this.$el.html(a.join("")),this.setData(this.model),this.custOn=!1,this},getData:function(){var a=this._getDOMField().val();return $.parseJSON(a)},setData:function(a){return this._getDOMField().val(JSON.stringify(a,null,2)),this.setTitle()},clear:function(){return this._getDOMField().val(""),this},_getDOMField:function(){return this.$el.children("textarea")}}),Evol.ViewOne.Mini=Evol.ViewOne.extend({events:{"click > .evol-buttons > button":"click_button","click .evol-title-toggle":"click_toggle","click label > .glyphicon-question-sign":"click_help"},viewName:"mini",prefix:"om",getFieldsCondition:function(a){return a.required||a.viewmany||a.viewmini},_render:function(a,b){var c=this.options,d={type:"panel","class":"evol-mini-holder",label:Evol.UI.capitalize(c.uiModel.entity),width:100,elements:this.getFields()};this.renderPanel(a,d,"evol-one-mini",b),this._renderButtons(a,b)}}),Evol.ViewOne.View=Evol.ViewOne.extend({viewName:"view",prefix:"ovw",getData:function(){return{}},setData:function(a){if(!_.isUndefined(a)&&null!==a){var b,c,d=this.getFields(),e=this,f=Evol.Dico.fieldTypes,g="#"+e.prefix+"-",h=this.getSubCollecs();_.each(d,function(d){if(b=e.$(g+d.id),c=a.get(d.id),a)switch(d.type){case f.lov:case f.bool:b.html(Evol.Dico.HTMLField4Many(d,c,e.hashLov));break;case f.url:b.html(Evol.UI.link(d.id,c,c,d.id));break;case f.email:b.html(Evol.UI.linkEmail(d.id,c));break;case f.pix:b.html(c?'
':"
"+Evol.i18n.nopix+"
");break;default:b.text(Evol.Dico.HTMLField4Many(d,c)||" ")}}),h&&_.each(h,function(a){var b=[];e._renderPanelListBody(b,a,c,"view"),e.$('[data-pid="'+a.id+'"] tbody').html(b.join(""))})}return this.setTitle()},clear:function(){var a,b=this.getFields(),c=this,d="#"+c.prefix+"-",e=this.getSubCollecs();return this.clearMessages(),_.each(b,function(b){switch(a=c.$(d+b.id),b.type){case"boolean":a.prop("checked",b.defaultvalue||"");break;default:a.html(b.defaultvalue||"")}}),e&&_.each(e,function(a){c.$('[data-pid="'+a.id+'"] tbody').html(c._TRnodata(a.elements.length,"view"))}),this},_renderButtons:function(a){a.push(Evol.UI.html.clearer,'
',Evol.UI.input.button("cancel",Evol.i18n.Cancel,"btn-default"),Evol.UI.input.button("edit",Evol.i18n.Edit,"btn-primary"),"
")}}),Evol.ViewOne.Wizard=Evol.ViewOne.extend({viewName:"wizard",prefix:"wiz",events:{"click .evo-wiz-bsteps>div,.evo-wiz-buttons>button":"click_nav","click label > .glyphicon-question-sign":"click_help",'click [data-id="bPlus"],[data-id="bMinus"]':"click_detailsAddDel"},stepIndex:function(a){return _.isUndefined(a)?this._stepIdx:a
0?c.hide().eq(--this._stepIdx).show():"next"===b&&this._stepIdx'),_.each(b,function(b,d){a.push('d?"past":"present"),a.push('">',d+1,"
",b.label,"
")}),a.push(" "),this},_renderPanels:function(a,b,c){var d=this;return a.push(''),_.each(b,function(b,e){switch(b.type){case"panel":d.renderPanel(a,b,"p-"+e,c,0===e);break;case"panel-list":d.renderPanelList(a,b,c,0===e)}}),a.push("
"),this},_renderButtons:function(a){return a.push(Evol.UI.html.clearer,'',Evol.UI.input.button("prev",Evol.i18n.prev,"btn-default disabled"),Evol.UI.input.button("next",Evol.i18n.next,"btn-primary"),Evol.UI.input.button("finish",Evol.i18n.finish,"btn-default"),"
"),this},click_nav:function(a){var b=$(a.currentTarget).data("id");if(this.clearMessages(),"finish"===b){var c=this.validate();""===c?this.$el.trigger("action","save"):this.sendMessage(Evol.i18n.validation.incomplete,c,"warning")}else{var d=parseInt(b,10);this._showStep(d,b)}this._refreshBreadcrumb()},_getButtons:function(){if(_.isUndefined(this._buttons)){var a=this.$(".evo-wiz-buttons>button");this._buttons={};for(var b=0;bdiv>div");_.each(b,function(b,c){c>a?$(b).attr("class","badge future"):a>c?$(b).attr("class","badge past"):$(b).attr("class","badge present")})}});var evoLangXpt=Evol.i18n.export;Evol.ViewAction.Export=Backbone.View.extend({viewName:"export",events:{"change .evol-xpt-format":"click_format","change input":"click_preview","click .evol-xpt-more":"click_toggle_sel","click button":"click_button"},options:{model:null,uiModel:null,many:!0,prefix:"tbr"},initialize:function(a){_.extend(this.options,a),this.render();var b=this.$el;return b.addClass("Panel"),this._preview("CSV"),this},render:function(){return this.$el.html(this._renderHTML()),this._preview("CSV"),this},_renderHTML:function(){var a=[],b=Evol.UI,c=this.options,d=c.prefix||"",e=this.getFields();a.push('');var k=d+"evol-xpt-format",l=evoLangXpt.ExportFormats.split("-");return a.push('
',evoLangXpt.ExportFormat," ",b.input.select(k,"","evol-xpt-format",!1,[{id:"CSV",text:l[0]},{id:"TAB",text:l[3]},{id:"HTML",text:l[1]},{id:"JSON",text:l[5]},{id:"SQL",text:l[2]},{id:"XML",text:l[4]}])),k=d+"FLH",a.push('
'),a.push('
'),a.push(b.input.checkbox(k,!0),b.fieldLabelSpan(k,evoLangXpt.ExportFirstLine)),a.push('
'),a.push('
',b.fieldLabel("FLS_evol",evoLangXpt.ExportSeparator),b.input.text(d+"FLS_evol",",",0),"
"),a.push("
"),_.each(["XML","HTML","SQL","JSON"],function(b){a.push('
')}),a.push("
"),a.push("
",evoLangXpt.preview,' '),a.push(''),a.push("
"),a.push('',b.input.button("cancel",Evol.i18n.Cancel,"btn-default"),b.input.button("export",evoLangXpt.DownloadEntity.replace("{0}",this.options.uiModel.entities),"btn btn-primary")),a.join("")},setModel:function(a){this.options.model=a},showFormatOpts:function(a){{var b="#"+(this.options.prefix||"");this.$el}switch(a){case"TAB":a="CSV",this.$('[data-id="csv2"]').hide();break;case"CSV":this.$('[data-id="csv2"]').show();break;case"HTML":case"XML":case"SQL":case"JSON":var c=this.$(b+a);""===c.html()&&c.html(EvoExport["form"+a](this.options.uiModel.entity))}var d=this.$(b+a).show().siblings().hide(),e=d.filter(".evol-FLH");"TAB"===a||"CSV"===a?e.show():e.hide(),EvoExport.cFormat=a},getFields:function(){var a=this.options;return this.fields||(this.fields=Evol.Dico.getFields(a.uiModel,a.fnFilter,a.mode)),this.fields},getTitle:function(){return this.options.many?Evol.i18n.getLabel("export.ExportEntities",this.options.uiModel.entities):Evol.i18n.getLabel("export.ExportEntity",this.options.uiModel.entity)},_preview:function(a){var b=[],c=Evol.Dico.fieldTypes;if(this.model&&this.model.collection){var d=this.model.collection.models,e=this.getFields(),f=this.$(".evol-xpt-flds > fieldset input:checked"),g={},h="#"+this.options.prefix,i=this.$(h+"FLH").prop("checked");switch(_.each(f,function(a){g[a.id.substring(3)]=""}),e=_.filter(e,function(a){return a.id&&_.has(g,a.id)?!0:void 0}),a){case"CSV":case"TAB":case"TXT":var j=e.length-1,k=Evol.UI.trim(this.$(h+"FLS_evol").val());"TAB"==a&&(k=" "),i&&(_.each(e,function(a,c){b.push(a.label),j>c&&b.push(k)}),b.push("\n")),_.each(d,function(a){_.each(e,function(c,d){var e=a.get(c.id);e&&b.push(e),j>d&&b.push(k)}),b.push("\n")}),b.push("\n");break;case"HTML":b.push("
\n"),i&&(b.push("\n"),_.each(e,function(a){b.push("",a.id," ")}),b.push(" \n")),_.each(d,function(a){b.push(""),_.each(e,function(c){var d=a.get(c.id);_.isUndefined(d)||""===d?b.push(" "):b.push("",d," ")}),b.push(" \n")}),b.push("
");break;case"JSON":b.push(JSON.stringify(this.model.toJSON(),null,2));break;case"SQL":var l=e.length-1,m=this.$("#evoxpTRS1").prop("checked"),n=this.$("#evoxpTRS2").prop("checked"),o=this.$("#evoTable").val().replace(/ /g,"_"),p=["INSERT INTO ",o," ("];""===o&&(o=this.options.uiModel.entity.replace(/ /g,"_")),_.each(e,function(a,b){p.push(a.id),l>b&&p.push(", ")}),p.push(")\n VALUES ("),p=p.join(""),m&&b.push("BEGIN TRANSACTION\n"),n&&b.push("SET IDENTITY_INSERT ",o," ON;\n");var q;_.each(d,function(a){b.push(p),_.each(e,function(d,e){switch(q=a.get(d.id),d.type){case c.integer:case c.decimal:case c.money:b.push(q?q:"NULL");break;case c.bool:b.push("boolean"==typeof q?q:"NULL");break;case c.date:case c.datetime:case c.time:_.isUndefined(q)||""===q?b.push("NULL"):b.push('"',q.replace(/"/g,'""'),'"');break;default:_.isUndefined(q)?b.push('""'):b.push('"',q.replace(/"/g,'""'),'"')}l>e&&b.push(", ")}),b.push(");\n")}),n&&b.push("SET IDENTITY_INSERT ",o," OFF;\n"),m&&b.push("COMMIT TRANSACTION\n");break;case"XML":var r,s=this.$("#evoRoot").val()||this.options.uiModel.entity.replace(/ /g,"_");b.push("
\n"),_.each(d,function(a){b.push("<",s," "),_.each(e,function(d){b.push(d.id,'="'),d.type===c.text||d.type===c.txtm?(r=a.get(d.id),_.isUndefined(r)||b.push(r.replace(/"/g,'\\"'))):b.push(a.get(d.id)),b.push('" ')}),b.push(">",s,">\n")}),b.push(" ")}}else b.push(Evol.UI.HTMLMsg(Evol.i18n.nodata,"","info"));this.$(".evol-xpt-val").html(b.join(""))},val:function(a){return _.isUndefined(a)?this._getValue():(this._setValue(a),this)},_ValFields:function(){var a=[],b=this.$(".evol-xpt-flds input:checked");return _.each(b,function(b){a.push(b.attr("id"))}),a},_getValue:function(){var a={format:this._bFormat.val(),fields:this._ValFields(),options:{}},b=this.$(".evol-xpt-para input"),c=b.eq(0),d=!_.isUndefined(c.attr("checked"));return a.options[c.attr("id")]=d,a},click_format:function(a){var b=$(a.currentTarget).val();"XML"===b&&(this.$("#XML").html(EvoExport.formXML(this.options.uiModel.entity)).show().siblings().not(".evol-FLH").hide(),EvoExport.cFormat="XML"),this.showFormatOpts(b),this._preview(b),this.$el.trigger("change.export","format",b)},click_preview:function(){var a=this.$(".evol-xpt-format").val();this._preview(a)},click_toggle_sel:function(a){$(a.currentTarget).hide().next().slideDown()},click_button:function(a){var b=$(a.currentTarget).data("id");this.$el.trigger("action",b)}});var EvoExport={cFormat:"CSV",html_more2:function(a){return['
',a,' '].join("")},formHTML:function(){return""},formXML:function(a){return[EvoExport.html_more2("options"),EvoExport.formEntityName("evoRoot",evoLangXpt.xpXMLroot,a),Evol.UI.fieldLabel("evoxpC2X",evoLangXpt.xpColMap),"
"].join("")},formJSON:function(){return""},formSQL:function(a){return[EvoExport.html_more2("options"),EvoExport.formEntityName("evoTable",evoLangXpt.xpSQLTable,a),"
",Evol.UI.input.checkbox("evoxpTRS2","0"),Evol.UI.fieldLabelSpan("evoxpTRS2",evoLangXpt.xpSQLId),"
","
",Evol.UI.input.checkbox("evoxpTRS1","0"),Evol.UI.fieldLabelSpan("evoxpTRS1",evoLangXpt.xpSQLTrans),"
","
"].join("")},formEntityName:function(a,b,c){return[Evol.UI.fieldLabel(a,b),Evol.UI.input.text(a,c.replace(" ","_"),30)," "].join("")}},evoLang=Evol.i18n.filters,fOps={sEqual:"eq",sNotEqual:"ne",sStart:"sw",sContain:"ct",sFinish:"fw",sInList:"in",sIsNull:"null",sIsNotNull:"nn",sGreater:"gt",sSmaller:"lt",sBetween:"bw"};Evol.ViewAction.Filter=Backbone.View.extend({viewName:"filter",events:{"click .evo-bNew":"click_new","click .evo-bAdd":"click_add","click .evo-bSubmit":"click_submit","click .evo-zfilters>a>button":"click_remove"},options:{fields:[],dateFormat:"mm/dd/yyyy",buttonLabels:!1,submitButton:!1,submitReady:!1},initialize:function(a){return this.options=_.extend(this.options,a),this},render:function(){var a=this.options.buttonLabels,b=this,c=this.$el,d=['
','',evoLang.bNewFilter," "];return this.options.submitButton&&d.push('',evoLang.bSubmit," "),d.push('
','',evoLang.bAddFilter," ",'',evoLang.bCancel," "),this._step=0,c.html(d.join("")),this.options.submitReady&&(this._hValues=$(" ").appendTo(c)),this.options.submitButton&&(this._bSubmit=c.find(".evo-bSubmit").button({text:a})),this._bNew=c.find(".evo-bNew").button({text:a,icons:{secondary:"ui-icon-plusthick"}}),this._bAdd=c.find(".evo-bAdd").button({text:a,icons:{secondary:"ui-icon-check"}}),this._bDel=c.find(".evo-bDel").button({text:a,icons:{secondary:"ui-icon-close"}}).on("click",function(){b._removeEditor()}),this._editor=c.find(".evo-editFilter").on("change","#field",function(a){a.stopPropagation(),b._step>2&&b._editor.find("#value,#value2,.as-Txt").remove(),b._step>1&&(b._editor.find("#operator").remove(),b._bAdd.hide()),b._step=1;var c=$(a.currentTarget).val();if(""!==c){b._field=b._getFieldById(c);var d=b._type=b._field.type;b._setEditorOperator(),(d==Evol.Dico.fieldTypes.lov||d==Evol.Dico.fieldTypes.bool)&&b._setEditorValue()}else b._field=b._type=null}).on("change","#operator",function(a){a.stopPropagation(),b._operator=$(this).val(),b._step>2&&(b._editor.find("#value,#value2,.as-Txt").remove(),b._bAdd.hide(),b._step=2),b._setEditorValue()}).on("change keyup","#value,#value2",function(a){a.stopPropagation();var c=b._type,d=$(this).val(),e=""!==d||c==Evol.Dico.fieldTypes.lov||c==Evol.Dico.fieldTypes.bool;c==Evol.Dico.fieldTypes.number?e=e&&!isNaN(d):b._operator==fOps.sBetween&&(e=""!==b._editor.find("#value").val()&&""!==b._editor.find("#value2").val()),e?(b._bAdd.button("enable"),13==a.which&&b._bAdd.trigger("click")):b._bAdd.button("disable")}).on("click","#checkAll",function(){var a=$(this),b=a.attr("checked"),c=a.siblings();"checked"==b?c.attr("checked",b):c.removeAttr("checked")}),this._filters=c.find(".evo-zfilters").on("click","a",function(){b._editFilter($(this))}).on("click","a>button",function(a){a.stopPropagation();var c=$(this).parent();c.hasClass("ui-state-disabled")||c.fadeOut("slow",function(){c.remove(),b._triggerChange()})}),this},_getFieldById:function(a){if(!this._hash){this._hash={};for(var b=this.options.fields,c=0,d=b.length;d>c;c++)this._hash[b[c].id]=b[c]}return this._hash[a]},_removeEditor:function(){this._editor.empty(),this._bAdd.hide(),this._bDel.hide(),this._enableFilter(null,!1),this._bNew.removeClass("ui-state-active").show().focus(),this._bSubmit&&this._bSubmit.removeClass("ui-state-active").show(),this._step=0,this._field=this._type=this._operator=null},addFilter:function(a){$(['',this._htmlFilter(a)," "].join("")).prependTo(this._filters).data("filter",a).fadeIn();return this._triggerChange(),this},removeFilter:function(a){return this._filters.children().eq(a).remove(),this._triggerChange(),this},_htmlFilter:function(a){var b=['',a.field.label," ",'',a.operator.label," ",'',a.value.label," "];return a.operator.value==fOps.sBetween&&b.push(' ',evoLang.opAnd," ",'',a.value.label2," "),b.push(Evol.UI.html.buttonClose),b.join("")},_enableFilter:function(a){this._cFilter&&(this._cFilter.removeClass("disabled"),a?(this._cFilter.data("filter",a).html(this._htmlFilter(a)),this._cFilter=null,this._triggerChange()):this._cFilter=null)},_editFilter:function(a){var b=a.data("filter"),c=b.field.value,d=b.operator.value,e=b.value;this._enableFilter(null,!1),this._removeEditor(),this._cFilter=a.addClass("disabled"),this._setEditorField(c),this._setEditorOperator(d),d==fOps.sBetween?this._setEditorValue(e.value,e.value2):this._setEditorValue(e.value),this._bAdd.find(".ui-button-text").html(evoLang.bUpdateFilter),this._step=3},_setEditorField:function(a){if(this._step<1){if(this._bNew.stop().hide(),this._bSubmit&&this._bSubmit.stop().hide(),this._bDel.show(),!this._fList){for(var b=this.options.fields,c=[' '],d=0,e=b.length;e>d;d++){var f=b[d];c.push(Evol.UI.input.option(f.id,f.label))}c.push(" "),this._fList=c.join("")}$(this._fList).appendTo(this._editor).focus()}a&&(this._field=this._getFieldById(a),this._type=this._field.type,this._editor.find("#field").val(a)),this._step=1},_setEditorOperator:function(a){var b=Evol.UI,c=b.input.option,d=Evol.Dico.fieldTypes,e=this._type;if(this._step<2){var f=[];switch(e){case d.lov:f.push(b.input.hidden("operator",fOps.sInList)),this._operator=fOps.sInList;break;case d.bool:f.push(b.input.hidden("operator",fOps.sEqual)),this._operator=fOps.sEqual;break;default:switch(f.push(b.input.selectBegin("operator","",!0)),e){case d.date:case d.datetime:case d.time:e==d.time?f.push(c(fOps.sEqual,evoLang.sAt),c(fOps.sNotEqual,evoLang.sNotAt)):f.push(c(fOps.sEqual,evoLang.sOn),c(fOps.sNotEqual,evoLang.sNotOn)),f.push(c(fOps.sGreater,evoLang.sAfter),c(fOps.sSmaller,evoLang.sBefore),c(fOps.sBetween,evoLang.sBetween));break;case d.integer:case d.decimal:case d.money:f.push(c(fOps.sEqual,evoLang.sNumEqual),c(fOps.sNotEqual,evoLang.sNumNotEqual),c(fOps.sGreater,evoLang.sGreater),c(fOps.sSmaller,evoLang.sSmaller));break;default:f.push(c(fOps.sEqual,evoLang.sEqual),c(fOps.sNotEqual,evoLang.sNotEqual),c(fOps.sStart,evoLang.sStart),c(fOps.sContain,evoLang.sContain),c(fOps.sFinish,evoLang.sFinish))}f.push(c(fOps.sIsNull,evoLang.sIsNull),c(fOps.sIsNotNull,evoLang.sIsNotNull)),f.push("")}this._editor.append(f.join(""))}a&&e!=d.lov&&(this._editor.find("#operator").val(a),this._operator=a),this._step=2},_setEditorValue:function(a,b){var c=this._editor,d=Evol.Dico.fieldTypes,e=this._type,f=c.find("#operator").val(),g=!1,h=!0;if(""!==f){if(e==d.lov||f!=fOps.sIsNull&&f!=fOps.sIsNotNull){if(this._step<3){var i=[];switch(g=f==fOps.sBetween,e){case d.lov:i.push(''),this._field.list.length>7&&i.push('(All ) '),i.push(Evol.UI.input.checkboxLOV(this._field.list)),i.push(" ");break;case d.bool:i.push('',Evol.UI.input.radio("value","1",evoLang.yes,"0"!=a,"value1"),Evol.UI.input.radio("value","0",evoLang.no,"0"==a,"value0")," ");break;case d.date:case d.datetime:case d.time:case d.integer:case d.decimal:case d.money:var j=e==d.date?"text":e;i.push(' '),g&&i.push('',evoLang.opAnd," ",' '),h=!1;break;default:i.push(' '),h=!1}c.append(i.join("")),e==d.date&&c.find("#value,#value2").datepicker({dateFormat:this.options.dateFormat})}if(a){var k=c.find("#value");switch(e){case d.lov:k.find("#"+a.split(",").join(",#")).attr("checked","checked");break;case d.bool:k.find("#value"+a).attr("checked","checked");break;default:k.val(a),h=""!==a,g&&(k.next().next().val(b),h=""!==a&&""!==b)}}else h=e==d.lov||e==d.bool}else c.append(Evol.UI.input.hidden("value",""));this._bAdd.button(h?"enable":"disable").show(),this._step=3}},_getEditorData:function(){function a(a){var b=n.split("/");return b.length>2?b[2]+"-"+b[0]+"-"+b[1]:a}var b=this._editor,c=b.find("#field"),d=b.find("#value"),e={field:{label:c.find("option:selected").text(),value:c.val()},operator:{},value:{}},f=e.operator,g=e.value;if(this._type==Evol.Dico.fieldTypes.lov){var h=[],i=[];d.find("input:checked").not("#checkAll").each(function(){h.push(this.value),i.push(this.nextSibling.innerHTML)}),0===h.length?(f.label=evoLang.sIsNull,f.value=fOps.sIsNull,g.label=g.value=""):1==h.length?(f.label=evoLang.sEqual,f.value=fOps.sEqual,g.label='"'+i[0]+'"',g.value=h[0]):(f.label=evoLang.sInList,f.value=fOps.sInList,g.label="("+i.join(", ")+")",g.value=h.join(","))}else if(this._type==Evol.Dico.fieldTypes.bool){f.label=evoLang.sEqual,f.value=fOps.sEqual;var j=d.find("#value1").prop("checked")?1:0;g.label=1==j?evoLang.yes:evoLang.no,g.value=j}else{var k=b.find("#operator"),l=k.val();if(f.label=k.find("option:selected").text(),f.value=l,l==fOps.sIsNull||l==fOps.sIsNotNull)g.label=g.value="";else{var m=Evol.Dico.fieldTypes,n=d.val();switch(this._type){case m.text:g.label=n,g.value=n.toLocaleLowerCase();break;case m.integer:case m.decimal:case m.time:g.label=n,g.value=n;break;case m.date:case m.datetime:g.value=a(n),g.label=n;break;default:g.label=n,g.value=n}l==fOps.sBetween&&(n=d.next().next().val(),g.label2=n,this._type===m.date||this._type===m.datetime?(g.value2=a(n),g.label2=n):g.value2=n)}}return e},_hiddenValue:function(a,b,c){var d=Evol.UI.hidden;a.push(d("fld-"+c,b.field.value),d("op-"+c,b.operator.value),d("val-"+c,b.value.value));var e=b.value.value2;e&&a.push(d("val2-"+c,e))},_setHiddenValues:function(){for(var a=this.val(),b=a.length,c=[Evol.UI.hidden("elem",b)],d=0;b>d;d++)this._hiddenValue(c,a[d],d+1);this._hValues.html(c.join(""))},_triggerChange:function(){this.options.submitReady&&this._setHiddenValues(),this.$el.trigger("filter.change")},val:function(a){if(_.isUndefined(a)){var b=[];return this._filters.find("a").each(function(){b.push($(this).data("filter"))}),b}this._filters.empty();for(var c=0,d=a.length;d>c;c++)this.addFilter(a[c]);return this._triggerChange(),this},valText:function(){var a=[];return this._filters.find("a").each(function(){a.push(this.text)}),a.join(" "+evoLang.opAnd+" ")},clear:function(){return this._cFilter=null,this._removeEditor(),this._filters.empty(),this._triggerChange(),this},length:function(){return this._filters.children().length},click_new:function(){this._step<1&&(this._setEditorField(),this._step=1),this._bAdd.find(".ui-button-text").html(evoLang.bAddFilter)},click_add:function(){var a=this._getEditorData();this._cFilter?this._enableFilter(a,this.options.highlight):this.addFilter(a),this._removeEditor()},click_remove:function(a){a.stopImmediatePropagation(),a.stopPropagation(),$(a.currentTarget).closest("a").remove(),this._triggerChange()},click_submit:function(){this.$el.trigger("submit.filter")}}),Evol.ViewToolbar=Backbone.View.extend({events:{"click .nav a":"click_toolbar","list.navigate >div":"click_navigate","action >div":"action_view","status >div":"status_update","filter.change >div":"change_filter","click .alert-dismissable>button":"clearMessage","message >div":"showMessage"},options:{toolbar:!0,defaultView:"list",style:"panel-info",display:"label",titleSelector:"#title",buttons:{view:!0,edit:!0,mini:!0,wiz:!1,json:!0,list:!0,cards:!0,charts:!0,"new":!0,save:!0,del:!0,filter:!0,"export":!0,group:!1,customize:!1},pageSize:20},modesHash:{view:"View",edit:"Edit",mini:"Mini",wiz:"Wizard",json:"JSON",cards:"Cards",list:"List",charts:"Charts"},views:[],viewsHash:{},curView:null,_group:!1,initialize:function(a){_.extend(this.options,a),this.render(),this.$(".dropdown-toggle").dropdown()},render:function(){this.$el.html(this._toolbarHTML()),this.setView(this.options.defaultView||"list"),this._viewsIcon=this.$(".glyphicon-eye-open")},_toolbarHTML:function(){function a(a,b){return['','',Evol.UI.icon(b),' ',' ";return d.push('"),d.join("")},updateModel:function(){this.refresh()},refresh:function(){return this.viewsHash.list&&this.viewsHash.list.render(),this.viewsHash.cards&&this.viewsHash.cards.render(),this},setView:function(a){var b,c=this.options,d=this.$el,e="evolw-"+a,f=this.$('[data-vid="'+e+'"]'),g=this.curView,h=this._curCollec();if("new"===a)a=this._prevOne?this._prevOne:"edit",this.setView(a),this.model=new c.modelClass,this.model.collection=h,this.newItem(),this.curView.options.mode="new";else if(f.length)this.model=this.curView.model,this.model.collection=h,this.curView=this.viewsHash[a],this.curView.setCollection&&this.curView.setCollection(h),this.model&&!this.model.isNew()?(this.curView.setModel?(!this.curView.collection&&m.collection&&(this.curView.collection=this.model.collection),this.curView.setModel(this.model)):this.curView.model=this.model,this.curView.setTitle&&this.curView.setTitle(),"n"===this.curView.cardinality&&this.curView.setPage&&this.curView.setPage(this.options.pageIndex)):this.curView.clear&&this.curView.clear(),this.$('[data-id="views"] > li').removeClass("evo-sel").filter('[data-id="'+a+'"]').addClass("evo-sel"),f.show().siblings().not(".evo-toolbar,.evo-filters,.clearfix").hide();else{switch(f=$('
'),d.children().not(".evo-toolbar,.evo-filters,.clearfix").hide(),d.append(f),b={el:f,mode:a,model:this.model,collection:h,uiModel:c.uiModel,style:c.style,pageSize:c.pageSize||20,pageIndex:c.pageIndex||0,titleSelector:c.titleSelector},this.$('[data-id="new"]').show(),this.$('[data-id="views"] > li').removeClass("evo-sel").filter('[data-id="'+a+'"]').addClass("evo-sel"),a){case"view":case"edit":case"mini":case"json":case"wiz":g=new Evol.ViewOne[this.modesHash[a]](b).render(),this._prevOne=a;break;case"charts":case"cards":case"list":g=new Evol.ViewMany[this.modesHash[a]](b).render(),this._prevMany=a,g.setTitle(),"charts"!=a&&this.options.pageIndex>0&&g.setPage(this.options.pageIndex||0);break;case"export":g=new Evol.ViewAction.Export(b),f.addClass("panel panel-info").slideDown()}this.curView=g,this.viewsHash[a]=g,$(this.options.titleSelector).html(this.curView.getTitle())
+}return"n"===this.curView.cardinality?this.showFilter(!1):("wizard"===this.curView.viewName&&this.curView.stepIndex(0),this.hideFilter()),this.setIcons(a),this},getView:function(){return this.curView},getToolbarButtons:function(){if(!this._toolbarButtons){var a=this.$(".evo-toolbar li");this._toolbarButtons={ones:a.filter('li[data-cardi="1"]'),manys:a.filter('li[data-cardi="n"]'),edit:a.filter('[data-id="main"]>[data-id="edit"]'),del:a.filter('[data-id="del"]'),save:a.filter('[data-id="save"]'),prevNext:this.$('.evo-toolbar [data-id="prev"],.evo-toolbar [data-id="next"]'),customize:this.$('.evo-toolbar a[data-id="customize"]').parent(),views:this.$('.evo-toolbar [data-id="views"]')}}return this._toolbarButtons},setIcons:function(a){function b(a,b){c(d.ones,a),c(d.manys,b)}var c=Evol.UI.setVisible;if(this.$el){var d=this.getToolbarButtons();if(c(d.customize,"json"!=a),d.prevNext.hide(),c(d.views,"export"!==a),d.del.hide(),this._viewsIcon){var e="glyphicon-eye-open",f="glyphicon-eye-close";"mini"===a||"json"===a?this._viewsIcon.removeClass(e).addClass(f):this._viewsIcon.removeClass(f).addClass(e)}this.model&&this.model.isNew()||"export"===a?(b(!1,!1),this.model.isNew()&&$('.evo-dropdown-icons>li[data-cardi="1"]').show()):"cards"===a||"list"===a||"charts"===a?(this._prevMany=a,b(!1,!0),"charts"===a?this.setStatus(""):this.collection.length>this.options.pageSize&&d.prevNext.show()):(this._prevOne=a,b(!0,!1),d.prevNext.show(),c(d.save,"view"!==a),c(d.edit,"view"===a)),c(d.manys.filter('[data-id="group"]'),"cards"===a)}},showFilter:function(a){if(this._filters)this._filters.$el.show();else{if(!a)return this;var b=this,c=$(Evol.UI.HTMLEmptyPanel("filters","evo-filters","info"));this.$(".evo-toolbar").after(c),this._filters=new Evol.ViewAction.Filter({el:c,fields:Evol.Dico.getFields(this.options.uiModel)}).render(),c.on("change.filter",function(){b.curView.setFilter(b._filters.val()).render()})}return this},hideFilter:function(){return this._filters&&this._filters.$el.hide(),this},toggleFilter:function(){return this._filtersOn=!this._filtersOn,this._filtersOn?this.showFilter(!0):this.hideFilter()},setStatus:function(a){var b=this.$(".evo-toolbar .evo-tb-status");b.html(a)},setData:function(a){return this.curView&&this.curView.setData(a),this},getData:function(){return this.curView?this.curView.getData():null},browse:function(a){var b=this._curCollec(),c=this.curView.model;if(c&&b&&b.length){var d=b.length-1,e=_.indexOf(b.models,c);e="prev"===a?e>0?e-1:d:d>e?e+1:0,c=b.models[e]}else c=null;return this.model=c,this.curView.setModel(c),this.clearMessage(),this},saveItem:function(a){function b(b){a?c.newItem():(c.model=b,c._filteredCollection&&c._filteredCollection.add(b),c.setIcons("edit"),d.setModel(b)),d.setTitle()}var c=this,d=this.curView,e=d.validate();if(""===e){var f=this.options.uiModel.entity;if(this.model.isNew()){var g=this.collection;g?(g.create(this.getData(),{success:function(a){b(a),c.setMessage("Record saved.",Evol.i18n.getLabel("status.added",f,_.escape(d.getTitle())),"success")},error:function(){alert("error")}}),this.options.mode="edit"):alert("Can't save record b/c no collection is specified.")}else this.model.set(this.getData()),this.model.save("","",{success:function(a){b(a),c.setMessage("Record saved.",Evol.i18n.getLabel("status.updated",Evol.UI.capitalize(f),_.escape(d.getTitle())),"success")},error:function(){alert("error")}})}else this.setMessage(Evol.i18n.validation.incomplete,e,"warning");return this},newItem:function(){var a=this.curView;return"view"==a.viewName&&this.setView("view"!==this._prevOne?this._prevOne:"edit"),this.curView.clear().setTitle(Evol.i18n.getLabel("NewEntity",this.options.uiModel.entity,a.getTitle()))},deleteItem:function(){var a=Evol.i18n,b=this.options.uiModel.entity,c=this.curView.getTitle();if("1"===this.curView.cardinality){var d=this.curView.model;if(d&&confirm(a.getLabel("DeleteEntity",b,c))){var e=this,f=this.collection,g=_.indexOf(f.models,d),h=g,i=null;f.length>1&&(h=0===g?1:g0&&confirm(a.getLabel("DeleteEntities",j.length,this.options.uiModel.entities))}},setMessage:function(a,b,c){var d=this.$('[data-id="msg"]');if(d.length){{d.children()}d.attr("class","evo-msg alert alert-"+c+" alert-dismissable"),d.find(">strong").text(a),d.find(">span").html(b),d.show()}else $(Evol.UI.HTMLMsg(a," "+b,c)).insertAfter(this.$el.children()[0]);return this},clearMessage:function(){return this.$('[data-id="msg"]').remove(),this},showMessage:function(a,b){return b?this.setMessage(b.title,b.content,b.style):this.clearMessage()},action_view:function(a,b){switch(b){case"cancel":this.setView("edit"!==this.curView.viewName||this.model.isNew?this._prevMany||"list":"view");break;case"edit":this.setView(b);break;case"export":alert("Sorry, no demo server yet...");break;case"save":case"save-add":this.saveItem("save-add"===b)}},paginate:function(a,b){b&&(a=b);var c=this.options.pageIndex||0;if("prev"===a)c=c>0?c-1:0;else if("next"===a)(c+1)*(this.options.pageSize||20)0&&(c=d)}this.options.pageIndex=c,this.curView.setPage&&this.curView.setPage(c)},status_update:function(a,b){this.setStatus(b)},_curCollec:function(){return this._filteredCollection?this._filteredCollection:this.collection?this.collection:this.model?this.model.collection:new this.options.collectionClass},click_toolbar:function(a){var b=$(a.currentTarget);"A"!==b.tagName&&(b=b.closest("a"));var c=b.data("id");switch(a.preventDefault(),a.stopImmediatePropagation(),c){case"save":this.saveItem(!1);break;case"del":this.deleteItem();break;case"customize":this.curView.customize();break;case"filter":this.toggleFilter();break;case"prev":case"next":"1"===this.curView.cardinality?(this.curView.isDirty&&this.curView.isDirty(),this.browse(c)):"n"===this.curView.cardinality&&this.paginate(c);break;case"new-field":Evol.Dico.showDesigner("","field",b);break;default:c&&""!==c&&this.setView(c)}this.$el.trigger("toolbar."+c)},click_navigate:function(a,b){var c=this.collection.get(b.id);a.stopImmediatePropagation(),this.model=c,this.setView("view"),this.curView.setModel(c)},change_filter:function(){var a,b=this._filters.val();if(b.length){var c=Evol.Dico.filterModels(this.model.collection.models,b);a=this.collectionClass?new collectionClass(c):new Backbone.Collection(c),this._filteredCollection=a;var d=a.length,e=this.collection.length;this.setStatus(d+" / "+e+" "+this.options.uiModel.entities)}else a=this.collection,this._filteredCollection=null,this.setStatus(a.length+" "+this.options.uiModel.entities);this.curView.setCollection(a)}});
\ No newline at end of file
diff --git a/js/ui-validation.js b/js/ui-validation.js
index bca8c29..bfac13f 100755
--- a/js/ui-validation.js
+++ b/js/ui-validation.js
@@ -126,9 +126,9 @@ Evol.UI.Validation = {
break;
case ft.dec:
case ft.money:
- var myRegExp = evoRegEx[fd.type + Evol.i18n.LOCALE];
+ var myRegExp = evoRegEx[ft.dec + Evol.i18n.LOCALE];
if (myRegExp === null) {
- myRegExp = evoRegEx[fd.type + "EN"]; // default to English with "."
+ myRegExp = evoRegEx[ft.dec + 'EN']; // default to English with "."
}
if (!myRegExp.test(fv))
that.setValidationFlags($f.parent(), labMsg(i18nVal[fd.type]));
diff --git a/js/ui.js b/js/ui.js
index 79390c3..ee717de 100755
--- a/js/ui.js
+++ b/js/ui.js
@@ -270,15 +270,18 @@ Evol.UI = {
// --- date formats ---
formatDate: function(d){
- var dateParts=d.split('-');
- if(dateParts.length>1){
- return dateParts[1]+'/'+dateParts[2]+'/'+dateParts[0];
+ if(!_.isUndefined(d) && d!==null){
+ var dateParts=d.split('-');
+ if(dateParts.length>1){
+ return dateParts[1]+'/'+dateParts[2]+'/'+dateParts[0];
+ }
}
+ return '';
},
formatTime: function(d){
- if(!_.isUndefined(d) && d!==''){
- var timeParts=d.split(':');
- var hour=parseInt(timeParts[0],10);
+ if(!_.isUndefined(d) && d!==null && d!==''){
+ var timeParts=d.split(':'),
+ hour=parseInt(timeParts[0],10);
if(hour>12){
return (hour-12)+':'+timeParts[1]+' PM';
}else{
@@ -288,7 +291,7 @@ Evol.UI = {
return '';
},
formatDateTime: function(d){
- if(!_.isUndefined(d) && d!==''){
+ if(!_.isUndefined(d) && d!==null && d!==''){
var dateParts=d.split('T');
if(dateParts.length>1){
return this.formatDate(dateParts[0])+', '+this.formatTime(dateParts[1]);
diff --git a/less/header.less b/less/header.less
index 27f4e11..d766b29 100644
--- a/less/header.less
+++ b/less/header.less
@@ -3,6 +3,8 @@
// https://github.com/evoluteur/evolutility
// Copyright (c) 2014, Olivier Giulieri
+// todo: WILL BE REMOVED LATER FOR BOOTSTRAP
+
/* --- header, navbar, content and footer --- */
@import "less/variables";
@@ -49,7 +51,7 @@
border-bottom: #366092 solid 1px;
width:100%;
padding:2px 5px 2px 10px;
- z-index: 3000;
+ z-index: 300;
//-webkit-box-shadow: 0 0 12px rgba(0, 0, 0, 0.5);
//-moz-box-shadow: 0 0 12px rgba(0, 0, 0, 0.5);
//box-shadow: 0 0 12px rgba(0, 0, 0, 0.5);