diversen opmerkingen
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 21/04/2018
|
||||
* Time: 20:02
|
||||
*/
|
||||
|
||||
dbo.employeeTargetDataService = {
|
||||
|
||||
getEmployeeTargets: function ( employeeID, callback ) {
|
||||
$.getJSON( 'index.php/beheer/employeetargetController/getEmployeeTargets/' + employeeID )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} );
|
||||
},
|
||||
|
||||
addEmployeeTarget: function ( employeeID, callback ) {
|
||||
$.post()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 21/04/2018
|
||||
* Time: 19:58
|
||||
*/
|
||||
|
||||
|
||||
$( function () {
|
||||
dbo.employeeTargetModel = {
|
||||
|
||||
employeeTargets: ko.observableArray( [] ),
|
||||
employeeID : null,
|
||||
|
||||
init: function ( employeeID ) {
|
||||
var vm = dbo.employeeTargetModel;
|
||||
|
||||
vm.employeeID = employeeID;
|
||||
|
||||
vm.showModal();
|
||||
|
||||
vm.refreshEmployeeTargets();
|
||||
},
|
||||
|
||||
showModal: function () {
|
||||
$( "#employee-target-modal" ).modal( 'show' );
|
||||
},
|
||||
|
||||
addEmployeeTarget: function () {
|
||||
var vm = dbo.employeeTargetModel;
|
||||
|
||||
var targetLength = vm.employeeTargets().length;
|
||||
|
||||
var lastDate = null
|
||||
if ( targetLength > 0 )
|
||||
var lastDate = vm.employeeTargets[targetLength - 1].enddate();
|
||||
|
||||
var data = {
|
||||
startdate: lastDate,
|
||||
enddate : null,
|
||||
target : 0
|
||||
}
|
||||
|
||||
vm.employeeTargets.push( new vm.Employeetarget( data ) );
|
||||
},
|
||||
|
||||
saveEmployeeTarget: function () {
|
||||
// if
|
||||
},
|
||||
|
||||
refreshEmployeeTargets: function () {
|
||||
var vm = dbo.employeeTargetModel;
|
||||
|
||||
dbo.employeeTargetDataService.getEmployeeTargets( vm.employeeID, function ( data ) {
|
||||
vm.employeeTargets.removeAll();
|
||||
|
||||
_.each( data, function ( p ) {
|
||||
console.log( 'jhaVCGHJkq' );
|
||||
vm.employeeTargets.push( new Employeetarget( p ) );
|
||||
} );
|
||||
} );
|
||||
},
|
||||
|
||||
Employeetarget: function ( data ) {
|
||||
var self = this;
|
||||
self.id = data.id;
|
||||
self.startdate = ko.observable( data.startdate );
|
||||
self.enddate = ko.observable( data.enddate );
|
||||
self.target = ko.observable( data.target );
|
||||
|
||||
self.validTarget = ko.pureComputed( function () {
|
||||
if ( !self.startdate() ) return false;
|
||||
console.log( 1 );
|
||||
if ( self.target() == 0 ) return;
|
||||
console.log( 2 );
|
||||
if ( ! Number.isInteger( self.target() ) ) return false;
|
||||
console.log( 3 );
|
||||
|
||||
return true;
|
||||
} );
|
||||
}
|
||||
};
|
||||
|
||||
ko.applyBindings( dbo.employeeTargetModel, document.getElementById( 'employee-target-modal' ) );
|
||||
|
||||
} );
|
||||
|
||||
@@ -53,6 +53,10 @@ dbo.usersInit = function () {
|
||||
} );
|
||||
},
|
||||
|
||||
editTarget : function(){
|
||||
dbo.employeeTargetModel.init(this.id);
|
||||
},
|
||||
|
||||
archiveUser: function () {
|
||||
var vm = dbo.usersModel;
|
||||
var self = this;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
dbo.employeehoursreportInit = function () {
|
||||
var timeout;
|
||||
|
||||
if ( dbo.employeeHoursreportModel !== undefined ) {
|
||||
dbo.employeeHoursreportModel.initModule();
|
||||
@@ -14,7 +15,7 @@ dbo.employeehoursreportInit = function () {
|
||||
dbo.employeeHoursreportModel = {
|
||||
|
||||
months : ko.observableArray( [
|
||||
{monthID: 0, monthName : 'totaal'},
|
||||
{monthID: 0, monthName: 'totaal'},
|
||||
{monthID: 1, monthName: 'jan'},
|
||||
{monthID: 2, monthName: 'febr'},
|
||||
{monthID: 3, monthName: 'mrt'},
|
||||
@@ -44,6 +45,7 @@ dbo.employeehoursreportInit = function () {
|
||||
revenuesTotaal : ko.observable(),
|
||||
averageDayRateTotaal : ko.observable(),
|
||||
initialize : null,
|
||||
validYear : ko.observable(),
|
||||
|
||||
init: function () {
|
||||
var vm = dbo.employeeHoursreportModel;
|
||||
@@ -70,6 +72,21 @@ dbo.employeehoursreportInit = function () {
|
||||
vm.refreshTab();
|
||||
},
|
||||
|
||||
checkYear: function () {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
if ( timeout ) {
|
||||
clearTimeout( timeout );
|
||||
timeout = null;
|
||||
}
|
||||
timeout = setTimeout( function () {
|
||||
vm.validYear( true );
|
||||
if ( !Number.isInteger( Number( vm.selectedYear() ) ) ) return vm.validYear( false );
|
||||
if ( Number( vm.selectedYear() ) > 2100 ) return vm.validYear( false );
|
||||
if ( Number( vm.selectedYear() ) < 2000 ) return vm.validYear( false );
|
||||
vm.initModule();
|
||||
}, 700 );
|
||||
},
|
||||
|
||||
setActivetab: function ( tab ) {
|
||||
var vm = dbo.employeeHoursreportModel;
|
||||
|
||||
@@ -104,10 +121,10 @@ dbo.employeehoursreportInit = function () {
|
||||
_.each( data, function ( p ) {
|
||||
vm.employees.push( new vm.Employee( p ) );
|
||||
|
||||
vm.profitablehoursTotaal( Math.round(vm.profitablehoursTotaal() + Number( p.profitablehours )) );
|
||||
vm.nonprofitablehoursTotaal( Math.round(vm.nonprofitablehoursTotaal() + Number( p.nonprofitablehours ) ));
|
||||
vm.nonprojecthoursTotaal( Math.round(vm.nonprojecthoursTotaal() + Number( p.nonprojecthours ) ));
|
||||
vm.totalhoursTotaal( Math.round(vm.totalhoursTotaal() + Number( p.totalhours )) );
|
||||
vm.profitablehoursTotaal( Math.round( vm.profitablehoursTotaal() + Number( p.profitablehours ) ) );
|
||||
vm.nonprofitablehoursTotaal( Math.round( vm.nonprofitablehoursTotaal() + Number( p.nonprofitablehours ) ) );
|
||||
vm.nonprojecthoursTotaal( Math.round( vm.nonprojecthoursTotaal() + Number( p.nonprojecthours ) ) );
|
||||
vm.totalhoursTotaal( Math.round( vm.totalhoursTotaal() + Number( p.totalhours ) ) );
|
||||
vm.targetTotaal( Math.round( vm.targetTotaal() + Number( p.targethours / 12 ) ) );
|
||||
vm.revenuesTotaal( Number( vm.revenuesTotaal() ) + Number( p.revenues ) );
|
||||
|
||||
@@ -117,14 +134,14 @@ dbo.employeehoursreportInit = function () {
|
||||
chartData.hours.push( p.totalhours );
|
||||
} );
|
||||
vm.occupancyRateTotalTotaal( Math.round( (vm.totalhoursTotaal() / vm.targetTotaal()) * 100 ) );
|
||||
vm.occupancyRateHoursTotaal( Math.round( (vm.profitablehoursTotaal() / vm.totalhoursTotaal() ) * 100 ) );
|
||||
vm.occupancyRateInvoiceTotaal( Math.round( (vm.profitablehoursTotaal() / vm.targetTotaal()) * 100 ) );
|
||||
vm.occupancyRateHoursTotaal( Math.round( (vm.profitablehoursTotaal() / vm.totalhoursTotaal()) * 100 ) );
|
||||
vm.occupancyRateInvoiceTotaal(Math.round( (vm.profitablehoursTotaal() / vm.targetTotaal()) * 100 ));
|
||||
vm.averageDayRateTotaal( Math.round( Number( vm.revenuesTotaal() ) / Number( vm.profitablehoursTotaal() ) ) * 8 );
|
||||
vm.revenuesTotaal( dbo.helpers.thousandSeparator( vm.revenuesTotaal() ) );
|
||||
|
||||
dbo.charts.drawPie( 'revenues-per-month', chartData.revenues, chartData.labels, 'omzet per medewerker' );
|
||||
dbo.charts.drawPie( 'hours-per-month', chartData.hours, chartData.labels, 'uren per medewerker' );
|
||||
dbo.charts.drawHoursChart( 'average-rate', chartData.averageRate, chartData.labels, 'gemiddeld tarief', '#78be4b' );
|
||||
// dbo.charts.drawPie( 'revenues-per-month', chartData.revenues, chartData.labels, 'omzet per medewerker' );
|
||||
// dbo.charts.drawPie( 'hours-per-month', chartData.hours, chartData.labels, 'uren per medewerker' );
|
||||
// dbo.charts.drawHoursChart( 'average-rate', chartData.averageRate, chartData.labels, 'gemiddeld tarief', '#78be4b' );
|
||||
} );
|
||||
},
|
||||
|
||||
@@ -142,10 +159,10 @@ dbo.employeehoursreportInit = function () {
|
||||
this.profitablehours = data.profitablehours;
|
||||
this.nonprofitablehours = data.nonprofitablehours;
|
||||
this.nonprojecthours = data.nonprojecthours;
|
||||
this.totalhours = Math.round(data.totalhours);
|
||||
this.totalhours = Math.round( data.totalhours );
|
||||
this.target = Math.round( data.targethours / 12 );
|
||||
this.occupancyRateTotal = Math.round( (data.totalhours / (data.targethours / 12)) * 100 );
|
||||
this.occupancyRateHours = Math.round( (data.profitablehours / data.totalhours ) * 100 );
|
||||
this.occupancyRateHours = Math.round( (data.profitablehours / data.totalhours) * 100 );
|
||||
this.occupancyRateInvoice = Math.round( (data.profitablehours / (data.targethours / 12)) * 100 );
|
||||
this.revenues = dbo.helpers.thousandSeparator( data.revenues );
|
||||
this.averageDayRate = Math.round( (data.revenues / data.profitablehours) * 8 );
|
||||
|
||||
Reference in New Issue
Block a user