/** * Created by Benny on 29.03.2016. */ var app = app || {}; app.ctrl = app.ctrl|| {}; app.ctrl.Invoice = { index : function( params ) { app.core.Rest.get( 'invoice', function( res ) { var page = app.core.View.createPage({ title : 'Invoice', content : AHDF.Tmpl.get( 'tpl_invoice-list', { invoices : res } ) }); app.core.View.showPage( page ); app.core.View.$main.find( '[data-invoice-id]' ).click( function() { app.core.Controller.redirect( 'invoice', 'detail', [ $(this).attr( 'data-invoice-id' ) ] ); return false; }); } ); } , detail : function( params ) { app.core.Rest.get( 'invoice?id=' + params[0], function( res ) { var page = app.core.View.createPage({ title : 'Invoice Detail: ' + params[ 0 ], content : AHDF.Tmpl.get( 'tpl_invoice-detail', { data : { invoice : res } } ) }); app.core.View.showPage( page ); app.core.View.$main.find( '[data-id="btn-print-invoice"]' ).click( function() { window.print(); }); } ); } };