dashboard
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 31/10/2019
|
||||
* Time: 14:44
|
||||
*/
|
||||
|
||||
dbo.dashboardDataservice = {
|
||||
|
||||
getOwhp : function(callback){
|
||||
$.getJSON('index.php/dashboard/dashboardController/getOwhp')
|
||||
.done(function(data){
|
||||
callback(data);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 31/10/2019
|
||||
* Time: 14:31
|
||||
*/
|
||||
|
||||
dbo.dashboardInit = function () {
|
||||
console.log( dbo.dashboardModel );
|
||||
if ( dbo.dashboardModel !== undefined ) {
|
||||
|
||||
dbo.dashboardModel.init();
|
||||
|
||||
} else {
|
||||
dbo.dashboardModel = {
|
||||
|
||||
|
||||
owpThisYear : ko.observable( null ),
|
||||
owpNextYear : ko.observable( null ),
|
||||
owpTotal : ko.observable( null ),
|
||||
revenuesNextyear: ko.observable( null ),
|
||||
totalRevenues : ko.observable( null ),
|
||||
|
||||
init: function () {
|
||||
var self = dbo.dashboardModel;
|
||||
dbo.dashboardDataservice.getOwhp( function ( data ) {
|
||||
self.owpThisYear( dbo.helpers.thousandSeparator( data.currentFinancialYear ) );
|
||||
self.owpNextYear( dbo.helpers.thousandSeparator( data.owpNextyear ) );
|
||||
self.owpTotal( dbo.helpers.thousandSeparator( data.totalOwp ) );
|
||||
self.revenuesNextyear( dbo.helpers.thousandSeparator( data.revenuesNextyear ) );
|
||||
self.totalRevenues( dbo.helpers.thousandSeparator( data.totalRevenues ) );
|
||||
} );
|
||||
}
|
||||
};
|
||||
|
||||
dbo.dashboardModel.init();
|
||||
|
||||
ko.applyBindings( dbo.dashboardModel, document.getElementById( 'DASHBOARD' ) );
|
||||
}
|
||||
};
|
||||
@@ -31,6 +31,8 @@ $( function () {
|
||||
|
||||
ko.applyBindings( dbo.menuModel, document.getElementById( "dbois-app" ) );
|
||||
|
||||
window.dbo['dashboardInit']();
|
||||
|
||||
vm.initialized( true );
|
||||
} );
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user