diff --git a/application/controllers/beheer/EmployeeTargetController.php b/application/controllers/beheer/EmployeeTargetController.php
new file mode 100644
index 0000000..72ae0d9
--- /dev/null
+++ b/application/controllers/beheer/EmployeeTargetController.php
@@ -0,0 +1,34 @@
+orderBy( 'startdate' )
+ ->get();
+
+ $this->json( $employeeTargets );
+ }
+
+
+}
\ No newline at end of file
diff --git a/application/models/eloquent/Employeetarget.php b/application/models/eloquent/Employeetarget.php
new file mode 100644
index 0000000..654c3e3
--- /dev/null
+++ b/application/models/eloquent/Employeetarget.php
@@ -0,0 +1,18 @@
+belongsTo( 'User' );
+ }
+
+}
\ No newline at end of file
diff --git a/application/models/eloquent/User.php b/application/models/eloquent/User.php
index 166c5a0..fda205e 100644
--- a/application/models/eloquent/User.php
+++ b/application/models/eloquent/User.php
@@ -16,6 +16,11 @@ class User extends BaseModel {
return $this->hasMany( 'Projectemployee' );
}
+ public function employeetargets()
+ {
+ return $this->hasMany( 'Employeetarget' );
+ }
+
public function projectemployee()
{
return $this->hasOne( 'Projectemployee' );
diff --git a/application/views/modals/employeetarget_modal.php b/application/views/modals/employeetarget_modal.php
new file mode 100644
index 0000000..b1045f2
--- /dev/null
+++ b/application/views/modals/employeetarget_modal.php
@@ -0,0 +1,76 @@
+
diff --git a/application/views/pages/users_view.php b/application/views/pages/users_view.php
index f673e36..6dc3828 100644
--- a/application/views/pages/users_view.php
+++ b/application/views/pages/users_view.php
@@ -20,6 +20,7 @@
|
+
diff --git a/application/views/partials/_js.php b/application/views/partials/_js.php
index 0304ff4..094e1cb 100644
--- a/application/views/partials/_js.php
+++ b/application/views/partials/_js.php
@@ -44,6 +44,7 @@
+
@@ -64,6 +65,7 @@
+
diff --git a/application/views/partials/_modals.php b/application/views/partials/_modals.php
index c4881f0..57e85b4 100644
--- a/application/views/partials/_modals.php
+++ b/application/views/partials/_modals.php
@@ -6,6 +6,7 @@ $this->load->view('modals/external_modal');
$this->load->view('modals/offer_modal');
$this->load->view('modals/project_modal');
$this->load->view('modals/comment_modal');
+$this->load->view('modals/employeetarget_modal');
$this->load->view('specials/tellme_modal');
$this->load->view('specials/upload_modal');
diff --git a/application/views/reports/employeehours/employeemonthhours_view.php b/application/views/reports/employeehours/employeemonthhours_view.php
index 8fc2340..027803c 100644
--- a/application/views/reports/employeehours/employeemonthhours_view.php
+++ b/application/views/reports/employeehours/employeemonthhours_view.php
@@ -49,22 +49,22 @@
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/public/js/lib/dataservices/employeeTargetDataService.js b/public/js/lib/dataservices/employeeTargetDataService.js
new file mode 100644
index 0000000..84284f1
--- /dev/null
+++ b/public/js/lib/dataservices/employeeTargetDataService.js
@@ -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()
+ }
+
+
+}
+
diff --git a/public/js/lib/modals/employeeTargetModal.js b/public/js/lib/modals/employeeTargetModal.js
new file mode 100644
index 0000000..6efe2cb
--- /dev/null
+++ b/public/js/lib/modals/employeeTargetModal.js
@@ -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' ) );
+
+} );
+
diff --git a/public/js/lib/modules/beheer/usersModule.js b/public/js/lib/modules/beheer/usersModule.js
index 255decd..33894f8 100644
--- a/public/js/lib/modules/beheer/usersModule.js
+++ b/public/js/lib/modules/beheer/usersModule.js
@@ -53,6 +53,10 @@ dbo.usersInit = function () {
} );
},
+ editTarget : function(){
+ dbo.employeeTargetModel.init(this.id);
+ },
+
archiveUser: function () {
var vm = dbo.usersModel;
var self = this;
diff --git a/public/js/lib/modules/reports/employeeHours.js b/public/js/lib/modules/reports/employeeHours.js
index 6b9c3b0..82af749 100644
--- a/public/js/lib/modules/reports/employeeHours.js
+++ b/public/js/lib/modules/reports/employeeHours.js
@@ -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 );
|