Diverse aanpassingen nav gesprek met Peter

This commit is contained in:
2018-02-14 11:03:42 +01:00
parent 0441ba7b81
commit 957bca2e9d
12 changed files with 117 additions and 20 deletions
+34 -4
View File
@@ -32,7 +32,11 @@ $( function () {
archive : ko.observable( false ),
startdate : ko.observable( null ),
enddate : ko.observable( null ),
projectname : ko.observable(),
busy : false,
ownRevenue : ko.observable(),
otherRevenue : ko.observable(),
projectname : ko.observable(),
init: function () {
var vm = dbo.editProjectModal;
@@ -251,6 +255,17 @@ $( function () {
vm.init();
},
saveProjectname: function () {
var vm = dbo.editProjectModal;
if ( timeout ) {
clearTimeout( timeout );
timeout = null;
}
timeout = setTimeout( function () {
vm.saveProject();
}, 700 );
},
saveProject: function () {
var vm = dbo.editProjectModal;
@@ -260,6 +275,7 @@ $( function () {
id : vm.projectID,
customer_id : vm.customerID(),
projectleader_id: vm.projectleaderID(),
projectname : vm.projectname(),
startdate : vm.startdate(),
enddate : vm.enddate()
}
@@ -269,9 +285,19 @@ $( function () {
} );
},
saveProjectemployee: function () {
changeProjectemployee: function () {
var vm = dbo.editProjectModal;
var self = this;
dbo.userDataService.getUser( this.employeeID(), function ( data ) {
self.tarif( data.hourlyrate );
vm.saveProjectemployee( self );
} );
},
saveProjectemployee: function ( self = false ) {
var vm = dbo.editProjectModal;
if ( !self ) self = this;
$.each( vm.users(), function ( i, p ) {
if ( self.employeeID == p.id ) self.fullname( p.fullname );
@@ -517,6 +543,7 @@ $( function () {
vm.startdate( dbo.helpers.mysql2date( data.startdate ) );
vm.enddate( dbo.helpers.mysql2date( data.enddate ) );
vm.projectnumber( data.projectnumber );
vm.projectname( data.projectname );
vm.projectEmployees.removeAll();
vm.projecthours.removeAll();
@@ -537,8 +564,11 @@ $( function () {
} );
vm.offers.removeAll();
$.each( data.offers, function ( i, p ) {
if ( i == 0 ) {
vm.ownRevenue( p.own_revenue );
vm.otherRevenue( p.other_revenue );
}
vm.offers.push( new dbo.offersService.Offer( p ) );
} );
@@ -560,8 +590,8 @@ $( function () {
self.id = data.id;
self.employeeID = ko.observable( data.user_id );
self.fullname = ko.observable( data.user ? data.user.fullname : '#NB' );
self.tarif = ko.observable( data.tarif ? data.tarif.toString().replace( '.', ',' ) : 0 );
self.budget = ko.observable( data.budget ? data.budget.toString().replace( '.', ',' ) : 0 );
self.tarif = ko.observable( data.tarif ? data.tarif : 0 );
self.budget = ko.observable( data.budget ? data.budget : 0 );
self.inEdit = ko.observable( sessionStorage.editEmployee == data.id );
},
+13 -4
View File
@@ -16,7 +16,9 @@ $( function () {
username : ko.observable(),
email : ko.observable(),
role : ko.observable(),
callback : null,
hourlyRate: ko.observable(),
callback: null,
init: function () {
var vm = dbo.editUserModal;
@@ -53,7 +55,8 @@ $( function () {
lastname : vm.lastname(),
username : vm.username(),
email : vm.email(),
role : vm.role()
role : vm.role(),
hourlyrate: vm.hourlyRate()
}
dbo.userDataService.saveUser( submitDATA, function ( data ) {
@@ -62,10 +65,10 @@ $( function () {
title : 'gebruiker aangemaakt',
message : 'gebuiker is succesvol opgeslagen',
modalClass: 'modal-success'
}, function(){
}, function () {
vm.hideUserModal();
if( typeof(vm.callback) == 'function') vm.callback();
if ( typeof(vm.callback) == 'function' ) vm.callback();
} );
return;
@@ -97,6 +100,7 @@ $( function () {
vm.username( user.username || '' );
vm.email( user.email || '' );
vm.role( user.role || null );
vm.hourlyRate( user.hourlyrate || 0 );
},
showUserModal: function () {
@@ -105,6 +109,11 @@ $( function () {
hideUserModal: function () {
$( "#user-modal" ).modal( 'hide' );
},
validateNumber: function ( field ) {
var vm = dbo.editUserModal;
vm[field]( dbo.helpers.validateNumber( vm[field](), true ) );
}
};