redesign for mulituser

change validation concept (client and server)
using entities
This commit is contained in:
Markus
2026-10-06 08:55:35 +02:00
parent 14e050e4ba
commit 995e2ec111
41 changed files with 2402 additions and 1223 deletions

View File

@@ -14,10 +14,10 @@
<div class="col-md-8 col-12">
<div class="card">
<div class="card-header pb-0">
<?php if ($id) : ?>
<h4 class="card-title"><?= ($transfer?'Transfer bearbeiten':($isScheduled?'Terminbuchung bearbeiten':'Rechnung bearbeiten'))?></h4>
<?php if ($booking['id']) : ?>
<h4 class="card-title"><?= ($booking['transfer']?'Transfer '.$booking['id'].' bearbeiten':($booking['scheduled']?'Terminbuchung '.$booking['id'].' bearbeiten':'Rechnung '.$booking['id'].' bearbeiten'))?></h4>
<?php else: ?>
<h4 class="card-title"><?= ($transfer?'Neuer Transfer':($isScheduled?'Neue Terminbuchung':'Neue Rechnung'))?></h4>
<h4 class="card-title"><?= ($booking['transfer']?'Neuer Transfer':($booking['scheduled']?'Neue Terminbuchung':'Neue Rechnung'))?></h4>
<?php endif; ?>
<?php if (! empty($validation)) : ?>
@@ -34,27 +34,25 @@
</div>
<div class="card-content">
<div class="card-body">
<?= form_open_multipart('newBill','class="form form-vertical" onsubmit="logData(event)" id="newbill"') ?>
<?= view("bill_bookingline",['booking'=>$booking, 'template'=>true]); ?>
<form id="newbill" action="/edit" class="form form-vertical needs-validation" method="post" enctype="multipart/form-data" onsubmit="checkForm(event,this)" novalidate>
<!-- <form class="form form-vertical" id="newbill" method="post" enctype="multipart/form-data" onsubmit="logData(event)" action="<?= base_url() ?>newBill"> -->
<input type="hidden" value="<?= $id ?>" name="id">
<input type="hidden" value="<?= $transfer?'1':'0' ?>" name="transfer">
<input type="hidden" value="<?= $booking['id'] ?>" name="id">
<input type="hidden" value="<?= $booking['amount']??0.0 ?>" name="amount">
<input type="hidden" value="<?= $booking['transfer']?'1':'0' ?>" name="transfer">
<input type="hidden" value="<?= ($booking['scheduled']??false)?'1':'0' ?>" name="scheduled">
<div class="form-body">
<div class="row">
<div class="col-12 <?= ($transfer?' d-none':'') ?>">
<div class="form-check form-switch">
<label class="form-check-label" for="multi">Multi Rechnung</label>
<input class="form-check-input" type="checkbox" id="multi" value="on" name="multi" <?= set_checkbox('multi', 'on', $multi??false) ?>>
</div>
</div>
<div class="col-12 <?= ($transfer?' d-none':($isScheduled?' d-none':'')) ?>">
<div class="col-12 <?= ($booking['transfer']?' d-none':(($booking['scheduled']??false)?' d-none':'')) ?>">
<label for="billfile">Rechnung:</label>
<input type="file" id="billfile" name="billfile" class="form-control <?= (!isset($billfile))?'':'d-none' ?>" capture="environment" accept="image/*, application/pdf">
<?php if (isset($billfile)): ?>
<a href="/viewBill/<?= $billfile ?>" id="billfileRef"><?= $billfile ?></a>
<input type="file" id="billfile" name="billfile" class="form-control <?= (!isset($booking['rechnung']))?'':'d-none' ?>" capture="environment" accept="image/*, application/pdf">
<?php if (isset($booking['rechnung'])): ?>
<a href="/viewInvoice/<?= $booking['rechnung'] ?>" id="billfileRef" target="_blank"> <?= $booking['rechnung'] ?></a>
<a class="" onclick="removeBillFile(this);"><i class="fa fa-trash"></i></a>
<?php endif; ?>
</div>
<div class="col-12 <?= ($transfer?' d-none':'d-none') ?>">
<div class="col-12 <?= ($booking['transfer']?' d-none':'d-none') ?>">
<div class='form-check'>
<div class="checkbox">
<label for="renummer">Re-Nr.</label>
@@ -64,76 +62,64 @@
</div>
<div class="col-12">
<label for="datum">Datum</label>
<input type="date" class="form-control" id="datum" name="datum" value="<?= $datum ?>" onclick="openBox(this);"/>
<input type="date" class="form-control" id="datum" name="datum" value="<?= $booking['datum'] ?>" onclick="openBox(this);"/>
</div>
</div>
<div class="col-12 <?= ($transfer?' d-none':'') ?>">
<div class="col-12 <?= ($booking['transfer']?' d-none':'') ?>">
<div class="form-group">
<label for="receiver">Empfänger</label>
<input type="text" class="form-control" id="receiver" name="receiver" value="<?= $receiver ?>">
<input type="text" class="form-control" id="receiver" name="receiver" <?=(($booking['transfer'])?'':'required')?> value="<?= $booking['receiver'] ?>">
</div>
</div>
<div class="col-12">
<div class="form-group">
<label for="source">Konto:</label>
<?= form_dropdown('source', $sourcelist, $source,'id="source" class="form-select"'); ?>
<label for="sourceID">Konto:</label>
<select name="source_id" class="form-select" required id="sourceID" >
<option value="">----</option>
<?php foreach ($booking['sourcelist'] as $key => $value): ?>
<option value="<?= $key ?>" <?= ($key == $booking['source_id'])?'selected':'' ?>><?= $value ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="col-12 multi">
<div class="input-group">
<input type="text" class="form-control dt-amount" id="total_in" name="total_in" placeholder="Einnahme" maxlength=120 value="<?= $total_in ?>">
<input type="text" class="form-control dt-amount text-danger" id="total_out" name="total_out" placeholder="Ausgabe" maxlength=120 value="<?= $total_out ?>">
</div>
</div>
<div class="col-12 scheduled <?=($isScheduled?'':'d-none')?>">
<div class="form-group">
<label for="scheduledNum">Scheduled:</label>
<div class="input-group">
<input type="hidden" value="<?= $isScheduled?'1':'0' ?>" name="scheduled">
<?= form_dropdown("scheduledNum", $scheduled['NumList'], $scheduledNum,$scheduled['style']); ?>
<?= form_dropdown("scheduledType",$scheduled['TypeList'], $scheduledType,$scheduled['style']); ?>
</div>
<div class="input-group has-validation">
<input type="text" id="total_in" name="total_in" value="<?= $booking['total_in'] ?>"
class="form-control dt-amount input"
pattern="[0-9\*\(\)\-\+\/,.]*"
oninput="if (!this.checkValidity()) this.value = this.value.slice(0, -1)"
placeholder="Einnahme" maxlength=120 ">
<input type="text" id="total_out" name="total_out" value="<?= $booking['total_out'] ?>"
class="form-control dt-amount output text-danger"
pattern="[0-9\*\(\)\-\+\/,.]*"
oninput="if (!this.checkValidity()) this.value = this.value.slice(0, -1)"
placeholder="Ausgabe" maxlength=120>
</div>
</div>
<?php if ($booking['scheduled']??false)
echo view("bill_scheduled",['booking'=>$booking]);
?>
<div class="col-12 d-none multi">
<div class="form-group">
<label for="openamount">Offener Betrag:</label>
<input type="text" class="form-control dt-amount" readonly="readonly" id="openamount" name="openamount">
<div class="invalid-feedback"></div>
</div>
</div>
<div class="col-12" id="linecont">
<?php for ($i=0;$i<10;$i++): ?>
<div class="row <?= (($i<3 || $input[$i]>0 || $output[$i]>0)?'':' d-none')?>">
<input type="hidden" value="<?= $sid[$i] ?>" name="sid[<?=$i?>]">
<div class="col-lg-3 col-6 col-md-6 <?=(($i>0)?'multi':'')?> order-sm-2 px-0">
<?= form_dropdown("category_parent[$i]", $subsparent[$i], $category_parent[$i], 'class="form-select parent"'); ?>
</div>
<div class="col-lg-3 col-6 col-md-6 <?=(($i>0)?'multi':'')?> order-sm-2 px-0 sub">
<?= form_dropdown("category[$i]", $subscategory[$i], $category[$i], 'class="form-select"'); ?>
</div>
<div class="w-100 d-md-none"></div>
<div class="col-lg-2 col-6 <?=(($i>0)?'multi':'')?> <?= ($transfer?' d-none':'') ?> px-0 order-sm-2">
<input type="text" name="input[<?=$i?>]" class="form-control dt-subamount" placeholder="Einnahme" value="<?= $input[$i] ?>">
</div>
<div class="<?= ($transfer?'col-lg-4 col-12':'col-lg-2 col-6') ?> <?=(($i>0)?'multi':'')?> px-0 order-sm-2">
<input type="text" name="output[<?=$i?>]" class="form-control dt-subamount text-danger" placeholder="Ausgabe" value="<?= $output[$i] ?>">
</div>
<div class="col-lg-2 col-12 col-md-12 <?=(($i>0)?'multi':'')?> order-sm-1 px-0 mb-3 mb-md-0">
<input type="text" name="comment[<?=$i?>]" class="form-control" placeholder="Kommentar" value="<?= $comment[$i] ?>">
</div>
</div>
<?php endfor; ?>
<?php $i = 0; foreach ($booking['sid'] as $_sid) :
echo view("bill_bookingline",['booking'=>$booking, 'i'=>$i,'template'=>false]);
?>
<?php $i++; endforeach; ?>
</div>
<div class="col-12 d-flex" role="group">
<a class="btn btn-info multi" onclick="addLine();" role="button">+ Zeile</a>
<input type="checkbox" id="validate" name="validate" value="1" class='btn-check' autocomplete="off" <?= set_checkbox('validate', '1', (($validate??"f")=="t")?true:false) ?>>
<a id="multiadd" class="btn btn-info <?= ($booking['transfer']?' d-none':'') ?>" onclick="addLine();" role="button">+ Zeile</a>
<input type="checkbox" id="validate" name="validate" value="1" class='btn-check' autocomplete="off" <?= set_checkbox('validate', '1', ($booking['validate'])?true:false) ?>>
<label class="btn btn-outline-danger" for="validate">Entwurf</label>
<?php if ($id) : ?>
<a class="btn btn-danger" data-bs-toggle="modal" data-bs-id="<?= $id ?>" data-bs-target="#mymodal"><i class="fa fa-trash"></i></a>
<?php if ($booking['id']) : ?>
<a class="btn btn-danger" data-bs-toggle="modal" data-bs-table="<?= ($booking['scheduled']??false)?'scheduled':'bill'?>" data-bs-id="<?= $booking['id'] ?>" data-bs-target="#mymodalDelete"><i class="fa fa-trash"></i></a>
<?php endif; ?>
<button type="submit" class="btn btn-primary">Submit</button>
<a class="btn btn-secondary" onclick="history.back();" role="button"><i class="fa-solid fa-rotate-left"></i></a>
</div>
</div>
</div>
@@ -149,7 +135,7 @@
function openBox(e) {
e.showPicker();
}
subsdata = <?= $subsdata; ?>;
subsdata = <?= json_encode($booking['category']['subs']) ?>;
</script>
<script src="/js/billing.js"></script>
<?= $this->endSection(); ?>