This commit is contained in:
2018-04-24 08:31:00 +02:00
parent e49fa05a9a
commit 6bc0b37f06
4 changed files with 55 additions and 34 deletions
@@ -5,7 +5,7 @@
* Date: 21/04/2018
* Time: 20:08
*/
include_once('../application/models/eloquent/Employeetarget.php');
//include_once('../application/models/eloquent/Employeetarget.php');
@@ -24,7 +24,7 @@ class EmployeeTargetController extends MY_Controller {
public function getEmployeeTargets( $employeeID )
{
$employeeTargets = Employeetarget::whereUserId( $employeeID )
->orderBy( 'startdate' )
->orderBy( 'id' )
->get();
$this->json( $employeeTargets );
-5
View File
@@ -56,18 +56,13 @@
</div>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
<?php $this->load->view( 'partials/_js' ); ?>
<!-- jQuery CDN -->
<!-- Bootstrap Js CDN -->
<script type="text/javascript">
$(document).ready(function () {
$('#sidebarCollapse').on('click', function () {
@@ -14,29 +14,56 @@
<table class="table table-condensed">
<thead>
<tr>
<th>start</th>
<th>eind</th>
<th colspan="2">start</th>
<th colspan="2">eind</th>
<th colspan="2">&nbsp;</th>
</tr>
<tr>
<th>maand</th>
<th>jaar</th>
<th>maand</th>
<th>jaar</th>
<th>target per maand</th>
<th>&nbsp;</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">
<select data-bind="options:years,
optionsText:'year',
optionsValue:'year',
value:startyear,
disable: ! changeable()"
class="form-control">
</select>
</td>
<td>
<input type="text"
placeholder="einddatum"
class="form-control"
readonly
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
value:enddate">
<select data-bind="options:months,
optionsText:'month',
optionsValue:'month_id',
value:startmonth,
disable: ! changeable()"
class="form-control">
</select>
</td>
<td>
<select data-bind="options:years,
optionsText:'year',
optionsValue:'year',
value:endyear,
disable: ! changeable()"
class="form-control">
</select>
</td>
<td>
<select data-bind="options:months,
optionsText:'month',
optionsValue:'month_id',
value:endmonth"
class="form-control">
</select>
</td>
<td>
<input type="text"
@@ -54,7 +81,7 @@
</tbody>
<tfoot>
<tr>
<th colspan="4">
<th colspan="6">
<i class="icon fa-plus-square-o pull-right pointer"
data-bind="click:addEmployeeTarget"></i>
</th>
+11 -12
View File
@@ -54,27 +54,26 @@ $( function () {
dbo.employeeTargetDataService.getEmployeeTargets( vm.employeeID, function ( data ) {
vm.employeeTargets.removeAll();
var targetLength = data.length
var i=0;
_.each( data, function ( p ) {
console.log( 'jhaVCGHJkq' );
vm.employeeTargets.push( new Employeetarget( p ) );
vm.employeeTargets.push( new vm.Employeetarget( p, targetLength, i ) );
i++;
} );
} );
},
Employeetarget: function ( data ) {
Employeetarget: function ( data, targetLength, i ) {
var self = this;
self.id = data.id;
self.startdate = ko.observable( data.startdate );
self.enddate = ko.observable( data.enddate );
self.startyear = ko.observable( data.startyear );
self.startmonth = ko.observable( data.startmonth );
self.endyear = ko.observable( data.endyear );
self.endmonth = ko.observable( data.endmonth );
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 );
self.changeAble = ko.pureComputed( function () {
if(i == (targetLength - 1))
return true;
} );