diff --git a/README.md b/README.md index 21b610b..e9426af 100755 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ Für Bestellungen per Mail zusätzlich: Optional: - `APP_API_KEY` – Schutz fuer `/wawi/api/bestand` und `/wawi/order` - `COOKIE_SECURE` – `0` fuer http lokal, `1` fuer https +- `PAYPAL_ACCOUNT` – PayPal-E-Mail für Bestellformular (z.B. `paypal@beispiel.de`) ## Benutzerverwaltung Beim ersten Start wird **ein Admin** aus ENV erzeugt: @@ -59,10 +60,12 @@ python import_from_html.py /pfad/zu/hellas_bestand.html --truncate ## Live‑Shop‑Ansicht (index.html) `index.html` lädt den Bestand aus der WaWi‑App: - API‑Proxy: `/wawi/proxy/bestand` +- Konfiguration: `/wawi/config` (lädt PayPal-Konto aus ENV) Wenn du diese Datei auf einem Webserver auslieferst, stelle sicher, dass die WaWi‑App unter `/wawi` erreichbar ist. Wenn du Bestellungen direkt aus `index.html` abschickst, muss der `X-Order-Key` bzw. `?key=` dem `APP_API_KEY` entsprechen. -Der Key wird in `index.html` im Script‑Block gesetzt: `const ORDER_KEY = ""` (neben der Formularlogik). Trage dort deinen Key ein. +Der Key wird in `index.html` im Script‑Block gesetzt: `const ORDER_KEY = ""`. Trage dort deinen Key ein (oder leer lassen, wenn kein API-Key erforderlich). +Das PayPal-Konto wird automatisch aus der ENV-Variable `PAYPAL_ACCOUNT` geladen. ## Umgebungsvariablen (ENV) **Pflicht/Empfohlen für Produktion** @@ -80,6 +83,7 @@ Der Key wird in `index.html` im Script‑Block gesetzt: `const ORDER_KEY = ""` ( **Optional** - `APP_API_KEY` – gemeinsamer API‑Key für `/wawi/api/bestand` **und** `/wawi/order` - `COOKIE_SECURE` – `1` (default) setzt Secure‑Cookie, `0` deaktiviert für http +- `PAYPAL_ACCOUNT` – PayPal-E-Mail-Adresse für Bestellungen (wird im Bestellformular angezeigt) ## Deployment (systemd + Gunicorn) 1) App nach `/var/www/hellas/wawi` kopieren @@ -112,6 +116,7 @@ Environment="SMTP_PASS=dein_pass" Environment="SMTP_FROM=bestand@example.com" Environment="ORDER_TO=admin@example.com, zweite@example.com" Environment="APP_API_KEY=api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +Environment="PAYPAL_ACCOUNT=dein-paypal@beispiel.de" ExecStart=/var/www/hellas/wawi/.venv/bin/gunicorn -w 3 -b 127.0.0.1:8000 app:app Restart=always diff --git a/wawi/app.py b/wawi/app.py index 40184c1..ea02181 100755 --- a/wawi/app.py +++ b/wawi/app.py @@ -886,8 +886,13 @@ def order(): db = get_db() cursor = db.execute( """ +<<<<<<< HEAD INSERT INTO orders (name, handy, email, mannschaft, artikel, groesse, menge, notiz, created_at, done, completed_by, completed_at, canceled, canceled_by, canceled_at, payment_method, payment_status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, 0, NULL, NULL, 0, NULL, NULL, ?, 'unpaid') +======= + INSERT INTO orders (name, handy, mannschaft, artikel, groesse, menge, notiz, created_at, done, completed_by, completed_at, canceled, canceled_by, canceled_at, payment_method, payment_status) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, 0, NULL, NULL, 0, NULL, NULL, ?, 'unpaid') +>>>>>>> origin/main """, ( data.get("name"), @@ -1026,7 +1031,11 @@ def orders(): """Bestellliste in der Verwaltung.""" rows = get_db().execute( """ +<<<<<<< HEAD SELECT id, name, handy, email, mannschaft, artikel, groesse, menge, notiz, created_at, done, completed_by, completed_at, canceled, canceled_by, canceled_at, payment_method, payment_status, paid_at, paid_by +======= + SELECT id, name, handy, mannschaft, artikel, groesse, menge, notiz, created_at, done, completed_by, completed_at, canceled, canceled_by, canceled_at, payment_method, payment_status, paid_at, paid_by +>>>>>>> origin/main FROM orders ORDER BY id DESC LIMIT 500 diff --git a/wawi/static/style.css b/wawi/static/style.css index b82b9b1..757872b 100755 --- a/wawi/static/style.css +++ b/wawi/static/style.css @@ -198,6 +198,25 @@ input[type="text"], input[type="number"] { } .to-top:hover { transform: translateY(-2px); } +.badge { + display: inline-block; + padding: 4px 10px; + border-radius: 4px; + font-size: 13px; + font-weight: 600; + white-space: nowrap; +} +.badge.success { + background: rgba(123, 213, 141, 0.2); + color: var(--ok); + border: 1px solid rgba(123, 213, 141, 0.4); +} +.badge.warning { + background: rgba(243, 213, 42, 0.2); + color: var(--accent); + border: 1px solid rgba(243, 213, 42, 0.4); +} + @media (max-width: 720px) { .actions { display: flex; gap: 6px; flex-wrap: wrap; } .btn.small { padding: 6px 8px; }