Fix: iOS Modal scrollIntoView bei Tastatur; CSV Stornierte mit 0€ + Stornonummer (SW by-v975)
This commit is contained in:
parent
2bbf3bc3f6
commit
cabb2fd6f7
6 changed files with 38 additions and 19 deletions
|
|
@ -408,7 +408,7 @@ async def serve_media(path: str, request: _Request):
|
||||||
raise _HE(404, "Nicht gefunden.")
|
raise _HE(404, "Nicht gefunden.")
|
||||||
return _media_response(filepath)
|
return _media_response(filepath)
|
||||||
|
|
||||||
APP_VER = "974" # muss mit APP_VER in app.js übereinstimmen
|
APP_VER = "975" # muss mit APP_VER in app.js übereinstimmen
|
||||||
|
|
||||||
@app.get("/.well-known/assetlinks.json")
|
@app.get("/.well-known/assetlinks.json")
|
||||||
async def assetlinks():
|
async def assetlinks():
|
||||||
|
|
|
||||||
|
|
@ -413,14 +413,17 @@ def get_quarterly(year: int, q: int, admin=Depends(require_admin)):
|
||||||
period = f"Q{q} {year} ({labels[q]} – {ends[q]})"
|
period = f"Q{q} {year} ({labels[q]} – {ends[q]})"
|
||||||
|
|
||||||
with db() as conn:
|
with db() as conn:
|
||||||
|
# Alle Rechnungen außer Entwürfe — Stornierte bleiben mit 0€ für lückenlose Nummerierung
|
||||||
rows = conn.execute(
|
rows = conn.execute(
|
||||||
"SELECT * FROM invoices WHERE status IN ('paid','sent') AND created_at >= ? AND created_at <= ? ORDER BY id",
|
"SELECT * FROM invoices WHERE status != 'draft' AND created_at >= ? AND created_at <= ? ORDER BY id",
|
||||||
(from_date, to_date + "T23:59:59Z")
|
(from_date, to_date + "T23:59:59Z")
|
||||||
).fetchall()
|
).fetchall()
|
||||||
|
|
||||||
total_net = sum(r["amount_net"] for r in rows)
|
# Summen nur für paid/sent (Stornierte zählen nicht zum Umsatz)
|
||||||
total_tax = sum(r["tax_amount"] for r in rows)
|
active = [r for r in rows if r["status"] in ("paid", "sent")]
|
||||||
total_gross = sum(r["amount_gross"] for r in rows)
|
total_net = sum(r["amount_net"] for r in active)
|
||||||
|
total_tax = sum(r["tax_amount"] for r in active)
|
||||||
|
total_gross = sum(r["amount_gross"] for r in active)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"period": period,
|
"period": period,
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
Router, State-Management, Navigation, Initialisierung.
|
Router, State-Management, Navigation, Initialisierung.
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
|
||||||
const APP_VER = '974'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
const APP_VER = '975'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||||
const APP_VERSION = '1.6.0'; // ← semantische Version, wird bei make release gesetzt
|
const APP_VERSION = '1.6.0'; // ← semantische Version, wird bei make release gesetzt
|
||||||
const IS_STAGING = location.hostname === 'staging.banyaro.app';
|
const IS_STAGING = location.hostname === 'staging.banyaro.app';
|
||||||
// Cache-Bust-Parameter nach Update-Reload sofort entfernen
|
// Cache-Bust-Parameter nach Update-Reload sofort entfernen
|
||||||
|
|
|
||||||
|
|
@ -4355,15 +4355,21 @@ window.Page_admin = (() => {
|
||||||
const fmtDate = iso => iso ? new Date(iso).toLocaleDateString('de-DE') : '';
|
const fmtDate = iso => iso ? new Date(iso).toLocaleDateString('de-DE') : '';
|
||||||
const escape = v => `"${String(v || '').replace(/"/g, '""')}"`;
|
const escape = v => `"${String(v || '').replace(/"/g, '""')}"`;
|
||||||
|
|
||||||
const header = 'Nummer;Empfaenger;E-Mail;Rechnungsdatum;Leistungszeitraum;Nettobetrag;Bruttobetrag;Eingegangener Betrag;Status;Versendet am;Zahlungseingang\n';
|
const header = 'Nummer;Stornonummer;Empfaenger;E-Mail;Rechnungsdatum;Leistungszeitraum;Nettobetrag;Bruttobetrag;Eingegangener Betrag;Status;Versendet am;Zahlungseingang\n';
|
||||||
const csvRows = data.invoices.map(inv =>
|
const csvRows = data.invoices.map(inv => {
|
||||||
[inv.invoice_number, inv.recipient_name, inv.recipient_email || '',
|
const cancelled = inv.status === 'cancelled';
|
||||||
|
return [
|
||||||
|
inv.invoice_number,
|
||||||
|
inv.cancellation_number || '',
|
||||||
|
inv.recipient_name, inv.recipient_email || '',
|
||||||
fmtDate(inv.created_at), inv.service_period || '',
|
fmtDate(inv.created_at), inv.service_period || '',
|
||||||
fmtEur(inv.amount_net), fmtEur(inv.amount_gross),
|
cancelled ? '0.00' : fmtEur(inv.amount_net),
|
||||||
inv.paid_amount != null ? fmtEur(inv.paid_amount) : '',
|
cancelled ? '0.00' : fmtEur(inv.amount_gross),
|
||||||
inv.status, fmtDate(inv.sent_at), fmtDate(inv.paid_at)
|
cancelled ? '0.00' : (inv.paid_amount != null ? fmtEur(inv.paid_amount) : ''),
|
||||||
].map(escape).join(';')
|
cancelled ? 'Storniert' : inv.status,
|
||||||
).join('\n');
|
fmtDate(inv.sent_at), fmtDate(inv.paid_at)
|
||||||
|
].map(escape).join(';');
|
||||||
|
}).join('\n');
|
||||||
|
|
||||||
const blob = new Blob(['' + header + csvRows], { type: 'text/csv;charset=utf-8;' });
|
const blob = new Blob(['' + header + csvRows], { type: 'text/csv;charset=utf-8;' });
|
||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ const UI = (() => {
|
||||||
document.getElementById('modal-container').appendChild(overlay);
|
document.getElementById('modal-container').appendChild(overlay);
|
||||||
document.documentElement.classList.add('modal-open');
|
document.documentElement.classList.add('modal-open');
|
||||||
|
|
||||||
// Tastatur auf Mobilgeräten: Modal nach oben schieben wenn Keyboard erscheint
|
// Tastatur auf Mobilgeräten: Modal nach oben schieben + fokussiertes Feld einblenden
|
||||||
let _vvCleanup = null;
|
let _vvCleanup = null;
|
||||||
const vv = window.visualViewport;
|
const vv = window.visualViewport;
|
||||||
if (vv) {
|
if (vv) {
|
||||||
|
|
@ -100,16 +100,26 @@ const UI = (() => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
_current = { overlay, onClose, _vvCleanup };
|
// Fokussiertes Feld in den sichtbaren Bereich scrollen (iOS)
|
||||||
|
const _onFocusin = e => {
|
||||||
|
const el = e.target;
|
||||||
|
if (el.tagName === 'INPUT' || el.tagName === 'TEXTAREA' || el.tagName === 'SELECT') {
|
||||||
|
setTimeout(() => el.scrollIntoView({ block: 'nearest', behavior: 'smooth' }), 320);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
overlay.addEventListener('focusin', _onFocusin);
|
||||||
|
|
||||||
|
_current = { overlay, onClose, _vvCleanup, _onFocusin };
|
||||||
|
|
||||||
return overlay.querySelector('.modal');
|
return overlay.querySelector('.modal');
|
||||||
}
|
}
|
||||||
|
|
||||||
function close() {
|
function close() {
|
||||||
if (!_current) return;
|
if (!_current) return;
|
||||||
const { onClose, _vvCleanup } = _current;
|
const { onClose, _vvCleanup, _onFocusin } = _current;
|
||||||
onClose?.();
|
onClose?.();
|
||||||
_vvCleanup?.();
|
_vvCleanup?.();
|
||||||
|
if (_onFocusin) _current.overlay.removeEventListener('focusin', _onFocusin);
|
||||||
_current.overlay.remove();
|
_current.overlay.remove();
|
||||||
document.documentElement.classList.remove('modal-open');
|
document.documentElement.classList.remove('modal-open');
|
||||||
_current = null;
|
_current = null;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
Offline-Cache + Push Notifications + Tile-Cache
|
Offline-Cache + Push Notifications + Tile-Cache
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
|
||||||
const CACHE_VERSION = 'by-v974';
|
const CACHE_VERSION = 'by-v975';
|
||||||
const CACHE_STATIC = `${CACHE_VERSION}-static`;
|
const CACHE_STATIC = `${CACHE_VERSION}-static`;
|
||||||
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten
|
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten
|
||||||
const CACHE_API = 'ban-yaro-api-v1'; // API-Response-Cache
|
const CACHE_API = 'ban-yaro-api-v1'; // API-Response-Cache
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue