Compare commits
No commits in common. "a0bc4559ed4c3396874fb28c7747fb8c7aadbf84" and "cf2b7f75e1fda7bb41cc2d5dda25762fbe5cef20" have entirely different histories.
a0bc4559ed
...
cf2b7f75e1
189
kaform.js
189
kaform.js
|
@ -37,12 +37,16 @@ function checkAllRows(){
|
|||
|
||||
f=3;
|
||||
v =row.cells[f].firstElementChild.value;
|
||||
if ( !isFloat(v) ){ // Amount
|
||||
if ( !v ){ // Datum
|
||||
row.cells[f].firstElementChild.focus();
|
||||
showAlert("Bitte gib einen gültigen Betrag ein!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -54,7 +58,7 @@ 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;
|
||||
var pdfs = row.cells[4].innerHTML;
|
||||
if (pdfs==0)
|
||||
return false;
|
||||
}
|
||||
|
@ -76,6 +80,20 @@ function isFloat(val) {
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* grey-out currency iselection if there is at least one document is atatched.
|
||||
*/
|
||||
function disableCurrency()
|
||||
{
|
||||
if (countRows()>0){
|
||||
document.getElementById("a_currency").disabled=true;
|
||||
}
|
||||
else {
|
||||
document.getElementById("a_currency").disabled=false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function deleteTableRow(rowId){
|
||||
|
||||
var target = document.getElementById("upload-target"+rowId);
|
||||
|
@ -102,6 +120,8 @@ function deleteTableRow(rowId){
|
|||
|
||||
element.parentNode.removeChild(element);
|
||||
renumberTableRows();
|
||||
// alert(rowId);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -113,10 +133,22 @@ function countRows(){
|
|||
|
||||
|
||||
function showAlert(text) {
|
||||
|
||||
$K.app.message.show( { message: `${text}`, position: 'centered', type: 'is-error' });
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function reset2()
|
||||
{
|
||||
// document.getElementById("a_type").value="";
|
||||
document.getElementById("a_description").value="";
|
||||
document.getElementById("a_amount").value="";
|
||||
setUploadField();
|
||||
|
||||
}
|
||||
|
||||
|
||||
function setTableRow(id)
|
||||
{
|
||||
|
@ -188,6 +220,7 @@ function getRow(rid,num) {
|
|||
onclick="deleteTableRow(${rid})"
|
||||
class="close is-large">
|
||||
</span></td>`;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -205,8 +238,144 @@ function addRow() {
|
|||
nextRid++;
|
||||
}
|
||||
|
||||
function xaddTableRow(){
|
||||
|
||||
var $node = $K.dom('#tabbody');
|
||||
// create a new table row with id
|
||||
var element = document.createElement('tr');
|
||||
element.setAttribute("id", "trow"+currentRowId);
|
||||
|
||||
|
||||
/* var a_type = document.getElementById("a_type").value;
|
||||
if (!a_type.trim().length ) {
|
||||
document.getElementById("a_type").focus();
|
||||
showAlert("Bitte gib eine Auslagenart an!");
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
var a_date = document.getElementById("a_date").value;
|
||||
if (!a_date.trim().length){
|
||||
document.getElementById("a_date").focus();
|
||||
showAlert("Bitte gib ein gültiges Datum an!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var a_description = document.getElementById("a_description").value;
|
||||
if (!a_description.trim().length){
|
||||
document.getElementById("a_description").focus();
|
||||
showAlert("Bitte gib eine Beschreibung ein!");
|
||||
return;
|
||||
}
|
||||
|
||||
var a_amount = document.getElementById("a_amount").value;
|
||||
if (!isFloat(a_amount)){
|
||||
document.getElementById("a_amount").focus();
|
||||
showAlert("Bitte gib einen gültigen Betrag ein!");
|
||||
return;
|
||||
}
|
||||
a_amount = parseFloat(a_amount).toFixed(2);
|
||||
|
||||
|
||||
var a_currency = document.getElementById("a_currency").value;
|
||||
/* if (!a_currency.trim().length){
|
||||
document.getElementById("a_currency").focus();
|
||||
showAlert("Bitte gib eine Währung an!");
|
||||
return;
|
||||
}
|
||||
*/
|
||||
var target = document.getElementById("upload-target"+currentRowId);
|
||||
var children = target.children;
|
||||
|
||||
if (!children.length){
|
||||
// showAlert("Bitte lade mindestens einen Beleg hoch!");
|
||||
// return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* a_type = "Hello";*/
|
||||
|
||||
var e="<td></td>";
|
||||
|
||||
// add column for position no
|
||||
// e += `<td>${a_type}
|
||||
// <input type="hidden" name="type[${currentRowId}]" value="${a_type}" /></td>`;
|
||||
|
||||
// add coluemn for a_type (Auslagenart)
|
||||
// e += `<td><textarea name="desc[${nextRowId}]" rows="2"></textarea> </td>`;
|
||||
e += `<td>${a_date}
|
||||
<input type="hidden" name="date[${currentRowId}]" value="${a_date}" /></td>`;
|
||||
|
||||
|
||||
// add column for date
|
||||
// e += `<td><input name="date[${nextRowId}]" type="date"/></td>`;
|
||||
e += `<td>${a_description}
|
||||
<input type="hidden" name="description[${currentRowId}]" value="${a_description}" /></td>`;
|
||||
|
||||
|
||||
// add column for num
|
||||
e += `<td>${a_amount} EUR
|
||||
<input type="hidden" name="amount[${currentRowId}]" value="${a_amount}" /></td>`;
|
||||
|
||||
|
||||
|
||||
// add column for file upload
|
||||
/* e+= `
|
||||
<td data-kube="">
|
||||
<div class="form-item">
|
||||
<div class="upload"
|
||||
data-kube="upload"
|
||||
data-type="file" data-multiple="true"
|
||||
data-target="#upload-target${nextRowId}"
|
||||
data-url="upload.php?row=${nextRowId}" data-url-remove="delete.php"
|
||||
data-progress="true">
|
||||
</div>
|
||||
<div id="upload-target${nextRowId}" class="upload-target"></div>
|
||||
</div>
|
||||
</td>
|
||||
*/
|
||||
var ulfiles = children.length;
|
||||
e += `<td>${ulfiles}</td>`;
|
||||
|
||||
// `;
|
||||
// add delete bnutton
|
||||
e +=
|
||||
`<td><span
|
||||
onclick="deleteTableRow(${currentRowId})"
|
||||
class="close is-large">
|
||||
</span></td>`;
|
||||
|
||||
|
||||
$node.append(element);
|
||||
element.innerHTML=(e);
|
||||
renumberTableRows();
|
||||
currentRowId++;
|
||||
reset2();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function setUploadField()
|
||||
{
|
||||
var e = $K.dom('#uploadfield');
|
||||
var uf =`<div class="upload"
|
||||
data-kube="upload"
|
||||
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(e) hochladen
|
||||
</div>
|
||||
<div id="upload-target${currentRowId}" class="upload-target small"></div>
|
||||
</div>
|
||||
`;
|
||||
document.getElementById("uploadfield").innerHTML=uf;
|
||||
}
|
||||
|
||||
$K.add('module', 'kaform', {
|
||||
init: function(app, context)
|
||||
|
@ -225,6 +394,8 @@ $K.add('module', 'kaform', {
|
|||
|
||||
console.log(banktype);
|
||||
|
||||
|
||||
|
||||
// console.log(sender);
|
||||
// this.message.show({ message: 'My message' });
|
||||
}
|
||||
|
@ -252,6 +423,8 @@ $K.ajax.get({
|
|||
error: function(response) {}
|
||||
});
|
||||
|
||||
setUploadField();
|
||||
|
||||
|
||||
function check_field(fieldid,message){
|
||||
var f = document.getElementById(fieldid).value;
|
||||
|
@ -327,12 +500,6 @@ function downloadDocument(mail)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!document.getElementById("agree").checked){
|
||||
document.getElementById("agree").focus();
|
||||
showAlert("Bitte bestätige, dass du alle Angaben nach bestem Wissen und Gewissen gemacht hast!");
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
if (mail){
|
||||
if (!isMailable()){
|
||||
|
@ -352,6 +519,12 @@ function downloadDocument(mail)
|
|||
document.getElementById('banktype').value=banktype;
|
||||
document.getElementById("theform").submit();
|
||||
|
||||
if (!document.getElementById("agree").checked){
|
||||
document.getElementById("agree").focus();
|
||||
showAlert("Bitte bestätige, dass du alle Angaben nach bestem Wissen und Gewissen gemacht hast!");
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
41
submit.php
41
submit.php
|
@ -13,31 +13,31 @@ require "PHPMailer/Exception.php";
|
|||
require_once('TCPDF/tcpdf.php');
|
||||
|
||||
class kaformPDF extends TCPDF {
|
||||
//Page header
|
||||
//Page header
|
||||
public function Header() {
|
||||
}
|
||||
|
||||
// Logo
|
||||
// $image_file = K_PATH_IMAGES.'logo_example.jpg';
|
||||
// $this->Image($image_file, 10, 10, 15, '', 'JPG', '', 'T', false, 300, '', false, false, 0, false, false, false);
|
||||
// // Set font
|
||||
// $this->SetFont('helvetica', 'B', 20);
|
||||
// // Title
|
||||
// $this->Cell(0, 15, '<< TCPDF Example 003 >>', 0, false, 'C', 0, '', 0, false, 'M', 'M');
|
||||
// }
|
||||
|
||||
// Page footer
|
||||
// // Logo
|
||||
// $image_file = K_PATH_IMAGES.'logo_example.jpg';
|
||||
// $this->Image($image_file, 10, 10, 15, '', 'JPG', '', 'T', false, 300, '', false, false, 0, false, false, false);
|
||||
// // Set font
|
||||
// $this->SetFont('helvetica', 'B', 20);
|
||||
// // Title
|
||||
// $this->Cell(0, 15, '<< TCPDF Example 003 >>', 0, false, 'C', 0, '', 0, false, 'M', 'M');
|
||||
// }
|
||||
//
|
||||
// // Page footer
|
||||
public function Footer() {
|
||||
}
|
||||
// Position at 15 mm from bottom
|
||||
// $this->SetY(-15);
|
||||
// Set font
|
||||
// $this->SetFont('helvetica', 'I', 8);
|
||||
// Page number
|
||||
// $this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Position at 15 mm from bottom
|
||||
// $this->SetY(-15);
|
||||
// // Set font
|
||||
// $this->SetFont('helvetica', 'I', 8);
|
||||
// // Page number
|
||||
// $this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
|
||||
// }
|
||||
// }
|
||||
//
|
||||
};
|
||||
|
||||
|
||||
|
@ -296,6 +296,7 @@ function calcSum(){
|
|||
}
|
||||
$sum -= get_adv();
|
||||
return str_replace(".",",",sprintf("%0.2f",$sum));
|
||||
// return sprintf("%.2f",$sum);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue