diversen opmerkingen

This commit is contained in:
2018-04-21 21:12:09 +02:00
parent 9187742658
commit e49fa05a9a
13 changed files with 303 additions and 37 deletions
@@ -0,0 +1,34 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 21/04/2018
* Time: 20:08
*/
include_once('../application/models/eloquent/Employeetarget.php');
class EmployeeTargetController extends MY_Controller {
public function __construct()
{
parent::__construct();
}
public function index()
{
}
public function getEmployeeTargets( $employeeID )
{
$employeeTargets = Employeetarget::whereUserId( $employeeID )
->orderBy( 'startdate' )
->get();
$this->json( $employeeTargets );
}
}
@@ -0,0 +1,18 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 21/04/2018
* Time: 19:55
*/
class Employeetarget extends BaseModel {
protected $table = 'employeetargets';
public function user()
{
return $this->belongsTo( 'User' );
}
}
+5
View File
@@ -16,6 +16,11 @@ class User extends BaseModel {
return $this->hasMany( 'Projectemployee' ); return $this->hasMany( 'Projectemployee' );
} }
public function employeetargets()
{
return $this->hasMany( 'Employeetarget' );
}
public function projectemployee() public function projectemployee()
{ {
return $this->hasOne( 'Projectemployee' ); return $this->hasOne( 'Projectemployee' );
@@ -0,0 +1,76 @@
<div class="modal modal-fade-in-scale-up modal-primary" tabindex="-1" id="employee-target-modal">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">toevoegen / wijzigen medewerker uren
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</h5>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-10 col-md-offset-1">
<table class="table table-condensed">
<thead>
<tr>
<th>start</th>
<th>eind</th>
<th>target per maand</th>
</tr>
</thead>
<tbody>
<!-- ko foreach:employeeTargets -->
<tr>
<td>
<input type="text"
placeholder="startdatum"
class="form-control"
readonly
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
value:startdate">
</td>
<td>
<input type="text"
placeholder="einddatum"
class="form-control"
readonly
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
value:enddate">
</td>
<td>
<input type="text"
class="form-control"
data-bind="textInput:target">
</td>
<td>
<button class="btn btn-success"
data-bind="disable: ! validTarget()">
opslaan
</button>
</td>
</tr>
<!-- /ko -->
</tbody>
<tfoot>
<tr>
<th colspan="4">
<i class="icon fa-plus-square-o pull-right pointer"
data-bind="click:addEmployeeTarget"></i>
</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button"
class="btn btn-warning"
data-dismiss="modal">
sluiten
</button>
</div>
</div>
</div>
</div>
@@ -5,12 +5,10 @@
<label>jaar</label> <label>jaar</label>
</div> </div>
<div class="col-md-2"> <div class="col-md-2">
<select class="form-control form-control-sm" <div class="col-md-2">
data-bind="options:years, <input type="text" class="form-control" data-bind="textInput:selectedYear, event:{keyup:checkYear}" >
optionsText:'year', <div class="invalid-feedback" data-bind="visible: ! validYear()">geen geldig jaar</div>
optionsValue: 'id', </div>
value:selectedYear,
event:{change:refreshTab}"></select>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
+1
View File
@@ -20,6 +20,7 @@
<td><span data-bind=""></span></td> <td><span data-bind=""></span></td>
<td> <td>
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editUser"></i> <i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editUser"></i>
<i class="icon fa-user pointer" title="uren" data-bind="click:$root.editTarget"></i>
<!-- ko if:archive == 'F' --> <!-- ko if:archive == 'F' -->
<i class="icon fa-archive pointer" title="archiveer" <i class="icon fa-archive pointer" title="archiveer"
data-bind="click:$root.archiveUser"></i> data-bind="click:$root.archiveUser"></i>
+2
View File
@@ -44,6 +44,7 @@
<script src="js/lib/modals/offerModal.js?version=<?= $this->version ?>"></script> <script src="js/lib/modals/offerModal.js?version=<?= $this->version ?>"></script>
<script src="js/lib/modals/projectModal.js?version=<?= $this->version ?>"></script> <script src="js/lib/modals/projectModal.js?version=<?= $this->version ?>"></script>
<script src="js/lib/modals/commentModal.js?version=<?= $this->version ?>"></script> <script src="js/lib/modals/commentModal.js?version=<?= $this->version ?>"></script>
<script src="js/lib/modals/employeeTargetModal.js?version=<?= $this->version ?>"></script>
<!-- ***********MODALS************* --> <!-- ***********MODALS************* -->
<script src="js/lib/services/offersService.js?version=<?= $this->version ?>"></script> <script src="js/lib/services/offersService.js?version=<?= $this->version ?>"></script>
@@ -64,6 +65,7 @@
<script src="js/lib/dataservices/reportsDataService.js"></script> <script src="js/lib/dataservices/reportsDataService.js"></script>
<script src="js/lib/dataservices/invoiceDataService.js"></script> <script src="js/lib/dataservices/invoiceDataService.js"></script>
<script src="js/lib/dataservices/reservationsDataService.js"></script> <script src="js/lib/dataservices/reservationsDataService.js"></script>
<script src="js/lib/dataservices/employeeTargetDataService.js"></script>
<script src="js/lib/services/chartService.js"></script> <script src="js/lib/services/chartService.js"></script>
+1
View File
@@ -6,6 +6,7 @@ $this->load->view('modals/external_modal');
$this->load->view('modals/offer_modal'); $this->load->view('modals/offer_modal');
$this->load->view('modals/project_modal'); $this->load->view('modals/project_modal');
$this->load->view('modals/comment_modal'); $this->load->view('modals/comment_modal');
$this->load->view('modals/employeetarget_modal');
$this->load->view('specials/tellme_modal'); $this->load->view('specials/tellme_modal');
$this->load->view('specials/upload_modal'); $this->load->view('specials/upload_modal');
@@ -49,22 +49,22 @@
</table> </table>
</div> </div>
</div> </div>
<div class="row"> <!--<div class="row">-->
<div class="col-md-3"> <!-- <div class="col-md-3">-->
<div class="graph-holder" style="min-height:350px"> <!-- <div class="graph-holder" style="min-height:350px">-->
<canvas id="hours-per-month" width="300"></canvas> <!-- <canvas id="hours-per-month" width="300"></canvas>-->
<div id="hours-per-month-legends"></div> <!-- <div id="hours-per-month-legends"></div>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
<div class="col-md-3"> <!-- <div class="col-md-3">-->
<div class="graph-holder" style="min-height:350px"> <!-- <div class="graph-holder" style="min-height:350px">-->
<canvas id="revenues-per-month" width="300"></canvas> <!-- <canvas id="revenues-per-month" width="300"></canvas>-->
<div id="revenues-per-month-legends"></div> <!-- <div id="revenues-per-month-legends"></div>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
<div class="col-md-6"> <!-- <div class="col-md-6">-->
<div class="graph-holder" style="min-height:350px"> <!-- <div class="graph-holder" style="min-height:350px">-->
<canvas id="average-rate" width="300"></canvas> <!-- <canvas id="average-rate" width="300"></canvas>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
</div> <!--</div>-->
@@ -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 () { archiveUser: function () {
var vm = dbo.usersModel; var vm = dbo.usersModel;
var self = this; var self = this;
+29 -12
View File
@@ -6,6 +6,7 @@
*/ */
dbo.employeehoursreportInit = function () { dbo.employeehoursreportInit = function () {
var timeout;
if ( dbo.employeeHoursreportModel !== undefined ) { if ( dbo.employeeHoursreportModel !== undefined ) {
dbo.employeeHoursreportModel.initModule(); dbo.employeeHoursreportModel.initModule();
@@ -14,7 +15,7 @@ dbo.employeehoursreportInit = function () {
dbo.employeeHoursreportModel = { dbo.employeeHoursreportModel = {
months : ko.observableArray( [ months : ko.observableArray( [
{monthID: 0, monthName : 'totaal'}, {monthID: 0, monthName: 'totaal'},
{monthID: 1, monthName: 'jan'}, {monthID: 1, monthName: 'jan'},
{monthID: 2, monthName: 'febr'}, {monthID: 2, monthName: 'febr'},
{monthID: 3, monthName: 'mrt'}, {monthID: 3, monthName: 'mrt'},
@@ -44,6 +45,7 @@ dbo.employeehoursreportInit = function () {
revenuesTotaal : ko.observable(), revenuesTotaal : ko.observable(),
averageDayRateTotaal : ko.observable(), averageDayRateTotaal : ko.observable(),
initialize : null, initialize : null,
validYear : ko.observable(),
init: function () { init: function () {
var vm = dbo.employeeHoursreportModel; var vm = dbo.employeeHoursreportModel;
@@ -70,6 +72,21 @@ dbo.employeehoursreportInit = function () {
vm.refreshTab(); 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 ) { setActivetab: function ( tab ) {
var vm = dbo.employeeHoursreportModel; var vm = dbo.employeeHoursreportModel;
@@ -104,10 +121,10 @@ dbo.employeehoursreportInit = function () {
_.each( data, function ( p ) { _.each( data, function ( p ) {
vm.employees.push( new vm.Employee( p ) ); vm.employees.push( new vm.Employee( p ) );
vm.profitablehoursTotaal( Math.round(vm.profitablehoursTotaal() + Number( p.profitablehours )) ); vm.profitablehoursTotaal( Math.round( vm.profitablehoursTotaal() + Number( p.profitablehours ) ) );
vm.nonprofitablehoursTotaal( Math.round(vm.nonprofitablehoursTotaal() + Number( p.nonprofitablehours ) )); vm.nonprofitablehoursTotaal( Math.round( vm.nonprofitablehoursTotaal() + Number( p.nonprofitablehours ) ) );
vm.nonprojecthoursTotaal( Math.round(vm.nonprojecthoursTotaal() + Number( p.nonprojecthours ) )); vm.nonprojecthoursTotaal( Math.round( vm.nonprojecthoursTotaal() + Number( p.nonprojecthours ) ) );
vm.totalhoursTotaal( Math.round(vm.totalhoursTotaal() + Number( p.totalhours )) ); vm.totalhoursTotaal( Math.round( vm.totalhoursTotaal() + Number( p.totalhours ) ) );
vm.targetTotaal( Math.round( vm.targetTotaal() + Number( p.targethours / 12 ) ) ); vm.targetTotaal( Math.round( vm.targetTotaal() + Number( p.targethours / 12 ) ) );
vm.revenuesTotaal( Number( vm.revenuesTotaal() ) + Number( p.revenues ) ); vm.revenuesTotaal( Number( vm.revenuesTotaal() ) + Number( p.revenues ) );
@@ -117,14 +134,14 @@ dbo.employeehoursreportInit = function () {
chartData.hours.push( p.totalhours ); chartData.hours.push( p.totalhours );
} ); } );
vm.occupancyRateTotalTotaal( Math.round( (vm.totalhoursTotaal() / vm.targetTotaal()) * 100 ) ); vm.occupancyRateTotalTotaal( Math.round( (vm.totalhoursTotaal() / vm.targetTotaal()) * 100 ) );
vm.occupancyRateHoursTotaal( Math.round( (vm.profitablehoursTotaal() / vm.totalhoursTotaal() ) * 100 ) ); vm.occupancyRateHoursTotaal( Math.round( (vm.profitablehoursTotaal() / vm.totalhoursTotaal()) * 100 ) );
vm.occupancyRateInvoiceTotaal( Math.round( (vm.profitablehoursTotaal() / vm.targetTotaal()) * 100 ) ); vm.occupancyRateInvoiceTotaal(Math.round( (vm.profitablehoursTotaal() / vm.targetTotaal()) * 100 ));
vm.averageDayRateTotaal( Math.round( Number( vm.revenuesTotaal() ) / Number( vm.profitablehoursTotaal() ) ) * 8 ); vm.averageDayRateTotaal( Math.round( Number( vm.revenuesTotaal() ) / Number( vm.profitablehoursTotaal() ) ) * 8 );
vm.revenuesTotaal( dbo.helpers.thousandSeparator( vm.revenuesTotaal() ) ); vm.revenuesTotaal( dbo.helpers.thousandSeparator( vm.revenuesTotaal() ) );
dbo.charts.drawPie( 'revenues-per-month', chartData.revenues, chartData.labels, 'omzet per medewerker' ); // 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.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.drawHoursChart( 'average-rate', chartData.averageRate, chartData.labels, 'gemiddeld tarief', '#78be4b' );
} ); } );
}, },
@@ -142,10 +159,10 @@ dbo.employeehoursreportInit = function () {
this.profitablehours = data.profitablehours; this.profitablehours = data.profitablehours;
this.nonprofitablehours = data.nonprofitablehours; this.nonprofitablehours = data.nonprofitablehours;
this.nonprojecthours = data.nonprojecthours; this.nonprojecthours = data.nonprojecthours;
this.totalhours = Math.round(data.totalhours); this.totalhours = Math.round( data.totalhours );
this.target = Math.round( data.targethours / 12 ); this.target = Math.round( data.targethours / 12 );
this.occupancyRateTotal = Math.round( (data.totalhours / (data.targethours / 12)) * 100 ); 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.occupancyRateInvoice = Math.round( (data.profitablehours / (data.targethours / 12)) * 100 );
this.revenues = dbo.helpers.thousandSeparator( data.revenues ); this.revenues = dbo.helpers.thousandSeparator( data.revenues );
this.averageDayRate = Math.round( (data.revenues / data.profitablehours) * 8 ); this.averageDayRate = Math.round( (data.revenues / data.profitablehours) * 8 );