diff --git a/kaform.js b/kaform.js
index 05687a6..dfe60b2 100644
--- a/kaform.js
+++ b/kaform.js
@@ -11,6 +11,17 @@ function renumberTableRows(){
return i;
}
+function isMailable(){
+ var row_no=1;
+ var table = document.getElementById("tabbody");
+ for (var i = 0, row; row = table.rows[i]; i++) {
+ var pdfs = row.cells[4].innerHTML;
+ if (pdfs==0)
+ return false;
+ }
+ return true;
+}
+
function isFloat(val) {
var floatRegex = /^-?\d+(?:[.,]\d*?)?$/;
@@ -200,9 +211,7 @@ function addTableRow(){
*/
var ulfiles = children.length;
- e += `
${ulfiles}
- |
- `;
+ e += `${ulfiles} | `;
// `;
// add delete bnutton
@@ -231,7 +240,7 @@ function setUploadField()
data-type="file" data-multiple="true"
data-target="#upload-target${currentRowId}"
data-url="upload.php?row=${currentRowId}" data-url-remove="delete.php"
- data-progress="true">Beleg hochladen
+ data-progress="true">Beleg(e) hochladen
@@ -364,6 +373,12 @@ function downloadDocument(mail)
};
if (mail){
+ if (!isMailable()){
+ showAlert("Um den Antrag elektronisch direkt an WMDE zu schicken, muss jeder Position ein Beleg beigefügt sein.");
+ return;
+
+ }
+
document.getElementById('sendmail').value="yes";
}