var currentRowId=1;
var banktype = "bank-eu";
function renumberTableRows(){
var row_no=1;
var table = document.getElementById("tabbody");
for (var i = 0, row; row = table.rows[i]; i++) {
row.cells[0].innerHTML=row_no++;
}
return i;
}
function checkAllRows(){
var row_no=1;
var table = document.getElementById("tabbody");
for (var i = 0, row; row = table.rows[i]; i++) {
// row.cells[0].innerHTML=row_no++;
//
var f=1
var v =row.cells[f].firstElementChild.value;
if ( !v ){ // Datum
row.cells[f].firstElementChild.focus();
showAlert("Bitte gib ein gültiges Datum an!");
return false;
}
f=2;
v =row.cells[f].firstElementChild.value;
if ( !v ){ // Datum
row.cells[f].firstElementChild.focus();
showAlert("Bitte gib ein Beschreibung ein!");
return false;
}
f=3;
v =row.cells[f].firstElementChild.value;
if ( !isFloat(v) ){ // Amount
row.cells[f].firstElementChild.focus();
showAlert("Bitte gib einen gültigen Betrag ein!");
return false;
}
}
return true;
}
function isMailable(){
var row_no=1;
var table = document.getElementById("tabbody");
for (var i = 0, row; row = table.rows[i]; i++) {
pdfs = row.cells[5].querySelector('input[name="file-count"]').value;
if (pdfs==0)
return false;
}
return true;
}
function isFloat(val) {
var floatRegex = /^-?\d+(?:[.,]\d*?)?$/;
if (!floatRegex.test(val))
return false;
val = parseFloat(val);
if (isNaN(val))
return false;
return true;
}
function deleteTableRow(rowId){
var target = document.getElementById("upload-target"+rowId);
// this.message = app.message;
// var children = target.children;
// delete all uploaded elements
/* for (var i = 0; i < children.length; i++) {
var tmp = children[i].getAttribute("data-id");
alert ("DEL");
alert (tmp);
$K.ajax.post({
url: 'delete.php',
data: 'id='+tmp,
before: function(xhr) {},
success: function(response) {},
error: function(response) {}
});
}
*/
// delete the row from table
var element = document.getElementById("trow"+rowId);
element.parentNode.removeChild(element);
renumberTableRows();
}
function countRows(){
return renumberTableRows();
}
function showAlert(text) {
$K.app.message.show( { message: `${text}`, position: 'centered', type: 'is-error' });
}
function setTableRow(id)
{
var $node = $K.dom('#tabbody');
var element = document.createElement('tr');
element.setAttribute("id", "trow"+id);
var e
e = `
${a_date}
`;
$node.append(element);
element.innerHTML=(e);
}
function getUploadField(rid)
{
var e = $K.dom('#uploadfield');
var uf =`