This commit is contained in:
2018-04-06 10:48:39 +02:00
parent 6f6cda4125
commit 49bd541cb8
10 changed files with 169 additions and 49 deletions
+70
View File
@@ -44,6 +44,8 @@ $( function () {
outstanding : ko.observable(),
toForecast : ko.observable(),
totalForecast : ko.observable(),
documents : ko.observableArray( [] ),
comments : ko.observableArray( [] ),
init: function () {
var vm = dbo.editProjectModal;
@@ -747,6 +749,8 @@ $( function () {
vm.reservations.push( new vm.Reservation( p ) );
} );
vm.refreshDocuments();
vm.busy = false;
dbo.charts.drawHoursVsBudget( 340, 230, 'hours-vs-budget' );
@@ -879,7 +883,73 @@ $( function () {
this.reservationamount = ko.observable( data.reservationamount );
this.payed = ko.observable( data.payed );
this.inEdit = ko.observable( data.inEdit || false );
},
addDocument: function ( data, evt ) {
var vm = dbo.editProjectModal;
uploadFile( evt.target.files[0], vm.projectID, function () {
vm.refreshDocuments();
} );
},
addComment: function () {
var vm = dbo.editProjectModal;
dbo.commentsDataService.addComment( vm.selectedRowID(), vm.tableName, function ( commentID ) {
dbo.commentModel.showComment( commentID, function () {
vm.refreshComments();
} )
} );
},
editComment: function () {
var vm = dbo.editProjectModal;
dbo.commentModel.showComment( this.id, function () {
vm.refreshComments();
} );
},
downloadDocument: function () {
window.open( 'index.php/projects/documentscontroller/downloaddocument/' + this.id );
},
refreshComments: function () {
var vm = dbo.editProjectModal;
dbo.commentsDataService.getComments( vm.selectedRowID(), vm.tableName, function ( data ) {
vm.comments.removeAll();
console.log( data );
$.each( data, function ( i, p ) {
vm.comments.push( new vm.Comment( p ) );
} );
} );
},
refreshDocuments: function () {
var vm = dbo.editProjectModal;
dbo.documentsDataService.getdocuments( vm.projectID, function ( data ) {
vm.documents.removeAll();
$.each( data, function ( i, p ) {
vm.documents.push( new vm.Document( p ) );
} )
} );
},
Comment: function ( data ) {
this.id = data.id;
this.comment_date = data.comment_date;
this.fullname = data.user.fullname;
this.comment = ko.observable( data.comment );
},
Document: function ( data ) {
this.id = data.id;
this.originalname = data.originalname;
this.uploaddate = data.uploaddate;
this.fullname = data.user.fullname;
}
};
dbo.editProjectModal.totalHours = ko.pureComputed( function () {