+
+
+
+ | door |
+ datum |
+ bestandsnaam |
+ |
+
+
+
+
+ |
+
+ |
+
+
+ |
+
+
+ |
+
+
+
+ |
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
- |
-
-
-
- |
-
-
-
-
-
-
-
-
-
- |
-
- |
-
-
-
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+
\ No newline at end of file
diff --git a/application/views/partials/_modals.php b/application/views/partials/_modals.php
index 4c64e81..c4881f0 100644
--- a/application/views/partials/_modals.php
+++ b/application/views/partials/_modals.php
@@ -8,6 +8,7 @@ $this->load->view('modals/project_modal');
$this->load->view('modals/comment_modal');
$this->load->view('specials/tellme_modal');
+$this->load->view('specials/upload_modal');
diff --git a/application/views/specials/upload_modal.php b/application/views/specials/upload_modal.php
new file mode 100644
index 0000000..339604a
--- /dev/null
+++ b/application/views/specials/upload_modal.php
@@ -0,0 +1,20 @@
+
\ No newline at end of file
diff --git a/public/css/main.css b/public/css/main.css
index 480700d..cbba3df 100644
--- a/public/css/main.css
+++ b/public/css/main.css
@@ -317,3 +317,27 @@ th.focus-green{
color:#666;
}
+
+.upload-btn-wrapper {
+ position: relative;
+ overflow: hidden;
+ display: inline-block;
+}
+
+.upload-btn {
+ border: 2px solid gray;
+ color: gray;
+ background-color: white;
+ padding: 8px 20px;
+ border-radius: 8px;
+ font-size: 20px;
+ font-weight: bold;
+}
+
+.upload-btn-wrapper input[type=file] {
+ font-size: 100px;
+ position: absolute;
+ left: 0;
+ top: 0;
+ opacity: 0;
+}
diff --git a/public/js/lib/dataservices/documentsDataservice.js b/public/js/lib/dataservices/documentsDataservice.js
index 7bbc294..0f9972f 100644
--- a/public/js/lib/dataservices/documentsDataservice.js
+++ b/public/js/lib/dataservices/documentsDataservice.js
@@ -8,8 +8,8 @@
dbo.documentsDataService = {
- getdocuments: function ( foreignID, tablename, callback ) {
- $.getJSON( 'index.php/projects/documentsController/getDocuments/' + foreignID + '/' + tablename )
+ getdocuments: function ( foreignID, callback ) {
+ $.getJSON( 'index.php/projects/documentsController/getDocuments/' + foreignID )
.done( function ( data ) {
callback( data );
} );
diff --git a/public/js/lib/main.js b/public/js/lib/main.js
index 2a19a9b..d7aadfd 100644
--- a/public/js/lib/main.js
+++ b/public/js/lib/main.js
@@ -33,8 +33,8 @@ $( function () {
$('body').delay(500).fadeIn(1500);
} );
-function uploadFile( file, foreignID, tablename, callback ) {
- var url = 'index.php/utils/fileUpload/upload/' + foreignID + '/' + tablename;
+function uploadFile( file, foreignID, callback ) {
+ var url = 'index.php/utils/fileUpload/upload/' + foreignID;
var xhr = new XMLHttpRequest();
var fd = new FormData();
xhr.open( "POST", url, true );
diff --git a/public/js/lib/modals/projectModal.js b/public/js/lib/modals/projectModal.js
index c006d4b..c8a78a3 100644
--- a/public/js/lib/modals/projectModal.js
+++ b/public/js/lib/modals/projectModal.js
@@ -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 () {
diff --git a/public/js/lib/services/documentService.js b/public/js/lib/services/documentService.js
index 802a815..0f681b8 100644
--- a/public/js/lib/services/documentService.js
+++ b/public/js/lib/services/documentService.js
@@ -10,7 +10,6 @@ dbo.documentService = {
tableName: 'OFFER',
-
removeFile: function (that) {
var vm = dbo.offersService.vm;