text: (function(b){b(document).ready(function(a){b(".da-circular-stat").daCircularStat();b("#_cantidad").spinner({prefix:"¢ ",min:0,max:9999999,places:0,step:1});b("#form-add-gasto select").change(function(){addInputChosen(this)});b("#_datepicker").datetimepicker({showOtherMonths:true,showWeek:true,dateFormat:"yy-mm-dd",showButtonPanel:true,showOn:"button",buttonImage:_app.urls.images.color.calendar,buttonImageOnly:true,buttonText:"Seleccionar día",showAnim:"drop"});b("#_datepicker").datetimepicker("setDate",new Date())})})(jQuery);var flagValidate=0;function validateForm(b){var e=b;var a=$("#form-add-gasto select");$.each(a,function(){var i=$(this).attr("id");var h=$("#"+i+" :selected");var g=$("#add"+i);var d=$("#label"+i);if(h.val()==-1){if(g.val()==""){d.css("display","");g.addClass("error");$(this).addClass("error");g.fadeIn("slow");e=false}else{d.css("display","none");g.removeClass("error");$(this).removeClass("error")}}else{d.css("display","none");g.removeClass("error");$(this).removeClass("error")}});var f=$("#_cantidad");var c=$("#label_cantidad");if(f.val()=="¢ 0"||f.val()=="0"||f.val()==""){c.css("display","");f.addClass("error");e=false}else{c.css("display","none");f.removeClass("error")}if(flagValidate==0){$("#form-add-gasto input, select").bind("change",function(){validateForm(false)});flagValidate=1}if(e){$("#form-add-gasto").submit()}}function addInputChosen(a){var d=$(a).attr("id");var c=$("#"+d+" :selected");var b="#add"+d;if($(c).val()==-1){$(b).fadeIn("slow");if(d=="_categoria"){$("#_gasto").html('<option value="-1" >Seleccionar una opci&oacute;n</option>');$("#_gasto").trigger("liszt:updated")}}else{if($(b).css("display")!="none"){$(b).effect("explode",{},1000);$("#label"+d).css("display","none")}if(d=="_categoria"){loadGastosByCategoria($(c).val())}}}function loadGastosByCategoria(a){$.get(_cdominguez.urls.getOptGDetallesByCat,{pidCategoria:a},function(b){$("#_gasto").html(b);$("#_gasto").trigger("liszt:updated")}).error(function(){showMessage("error","No se pudo cargar los gastos")})}function saveData(){$.ajax({url:_cdominguez.urls.add,data:$("#form-add-gasto").serialize(),success:function(a){if(a=="done"){showMessage("success","Los datos se guardaron correctamente")}else{showMessage("info",a)}},beforeSend:function(){},error:function(c,a,b){showMessage("error","An error occurred, please try again."+b)},type:"POST"})};