Sends only mails, when positions all have files attached

This commit is contained in:
7u83 2020-04-16 20:51:41 +00:00
parent 9a7f678a13
commit aa60f276ed
1 changed files with 19 additions and 4 deletions

View File

@ -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(){
</td>
*/
var ulfiles = children.length;
e += `<td>${ulfiles}
<input type="hidden" name="currency[${currentRowId}]" value="${a_currency}" /></td>
</td>`;
e += `<td>${ulfiles}</td>`;
// `;
// 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
</div>
<div id="upload-target${currentRowId}" class="upload-target small"></div>
</div>
@ -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&uuml;gt sein.");
return;
}
document.getElementById('sendmail').value="yes";
}