projecten
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 17/01/2018
|
||||
* Time: 09:55
|
||||
*/
|
||||
|
||||
dbo.commentsService = {
|
||||
|
||||
|
||||
tableName: 'OFFER',
|
||||
|
||||
|
||||
addComment: function () {
|
||||
var vm = dbo.offersModel;
|
||||
dbo.commentsDataService.addComment( vm.selectedRowID(), vm.tableName, function ( commentID ) {
|
||||
dbo.commentModel.showComment( commentID, function () {
|
||||
vm.refreshComments();
|
||||
} )
|
||||
} );
|
||||
},
|
||||
|
||||
editComment: function () {
|
||||
var vm = dbo.offersModel;
|
||||
dbo.commentModel.showComment( this.id, function () {
|
||||
vm.refreshComments();
|
||||
} );
|
||||
},
|
||||
refreshComments: function () {
|
||||
var vm = dbo.offersModel;
|
||||
|
||||
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 ) );
|
||||
} );
|
||||
} );
|
||||
},
|
||||
|
||||
Comment: function ( data ) {
|
||||
this.id = data.id;
|
||||
this.comment_date = data.comment_date;
|
||||
this.fullname = data.user.fullname;
|
||||
this.comment = ko.observable( data.comment );
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user