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

View file

@ -11,6 +11,17 @@ function renumberTableRows(){
return i; 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) { function isFloat(val) {
var floatRegex = /^-?\d+(?:[.,]\d*?)?$/; var floatRegex = /^-?\d+(?:[.,]\d*?)?$/;
@ -200,9 +211,7 @@ function addTableRow(){
</td> </td>
*/ */
var ulfiles = children.length; var ulfiles = children.length;
e += `<td>${ulfiles} e += `<td>${ulfiles}</td>`;
<input type="hidden" name="currency[${currentRowId}]" value="${a_currency}" /></td>
</td>`;
// `; // `;
// add delete bnutton // add delete bnutton
@ -231,7 +240,7 @@ function setUploadField()
data-type="file" data-multiple="true" data-type="file" data-multiple="true"
data-target="#upload-target${currentRowId}" data-target="#upload-target${currentRowId}"
data-url="upload.php?row=${currentRowId}" data-url-remove="delete.php" data-url="upload.php?row=${currentRowId}" data-url-remove="delete.php"
data-progress="true">Beleg hochladen data-progress="true">Beleg(e) hochladen
</div> </div>
<div id="upload-target${currentRowId}" class="upload-target small"></div> <div id="upload-target${currentRowId}" class="upload-target small"></div>
</div> </div>
@ -364,6 +373,12 @@ function downloadDocument(mail)
}; };
if (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"; document.getElementById('sendmail').value="yes";
} }