feat: Betragseingabe mit Komma (data-type=amount in json-form)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -50,6 +50,14 @@
|
||||
out[k] = null;
|
||||
} else if (kind === 'int') {
|
||||
out[k] = parseInt(v, 10);
|
||||
} else if (kind === 'amount') {
|
||||
// Deutsche Betragseingabe: "1.234,56" -> "1234.56". Ohne Komma
|
||||
// bleibt der Wert unveraendert (Punkt-Eingaben funktionieren weiter).
|
||||
var s = String(v).replace(/[\s€]/g, '');
|
||||
if (s.indexOf(',') !== -1) {
|
||||
s = s.replace(/\./g, '').replace(',', '.');
|
||||
}
|
||||
out[k] = s;
|
||||
} else {
|
||||
out[k] = v;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
hx-swap="none" hx-on::after-request="if(event.detail.successful){window.location.reload()}">
|
||||
<input type="date" name="anchor_date"
|
||||
value="{{ account.anchor_date.isoformat() if account.anchor_date is not none else '' }}" required>
|
||||
<input type="text" name="anchor_balance" placeholder="500.00"
|
||||
<input type="text" name="anchor_balance" data-type="amount" placeholder="500,00"
|
||||
value="{{ account.anchor_balance|eur if account.anchor_balance is not none else '' }}" required>
|
||||
<button type="submit">Anker setzen</button>
|
||||
</form>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<form hx-ext="json-form" hx-post="/api/recurring" hx-swap="none"
|
||||
hx-on::after-request="if(event.detail.successful){window.location.reload()}">
|
||||
<label>Name <input type="text" name="name" required></label>
|
||||
<label>Betrag <input type="text" name="amount" placeholder="-49.99" required></label>
|
||||
<label>Betrag <input type="text" name="amount" data-type="amount" placeholder="-49,99" required></label>
|
||||
<label>Rhythmus
|
||||
<select name="rhythm" data-type="str">
|
||||
{% for rh in rhythms %}<option value="{{ rh }}">{{ rh|de_label }}</option>{% endfor %}
|
||||
@@ -120,7 +120,7 @@
|
||||
<form hx-ext="json-form" hx-post="/api/planned" hx-swap="none"
|
||||
hx-on::after-request="if(event.detail.successful){window.location.reload()}">
|
||||
<label>Name <input type="text" name="name" required></label>
|
||||
<label>Betrag <input type="text" name="amount" placeholder="-2000.00" required></label>
|
||||
<label>Betrag <input type="text" name="amount" data-type="amount" placeholder="-2000,00" required></label>
|
||||
<label>Fällig am <input type="date" name="due" required></label>
|
||||
<label>Kategorie
|
||||
<select name="category_id" data-type="int">
|
||||
@@ -175,8 +175,8 @@
|
||||
<form hx-ext="json-form" hx-post="/api/loans" hx-swap="none"
|
||||
hx-on::after-request="if(event.detail.successful){window.location.reload()}">
|
||||
<label>Name <input type="text" name="name" required></label>
|
||||
<label>Darlehenssumme <input type="text" name="principal" placeholder="10000.00" required></label>
|
||||
<label>Zins p.a. (%) <input type="text" name="annual_rate_pct" placeholder="4.5" required></label>
|
||||
<label>Darlehenssumme <input type="text" name="principal" data-type="amount" placeholder="10000,00" required></label>
|
||||
<label>Zins p.a. (%) <input type="text" name="annual_rate_pct" data-type="amount" placeholder="4,5" required></label>
|
||||
<label>Laufzeit (Monate) <input type="number" name="term_months" data-type="int" min="1" required></label>
|
||||
<label>Auszahlungsdatum <input type="date" name="payout_date" required></label>
|
||||
<label>Tilgungsart
|
||||
@@ -269,7 +269,7 @@
|
||||
{% for k in modifier_kinds %}<option value="{{ k }}">{{ k|de_label }}</option>{% endfor %}
|
||||
</select>
|
||||
</label>
|
||||
<label>Wert <input type="text" name="value" value="0"></label>
|
||||
<label>Wert <input type="text" name="value" data-type="amount" value="0"></label>
|
||||
<button type="submit">Modifikator hinzufügen</button>
|
||||
</form>
|
||||
</details>
|
||||
|
||||
Reference in New Issue
Block a user