/* Minified: inspector.widget.tracking.js, jquery.objectTime.js, widgets.SelectEstimate.js */
App.Inspector.Widgets.Tracking=function(object,client_interface,default_billable_status){var wrapper=$(this);var check_string=object.object_time+"."+object.object_expenses+"."+(object.estimate?object.estimate.value:0);if(wrapper.attr("check_string")==check_string){return true}wrapper.attr("check_string",check_string);wrapper.empty();if(object.permissions.can_manage_tracking){$('<a href="'+object.urls.tracking+'" title="'+App.lang("Time & Expenses")+'"><span class="tracking_label">'+object.object_time+"h</span></a>").appendTo(wrapper)}else{$('<span class="tracking_label">'+object.object_time+"h</span>").appendTo(wrapper)}if(object.object_expenses){wrapper.find("span.tracking_label").append('/<span class="expense_label">'+App.lang(":expense spent",{expense:object.object_expenses})+"</span>")}};
(function($){var public_methods={init:function(options){return this.each(function(){var wrapper=$(this);var wrapper_dom=this;var item=options.object;var default_billable_status=typeof(options.default_billable_status)!="undefined"&&options.default_billable_status?1:0;var label_text=generate_label_string(item);if(options["interface"]=="printer"){wrapper.append('<span class="object_tracking_text">'+label_text+"</span> ");return true}if(options.show_label===undefined||options.show_label){wrapper.append('<span class="object_tracking_text">'+label_text+"</span> ")}if(options["interface"]==App.Wireframe.Utils.INTERFACE_DEFAULT){var anchor=$('<a href="'+item.urls.tracking+'" title="'+label_text+'"><img src="'+get_icon_url(item)+'" alt="" /></a>').appendTo(wrapper);anchor.objectTimeExpensesFlyout(updated_callback_function,default_billable_status)}})}};var updated_callback_function=function(time,expenses,formatted){var wrapper=$(this).parent();wrapper.find("a").attr("title",formatted);if(wrapper.find("span.object_tracking_text").length){wrapper.find("span.object_tracking_text").html(formatted)}if(time||expenses){wrapper.find("img").attr("src",App.Wireframe.Utils.imageUrl("icons/12x12/object-time-active.png","tracking"))}else{wrapper.find("img").attr("src",App.Wireframe.Utils.imageUrl("icons/12x12/object-time-inactive.png","tracking"))}};var generate_label_string=function(item){var time_string=false;if(item.object_time){time_string=App.lang("Time: :totalh",{totalh:item.object_time})}var expenses_string=false;if(item.object_expenses){expenses_string=App.lang("Expenses: :total",{total:item.object_expenses})}if(time_string&&expenses_string){return time_string+". "+expenses_string}else{if(time_string){return time_string}else{if(expenses_string){return expenses_string}}}return App.lang("No Time")};var get_icon_url=function(item){if(item.object_time||item.object_expenses){return App.Wireframe.Utils.imageUrl("icons/12x12/object-time-active.png","tracking")}else{return App.Wireframe.Utils.imageUrl("icons/12x12/object-time-inactive.png","tracking")}};var plugin_name="objectTime";$.fn[plugin_name]=function(method){if(public_methods[method]){return public_methods[method].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof method==="object"||!method){return public_methods.init.apply(this,arguments)}else{$.error("Method "+method+" does not exist in jQuery."+plugin_name)}}}})(jQuery);
App.widgets.SelectEstimate=function(){return{init:function(select_id){if(typeof(select_id)=="object"){var select=select_id}else{var select=$("#"+select_id)}select.change(function(){var selected_option=select.find("option:selected");if(selected_option.attr("value")=="other"){var input=prompt(App.lang("Please insert estimate, in hours. Example: 0.25, 1, 8 etc"),"");if(input){var value=App.Wireframe.Utils.parseEstimate(input);if(value>=0){if(select.find("option[value="+value+"]").length==0){var option=$('<option value="'+value+'" class="other">'+App.Wireframe.Utils.formatEstimate(value)+"</option>");if(select.find("option.other").length>0){select.find("option.other:last").after(option)}else{select.find("option.before_other").after(option);option.after('<option value=""></option>')}}select.val(value)}else{select.val("")}}}})}}}();
