@@ -103,27 +103,31 @@ | |||
<!-- Upload --> | |||
<div class="container d-none" id="autodoc_tab_upload"> | |||
<h3>upload</h3> | |||
<div class="row"> | |||
<div class="col"> | |||
<div class="d-none autodoc_template_progress"> | |||
<div class="progress"> | |||
<div class="progress-bar progress-bar-striped progress-bar-animated"></div> | |||
</div> | |||
</div> | |||
<h3>upload</h3> | |||
<div class="row"> | |||
<div class="col"> | |||
<div class="lead">Upload Zone</div> | |||
<div class="lead">Upload Zone</div> | |||
<div class="text-center autodoc_upload_zone"> | |||
Drag & Drop files (png, jpeg, pdf) into this zone to attach them to a single new document<br/> | |||
Files can be uploaded at once or separately. A long as the page is not refreshed or the new document | |||
button | |||
is pushed, they will all be attached to the same document | |||
</div> | |||
<div class="text-center autodoc_upload_zone"> | |||
Drag & Drop files (png, jpeg, pdf) into this zone to attach them to a single new document<br /> | |||
Files can be uploaded at once or separately. A long as the page is not refreshed or the new document | |||
button | |||
is pushed, they will all be attached to the same document | |||
</div> | |||
</div> | |||
</div> | |||
<div class="col"> | |||
<div class="lead">Upload Status</div> | |||
<div class="autodoc_upload_template_progress progress d-none"> | |||
<div class="progress-bar progress-bar-striped progress-bar-animated"></div> | |||
</div> | |||
<div class="col"> | |||
<div class="lead">Upload Status</div> | |||
</div> | |||
</div> | |||
</div> |
@@ -189,7 +189,9 @@ function upload_zone_drop(e) { | |||
if ( temp.documentid == null ) { | |||
$.post(conf.openapi + "/documents", {}, function(data) { | |||
temp.upload = []; | |||
temp.documentid = data.id; | |||
upload_status(); | |||
handle_uploads(ev); | |||
}); | |||
} | |||
@@ -200,7 +202,6 @@ function upload_zone_drop(e) { | |||
function handle_uploads(ev) { | |||
$.each(ev.dataTransfer.files, function(id,file) { | |||
var fileid = temp.upload.length; | |||
temp.upload.push({ | |||
@@ -212,8 +213,8 @@ function handle_uploads(ev) { | |||
}); | |||
if ( file.type != 'application/pdf' && file.type != 'image/png' && file.type != 'image/jpeg' ) { | |||
temp.upload['progress']=1; | |||
temp.upload['error']='invalid file type'; | |||
temp.upload[fileid]['progress']=1; | |||
temp.upload[fileid]['error']='invalid file type'; | |||
} | |||
else { | |||
var reader = new FileReader(); | |||
@@ -228,4 +229,12 @@ function handle_uploads(ev) { | |||
} | |||
}); | |||
return true; | |||
} | |||
function upload_status() { | |||
$.each(temp.upload, function(id, file) { | |||
var obj = $(".autodoc_template_progress").children(); | |||
console.log(obj); | |||
}); | |||
// setTimeout(upload_status, 1000); | |||
} |