text: function render_loading_invoice(e,t){var n=_.template(jQuery("#loading_invoice_template").html());jQuery(e).html(n(t))}function render_empty_invoice(e,t){var n=_.template(jQuery("#empty_invoice_template").html());jQuery(e).html(n(t))}function render_invoice_table(e,t){var n=_.template(jQuery("#invoice_table_template").html());jQuery(e).html(n(t))}function render_invoice_row(e,t){var n=_.template(jQuery("#invoice_row_template").html());jQuery(e).append(n({invoice:t}))}function render_payment_history(e,t){if(0==t.length)console.debug("Rendering empty invoices"),render_empty_invoice(e,{});else{var n="#invoice_table > tbody";console.debug("Rendering table"),render_invoice_table(e,{}),_.each(t,function(e){render_invoice_row(n,e)})}}function render_fail_invoice(e,t){var n=_.template(jQuery("#fail_invoice_template").html());jQuery(e).html(n({message:"Can not read payment history from Payment service"}))}jQuery(document).ready(function(){if(jQuery("#payment_history").length){console.debug("Going to render payment history..."),_.templateSettings={interpolate:/\{\{\=(.+?)\}\}/g,evaluate:/\{\{(.+?)\}\}/g};var e="#payment_history";render_loading_invoice(e);var t=jQuery.getJSON("/settings/payments.json");t.done(function(t,n,r){console.debug("Got invoices: "+n),render_payment_history(e,t)}),t.fail(function(t,n,r){console.debug("Failed invoices: "+n),render_fail_invoice(e,t)})}});