Compare commits
102
Commits
main
...
03af5fcfb8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03af5fcfb8 | ||
|
|
57f235dd36 | ||
|
|
16f3150ff1 | ||
|
|
ec740ca970 | ||
|
|
ae905a5d9b | ||
|
|
3eb67bba81 | ||
|
|
6323b830d7 | ||
|
|
fa23732217 | ||
|
|
82c2460835 | ||
|
|
dddfb02d1d | ||
|
|
b8e4de97c7 | ||
|
|
21325c4037 | ||
|
|
3af8a2f2ad | ||
|
|
3a3e43d5ec | ||
|
|
3e3a9a3bbd | ||
|
|
56489b8d6d | ||
|
|
cc59e7978e | ||
|
|
c24b3d43c8 | ||
|
|
c8c1d84794 | ||
|
|
c7c1e338a3 | ||
|
|
67b9439145 | ||
|
|
31be2af4c3 | ||
|
|
1212173cb4 | ||
|
|
0105179e21 | ||
|
|
701ff1a8e8 | ||
|
|
f120ec2ef3 | ||
|
|
3b6a821687 | ||
|
|
b05f49621c | ||
|
|
7b31cb5368 | ||
|
|
50d237a932 | ||
|
|
92fdfdc961 | ||
|
|
5a066eb3c4 | ||
|
|
31144148d1 | ||
|
|
1a8604f7e6 | ||
|
|
34c4db0228 | ||
|
|
062d992b63 | ||
|
|
bf007df737 | ||
|
|
7b33e3900d | ||
|
|
7852593a7a | ||
|
|
df62bcbc55 | ||
|
|
b758b1f9a7 | ||
|
|
889a2f42eb | ||
|
|
d684aea576 | ||
|
|
8d2a99e5d6 | ||
|
|
cbf77004ad | ||
|
|
2d4e569cc3 | ||
|
|
0c884a57d7 | ||
|
|
149b38b94b | ||
|
|
e678899141 | ||
|
|
8cb0bb8146 | ||
|
|
d6becf0151 | ||
|
|
d86f9c07cd | ||
|
|
cf1d653eb2 | ||
|
|
d42ee939e9 | ||
|
|
19464fe20d | ||
|
|
98601b4b3d | ||
|
|
3cc6ab3343 | ||
|
|
d7f9cf75a3 | ||
|
|
5361800ca9 | ||
|
|
52713fb481 | ||
|
|
e59a066d3c | ||
|
|
fe3e39bd04 | ||
|
|
4c305fcd46 | ||
|
|
0b24596f15 | ||
|
|
1cec319fa8 | ||
|
|
5786eed3ba | ||
|
|
5270084ff0 | ||
|
|
8855fe92ba | ||
|
|
612063455e | ||
|
|
9e4c60fdaf | ||
|
|
86fb24b1a9 | ||
|
|
6c3f03b5b4 | ||
|
|
42f729abfc | ||
|
|
ff536b048f | ||
|
|
4be20237a1 | ||
|
|
f76b738f5f | ||
|
|
27b365622e | ||
|
|
a1cb90372f | ||
|
|
7d764ce6bc | ||
|
|
1006824375 | ||
|
|
43a8064ad5 | ||
|
|
d20a4de117 | ||
|
|
8f6927fbb0 | ||
|
|
8abf11ad18 | ||
|
|
4a2e94bc83 | ||
|
|
fcd13e6a40 | ||
|
|
fda673702e | ||
|
|
8d62e353cb | ||
|
|
f5257cd251 | ||
|
|
73d6c50b8d | ||
|
|
f174421c63 | ||
|
|
d2e7088146 | ||
|
|
4f4de7f290 | ||
|
|
5fbb2fb4b5 | ||
|
|
a4c64b5398 | ||
|
|
cb110a184b | ||
|
|
99b89bcabe | ||
|
|
895c55399f | ||
|
|
ee7c866616 | ||
|
|
5717612db5 | ||
|
|
3f8fce3c02 | ||
|
|
0e19df6895 |
No files matched your search
@@ -0,0 +1,5 @@
|
|||||||
|
# Öffentliche Vite-Variablen für lokale Entwicklung (in Git, kein Secret)
|
||||||
|
VITE_APPWRITE_ENDPOINT=http://localhost:5173/v1
|
||||||
|
VITE_APPWRITE_PROJECT_ID=6a1058610003c5a13a05
|
||||||
|
VITE_APPWRITE_DATABASE_ID=woms-database
|
||||||
|
VITE_APPWRITE_BUCKET_ID=woms-attachments
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
# Kopieren nach .env.local (wird nicht von Git versioniert):
|
||||||
|
# cp .env.example .env.local
|
||||||
|
#
|
||||||
|
# Lokal mit Vite-Proxy (empfohlen � Session-Cookies wie auf dem Server):
|
||||||
|
VITE_APPWRITE_ENDPOINT=http://localhost:5173/v1
|
||||||
|
VITE_APPWRITE_PROJECT_ID=6a1058610003c5a13a05
|
||||||
|
VITE_APPWRITE_DATABASE_ID=woms-database
|
||||||
|
VITE_APPWRITE_BUCKET_ID=woms-attachments
|
||||||
|
|
||||||
|
# Optional: Proxy-Ziel (Standard: https://appwrite.webklar.com)
|
||||||
|
# VITE_APPWRITE_PROXY_TARGET=https://appwrite.webklar.com
|
||||||
|
|
||||||
|
# Produktion / Build (ohne Vite-Proxy):
|
||||||
|
# VITE_APPWRITE_ENDPOINT=https://ticket.webklar.com/v1
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
# Öffentliche Vite-Variablen für Production-Build (in Git, kein Secret)
|
||||||
|
VITE_APPWRITE_ENDPOINT=https://ticket.webklar.com/v1
|
||||||
|
VITE_APPWRITE_PROJECT_ID=6a1058610003c5a13a05
|
||||||
|
VITE_APPWRITE_DATABASE_ID=woms-database
|
||||||
|
VITE_APPWRITE_BUCKET_ID=woms-attachments
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
# Dependencies
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# Environment variables (persönliche Overrides — nicht committen)
|
||||||
|
.env
|
||||||
|
.env.local
|
||||||
|
.env.*.local
|
||||||
|
|
||||||
|
# Build output
|
||||||
|
dist/
|
||||||
|
build/
|
||||||
|
|
||||||
|
# IDE
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
*~
|
||||||
|
|
||||||
|
# OS
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"enabled": false,
|
||||||
|
"type": "static",
|
||||||
|
"branch": "test",
|
||||||
|
"displayName": "tickte-system",
|
||||||
|
"templateName": "webklar-preview-template",
|
||||||
|
"projectType": "project",
|
||||||
|
"public": false
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
Sehr geehrtes Hetzner Team,
|
||||||
|
|
||||||
|
bezüglich der Portscan Erkennung haben wir folgende Präventionsmaßnahmen implementiert.
|
||||||
|
|
||||||
|
Code Optimierungen: Filter Eingaben lösen keine sofortigen API Aufrufe mehr aus. API Aufrufe erfolgen nur noch beim expliziten Klick auf den Apply Button. Dies reduziert unnötige TCP Verbindungen um etwa 90 Prozent.
|
||||||
|
|
||||||
|
Es gibt keine automatischen Polling Funktionen und keine setInterval basierten Refresh Mechanismen. API Aufrufe erfolgen nur bei Benutzerinteraktionen.
|
||||||
|
|
||||||
|
Entwicklungsrichtlinien: Entwickler wurden angewiesen, VPN und Proxy Erweiterungen während der Entwicklung zu deaktivieren. Security Plugins werden vor dem Testen überprüft.
|
||||||
|
|
||||||
|
Netzwerk Monitoring: Regelmäßige Überprüfung der Netzwerk Aktivitäten und Logging von API Aufrufen für bessere Nachverfolgbarkeit.
|
||||||
|
|
||||||
|
Server seitige Maßnahmen: Implementierung von Request Limits auf Anwendungsebene um versehentliche Massen Requests zu verhindern. Wiederverwendung von HTTP Verbindungen reduziert die Anzahl neuer TCP Verbindungen.
|
||||||
|
|
||||||
|
Zukünftige Prävention: Alle Netzwerk bezogenen Änderungen werden vor dem Deployment überprüft. Automatische Tests für Netzwerk Verhalten werden durchgeführt. Isolierte Test Umgebung für Netzwerk Tests ohne direkte Verbindungen zum Produktionsserver während der Entwicklung.
|
||||||
|
|
||||||
|
Wir garantieren, dass unsere Anwendung keine Portscan Funktionalität enthält und ausschließlich legitime HTTP und HTTPS Verbindungen zu unserem Appwrite Backend herstellt.
|
||||||
|
|
||||||
|
Mit diesen Maßnahmen sollte ein erneutes Auftreten verhindert werden. Wir bitten um Entsperrung unserer IP Adresse 91.99.156.85.
|
||||||
|
|
||||||
|
Mit freundlichen Grüßen
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
Sehr geehrtes Hetzner Team,
|
||||||
|
|
||||||
|
bezüglich der Portscan Erkennung von unserer IP Adresse 91.99.156.85 am 30.12.2025 um 10:59:37 UTC möchten wir die Ursache erläutern.
|
||||||
|
|
||||||
|
Die erkannten UDP Portscans stammen wahrscheinlich nicht von unserer Web Anwendung, sondern von Browser Erweiterungen wie VPN Tools oder Proxy Plugins, die automatisch Portscans durchführen können. Diese laufen im Hintergrund und sind dem Benutzer oft nicht bewusst.
|
||||||
|
|
||||||
|
Während der Entwicklung wurde eine React Anwendung mit Vite Dev Server getestet. Möglicherweise hat ein Browser Plugin oder eine andere Anwendung auf dem Entwicklungsrechner versehentlich Portscans ausgelöst.
|
||||||
|
|
||||||
|
Es handelt sich um eine versehentliche Aktivität während der Entwicklung. Es gab keine absichtliche Portscan Aktivität oder Angriffsversuche.
|
||||||
|
|
||||||
|
Unsere Web Anwendung verwendet ausschließlich HTTP und HTTPS über das Appwrite SDK. Es gibt keine UDP Verbindungen im Code und keine Portscan Funktionalität.
|
||||||
|
|
||||||
|
Wir bitten um Entsperrung unserer IP Adresse 91.99.156.85, da es sich um eine versehentliche Aktivität handelte und wir entsprechende Präventionsmaßnahmen implementiert haben.
|
||||||
|
|
||||||
|
Mit freundlichen Grüßen
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
# Lokale Entwicklung (Appwrite)
|
||||||
|
|
||||||
|
## Warum funktioniert es auf dem Server, aber nicht mit `npm run dev`?
|
||||||
|
|
||||||
|
| | Server (`ticket.webklar.com`) | Lokal (`localhost:5173`) |
|
||||||
|
|---|---|---|
|
||||||
|
| App-URL | `https://ticket.webklar.com` | `http://localhost:5173` |
|
||||||
|
| API-URL | `https://ticket.webklar.com/v1` (nginx-Proxy) | oft `https://ticket.webklar.com/v1` direkt |
|
||||||
|
| **Gleiche Origin?** | Ja | **Nein** (Cross-Origin) |
|
||||||
|
| Session-Cookie | `domain=.ticket.webklar.com` | Browser speichert Cookie **nicht** f�r localhost |
|
||||||
|
|
||||||
|
Auf dem Server leitet nginx `/v1/` an Appwrite weiter und schreibt Cookies auf `ticket.webklar.com` um. Die React-App und die API sind **dieselbe Site** � Login funktioniert.
|
||||||
|
|
||||||
|
Lokal ruft der Browser die API auf einer **anderen Domain** auf. Appwrite setzt Cookies f�r `.ticket.webklar.com`. Die werden bei Requests von `localhost:5173` **nicht mitgeschickt** ? `guests missing scopes`, Login scheint tot.
|
||||||
|
|
||||||
|
CORS f�r `http://localhost:5173` ist auf dem Server erlaubt � das reicht allein nicht f�r HttpOnly-Session-Cookies.
|
||||||
|
|
||||||
|
## L�sung: Vite-Proxy + `.env.local`
|
||||||
|
|
||||||
|
1. Datei anlegen (nicht in Git):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp .env.example .env.local
|
||||||
|
```
|
||||||
|
|
||||||
|
2. In `.env.local` muss stehen:
|
||||||
|
|
||||||
|
```env
|
||||||
|
VITE_APPWRITE_ENDPOINT=http://localhost:5173/v1
|
||||||
|
VITE_APPWRITE_PROJECT_ID=6a1058610003c5a13a05
|
||||||
|
VITE_APPWRITE_DATABASE_ID=woms-database
|
||||||
|
VITE_APPWRITE_BUCKET_ID=woms-attachments
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Dev-Server starten:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
`vite.config.js` leitet `/v1` an `https://ticket.webklar.com` weiter und schreibt Cookie-Domains auf `localhost` um � Verhalten wie nginx auf dem Server.
|
||||||
|
|
||||||
|
## Fehler: „Failed to load resource“ / **504** in der Konsole
|
||||||
|
|
||||||
|
Typisch bei `VITE_APPWRITE_ENDPOINT=http://localhost:5173/v1`: Der Vite-Proxy erreicht Appwrite nicht rechtzeitig.
|
||||||
|
|
||||||
|
1. **Neuesten Code holen** (`git pull`) — Proxy zeigt jetzt direkt auf `appwrite.webklar.com` mit längerem Timeout.
|
||||||
|
2. Dev-Server **komplett stoppen** (Strg+C) und neu starten: `npm run dev`
|
||||||
|
3. In `.env.local` prüfen:
|
||||||
|
```env
|
||||||
|
VITE_APPWRITE_ENDPOINT=http://localhost:5173/v1
|
||||||
|
```
|
||||||
|
4. Im Browser **Network**-Tab: Welche URL liefert 504?
|
||||||
|
- `http://localhost:5173/v1/...` ? Proxy/Netzwerk (Firewall, VPN, Server nicht erreichbar)
|
||||||
|
- `https://ticket.webklar.com/v1/...` ? ohne Proxy; Endpoint in `.env.local` auf `localhost:5173` stellen
|
||||||
|
5. Test im Terminal (ersetzt 5173 durch deinen Vite-Port):
|
||||||
|
```bash
|
||||||
|
curl -sS -o /dev/null -w "%{http_code}\n" http://localhost:5173/v1/health \
|
||||||
|
-H "X-Appwrite-Project: 6a1058610003c5a13a05"
|
||||||
|
```
|
||||||
|
Erwartung: **401** (nicht 504) — dann ist der Proxy ok.
|
||||||
|
|
||||||
|
**Notfall ohne Proxy:** In `.env.local` temporär `VITE_APPWRITE_ENDPOINT=https://ticket.webklar.com/v1` — Login-Cookies funktionieren lokal dann oft nicht, aber du siehst ob der Server erreichbar ist.
|
||||||
|
|
||||||
|
## Checkliste bei Problemen
|
||||||
|
|
||||||
|
- [ ] `.env.local` existiert (`.env` allein reicht; Vite l�dt `.env.local` mit h�herer Priorit�t)
|
||||||
|
- [ ] Endpoint ist `http://localhost:5173/v1`, **nicht** `https://appwrite.webklar.com/v1` (altes Projekt)
|
||||||
|
- [ ] Nach Login: DevTools ? Application ? Cookies ? `localhost` ? `a_session_6a1058610003c5a13a05`
|
||||||
|
- [ ] Appwrite Console ? Projekt **Ticket-System** ? Platforms ? `localhost` eingetragen
|
||||||
|
|
||||||
|
## Git / Deploy
|
||||||
|
|
||||||
|
- `.env` und `.env.local` sind in `.gitignore` � jeder Entwickler braucht eigene `.env.local`
|
||||||
|
- Server-Build nutzt Container-Env (`VITE_APPWRITE_ENDPOINT=https://ticket.webklar.com/v1`)
|
||||||
|
- Push nach Gitea deployt nur den **Frontend-Code**, nicht deine lokale `.env.local`
|
||||||
@@ -1,67 +1,42 @@
|
|||||||
# WOMS 2.0 - Work Order Management System
|
# WOMS – Ticketsystem von WEBklar
|
||||||
|
|
||||||
React-basiertes Ticket-Management-System mit Appwrite Backend.
|
Internes Ticketsystem unter https://ticket.webklar.com: Tickets, Arbeitsblätter mit
|
||||||
|
Zeiterfassung, Kunden und Leads, Website-Projekte, Planboard und Rechnungen (nur
|
||||||
|
anzeigen; Rechnungen werden in InvoiceNinja geschrieben).
|
||||||
|
React/Vite im Browser, Daten in Appwrite (Projekt `6a1058610003c5a13a05`,
|
||||||
|
Datenbank `woms-database`, API unter `https://ticket.webklar.com/v1`).
|
||||||
|
|
||||||
## Setup
|
## Entwickeln und live stellen
|
||||||
|
|
||||||
### 1. Dependencies installieren
|
- Lokal starten: siehe [LOCAL_DEV.md](./LOCAL_DEV.md) (Vite-Proxy + `.env.local`).
|
||||||
```bash
|
- Live ist der Branch `test` im Gitea-Repo `JUSN/tickte-system`. Ein Push löst
|
||||||
npm install
|
auf dem Server Build und Deploy aus.
|
||||||
```
|
- Achtung: Der Webhook baut **jeden** gepushten Branch und stellt ihn live.
|
||||||
|
Feature-Branches deshalb nicht pushen; live geht es mit
|
||||||
|
`git push origin <branch>:test`.
|
||||||
|
|
||||||
### 2. Appwrite konfigurieren
|
## Datenmodell (Kurzfassung)
|
||||||
|
|
||||||
Erstelle eine `.env` Datei basierend auf `.env.example`:
|
Datum speichert WOMS als Text `dd.mm.yyyy`, Uhrzeiten als `hhmm` (z. B. `0930`).
|
||||||
```env
|
|
||||||
VITE_APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1
|
|
||||||
VITE_APPWRITE_PROJECT_ID=your-project-id
|
|
||||||
VITE_APPWRITE_DATABASE_ID=woms-database
|
|
||||||
```
|
|
||||||
|
|
||||||
### 3. Appwrite Database Schema
|
| Collection | Inhalt | Wichtige Felder |
|
||||||
|
|---|---|---|
|
||||||
|
| `workorders` | Tickets | `woid` (fortlaufend ab 10000), `topic`, `details`, `status`, `priority`, `type` (Webpage, Migration, Project, Akquise), `serviceType`, `customerId`/`customerName`, `assignedTo`/`assignedName`, `requestedBy`, `startDate`/`startTime`/`endTime`, `deadline` |
|
||||||
|
| `worksheets` | Arbeitsblätter | `wsid` (fortlaufend ab 100000), `woid` + `workorderId`, `employeeId`/`employeeName`, `serviceType`, `oldStatus`/`newStatus`, `totalTime` (Minuten), `startDate`/`startTime`/`endDate`/`endTime`, `details`, `isComment`, `countsToPlan` (Abo-Stunden) |
|
||||||
|
| `customers` | Kunden und Leads | `code` (Kundennummer), `name`/`companyName`, `customerStatus` (z. B. lead, customer, lost), `archived`, Rechnungsadresse, `invoiceNinjaClientId`, Portal-Zugang |
|
||||||
|
| `employees` | Mitarbeiter | `userId` (Appwrite-Benutzer), `displayName`, `email`, `shortcode` (Kürzel) |
|
||||||
|
| `websiteProjects` | Website-Projekte und Vorschauen | `customerId` (steuert, was der Kunde im Portal sieht), `ticketId` (Ziel der Git-Push-Arbeitsblätter), Subdomain, Repo |
|
||||||
|
| `leads`, `leadPipeline`, `leadSettings` | Lead-Automatik | Recherche-Ergebnisse, Pipeline-Schritte, Sucheinstellungen |
|
||||||
|
| `roadmaps`, `roadmapNodes` | alte Projektpläne | wird von WOMS nicht mehr gelesen (Plan mit Schritten, verknüpft mit einem Ticket) |
|
||||||
|
| `config` | alte Einstellungen | wird von WOMS nicht mehr gelesen (Prioritäten, alte Listen) |
|
||||||
|
|
||||||
Erstelle folgende Collections in deiner Appwrite-Datenbank:
|
Zusammenspiel mit anderen Systemen:
|
||||||
|
|
||||||
#### Collection: `workorders`
|
- **Kundenportal** (project.webklar.com): legt bei jedem Git-Push ein Arbeitsblatt an
|
||||||
| Attribut | Typ | Required |
|
(`employeeId` `gitea`, `serviceType` `GIT`, ohne Beginn). Die Zeit wird in WOMS
|
||||||
|----------|-----|----------|
|
nachgetragen, danach zählt sie als Arbeitszeit. Termine aus der Rechnungsanalyse
|
||||||
| title | string (255) | ✓ |
|
landen am Akquise-Ticket des Kunden und erscheinen im Planboard. Kunden-, Mitarbeiter-
|
||||||
| description | string (5000) | |
|
und Projektverwaltung laufen über die Admin-API des Portals.
|
||||||
| status | string (50) | ✓ |
|
- **ticket-integrations** (`/api/integrations`): Proxy zu InvoiceNinja (Rechnungen
|
||||||
| priority | integer | ✓ |
|
anzeigen, Kunden verknüpfen). Die Paperless-Routen dort nutzt WOMS nicht mehr;
|
||||||
| type | string (50) | |
|
Paperless selbst ist gestoppt.
|
||||||
| customerId | string (50) | |
|
|
||||||
| customerName | string (255) | |
|
|
||||||
| assignedTo | string (50) | |
|
|
||||||
| assignedName | string (255) | |
|
|
||||||
| response | string (50) | |
|
|
||||||
| createdAt | datetime | |
|
|
||||||
|
|
||||||
#### Collection: `customers`
|
|
||||||
| Attribut | Typ | Required |
|
|
||||||
|----------|-----|----------|
|
|
||||||
| name | string (255) | ✓ |
|
|
||||||
| email | string (255) | |
|
|
||||||
| phone | string (50) | |
|
|
||||||
|
|
||||||
#### Collection: `users`
|
|
||||||
| Attribut | Typ | Required |
|
|
||||||
|----------|-----|----------|
|
|
||||||
| name | string (255) | ✓ |
|
|
||||||
| email | string (255) | ✓ |
|
|
||||||
| role | string (50) | |
|
|
||||||
|
|
||||||
### 4. App starten
|
|
||||||
```bash
|
|
||||||
npm run dev
|
|
||||||
```
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- Ticket-Erstellung und -Verwaltung
|
|
||||||
- Status-Tracking (Open, Occupied, Assigned, Awaiting, Closed)
|
|
||||||
- Prioritäts-Management (Low, Normal, High, Critical)
|
|
||||||
- Filter und Suche
|
|
||||||
- Datei-Uploads
|
|
||||||
- Dashboard mit Statistiken
|
|
||||||
- Planboard für Terminplanung
|
|
||||||
@@ -0,0 +1,240 @@
|
|||||||
|
# Mitarbeiter-2FA per E-Mail-Code + Wechsel Ticketsystem ⇄ Projekt-Admin – Implementation Plan
|
||||||
|
|
||||||
|
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||||
|
|
||||||
|
**Goal:** Mitarbeiter melden sich in Ticketsystem und Projekt-Admin nur mit Passwort + E-Mail-Code an (Appwrite-MFA), und ein Seitenleisten-Eintrag wechselt ohne zweiten Login ins Projekt-Admin, ein Kopfzeilen-Button zurück.
|
||||||
|
|
||||||
|
**Architecture:** Appwrite 1.8.1 erzwingt den zweiten Faktor (`user.mfa` + `emailVerification`). Das Ticketsystem (React, SDK 13) ruft die MFA-Endpunkte über `client.call` auf; das Kundenportal (Express) führt beim Mitarbeiter-Login die Challenge serverseitig mit der Appwrite-Sitzung aus der Login-Antwort durch. Der Wechsel nutzt die vorhandenen Einmal-Tokens aus `staffPreviewTokens.js` mit neuem `purpose: 'switch'`.
|
||||||
|
|
||||||
|
**Tech Stack:** Kundenportal: Node/Express, `node --test`, Appwrite-Nachbau `test/support/appwriteMock.js`. Ticketsystem: React 18 + Vite, Appwrite-Web-SDK 13.0.2, neu `node --test` für reine Module; UI-Prüfung per esbuild-Harness + Playwright im Scratchpad (Rezept: Memory „woms-ticketsystem“, `MemoryMax` beachten).
|
||||||
|
|
||||||
|
**Spec:** `docs/superpowers/specs/2026-09-30-mitarbeiter-2fa-und-wechsel-design.md` (dieser Worktree)
|
||||||
|
|
||||||
|
**Repos / Worktrees:**
|
||||||
|
- Ticketsystem: `/home/webklar/apps/ticket.webklar.com/dev-2fa`, Branch `feature/mitarbeiter-2fa` (von `origin/test` 3b6a821). `node_modules` ist getrackt → nur `git add <dateien>`, nie `-A`. **Nie pushen** (Webhook deployt jeden Branch).
|
||||||
|
- Kundenportal: `/home/webklar/apps/kundenbereich.webklar.com/dev-2fa`, Branch `feature/mitarbeiter-2fa` von `origin/main` (d5c70a5), anlegen in Task 1 (`git -C build worktree add -b feature/mitarbeiter-2fa ../dev-2fa origin/main`, `node_modules` als Symlink auf `../build/node_modules`). Nicht pushen.
|
||||||
|
|
||||||
|
## Global Constraints
|
||||||
|
|
||||||
|
- Appwrite-Endpunkte (1.8.1): `POST /v1/account/mfa/challenges {factor:'email'}` → `{ $id, expire }`; `PUT /v1/account/mfa/challenges {challengeId, otp}`; Admin: `PATCH /v1/users/:id/mfa {mfa}`, `PATCH /v1/users/:id/verification {emailVerification}`.
|
||||||
|
- Fehlertypen: `user_more_factors_required` (401, halbe Sitzung), `user_invalid_token` (401, Code falsch/abgelaufen), `user_email_not_verified`, `general_rate_limit_exceeded` / Status 429.
|
||||||
|
- Code gilt 1 Stunde (Appwrite). Offene Portal-Code-Anmeldung: 10 Minuten, max. 5 Fehlversuche.
|
||||||
|
- Einmal-Link: 60 s, einmalig, `purpose: 'switch'`; Preview-Tokens ohne `purpose` gelten als `'preview'`.
|
||||||
|
- MFA-Aufrufe senden `X-Appwrite-Locale: de`.
|
||||||
|
- Texte (wörtlich, in beiden Systemen gleich):
|
||||||
|
- Hinweis: `Wir haben dir einen Code an {maskierteEmail} geschickt.`
|
||||||
|
- Feld-Label: `Code aus der E-Mail`; Buttons: `Anmelden`, `Code erneut senden`, `Abbrechen`, (halbe Sitzung beim Laden) `Code senden`
|
||||||
|
- `user_invalid_token` → `Code falsch oder abgelaufen.`
|
||||||
|
- 429 → `Zu viele Versuche. Bitte warte einige Minuten.`
|
||||||
|
- `user_email_not_verified` → `2FA ist für dein Konto noch nicht eingerichtet – bitte Kenso Bescheid geben.`
|
||||||
|
- Portal nach 5 Fehlversuchen / abgelaufen → `Bitte melde dich erneut an.`
|
||||||
|
- E-Mail-Maskierung: erstes Zeichen des lokalen Teils + `…@` + Domain (`kenso@webklar.com` → `k…@webklar.com`).
|
||||||
|
- Seitenleiste: Label `Projekt-Admin`, Icon `IconExternalLink`; Kopfzeile Portal: `← Ticketsystem` → `https://ticket.webklar.com/tickets`.
|
||||||
|
- Kunden-Login und Mitarbeiter mit `mfa = false` verhalten sich exakt wie heute.
|
||||||
|
|
||||||
|
## Review Focus
|
||||||
|
|
||||||
|
1. **Portal-Umgehung:** Mitarbeiter mit `mfa = true` darf nach `POST /api/auth/login` **kein** `webklar_portal_session`- und kein Preview-Cookie bekommen – Test in Task 3.
|
||||||
|
2. **Reload mit halber Sitzung im Ticketsystem:** darf keine Mail automatisch auslösen und nicht in einer Login-Schleife enden – Test in Task 6 (UI-Harness).
|
||||||
|
3. **Token-Verwechslung:** Ein Switch-Token darf nicht über `/api/auth/staff-preview` einlösbar sein und umgekehrt – Test in Task 4.
|
||||||
|
4. **Halbe Sitzung beim Wechsel:** JWT aus halber Sitzung → `/account` 401 → `switch-link` 401, kein Token – Test in Task 4.
|
||||||
|
5. **Abbrechen/Neu-Login mit halber Sitzung im Ticketsystem:** `deleteSessions()` vor dem Neu-Login muss auch mit halber Sitzung klappen (in Appwrite zur MFA-Gruppe gehörend? – wenn nicht, wird der Fehler geschluckt wie heute und die lokale Sitzung trotzdem gelöscht) – Test in Task 5.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Teil A – Kundenportal (`kundenbereich.webklar.com/dev-2fa`)
|
||||||
|
|
||||||
|
### Task 1: Appwrite-Sitzung aus dem Login + MFA-Aufrufe im Namen der Sitzung
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Modify: `server/services/appwriteClient.js` (`appwriteFetch`, `loginWithAppwrite`)
|
||||||
|
- Modify: `test/support/appwriteMock.js` (Sessions + MFA-Nachbau)
|
||||||
|
- Test: `test/staffMfa.test.js` (neu, erster Teil)
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Produces:
|
||||||
|
- `loginWithAppwrite(email, password) → { $id, email, name: '', sessionCookie: string }` (`sessionCookie` = Wert von `a_session_<projectId>` aus `set-cookie`, sonst `''`).
|
||||||
|
- `appwriteSessionFetch(path, { method, body, sessionCookie }) → data` – wie `appwriteFetch`, zusätzlich Header `Cookie: a_session_<projectId>=<sessionCookie>` und `X-Appwrite-Locale: de`; Fehler mit `.status`, `.type` wie `appwriteFetch`.
|
||||||
|
- Mock: `POST /v1/account/sessions/email` (setzt `set-cookie a_session_<project>=sess-<userId>`; Nutzer aus `mock.addUser({ $id, email, password, mfa, emailVerification, labels })`), `GET /v1/users/:id` liefert `mfa`, `emailVerification`, `labels`, `email`; `GET /v1/account` mit Cookie → 401 `user_more_factors_required` solange mfa und Faktor fehlt; `POST/PUT /v1/account/mfa/challenges` (OTP abrufbar über `mock.lastOtp(userId)`, `mock.expireChallenges()`); `PATCH /v1/users/:id/mfa`, `PATCH /v1/users/:id/verification`; Zähler `mock.mailsSent(userId)`.
|
||||||
|
|
||||||
|
- [ ] **Step 1:** Worktree anlegen (siehe Kopf), `npm test` im Worktree → alle bestehenden Tests grün (Ausgangslage notieren).
|
||||||
|
- [ ] **Step 2: Failing test** in `test/staffMfa.test.js`:
|
||||||
|
- `loginWithAppwrite liefert sessionCookie` → `assert.equal(user.sessionCookie, 'sess-u_staff')`.
|
||||||
|
- `appwriteSessionFetch schickt Cookie und Locale` → Challenge anlegen, `mock.mailsSent('u_staff') === 1`, Mock hat Header `x-appwrite-locale: de` gesehen.
|
||||||
|
- [ ] **Step 3:** `npm test` → FAIL (`sessionCookie` undefined / Funktion fehlt).
|
||||||
|
- [ ] **Step 4:** Implementieren: `appwriteFetch` gibt intern auch die Response-Header zurück (`response.headers.getSetCookie()`), `loginWithAppwrite` nimmt das Cookie `a_session_${config.appwrite.projectId}`; `appwriteSessionFetch` exportieren. Mock erweitern.
|
||||||
|
- [ ] **Step 5:** `npm test` → PASS (alle).
|
||||||
|
- [ ] **Step 6: Commit** `git add server/services/appwriteClient.js test/support/appwriteMock.js test/staffMfa.test.js && git commit -m "Portal-Login: Appwrite-Sitzung merken, MFA-Aufrufe im Namen der Sitzung"`
|
||||||
|
|
||||||
|
### Task 2: Offene Code-Anmeldungen (`staffMfa.js`)
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `server/services/staffMfa.js`
|
||||||
|
- Test: `test/staffMfa.test.js` (erweitern)
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes: `appwriteSessionFetch` (Task 1).
|
||||||
|
- Produces:
|
||||||
|
- `maskEmail(email: string) → string`
|
||||||
|
- `startStaffMfa({ userId, email, sessionCookie }) → Promise<{ key: string, maskedEmail: string }>` – legt Challenge an, Eintrag `{ userId, email, sessionCookie, challengeId, expiresAt: now+10min, attempts: 0 }` in einer `Map`.
|
||||||
|
- `verifyStaffMfa(key, otp) → Promise<{ ok: true, userId, email } | { ok: false, reason: 'invalid' | 'gone' }>` – `invalid` bei `user_invalid_token` (attempts+1; beim 5. Fehlversuch Eintrag löschen → danach `gone`), `gone` bei unbekanntem/abgelaufenem Schlüssel; bei Erfolg Eintrag löschen. Andere Fehler (z. B. 429) werden geworfen.
|
||||||
|
- `resendStaffMfa(key) → Promise<boolean>` – neue Challenge, `challengeId` ersetzen; `false` wenn Eintrag weg.
|
||||||
|
- `MFA_COOKIE = 'webklar_portal_mfa'`
|
||||||
|
|
||||||
|
- [ ] **Step 1: Failing tests:**
|
||||||
|
- `maskEmail`: `'kenso@webklar.com' → 'k…@webklar.com'`, `'a@b.de' → 'a…@b.de'`, `'' → ''`.
|
||||||
|
- `richtiger Code`: start → `verifyStaffMfa(key, mock.lastOtp('u_staff'))` → `{ ok: true, userId: 'u_staff', email }`; zweiter Aufruf mit gleichem Key → `{ ok:false, reason:'gone' }`.
|
||||||
|
- `falscher Code 5x`: vier Mal `reason:'invalid'`, fünfter `invalid`, sechster `gone`.
|
||||||
|
- `abgelaufen`: Zeit per `Date.now`-Stub +11 min → `gone`.
|
||||||
|
- `resend`: `mock.mailsSent` steigt auf 2, alter OTP ungültig (`invalid`), neuer gültig.
|
||||||
|
- [ ] **Step 2:** `npm test` → FAIL (Modul fehlt).
|
||||||
|
- [ ] **Step 3:** `server/services/staffMfa.js` implementieren (Schlüssel `randomBytes(32).toString('hex')`, Aufräumen wie `staffPreviewTokens.purgeExpired`).
|
||||||
|
- [ ] **Step 4:** `npm test` → PASS.
|
||||||
|
- [ ] **Step 5: Commit** `git add server/services/staffMfa.js test/staffMfa.test.js && git commit -m "Portal: offene Mitarbeiter-Code-Anmeldungen (staffMfa)"`
|
||||||
|
|
||||||
|
### Task 3: Login-Route mit Code-Schritt + Login-Seite
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `server/services/staffAccount.js` (verschiebt `resolveStaffAccount` aus `routes/auth.js` unverändert, exportiert)
|
||||||
|
- Modify: `server/routes/auth.js` (Login, neue Routen, Helfer `startStaffPortalSession`)
|
||||||
|
- Modify: `public/login.html`, `public/app.js` (`initLoginPage`), `public/login.css` (nur falls nötig)
|
||||||
|
- Test: `test/staffLogin.test.js` (neu, mit `startTestApp({ '/api/auth': authRoutes })`)
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes: Task 1 + 2.
|
||||||
|
- Produces:
|
||||||
|
- `resolveStaffAccount(appwriteUserId, email, account) → { isAdmin, name, email } | null` (aus `server/services/staffAccount.js`).
|
||||||
|
- In `auth.js` lokal: `startStaffPortalSession(res, { userId, staff }) → Promise<void>` (setzt Portal-Sitzung + Preview-Cookie exakt wie heute der Mitarbeiter-Zweig; wird in Task 4 von `staff-switch` genutzt – deshalb exportieren als benannten Export).
|
||||||
|
- `POST /api/auth/login`: Mitarbeiter mit `account.mfa === true` → Status 200 `{ mfaRequired: true, email: maskedEmail }` + signiertes httpOnly-Cookie `webklar_portal_mfa` (10 min, `sameSite: 'lax'`, `secure` wie Portal-Cookie); **keine** Portal-Sitzung.
|
||||||
|
- `POST /api/auth/login/mfa {otp}` → 200 `{ success:true, role:'admin', admin }` | 401 `{ error:'Code falsch oder abgelaufen.' }` | 410 `{ error:'Bitte melde dich erneut an.' }` (+ MFA-Cookie löschen) | 429.
|
||||||
|
- `POST /api/auth/login/mfa/resend` → 200 `{ success:true }` | 410.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Failing tests** (`test/staffLogin.test.js`):
|
||||||
|
- `Kunde ohne MFA: unverändert` → 200, Portal-Cookie gesetzt, kein `mfaRequired`.
|
||||||
|
- `Mitarbeiter ohne MFA: unverändert` → 200 `role:'admin'`, Portal-Cookie gesetzt.
|
||||||
|
- `Mitarbeiter mit MFA: kein Portal-Cookie vor dem Code` → 200 `{ mfaRequired:true, email:'k…@webklar.com' }`; `set-cookie` enthält `webklar_portal_mfa`, **nicht** `webklar_portal_session` und nicht das Preview-Cookie. `GET /api/auth/me` mit diesem Cookie-Stand → `authenticated:false`.
|
||||||
|
- `richtiger Code` → 200 `role:'admin'`, Portal-Cookie gesetzt, MFA-Cookie gelöscht; `/me` → `role:'admin'`.
|
||||||
|
- `falscher Code` → 401 Text wörtlich; nach 5 falschen → 410 `Bitte melde dich erneut an.`.
|
||||||
|
- `ohne MFA-Cookie` → 410.
|
||||||
|
- `resend` → 200, `mock.mailsSent` = 2.
|
||||||
|
- [ ] **Step 2:** `npm test` → FAIL.
|
||||||
|
- [ ] **Step 3:** Server implementieren: `resolveStaffAccount` verschieben; im Login nach `resolveStaffAccount` bei `account?.mfa === true` → `startStaffMfa`, sonst unverändert `startStaffPortalSession`. `staff` für den späteren Erfolg wird bei `verify` neu per `getUserById` + `resolveStaffAccount` ermittelt (nicht im Speicher halten).
|
||||||
|
- [ ] **Step 4:** `npm test` → PASS (alle, inkl. bestehender).
|
||||||
|
- [ ] **Step 5:** Login-Seite: bei `result.mfaRequired` Passwort-Formular ausblenden, Code-Schritt zeigen (Texte aus Global Constraints, Feld `inputmode="numeric" autocomplete="one-time-code" maxlength="6"`), `Abbrechen` = Seite neu laden (`/login.html`). Erfolg → `adminLoginTarget()`.
|
||||||
|
- [ ] **Step 6:** Sichtprüfung mit Playwright gegen den Test-Server aus Step 1 (Mock + App): Passwort → Code-Schritt sichtbar, falscher Code zeigt Text, richtiger Code landet auf `/admin.html`. Screenshot Handy- und Desktop-Breite.
|
||||||
|
- [ ] **Step 7: Commit** `git add server/services/staffAccount.js server/routes/auth.js public/login.html public/app.js test/staffLogin.test.js && git commit -m "Portal-Login: E-Mail-Code für Mitarbeiter mit 2FA"` (+ `public/login.css`, falls geändert)
|
||||||
|
|
||||||
|
### Task 4: Wechsel-Link + Rückweg-Button
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Modify: `server/services/staffPreviewTokens.js`
|
||||||
|
- Create: `server/routes/admin/switchLink.js`, mount in `server/index.js` als `app.use('/api/admin/switch-link', adminSwitchLinkRoutes)` neben `preview-open`
|
||||||
|
- Modify: `server/routes/auth.js` (neue Route `GET /staff-switch`, `staff-preview` prüft `purpose`)
|
||||||
|
- Modify: `public/admin.html` (Button in `.portal-header-actions` vor `#logout-btn`)
|
||||||
|
- Test: `test/staffSwitch.test.js` (neu)
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes: `resolveStaffAccount` (Task 3), `startStaffPortalSession` (Task 3).
|
||||||
|
- Produces:
|
||||||
|
- `createStaffPreviewToken(payload)` unverändert; `consumeStaffPreviewToken(token, purpose = 'preview')` → `null`, wenn `(entry.purpose || 'preview') !== purpose` (Token wird dabei trotzdem verbraucht).
|
||||||
|
- `POST /api/admin/switch-link` (Bearer-JWT): `/account` per JWT (wie `requireAppwriteStaff`, aber ohne Label-Pflicht), dann `getUserById` + `resolveStaffAccount`; kein Mitarbeiter → 403; → 200 `{ openUrl: 'https://<config.preview.baseHost>/api/auth/staff-switch?token=…' }`.
|
||||||
|
- `GET /api/auth/staff-switch?token=` → gültig: `startStaffPortalSession` + `302 /admin.html`; sonst `302 /login.html?error=Link%20abgelaufen%2C%20bitte%20anmelden`.
|
||||||
|
- Button: `<a class="portal-btn-outline" href="https://ticket.webklar.com/tickets">← Ticketsystem</a>`.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Failing tests:**
|
||||||
|
- `switch-link ohne JWT` → 401; `ungültiges JWT` → 401; `JWT aus halber Sitzung` (Mock liefert `user_more_factors_required`) → 401.
|
||||||
|
- `Kunde` (`jwt-kunde`, kein employee) → 403.
|
||||||
|
- `Mitarbeiter ohne admin-Label` (neues Mock-JWT `jwt-staff`, employee-Dokument vorhanden) → 200 mit `openUrl`.
|
||||||
|
- `staff-switch gültig` → 302 `/admin.html`, Portal-Cookie `role:'admin'`, `isAdmin` passend.
|
||||||
|
- `staff-switch zweimal` → zweiter Aufruf 302 auf `/login.html?error=…`.
|
||||||
|
- `staff-switch nach 61 s` → 302 Login.
|
||||||
|
- `Switch-Token über staff-preview` → 410; `Preview-Token über staff-switch` → 302 Login.
|
||||||
|
- `admin.html enthält Rückweg-Link` → statischer Test: Datei enthält `href="https://ticket.webklar.com/tickets"` innerhalb `portal-header-actions`.
|
||||||
|
- [ ] **Step 2:** `npm test` → FAIL.
|
||||||
|
- [ ] **Step 3:** Implementieren.
|
||||||
|
- [ ] **Step 4:** `npm test` → PASS (alle).
|
||||||
|
- [ ] **Step 5: Commit** `git add server/services/staffPreviewTokens.js server/routes/admin/switchLink.js server/index.js server/routes/auth.js public/admin.html test/staffSwitch.test.js && git commit -m "Wechsel Ticketsystem → Projekt-Admin per Einmal-Link, Rückweg-Button"`
|
||||||
|
|
||||||
|
### Task 5 (Portal): Einrichtungs-Skript `scripts/mitarbeiter-2fa.mjs`
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `scripts/mitarbeiter-2fa.mjs`, `server/services/staffMfaAdmin.js`
|
||||||
|
- Test: `test/staffMfaAdmin.test.js`
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Produces (`staffMfaAdmin.js`): `listStaffMfaStatus() → Promise<Array<{ userId, name, email, emailVerification, mfa }>>` (alle `employees` mit `userId`); `enableStaffMfa(userId)` (erst verification, dann mfa); `disableStaffMfa(userId)`.
|
||||||
|
- Skript: `--status` (Tabelle), `--enable <userId>|alle` (zeigt vorher die Adressen, fragt `Ja/Nein` auf stdin; `--yes` überspringt), `--disable <userId>`. Läuft per `docker exec -w /app webklar-kundenbereich-server node scripts/mitarbeiter-2fa.mjs …`.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Failing tests:** `listStaffMfaStatus` gegen Mock (2 employees, 1 ohne `userId` → ignoriert); `enableStaffMfa` ruft `verification` **vor** `mfa` (Reihenfolge im Mock protokolliert); `disableStaffMfa` setzt nur `mfa:false`.
|
||||||
|
- [ ] **Step 2:** FAIL → **Step 3:** implementieren → **Step 4:** `npm test` PASS.
|
||||||
|
- [ ] **Step 5: Commit** `git add scripts/mitarbeiter-2fa.mjs server/services/staffMfaAdmin.js test/staffMfaAdmin.test.js && git commit -m "Skript: 2FA für Mitarbeiter anzeigen, einschalten, abschalten"`
|
||||||
|
|
||||||
|
## Teil B – Ticketsystem (`ticket.webklar.com/dev-2fa`)
|
||||||
|
|
||||||
|
### Task 6: MFA-Modul + AuthContext + Login-Seite
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `src/lib/mfa.js`, `tests/mfa.test.mjs`
|
||||||
|
- Modify: `src/lib/appwrite.js` (`export { client }`), `src/context/AuthContext.jsx`, `src/pages/LoginPage.jsx`, `package.json` (`"test": "node --test tests/"`)
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Produces (`src/lib/mfa.js`, **ohne** Import von `appwrite.js`, damit Node es laden kann):
|
||||||
|
- `createMfaApi(client) → { createEmailChallenge(): Promise<string /*challengeId*/>, completeChallenge(challengeId, otp): Promise<void> }` – über `client.call(method, new URL(client.config.endpoint + '/account/mfa/challenges'), { 'content-type': 'application/json', 'X-Appwrite-Locale': 'de' }, params)`.
|
||||||
|
- `isMoreFactorsError(err) → boolean` (`err?.type === 'user_more_factors_required'`)
|
||||||
|
- `mfaErrorMessage(err) → string` (Texte aus Global Constraints; Fallback `err.message || 'Anmeldung fehlgeschlagen'`)
|
||||||
|
- `maskEmail(email) → string` (gleiche Regel wie Portal)
|
||||||
|
- AuthContext-Wert zusätzlich: `mfaPending: null | { challengeId: string | null, email: string }`, `verifyCode(otp) → {success, error?}`, `sendCode() → {success, error?}` (erstmals oder erneut), `cancelMfa() → Promise<void>`. `login()` liefert bei MFA `{ success:false, mfaRequired:true }`.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Failing tests** (`tests/mfa.test.mjs`, Fake-Client zeichnet `call`-Argumente auf):
|
||||||
|
- `createEmailChallenge` → Methode `post`, Pfad endet auf `/account/mfa/challenges`, Params `{ factor:'email' }`, Header `X-Appwrite-Locale: de`, Rückgabe = `$id`.
|
||||||
|
- `completeChallenge('c1','123456')` → Methode `put`, Params `{ challengeId:'c1', otp:'123456' }`.
|
||||||
|
- `isMoreFactorsError` true/false; `mfaErrorMessage` für `user_invalid_token`, Code 429, `user_email_not_verified`, sonstige.
|
||||||
|
- `maskEmail('kenso@webklar.com') === 'k…@webklar.com'`.
|
||||||
|
- [ ] **Step 2:** `npm test` → FAIL.
|
||||||
|
- [ ] **Step 3:** `mfa.js` implementieren → `npm test` PASS.
|
||||||
|
- [ ] **Step 4:** AuthContext:
|
||||||
|
- `login()`: nach `createSessionWithCleanup` → `account.get()`; `isMoreFactorsError` → `sendCode()` + `mfaPending` setzen → `{ success:false, mfaRequired:true }`.
|
||||||
|
- `checkUser()`: `isMoreFactorsError` → `mfaPending = { challengeId: null, email: '' }`, **keine** Mail, `user` bleibt `null`, lokale Sitzung **nicht** löschen (anders als bei anderen 401).
|
||||||
|
- `verifyCode`: `completeChallenge` → `account.get()` → `setUser`, `ensureEmployeeExists`, `mfaPending = null`.
|
||||||
|
- `cancelMfa`: `account.deleteSession('current')` (Fehler schlucken), `clearAllLocalAppwriteSessions()`, `mfaPending = null`.
|
||||||
|
- E-Mail für den Hinweis: beim Login aus dem Formular; beim Reload unbekannt → Hinweis ohne Adresse `Wir schicken dir einen Code an deine E-Mail-Adresse.` bis `Code senden` gedrückt ist.
|
||||||
|
- [ ] **Step 5:** LoginPage: bei `mfaPending` Code-Schritt statt Passwort-Formular (Texte wörtlich; `Code senden` nur wenn `challengeId === null`, sonst Codefeld + `Code erneut senden`); `/login` leitet wie bisher nur bei `user` weiter.
|
||||||
|
- [ ] **Step 6:** UI-Harness (Scratchpad, esbuild + Playwright, Appwrite per `page.route` nachgebaut, Rezept aus Memory): Checks
|
||||||
|
- Login ohne MFA → `/tickets`.
|
||||||
|
- Login mit MFA → Code-Schritt, Hinweis `k…@webklar.com`, **1** Challenge-POST.
|
||||||
|
- falscher Code → `Code falsch oder abgelaufen.`; richtiger Code → `/tickets`.
|
||||||
|
- `Code erneut senden` → 2. Challenge-POST.
|
||||||
|
- Reload mit halber Sitzung → Code-Schritt mit `Code senden`, **0** Challenge-POSTs, keine Weiterleitungsschleife (URL bleibt `/login`, max. 1 `GET /account`).
|
||||||
|
- `Abbrechen` → `DELETE /account/sessions/current`, Passwort-Formular sichtbar; danach neuer Login möglich, auch wenn der Mock `DELETE /account/sessions` mit 401 beantwortet.
|
||||||
|
- 429 beim Challenge-POST → Text `Zu viele Versuche. Bitte warte einige Minuten.`
|
||||||
|
- [ ] **Step 7:** `npx vite build` im Worktree (unter `systemd-run --scope -p MemoryMax=700M -p MemorySwapMax=0`) → Build ok.
|
||||||
|
- [ ] **Step 8: Commit** `git add src/lib/mfa.js tests/mfa.test.mjs src/lib/appwrite.js src/context/AuthContext.jsx src/pages/LoginPage.jsx package.json && git commit -m "Login mit E-Mail-Code (Appwrite-2FA)"`
|
||||||
|
|
||||||
|
### Task 7: Seitenleisten-Eintrag „Projekt-Admin“
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Modify: `src/components/Navbar.jsx`, `src/lib/employeeAdminApi.js` (oder neue kleine `src/lib/projectAdminSwitch.js` im gleichen Stil)
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes: `POST /api/admin/switch-link` (Task 4).
|
||||||
|
- Produces: `openProjectAdmin() → Promise<void>` – `account.createJWT()`, POST, `window.location.assign(openUrl)`; bei Fehler `window.location.assign('https://project.webklar.com/login.html')`.
|
||||||
|
|
||||||
|
- [ ] **Step 1:** Eintrag als `<button className="side-link">` (kein `<Link>`, externes Ziel) nach der Linkliste in derselben `side-group`, Icon `IconExternalLink`, Label `Projekt-Admin`, während des Ladens `disabled`; im eingeklappten Zustand `title` gesetzt wie die anderen.
|
||||||
|
- [ ] **Step 2:** UI-Harness-Checks: Eintrag für Mitarbeiter ohne Admin-Rolle sichtbar; Klick → genau 1 POST auf `https://project.webklar.com/api/admin/switch-link` mit `Authorization: Bearer …`, danach Navigation auf `openUrl`; Fehlerantwort 500 → Navigation auf `…/login.html`.
|
||||||
|
- [ ] **Step 3:** `npm test` + `vite build` ok.
|
||||||
|
- [ ] **Step 4: Commit** `git add src/components/Navbar.jsx src/lib/employeeAdminApi.js && git commit -m "Seitenleiste: direkt ins Projekt-Admin wechseln"`
|
||||||
|
|
||||||
|
## Teil C – Livegang (nur mit OK des Nutzers)
|
||||||
|
|
||||||
|
### Task 8: Code-Mail-Vorlage + Übergabe
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `docs/superpowers/specs/2026-09-30-mfa-mailvorlage.html` (Ticketsystem-Worktree) – Betreff `Dein Anmeldecode für WEBklar`, HTML im Stil der Portal-Vorlagen (`dev-mailvorlagen`/`server/mail-templates`), Platzhalter `{{otp}}`, Text `Der Code gilt 1 Stunde.` und `Nicht du? Dann ändere bitte dein Passwort.`
|
||||||
|
|
||||||
|
- [ ] **Step 1:** Vorlage erstellen, lokal mit `{{otp}} = 123456` rendern, Screenshot an den Nutzer.
|
||||||
|
- [ ] **Step 2:** Übergabe an den Nutzer mit genauer Reihenfolge:
|
||||||
|
1. Portal: `git -C /home/webklar/apps/kundenbereich.webklar.com/dev-2fa push origin feature/mitarbeiter-2fa:main` – danach Live-Check: `POST /api/admin/switch-link` ohne JWT → 401, Login-Seite lädt.
|
||||||
|
2. Ticketsystem: `git -C /home/webklar/apps/ticket.webklar.com/dev-2fa push origin feature/mitarbeiter-2fa:test` – danach Live-Check Bundle enthält `Projekt-Admin`.
|
||||||
|
3. Nutzer hinterlegt Vorlage in der Appwrite-Console (Auth → Templates → MFA-Challenge, Sprache Deutsch).
|
||||||
|
4. `--status`, dann `--enable <Kensos userId>`, Nutzer probiert beide Logins + Wechsel, dann `--enable alle`.
|
||||||
|
- [ ] **Step 3:** Commit der Vorlage (`git add docs/superpowers/specs/2026-09-30-mfa-mailvorlage.html`).
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
# WOMS „Rechtliches“ Implementation Plan
|
||||||
|
|
||||||
|
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||||
|
|
||||||
|
**Goal:** Interner Menüpunkt „Rechtliches“ mit versionierten Rechtstexten und Anbieter-Verträgen samt Fristen.
|
||||||
|
|
||||||
|
**Architecture:** Drei neue Appwrite-Sammlungen + ein Bucket, angelegt per idempotentem Setup-Skript. Reine
|
||||||
|
Fristen-/Versionslogik in `src/lib/legal.js` (Node-Unit-Tests), Datenzugriff in `src/hooks/useLegal.js`,
|
||||||
|
Oberfläche in `src/pages/LegalPage.jsx` + zwei Reiter-Komponenten. Erstbefüllung per Seed-Skript nach Freigabe
|
||||||
|
der Versionsliste durch den Nutzer.
|
||||||
|
|
||||||
|
**Tech Stack:** React 18, Vite 5, Appwrite JS SDK 13 (Client) / node-appwrite (Skripte), `node --test` (Node 24), Playwright (Scratchpad).
|
||||||
|
|
||||||
|
**Spec:** `docs/superpowers/specs/2026-09-30-rechtliches-design.md`
|
||||||
|
|
||||||
|
## Global Constraints
|
||||||
|
|
||||||
|
- Arbeitsort: Worktree `/home/webklar/apps/ticket.webklar.com/dev-rechtliches`, Branch `feature/rechtliches`. **Nie pushen** – jeder Push (egal welcher Branch) geht live. Push nur durch/nach OK des Nutzers: `git push origin feature/rechtliches:test`.
|
||||||
|
- `node_modules` ist in Git getrackt: immer `git add <dateien>`, nie `-A`.
|
||||||
|
- Keine neuen npm-Abhängigkeiten.
|
||||||
|
- Oberflächentexte Deutsch. Datumsangaben als `YYYY-MM-DD`-String gespeichert, angezeigt `dd.mm.yyyy`.
|
||||||
|
- Versionen und Dateien: kein Löschen (weder UI noch Rechte). Anbieter-Verträge: Löschen erlaubt.
|
||||||
|
- Fristenfarben: rot ≤ 30 Tage, orange ≤ 90 Tage bis Kündigungstermin; grau = gekündigt/beendet; „Fristen fehlen“ bei unvollständigen Angaben.
|
||||||
|
- Keine erfundenen Fristen/Preise im Seed.
|
||||||
|
- CSS: kein Bootstrap vorhanden (`.d-flex` etc. existieren nicht), vorhandene Klassen/`ui`-Komponenten nutzen.
|
||||||
|
|
||||||
|
## Review Focus
|
||||||
|
|
||||||
|
- Abgelöst-Setzen scheitert nach dem Anlegen der neuen Version (zweiter Request 401/Netz) → zwei „gültige“ Versionen; UI muss den Fehler zeigen und `currentVersion()` die mit dem jüngsten `validFrom` nehmen (Test Task 1).
|
||||||
|
- Vertrag mit Start am 31. eines Monats → Monatsende klemmen, nie in den Folgemonat überlaufen (Test Task 1).
|
||||||
|
- Kündigungstermin genau heute → zählt noch als aktuelle Periode, rot, nicht übersprungen (Test Task 1).
|
||||||
|
- Neue Version mit `validFrom` älter als die aktuelle (Nachtrag einer alten Fassung) → darf die aktuelle NICHT ablösen, wird als `superseded` mit passendem `validTo` einsortiert (Test Task 1).
|
||||||
|
- Bucket/Sammlung fehlt noch (Setup nicht gelaufen) → Seite zeigt leeren Zustand mit Hinweis statt Absturz (Test Task 5).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 1: Fristen- und Versionslogik
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `src/lib/legal.js`
|
||||||
|
- Create: `tests/legal.test.mjs`
|
||||||
|
- Modify: `package.json` (Script `"test": "node --test tests/"`)
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Produces:
|
||||||
|
- `addMonthsClamped(date: string, n: number): string`
|
||||||
|
- `nextCancellationDate(contract, today: string): { state: 'active'|'anytime'|'ends'|'ended'|'cancelled'|'incomplete', noticeBy: string|null, periodEnd: string|null }`
|
||||||
|
- `deadlineTone(result, today: string): 'red'|'orange'|'normal'|'grey'|'missing'`
|
||||||
|
- `currentVersion(versions): version|null` (Status `current`, bei mehreren das jüngste `validFrom`)
|
||||||
|
- `planNewVersion(versions, input): { create: object, updates: Array<{ id: string, patch: object }> }`
|
||||||
|
- `formatDate(date: string): string` (`YYYY-MM-DD` → `dd.mm.yyyy`, leer → `–`)
|
||||||
|
|
||||||
|
- [ ] **Step 1: Failing tests** in `tests/legal.test.mjs` (`node:test`, `assert/strict`):
|
||||||
|
- `addMonthsClamped('2026-01-31', 1) === '2026-02-28'`; `('2028-01-31', 1) === '2028-02-29'`; `('2026-03-15', 12) === '2027-03-15'`.
|
||||||
|
- Start `2025-03-12`, term 12, renewal 12, notice 1 month, today `2026-09-30` → `{state:'active', periodEnd:'2027-03-12', noticeBy:'2027-02-12'}`.
|
||||||
|
- gleiche Daten, today `2027-02-12` → noticeBy `2027-02-12` (heute zählt noch); today `2027-02-13` → periodEnd `2028-03-12`, noticeBy `2028-02-12`.
|
||||||
|
- notice 30 days, periodEnd `2027-03-12` → noticeBy `2027-02-10`.
|
||||||
|
- `termMonths: 0` → `state:'anytime'`, noticeBy null.
|
||||||
|
- renewal 0, periodEnd in Zukunft → `state:'ends'`, periodEnd gesetzt; periodEnd vorbei → `'ended'`.
|
||||||
|
- `cancelledAt` gesetzt → `'cancelled'`, periodEnd = `endsAt`.
|
||||||
|
- fehlendes `startDate` oder `noticeValue` (bei term > 0) → `'incomplete'`.
|
||||||
|
- `deadlineTone`: noticeBy in 30 Tagen → `'red'`, 31 → `'orange'`, 90 → `'orange'`, 91 → `'normal'`; cancelled/ended → `'grey'`; incomplete → `'missing'`; anytime/ends → `'normal'`.
|
||||||
|
- `planNewVersion` mit aktueller v5 (validFrom `2026-05-01`), Eingabe v6 status `current` validFrom `2026-09-01` → updates `[{id:v5.$id, patch:{status:'superseded', validTo:'2026-08-31'}}]`, create.validTo null.
|
||||||
|
- Eingabe status `draft` → updates leer.
|
||||||
|
- Eingabe `current` mit validFrom `2025-01-01` (älter als v5) → create.status `'superseded'`, create.validTo = Tag vor dem nächstjüngeren validFrom (`2026-04-30`), updates leer.
|
||||||
|
- `currentVersion` mit zwei `current` → die mit jüngerem validFrom.
|
||||||
|
|
||||||
|
- [ ] **Step 2:** `npm test` → FAIL (Modul fehlt).
|
||||||
|
- [ ] **Step 3: Implementieren.** Rein, ohne Imports; Datumsrechnung in UTC auf `YYYY-MM-DD`. Algorithmus `nextCancellationDate` (active): `periodEnd = addMonthsClamped(start, term)`; solange `noticeBy(periodEnd) < today`: `periodEnd = addMonthsClamped(periodEnd, renewal)`. Notice in Monaten per `addMonthsClamped(periodEnd, -n)`, in Tagen per Tagesabzug.
|
||||||
|
- [ ] **Step 4:** `npm test` → alle PASS.
|
||||||
|
- [ ] **Step 5: Commit** `git add src/lib/legal.js tests/legal.test.mjs package.json && git commit -m "Rechtliches: Fristen- und Versionslogik mit Tests"`
|
||||||
|
|
||||||
|
### Task 2: Appwrite-Setup und Konstanten
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `scripts/setup-legal.mjs`
|
||||||
|
- Modify: `src/lib/appwrite.js` (`Storage` exportieren, Konstanten)
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Produces: `COLLECTIONS.LEGAL_DOCUMENTS = 'legalDocuments'`, `COLLECTIONS.LEGAL_VERSIONS = 'legalVersions'`, `COLLECTIONS.PROVIDER_CONTRACTS = 'providerContracts'`, `LEGAL_BUCKET_ID = 'legal-files'`, `storage` (Appwrite `Storage`).
|
||||||
|
|
||||||
|
- [ ] **Step 1: Skript schreiben** nach Muster `setup-woms-appwrite.mjs` (ENV `APPWRITE_API_KEY`, idempotent, vorhandene Attribute überspringen). Attribute exakt wie Spec-Abschnitt „Daten“; Datumsfelder `string(10)`, `fileIds` string-Array (size 64), `changeNote`/`note` string(5000), `status`/`costInterval`/`noticeUnit` als enum, `cost` float, Monats-/Fristzahlen integer. Rechte: `legalDocuments`/`legalVersions` = read/create/update für `users`, **kein delete**; `providerContracts` = read/create/update/delete `users`. Bucket `legal-files`: read/create `users`, kein update/delete, `maximumFileSize` 20 MB, Endungen `pdf, html, htm, png, jpg, jpeg, webp, doc, docx`. Die 7 `legalDocuments` (Keys `agb, abo-bedingungen, avv, datenschutz-website, datenschutz-portal, impressum, widerruf`, mit Titel, Live-URL, sort 1–7) als feste IDs = Key anlegen, wenn fehlend. Flag `--dry-run` gibt nur aus, was angelegt würde.
|
||||||
|
- [ ] **Step 2:** `node --check scripts/setup-legal.mjs` → OK; `node scripts/setup-legal.mjs --dry-run` ohne Key → listet Sammlungen/Bucket/Dokumente, Exit 0.
|
||||||
|
- [ ] **Step 3:** Konstanten in `appwrite.js`; `npm run build` → Exit 0.
|
||||||
|
- [ ] **Step 4: Commit.** Skript wird erst in Task 6 mit Key ausgeführt.
|
||||||
|
|
||||||
|
### Task 3: Daten-Hook
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `src/hooks/useLegal.js`
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes: Task 1 `planNewVersion`, Task 2 Konstanten.
|
||||||
|
- Produces:
|
||||||
|
- `useLegalDocuments(): { documents, versions, loading, error, missingSetup: boolean, addVersion(documentKey, input, files: File[]), updateVersion(id, patch), refresh }`
|
||||||
|
- `useProviderContracts(): { contracts, loading, error, missingSetup, saveContract(data, files, id?), deleteContract(id), refresh }`
|
||||||
|
- `fileUrl(fileId): string` (View-URL), `fileDownloadUrl(fileId): string`
|
||||||
|
|
||||||
|
- [ ] **Step 1: Implementieren.** Listen mit `Query.limit(5000)`. 404 auf Sammlung → `missingSetup: true`, leere Listen, kein Fehler. `addVersion`: Dateien per `storage.createFile(LEGAL_BUCKET_ID, ID.unique(), file)`, dann `planNewVersion` → erst `createDocument`, dann die `updates`; scheitert ein Update, `error` = „Neue Version gespeichert, alte Version konnte nicht abgelöst werden: …“ und trotzdem `refresh()`.
|
||||||
|
- [ ] **Step 2:** `npm run build` → Exit 0. (Verhalten wird in Task 5 per Playwright geprüft.)
|
||||||
|
- [ ] **Step 3: Commit.**
|
||||||
|
|
||||||
|
### Task 4: Seite „Rechtliches“ mit beiden Reitern
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `src/pages/LegalPage.jsx`, `src/components/legal/LegalTextsTab.jsx`, `src/components/legal/VersionForm.jsx`, `src/components/legal/ProviderContractsTab.jsx`, `src/components/legal/ContractForm.jsx`
|
||||||
|
- Modify: `src/App.jsx` (Route `/rechtliches` in `ProtectedRoute`), `src/components/Navbar.jsx` (Eintrag „Rechtliches“ mit `IconScale` nach „Finanzen“)
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes: Task 1 (`currentVersion`, `nextCancellationDate`, `deadlineTone`, `formatDate`), Task 3 Hooks.
|
||||||
|
|
||||||
|
- [ ] **Step 1: LegalTextsTab.** Pro Dokument `Card`: Titel, aktuelle Version + „gilt seit“, Link „Live-Seite“ (`target=_blank`); Entwürfe als graues `Badge` „Entwurf“. Klick klappt Versionsgeschichte auf (neu → alt nach validFrom): Nummer, `formatDate(validFrom)`–`formatDate(validTo)`, Notiz, Dateilinks (Ansehen/Herunterladen). Aktuelle Zeile grün. Button „Neue Version“ öffnet `VersionForm` (Felder: Version, Status draft/current, gültig ab, Notiz, Dateien; Pflicht: Version, gültig ab). Entwurf-Zeilen haben „Als gültig markieren“ (setzt `status current` über `planNewVersion`-Logik: Update + Ablösung). Kein Löschen-Button.
|
||||||
|
- [ ] **Step 2: ProviderContractsTab.** Tabelle/Liste sortiert: rot, orange, normal, missing, grey; innerhalb nach noticeBy. Spalten: Anbieter, Zweck, Kosten (`12,00 €/Monat`), Laufzeit, Kündigungsfrist, nächster Kündigungstermin (bzw. „jederzeit kündbar“, „endet am …“, „gekündigt zum …“, „Fristen fehlen“). Zeilenfarbe per Klasse `legal-tone-{tone}`. Detail aufklappbar mit Notiz, Dateien, „Bearbeiten“, „Als gekündigt markieren“ (fragt `endsAt`, setzt `cancelledAt` = heute), „Löschen“ mit `confirm`. `ContractForm` für Neu/Bearbeiten.
|
||||||
|
- [ ] **Step 3: LegalPage** mit `PageHeader` „Rechtliches“ und `Tabs` (`texte` „Unsere Rechtstexte“, `anbieter` „Verträge mit Anbietern“). Bei `missingSetup` `EmptyState` „Rechtliches ist noch nicht eingerichtet (Setup-Skript fehlt).“ CSS-Regeln für `legal-tone-*` in die bestehende globale CSS.
|
||||||
|
- [ ] **Step 4:** `npm run build` → Exit 0.
|
||||||
|
- [ ] **Step 5: Commit.**
|
||||||
|
|
||||||
|
### Task 5: Oberflächentest
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create (Scratchpad, nicht im Repo): `legal-e2e.mjs` – Vite-Build mit `DIST=…`, Appwrite-Mock unter `https://ticket.test` (Muster `appsmoke.mjs` aus Memory „woms-ticketsystem“), Build und Browser unter `systemd-run --scope -p MemoryMax=…`.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Test schreiben**, Prüfungen:
|
||||||
|
- Menü zeigt „Rechtliches“, `/rechtliches` lädt, zwei Reiter.
|
||||||
|
- AGB-Karte zeigt aktuelle „v5“, grün; Geschichte listet v5, v4 mit `validTo`.
|
||||||
|
- „Neue Version“ v6 current ab heute → Mock erhält Create v6 **und** Patch v5 `{status:'superseded', validTo:<gestern>}`; Karte zeigt v6.
|
||||||
|
- Patch-Request mit 401 gemockt → Fehlermeldung sichtbar, v6 trotzdem gelistet.
|
||||||
|
- Kein „Löschen“ bei Versionen.
|
||||||
|
- Anbieter-Reiter: Vertrag mit noticeBy in 10 Tagen hat `legal-tone-red` und steht oben; unvollständiger zeigt „Fristen fehlen“; gekündigter ist grau und unten.
|
||||||
|
- Sammlung liefert 404 → EmptyState-Hinweis, kein Absturz.
|
||||||
|
- [ ] **Step 2:** Test laufen lassen → alle PASS; bei FAIL Code in Task 3/4 korrigieren und neu committen.
|
||||||
|
|
||||||
|
### Task 6: Einrichtung und Erstbefüllung (Nutzer-Gates)
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `scripts/seed-legal.mjs`, `scripts/legal-seed.json` (erzeugte Versionsliste)
|
||||||
|
|
||||||
|
- [ ] **Step 1: Versionsliste rekonstruieren.** Pro Text: `git log --format='%h %ad %s' --date=short origin/main -- <datei>` in `/home/webklar/apps/webklar.com/build` (`src/pages/AGB.tsx`, `Impressum.tsx`, `Datenschutz.tsx`) und `/home/webklar/apps/kundenbereich.webklar.com/build` (`public/abo-bedingungen.html` inkl. AVV-Anlage, `public/datenschutz.html`, `public/widerrufen.html`). Nur inhaltliche Änderungen werden Versionen (reine Format-/Build-Commits zusammenfassen). Ergebnis als `legal-seed.json`: `{documentKey, version, validFrom, status, changeNote, source: '<repo>@<hash>:<pfad>'}`. Nicht auf main liegende Stände (z. B. Abo-Bedingungen v4, AGB `f40e889`) als `draft`.
|
||||||
|
- [ ] **Step 2: GATE – Nutzer prüft die Liste** (Nummerierung, v. a. AGB „v6“). Erst nach OK weiter.
|
||||||
|
- [ ] **Step 3: Seed-Skript.** Liest JSON, erzeugt je Version eine Datei: Portal-HTML direkt aus `git show`; Website-TSX als lesbares HTML (Text aus JSX, eigene Mini-Umwandlung; bei Unsicherheit TSX-Quelltext als `.html` in `<pre>`). Upload in `legal-files`, Dokument in `legalVersions`. Idempotent über `source` (schon vorhanden → überspringen). Anbieter Hetzner (Server), Hetzner (Mail), Porkbun (Domains), Stripe (Zahlungen) ohne Fristen/Preise. `--dry-run`.
|
||||||
|
- [ ] **Step 4: GATE – API-Key.** Key auf dem Server suchen (nur Dateien, die bisherige Setup-Läufe nutzten); sonst Nutzer fragen. Dann `node scripts/setup-legal.mjs`, danach `node scripts/seed-legal.mjs` → Ausgabe zählt angelegte Sammlungen/Versionen.
|
||||||
|
- [ ] **Step 5: Commit** Skripte + JSON.
|
||||||
|
|
||||||
|
### Task 7: Abschluss
|
||||||
|
|
||||||
|
- [ ] **Step 1:** `npm test`, `npm run build`, Task-5-Test → grün. Deploy-nahe Prüfung: `git archive` + `docker run node:20-alpine` (`npm install; npm run build`).
|
||||||
|
- [ ] **Step 2: GATE – Push-OK des Nutzers**, dann `git push origin feature/rechtliches:test`; Live-Bundle auf „Rechtliches“ prüfen.
|
||||||
|
- [ ] **Step 3:** Memory `woms-ticketsystem` aktualisieren.
|
||||||
@@ -0,0 +1,183 @@
|
|||||||
|
# Serverpuls Implementation Plan
|
||||||
|
|
||||||
|
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||||
|
|
||||||
|
**Goal:** Admin-only WOMS page „Serverpuls“ with server/container/app metrics over time and deterministic Low/Medium/Critical mail alerts from a small monitoring service.
|
||||||
|
|
||||||
|
**Architecture:** New service `/home/webklar/apps/serverpuls` (own local git repo, Node 22, `node:sqlite`, nodemailer) collects from host `/proc`, a read-only docker-socket-proxy and read-only mounts, stores downsampled series in SQLite, evaluates rules, mails via server@webklar.com and serves a read-only JWT+admin API. WOMS nginx proxies `/api/serverpuls/`; WOMS gets `ServerpulsPage` with uPlot charts.
|
||||||
|
|
||||||
|
**Tech Stack:** Node 22 (container) / Node 24 (host tests, `node --test`), `node:sqlite`, nodemailer, `tecnativa/docker-socket-proxy`, React 18 + Vite 5, uPlot, Playwright headless shell (host cache `chromium_headless_shell-1234`).
|
||||||
|
|
||||||
|
**Spec:** `docs/superpowers/specs/2026-09-30-serverpuls-design.md` (WOMS worktree `dev-serverpuls`, branch `feature/serverpuls`).
|
||||||
|
|
||||||
|
## Global Constraints
|
||||||
|
|
||||||
|
- No AI anywhere in collection, rules or mails.
|
||||||
|
- serverpuls container: `mem_limit: 128m`, `cpus: 0.5`, `init: true`, port 8091, base path `/api/serverpuls`.
|
||||||
|
- Every API route except `/health` requires `X-Appwrite-JWT`; `/account` must return `labels` containing `admin` → else 401 (no/invalid JWT) / 403 (no admin). Auth cache 60 s.
|
||||||
|
- API is read-only: only `GET`. No delete/stop/restart anywhere.
|
||||||
|
- Mail: `mail.your-server.de:587` STARTTLS, user + from + to = `server@webklar.com`; password only in `/home/webklar/apps/.env` as `SERVERPULS_SMTP_PASS`, set by the user; never printed, never read by Claude.
|
||||||
|
- Retention: raw 5 min for 7 days → hourly (avg + max) for 90 days → daily forever. Sizes daily forever.
|
||||||
|
- Schedules (Europe/Berlin, via `Intl`): sample every 5 min; sizes 03:00; downsampling 03:30; Medium digest daily 07:00; Low weekly Monday 07:00. Due-state stored in SQLite `meta` so restarts neither skip nor double-send.
|
||||||
|
- Missing measurement = no row (gap), never 0.
|
||||||
|
- Critical containers: `webklar-traefik`, `webklar-appwrite`, `webklar-kundenbereich-server`, `webklar-ticket`, `webklar-ticket-integrations`, `webklar-gitea`, `webklar-invoiceninja`, `webklar-n8n`.
|
||||||
|
- Mail subjects start with `[Serverpuls]`; texts German.
|
||||||
|
- WOMS: never push; never `git add -A` (node_modules is tracked); branch `feature/serverpuls`. Live = the user pushes to `test`.
|
||||||
|
- Heavy work (vite build, Playwright, npm install) runs under `systemd-run --scope -p MemoryMax=…M -p MemorySwapMax=0` (build 700M, browser 700M) — swap is full.
|
||||||
|
- Before editing `/home/webklar/apps/docker-compose.yml`, `.env`-touching scripts or the WOMS nginx conf: backup `*.bak-2026-09-30-serverpuls`.
|
||||||
|
|
||||||
|
## Review Focus
|
||||||
|
|
||||||
|
- Small apps flapping in growth rules (1 MB → 2 MB = +100 %): percentage growth rules only apply when the app is ≥ 100 MB at the later point (absolute 2 GB rule always applies). Test in Task 3.
|
||||||
|
- First days without 7-day history: growth rules silent until a size row ≥ 6 days old exists (no division by missing/zero). Test in Task 3.
|
||||||
|
- Service restart / downtime around 07:00: digest is sent once, on the first tick after 07:00 the same day; never twice. Test in Task 4.
|
||||||
|
- Container that is deliberately stopped (e.g. Paperless, exit code 0): no alert; only non-zero exit or restart loop counts for non-critical. Test in Task 3.
|
||||||
|
- API polled by the page every minute while Appwrite is slow: auth cache prevents one `/account` call per request; Appwrite down → 502 with JSON `{error}`, page shows the error instead of blank charts. Tests in Task 5 and Task 8.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## File Structure
|
||||||
|
|
||||||
|
Service repo `/home/webklar/apps/serverpuls/`:
|
||||||
|
|
||||||
|
| File | Responsibility |
|
||||||
|
|---|---|
|
||||||
|
| `Dockerfile` | `FROM node:22-alpine`, `apk add --no-cache util-linux-misc` (ionice), `npm ci --omit=dev`, `CMD node src/main.js` |
|
||||||
|
| `package.json` | `"type":"module"`, dep `nodemailer`, script `test: node --test test/` |
|
||||||
|
| `config/apps.json` | container → app grouping, app → folders |
|
||||||
|
| `config/rules.json` | thresholds + critical container list |
|
||||||
|
| `src/collect/host.js` | parse `/proc` + statfs |
|
||||||
|
| `src/collect/docker.js` | proxy client: list, inspect, stats, system df |
|
||||||
|
| `src/collect/sizes.js` | nightly `du` per app + previews + cleanup numbers |
|
||||||
|
| `src/apps.js` | map containers/volumes/folders to apps |
|
||||||
|
| `src/store.js` | SQLite schema, inserts, queries, downsampling, meta |
|
||||||
|
| `src/rules.js` | pure rule evaluation |
|
||||||
|
| `src/alerts.js` | state diff, mail decisions, digests |
|
||||||
|
| `src/mail.js` | nodemailer + queue |
|
||||||
|
| `src/api.js` | HTTP API + auth |
|
||||||
|
| `src/schedule.js` | Berlin-time due checks |
|
||||||
|
| `src/main.js` | wiring + timers |
|
||||||
|
| `test/*.test.js`, `test/fixtures/` | unit/API tests |
|
||||||
|
|
||||||
|
WOMS worktree `dev-serverpuls`: `src/lib/serverpulsApi.js`, `src/lib/serverpulsFormat.js`, `src/components/serverpuls/{Chart.jsx,Sparkline.jsx,AppsTable.jsx}`, `src/pages/ServerpulsPage.jsx`, `src/styles/serverpuls.css`; modify `src/App.jsx`, `src/components/Navbar.jsx`, `package.json`, `package-lock.json`; test `tests/unit/serverpulsFormat.test.mjs`.
|
||||||
|
|
||||||
|
Ops: `/home/webklar/apps/docker-compose.yml`, `/home/webklar/apps/ticket.webklar.com/nginx/ticket.webklar.com.conf`, `/home/webklar/apps/scripts/mail-zugang.py`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 1: Repo, host collector, app mapping
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `Dockerfile`, `package.json`, `.gitignore` (`node_modules`, `data`), `config/apps.json`, `src/collect/host.js`, `src/apps.js`
|
||||||
|
- Test: `test/host.test.js`, `test/apps.test.js`, fixtures `test/fixtures/proc/{stat,stat2,meminfo,loadavg}` and `test/fixtures/proc/{101,102,103}/stat` (103 in state `Z`)
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Produces: `readHost(procRoot: string, diskPath: string, prevCpu?: {idle,total}) → Promise<{cpuPct: number|null, cpuRaw:{idle,total}, load1, load5, load15, memAvail, memTotal, swapUsed, swapTotal, diskUsed, diskTotal, zombies}>` (bytes; `cpuPct` null when no `prevCpu`).
|
||||||
|
- Produces: `loadAppsConfig(path) → AppsConfig`; `appForContainer(cfg, {name, service, project}) → string`; `foldersForApp(cfg, app) → string[]` (relative to apps root).
|
||||||
|
|
||||||
|
- [ ] **Step 1:** `git init` in `/home/webklar/apps/serverpuls`; package.json, Dockerfile, .gitignore. Install nodemailer + lockfile in a throwaway `docker run --rm -v $PWD:/w -w /w node:22-alpine npm install nodemailer` under MemoryMax 700M.
|
||||||
|
- [ ] **Step 2: Failing tests** — `host.test.js`: with fixtures `stat`→`stat2` delta, `cpuPct` equals the hand-computed value (write it into the fixture comment); `memAvail` = MemAvailable×1024; `swapUsed` = (SwapTotal−SwapFree)×1024; `zombies === 1`; unreadable `/proc/<pid>/stat` (pid dir without stat) is skipped, not thrown. `apps.test.js`: `webklar-appwrite-worker-mails` → `Appwrite`; `openruntimes-executor` → `Appwrite`; `webklar-nextcloud25-db` → `Nextcloud 25`; `webklar-ticket`, `webklar-ticket-build`, `webklar-ticket-integrations` → `Ticketsystem`; `debian-app-1` (project `debian`) → `debian`; unknown `webklar-foo` → `foo`.
|
||||||
|
- [ ] **Step 3:** Run `node --test test/` → FAIL.
|
||||||
|
- [ ] **Step 4:** Implement. `config/apps.json` shape: `{"groups":[{"app":"Appwrite","match":["webklar-appwrite*","openruntimes-executor"],"folders":["appwrite"]}, …]}`, glob `*` only; fallback = container name minus `webklar-` prefix, or compose project for non-`apps` projects. Seed groups for Appwrite, Kundenportal (`webklar-kundenbereich-*`, folder `kundenbereich.webklar.com`), Ticketsystem (`ticket.webklar.com`, `ticket-integrations`), Website (`webklar-webclaw*`, `webklar.com`), Nextcloud, Nextcloud 25, InvoiceNinja (`InvoiceNinja`), Gitea, n8n, Bitwarden, E-Mail-Sorter (`emailsorter*`), eship, Previews-System (`webklar-preview-*`, `previews`), Traefik. Disk via `fs.statfsSync(diskPath)`.
|
||||||
|
- [ ] **Step 5:** `node --test test/` → PASS. Commit `serverpuls: host collector + app mapping`.
|
||||||
|
|
||||||
|
### Task 2: Store and downsampling
|
||||||
|
|
||||||
|
**Files:** Create `src/store.js`; Test `test/store.test.js`
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Produces: `openStore(file: string) → Store` with
|
||||||
|
`insertHost(ts, host)`, `insertApps(ts, [{app, cpuPct, memBytes}])`, `insertContainers(ts, [{name, app, status, health, exitCode, restartCount}])`, `insertSizes(day 'YYYY-MM-DD', [{app, bytes}])`, `insertCleanup(day, {imagesBytes, buildCacheBytes, stoppedBytes, stopped:[{name,bytes}]})`,
|
||||||
|
`hostSeries(metric, sinceTs, res: 'raw'|'hour'|'day') → [{ts, v, max}]`, `appSeries(app, field: 'cpu'|'mem', sinceTs, res)`, `sizeSeries(app|null, sinceDay) → [{day, app, bytes}]`, `containerHistory(name, sinceTs)`, `latestHost()`, `latestContainers()`, `latestCleanup()`,
|
||||||
|
`downsample(nowTs)`, `getMeta(key)`, `setMeta(key, value)`, `alertState() → Map`, `saveAlertState(Map)`, `queueMail(msg)`, `pendingMails()`, `markMailSent(id)`, `dropMailsOlderThan(ts)`.
|
||||||
|
- Metrics names: `cpu, load1, load5, load15, memAvail, memTotal, swapUsed, swapTotal, diskUsed, diskTotal, zombies`.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Failing tests** (`:memory:` DB): insert 24 raw rows 5 min apart at 10 days ago → `downsample(now)` leaves 0 raw, 2 hour rows with correct avg and max; hour rows older than 90 days become day rows; raw from 1 day ago untouched; `containerHistory` rows older than 7 days deleted; `setMeta/getMeta` round-trip; alert state round-trip survives reopen of a temp file DB.
|
||||||
|
- [ ] **Step 2:** Run → FAIL. **Step 3:** Implement (tables per spec; `host_samples(ts, res, metric…, *_max)` one row per ts; indexes on `(res, ts)`; `app_samples(ts,res,app,cpu,cpu_max,mem,mem_max)`). **Step 4:** Run → PASS. **Step 5:** Commit `serverpuls: sqlite store + downsampling`.
|
||||||
|
|
||||||
|
### Task 3: Rules
|
||||||
|
|
||||||
|
**Files:** Create `config/rules.json`, `src/rules.js`; Test `test/rules.test.js`
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes: Store queries (Task 2) via an input object built in `main.js`.
|
||||||
|
- Produces: `evaluate(input, rules) → Finding[]` where
|
||||||
|
`input = {now, hostRaw:[{ts, …metrics}] (last 2 h), containers:[{name, app, status, health, exitCode, restartCount}], restarts1h: {name: n}, sizes:[{day, app, bytes}] (last 8 days), cleanup, zombieSince: ts|null, critical: string[]}` and
|
||||||
|
`Finding = {id: string, level: 'low'|'medium'|'critical', title: string, value: string}`.
|
||||||
|
- Ids: `disk`, `mem`, `load`, `zombies`, `zombies-persist`, `container:<name>`, `growth:<app>`, `cleanup`.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Failing tests** — one per spec rule and both sides of each threshold: disk 89.9 % → medium, 90 % → critical; mem critical needs every sample in last 10 min to have memAvail < 500 MB **and** swap ≥ 90 % (and ≥ 2 samples); one good sample inside window → not critical; swap ≥ 75 % for 1 h → medium; load5 > 24 for 15 min → critical, > 8 for 1 h → medium; zombies 100 → critical, 20 → medium, ≥ 1 for > 24 h → low `zombies-persist`; critical container `exited` → critical; any container restartCount +4 in 1 h → critical if in list else medium; non-critical exited with exitCode 0 → none, exitCode 1 → medium; growth 7 d +21 % on 500 MB app → medium; +21 % on 50 MB app → none; +2.1 GB on 50 GB app → medium; +11 % week on 500 MB → low; only 3 days of sizes → no growth finding; images 11 GB → low `cleanup`. Each finding has non-empty German `title` and `value`.
|
||||||
|
- [ ] **Step 2:** Run → FAIL. **Step 3:** Implement with values from `config/rules.json` (copy the spec numbers verbatim; `minGrowthPctBaseBytes: 104857600`). One finding per id, highest level wins. **Step 4:** Run → PASS. **Step 5:** Commit `serverpuls: warning rules`.
|
||||||
|
|
||||||
|
### Task 4: Alerts, schedule, mail
|
||||||
|
|
||||||
|
**Files:** Create `src/schedule.js`, `src/alerts.js`, `src/mail.js`; Test `test/alerts.test.js`, `test/schedule.test.js`
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Produces: `berlinParts(ts) → {day:'YYYY-MM-DD', hour, minute, weekday: 1..7}`; `isDue(kind: 'sizes'|'downsample'|'daily'|'weekly', ts, lastRunDay) → boolean` (03:00 / 03:30 / 07:00 / Monday 07:00; due once per day/week after the time).
|
||||||
|
- Produces: `processFindings(findings, state: Map, now) → {state, immediate: Mail[], resolvedForDigest: {medium:[], low:[]}}` — state entry `{id, level, since, lastMailed}`; critical new or re-mail after 24 h or escalation → immediate; critical resolved → immediate „✅ behoben“; medium/low resolved → collected for next digest.
|
||||||
|
- Produces: `dailyDigest(state, resolved, now) → Mail|null` (null if nothing active or resolved), `weeklyDigest(state, resolved, tops, now) → Mail` (always, contains the three Top-5 lists); `Mail = {subject, text, html}`.
|
||||||
|
- Produces: `createMailer(env) → {send(mail) → Promise}`; `flushQueue(store, mailer, now)` retries every 5 min, drops after 24 h; empty `SERVERPULS_SMTP_PASS` → mails stay queued, one log line, no crash.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Failing tests** — new critical → 1 immediate, subject `[Serverpuls] 🔴 Critical: <title>`; same finding again 1 h later → 0; 24 h later → 1; medium → critical escalation → 1 immediate; critical disappears → `[Serverpuls] ✅ behoben: <title>`; medium only appears in `dailyDigest` subject `[Serverpuls] 🟠 Tagesbericht: n Warnungen`; weekly subject `[Serverpuls] 🟡 Wochenübersicht KW <n>`; `isDue('daily')` at 06:59 Berlin false, 07:00 true, again same day with lastRunDay=today false, service down 06:00–09:00 then tick 09:05 → true once; DST switch day (2026-10-25) still exactly once. `flushQueue` with a failing mailer keeps the mail; with success marks it sent; mailer without password never calls SMTP and keeps the mail.
|
||||||
|
- [ ] **Step 2:** Run → FAIL. **Step 3:** Implement; nodemailer `{host, port:587, secure:false, requireTLS:true, auth}` from `SERVERPULS_SMTP_*`; mails text + simple HTML table, link `https://ticket.webklar.com/serverpuls`. **Step 4:** Run → PASS. **Step 5:** Commit `serverpuls: alerts, digests, mail queue`.
|
||||||
|
|
||||||
|
### Task 5: API
|
||||||
|
|
||||||
|
**Files:** Create `src/api.js`; Test `test/api.test.js`
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes: Store (Task 2), active alert state.
|
||||||
|
- Produces: `createApi({store, getAlerts: () => Finding-state[], appwrite: {endpoint, projectId}, fetchImpl}) → http.Server` with routes from the spec table. Range → resolution: `24h`,`7d` raw; `30d`,`90d` hour; `1y` day. `/overview` returns `{lastSample, host: {metric: {value, spark24h:[…], deltaYesterday}}, alerts:[…], level: 'ok'|'medium'|'critical'}`; `/apps` → `{sizesDay, rows}` (sizesDay = date of the latest size measurement, shown on the page), rows `{id, name, cpuPct, memBytes, sizeBytes, delta7d, delta30d, spark30d}` (deltas null without history); `/apps/:id` `{size, mem, cpu}` series; `/cleanup` = latest cleanup row.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Failing tests** (seeded `:memory:` store, fake `fetchImpl` for `/account`): no JWT → 401; JWT with `labels:[]` → 403; admin → 200 on every route; `/host?metric=bogus` → 400; `/host?range=30d` returns hour rows; `/apps/unknown` → 404; POST → 405; `/account` throws → 502 `{error}`; two requests with same JWT within 60 s → one `/account` call; `/health` without JWT → 200.
|
||||||
|
- [ ] **Step 2:** Run → FAIL. **Step 3:** Implement (plain `node:http`, pattern of `ticket-integrations/server.js`). **Step 4:** Run → PASS. **Step 5:** Commit `serverpuls: read-only admin API`.
|
||||||
|
|
||||||
|
### Task 6: Docker + sizes collectors, main wiring
|
||||||
|
|
||||||
|
**Files:** Create `src/collect/docker.js`, `src/collect/sizes.js`, `src/main.js`; Test `test/docker.test.js`, `test/sizes.test.js`
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Produces: `dockerClient(baseUrl) → {list(), inspect(id), stats(id), systemDf()}`; `containerCpuPct(stats) → number|null` (standard `cpu_delta/system_delta*online_cpus*100`); `memBytes(stats)` = usage − inactive_file (fallback cache).
|
||||||
|
- Produces: `measureSizes({appsRoot, volumesRoot, previewsRoot, apps: [{app, folders, volumes}], timeoutMs: 1800000}) → Promise<[{app, bytes}]>` using `ionice -c3 nice -n 19 du -sk` (fallback `nice` only if ionice missing); each preview folder → app `Preview: <name>`.
|
||||||
|
- `main.js`: env `DB_FILE=/data/serverpuls.db`, `PROC_ROOT=/host/proc`, `DISK_PATH=/host/apps`, `APPS_ROOT=/host/apps`, `VOLUMES_ROOT=/host/volumes`, `PREVIEWS_ROOT=/host/previews`, `DOCKER_URL=http://serverpuls-docker-proxy:2375`; 60 s tick: sample if ≥ 5 min since last; due jobs; rules → alerts → queue → flush. Every collector failure is caught and logged; others still stored.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Failing tests** — `containerCpuPct` on a fixture stats JSON equals hand value; missing `precpu_stats` → null; `measureSizes` on a temp tree (folder A 3 files, volume dir, previews/x) returns the three apps with sizes ≥ file bytes; a `du` that exceeds `timeoutMs` (set 1) rejects/returns partial without throwing out of `measureSizes`.
|
||||||
|
- [ ] **Step 2:** Run → FAIL. **Step 3:** Implement. **Step 4:** Run all `node --test test/` → PASS. **Step 5:** Commit `serverpuls: docker/sizes collectors + main loop`.
|
||||||
|
|
||||||
|
### Task 7: Deploy service (ops, with user gate for mail)
|
||||||
|
|
||||||
|
**Files:** Modify `/home/webklar/apps/docker-compose.yml` (backup first), `/home/webklar/apps/scripts/mail-zugang.py` (backup first), `/home/webklar/apps/ticket.webklar.com/nginx/ticket.webklar.com.conf` (backup first).
|
||||||
|
|
||||||
|
- [ ] **Step 1:** Compose: add `serverpuls-docker-proxy` (`tecnativa/docker-socket-proxy`, `CONTAINERS=1 IMAGES=1 SYSTEM=1 POST=0`, socket `:ro`, `mem_limit: 32m`, `webklar-network`, no Traefik labels) and `serverpuls` (`build: ./serverpuls`, `container_name: webklar-serverpuls`, limits from Global Constraints, mounts `/proc:/host/proc:ro`, `./:/host/apps:ro`, `/var/lib/docker/volumes:/host/volumes:ro`, `/var/www/previews:/host/previews:ro`, `serverpuls-data:/data`, env `SERVERPULS_SMTP_USER=server@webklar.com`, `SERVERPULS_SMTP_PASS=${SERVERPULS_SMTP_PASS:-}`, `TZ=Europe/Berlin`). `docker compose config -q` → exit 0. Note: mount `/host/previews` is an addition to the spec's mount list (needed for preview apps).
|
||||||
|
- [ ] **Step 2:** `docker compose up -d --build serverpuls-docker-proxy serverpuls` (build under MemoryMax 700M). Check: `docker stats --no-stream webklar-serverpuls` < 128 MiB; after 6 min `wget -qO- http://webklar-serverpuls:8091/api/serverpuls/health` from `webklar-ticket-integrations` shows `lastSample`; proxy rejects `POST /containers/x/stop` with 403.
|
||||||
|
- [ ] **Step 3:** nginx: add `location /api/serverpuls/` block mirroring `/api/integrations/` (`set $serverpuls_upstream webklar-serverpuls; proxy_pass http://$serverpuls_upstream:8091;`, no `client_max_body_size`). `docker exec webklar-ticket nginx -t && docker exec webklar-ticket nginx -s reload`. `curl -s -o /dev/null -w '%{http_code}' https://ticket.webklar.com/api/serverpuls/overview` → 401.
|
||||||
|
- [ ] **Step 4:** `mail-zugang.py --serverpuls`: prompt password for server@webklar.com (getpass), test login, backup + write `SERVERPULS_SMTP_PASS` into `.env`, `docker compose up -d serverpuls`, send test mail `[Serverpuls] Testmail` from inside the container. Dry-run with `WEBKLAR_ROOT` copy + fake SMTP. **User gate:** the user runs it; Claude only checks for the `250` result line.
|
||||||
|
- [ ] **Step 5:** Commit service repo; record compose/nginx/script changes in the memory file.
|
||||||
|
|
||||||
|
### Task 8: WOMS page
|
||||||
|
|
||||||
|
**Files:** Create `src/lib/serverpulsApi.js`, `src/lib/serverpulsFormat.js`, `src/components/serverpuls/{Chart.jsx,Sparkline.jsx,AppsTable.jsx}`, `src/pages/ServerpulsPage.jsx`, `src/styles/serverpuls.css`; Modify `src/App.jsx` (route `/serverpuls`), `src/components/Navbar.jsx` (entry after „Rechtliches“, before „Admin“, only `isAdmin`, pulse icon, dot from `overview.level`, fetched on app load and every 5 min, admins only), `package.json`/`package-lock.json` (`uplot`); Test `tests/unit/serverpulsFormat.test.mjs`.
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes: API from Task 5.
|
||||||
|
- Produces: `serverpulsApi.{overview(), host(metric, range), apps(), app(id, range), cleanup()}` (JWT pattern of `integrationsApi.js`, base `/api/serverpuls`); `formatBytes(n) → '1,2 GB'` (de-DE, base 1024), `formatDelta(pct|null) → {text:'+12,3 %'|'–', dir:'up'|'down'|'flat'}`, `ageLabel(ts, now) → {text:'vor 4 Min.', stale: boolean}` (stale > 15 min).
|
||||||
|
|
||||||
|
- [ ] **Step 1: Failing test** `serverpulsFormat.test.mjs`: `formatBytes(1288490189)` → `'1,2 GB'`; `formatBytes(0)` → `'0 B'`; `formatDelta(null).text` → `'–'`; `formatDelta(-3.21)` → `{text:'−3,2 %', dir:'down'}`; `ageLabel` at 16 min → stale true, 14 min → false.
|
||||||
|
- [ ] **Step 2:** `npm test` → FAIL. **Step 3:** Implement format helpers → PASS.
|
||||||
|
- [ ] **Step 4:** `uplot` into package.json + lockfile via throwaway `docker run node:20-alpine` (never touch tracked node_modules). Implement page per spec „WOMS-Seite“ (ampel, 6 tiles, big chart with range + metric selector, sortable/searchable apps table with row → detail chart, „Aufräumbar“, 60 s refresh while `document.visibilityState==='visible'`, error box on API error, non-admin → `<Navigate to="/tickets">`). Mobile: tiles stack < 700 px.
|
||||||
|
- [ ] **Step 5:** Deploy-like build: `git archive HEAD` + `docker run --rm node:20-alpine sh -c 'npm install && npm run build'` under MemoryMax 700M → exit 0. Commit `Serverpuls: Admin-Seite mit Verlauf und Warnungen` (only the listed files).
|
||||||
|
|
||||||
|
### Task 9: UI test
|
||||||
|
|
||||||
|
**Files:** Create (scratchpad, not in repo) `serverpuls-e2e.mjs`.
|
||||||
|
|
||||||
|
- [ ] **Step 1:** Vite build with `DIST=…` (MemoryMax 700M); serve via Playwright `page.route` under `https://ticket.test`, mock Appwrite (`/v1/account` with/without `labels:['admin']`) and `/api/serverpuls/*` fixtures (one medium alert, 3 apps, one with `delta7d:null`).
|
||||||
|
- [ ] **Step 2:** Assertions: admin sees nav entry „Serverpuls“ with orange dot; non-admin sees no entry and `/serverpuls` redirects to `/tickets`; ampel text contains „1 Warnung“; 6 tiles; switching range to „30 T“ requests `range=30d`; clicking column „Δ 7 T“ sorts; null delta shows „–“; row click opens detail chart; `/overview` 502 → error box visible, no crash; `lastSample` 20 min old → stale hint; width 390 px → no horizontal scroll.
|
||||||
|
- [ ] **Step 3:** Run under MemoryMax 700M → all pass; screenshot desktop + mobile for the user.
|
||||||
|
|
||||||
|
### Task 10: Finish
|
||||||
|
|
||||||
|
- [ ] **Step 1:** Service: `node --test test/` all pass; live container RAM < 128 MiB after 1 h; first rows in `/overview`.
|
||||||
|
- [ ] **Step 2:** WOMS: `npm test` all pass; final whole-branch review.
|
||||||
|
- [ ] **Step 3:** Report to the user: what is live (service + nginx), what waits (WOMS push `git -C dev-serverpuls push origin feature/serverpuls:test`), password step status. Update memory.
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de" xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<!--
|
||||||
|
Appwrite-Vorlage "MFA-Challenge" (Auth → Templates → Sprache Deutsch)
|
||||||
|
Betreff: Dein Anmeldecode für WEBklar
|
||||||
|
Platzhalter (Appwrite): {{otp}}, {{user}}
|
||||||
|
Code gilt 1 Stunde (Appwrite fest).
|
||||||
|
-->
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<meta name="color-scheme" content="light dark">
|
||||||
|
<meta name="supported-color-schemes" content="light dark">
|
||||||
|
<title>Dein Anmeldecode für WEBklar</title>
|
||||||
|
<!--[if mso]><style>table,td{font-family:Arial,Helvetica,sans-serif!important;}</style><![endif]-->
|
||||||
|
<style>
|
||||||
|
a{color:#111111;}
|
||||||
|
@media (max-width:620px){.w{width:100%!important;}.px{padding-left:24px!important;padding-right:24px!important;}.lbl{display:block!important;width:100%!important;padding-bottom:2px!important;border-bottom:0!important;}.val{display:block!important;width:100%!important;padding-top:0!important;}}
|
||||||
|
@media (prefers-color-scheme:dark){.bg{background:#161615!important;}.card{background:#1f1f1e!important;}.ink{color:#f2f1ee!important;}.mut{color:#a8a6a0!important;}.box{background:#2a2a28!important;border-color:#3a3a37!important;}.btn{background:#f2f1ee!important;}.btn a{color:#161615!important;}.rowline{border-color:#3a3a37!important;}}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body style="margin:0;padding:0;background:#f1f0ec;">
|
||||||
|
<span style="display:none;max-height:0;overflow:hidden;opacity:0;mso-hide:all;font-size:1px;line-height:1px;color:#f1f0ec;">Dein Code: {{otp}} ͏ ͏ ͏</span>
|
||||||
|
<table role="presentation" class="bg" width="100%" cellpadding="0" cellspacing="0" border="0" style="background:#f1f0ec;">
|
||||||
|
<tr><td align="center" style="padding:32px 12px;">
|
||||||
|
<table role="presentation" class="w" width="600" cellpadding="0" cellspacing="0" border="0" style="width:600px;max-width:600px;">
|
||||||
|
<tr><td class="px" style="padding:0 40px 20px 40px;"><table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0"><tr>
|
||||||
|
<td><table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td valign="middle" style="padding-right:10px;"><img src="https://project.webklar.com/webklar-logo.png" width="40" height="40" alt="WEBklar" style="display:block;width:40px;height:40px;border:0;outline:none;text-decoration:none;border-radius:10px;"></td><td valign="middle" class="ink" style="font-family:Arial,Helvetica,sans-serif;font-size:26px;font-weight:bold;letter-spacing:-1px;color:#111111;">WEBklar</td></tr></table></td>
|
||||||
|
<td align="right" class="mut" style="font-family:Arial,Helvetica,sans-serif;font-size:12px;color:#6b6964;">Anmeldung</td>
|
||||||
|
</tr></table></td></tr>
|
||||||
|
<tr><td class="card" style="background:#ffffff;border-radius:16px;">
|
||||||
|
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr><td class="px" style="padding:44px 40px 8px 40px;"><table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td style="background:#efe6fb;border-radius:100px;padding:6px 12px;font-family:Arial,Helvetica,sans-serif;font-size:12px;font-weight:bold;color:#5a2a91;">Anmeldecode</td></tr></table></td></tr>
|
||||||
|
<tr><td class="px ink" style="padding:16px 40px 0 40px;font-family:Arial,Helvetica,sans-serif;font-size:28px;line-height:34px;mso-line-height-rule:exactly;font-weight:bold;letter-spacing:-0.5px;color:#111111;">Hallo {{user}}, hier ist dein Code</td></tr>
|
||||||
|
<tr><td class="px ink" style="padding:12px 40px 0 40px;font-family:Arial,Helvetica,sans-serif;font-size:16px;line-height:25px;color:#111111;">Gib ihn im Ticketsystem oder im Projekt-Admin ein, um die Anmeldung abzuschließen.</td></tr>
|
||||||
|
<tr><td class="px" style="padding:24px 40px 0 40px;"><table role="presentation" class="box" width="100%" cellpadding="0" cellspacing="0" border="0" style="background:#f7f6f3;border:1px solid #e8e6e0;border-radius:12px;"><tr><td align="center" class="ink" style="padding:22px;font-family:'Courier New',Courier,monospace;font-size:36px;line-height:40px;font-weight:bold;letter-spacing:10px;color:#111111;">{{otp}}</td></tr></table></td></tr>
|
||||||
|
<tr><td class="px mut" style="padding:14px 40px 0 40px;font-family:Arial,Helvetica,sans-serif;font-size:13px;line-height:20px;mso-line-height-rule:exactly;color:#6b6964;">Der Code gilt 1 Stunde. Nicht du? Dann ändere bitte dein Passwort.</td></tr>
|
||||||
|
<tr><td style="padding:0 0 44px 0;font-size:0;line-height:0;"> </td></tr>
|
||||||
|
</table>
|
||||||
|
</td></tr>
|
||||||
|
<tr><td class="px mut" align="center" style="padding:24px 40px 0 40px;font-family:Arial,Helvetica,sans-serif;font-size:12px;line-height:19px;color:#6b6964;">Automatische Nachricht von WEBklar · Bitte nicht antworten.</td></tr>
|
||||||
|
</table>
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,169 @@
|
|||||||
|
# Mitarbeiter-2FA per E-Mail-Code + Wechsel Ticketsystem ⇄ Projekt-Admin
|
||||||
|
|
||||||
|
Stand: 2026-09-30 · Status: Design vom Nutzer freigegeben (Teil 1 + Teil 2), Spec wartet auf Review
|
||||||
|
|
||||||
|
## Ziel
|
||||||
|
|
||||||
|
1. Jeder Mitarbeiter-Login (Ticketsystem ticket.webklar.com **und** Projekt-Admin project.webklar.com)
|
||||||
|
verlangt nach dem Passwort einen 6-stelligen Code, der per E-Mail kommt. Pflicht für alle
|
||||||
|
Mitarbeiter. Kunden bleiben unverändert.
|
||||||
|
2. Aus der Seitenleiste des Ticketsystems springt man ohne zweiten Login ins Projekt-Admin; aus dem
|
||||||
|
Projekt-Admin führt ein Button zurück ins Ticketsystem.
|
||||||
|
|
||||||
|
Entscheidungen des Nutzers: E-Mail-Code statt TOTP/KeePass; 2FA über Appwrite selbst (Variante A),
|
||||||
|
nicht als reine Oberflächen-Sperre; Pflicht für alle Mitarbeiter.
|
||||||
|
|
||||||
|
## Ausgangslage (geprüft)
|
||||||
|
|
||||||
|
- Beide Systeme nutzen dieselben Appwrite-Konten (Appwrite **1.8.1**, Projekt `6a1058610003c5a13a05`).
|
||||||
|
- Appwrite verschickt bereits Mails: `_APP_SMTP_HOST=mail.your-server.de:587`, Absender
|
||||||
|
`WEBklar <noreply@webklar.com>`.
|
||||||
|
- Appwrite-MFA (1.8.1): Ist `user.mfa = true` und die E-Mail bestätigt (`emailVerification = true`),
|
||||||
|
braucht jede Sitzung 2 Faktoren. Eine Passwort-Sitzung hat nur den Faktor `password`; jeder
|
||||||
|
Nicht-MFA-Aufruf liefert dann `401 user_more_factors_required`. Das gilt auch für **bereits
|
||||||
|
bestehende** Sitzungen und für JWTs aus solchen Sitzungen.
|
||||||
|
- `POST /v1/account/mfa/challenges` `{factor:'email'}` → `{ $id, expire }`, schickt die Mail
|
||||||
|
(Vorlage `mfaChallenge`). Code gilt **1 Stunde**. Limit 10 Anfragen pro Nutzer und Zeitfenster.
|
||||||
|
- `PUT /v1/account/mfa/challenges` `{challengeId, otp}` → Sitzung bekommt Faktor `email`.
|
||||||
|
Falscher/abgelaufener Code: `401 user_invalid_token`.
|
||||||
|
- Server-API mit Key: `PATCH /v1/users/:id/mfa {mfa}`, `PATCH /v1/users/:id/verification {emailVerification}`.
|
||||||
|
- Ticketsystem: Appwrite-Web-SDK **13.0.2** (kennt kein MFA). AuthContext meldet per
|
||||||
|
`createEmailPasswordSession` an und prüft mit `account.get()`.
|
||||||
|
- Projekt-Admin: `POST /api/auth/login` ruft serverseitig `/account/sessions/email` ohne API-Key auf,
|
||||||
|
nimmt nur die `userId` und setzt die Portal-Sitzung (`role: 'admin'`) für Mitarbeiter
|
||||||
|
(`resolveStaffAccount`). **Mit MFA wäre das eine Umgehung**, weil die halbe Sitzung reicht.
|
||||||
|
- `requireAppwriteStaff` (JWT-Prüfung für `/api/admin/*` aus dem Ticketsystem) verlangt das
|
||||||
|
Label `admin`. Mitarbeiter ohne Admin-Label kommen per Portal-Login trotzdem ins Projekt-Admin
|
||||||
|
(`staff.isAdmin = false`).
|
||||||
|
- Einmal-Link-Mechanismus existiert: `services/staffPreviewTokens.js` (Map im Speicher, 60 s, einmalig),
|
||||||
|
genutzt von `/api/admin/preview-open` → `/api/auth/staff-preview`.
|
||||||
|
- Projekt-Admin (`public/admin.html`) hat keine Seitenleiste, sondern Kopfzeile + Tabs.
|
||||||
|
|
||||||
|
## Teil 1: Anmeldung mit E-Mail-Code
|
||||||
|
|
||||||
|
### Ablauf für Mitarbeiter
|
||||||
|
|
||||||
|
1. E-Mail + Passwort.
|
||||||
|
2. Anzeige „Wir haben dir einen Code an k…@webklar.com geschickt“ + 6-stelliges Codefeld
|
||||||
|
(`inputmode="numeric"`, `autocomplete="one-time-code"`), Link „Code erneut senden“, Link „Abbrechen“
|
||||||
|
(meldet die halbe Sitzung ab, zurück zur Passwort-Eingabe).
|
||||||
|
3. Richtiger Code → angemeldet. Falscher/abgelaufener Code → „Code falsch oder abgelaufen“, Feld bleibt.
|
||||||
|
|
||||||
|
### Ticketsystem (Repo JUSN/tickte-system)
|
||||||
|
|
||||||
|
- **Kein SDK-Upgrade.** Neues Modul `src/lib/mfa.js` mit zwei Funktionen über `client.call(...)` des
|
||||||
|
vorhandenen SDK-Clients (nutzt dieselbe Sitzung/Cookie-Fallback wie das SDK):
|
||||||
|
`createEmailChallenge()` → `challengeId`; `completeChallenge(challengeId, otp)`.
|
||||||
|
Beide senden `X-Appwrite-Locale: de`, damit die deutsche Vorlage greift.
|
||||||
|
- `AuthContext`:
|
||||||
|
- neuer Zustand `mfaPending` (`{ challengeId, email }` oder `null`).
|
||||||
|
- `login()`: nach der Passwort-Sitzung `account.get()`; bei `user_more_factors_required` →
|
||||||
|
Challenge anlegen, `mfaPending` setzen, `{ success: false, mfaRequired: true }` zurück.
|
||||||
|
- `checkUser()` beim Laden: gleicher Fall (bestehende halbe Sitzung, z. B. direkt nach dem
|
||||||
|
Einschalten) → **keine** neue Mail automatisch, sondern Code-Schritt mit Knopf „Code senden“.
|
||||||
|
Grund: jedes Neuladen würde sonst eine Mail auslösen und das Limit (10) aufbrauchen.
|
||||||
|
- `verifyCode(otp)`, `resendCode()`, `cancelMfa()` (= `deleteSession('current')`).
|
||||||
|
- Nach erfolgreichem Code wie bisher `account.get()` + `ensureEmployeeExists`.
|
||||||
|
- `LoginPage.jsx`: zweiter Schritt „Code eingeben“; Routing: solange `mfaPending`, führt jede
|
||||||
|
geschützte Route auf `/login`.
|
||||||
|
- Fehlertexte: `user_invalid_token` → „Code falsch oder abgelaufen“; `429`/`general_rate_limit_exceeded`
|
||||||
|
→ „Zu viele Versuche, bitte einige Minuten warten“; `user_email_not_verified` →
|
||||||
|
„2FA ist für dein Konto noch nicht eingerichtet – bitte Kenso Bescheid geben“.
|
||||||
|
|
||||||
|
### Projekt-Admin (Repo Kundenportal, project.webklar.com)
|
||||||
|
|
||||||
|
- `loginWithAppwrite` liest zusätzlich die Sitzung aus der Antwort (`set-cookie`
|
||||||
|
`a_session_<projectId>` via `headers.getSetCookie()`), damit der Server im Namen dieser Sitzung
|
||||||
|
weiterarbeiten kann.
|
||||||
|
- `POST /api/auth/login` für **Mitarbeiter**: Ist `account.mfa === true` (aus `getUserById`), wird
|
||||||
|
**keine** Portal-Sitzung gesetzt. Stattdessen:
|
||||||
|
- Challenge über die Sitzung anlegen, Eintrag in einer Map im Speicher
|
||||||
|
`{ userId, email, appwriteSessionCookie, challengeId, expiresAt: +10 min, attempts: 0 }`
|
||||||
|
unter zufälligem Schlüssel; Schlüssel als signiertes, httpOnly-Cookie `webklar_portal_mfa`.
|
||||||
|
- Antwort `{ mfaRequired: true, email: <maskiert> }`.
|
||||||
|
- `POST /api/auth/login/mfa` `{ otp }`: prüft den Code bei Appwrite (`PUT /account/mfa/challenges`
|
||||||
|
mit der gespeicherten Sitzung). Erfolg → exakt der bisherige Mitarbeiter-Zweig (Portal-Sitzung +
|
||||||
|
Preview-Cookie), Map-Eintrag + Cookie löschen. Max. 5 Fehlversuche pro Eintrag, dann Eintrag weg
|
||||||
|
→ neu anmelden.
|
||||||
|
- `POST /api/auth/login/mfa/resend`: neue Challenge für denselben Eintrag.
|
||||||
|
- Serverneustart verwirft offene Einträge → Nutzer meldet sich neu an (akzeptiert).
|
||||||
|
- Kunden-Zweig bleibt unverändert (Kunden haben `mfa = false`).
|
||||||
|
- `public/login.html` + `app.js`: zweiter Schritt mit Codefeld, gleiche Texte wie im Ticketsystem.
|
||||||
|
|
||||||
|
### Einmalige Einrichtung (Skript, nach dem Livegang beider Teile)
|
||||||
|
|
||||||
|
- Skript `scripts/mitarbeiter-2fa.mjs` im Kundenportal-Repo (läuft im Container mit dem Server-Key):
|
||||||
|
- `--status`: listet alle Mitarbeiter (Collection `employees` → `userId`) mit `emailVerification`
|
||||||
|
und `mfa`.
|
||||||
|
- `--enable [userId|alle]`: setzt `emailVerification = true`, dann `mfa = true`.
|
||||||
|
- `--disable <userId>`: Notfall-Schalter, wenn bei einer Person keine Mail ankommt.
|
||||||
|
- Vor dem Einschalten wird die E-Mail-Adresse jedes Kontos angezeigt; nur Adressen, die
|
||||||
|
tatsächlich Post empfangen, werden bestätigt.
|
||||||
|
- Wirkung: Alle bestehenden Mitarbeiter-Sitzungen fragen beim nächsten Aufruf nach dem Code.
|
||||||
|
- Keine Wiederherstellungscodes (Faktor ist das Postfach; Notfall = `--disable`).
|
||||||
|
|
||||||
|
### Code-Mail
|
||||||
|
|
||||||
|
- Appwrite-Vorlage `mfaChallenge`, Sprache `de`, als eigene Vorlage im Projekt hinterlegt
|
||||||
|
(Betreff „Dein Anmeldecode für WEBklar“, Inhalt im Stil der WEBklar-Mailvorlagen: Logo, Code groß,
|
||||||
|
„gilt 1 Stunde“, „Nicht du? Dann ändere bitte dein Passwort.“).
|
||||||
|
- Wird über die Appwrite-Console gesetzt (Auth → Templates) – der Nutzer ist dort eingeloggt; ich
|
||||||
|
bereite HTML und Betreff vor.
|
||||||
|
|
||||||
|
## Teil 2: Wechsel zwischen Ticketsystem und Projekt-Admin
|
||||||
|
|
||||||
|
### Hinweg (Ticketsystem → Projekt-Admin, ohne zweiten Login)
|
||||||
|
|
||||||
|
- `Navbar.jsx`: neuer Eintrag **„Projekt-Admin“** mit Symbol `IconExternalLink` nach „Finanzen“ /
|
||||||
|
„Admin“, für alle Mitarbeiter sichtbar. Klick → `openProjectAdmin()` → `window.location.assign(openUrl)`
|
||||||
|
(selber Tab). Während des Ladens deaktiviert; bei Fehler Fallback auf
|
||||||
|
`https://project.webklar.com/login.html`.
|
||||||
|
- Kundenportal: `POST /api/admin/switch-link` (Bearer-JWT aus dem Ticketsystem):
|
||||||
|
- eigene Prüfung statt `requireAppwriteStaff`: JWT gültig (`/account`) **und** `resolveStaffAccount`
|
||||||
|
findet einen Mitarbeiter – so kommen auch Mitarbeiter ohne Admin-Label rüber, wie beim normalen
|
||||||
|
Login.
|
||||||
|
- Antwort `{ openUrl: 'https://project.webklar.com/api/auth/staff-switch?token=…' }`, Token über
|
||||||
|
`createStaffPreviewToken` (60 s, einmalig) mit `{ userId, email, name, isAdmin, purpose: 'switch' }`.
|
||||||
|
- `GET /api/auth/staff-switch?token=…`: `consumeStaffPreviewToken`; nur `purpose === 'switch'`
|
||||||
|
akzeptiert (und `staff-preview` akzeptiert umgekehrt keine Switch-Tokens). Setzt Portal-Sitzung +
|
||||||
|
Preview-Cookie wie der Mitarbeiter-Login, Redirect `/admin.html`. Ungültig/abgelaufen → Redirect
|
||||||
|
`/login.html?error=Link abgelaufen, bitte anmelden`.
|
||||||
|
- 2FA bleibt gewahrt: Das JWT stammt aus einer Sitzung, die nach Teil 1 nur mit Code voll gültig ist.
|
||||||
|
|
||||||
|
### Rückweg (Projekt-Admin → Ticketsystem)
|
||||||
|
|
||||||
|
- `admin.html` Kopfzeile: Button **„← Ticketsystem“** (Link `https://ticket.webklar.com/tickets`)
|
||||||
|
vor „Abmelden“. Nur in der Admin-Ansicht; im Modus „Als Kunde ansehen“ und bei Kunden nicht.
|
||||||
|
- Kein automatischer Login in diese Richtung: Ist die Ticketsystem-Sitzung noch aktiv, ist man direkt
|
||||||
|
drin, sonst Login mit Code.
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
|
||||||
|
Mit nachgebautem Appwrite (Mock nach 1.8.1-Verhalten, keine echten Daten):
|
||||||
|
|
||||||
|
- Ticketsystem: Login ohne MFA unverändert; Login mit MFA → Code-Schritt; richtiger Code;
|
||||||
|
falscher Code; abgelaufener Code; erneut senden; Abbrechen; halbe Sitzung beim Neuladen (keine
|
||||||
|
automatische Mail); 429-Text; Seitenleisten-Eintrag öffnet `openUrl`, Fehler → Fallback.
|
||||||
|
- Projekt-Admin: Kunden-Login unverändert; Mitarbeiter ohne MFA unverändert; Mitarbeiter mit MFA
|
||||||
|
bekommt **keine** Portal-Sitzung vor dem Code; richtiger/falscher Code; 5 Fehlversuche; resend;
|
||||||
|
switch-link ohne/mit ungültigem JWT (401), mit halber Sitzung (401), Kunde (403), Mitarbeiter ohne
|
||||||
|
Admin-Label (200); staff-switch einmalig, abgelaufen, falscher `purpose`; Rückweg-Button nur für
|
||||||
|
Mitarbeiter und nicht im „Als Kunde ansehen“-Modus.
|
||||||
|
- Bestehende Testsuites beider Repos grün.
|
||||||
|
|
||||||
|
## Livegang (Reihenfolge)
|
||||||
|
|
||||||
|
1. Kundenportal live (Push nach `main` durch den Nutzer bzw. auf sein OK).
|
||||||
|
2. Ticketsystem live (Push nach `test` durch den Nutzer).
|
||||||
|
3. Code-Mail-Vorlage in der Appwrite-Console hinterlegen.
|
||||||
|
4. `mitarbeiter-2fa.mjs --status`, dann zuerst nur für Kenso `--enable`, einmal in beiden Systemen
|
||||||
|
durchspielen, dann `--enable alle`.
|
||||||
|
|
||||||
|
Ohne Schritt 4 ändert sich für niemanden etwas (MFA aus → Login wie bisher); Teil 2 funktioniert
|
||||||
|
schon nach Schritt 1+2.
|
||||||
|
|
||||||
|
## Nicht enthalten
|
||||||
|
|
||||||
|
- TOTP/KeePass, SMS, Wiederherstellungscodes, 2FA für Kunden.
|
||||||
|
- Automatischer Login vom Projekt-Admin zurück ins Ticketsystem.
|
||||||
|
- SDK-Upgrade des Ticketsystems.
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
# WOMS „Rechtliches“ – Konzept
|
||||||
|
|
||||||
|
Stand 2026-09-30, freigegeben im Gespräch (Umfang A, Rolle „Archiv + Überblick“, Anbieter mit Fristen).
|
||||||
|
|
||||||
|
## Ziel
|
||||||
|
|
||||||
|
Ein interner Menüpunkt **Rechtliches** (`/rechtliches`) in WOMS, der alle Rechtstexte von WEBklar mit
|
||||||
|
lückenloser Versionsgeschichte und alle Verträge mit Anbietern samt Fristen an einer Stelle zeigt.
|
||||||
|
Nur Mitarbeiter, keine Kunden. Die Texte werden weiter auf webklar.com und im Kundenportal gepflegt;
|
||||||
|
WOMS speichert feste Kopien jeder Version (Archiv, keine Quelle).
|
||||||
|
|
||||||
|
Nicht im Umfang: Firmenunterlagen, kundenbezogene Dokumente, Mail-Erinnerungen, automatische
|
||||||
|
Übernahme neuer Versionen aus den Deploys.
|
||||||
|
|
||||||
|
## Oberfläche
|
||||||
|
|
||||||
|
Seite mit zwei Reitern.
|
||||||
|
|
||||||
|
**Unsere Rechtstexte** – je Text eine Karte: AGB, Abo-Bedingungen, AVV, Datenschutz Website,
|
||||||
|
Datenschutz Portal, Impressum, Widerrufsbelehrung/-formular. Karte zeigt aktuelle Version, „gilt seit“,
|
||||||
|
Link zur Live-Seite. Klick öffnet die Versionsgeschichte (neu → alt): Nummer, gültig von/bis,
|
||||||
|
Änderungsnotiz, Datei ansehen/herunterladen. Aktuell = grün, Entwurf = graues Abzeichen.
|
||||||
|
„Neue Version“: Datei, Nummer, gültig ab, Notiz, Status. Wird eine Version gültig, bekommt die bisher
|
||||||
|
gültige automatisch `validTo` = neues `validFrom` minus 1 Tag und Status „abgelöst“.
|
||||||
|
|
||||||
|
**Verträge mit Anbietern** – Liste mit Anbieter, Zweck, Kosten, Laufzeit, Kündigungsfrist, nächster
|
||||||
|
Kündigungstermin; sortiert nach nächstem Termin. Rot ≤ 30 Tage, orange ≤ 90 Tage, grau = gekündigt/beendet,
|
||||||
|
„Fristen fehlen“ wenn Angaben unvollständig. Detailansicht mit Dateien und Notiz; Anlegen, Bearbeiten,
|
||||||
|
„Als gekündigt markieren“.
|
||||||
|
|
||||||
|
## Daten (Appwrite `woms-database`)
|
||||||
|
|
||||||
|
- `legalDocuments`: `key` (z. B. `agb`), `title`, `liveUrl`, `sort`.
|
||||||
|
- `legalVersions`: `documentKey`, `version` (Text, z. B. „v6“), `validFrom`, `validTo`,
|
||||||
|
`status` (`draft` | `current` | `superseded`), `changeNote`, `fileIds[]`.
|
||||||
|
- `providerContracts`: `provider`, `purpose`, `cost`, `costInterval` (`month` | `year`), `startDate`,
|
||||||
|
`termMonths`, `renewalMonths` (0 = keine Verlängerung), `noticeValue` + `noticeUnit` (`days` | `months`),
|
||||||
|
`cancelledAt`, `endsAt`, `note`, `fileIds[]`.
|
||||||
|
|
||||||
|
Bucket `legal-files`: PDF, HTML, Bilder, DOC/DOCX, max. 20 MB.
|
||||||
|
Rechte: `users` dürfen lesen, anlegen, bearbeiten. Kein Löschen bei Versionen und Dateien (Archiv bleibt
|
||||||
|
vollständig); Anbieter-Verträge dürfen gelöscht werden.
|
||||||
|
Anlage per Setup-Skript (`scripts/setup-legal.mjs`, idempotent wie `setup-woms-appwrite.mjs`),
|
||||||
|
braucht einmal einen Appwrite-API-Key.
|
||||||
|
|
||||||
|
## Code
|
||||||
|
|
||||||
|
- `src/lib/legal.js`: `nextCancellationDate(contract, today)`, `deadlineTone(date, today)`,
|
||||||
|
`supersedePrevious(versions, newVersion)`; reine Funktionen.
|
||||||
|
- `src/hooks/useLegal.js`: Laden/Speichern der drei Sammlungen, Datei-Upload/-Link über Appwrite Storage.
|
||||||
|
- `src/pages/LegalPage.jsx` mit den Reitern; Route und Menüpunkt in `App.jsx`/`Navbar.jsx`.
|
||||||
|
|
||||||
|
`nextCancellationDate`: Ende der laufenden Periode = Start + Laufzeit, danach je + Verlängerung, bis das
|
||||||
|
Periodenende nach heute liegt; Termin = Periodenende minus Kündigungsfrist (Monatsende korrekt geklemmt,
|
||||||
|
z. B. 31.01. + 1 Monat = 28./29.02.). Liegt der Termin schon vorbei, zählt die nächste Periode.
|
||||||
|
Ohne Verlängerung: Vertragsende, danach „beendet“. Gekündigt: kein Termin, grau. Fehlende Angaben: `null`
|
||||||
|
→ „Fristen fehlen“.
|
||||||
|
|
||||||
|
## Erstbefüllung
|
||||||
|
|
||||||
|
Skript `scripts/seed-legal.mjs`: Versionen aus der Git-Geschichte von webklar.com (`JUSN/Webklar`) und
|
||||||
|
dem Kundenportal rekonstruieren (je live gegangene Fassung eine Version, Datum = Commit auf main,
|
||||||
|
gespeichert als HTML/PDF). Die Versionsliste bekommt der Nutzer **vor dem Eintragen** zur Prüfung,
|
||||||
|
damit die Nummerierung (AGB aktuell „v6“) zu seiner passt. Nicht-live-Stände (z. B. Abo-Bedingungen v4)
|
||||||
|
als `draft`. Anbieter Hetzner (Server, Mail), Porkbun, Stripe als Einträge ohne geratene Fristen/Preise.
|
||||||
|
|
||||||
|
## Test und Auslieferung
|
||||||
|
|
||||||
|
Unit-Tests für `lib/legal.js` (Monatsende, Schaltjahr, keine Verlängerung, gekündigt, fehlende Angaben,
|
||||||
|
Ablösung). Playwright-Test gegen Vite-Build mit gemocktem Appwrite (Reiter, Karte, Versionsgeschichte,
|
||||||
|
neue Version löst alte ab, Farben der Fristen). Worktree `dev-rechtliches`, Branch `feature/rechtliches`;
|
||||||
|
live erst nach OK des Nutzers per `push … :test`.
|
||||||
@@ -0,0 +1,198 @@
|
|||||||
|
# Serverpuls – Server-Monitoring in WOMS
|
||||||
|
|
||||||
|
Stand: 2026-09-30 · Status: Design vom Nutzer im Chat freigegeben, Spec zur Prüfung
|
||||||
|
|
||||||
|
## Ziel
|
||||||
|
|
||||||
|
Ein neuer Navbar-Eintrag **Serverpuls** in WOMS (ticket.webklar.com) zeigt Admins die
|
||||||
|
Auslastung des Servers und das Wachstum der einzelnen Projekte über Tage, Wochen und
|
||||||
|
Monate – als Verlaufskurven „wie bei Aktien“. Feste Warnregeln (keine KI) melden
|
||||||
|
Probleme per E-Mail in drei Stufen.
|
||||||
|
|
||||||
|
Ausdrücklich **nicht KI-gesteuert**: Messung, Auswertung und Mails laufen
|
||||||
|
deterministisch in einem kleinen Dienst ohne Claude.
|
||||||
|
|
||||||
|
## Rahmenbedingungen
|
||||||
|
|
||||||
|
- Server: 8 Kerne, 15 GB RAM, 4 GB Swap (am 2026-09-30 voll), Platte 150 GB (76 % belegt),
|
||||||
|
~61 Container. Der Dienst selbst muss sehr sparsam sein (Limit 128 MB RAM, 0,5 CPU).
|
||||||
|
- WOMS ist eine statische React/Vite-SPA auf Appwrite; Server-Logik liegt in kleinen
|
||||||
|
Node-Diensten hinter dem WOMS-nginx (Vorbild: `ticket-integrations`,
|
||||||
|
`/api/integrations/`, Auth über Appwrite-JWT).
|
||||||
|
- Admin in WOMS = Appwrite-Konto mit Label `admin` (`AuthContext.jsx`).
|
||||||
|
- Der Deploy-Webhook von WOMS deployt jeden gepushten Branch; live geht nur per Push
|
||||||
|
des Nutzers nach `test`.
|
||||||
|
|
||||||
|
## Entscheidungen
|
||||||
|
|
||||||
|
| Frage | Entscheidung |
|
||||||
|
|---|---|
|
||||||
|
| Name | Serverpuls |
|
||||||
|
| Rolle der KI | keine; feste Warnregeln |
|
||||||
|
| „Projekt“ | jede App / jeder Container (Previews als eigene Apps) mit CPU, RAM, Speicher |
|
||||||
|
| Warnkanal | E-Mail in drei Stufen Low / Medium / Critical |
|
||||||
|
| Mail-Takt | Critical sofort, Medium Sammelmail täglich 07:00, Low Wochenübersicht Mo 07:00 |
|
||||||
|
| Mail-Adresse | `server@webklar.com` ist Absender **und** einziger Empfänger |
|
||||||
|
| Umsetzung | eigener schlanker Dienst (kein Beszel, kein Netdata) |
|
||||||
|
| Sichtbarkeit | nur Admins (Navbar und API) |
|
||||||
|
|
||||||
|
## Architektur
|
||||||
|
|
||||||
|
```
|
||||||
|
Host /proc (ro) ──┐
|
||||||
|
docker-socket-proxy (nur GET containers/stats) ──┼──> serverpuls (Node 22, SQLite) ──> SMTP server@
|
||||||
|
/home/webklar/apps + Docker-Volumes (ro) ──┘ │
|
||||||
|
└── HTTP :8091 <── WOMS-nginx /api/serverpuls/ <── ServerpulsPage (uPlot)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Einheiten
|
||||||
|
|
||||||
|
1. **Collector** (`collect/`): liest Messwerte, gibt reine Datenobjekte zurück.
|
||||||
|
- `host.js` – `/proc/stat` (CPU % aus Differenz), `/proc/meminfo` (RAM verfügbar,
|
||||||
|
Swap), `/proc/loadavg`, Zombies = Prozesse mit State `Z` in `/proc/*/stat`.
|
||||||
|
Plattenbelegung `/` per `statfs` auf `/host/apps` (gleiches Dateisystem `/dev/sda1`).
|
||||||
|
- `docker.js` – über den Socket-Proxy: Container-Liste (Name, Compose-Projekt/-Service,
|
||||||
|
Status, Health, RestartCount) und `stats?stream=false` (CPU %, RAM).
|
||||||
|
- `sizes.js` – Größe pro App: Ordner unter `/home/webklar/apps/<app>` plus Docker-
|
||||||
|
Volumes der Container dieser App (`du -sb`, unter `nice -n 19 ionice -c3`).
|
||||||
|
Außerdem „Aufräumbar“: ungenutzte Images, Build-Cache, gestoppte Container
|
||||||
|
(`/system/df` über den Proxy).
|
||||||
|
2. **App-Zuordnung** (`apps.js`): Container → App über das Label
|
||||||
|
`com.docker.compose.service` bzw. den Containernamen; eine kleine Mapping-Datei
|
||||||
|
`config/apps.json` erlaubt Umbenennen/Zusammenfassen (z. B. `webklar-ticket-*` →
|
||||||
|
„Ticketsystem“) und Ordnerzuordnung. Previews erscheinen einzeln.
|
||||||
|
3. **Speicher** (`store.js`): SQLite (`node:sqlite`) im Volume `serverpuls-data`.
|
||||||
|
- Tabellen: `host_samples`, `app_samples`, `app_sizes`, `cleanup_samples`,
|
||||||
|
`alerts` (Zustand), `mail_queue`.
|
||||||
|
- Aufbewahrung: Rohwerte (5 min) 7 Tage → Stundenmittel/-max 90 Tage →
|
||||||
|
Tageswerte unbegrenzt. Verdichtung täglich 03:30.
|
||||||
|
- Erwartete Größe < 100 MB/Jahr.
|
||||||
|
4. **Regeln** (`rules.js`): reine Funktion `(aktuelle + historische Werte) → Liste aktiver
|
||||||
|
Befunde {id, level, titel, wert, seit}`. Schwellen in `config/rules.json`.
|
||||||
|
5. **Alarmierung** (`alerts.js`): vergleicht Befunde mit gespeichertem Zustand, erzeugt
|
||||||
|
Mails (sofort/täglich/wöchentlich), Wiederholungssperre 24 h, „✅ behoben“-Mail beim
|
||||||
|
Verschwinden. Zustand in SQLite → Neustart erzeugt keine Doppel-Mails.
|
||||||
|
6. **Mailer** (`mail.js`): nodemailer, `mail.your-server.de:587` STARTTLS, Login
|
||||||
|
`server@webklar.com`. Fehlgeschlagene Mails bleiben in `mail_queue` und werden
|
||||||
|
alle 5 min erneut versucht (max. 24 h).
|
||||||
|
7. **API** (`api.js`): HTTP-Server Port 8091, Basis `/api/serverpuls`. Jede Anfrage
|
||||||
|
(außer `/health`) braucht `X-Appwrite-JWT`; der Dienst fragt `/account` bei Appwrite
|
||||||
|
ab (Cache 60 s) und verlangt Label `admin`, sonst 401/403.
|
||||||
|
8. **Scheduler** (`main.js`): 5-min-Takt, nächtliche Größenmessung 03:00, Verdichtung
|
||||||
|
03:30, Medium-Digest täglich 07:00, Low-Wochenübersicht Mo 07:00 (Europe/Berlin).
|
||||||
|
|
||||||
|
### Messung
|
||||||
|
|
||||||
|
- Alle 5 Minuten: Server gesamt (CPU %, Load 1/5/15, RAM verfügbar, Swap belegt,
|
||||||
|
Platte `/`, Zombies) und pro Container (CPU %, RAM, Status, Neustarts).
|
||||||
|
- Täglich 03:00: Größe pro App und „Aufräumbar“-Werte.
|
||||||
|
- Fällt eine Messung aus, wird **kein** Wert geschrieben (Lücke statt falscher Null).
|
||||||
|
|
||||||
|
## Warnregeln
|
||||||
|
|
||||||
|
Wichtige Container („kritisch“): Traefik, Appwrite, Kundenportal, Ticketsystem,
|
||||||
|
ticket-integrations, Gitea, InvoiceNinja, n8n (Liste in `config/rules.json`).
|
||||||
|
|
||||||
|
**🔴 Critical – sofortige Mail**
|
||||||
|
- Platte `/` ≥ 90 %
|
||||||
|
- RAM verfügbar < 500 MB **und** Swap ≥ 90 %, 10 min lang
|
||||||
|
- Load (5 min) > 24, 15 min lang
|
||||||
|
- kritischer Container läuft nicht oder > 3 Neustarts pro Stunde
|
||||||
|
- Zombies ≥ 100
|
||||||
|
|
||||||
|
**🟠 Medium – Sammelmail täglich 07:00**
|
||||||
|
- Platte `/` ≥ 80 %
|
||||||
|
- Swap ≥ 75 % oder RAM verfügbar < 1,5 GB, jeweils 1 h lang
|
||||||
|
- Zombies ≥ 20
|
||||||
|
- App wächst in 7 Tagen um > 20 % oder > 2 GB
|
||||||
|
- Load (5 min) > 8, 1 h lang
|
||||||
|
- nicht-kritischer Container abgestürzt (exited ≠ 0 oder Restart-Schleife)
|
||||||
|
|
||||||
|
**🟡 Low – Wochenübersicht Mo 07:00**
|
||||||
|
- ungenutzte Docker-Images > 10 GB oder Build-Cache > 3 GB
|
||||||
|
- App wächst in der Woche um > 10 %
|
||||||
|
- Zombies (≥ 1) halten sich > 24 h
|
||||||
|
- immer enthalten: Top 5 größte Apps, Top 5 schnellstes Wachstum, Top 5 RAM
|
||||||
|
|
||||||
|
**Allgemein**
|
||||||
|
- Dieselbe Warnung (gleiche `id`) höchstens 1× pro 24 h erneut gemeldet.
|
||||||
|
- Beim Verschwinden: Mail „✅ behoben“ (in derselben Taktung wie die Stufe; bei
|
||||||
|
Critical sofort).
|
||||||
|
- Alle aktiven Warnungen stehen jederzeit auf der Seite.
|
||||||
|
- Wird eine Warnung höher eingestuft (Medium → Critical), gilt sofort die höhere Stufe.
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
Alle Antworten JSON, Zeitstempel ISO/UTC.
|
||||||
|
|
||||||
|
| Methode + Pfad | Inhalt |
|
||||||
|
|---|---|
|
||||||
|
| `GET /health` | ohne Auth; `{ok, lastSample}` |
|
||||||
|
| `GET /overview` | aktuelle Serverwerte, 24-h-Minikurven, Trend ggü. gestern, aktive Warnungen, Zeitpunkt der letzten Messung |
|
||||||
|
| `GET /host?metric=cpu\|ram\|swap\|load\|disk\|zombies&range=24h\|7d\|30d\|90d\|1y` | Zeitreihe; Auflösung abhängig vom Zeitraum |
|
||||||
|
| `GET /apps` | Tabelle: Name, CPU %, RAM, Speicher, Δ 7 T, Δ 30 T, Speicher-Minikurve (30 T) |
|
||||||
|
| `GET /apps/:id?range=…` | Zeitreihen Speicher, RAM, CPU für eine App |
|
||||||
|
| `GET /cleanup` | ungenutzte Images, Build-Cache, gestoppte Container mit Größe |
|
||||||
|
|
||||||
|
Nur lesend. Es gibt **keine** Endpunkte zum Löschen, Stoppen oder Ändern.
|
||||||
|
|
||||||
|
## WOMS-Seite „Serverpuls“
|
||||||
|
|
||||||
|
- Navbar-Eintrag mit Pulssymbol, nur für `isAdmin`; roter/oranger Punkt bei aktiver
|
||||||
|
Critical/Medium-Warnung (aus `/overview`, beim Laden der App und alle 5 min).
|
||||||
|
- Route `/serverpuls`; Nicht-Admins werden umgeleitet.
|
||||||
|
- Aufbau:
|
||||||
|
1. **Kopf mit Ampel**: 🟢 Alles ok / 🟠 n Warnungen / 🔴 Critical, darunter die
|
||||||
|
aktiven Warnungen (Stufe, seit wann, Wert). Hinweis „letzte Messung vor X Min.“;
|
||||||
|
gelb, wenn älter als 15 min.
|
||||||
|
2. **Kacheln**: CPU, Load, RAM, Swap, Platte, Zombies – aktueller Wert, 24-h-Minikurve,
|
||||||
|
Trend ggü. gestern.
|
||||||
|
3. **Großes Diagramm** (uPlot): Zeitraum 24 h / 7 T / 30 T / 90 T / 1 J, Wert
|
||||||
|
wählbar, Tooltip mit exaktem Wert.
|
||||||
|
4. **Tabelle „Projekte“**: sortierbar, Suchfeld, Δ-Spalten grün/rot mit Pfeil,
|
||||||
|
Minikurve; Klick öffnet Detaildiagramm der App.
|
||||||
|
5. **„Aufräumbar“**: reine Anzeige.
|
||||||
|
- Aktualisiert sich jede Minute, solange sichtbar. Handy: Kacheln untereinander.
|
||||||
|
- Neue Abhängigkeit: `uplot`. Lockfile wie bisher in einem Wegwerf-`node:20-alpine`
|
||||||
|
erzeugen (Deploy-Image).
|
||||||
|
|
||||||
|
## Betrieb / Deploy
|
||||||
|
|
||||||
|
- Code: `/home/webklar/apps/serverpuls/` (eigenes Git-Repo, nur lokal).
|
||||||
|
- `docker-compose.yml` (Backup vorher): Dienste `serverpuls` (`node:22-alpine`,
|
||||||
|
`mem_limit: 128m`, `cpus: 0.5`, `init: true`; Host-`/proc` wird als `/host/proc:ro` gemountet,
|
||||||
|
kein `pid: host`) und `serverpuls-docker-proxy`
|
||||||
|
(`tecnativa/docker-socket-proxy`, nur lesend: `CONTAINERS=1`, `IMAGES=1`, `SYSTEM=1`
|
||||||
|
für `/system/df`, `POST=0`), beide im `webklar-network`, ohne Traefik-Route.
|
||||||
|
- Mounts serverpuls: `/proc:/host/proc:ro`, `/home/webklar/apps:/host/apps:ro`,
|
||||||
|
`/var/lib/docker/volumes:/host/volumes:ro`, `serverpuls-data:/data`.
|
||||||
|
- `.env`: `SERVERPULS_SMTP_USER=server@webklar.com`, `SERVERPULS_SMTP_PASS` – vom
|
||||||
|
Nutzer über eine Erweiterung von `scripts/mail-zugang.py` gesetzt (Claude sieht das
|
||||||
|
Passwort nicht).
|
||||||
|
- WOMS-nginx: `location /api/serverpuls/` → `http://serverpuls:8091` (wie
|
||||||
|
`/api/integrations/`).
|
||||||
|
- WOMS-Code auf `feature/serverpuls` (Worktree `dev-serverpuls`, Basis `origin/test`).
|
||||||
|
Live erst nach Push des Nutzers.
|
||||||
|
|
||||||
|
## Fehlerbehandlung
|
||||||
|
|
||||||
|
- Collector-Teilfehler (z. B. Proxy nicht erreichbar) → betroffene Werte fehlen, Rest
|
||||||
|
wird gespeichert; Fehler im Log.
|
||||||
|
- Größenmessung hat Zeitlimit (30 min); bricht sie ab, bleiben die Vortageswerte stehen
|
||||||
|
und die Seite zeigt deren Datum.
|
||||||
|
- SMTP-Fehler → `mail_queue`, erneuter Versuch alle 5 min bis 24 h.
|
||||||
|
- Appwrite nicht erreichbar → API 502, Seite zeigt Fehlerhinweis.
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
|
||||||
|
- Unit: Regeln (Schwellen, Dauerbedingungen, Hoch-/Herabstufung, Wiederholungssperre,
|
||||||
|
behoben), Verdichtung, Wachstumsberechnung, `/proc`-Parser mit Beispieldateien.
|
||||||
|
- API: gemocktes Appwrite (Admin → 200, ohne Label → 403, ohne JWT → 401).
|
||||||
|
- UI: bewährtes esbuild-/Playwright-Harness unter RAM-Limit mit API-Fixtures.
|
||||||
|
- Live-Check: Container-RAM < 128 MB, erste Messwerte, Test-Mail an server@.
|
||||||
|
|
||||||
|
## Nicht enthalten
|
||||||
|
|
||||||
|
- Keine Aktionen (Löschen, Neustarten) aus der Seite heraus.
|
||||||
|
- Keine KI-Auswertung.
|
||||||
|
- Keine automatischen Tickets (Warnungen nur per Mail und auf der Seite).
|
||||||
+1
-2
@@ -3,8 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>NetWEB Systems WOMS 2.0</title>
|
<title>Webklar WOMS 2.0</title>
|
||||||
<link href="https://fonts.googleapis.com/css?family=Lato|Open+Sans" rel="stylesheet">
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
|
|||||||
+16
-1
@@ -1 +1,16 @@
|
|||||||
../baseline-browser-mapping/dist/cli.js
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*)
|
||||||
|
if command -v cygpath > /dev/null 2>&1; then
|
||||||
|
basedir=`cygpath -w "$basedir"`
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
exec "$basedir/node" "$basedir/../baseline-browser-mapping/dist/cli.js" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../baseline-browser-mapping/dist/cli.js" "$@"
|
||||||
|
fi
|
||||||
+16
-1
@@ -1 +1,16 @@
|
|||||||
../browserslist/cli.js
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*)
|
||||||
|
if command -v cygpath > /dev/null 2>&1; then
|
||||||
|
basedir=`cygpath -w "$basedir"`
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
exec "$basedir/node" "$basedir/../browserslist/cli.js" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../browserslist/cli.js" "$@"
|
||||||
|
fi
|
||||||
+16
-1
@@ -1 +1,16 @@
|
|||||||
../esbuild/bin/esbuild
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*)
|
||||||
|
if command -v cygpath > /dev/null 2>&1; then
|
||||||
|
basedir=`cygpath -w "$basedir"`
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
exec "$basedir/node" "$basedir/../esbuild/bin/esbuild" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../esbuild/bin/esbuild" "$@"
|
||||||
|
fi
|
||||||
+16
-1
@@ -1 +1,16 @@
|
|||||||
../jsesc/bin/jsesc
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*)
|
||||||
|
if command -v cygpath > /dev/null 2>&1; then
|
||||||
|
basedir=`cygpath -w "$basedir"`
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
exec "$basedir/node" "$basedir/../jsesc/bin/jsesc" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../jsesc/bin/jsesc" "$@"
|
||||||
|
fi
|
||||||
+16
-1
@@ -1 +1,16 @@
|
|||||||
../json5/lib/cli.js
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*)
|
||||||
|
if command -v cygpath > /dev/null 2>&1; then
|
||||||
|
basedir=`cygpath -w "$basedir"`
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
exec "$basedir/node" "$basedir/../json5/lib/cli.js" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../json5/lib/cli.js" "$@"
|
||||||
|
fi
|
||||||
+16
-1
@@ -1 +1,16 @@
|
|||||||
../loose-envify/cli.js
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*)
|
||||||
|
if command -v cygpath > /dev/null 2>&1; then
|
||||||
|
basedir=`cygpath -w "$basedir"`
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
exec "$basedir/node" "$basedir/../loose-envify/cli.js" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../loose-envify/cli.js" "$@"
|
||||||
|
fi
|
||||||
+16
-1
@@ -1 +1,16 @@
|
|||||||
../nanoid/bin/nanoid.cjs
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*)
|
||||||
|
if command -v cygpath > /dev/null 2>&1; then
|
||||||
|
basedir=`cygpath -w "$basedir"`
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
exec "$basedir/node" "$basedir/../nanoid/bin/nanoid.cjs" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../nanoid/bin/nanoid.cjs" "$@"
|
||||||
|
fi
|
||||||
+16
-1
@@ -1 +1,16 @@
|
|||||||
../@babel/parser/bin/babel-parser.js
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*)
|
||||||
|
if command -v cygpath > /dev/null 2>&1; then
|
||||||
|
basedir=`cygpath -w "$basedir"`
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
exec "$basedir/node" "$basedir/../@babel/parser/bin/babel-parser.js" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../@babel/parser/bin/babel-parser.js" "$@"
|
||||||
|
fi
|
||||||
+16
-1
@@ -1 +1,16 @@
|
|||||||
../rollup/dist/bin/rollup
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*)
|
||||||
|
if command -v cygpath > /dev/null 2>&1; then
|
||||||
|
basedir=`cygpath -w "$basedir"`
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
exec "$basedir/node" "$basedir/../rollup/dist/bin/rollup" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../rollup/dist/bin/rollup" "$@"
|
||||||
|
fi
|
||||||
+16
-1
@@ -1 +1,16 @@
|
|||||||
../semver/bin/semver.js
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*)
|
||||||
|
if command -v cygpath > /dev/null 2>&1; then
|
||||||
|
basedir=`cygpath -w "$basedir"`
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
exec "$basedir/node" "$basedir/../semver/bin/semver.js" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../semver/bin/semver.js" "$@"
|
||||||
|
fi
|
||||||
+16
-1
@@ -1 +1,16 @@
|
|||||||
../update-browserslist-db/cli.js
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*)
|
||||||
|
if command -v cygpath > /dev/null 2>&1; then
|
||||||
|
basedir=`cygpath -w "$basedir"`
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
exec "$basedir/node" "$basedir/../update-browserslist-db/cli.js" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../update-browserslist-db/cli.js" "$@"
|
||||||
|
fi
|
||||||
+16
-1
@@ -1 +1,16 @@
|
|||||||
../vite/bin/vite.js
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*)
|
||||||
|
if command -v cygpath > /dev/null 2>&1; then
|
||||||
|
basedir=`cygpath -w "$basedir"`
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
exec "$basedir/node" "$basedir/../vite/bin/vite.js" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../vite/bin/vite.js" "$@"
|
||||||
|
fi
|
||||||
+162
-22
@@ -32,6 +32,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.5.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.5.tgz",
|
||||||
"integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==",
|
"integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/code-frame": "^7.27.1",
|
"@babel/code-frame": "^7.27.1",
|
||||||
"@babel/generator": "^7.28.5",
|
"@babel/generator": "^7.28.5",
|
||||||
@@ -275,17 +276,17 @@
|
|||||||
"node": ">=6.9.0"
|
"node": ">=6.9.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/darwin-arm64": {
|
"node_modules/@esbuild/win32-x64": {
|
||||||
"version": "0.21.5",
|
"version": "0.21.5",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz",
|
||||||
"integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==",
|
"integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"x64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
"darwin"
|
"win32"
|
||||||
],
|
],
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
@@ -350,19 +351,58 @@
|
|||||||
"integrity": "sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA==",
|
"integrity": "sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@rollup/rollup-darwin-arm64": {
|
"node_modules/@rollup/rollup-win32-x64-gnu": {
|
||||||
"version": "4.53.5",
|
"version": "4.53.5",
|
||||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.53.5.tgz",
|
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.53.5.tgz",
|
||||||
"integrity": "sha512-S87zZPBmRO6u1YXQLwpveZm4JfPpAa6oHBX7/ghSiGH3rz/KDgAu1rKdGutV+WUI6tKDMbaBJomhnT30Y2t4VQ==",
|
"integrity": "sha512-2NqKgZSuLH9SXBBV2dWNRCZmocgSOx8OJSdpRaEcRlIfX8YrKxUT6z0F1NpvDVhOsl190UFTRh2F2WDWWCYp3A==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"x64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
"darwin"
|
"win32"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"node_modules/@rollup/rollup-win32-x64-msvc": {
|
||||||
|
"version": "4.53.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.53.5.tgz",
|
||||||
|
"integrity": "sha512-JRpZUhCfhZ4keB5v0fe02gQJy05GqboPOaxvjugW04RLSYYoB/9t2lx2u/tMs/Na/1NXfY8QYjgRljRpN+MjTQ==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"node_modules/@tabler/icons": {
|
||||||
|
"version": "3.36.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tabler/icons/-/icons-3.36.0.tgz",
|
||||||
|
"integrity": "sha512-z9OfTEG6QbaQWM9KBOxxUdpgvMUn0atageXyiaSc2gmYm51ORO8Ua7eUcjlks+Dc0YMK4rrodAFdK9SfjJ4ZcA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/codecalm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@tabler/icons-react": {
|
||||||
|
"version": "3.36.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tabler/icons-react/-/icons-react-3.36.0.tgz",
|
||||||
|
"integrity": "sha512-sSZ00bEjTdTTskVFykq294RJq+9cFatwy4uYa78HcYBCXU1kSD1DIp5yoFsQXmybkIOKCjp18OnhAYk553UIfQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@tabler/icons": "3.36.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/codecalm"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": ">= 16"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/babel__core": {
|
"node_modules/@types/babel__core": {
|
||||||
"version": "7.20.5",
|
"version": "7.20.5",
|
||||||
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",
|
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",
|
||||||
@@ -421,6 +461,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.27.tgz",
|
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.27.tgz",
|
||||||
"integrity": "sha512-cisd7gxkzjBKU2GgdYrTdtQx1SORymWyaAFhaxQPK9bYO9ot3Y5OikQRvY0VYQtvwjeQnizCINJAenh/V7MK2w==",
|
"integrity": "sha512-cisd7gxkzjBKU2GgdYrTdtQx1SORymWyaAFhaxQPK9bYO9ot3Y5OikQRvY0VYQtvwjeQnizCINJAenh/V7MK2w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/prop-types": "*",
|
"@types/prop-types": "*",
|
||||||
"csstype": "^3.2.2"
|
"csstype": "^3.2.2"
|
||||||
@@ -497,6 +538,7 @@
|
|||||||
"url": "https://github.com/sponsors/ai"
|
"url": "https://github.com/sponsors/ai"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"baseline-browser-mapping": "^2.9.0",
|
"baseline-browser-mapping": "^2.9.0",
|
||||||
"caniuse-lite": "^1.0.30001759",
|
"caniuse-lite": "^1.0.30001759",
|
||||||
@@ -543,6 +585,15 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"node_modules/clsx": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
|
||||||
|
"integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/combined-stream": {
|
"node_modules/combined-stream": {
|
||||||
"version": "1.0.8",
|
"version": "1.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||||
@@ -737,18 +788,31 @@
|
|||||||
"node": ">= 0.12"
|
"node": ">= 0.12"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/fsevents": {
|
"node_modules/framer-motion": {
|
||||||
"version": "2.3.3",
|
"version": "12.23.26",
|
||||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-12.23.26.tgz",
|
||||||
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
"integrity": "sha512-cPcIhgR42xBn1Uj+PzOyheMtZ73H927+uWPDVhUMqxy8UHt6Okavb6xIz9J/phFUHUj0OncR6UvMfJTXoc/LKA==",
|
||||||
"dev": true,
|
"license": "MIT",
|
||||||
"hasInstallScript": true,
|
"dependencies": {
|
||||||
"optional": true,
|
"motion-dom": "^12.23.23",
|
||||||
"os": [
|
"motion-utils": "^12.23.6",
|
||||||
"darwin"
|
"tslib": "^2.4.0"
|
||||||
],
|
},
|
||||||
"engines": {
|
"peerDependencies": {
|
||||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
"@emotion/is-prop-valid": "*",
|
||||||
|
"react": "^18.0.0 || ^19.0.0",
|
||||||
|
"react-dom": "^18.0.0 || ^19.0.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@emotion/is-prop-valid": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"react": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"react-dom": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/function-bind": {
|
"node_modules/function-bind": {
|
||||||
@@ -934,6 +998,47 @@
|
|||||||
"node": ">= 0.6"
|
"node": ">= 0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/motion": {
|
||||||
|
"version": "12.23.26",
|
||||||
|
"resolved": "https://registry.npmjs.org/motion/-/motion-12.23.26.tgz",
|
||||||
|
"integrity": "sha512-Ll8XhVxY8LXMVYTCfme27WH2GjBrCIzY4+ndr5QKxsK+YwCtOi2B/oBi5jcIbik5doXuWT/4KKDOVAZJkeY5VQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"framer-motion": "^12.23.26",
|
||||||
|
"tslib": "^2.4.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@emotion/is-prop-valid": "*",
|
||||||
|
"react": "^18.0.0 || ^19.0.0",
|
||||||
|
"react-dom": "^18.0.0 || ^19.0.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@emotion/is-prop-valid": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"react": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"react-dom": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/motion-dom": {
|
||||||
|
"version": "12.23.23",
|
||||||
|
"resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-12.23.23.tgz",
|
||||||
|
"integrity": "sha512-n5yolOs0TQQBRUFImrRfs/+6X4p3Q4n1dUEqt/H58Vx7OW6RF+foWEgmTVDhIWJIMXOuNNL0apKH2S16en9eiA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"motion-utils": "^12.23.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/motion-utils": {
|
||||||
|
"version": "12.23.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/motion-utils/-/motion-utils-12.23.6.tgz",
|
||||||
|
"integrity": "sha512-eAWoPgr4eFEOFfg2WjIsMoqJTW6Z8MTUCgn/GZ3VRpClWBdnbjryiA3ZSNLyxCTmCQx4RmYX6jX1iWHbenUPNQ==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/ms": {
|
"node_modules/ms": {
|
||||||
"version": "2.1.3",
|
"version": "2.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||||
@@ -1017,10 +1122,20 @@
|
|||||||
"node": "^10 || ^12 || >=14"
|
"node": "^10 || ^12 || >=14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/postprocessing": {
|
||||||
|
"version": "6.38.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/postprocessing/-/postprocessing-6.38.2.tgz",
|
||||||
|
"integrity": "sha512-7DwuT7Tkst41ZjSj287g7C9c5/D3Xx5rMgBosg0dadbUPoZD2HNzkadKPol1d2PJAoI9f+Jeh1/v9YfLzpFGVw==",
|
||||||
|
"license": "Zlib",
|
||||||
|
"peerDependencies": {
|
||||||
|
"three": ">= 0.157.0 < 0.183.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/react": {
|
"node_modules/react": {
|
||||||
"version": "18.3.1",
|
"version": "18.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
|
||||||
"integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==",
|
"integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"loose-envify": "^1.1.0"
|
"loose-envify": "^1.1.0"
|
||||||
},
|
},
|
||||||
@@ -1032,6 +1147,7 @@
|
|||||||
"version": "18.3.1",
|
"version": "18.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz",
|
||||||
"integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==",
|
"integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"loose-envify": "^1.1.0",
|
"loose-envify": "^1.1.0",
|
||||||
"scheduler": "^0.23.2"
|
"scheduler": "^0.23.2"
|
||||||
@@ -1173,11 +1289,34 @@
|
|||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/tailwind-merge": {
|
||||||
|
"version": "3.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-3.4.0.tgz",
|
||||||
|
"integrity": "sha512-uSaO4gnW+b3Y2aWoWfFpX62vn2sR3skfhbjsEnaBI81WD1wBLlHZe5sWf0AqjksNdYTbGBEd0UasQMT3SNV15g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/dcastil"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/three": {
|
||||||
|
"version": "0.182.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/three/-/three-0.182.0.tgz",
|
||||||
|
"integrity": "sha512-GbHabT+Irv+ihI1/f5kIIsZ+Ef9Sl5A1Y7imvS5RQjWgtTPfPnZ43JmlYI7NtCRDK9zir20lQpfg8/9Yd02OvQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peer": true
|
||||||
|
},
|
||||||
"node_modules/tr46": {
|
"node_modules/tr46": {
|
||||||
"version": "0.0.3",
|
"version": "0.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
||||||
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
|
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
|
||||||
},
|
},
|
||||||
|
"node_modules/tslib": {
|
||||||
|
"version": "2.8.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||||
|
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||||
|
"license": "0BSD"
|
||||||
|
},
|
||||||
"node_modules/update-browserslist-db": {
|
"node_modules/update-browserslist-db": {
|
||||||
"version": "1.2.3",
|
"version": "1.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz",
|
||||||
@@ -1213,6 +1352,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/vite/-/vite-5.4.21.tgz",
|
"resolved": "https://registry.npmjs.org/vite/-/vite-5.4.21.tgz",
|
||||||
"integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==",
|
"integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"esbuild": "^0.21.3",
|
"esbuild": "^0.21.3",
|
||||||
"postcss": "^8.4.43",
|
"postcss": "^8.4.43",
|
||||||
|
|||||||
+67
-25
@@ -1,91 +1,133 @@
|
|||||||
{
|
{
|
||||||
"hash": "8745a243",
|
"hash": "91e90cf6",
|
||||||
"configHash": "d74aae15",
|
"configHash": "eaf678ca",
|
||||||
"lockfileHash": "8786fedf",
|
"lockfileHash": "4b2b8d7d",
|
||||||
"browserHash": "6bc53e11",
|
"browserHash": "114e306f",
|
||||||
"optimized": {
|
"optimized": {
|
||||||
"react": {
|
"react": {
|
||||||
"src": "../../react/index.js",
|
"src": "../../react/index.js",
|
||||||
"file": "react.js",
|
"file": "react.js",
|
||||||
"fileHash": "0ccae341",
|
"fileHash": "c1394b31",
|
||||||
"needsInterop": true
|
"needsInterop": true
|
||||||
},
|
},
|
||||||
"react-dom": {
|
"react-dom": {
|
||||||
"src": "../../react-dom/index.js",
|
"src": "../../react-dom/index.js",
|
||||||
"file": "react-dom.js",
|
"file": "react-dom.js",
|
||||||
"fileHash": "b3aa3ef2",
|
"fileHash": "e0cfaa25",
|
||||||
"needsInterop": true
|
"needsInterop": true
|
||||||
},
|
},
|
||||||
"react/jsx-dev-runtime": {
|
"react/jsx-dev-runtime": {
|
||||||
"src": "../../react/jsx-dev-runtime.js",
|
"src": "../../react/jsx-dev-runtime.js",
|
||||||
"file": "react_jsx-dev-runtime.js",
|
"file": "react_jsx-dev-runtime.js",
|
||||||
"fileHash": "898bc344",
|
"fileHash": "4e6552af",
|
||||||
"needsInterop": true
|
"needsInterop": true
|
||||||
},
|
},
|
||||||
"react/jsx-runtime": {
|
"react/jsx-runtime": {
|
||||||
"src": "../../react/jsx-runtime.js",
|
"src": "../../react/jsx-runtime.js",
|
||||||
"file": "react_jsx-runtime.js",
|
"file": "react_jsx-runtime.js",
|
||||||
"fileHash": "49a33e04",
|
"fileHash": "326b9f6e",
|
||||||
"needsInterop": true
|
"needsInterop": true
|
||||||
},
|
},
|
||||||
|
"@tabler/icons-react": {
|
||||||
|
"src": "../../@tabler/icons-react/dist/esm/tabler-icons-react.mjs",
|
||||||
|
"file": "@tabler_icons-react.js",
|
||||||
|
"fileHash": "ef17992e",
|
||||||
|
"needsInterop": false
|
||||||
|
},
|
||||||
"appwrite": {
|
"appwrite": {
|
||||||
"src": "../../appwrite/dist/esm/sdk.js",
|
"src": "../../appwrite/dist/esm/sdk.js",
|
||||||
"file": "appwrite.js",
|
"file": "appwrite.js",
|
||||||
"fileHash": "1f73c770",
|
"fileHash": "e3207492",
|
||||||
|
"needsInterop": false
|
||||||
|
},
|
||||||
|
"clsx": {
|
||||||
|
"src": "../../clsx/dist/clsx.mjs",
|
||||||
|
"file": "clsx.js",
|
||||||
|
"fileHash": "438277fe",
|
||||||
"needsInterop": false
|
"needsInterop": false
|
||||||
},
|
},
|
||||||
"date-fns": {
|
"date-fns": {
|
||||||
"src": "../../date-fns/esm/index.js",
|
"src": "../../date-fns/esm/index.js",
|
||||||
"file": "date-fns.js",
|
"file": "date-fns.js",
|
||||||
"fileHash": "9fa70dfb",
|
"fileHash": "c8cdb3c6",
|
||||||
"needsInterop": false
|
"needsInterop": false
|
||||||
},
|
},
|
||||||
"date-fns/locale": {
|
"date-fns/locale": {
|
||||||
"src": "../../date-fns/esm/locale/index.js",
|
"src": "../../date-fns/esm/locale/index.js",
|
||||||
"file": "date-fns_locale.js",
|
"file": "date-fns_locale.js",
|
||||||
"fileHash": "af0a0b06",
|
"fileHash": "affdbcf7",
|
||||||
|
"needsInterop": false
|
||||||
|
},
|
||||||
|
"motion/react": {
|
||||||
|
"src": "../../motion/dist/es/react.mjs",
|
||||||
|
"file": "motion_react.js",
|
||||||
|
"fileHash": "d06adb28",
|
||||||
|
"needsInterop": false
|
||||||
|
},
|
||||||
|
"postprocessing": {
|
||||||
|
"src": "../../postprocessing/build/index.js",
|
||||||
|
"file": "postprocessing.js",
|
||||||
|
"fileHash": "a05d80d0",
|
||||||
"needsInterop": false
|
"needsInterop": false
|
||||||
},
|
},
|
||||||
"react-dom/client": {
|
"react-dom/client": {
|
||||||
"src": "../../react-dom/client.js",
|
"src": "../../react-dom/client.js",
|
||||||
"file": "react-dom_client.js",
|
"file": "react-dom_client.js",
|
||||||
"fileHash": "f6b57c12",
|
"fileHash": "35e13db7",
|
||||||
"needsInterop": true
|
"needsInterop": true
|
||||||
},
|
},
|
||||||
"react-icons/fa": {
|
"react-icons/fa": {
|
||||||
"src": "../../react-icons/fa/index.esm.js",
|
"src": "../../react-icons/fa/index.esm.js",
|
||||||
"file": "react-icons_fa.js",
|
"file": "react-icons_fa.js",
|
||||||
"fileHash": "750bb1d4",
|
"fileHash": "b39d751a",
|
||||||
"needsInterop": false
|
"needsInterop": false
|
||||||
},
|
},
|
||||||
"react-icons/fa6": {
|
"react-icons/fa6": {
|
||||||
"src": "../../react-icons/fa6/index.esm.js",
|
"src": "../../react-icons/fa6/index.esm.js",
|
||||||
"file": "react-icons_fa6.js",
|
"file": "react-icons_fa6.js",
|
||||||
"fileHash": "e0a50b57",
|
"fileHash": "ee91d98a",
|
||||||
"needsInterop": false
|
"needsInterop": false
|
||||||
},
|
},
|
||||||
"react-router-dom": {
|
"react-router-dom": {
|
||||||
"src": "../../react-router-dom/dist/index.js",
|
"src": "../../react-router-dom/dist/index.js",
|
||||||
"file": "react-router-dom.js",
|
"file": "react-router-dom.js",
|
||||||
"fileHash": "061d1fe8",
|
"fileHash": "96b74880",
|
||||||
|
"needsInterop": false
|
||||||
|
},
|
||||||
|
"tailwind-merge": {
|
||||||
|
"src": "../../tailwind-merge/dist/bundle-mjs.mjs",
|
||||||
|
"file": "tailwind-merge.js",
|
||||||
|
"fileHash": "422eebfe",
|
||||||
|
"needsInterop": false
|
||||||
|
},
|
||||||
|
"three": {
|
||||||
|
"src": "../../three/build/three.module.js",
|
||||||
|
"file": "three.js",
|
||||||
|
"fileHash": "7ea78180",
|
||||||
"needsInterop": false
|
"needsInterop": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"chunks": {
|
"chunks": {
|
||||||
"chunk-EHLE63A5": {
|
"chunk-IFCYBMKG": {
|
||||||
"file": "chunk-EHLE63A5.js"
|
"file": "chunk-IFCYBMKG.js"
|
||||||
},
|
},
|
||||||
"chunk-TOOCKHFL": {
|
"chunk-DQJKJRV5": {
|
||||||
"file": "chunk-TOOCKHFL.js"
|
"file": "chunk-DQJKJRV5.js"
|
||||||
},
|
},
|
||||||
"chunk-TYILIMWK": {
|
"chunk-PJEEZAML": {
|
||||||
"file": "chunk-TYILIMWK.js"
|
"file": "chunk-PJEEZAML.js"
|
||||||
},
|
},
|
||||||
"chunk-CANBAPAS": {
|
"chunk-6PXSGDAH": {
|
||||||
"file": "chunk-CANBAPAS.js"
|
"file": "chunk-6PXSGDAH.js"
|
||||||
},
|
},
|
||||||
"chunk-5WRI5ZAA": {
|
"chunk-DRWLMN53": {
|
||||||
"file": "chunk-5WRI5ZAA.js"
|
"file": "chunk-DRWLMN53.js"
|
||||||
|
},
|
||||||
|
"chunk-SJKHQ62W": {
|
||||||
|
"file": "chunk-SJKHQ62W.js"
|
||||||
|
},
|
||||||
|
"chunk-G3PMV62Z": {
|
||||||
|
"file": "chunk-G3PMV62Z.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
__commonJS,
|
__commonJS,
|
||||||
__toESM
|
__toESM
|
||||||
} from "./chunk-5WRI5ZAA.js";
|
} from "./chunk-G3PMV62Z.js";
|
||||||
|
|
||||||
// node_modules/isomorphic-form-data/lib/browser.js
|
// node_modules/isomorphic-form-data/lib/browser.js
|
||||||
var require_browser = __commonJS({
|
var require_browser = __commonJS({
|
||||||
|
|||||||
-31
@@ -1,31 +0,0 @@
|
|||||||
var __create = Object.create;
|
|
||||||
var __defProp = Object.defineProperty;
|
|
||||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
||||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
||||||
var __getProtoOf = Object.getPrototypeOf;
|
|
||||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
||||||
var __commonJS = (cb, mod) => function __require() {
|
|
||||||
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
||||||
};
|
|
||||||
var __copyProps = (to, from, except, desc) => {
|
|
||||||
if (from && typeof from === "object" || typeof from === "function") {
|
|
||||||
for (let key of __getOwnPropNames(from))
|
|
||||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
||||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
||||||
}
|
|
||||||
return to;
|
|
||||||
};
|
|
||||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
||||||
// If the importer is in node compatibility mode or this is not an ESM
|
|
||||||
// file that has been converted to a CommonJS file using a Babel-
|
|
||||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
||||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
||||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
||||||
mod
|
|
||||||
));
|
|
||||||
|
|
||||||
export {
|
|
||||||
__commonJS,
|
|
||||||
__toESM
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=chunk-5WRI5ZAA.js.map
|
|
||||||
-7
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"sources": [],
|
|
||||||
"sourcesContent": [],
|
|
||||||
"mappings": "",
|
|
||||||
"names": []
|
|
||||||
}
|
|
||||||
-1906
File diff suppressed because it is too large.
Load diff
-7
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"sources": ["../../react/cjs/react.development.js", "../../react/index.js"],
|
|
||||||
"sourcesContent": ["/**\n * @license React\n * react.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var ReactVersion = '18.3.1';\n\n// ATTENTION\n// When adding new symbols to this file,\n// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'\n// The Symbol used to tag the ReactElement-like types.\nvar REACT_ELEMENT_TYPE = Symbol.for('react.element');\nvar REACT_PORTAL_TYPE = Symbol.for('react.portal');\nvar REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');\nvar REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');\nvar REACT_PROFILER_TYPE = Symbol.for('react.profiler');\nvar REACT_PROVIDER_TYPE = Symbol.for('react.provider');\nvar REACT_CONTEXT_TYPE = Symbol.for('react.context');\nvar REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');\nvar REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');\nvar REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');\nvar REACT_MEMO_TYPE = Symbol.for('react.memo');\nvar REACT_LAZY_TYPE = Symbol.for('react.lazy');\nvar REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');\nvar MAYBE_ITERATOR_SYMBOL = Symbol.iterator;\nvar FAUX_ITERATOR_SYMBOL = '@@iterator';\nfunction getIteratorFn(maybeIterable) {\n if (maybeIterable === null || typeof maybeIterable !== 'object') {\n return null;\n }\n\n var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];\n\n if (typeof maybeIterator === 'function') {\n return maybeIterator;\n }\n\n return null;\n}\n\n/**\n * Keeps track of the current dispatcher.\n */\nvar ReactCurrentDispatcher = {\n /**\n * @internal\n * @type {ReactComponent}\n */\n current: null\n};\n\n/**\n * Keeps track of the current batch's configuration such as how long an update\n * should suspend for if it needs to.\n */\nvar ReactCurrentBatchConfig = {\n transition: null\n};\n\nvar ReactCurrentActQueue = {\n current: null,\n // Used to reproduce behavior of `batchedUpdates` in legacy mode.\n isBatchingLegacy: false,\n didScheduleLegacyUpdate: false\n};\n\n/**\n * Keeps track of the current owner.\n *\n * The current owner is the component who should own any components that are\n * currently being constructed.\n */\nvar ReactCurrentOwner = {\n /**\n * @internal\n * @type {ReactComponent}\n */\n current: null\n};\n\nvar ReactDebugCurrentFrame = {};\nvar currentExtraStackFrame = null;\nfunction setExtraStackFrame(stack) {\n {\n currentExtraStackFrame = stack;\n }\n}\n\n{\n ReactDebugCurrentFrame.setExtraStackFrame = function (stack) {\n {\n currentExtraStackFrame = stack;\n }\n }; // Stack implementation injected by the current renderer.\n\n\n ReactDebugCurrentFrame.getCurrentStack = null;\n\n ReactDebugCurrentFrame.getStackAddendum = function () {\n var stack = ''; // Add an extra top frame while an element is being validated\n\n if (currentExtraStackFrame) {\n stack += currentExtraStackFrame;\n } // Delegate to the injected renderer-specific implementation\n\n\n var impl = ReactDebugCurrentFrame.getCurrentStack;\n\n if (impl) {\n stack += impl() || '';\n }\n\n return stack;\n };\n}\n\n// -----------------------------------------------------------------------------\n\nvar enableScopeAPI = false; // Experimental Create Event Handle API.\nvar enableCacheElement = false;\nvar enableTransitionTracing = false; // No known bugs, but needs performance testing\n\nvar enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber\n// stuff. Intended to enable React core members to more easily debug scheduling\n// issues in DEV builds.\n\nvar enableDebugTracing = false; // Track which Fiber(s) schedule render work.\n\nvar ReactSharedInternals = {\n ReactCurrentDispatcher: ReactCurrentDispatcher,\n ReactCurrentBatchConfig: ReactCurrentBatchConfig,\n ReactCurrentOwner: ReactCurrentOwner\n};\n\n{\n ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;\n ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;\n}\n\n// by calls to these methods by a Babel plugin.\n//\n// In PROD (or in packages without access to React internals),\n// they are left as they are instead.\n\nfunction warn(format) {\n {\n {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n prLine truncated
|
|
||||||
"mappings": "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 truncated
|
|
||||||
"names": ["ReactDebugCurrentFrame", "moduleObject", "error", "Component", "returnValue"]
|
|
||||||
}
|
|
||||||
-84
@@ -1,84 +0,0 @@
|
|||||||
import {
|
|
||||||
require_react
|
|
||||||
} from "./chunk-CANBAPAS.js";
|
|
||||||
import {
|
|
||||||
__toESM
|
|
||||||
} from "./chunk-5WRI5ZAA.js";
|
|
||||||
|
|
||||||
// node_modules/react-icons/lib/esm/iconBase.js
|
|
||||||
var import_react2 = __toESM(require_react());
|
|
||||||
|
|
||||||
// node_modules/react-icons/lib/esm/iconContext.js
|
|
||||||
var import_react = __toESM(require_react());
|
|
||||||
var DefaultContext = {
|
|
||||||
color: void 0,
|
|
||||||
size: void 0,
|
|
||||||
className: void 0,
|
|
||||||
style: void 0,
|
|
||||||
attr: void 0
|
|
||||||
};
|
|
||||||
var IconContext = import_react.default.createContext && import_react.default.createContext(DefaultContext);
|
|
||||||
|
|
||||||
// node_modules/react-icons/lib/esm/iconBase.js
|
|
||||||
var __assign = function() {
|
|
||||||
__assign = Object.assign || function(t) {
|
|
||||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
||||||
s = arguments[i];
|
|
||||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
||||||
}
|
|
||||||
return t;
|
|
||||||
};
|
|
||||||
return __assign.apply(this, arguments);
|
|
||||||
};
|
|
||||||
var __rest = function(s, e) {
|
|
||||||
var t = {};
|
|
||||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
||||||
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
||||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
||||||
}
|
|
||||||
return t;
|
|
||||||
};
|
|
||||||
function Tree2Element(tree) {
|
|
||||||
return tree && tree.map(function(node, i) {
|
|
||||||
return import_react2.default.createElement(node.tag, __assign({
|
|
||||||
key: i
|
|
||||||
}, node.attr), Tree2Element(node.child));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function GenIcon(data) {
|
|
||||||
return function(props) {
|
|
||||||
return import_react2.default.createElement(IconBase, __assign({
|
|
||||||
attr: __assign({}, data.attr)
|
|
||||||
}, props), Tree2Element(data.child));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
function IconBase(props) {
|
|
||||||
var elem = function(conf) {
|
|
||||||
var attr = props.attr, size = props.size, title = props.title, svgProps = __rest(props, ["attr", "size", "title"]);
|
|
||||||
var computedSize = size || conf.size || "1em";
|
|
||||||
var className;
|
|
||||||
if (conf.className) className = conf.className;
|
|
||||||
if (props.className) className = (className ? className + " " : "") + props.className;
|
|
||||||
return import_react2.default.createElement("svg", __assign({
|
|
||||||
stroke: "currentColor",
|
|
||||||
fill: "currentColor",
|
|
||||||
strokeWidth: "0"
|
|
||||||
}, conf.attr, attr, svgProps, {
|
|
||||||
className,
|
|
||||||
style: __assign(__assign({
|
|
||||||
color: props.color || conf.color
|
|
||||||
}, conf.style), props.style),
|
|
||||||
height: computedSize,
|
|
||||||
width: computedSize,
|
|
||||||
xmlns: "http://www.w3.org/2000/svg"
|
|
||||||
}), title && import_react2.default.createElement("title", null, title), props.children);
|
|
||||||
};
|
|
||||||
return IconContext !== void 0 ? import_react2.default.createElement(IconContext.Consumer, null, function(conf) {
|
|
||||||
return elem(conf);
|
|
||||||
}) : elem(DefaultContext);
|
|
||||||
}
|
|
||||||
|
|
||||||
export {
|
|
||||||
GenIcon
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=chunk-EHLE63A5.js.map
|
|
||||||
-7
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"sources": ["../../react-icons/lib/esm/iconBase.js", "../../react-icons/lib/esm/iconContext.js"],
|
|
||||||
"sourcesContent": ["var __assign = this && this.__assign || function () {\n __assign = Object.assign || function (t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport React from \"react\";\nimport { IconContext, DefaultContext } from \"./iconContext\";\nfunction Tree2Element(tree) {\n return tree && tree.map(function (node, i) {\n return React.createElement(node.tag, __assign({\n key: i\n }, node.attr), Tree2Element(node.child));\n });\n}\nexport function GenIcon(data) {\n // eslint-disable-next-line react/display-name\n return function (props) {\n return React.createElement(IconBase, __assign({\n attr: __assign({}, data.attr)\n }, props), Tree2Element(data.child));\n };\n}\nexport function IconBase(props) {\n var elem = function (conf) {\n var attr = props.attr,\n size = props.size,\n title = props.title,\n svgProps = __rest(props, [\"attr\", \"size\", \"title\"]);\n var computedSize = size || conf.size || \"1em\";\n var className;\n if (conf.className) className = conf.className;\n if (props.className) className = (className ? className + \" \" : \"\") + props.className;\n return React.createElement(\"svg\", __assign({\n stroke: \"currentColor\",\n fill: \"currentColor\",\n strokeWidth: \"0\"\n }, conf.attr, attr, svgProps, {\n className: className,\n style: __assign(__assign({\n color: props.color || conf.color\n }, conf.style), props.style),\n height: computedSize,\n width: computedSize,\n xmlns: \"http://www.w3.org/2000/svg\"\n }), title && React.createElement(\"title\", null, title), props.children);\n };\n return IconContext !== undefined ? React.createElement(IconContext.Consumer, null, function (conf) {\n return elem(conf);\n }) : elem(DefaultContext);\n}", "import React from \"react\";\nexport var DefaultContext = {\n color: undefined,\n size: undefined,\n className: undefined,\n style: undefined,\n attr: undefined\n};\nexport var IconContext = React.createContext && React.createContext(DefaultContext);"],
|
|
||||||
"mappings": "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",
|
|
||||||
"names": ["import_react", "React", "React"]
|
|
||||||
}
|
|
||||||
-7261
File diff suppressed because it is too large.
Load diff
-7
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"sources": ["../../@babel/runtime/helpers/esm/typeof.js", "../../date-fns/esm/_lib/toInteger/index.js", "../../date-fns/esm/_lib/requiredArgs/index.js", "../../date-fns/esm/toDate/index.js", "../../date-fns/esm/addDays/index.js", "../../date-fns/esm/addMonths/index.js", "../../date-fns/esm/add/index.js", "../../date-fns/esm/isWeekend/index.js", "../../date-fns/esm/isSunday/index.js", "../../date-fns/esm/isSaturday/index.js", "../../date-fns/esm/addBusinessDays/index.js", "../../date-fns/esm/addMilliseconds/index.js", "../../date-fns/esm/addHours/index.js", "../../date-fns/esm/_lib/defaultOptions/index.js", "../../date-fns/esm/startOfWeek/index.js", "../../date-fns/esm/startOfISOWeek/index.js", "../../date-fns/esm/getISOWeekYear/index.js", "../../date-fns/esm/startOfISOWeekYear/index.js", "../../date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js", "../../date-fns/esm/startOfDay/index.js", "../../date-fns/esm/differenceInCalendarDays/index.js", "../../date-fns/esm/setISOWeekYear/index.js", "../../date-fns/esm/addISOWeekYears/index.js", "../../date-fns/esm/addMinutes/index.js", "../../date-fns/esm/addQuarters/index.js", "../../date-fns/esm/addSeconds/index.js", "../../date-fns/esm/addWeeks/index.js", "../../date-fns/esm/addYears/index.js", "../../date-fns/esm/areIntervalsOverlapping/index.js", "../../date-fns/esm/max/index.js", "../../date-fns/esm/min/index.js", "../../date-fns/esm/clamp/index.js", "../../date-fns/esm/closestIndexTo/index.js", "../../date-fns/esm/closestTo/index.js", "../../date-fns/esm/compareAsc/index.js", "../../date-fns/esm/compareDesc/index.js", "../../date-fns/esm/constants/index.js", "../../date-fns/esm/daysToWeeks/index.js", "../../date-fns/esm/isSameDay/index.js", "../../date-fns/esm/isDate/index.js", "../../date-fns/esm/isValid/index.js", "../../date-fns/esm/differenceInBusinessDays/index.js", "../../date-fns/esm/differenceInCalendarISOWeekYears/index.js", "../../date-fns/esm/differenceInCalendarISOWeeks/index.js", "../../date-fns/esm/differenceInCalendarMonths/index.js", "../../date-fns/esm/getQuarter/index.js", "../../date-fns/esm/differenceInCalendarQuarters/index.js", "../../date-fns/esm/differenceInCalendarWeeks/index.js", "../../date-fns/esm/differenceInCalendarYears/index.js", "../../date-fns/esm/differenceInDays/index.js", "../../date-fns/esm/differenceInMilliseconds/index.js", "../../date-fns/esm/_lib/roundingMethods/index.js", "../../date-fns/esm/differenceInHours/index.js", "../../date-fns/esm/subISOWeekYears/index.js", "../../date-fns/esm/differenceInISOWeekYears/index.js", "../../date-fns/esm/differenceInMinutes/index.js", "../../date-fns/esm/endOfDay/index.js", "../../date-fns/esm/endOfMonth/index.js", "../../date-fns/esm/isLastDayOfMonth/index.js", "../../date-fns/esm/differenceInMonths/index.js", "../../date-fns/esm/differenceInQuarters/index.js", "../../date-fns/esm/differenceInSeconds/index.js", "../../date-fns/esm/differenceInWeeks/index.js", "../../date-fns/esm/differenceInYears/index.js", "../../date-fns/esm/eachDayOfInterval/index.js", "../../date-fns/esm/eachHourOfInterval/index.js", "../../date-fns/esm/startOfMinute/index.js", "../../date-fns/esm/eachMinuteOfInterval/index.js", "../../date-fns/esm/eachMonthOfInterval/index.js", "../../date-fns/esm/startOfQuarter/index.js", "../../date-fns/esm/eachQuarterOfInterval/index.js", "../../date-fns/esm/eachWeekOfInterval/index.js", "../../date-fns/esm/eachWeekendOfInterval/index.js", "../../date-fns/esm/startOfMonth/index.js", "../../date-fns/esm/eachWeekendOfMonth/index.js", "../../date-fns/esm/endOfYear/index.js", "../../date-fns/esm/startOfYear/index.js", "../../date-fns/esm/eachWeekendOfYear/index.js", "../../date-fns/esm/eachYearOfInterval/index.js", "../../date-fns/esm/endOfDecade/index.js", "../../date-fns/esm/endOfHour/index.js", "../../date-fns/esm/endOfWeek/index.js", "../../date-fns/esm/endOfISOWeek/index.js", "../../date-fns/esm/endOfISOWeekYear/index.js", "../../date-fns/esm/endOfMinute/index.js", "../../date-fns/esm/endOfQuarter/index.js", "../../date-fns/esm/endOfSecond/index.js", "../../date-fns/esm/endOfToday/index.js", "../../date-fns/esm/endOfTomorrow/index.js", "../../date-fns/esm/endOfYesterday/index.js", "../../date-fns/esm/subMilliseconds/index.js", "../../date-fns/esm/_lib/getUTCDayOfYear/index.js", "../../date-fns/esm/_lib/startOfUTCISOWeek/index.js", "../../date-fns/esm/_lib/getUTCISOWeekYear/index.js", "../../date-fns/esm/_lib/startOfUTCISOWeekYear/index.js", "../../date-fns/esm/_lib/getUTCISOWeek/index.js", "../../date-fns/esm/_lib/startOfUTCWeek/index.js", "../../date-fns/esm/_lib/getUTCWeekYear/index.js", "../../date-fns/esm/_lib/startOfUTCWeekYear/index.js", "../../date-fns/esm/_lib/getUTCWeek/index.js", "../../date-fns/esm/_lib/addLeadingZeros/index.js", "../../date-fns/esm/_lib/format/lightFormatters/index.js", "../../date-fns/esm/_lib/format/formatters/index.js", "../../date-fns/esm/_lib/format/longFormatters/index.js", "../../date-fns/esm/_lib/protectedTokens/index.js", ".Line truncated
|
|
||||||
"sourcesContent": ["function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}\nexport { _typeof as default };", "export default function toInteger(dirtyNumber) {\n if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {\n return NaN;\n }\n var number = Number(dirtyNumber);\n if (isNaN(number)) {\n return number;\n }\n return number < 0 ? Math.ceil(number) : Math.floor(number);\n}", "export default function requiredArgs(required, args) {\n if (args.length < required) {\n throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');\n }\n}", "import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name toDate\n * @category Common Helpers\n * @summary Convert the given argument to an instance of Date.\n *\n * @description\n * Convert the given argument to an instance of Date.\n *\n * If the argument is an instance of Date, the function returns its clone.\n *\n * If the argument is a number, it is treated as a timestamp.\n *\n * If the argument is none of the above, the function returns Invalid Date.\n *\n * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.\n *\n * @param {Date|Number} argument - the value to convert\n * @returns {Date} the parsed date in the local time zone\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Clone the date:\n * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert the timestamp to date:\n * const result = toDate(1392098430000)\n * //=> Tue Feb 11 2014 11:30:30\n */\nexport default function toDate(argument) {\n requiredArgs(1, arguments);\n var argStr = Object.prototype.toString.call(argument);\n\n // Clone the date\n if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {\n // Prevent the date to lose the milliseconds when passed to new Date() in IE10\n return new Date(argument.getTime());\n } else if (typeof argument === 'number' || argStr === '[object Number]') {\n return new Date(argument);\n } else {\n if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {\n // eslint-disable-next-line no-console\n console.warn(\"Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments\");\n // eslint-disable-next-line no-console\n console.warn(new Error().stack);\n }\n return new Date(NaN);\n }\n}", "import toInteger from \"../_lib/toInteger/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name addDays\n * @category Day Helpers\n * @summary Add the specified number of days to the given date.\n *\n * @description\n * Add the specified number of days to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of days to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} - the new date with the days added\n * @throws {TypeError} - 2 arguments required\n *\n * @example\n * // Add 10 days to 1 September 2014:\n * const result = addDays(new Date(2014, 8, 1), 10)\n * //=> Thu Sep 11 2014 00:00:00\n */\nexport default function addDays(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var amount = toInteger(dirtyAmount);\n if (isNaN(amount)) {\n return new Date(NaN);\n }\n if (!amount) {\n // If 0 days, no-op to avoid changing times in the hour before end of DST\n return date;\n }\n date.setDate(date.getDate() + amount);\n return date;\n}", "import toInteger from \"../_lib/toInteger/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name addMonths\n * @category Month Helpers\n * @summary Add the specified number of months to the given date.\n *\n * @description\n * Add the specified number of months to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of months to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the months added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // ALine truncated
|
|
||||||
"mappings": "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 truncated
|
|
||||||
"names": ["o", "months", "days", "defaultOptions", "months", "days", "days", "MILLISECONDS_IN_WEEK", "defaultOptions", "MILLISECONDS_IN_DAY", "MILLISECONDS_IN_WEEK", "defaultOptions", "defaultOptions", "defaultOptions", "MILLISECONDS_IN_WEEK", "milliseconds", "formatters", "localize", "y", "M", "d", "a", "h", "H", "m", "s", "S", "dateLongFormatter", "formatLong", "timeLongFormatter", "dateTimeLongFormatter", "format", "formatDistance", "format", "formatRelative", "ordinalNumber", "valueCallback", "defaultOptions", "locale", "formatDistance", "defaultOptions", "locale", "months", "days", "MILLISECONDS_IN_MINUTE", "MINUTES_IN_DAY", "MINUTES_IN_MONTH", "defaultOptions", "locale", "milliseconds", "days", "months", "formatDistance", "defaultOptions", "locale", "format", "m", "format", "format", "months", "days", "milliseconds", "formatRelative", "defaultOptions", "locale", "lastDayOfMonth", "getDefaultOptions", "MILLISECONDS_IN_WEEK", "MILLISECONDS_IN_WEEK", "milliseconds", "MILLISECONDS_IN_DAY", "defaultOptions", "defaultOptions", "MILLISECONDS_IN_WEEK", "defaultOptions", "a", "e", "a", "t", "e", "t", "F", "r", "a", "u", "s", "e", "t", "e", "t", "e", "t", "t", "_isNativeReflectConstruct", "t", "e", "t", "e", "s", "a", "t", "e", "i", "t", "i", "e", "t", "e", "t", "Setter", "ValueSetter", "set", "DateToSystemTimezoneSetter", "Parser", "match", "EraParser", "parse", "match", "set", "YearParser", "parse", "match", "valueCallback", "set", "LocalWeekYearParser", "parse", "match", "valueCallback", "set", "ISOWeekYearParser", "parse", "set", "ExtendedYearParser", "parse", "set", "QuarterParser", "parse", "match", "set", "StandAloneQuarterParser", "parse", "match", "set", "MonthParser", "parse", "match", "valueCallback", "set", "StandAloneMonthParser", "parse", "match", "valueCallback", "set", "LocalWeekParser", "parse", "match", "set", "ISOWeekParser", "parse", "match", "set", "DateParser", "parse", "match", "isLeapYear", "set", "DayOfYearParser", "parse", "match", "isLeapYear", "set", "defaultOptions", "DayParser", "parse", "match", "set", "LocalDayParser", "parse", "match", "valueCallback", "set", "StandAloneLocalDayParser", "parse", "match", "valueCallback", "set", "ISODayParser", "parse", "match", "valueCallback", "set", "AMPMParser", "parse", "match", "set", "AMPMMidnightParser", "parse", "match", "set", "DayPeriodParser", "parse", "match", "set", "Hour1to12Parser", "parse", "match", "set", "Hour0to23Parser", "parse", "match", "set", "Hour0To11Parser", "parse", "match", "set", "Hour1To24Parser", "parse", "match", "set", "MinuteParser", "parse", "match", "set", "SecondParser", "parse", "match", "set", "FractionOfSecondParser", "parse", "valueCallback", "set", "ISOTimezoneWithZParser", "parse", "set", "ISOTimezoneParser", "parse", "set", "TimestampSecondsParser", "parse", "set", "TimestampMillisecondsParser", "parse", "set", "formattingTokensRegExp", "longFormattingTokensRegExp", "escapedStringRegExp", "doubleQuoteRegExp", "unescapedLatinCharacterRegExp", "defaultOptions", "locale", "_loop", "cleanEscapedString", "setter", "a", "b", "defaultOptions", "formattingTokensRegExp", "escapedStringRegExp", "doubleQuoteRegExp", "unescapedLatinCharacterRegExp", "cleanEscapedString", "daysInYear", "months", "days", "milliseconds", "milliseconds", "milliseconds", "months", "months", "isLeapYearIndex", "defaultOptions", "setDefaultOptions", "defaultOptions", "milliseconds", "defaultOptions", "months", "days"]
|
|
||||||
}
|
|
||||||
-21628
File diff suppressed because it is too large.
Load diff
-7
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"sources": ["../../scheduler/cjs/scheduler.development.js", "../../scheduler/index.js", "../../react-dom/cjs/react-dom.development.js", "../../react-dom/index.js"],
|
|
||||||
"sourcesContent": ["/**\n * @license React\n * scheduler.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var enableSchedulerDebugging = false;\nvar enableProfiling = false;\nvar frameYieldMs = 5;\n\nfunction push(heap, node) {\n var index = heap.length;\n heap.push(node);\n siftUp(heap, node, index);\n}\nfunction peek(heap) {\n return heap.length === 0 ? null : heap[0];\n}\nfunction pop(heap) {\n if (heap.length === 0) {\n return null;\n }\n\n var first = heap[0];\n var last = heap.pop();\n\n if (last !== first) {\n heap[0] = last;\n siftDown(heap, last, 0);\n }\n\n return first;\n}\n\nfunction siftUp(heap, node, i) {\n var index = i;\n\n while (index > 0) {\n var parentIndex = index - 1 >>> 1;\n var parent = heap[parentIndex];\n\n if (compare(parent, node) > 0) {\n // The parent is larger. Swap positions.\n heap[parentIndex] = node;\n heap[index] = parent;\n index = parentIndex;\n } else {\n // The parent is smaller. Exit.\n return;\n }\n }\n}\n\nfunction siftDown(heap, node, i) {\n var index = i;\n var length = heap.length;\n var halfLength = length >>> 1;\n\n while (index < halfLength) {\n var leftIndex = (index + 1) * 2 - 1;\n var left = heap[leftIndex];\n var rightIndex = leftIndex + 1;\n var right = heap[rightIndex]; // If the left or right node is smaller, swap with the smaller of those.\n\n if (compare(left, node) < 0) {\n if (rightIndex < length && compare(right, left) < 0) {\n heap[index] = right;\n heap[rightIndex] = node;\n index = rightIndex;\n } else {\n heap[index] = left;\n heap[leftIndex] = node;\n index = leftIndex;\n }\n } else if (rightIndex < length && compare(right, node) < 0) {\n heap[index] = right;\n heap[rightIndex] = node;\n index = rightIndex;\n } else {\n // Neither child is smaller. Exit.\n return;\n }\n }\n}\n\nfunction compare(a, b) {\n // Compare sort index first, then task id.\n var diff = a.sortIndex - b.sortIndex;\n return diff !== 0 ? diff : a.id - b.id;\n}\n\n// TODO: Use symbols?\nvar ImmediatePriority = 1;\nvar UserBlockingPriority = 2;\nvar NormalPriority = 3;\nvar LowPriority = 4;\nvar IdlePriority = 5;\n\nfunction markTaskErrored(task, ms) {\n}\n\n/* eslint-disable no-var */\n\nvar hasPerformanceNow = typeof performance === 'object' && typeof performance.now === 'function';\n\nif (hasPerformanceNow) {\n var localPerformance = performance;\n\n exports.unstable_now = function () {\n return localPerformance.now();\n };\n} else {\n var localDate = Date;\n var initialTime = localDate.now();\n\n exports.unstable_now = function () {\n return localDate.now() - initialTime;\n };\n} // Max 31 bit integer. The max integer size in V8 for 32-bit systems.\n// Math.pow(2, 30) - 1\n// 0b111111111111111111111111111111\n\n\nvar maxSigned31BitInt = 1073741823; // Times out immediately\n\nvar IMMEDIATE_PRIORITY_TIMEOUT = -1; // Eventually times out\n\nvar USER_BLOCKING_PRIORITY_TIMEOUT = 250;\nvar NORMAL_PRIORITY_TIMEOUT = 5000;\nvar LOW_PRIORITY_TIMEOUT = 10000; // Never times out\n\nvar IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt; // Tasks are stored on a min heap\n\nvar taskQueue = [];\nvar timerQueue = []; // Incrementing id counter. Used to maintain insertion order.\n\nvar taskIdCounter = 1; // Pausing the scheduler is useful for debugging.\nvar currentTask = null;\nvar currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrance.\n\nvar isPerformingWork = false;\nvar isHostCallbackScheduled = false;\nvar isHostTimeoutScheduled = false; // Capture local references to native APIs, in case a polyfill overrides them.\n\nvar localSetTimeout = typeof setTimeout === 'function' ? setTimeout : null;\nvar localClearTimeout = typeof clearTimeout === 'function' ? clearTimeout : null;\nvar localSetImmediate = typeof setImmediate !== 'undefined' ? setImmediate : null; // IE and Node.js + jsdom\n\nvar isInputPending = typeof navigator !== 'undefined' && navigator.scheduling !== undefined && navigator.scheduling.isInputPending !== undefined ? navigator.scheduling.isInputPending.bind(navigator.scheduling) : null;\n\nfunction advanceTimers(currentTime) {\n // Check for tasks that are no longer delayed and add them to the queue.\n var timer = peek(timerQueue);\n\n while (timer !== null) {\n if (timer.caLine truncated
|
|
||||||
"mappings": "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 truncated
|
|
||||||
"names": ["initialTime", "startTime", "ReactDebugCurrentFrame", "prefix", "sanitizeURL", "workInProgress", "get", "set", "isHydrating", "options", "style", "registrationNameDependencies", "possibleRegistrationNames", "error", "callCallback", "current", "root", "index", "renderLanes", "queuedEvent", "prefixes", "has", "updateFragment", "child", "reconcileChildFibers", "error$1", "render", "subtreeRenderLanes", "hasContextChanged", "commitTime", "shouldFireAfterActiveInstanceBlur", "hydrate", "currentHook", "ReactCurrentDispatcher"]
|
|
||||||
}
|
|
||||||
+2
-2
@@ -256,8 +256,8 @@ import {
|
|||||||
weeksToDays,
|
weeksToDays,
|
||||||
yearsToMonths,
|
yearsToMonths,
|
||||||
yearsToQuarters
|
yearsToQuarters
|
||||||
} from "./chunk-TOOCKHFL.js";
|
} from "./chunk-SJKHQ62W.js";
|
||||||
import "./chunk-5WRI5ZAA.js";
|
import "./chunk-G3PMV62Z.js";
|
||||||
export {
|
export {
|
||||||
add,
|
add,
|
||||||
addBusinessDays,
|
addBusinessDays,
|
||||||
|
|||||||
+2
-2
@@ -11,8 +11,8 @@ import {
|
|||||||
requiredArgs,
|
requiredArgs,
|
||||||
startOfUTCWeek,
|
startOfUTCWeek,
|
||||||
toDate
|
toDate
|
||||||
} from "./chunk-TOOCKHFL.js";
|
} from "./chunk-SJKHQ62W.js";
|
||||||
import "./chunk-5WRI5ZAA.js";
|
import "./chunk-G3PMV62Z.js";
|
||||||
|
|
||||||
// node_modules/date-fns/esm/locale/af/_lib/formatDistance/index.js
|
// node_modules/date-fns/esm/locale/af/_lib/formatDistance/index.js
|
||||||
var formatDistanceLocale = {
|
var formatDistanceLocale = {
|
||||||
|
|||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
require_react_dom
|
require_react_dom
|
||||||
} from "./chunk-TYILIMWK.js";
|
} from "./chunk-PJEEZAML.js";
|
||||||
import "./chunk-CANBAPAS.js";
|
import "./chunk-DRWLMN53.js";
|
||||||
import "./chunk-5WRI5ZAA.js";
|
import "./chunk-G3PMV62Z.js";
|
||||||
export default require_react_dom();
|
export default require_react_dom();
|
||||||
//# sourceMappingURL=react-dom.js.map
|
//# sourceMappingURL=react-dom.js.map
|
||||||
+3
-3
@@ -1,10 +1,10 @@
|
|||||||
import {
|
import {
|
||||||
require_react_dom
|
require_react_dom
|
||||||
} from "./chunk-TYILIMWK.js";
|
} from "./chunk-PJEEZAML.js";
|
||||||
import "./chunk-CANBAPAS.js";
|
import "./chunk-DRWLMN53.js";
|
||||||
import {
|
import {
|
||||||
__commonJS
|
__commonJS
|
||||||
} from "./chunk-5WRI5ZAA.js";
|
} from "./chunk-G3PMV62Z.js";
|
||||||
|
|
||||||
// node_modules/react-dom/client.js
|
// node_modules/react-dom/client.js
|
||||||
var require_client = __commonJS({
|
var require_client = __commonJS({
|
||||||
|
|||||||
+3
-3
@@ -1,8 +1,8 @@
|
|||||||
import {
|
import {
|
||||||
GenIcon
|
GenIcon
|
||||||
} from "./chunk-EHLE63A5.js";
|
} from "./chunk-DQJKJRV5.js";
|
||||||
import "./chunk-CANBAPAS.js";
|
import "./chunk-DRWLMN53.js";
|
||||||
import "./chunk-5WRI5ZAA.js";
|
import "./chunk-G3PMV62Z.js";
|
||||||
|
|
||||||
// node_modules/react-icons/fa/index.esm.js
|
// node_modules/react-icons/fa/index.esm.js
|
||||||
function Fa500Px(props) {
|
function Fa500Px(props) {
|
||||||
|
|||||||
+3
-3
@@ -1,8 +1,8 @@
|
|||||||
import {
|
import {
|
||||||
GenIcon
|
GenIcon
|
||||||
} from "./chunk-EHLE63A5.js";
|
} from "./chunk-DQJKJRV5.js";
|
||||||
import "./chunk-CANBAPAS.js";
|
import "./chunk-DRWLMN53.js";
|
||||||
import "./chunk-5WRI5ZAA.js";
|
import "./chunk-G3PMV62Z.js";
|
||||||
|
|
||||||
// node_modules/react-icons/fa6/index.esm.js
|
// node_modules/react-icons/fa6/index.esm.js
|
||||||
function Fa42Group(props) {
|
function Fa42Group(props) {
|
||||||
|
|||||||
+3
-3
@@ -1,12 +1,12 @@
|
|||||||
import {
|
import {
|
||||||
require_react_dom
|
require_react_dom
|
||||||
} from "./chunk-TYILIMWK.js";
|
} from "./chunk-PJEEZAML.js";
|
||||||
import {
|
import {
|
||||||
require_react
|
require_react
|
||||||
} from "./chunk-CANBAPAS.js";
|
} from "./chunk-DRWLMN53.js";
|
||||||
import {
|
import {
|
||||||
__toESM
|
__toESM
|
||||||
} from "./chunk-5WRI5ZAA.js";
|
} from "./chunk-G3PMV62Z.js";
|
||||||
|
|
||||||
// node_modules/react-router-dom/dist/index.js
|
// node_modules/react-router-dom/dist/index.js
|
||||||
var React2 = __toESM(require_react());
|
var React2 = __toESM(require_react());
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
require_react
|
require_react
|
||||||
} from "./chunk-CANBAPAS.js";
|
} from "./chunk-DRWLMN53.js";
|
||||||
import "./chunk-5WRI5ZAA.js";
|
import "./chunk-G3PMV62Z.js";
|
||||||
export default require_react();
|
export default require_react();
|
||||||
//# sourceMappingURL=react.js.map
|
//# sourceMappingURL=react.js.map
|
||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
import {
|
import {
|
||||||
require_react
|
require_react
|
||||||
} from "./chunk-CANBAPAS.js";
|
} from "./chunk-DRWLMN53.js";
|
||||||
import {
|
import {
|
||||||
__commonJS
|
__commonJS
|
||||||
} from "./chunk-5WRI5ZAA.js";
|
} from "./chunk-G3PMV62Z.js";
|
||||||
|
|
||||||
// node_modules/react/cjs/react-jsx-dev-runtime.development.js
|
// node_modules/react/cjs/react-jsx-dev-runtime.development.js
|
||||||
var require_react_jsx_dev_runtime_development = __commonJS({
|
var require_react_jsx_dev_runtime_development = __commonJS({
|
||||||
|
|||||||
+4
-922
@@ -1,925 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
require_react
|
require_jsx_runtime
|
||||||
} from "./chunk-CANBAPAS.js";
|
} from "./chunk-6PXSGDAH.js";
|
||||||
import {
|
import "./chunk-DRWLMN53.js";
|
||||||
__commonJS
|
import "./chunk-G3PMV62Z.js";
|
||||||
} from "./chunk-5WRI5ZAA.js";
|
|
||||||
|
|
||||||
// node_modules/react/cjs/react-jsx-runtime.development.js
|
|
||||||
var require_react_jsx_runtime_development = __commonJS({
|
|
||||||
"node_modules/react/cjs/react-jsx-runtime.development.js"(exports) {
|
|
||||||
"use strict";
|
|
||||||
if (true) {
|
|
||||||
(function() {
|
|
||||||
"use strict";
|
|
||||||
var React = require_react();
|
|
||||||
var REACT_ELEMENT_TYPE = Symbol.for("react.element");
|
|
||||||
var REACT_PORTAL_TYPE = Symbol.for("react.portal");
|
|
||||||
var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
|
||||||
var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
|
|
||||||
var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
|
|
||||||
var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
|
|
||||||
var REACT_CONTEXT_TYPE = Symbol.for("react.context");
|
|
||||||
var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
|
|
||||||
var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
|
|
||||||
var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
|
|
||||||
var REACT_MEMO_TYPE = Symbol.for("react.memo");
|
|
||||||
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
||||||
var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
|
|
||||||
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
||||||
var FAUX_ITERATOR_SYMBOL = "@@iterator";
|
|
||||||
function getIteratorFn(maybeIterable) {
|
|
||||||
if (maybeIterable === null || typeof maybeIterable !== "object") {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
||||||
if (typeof maybeIterator === "function") {
|
|
||||||
return maybeIterator;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
||||||
function error(format) {
|
|
||||||
{
|
|
||||||
{
|
|
||||||
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
||||||
args[_key2 - 1] = arguments[_key2];
|
|
||||||
}
|
|
||||||
printWarning("error", format, args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function printWarning(level, format, args) {
|
|
||||||
{
|
|
||||||
var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
||||||
var stack = ReactDebugCurrentFrame2.getStackAddendum();
|
|
||||||
if (stack !== "") {
|
|
||||||
format += "%s";
|
|
||||||
args = args.concat([stack]);
|
|
||||||
}
|
|
||||||
var argsWithFormat = args.map(function(item) {
|
|
||||||
return String(item);
|
|
||||||
});
|
|
||||||
argsWithFormat.unshift("Warning: " + format);
|
|
||||||
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var enableScopeAPI = false;
|
|
||||||
var enableCacheElement = false;
|
|
||||||
var enableTransitionTracing = false;
|
|
||||||
var enableLegacyHidden = false;
|
|
||||||
var enableDebugTracing = false;
|
|
||||||
var REACT_MODULE_REFERENCE;
|
|
||||||
{
|
|
||||||
REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
|
|
||||||
}
|
|
||||||
function isValidElementType(type) {
|
|
||||||
if (typeof type === "string" || typeof type === "function") {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (typeof type === "object" && type !== null) {
|
|
||||||
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
|
|
||||||
// types supported by any Flight configuration anywhere since
|
|
||||||
// we don't know which Flight build this will end up being used
|
|
||||||
// with.
|
|
||||||
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
function getWrappedName(outerType, innerType, wrapperName) {
|
|
||||||
var displayName = outerType.displayName;
|
|
||||||
if (displayName) {
|
|
||||||
return displayName;
|
|
||||||
}
|
|
||||||
var functionName = innerType.displayName || innerType.name || "";
|
|
||||||
return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
||||||
}
|
|
||||||
function getContextName(type) {
|
|
||||||
return type.displayName || "Context";
|
|
||||||
}
|
|
||||||
function getComponentNameFromType(type) {
|
|
||||||
if (type == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
if (typeof type.tag === "number") {
|
|
||||||
error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (typeof type === "function") {
|
|
||||||
return type.displayName || type.name || null;
|
|
||||||
}
|
|
||||||
if (typeof type === "string") {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
switch (type) {
|
|
||||||
case REACT_FRAGMENT_TYPE:
|
|
||||||
return "Fragment";
|
|
||||||
case REACT_PORTAL_TYPE:
|
|
||||||
return "Portal";
|
|
||||||
case REACT_PROFILER_TYPE:
|
|
||||||
return "Profiler";
|
|
||||||
case REACT_STRICT_MODE_TYPE:
|
|
||||||
return "StrictMode";
|
|
||||||
case REACT_SUSPENSE_TYPE:
|
|
||||||
return "Suspense";
|
|
||||||
case REACT_SUSPENSE_LIST_TYPE:
|
|
||||||
return "SuspenseList";
|
|
||||||
}
|
|
||||||
if (typeof type === "object") {
|
|
||||||
switch (type.$$typeof) {
|
|
||||||
case REACT_CONTEXT_TYPE:
|
|
||||||
var context = type;
|
|
||||||
return getContextName(context) + ".Consumer";
|
|
||||||
case REACT_PROVIDER_TYPE:
|
|
||||||
var provider = type;
|
|
||||||
return getContextName(provider._context) + ".Provider";
|
|
||||||
case REACT_FORWARD_REF_TYPE:
|
|
||||||
return getWrappedName(type, type.render, "ForwardRef");
|
|
||||||
case REACT_MEMO_TYPE:
|
|
||||||
var outerName = type.displayName || null;
|
|
||||||
if (outerName !== null) {
|
|
||||||
return outerName;
|
|
||||||
}
|
|
||||||
return getComponentNameFromType(type.type) || "Memo";
|
|
||||||
case REACT_LAZY_TYPE: {
|
|
||||||
var lazyComponent = type;
|
|
||||||
var payload = lazyComponent._payload;
|
|
||||||
var init = lazyComponent._init;
|
|
||||||
try {
|
|
||||||
return getComponentNameFromType(init(payload));
|
|
||||||
} catch (x) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
var assign = Object.assign;
|
|
||||||
var disabledDepth = 0;
|
|
||||||
var prevLog;
|
|
||||||
var prevInfo;
|
|
||||||
var prevWarn;
|
|
||||||
var prevError;
|
|
||||||
var prevGroup;
|
|
||||||
var prevGroupCollapsed;
|
|
||||||
var prevGroupEnd;
|
|
||||||
function disabledLog() {
|
|
||||||
}
|
|
||||||
disabledLog.__reactDisabledLog = true;
|
|
||||||
function disableLogs() {
|
|
||||||
{
|
|
||||||
if (disabledDepth === 0) {
|
|
||||||
prevLog = console.log;
|
|
||||||
prevInfo = console.info;
|
|
||||||
prevWarn = console.warn;
|
|
||||||
prevError = console.error;
|
|
||||||
prevGroup = console.group;
|
|
||||||
prevGroupCollapsed = console.groupCollapsed;
|
|
||||||
prevGroupEnd = console.groupEnd;
|
|
||||||
var props = {
|
|
||||||
configurable: true,
|
|
||||||
enumerable: true,
|
|
||||||
value: disabledLog,
|
|
||||||
writable: true
|
|
||||||
};
|
|
||||||
Object.defineProperties(console, {
|
|
||||||
info: props,
|
|
||||||
log: props,
|
|
||||||
warn: props,
|
|
||||||
error: props,
|
|
||||||
group: props,
|
|
||||||
groupCollapsed: props,
|
|
||||||
groupEnd: props
|
|
||||||
});
|
|
||||||
}
|
|
||||||
disabledDepth++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function reenableLogs() {
|
|
||||||
{
|
|
||||||
disabledDepth--;
|
|
||||||
if (disabledDepth === 0) {
|
|
||||||
var props = {
|
|
||||||
configurable: true,
|
|
||||||
enumerable: true,
|
|
||||||
writable: true
|
|
||||||
};
|
|
||||||
Object.defineProperties(console, {
|
|
||||||
log: assign({}, props, {
|
|
||||||
value: prevLog
|
|
||||||
}),
|
|
||||||
info: assign({}, props, {
|
|
||||||
value: prevInfo
|
|
||||||
}),
|
|
||||||
warn: assign({}, props, {
|
|
||||||
value: prevWarn
|
|
||||||
}),
|
|
||||||
error: assign({}, props, {
|
|
||||||
value: prevError
|
|
||||||
}),
|
|
||||||
group: assign({}, props, {
|
|
||||||
value: prevGroup
|
|
||||||
}),
|
|
||||||
groupCollapsed: assign({}, props, {
|
|
||||||
value: prevGroupCollapsed
|
|
||||||
}),
|
|
||||||
groupEnd: assign({}, props, {
|
|
||||||
value: prevGroupEnd
|
|
||||||
})
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (disabledDepth < 0) {
|
|
||||||
error("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
|
||||||
var prefix;
|
|
||||||
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
||||||
{
|
|
||||||
if (prefix === void 0) {
|
|
||||||
try {
|
|
||||||
throw Error();
|
|
||||||
} catch (x) {
|
|
||||||
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
||||||
prefix = match && match[1] || "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "\n" + prefix + name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var reentry = false;
|
|
||||||
var componentFrameCache;
|
|
||||||
{
|
|
||||||
var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
|
|
||||||
componentFrameCache = new PossiblyWeakMap();
|
|
||||||
}
|
|
||||||
function describeNativeComponentFrame(fn, construct) {
|
|
||||||
if (!fn || reentry) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
var frame = componentFrameCache.get(fn);
|
|
||||||
if (frame !== void 0) {
|
|
||||||
return frame;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var control;
|
|
||||||
reentry = true;
|
|
||||||
var previousPrepareStackTrace = Error.prepareStackTrace;
|
|
||||||
Error.prepareStackTrace = void 0;
|
|
||||||
var previousDispatcher;
|
|
||||||
{
|
|
||||||
previousDispatcher = ReactCurrentDispatcher.current;
|
|
||||||
ReactCurrentDispatcher.current = null;
|
|
||||||
disableLogs();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
if (construct) {
|
|
||||||
var Fake = function() {
|
|
||||||
throw Error();
|
|
||||||
};
|
|
||||||
Object.defineProperty(Fake.prototype, "props", {
|
|
||||||
set: function() {
|
|
||||||
throw Error();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (typeof Reflect === "object" && Reflect.construct) {
|
|
||||||
try {
|
|
||||||
Reflect.construct(Fake, []);
|
|
||||||
} catch (x) {
|
|
||||||
control = x;
|
|
||||||
}
|
|
||||||
Reflect.construct(fn, [], Fake);
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
Fake.call();
|
|
||||||
} catch (x) {
|
|
||||||
control = x;
|
|
||||||
}
|
|
||||||
fn.call(Fake.prototype);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
throw Error();
|
|
||||||
} catch (x) {
|
|
||||||
control = x;
|
|
||||||
}
|
|
||||||
fn();
|
|
||||||
}
|
|
||||||
} catch (sample) {
|
|
||||||
if (sample && control && typeof sample.stack === "string") {
|
|
||||||
var sampleLines = sample.stack.split("\n");
|
|
||||||
var controlLines = control.stack.split("\n");
|
|
||||||
var s = sampleLines.length - 1;
|
|
||||||
var c = controlLines.length - 1;
|
|
||||||
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
||||||
c--;
|
|
||||||
}
|
|
||||||
for (; s >= 1 && c >= 0; s--, c--) {
|
|
||||||
if (sampleLines[s] !== controlLines[c]) {
|
|
||||||
if (s !== 1 || c !== 1) {
|
|
||||||
do {
|
|
||||||
s--;
|
|
||||||
c--;
|
|
||||||
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
||||||
var _frame = "\n" + sampleLines[s].replace(" at new ", " at ");
|
|
||||||
if (fn.displayName && _frame.includes("<anonymous>")) {
|
|
||||||
_frame = _frame.replace("<anonymous>", fn.displayName);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
if (typeof fn === "function") {
|
|
||||||
componentFrameCache.set(fn, _frame);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return _frame;
|
|
||||||
}
|
|
||||||
} while (s >= 1 && c >= 0);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
reentry = false;
|
|
||||||
{
|
|
||||||
ReactCurrentDispatcher.current = previousDispatcher;
|
|
||||||
reenableLogs();
|
|
||||||
}
|
|
||||||
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
||||||
}
|
|
||||||
var name = fn ? fn.displayName || fn.name : "";
|
|
||||||
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
|
|
||||||
{
|
|
||||||
if (typeof fn === "function") {
|
|
||||||
componentFrameCache.set(fn, syntheticFrame);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return syntheticFrame;
|
|
||||||
}
|
|
||||||
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
||||||
{
|
|
||||||
return describeNativeComponentFrame(fn, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function shouldConstruct(Component) {
|
|
||||||
var prototype = Component.prototype;
|
|
||||||
return !!(prototype && prototype.isReactComponent);
|
|
||||||
}
|
|
||||||
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
||||||
if (type == null) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
if (typeof type === "function") {
|
|
||||||
{
|
|
||||||
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (typeof type === "string") {
|
|
||||||
return describeBuiltInComponentFrame(type);
|
|
||||||
}
|
|
||||||
switch (type) {
|
|
||||||
case REACT_SUSPENSE_TYPE:
|
|
||||||
return describeBuiltInComponentFrame("Suspense");
|
|
||||||
case REACT_SUSPENSE_LIST_TYPE:
|
|
||||||
return describeBuiltInComponentFrame("SuspenseList");
|
|
||||||
}
|
|
||||||
if (typeof type === "object") {
|
|
||||||
switch (type.$$typeof) {
|
|
||||||
case REACT_FORWARD_REF_TYPE:
|
|
||||||
return describeFunctionComponentFrame(type.render);
|
|
||||||
case REACT_MEMO_TYPE:
|
|
||||||
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
||||||
case REACT_LAZY_TYPE: {
|
|
||||||
var lazyComponent = type;
|
|
||||||
var payload = lazyComponent._payload;
|
|
||||||
var init = lazyComponent._init;
|
|
||||||
try {
|
|
||||||
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
||||||
} catch (x) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
||||||
var loggedTypeFailures = {};
|
|
||||||
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
||||||
function setCurrentlyValidatingElement(element) {
|
|
||||||
{
|
|
||||||
if (element) {
|
|
||||||
var owner = element._owner;
|
|
||||||
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
||||||
ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
|
||||||
} else {
|
|
||||||
ReactDebugCurrentFrame.setExtraStackFrame(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
||||||
{
|
|
||||||
var has = Function.call.bind(hasOwnProperty);
|
|
||||||
for (var typeSpecName in typeSpecs) {
|
|
||||||
if (has(typeSpecs, typeSpecName)) {
|
|
||||||
var error$1 = void 0;
|
|
||||||
try {
|
|
||||||
if (typeof typeSpecs[typeSpecName] !== "function") {
|
|
||||||
var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
||||||
err.name = "Invariant Violation";
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
||||||
} catch (ex) {
|
|
||||||
error$1 = ex;
|
|
||||||
}
|
|
||||||
if (error$1 && !(error$1 instanceof Error)) {
|
|
||||||
setCurrentlyValidatingElement(element);
|
|
||||||
error("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", componentName || "React class", location, typeSpecName, typeof error$1);
|
|
||||||
setCurrentlyValidatingElement(null);
|
|
||||||
}
|
|
||||||
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
||||||
loggedTypeFailures[error$1.message] = true;
|
|
||||||
setCurrentlyValidatingElement(element);
|
|
||||||
error("Failed %s type: %s", location, error$1.message);
|
|
||||||
setCurrentlyValidatingElement(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var isArrayImpl = Array.isArray;
|
|
||||||
function isArray(a) {
|
|
||||||
return isArrayImpl(a);
|
|
||||||
}
|
|
||||||
function typeName(value) {
|
|
||||||
{
|
|
||||||
var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
|
|
||||||
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function willCoercionThrow(value) {
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
testStringCoercion(value);
|
|
||||||
return false;
|
|
||||||
} catch (e) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function testStringCoercion(value) {
|
|
||||||
return "" + value;
|
|
||||||
}
|
|
||||||
function checkKeyStringCoercion(value) {
|
|
||||||
{
|
|
||||||
if (willCoercionThrow(value)) {
|
|
||||||
error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
|
|
||||||
return testStringCoercion(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
||||||
var RESERVED_PROPS = {
|
|
||||||
key: true,
|
|
||||||
ref: true,
|
|
||||||
__self: true,
|
|
||||||
__source: true
|
|
||||||
};
|
|
||||||
var specialPropKeyWarningShown;
|
|
||||||
var specialPropRefWarningShown;
|
|
||||||
var didWarnAboutStringRefs;
|
|
||||||
{
|
|
||||||
didWarnAboutStringRefs = {};
|
|
||||||
}
|
|
||||||
function hasValidRef(config) {
|
|
||||||
{
|
|
||||||
if (hasOwnProperty.call(config, "ref")) {
|
|
||||||
var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
|
|
||||||
if (getter && getter.isReactWarning) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return config.ref !== void 0;
|
|
||||||
}
|
|
||||||
function hasValidKey(config) {
|
|
||||||
{
|
|
||||||
if (hasOwnProperty.call(config, "key")) {
|
|
||||||
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
||||||
if (getter && getter.isReactWarning) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return config.key !== void 0;
|
|
||||||
}
|
|
||||||
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
|
||||||
{
|
|
||||||
if (typeof config.ref === "string" && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
|
|
||||||
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
||||||
if (!didWarnAboutStringRefs[componentName]) {
|
|
||||||
error('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
|
|
||||||
didWarnAboutStringRefs[componentName] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function defineKeyPropWarningGetter(props, displayName) {
|
|
||||||
{
|
|
||||||
var warnAboutAccessingKey = function() {
|
|
||||||
if (!specialPropKeyWarningShown) {
|
|
||||||
specialPropKeyWarningShown = true;
|
|
||||||
error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
warnAboutAccessingKey.isReactWarning = true;
|
|
||||||
Object.defineProperty(props, "key", {
|
|
||||||
get: warnAboutAccessingKey,
|
|
||||||
configurable: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function defineRefPropWarningGetter(props, displayName) {
|
|
||||||
{
|
|
||||||
var warnAboutAccessingRef = function() {
|
|
||||||
if (!specialPropRefWarningShown) {
|
|
||||||
specialPropRefWarningShown = true;
|
|
||||||
error("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
warnAboutAccessingRef.isReactWarning = true;
|
|
||||||
Object.defineProperty(props, "ref", {
|
|
||||||
get: warnAboutAccessingRef,
|
|
||||||
configurable: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var ReactElement = function(type, key, ref, self, source, owner, props) {
|
|
||||||
var element = {
|
|
||||||
// This tag allows us to uniquely identify this as a React Element
|
|
||||||
$$typeof: REACT_ELEMENT_TYPE,
|
|
||||||
// Built-in properties that belong on the element
|
|
||||||
type,
|
|
||||||
key,
|
|
||||||
ref,
|
|
||||||
props,
|
|
||||||
// Record the component responsible for creating this element.
|
|
||||||
_owner: owner
|
|
||||||
};
|
|
||||||
{
|
|
||||||
element._store = {};
|
|
||||||
Object.defineProperty(element._store, "validated", {
|
|
||||||
configurable: false,
|
|
||||||
enumerable: false,
|
|
||||||
writable: true,
|
|
||||||
value: false
|
|
||||||
});
|
|
||||||
Object.defineProperty(element, "_self", {
|
|
||||||
configurable: false,
|
|
||||||
enumerable: false,
|
|
||||||
writable: false,
|
|
||||||
value: self
|
|
||||||
});
|
|
||||||
Object.defineProperty(element, "_source", {
|
|
||||||
configurable: false,
|
|
||||||
enumerable: false,
|
|
||||||
writable: false,
|
|
||||||
value: source
|
|
||||||
});
|
|
||||||
if (Object.freeze) {
|
|
||||||
Object.freeze(element.props);
|
|
||||||
Object.freeze(element);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return element;
|
|
||||||
};
|
|
||||||
function jsxDEV(type, config, maybeKey, source, self) {
|
|
||||||
{
|
|
||||||
var propName;
|
|
||||||
var props = {};
|
|
||||||
var key = null;
|
|
||||||
var ref = null;
|
|
||||||
if (maybeKey !== void 0) {
|
|
||||||
{
|
|
||||||
checkKeyStringCoercion(maybeKey);
|
|
||||||
}
|
|
||||||
key = "" + maybeKey;
|
|
||||||
}
|
|
||||||
if (hasValidKey(config)) {
|
|
||||||
{
|
|
||||||
checkKeyStringCoercion(config.key);
|
|
||||||
}
|
|
||||||
key = "" + config.key;
|
|
||||||
}
|
|
||||||
if (hasValidRef(config)) {
|
|
||||||
ref = config.ref;
|
|
||||||
warnIfStringRefCannotBeAutoConverted(config, self);
|
|
||||||
}
|
|
||||||
for (propName in config) {
|
|
||||||
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
||||||
props[propName] = config[propName];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (type && type.defaultProps) {
|
|
||||||
var defaultProps = type.defaultProps;
|
|
||||||
for (propName in defaultProps) {
|
|
||||||
if (props[propName] === void 0) {
|
|
||||||
props[propName] = defaultProps[propName];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (key || ref) {
|
|
||||||
var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type;
|
|
||||||
if (key) {
|
|
||||||
defineKeyPropWarningGetter(props, displayName);
|
|
||||||
}
|
|
||||||
if (ref) {
|
|
||||||
defineRefPropWarningGetter(props, displayName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
|
||||||
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
||||||
function setCurrentlyValidatingElement$1(element) {
|
|
||||||
{
|
|
||||||
if (element) {
|
|
||||||
var owner = element._owner;
|
|
||||||
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
||||||
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
||||||
} else {
|
|
||||||
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var propTypesMisspellWarningShown;
|
|
||||||
{
|
|
||||||
propTypesMisspellWarningShown = false;
|
|
||||||
}
|
|
||||||
function isValidElement(object) {
|
|
||||||
{
|
|
||||||
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function getDeclarationErrorAddendum() {
|
|
||||||
{
|
|
||||||
if (ReactCurrentOwner$1.current) {
|
|
||||||
var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
|
|
||||||
if (name) {
|
|
||||||
return "\n\nCheck the render method of `" + name + "`.";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function getSourceInfoErrorAddendum(source) {
|
|
||||||
{
|
|
||||||
if (source !== void 0) {
|
|
||||||
var fileName = source.fileName.replace(/^.*[\\\/]/, "");
|
|
||||||
var lineNumber = source.lineNumber;
|
|
||||||
return "\n\nCheck your code at " + fileName + ":" + lineNumber + ".";
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var ownerHasKeyUseWarning = {};
|
|
||||||
function getCurrentComponentErrorInfo(parentType) {
|
|
||||||
{
|
|
||||||
var info = getDeclarationErrorAddendum();
|
|
||||||
if (!info) {
|
|
||||||
var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
|
|
||||||
if (parentName) {
|
|
||||||
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function validateExplicitKey(element, parentType) {
|
|
||||||
{
|
|
||||||
if (!element._store || element._store.validated || element.key != null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
element._store.validated = true;
|
|
||||||
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
||||||
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
|
||||||
var childOwner = "";
|
|
||||||
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
|
||||||
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
||||||
}
|
|
||||||
setCurrentlyValidatingElement$1(element);
|
|
||||||
error('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
|
||||||
setCurrentlyValidatingElement$1(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function validateChildKeys(node, parentType) {
|
|
||||||
{
|
|
||||||
if (typeof node !== "object") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (isArray(node)) {
|
|
||||||
for (var i = 0; i < node.length; i++) {
|
|
||||||
var child = node[i];
|
|
||||||
if (isValidElement(child)) {
|
|
||||||
validateExplicitKey(child, parentType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (isValidElement(node)) {
|
|
||||||
if (node._store) {
|
|
||||||
node._store.validated = true;
|
|
||||||
}
|
|
||||||
} else if (node) {
|
|
||||||
var iteratorFn = getIteratorFn(node);
|
|
||||||
if (typeof iteratorFn === "function") {
|
|
||||||
if (iteratorFn !== node.entries) {
|
|
||||||
var iterator = iteratorFn.call(node);
|
|
||||||
var step;
|
|
||||||
while (!(step = iterator.next()).done) {
|
|
||||||
if (isValidElement(step.value)) {
|
|
||||||
validateExplicitKey(step.value, parentType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function validatePropTypes(element) {
|
|
||||||
{
|
|
||||||
var type = element.type;
|
|
||||||
if (type === null || type === void 0 || typeof type === "string") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var propTypes;
|
|
||||||
if (typeof type === "function") {
|
|
||||||
propTypes = type.propTypes;
|
|
||||||
} else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
||||||
// Inner props are checked in the reconciler.
|
|
||||||
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
||||||
propTypes = type.propTypes;
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (propTypes) {
|
|
||||||
var name = getComponentNameFromType(type);
|
|
||||||
checkPropTypes(propTypes, element.props, "prop", name, element);
|
|
||||||
} else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
|
|
||||||
propTypesMisspellWarningShown = true;
|
|
||||||
var _name = getComponentNameFromType(type);
|
|
||||||
error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
|
|
||||||
}
|
|
||||||
if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) {
|
|
||||||
error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function validateFragmentProps(fragment) {
|
|
||||||
{
|
|
||||||
var keys = Object.keys(fragment.props);
|
|
||||||
for (var i = 0; i < keys.length; i++) {
|
|
||||||
var key = keys[i];
|
|
||||||
if (key !== "children" && key !== "key") {
|
|
||||||
setCurrentlyValidatingElement$1(fragment);
|
|
||||||
error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
|
|
||||||
setCurrentlyValidatingElement$1(null);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (fragment.ref !== null) {
|
|
||||||
setCurrentlyValidatingElement$1(fragment);
|
|
||||||
error("Invalid attribute `ref` supplied to `React.Fragment`.");
|
|
||||||
setCurrentlyValidatingElement$1(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var didWarnAboutKeySpread = {};
|
|
||||||
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
||||||
{
|
|
||||||
var validType = isValidElementType(type);
|
|
||||||
if (!validType) {
|
|
||||||
var info = "";
|
|
||||||
if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) {
|
|
||||||
info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
|
|
||||||
}
|
|
||||||
var sourceInfo = getSourceInfoErrorAddendum(source);
|
|
||||||
if (sourceInfo) {
|
|
||||||
info += sourceInfo;
|
|
||||||
} else {
|
|
||||||
info += getDeclarationErrorAddendum();
|
|
||||||
}
|
|
||||||
var typeString;
|
|
||||||
if (type === null) {
|
|
||||||
typeString = "null";
|
|
||||||
} else if (isArray(type)) {
|
|
||||||
typeString = "array";
|
|
||||||
} else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
||||||
typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
|
|
||||||
info = " Did you accidentally export a JSX literal instead of a component?";
|
|
||||||
} else {
|
|
||||||
typeString = typeof type;
|
|
||||||
}
|
|
||||||
error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info);
|
|
||||||
}
|
|
||||||
var element = jsxDEV(type, props, key, source, self);
|
|
||||||
if (element == null) {
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
if (validType) {
|
|
||||||
var children = props.children;
|
|
||||||
if (children !== void 0) {
|
|
||||||
if (isStaticChildren) {
|
|
||||||
if (isArray(children)) {
|
|
||||||
for (var i = 0; i < children.length; i++) {
|
|
||||||
validateChildKeys(children[i], type);
|
|
||||||
}
|
|
||||||
if (Object.freeze) {
|
|
||||||
Object.freeze(children);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
validateChildKeys(children, type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
if (hasOwnProperty.call(props, "key")) {
|
|
||||||
var componentName = getComponentNameFromType(type);
|
|
||||||
var keys = Object.keys(props).filter(function(k) {
|
|
||||||
return k !== "key";
|
|
||||||
});
|
|
||||||
var beforeExample = keys.length > 0 ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
||||||
if (!didWarnAboutKeySpread[componentName + beforeExample]) {
|
|
||||||
var afterExample = keys.length > 0 ? "{" + keys.join(": ..., ") + ": ...}" : "{}";
|
|
||||||
error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
|
|
||||||
didWarnAboutKeySpread[componentName + beforeExample] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (type === REACT_FRAGMENT_TYPE) {
|
|
||||||
validateFragmentProps(element);
|
|
||||||
} else {
|
|
||||||
validatePropTypes(element);
|
|
||||||
}
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function jsxWithValidationStatic(type, props, key) {
|
|
||||||
{
|
|
||||||
return jsxWithValidation(type, props, key, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function jsxWithValidationDynamic(type, props, key) {
|
|
||||||
{
|
|
||||||
return jsxWithValidation(type, props, key, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var jsx = jsxWithValidationDynamic;
|
|
||||||
var jsxs = jsxWithValidationStatic;
|
|
||||||
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
||||||
exports.jsx = jsx;
|
|
||||||
exports.jsxs = jsxs;
|
|
||||||
})();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// node_modules/react/jsx-runtime.js
|
|
||||||
var require_jsx_runtime = __commonJS({
|
|
||||||
"node_modules/react/jsx-runtime.js"(exports, module) {
|
|
||||||
if (false) {
|
|
||||||
module.exports = null;
|
|
||||||
} else {
|
|
||||||
module.exports = require_react_jsx_runtime_development();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
export default require_jsx_runtime();
|
export default require_jsx_runtime();
|
||||||
/*! Bundled license information:
|
|
||||||
|
|
||||||
react/cjs/react-jsx-runtime.development.js:
|
|
||||||
(**
|
|
||||||
* @license React
|
|
||||||
* react-jsx-runtime.development.js
|
|
||||||
*
|
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*)
|
|
||||||
*/
|
|
||||||
//# sourceMappingURL=react_jsx-runtime.js.map
|
//# sourceMappingURL=react_jsx-runtime.js.map
|
||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"version": 3,
|
"version": 3,
|
||||||
"sources": ["../../react/cjs/react-jsx-runtime.development.js", "../../react/jsx-runtime.js"],
|
"sources": [],
|
||||||
"sourcesContent": ["/**\n * @license React\n * react-jsx-runtime.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n'use strict';\n\nvar React = require('react');\n\n// ATTENTION\n// When adding new symbols to this file,\n// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'\n// The Symbol used to tag the ReactElement-like types.\nvar REACT_ELEMENT_TYPE = Symbol.for('react.element');\nvar REACT_PORTAL_TYPE = Symbol.for('react.portal');\nvar REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');\nvar REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');\nvar REACT_PROFILER_TYPE = Symbol.for('react.profiler');\nvar REACT_PROVIDER_TYPE = Symbol.for('react.provider');\nvar REACT_CONTEXT_TYPE = Symbol.for('react.context');\nvar REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');\nvar REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');\nvar REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');\nvar REACT_MEMO_TYPE = Symbol.for('react.memo');\nvar REACT_LAZY_TYPE = Symbol.for('react.lazy');\nvar REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');\nvar MAYBE_ITERATOR_SYMBOL = Symbol.iterator;\nvar FAUX_ITERATOR_SYMBOL = '@@iterator';\nfunction getIteratorFn(maybeIterable) {\n if (maybeIterable === null || typeof maybeIterable !== 'object') {\n return null;\n }\n\n var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];\n\n if (typeof maybeIterator === 'function') {\n return maybeIterator;\n }\n\n return null;\n}\n\nvar ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;\n\nfunction error(format) {\n {\n {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n printWarning('error', format, args);\n }\n }\n}\n\nfunction printWarning(level, format, args) {\n // When changing this logic, you might want to also\n // update consoleWithStackDev.www.js as well.\n {\n var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;\n var stack = ReactDebugCurrentFrame.getStackAddendum();\n\n if (stack !== '') {\n format += '%s';\n args = args.concat([stack]);\n } // eslint-disable-next-line react-internal/safe-string-coercion\n\n\n var argsWithFormat = args.map(function (item) {\n return String(item);\n }); // Careful: RN currently depends on this prefix\n\n argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it\n // breaks IE9: https://github.com/facebook/react/issues/13610\n // eslint-disable-next-line react-internal/no-production-logging\n\n Function.prototype.apply.call(console[level], console, argsWithFormat);\n }\n}\n\n// -----------------------------------------------------------------------------\n\nvar enableScopeAPI = false; // Experimental Create Event Handle API.\nvar enableCacheElement = false;\nvar enableTransitionTracing = false; // No known bugs, but needs performance testing\n\nvar enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber\n// stuff. Intended to enable React core members to more easily debug scheduling\n// issues in DEV builds.\n\nvar enableDebugTracing = false; // Track which Fiber(s) schedule render work.\n\nvar REACT_MODULE_REFERENCE;\n\n{\n REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');\n}\n\nfunction isValidElementType(type) {\n if (typeof type === 'string' || typeof type === 'function') {\n return true;\n } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).\n\n\n if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {\n return true;\n }\n\n if (typeof type === 'object' && type !== null) {\n if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object\n // types supported by any Flight configuration anywhere since\n // we don't know which Flight build this will end up being used\n // with.\n type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction getWrappedName(outerType, innerType, wrapperName) {Line truncated
|
"sourcesContent": [],
|
||||||
"mappings": "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 truncated
|
"mappings": "",
|
||||||
"names": ["ReactDebugCurrentFrame"]
|
"names": []
|
||||||
}
|
}
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
# esbuild
|
|
||||||
|
|
||||||
This is the macOS ARM 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details.
|
|
||||||
BIN
Binary file not shown.
-20
@@ -1,20 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@esbuild/darwin-arm64",
|
|
||||||
"version": "0.21.5",
|
|
||||||
"description": "The macOS ARM 64-bit binary for esbuild, a JavaScript bundler.",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/evanw/esbuild.git"
|
|
||||||
},
|
|
||||||
"license": "MIT",
|
|
||||||
"preferUnplugged": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
},
|
|
||||||
"os": [
|
|
||||||
"darwin"
|
|
||||||
],
|
|
||||||
"cpu": [
|
|
||||||
"arm64"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
# `@rollup/rollup-darwin-arm64`
|
|
||||||
|
|
||||||
This is the **aarch64-apple-darwin** binary for `rollup`
|
|
||||||
-22
@@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@rollup/rollup-darwin-arm64",
|
|
||||||
"version": "4.53.5",
|
|
||||||
"os": [
|
|
||||||
"darwin"
|
|
||||||
],
|
|
||||||
"cpu": [
|
|
||||||
"arm64"
|
|
||||||
],
|
|
||||||
"files": [
|
|
||||||
"rollup.darwin-arm64.node"
|
|
||||||
],
|
|
||||||
"description": "Native bindings for Rollup",
|
|
||||||
"author": "Lukas Taegert-Atkinson",
|
|
||||||
"homepage": "https://rollupjs.org/",
|
|
||||||
"license": "MIT",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/rollup/rollup.git"
|
|
||||||
},
|
|
||||||
"main": "./rollup.darwin-arm64.node"
|
|
||||||
}
|
|
||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
-22
@@ -1,22 +0,0 @@
|
|||||||
MIT License
|
|
||||||
-----------
|
|
||||||
|
|
||||||
Copyright (C) 2010-2020 by Philipp Dunkel, Ben Noordhuis, Elan Shankar, Paul Miller
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
-89
@@ -1,89 +0,0 @@
|
|||||||
# fsevents
|
|
||||||
|
|
||||||
Native access to MacOS FSEvents in [Node.js](https://nodejs.org/)
|
|
||||||
|
|
||||||
The FSEvents API in MacOS allows applications to register for notifications of
|
|
||||||
changes to a given directory tree. It is a very fast and lightweight alternative
|
|
||||||
to kqueue.
|
|
||||||
|
|
||||||
This is a low-level library. For a cross-platform file watching module that
|
|
||||||
uses fsevents, check out [Chokidar](https://github.com/paulmillr/chokidar).
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm install fsevents
|
|
||||||
```
|
|
||||||
|
|
||||||
Supports only **Node.js v8.16 and higher**.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const fsevents = require('fsevents');
|
|
||||||
|
|
||||||
// To start observation
|
|
||||||
const stop = fsevents.watch(__dirname, (path, flags, id) => {
|
|
||||||
const info = fsevents.getInfo(path, flags);
|
|
||||||
});
|
|
||||||
|
|
||||||
// To end observation
|
|
||||||
stop();
|
|
||||||
```
|
|
||||||
|
|
||||||
> **Important note:** The API behaviour is slightly different from typical JS APIs. The `stop` function **must** be
|
|
||||||
> retrieved and stored somewhere, even if you don't plan to stop the watcher. If you forget it, the garbage collector
|
|
||||||
> will eventually kick in, the watcher will be unregistered, and your callbacks won't be called anymore.
|
|
||||||
|
|
||||||
The callback passed as the second parameter to `.watch` get's called whenever the operating system detects a
|
|
||||||
a change in the file system. It takes three arguments:
|
|
||||||
|
|
||||||
###### `fsevents.watch(dirname: string, (path: string, flags: number, id: string) => void): () => Promise<undefined>`
|
|
||||||
|
|
||||||
* `path: string` - the item in the filesystem that have been changed
|
|
||||||
* `flags: number` - a numeric value describing what the change was
|
|
||||||
* `id: string` - an unique-id identifying this specific event
|
|
||||||
|
|
||||||
Returns closer callback which when called returns a Promise resolving when the watcher process has been shut down.
|
|
||||||
|
|
||||||
###### `fsevents.getInfo(path: string, flags: number, id: string): FsEventInfo`
|
|
||||||
|
|
||||||
The `getInfo` function takes the `path`, `flags` and `id` arguments and converts those parameters into a structure
|
|
||||||
that is easier to digest to determine what the change was.
|
|
||||||
|
|
||||||
The `FsEventsInfo` has the following shape:
|
|
||||||
|
|
||||||
```js
|
|
||||||
/**
|
|
||||||
* @typedef {'created'|'modified'|'deleted'|'moved'|'root-changed'|'cloned'|'unknown'} FsEventsEvent
|
|
||||||
* @typedef {'file'|'directory'|'symlink'} FsEventsType
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
"event": "created", // {FsEventsEvent}
|
|
||||||
"path": "file.txt",
|
|
||||||
"type": "file", // {FsEventsType}
|
|
||||||
"changes": {
|
|
||||||
"inode": true, // Had iNode Meta-Information changed
|
|
||||||
"finder": false, // Had Finder Meta-Data changed
|
|
||||||
"access": false, // Had access permissions changed
|
|
||||||
"xattrs": false // Had xAttributes changed
|
|
||||||
},
|
|
||||||
"flags": 0x100000000
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Changelog
|
|
||||||
|
|
||||||
- v2.3 supports Apple Silicon ARM CPUs
|
|
||||||
- v2 supports node 8.16+ and reduces package size massively
|
|
||||||
- v1.2.8 supports node 6+
|
|
||||||
- v1.2.7 supports node 4+
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
- I'm getting `EBADPLATFORM` `Unsupported platform for fsevents` error.
|
|
||||||
- It's fine, nothing is broken. fsevents is macos-only. Other platforms are skipped. If you want to hide this warning, report a bug to NPM bugtracker asking them to hide ebadplatform warnings by default.
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
The MIT License Copyright (C) 2010-2020 by Philipp Dunkel, Ben Noordhuis, Elan Shankar, Paul Miller — see LICENSE file.
|
|
||||||
|
|
||||||
Visit our [GitHub page](https://github.com/fsevents/fsevents) and [NPM Page](https://npmjs.org/package/fsevents)
|
|
||||||
-46
@@ -1,46 +0,0 @@
|
|||||||
declare type Event = "created" | "cloned" | "modified" | "deleted" | "moved" | "root-changed" | "unknown";
|
|
||||||
declare type Type = "file" | "directory" | "symlink";
|
|
||||||
declare type FileChanges = {
|
|
||||||
inode: boolean;
|
|
||||||
finder: boolean;
|
|
||||||
access: boolean;
|
|
||||||
xattrs: boolean;
|
|
||||||
};
|
|
||||||
declare type Info = {
|
|
||||||
event: Event;
|
|
||||||
path: string;
|
|
||||||
type: Type;
|
|
||||||
changes: FileChanges;
|
|
||||||
flags: number;
|
|
||||||
};
|
|
||||||
declare type WatchHandler = (path: string, flags: number, id: string) => void;
|
|
||||||
export declare function watch(path: string, handler: WatchHandler): () => Promise<void>;
|
|
||||||
export declare function watch(path: string, since: number, handler: WatchHandler): () => Promise<void>;
|
|
||||||
export declare function getInfo(path: string, flags: number): Info;
|
|
||||||
export declare const constants: {
|
|
||||||
None: 0x00000000;
|
|
||||||
MustScanSubDirs: 0x00000001;
|
|
||||||
UserDropped: 0x00000002;
|
|
||||||
KernelDropped: 0x00000004;
|
|
||||||
EventIdsWrapped: 0x00000008;
|
|
||||||
HistoryDone: 0x00000010;
|
|
||||||
RootChanged: 0x00000020;
|
|
||||||
Mount: 0x00000040;
|
|
||||||
Unmount: 0x00000080;
|
|
||||||
ItemCreated: 0x00000100;
|
|
||||||
ItemRemoved: 0x00000200;
|
|
||||||
ItemInodeMetaMod: 0x00000400;
|
|
||||||
ItemRenamed: 0x00000800;
|
|
||||||
ItemModified: 0x00001000;
|
|
||||||
ItemFinderInfoMod: 0x00002000;
|
|
||||||
ItemChangeOwner: 0x00004000;
|
|
||||||
ItemXattrMod: 0x00008000;
|
|
||||||
ItemIsFile: 0x00010000;
|
|
||||||
ItemIsDir: 0x00020000;
|
|
||||||
ItemIsSymlink: 0x00040000;
|
|
||||||
ItemIsHardlink: 0x00100000;
|
|
||||||
ItemIsLastHardlink: 0x00200000;
|
|
||||||
OwnEvent: 0x00080000;
|
|
||||||
ItemCloned: 0x00400000;
|
|
||||||
};
|
|
||||||
export {};
|
|
||||||
-83
@@ -1,83 +0,0 @@
|
|||||||
/*
|
|
||||||
** © 2020 by Philipp Dunkel, Ben Noordhuis, Elan Shankar, Paul Miller
|
|
||||||
** Licensed under MIT License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* jshint node:true */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
if (process.platform !== "darwin") {
|
|
||||||
throw new Error(`Module 'fsevents' is not compatible with platform '${process.platform}'`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const Native = require("./fsevents.node");
|
|
||||||
const events = Native.constants;
|
|
||||||
|
|
||||||
function watch(path, since, handler) {
|
|
||||||
if (typeof path !== "string") {
|
|
||||||
throw new TypeError(`fsevents argument 1 must be a string and not a ${typeof path}`);
|
|
||||||
}
|
|
||||||
if ("function" === typeof since && "undefined" === typeof handler) {
|
|
||||||
handler = since;
|
|
||||||
since = Native.flags.SinceNow;
|
|
||||||
}
|
|
||||||
if (typeof since !== "number") {
|
|
||||||
throw new TypeError(`fsevents argument 2 must be a number and not a ${typeof since}`);
|
|
||||||
}
|
|
||||||
if (typeof handler !== "function") {
|
|
||||||
throw new TypeError(`fsevents argument 3 must be a function and not a ${typeof handler}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
let instance = Native.start(Native.global, path, since, handler);
|
|
||||||
if (!instance) throw new Error(`could not watch: ${path}`);
|
|
||||||
return () => {
|
|
||||||
const result = instance ? Promise.resolve(instance).then(Native.stop) : Promise.resolve(undefined);
|
|
||||||
instance = undefined;
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function getInfo(path, flags) {
|
|
||||||
return {
|
|
||||||
path,
|
|
||||||
flags,
|
|
||||||
event: getEventType(flags),
|
|
||||||
type: getFileType(flags),
|
|
||||||
changes: getFileChanges(flags),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function getFileType(flags) {
|
|
||||||
if (events.ItemIsFile & flags) return "file";
|
|
||||||
if (events.ItemIsDir & flags) return "directory";
|
|
||||||
if (events.MustScanSubDirs & flags) return "directory";
|
|
||||||
if (events.ItemIsSymlink & flags) return "symlink";
|
|
||||||
}
|
|
||||||
function anyIsTrue(obj) {
|
|
||||||
for (let key in obj) {
|
|
||||||
if (obj[key]) return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
function getEventType(flags) {
|
|
||||||
if (events.ItemRemoved & flags) return "deleted";
|
|
||||||
if (events.ItemRenamed & flags) return "moved";
|
|
||||||
if (events.ItemCreated & flags) return "created";
|
|
||||||
if (events.ItemModified & flags) return "modified";
|
|
||||||
if (events.RootChanged & flags) return "root-changed";
|
|
||||||
if (events.ItemCloned & flags) return "cloned";
|
|
||||||
if (anyIsTrue(flags)) return "modified";
|
|
||||||
return "unknown";
|
|
||||||
}
|
|
||||||
function getFileChanges(flags) {
|
|
||||||
return {
|
|
||||||
inode: !!(events.ItemInodeMetaMod & flags),
|
|
||||||
finder: !!(events.ItemFinderInfoMod & flags),
|
|
||||||
access: !!(events.ItemChangeOwner & flags),
|
|
||||||
xattrs: !!(events.ItemXattrMod & flags),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.watch = watch;
|
|
||||||
exports.getInfo = getInfo;
|
|
||||||
exports.constants = events;
|
|
||||||
BIN
Binary file not shown.
-62
@@ -1,62 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "fsevents",
|
|
||||||
"version": "2.3.3",
|
|
||||||
"description": "Native Access to MacOS FSEvents",
|
|
||||||
"main": "fsevents.js",
|
|
||||||
"types": "fsevents.d.ts",
|
|
||||||
"os": [
|
|
||||||
"darwin"
|
|
||||||
],
|
|
||||||
"files": [
|
|
||||||
"fsevents.d.ts",
|
|
||||||
"fsevents.js",
|
|
||||||
"fsevents.node"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"clean": "node-gyp clean && rm -f fsevents.node",
|
|
||||||
"build": "node-gyp clean && rm -f fsevents.node && node-gyp rebuild && node-gyp clean",
|
|
||||||
"test": "/bin/bash ./test.sh 2>/dev/null",
|
|
||||||
"prepublishOnly": "npm run build"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/fsevents/fsevents.git"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"fsevents",
|
|
||||||
"mac"
|
|
||||||
],
|
|
||||||
"contributors": [
|
|
||||||
{
|
|
||||||
"name": "Philipp Dunkel",
|
|
||||||
"email": "pip@pipobscure.com"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Ben Noordhuis",
|
|
||||||
"email": "info@bnoordhuis.nl"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Elan Shankar",
|
|
||||||
"email": "elan.shanker@gmail.com"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Miroslav Bajtoš",
|
|
||||||
"email": "mbajtoss@gmail.com"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Paul Miller",
|
|
||||||
"url": "https://paulmillr.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/fsevents/fsevents/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/fsevents/fsevents",
|
|
||||||
"devDependencies": {
|
|
||||||
"node-gyp": "^9.4.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Generated
+35
-34
@@ -8,16 +8,16 @@
|
|||||||
"name": "woms-react",
|
"name": "woms-react",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@tabler/icons-react": "^3.36.0",
|
||||||
"appwrite": "^13.0.0",
|
"appwrite": "^13.0.0",
|
||||||
"date-fns": "^2.30.0",
|
"date-fns": "^2.30.0",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-icons": "^4.12.0",
|
"react-icons": "^4.12.0",
|
||||||
"react-router-dom": "^6.20.0"
|
"react-router-dom": "^6.20.0",
|
||||||
|
"uplot": "^1.6.32"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/react": "^18.2.0",
|
|
||||||
"@types/react-dom": "^18.2.0",
|
|
||||||
"@vitejs/plugin-react": "^4.2.0",
|
"@vitejs/plugin-react": "^4.2.0",
|
||||||
"vite": "^5.0.0"
|
"vite": "^5.0.0"
|
||||||
}
|
}
|
||||||
@@ -1006,6 +1006,32 @@
|
|||||||
"win32"
|
"win32"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"node_modules/@tabler/icons": {
|
||||||
|
"version": "3.36.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tabler/icons/-/icons-3.36.0.tgz",
|
||||||
|
"integrity": "sha512-z9OfTEG6QbaQWM9KBOxxUdpgvMUn0atageXyiaSc2gmYm51ORO8Ua7eUcjlks+Dc0YMK4rrodAFdK9SfjJ4ZcA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/codecalm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@tabler/icons-react": {
|
||||||
|
"version": "3.36.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tabler/icons-react/-/icons-react-3.36.0.tgz",
|
||||||
|
"integrity": "sha512-sSZ00bEjTdTTskVFykq294RJq+9cFatwy4uYa78HcYBCXU1kSD1DIp5yoFsQXmybkIOKCjp18OnhAYk553UIfQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@tabler/icons": "3.36.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/codecalm"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": ">= 16"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/babel__core": {
|
"node_modules/@types/babel__core": {
|
||||||
"version": "7.20.5",
|
"version": "7.20.5",
|
||||||
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",
|
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",
|
||||||
@@ -1053,31 +1079,6 @@
|
|||||||
"integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==",
|
"integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/prop-types": {
|
|
||||||
"version": "15.7.15",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz",
|
|
||||||
"integrity": "sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/@types/react": {
|
|
||||||
"version": "18.3.27",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.27.tgz",
|
|
||||||
"integrity": "sha512-cisd7gxkzjBKU2GgdYrTdtQx1SORymWyaAFhaxQPK9bYO9ot3Y5OikQRvY0VYQtvwjeQnizCINJAenh/V7MK2w==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@types/prop-types": "*",
|
|
||||||
"csstype": "^3.2.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@types/react-dom": {
|
|
||||||
"version": "18.3.7",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.7.tgz",
|
|
||||||
"integrity": "sha512-MEe3UeoENYVFXzoXEWsvcpg6ZvlrFNlOQ7EOsvhI3CfAXwzPfO8Qwuxd40nepsYKqyyVQnTdEfv68q91yLcKrQ==",
|
|
||||||
"dev": true,
|
|
||||||
"peerDependencies": {
|
|
||||||
"@types/react": "^18.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@vitejs/plugin-react": {
|
"node_modules/@vitejs/plugin-react": {
|
||||||
"version": "4.7.0",
|
"version": "4.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.7.0.tgz",
|
||||||
@@ -1211,12 +1212,6 @@
|
|||||||
"node-fetch": "2.6.7"
|
"node-fetch": "2.6.7"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/csstype": {
|
|
||||||
"version": "3.2.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
|
|
||||||
"integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/date-fns": {
|
"node_modules/date-fns": {
|
||||||
"version": "2.30.0",
|
"version": "2.30.0",
|
||||||
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz",
|
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz",
|
||||||
@@ -1851,6 +1846,12 @@
|
|||||||
"browserslist": ">= 4.21.0"
|
"browserslist": ">= 4.21.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/uplot": {
|
||||||
|
"version": "1.6.32",
|
||||||
|
"resolved": "https://registry.npmjs.org/uplot/-/uplot-1.6.32.tgz",
|
||||||
|
"integrity": "sha512-KIMVnG68zvu5XXUbC4LQEPnhwOxBuLyW1AHtpm6IKTXImkbLgkMy+jabjLgSLMasNuGGzQm/ep3tOkyTxpiQIw==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/vite": {
|
"node_modules/vite": {
|
||||||
"version": "5.4.21",
|
"version": "5.4.21",
|
||||||
"resolved": "https://registry.npmjs.org/vite/-/vite-5.4.21.tgz",
|
"resolved": "https://registry.npmjs.org/vite/-/vite-5.4.21.tgz",
|
||||||
|
|||||||
+8
-7
@@ -3,22 +3,23 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@tabler/icons-react": "^3.36.0",
|
||||||
|
"appwrite": "^13.0.0",
|
||||||
|
"date-fns": "^2.30.0",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-router-dom": "^6.20.0",
|
|
||||||
"appwrite": "^13.0.0",
|
|
||||||
"react-icons": "^4.12.0",
|
"react-icons": "^4.12.0",
|
||||||
"date-fns": "^2.30.0"
|
"react-router-dom": "^6.20.0",
|
||||||
|
"uplot": "^1.6.32"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"vite": "^5.0.0",
|
|
||||||
"@vitejs/plugin-react": "^4.2.0",
|
"@vitejs/plugin-react": "^4.2.0",
|
||||||
"@types/react": "^18.2.0",
|
"vite": "^5.0.0"
|
||||||
"@types/react-dom": "^18.2.0"
|
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview",
|
||||||
|
"test": "node --test tests/*.test.mjs tests/unit/*.test.mjs"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,180 @@
|
|||||||
|
{
|
||||||
|
"versions": [
|
||||||
|
{
|
||||||
|
"documentKey": "agb",
|
||||||
|
"version": "v1",
|
||||||
|
"validFrom": "2026-02-02",
|
||||||
|
"status": "superseded",
|
||||||
|
"changeNote": "Erste Fassung der AGB auf webklar.com",
|
||||||
|
"source": "webklar.com@217bbdc:src/pages/AGB.tsx"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"documentKey": "agb",
|
||||||
|
"version": "v2",
|
||||||
|
"validFrom": "2026-09-27",
|
||||||
|
"status": "superseded",
|
||||||
|
"changeNote": "Modul C Hosting ergänzt (Hosting-Abo, Wartungs-Abo mit beliebig vielen Postfächern)",
|
||||||
|
"source": "webklar.com@dc27e50:src/pages/AGB.tsx"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"documentKey": "agb",
|
||||||
|
"version": "v3",
|
||||||
|
"validFrom": "2026-09-27",
|
||||||
|
"status": "superseded",
|
||||||
|
"changeNote": "An die Vertragsbedingungen angeglichen (Wechsel, Zusatzspeicher, Sicherheit), Verweise auf die Abo-Bedingungen",
|
||||||
|
"source": "webklar.com@2c1a4c1:src/pages/AGB.tsx"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"documentKey": "agb",
|
||||||
|
"version": "v4",
|
||||||
|
"validFrom": "2026-09-28",
|
||||||
|
"status": "superseded",
|
||||||
|
"changeNote": "Haftungssatz in Modul C entfällt; Kündigung nach Verlängerung für Verbraucher",
|
||||||
|
"source": "webklar.com@2bffca4:src/pages/AGB.tsx"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"documentKey": "agb",
|
||||||
|
"version": "v5",
|
||||||
|
"validFrom": "2026-09-28",
|
||||||
|
"status": "current",
|
||||||
|
"changeNote": "Verbraucher-Kündigung als Ausnahme formuliert",
|
||||||
|
"source": "webklar.com@044f788:src/pages/AGB.tsx"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"documentKey": "agb",
|
||||||
|
"version": "v6",
|
||||||
|
"validFrom": "2026-09-28",
|
||||||
|
"status": "draft",
|
||||||
|
"changeNote": "§ 11 Haftung neu nach dem Muster der Abo-Bedingungen (noch nicht live)",
|
||||||
|
"source": "webklar.com@f40e889:src/pages/AGB.tsx"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"documentKey": "abo-bedingungen",
|
||||||
|
"version": "v1",
|
||||||
|
"validFrom": "2026-09-25",
|
||||||
|
"status": "superseded",
|
||||||
|
"changeNote": "Erste Fassung: Wartungs-Abo 50 €/Monat über Stripe mit Stundenkonto",
|
||||||
|
"source": "kundenbereich@65429aa:public/abo-bedingungen.html"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"documentKey": "abo-bedingungen",
|
||||||
|
"version": "v2",
|
||||||
|
"validFrom": "2026-09-25",
|
||||||
|
"status": "superseded",
|
||||||
|
"changeNote": "Vertragsunterlagen Version 2 nach Rechtsrunde, Postfächer und Domains bei Hetzner",
|
||||||
|
"source": "kundenbereich@4ab154b:public/abo-bedingungen.html"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"documentKey": "abo-bedingungen",
|
||||||
|
"version": "v3",
|
||||||
|
"validFrom": "2026-09-25",
|
||||||
|
"status": "superseded",
|
||||||
|
"changeNote": "Version 3: Mindestlaufzeit 12 Monate; Kontakt support@webklar.com",
|
||||||
|
"source": "kundenbereich@dbabbf1:public/abo-bedingungen.html"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"documentKey": "abo-bedingungen",
|
||||||
|
"version": "v4",
|
||||||
|
"validFrom": "2026-09-30",
|
||||||
|
"status": "current",
|
||||||
|
"changeNote": "Version 4: Hosting-Abo und Wartungs-Abo, Postfächer, Zusatzspeicher, Wechsel, AVV; § 13 Abs. 3 mit Ausnahme für Absatz 1; Hosting-Preis 20 €",
|
||||||
|
"source": "kundenbereich@e4efdac:public/abo-bedingungen.html"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"documentKey": "avv",
|
||||||
|
"version": "v2",
|
||||||
|
"validFrom": "2026-09-25",
|
||||||
|
"status": "superseded",
|
||||||
|
"changeNote": "Erste AVV als Anlage der Vertragsbedingungen Version 2 (in Version 1 nur „auf Anfrage“)",
|
||||||
|
"source": "kundenbereich@4ab154b:public/abo-bedingungen.html"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"documentKey": "avv",
|
||||||
|
"version": "v3",
|
||||||
|
"validFrom": "2026-09-25",
|
||||||
|
"status": "superseded",
|
||||||
|
"changeNote": "AVV als Anlage der Vertragsbedingungen Version 3",
|
||||||
|
"source": "kundenbereich@dbabbf1:public/abo-bedingungen.html"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"documentKey": "avv",
|
||||||
|
"version": "v4",
|
||||||
|
"validFrom": "2026-09-30",
|
||||||
|
"status": "current",
|
||||||
|
"changeNote": "AVV als Anlage der Vertragsbedingungen Version 4 (Anlagen 1 und 3 überarbeitet)",
|
||||||
|
"source": "kundenbereich@e4efdac:public/abo-bedingungen.html"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"documentKey": "datenschutz",
|
||||||
|
"version": "v1",
|
||||||
|
"validFrom": "2026-09-25",
|
||||||
|
"status": "superseded",
|
||||||
|
"changeNote": "Stand 25.09.2026: Abo, Übernahmegutschrift",
|
||||||
|
"source": "kundenbereich@48b13f4:public/datenschutz.html"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"documentKey": "datenschutz",
|
||||||
|
"version": "v2",
|
||||||
|
"validFrom": "2026-09-26",
|
||||||
|
"status": "superseded",
|
||||||
|
"changeNote": "Stand 26.09.2026: Chat mit Bildern, Dateien und Sprachnachrichten",
|
||||||
|
"source": "kundenbereich@35d98da:public/datenschutz.html"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"documentKey": "datenschutz",
|
||||||
|
"version": "v3",
|
||||||
|
"validFrom": "2026-09-27",
|
||||||
|
"status": "superseded",
|
||||||
|
"changeNote": "Stand 27.09.2026: E-Mail bei Hetzner statt Porkbun, UptimeRobot, Bestellungen im Portal",
|
||||||
|
"source": "kundenbereich@7e86928:public/datenschutz.html"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"documentKey": "datenschutz",
|
||||||
|
"version": "v4",
|
||||||
|
"validFrom": "2026-09-30",
|
||||||
|
"status": "current",
|
||||||
|
"changeNote": "Stand 30.09.2026: Livegang mit Vertragsbedingungen Version 4",
|
||||||
|
"source": "kundenbereich@78b4d7b:public/datenschutz.html"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"documentKey": "impressum",
|
||||||
|
"version": "v1",
|
||||||
|
"validFrom": "2026-02-02",
|
||||||
|
"status": "superseded",
|
||||||
|
"changeNote": "Erste Fassung",
|
||||||
|
"source": "webklar.com@6af24d2:src/pages/Impressum.tsx"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"documentKey": "impressum",
|
||||||
|
"version": "v2",
|
||||||
|
"validFrom": "2026-09-25",
|
||||||
|
"status": "current",
|
||||||
|
"changeNote": "Neu nach DDG mit Gesellschaftern; Kontakt support@webklar.com",
|
||||||
|
"source": "webklar.com@f74ddfb:src/pages/Impressum.tsx"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"documentKey": "widerruf",
|
||||||
|
"version": "v1",
|
||||||
|
"validFrom": "2026-09-25",
|
||||||
|
"status": "superseded",
|
||||||
|
"changeNote": "Widerrufsformular im Kundenportal",
|
||||||
|
"source": "kundenbereich@65429aa:public/widerrufen.html"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"documentKey": "widerruf",
|
||||||
|
"version": "v2",
|
||||||
|
"validFrom": "2026-09-25",
|
||||||
|
"status": "superseded",
|
||||||
|
"changeNote": "Überarbeitet nach Rechtsrunde",
|
||||||
|
"source": "kundenbereich@4ab154b:public/widerrufen.html"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"documentKey": "widerruf",
|
||||||
|
"version": "v3",
|
||||||
|
"validFrom": "2026-09-29",
|
||||||
|
"status": "current",
|
||||||
|
"changeNote": "Vertrag bzw. Bestellung auswählbar (§ 312k, § 356a BGB)",
|
||||||
|
"source": "kundenbereich@7ffe95f:public/widerrufen.html"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,199 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
/**
|
||||||
|
* WOMS Rechtliches – Erstbefuellung (idempotent ueber das Feld `source`).
|
||||||
|
* Liest scripts/legal-seed.json, erzeugt je Version eine Archivkopie als HTML
|
||||||
|
* (Portal-HTML direkt aus Git, Website-Seiten per React zu HTML gerendert),
|
||||||
|
* laedt sie in den Bucket legal-files und legt die Versionen an. Dazu die
|
||||||
|
* Anbieter-Vertraege ohne Fristen und Preise.
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
* node scripts/seed-legal.mjs --dry-run [--out DIR] (nur rendern, nichts hochladen)
|
||||||
|
* APPWRITE_API_KEY=... node scripts/seed-legal.mjs
|
||||||
|
*/
|
||||||
|
import { execFileSync } from "node:child_process";
|
||||||
|
import fs from "node:fs";
|
||||||
|
import os from "node:os";
|
||||||
|
import path from "node:path";
|
||||||
|
import { createRequire } from "node:module";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
|
||||||
|
const HERE = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
const APPS = "/home/webklar/apps";
|
||||||
|
const REPOS = {
|
||||||
|
"webklar.com": process.env.WEBSITE_REPO || `${APPS}/webklar.com/build`,
|
||||||
|
kundenbereich: process.env.PORTAL_REPO || `${APPS}/kundenbereich.webklar.com/build`,
|
||||||
|
};
|
||||||
|
const NODE_MODULES = process.env.WOMS_NODE_MODULES || `${APPS}/ticket.webklar.com/build/node_modules`;
|
||||||
|
|
||||||
|
const dryRun = process.argv.includes("--dry-run");
|
||||||
|
const outIdx = process.argv.indexOf("--out");
|
||||||
|
const outDir = outIdx > 0 ? process.argv[outIdx + 1] : null;
|
||||||
|
const endpoint = process.env.APPWRITE_ENDPOINT || "https://appwrite.webklar.com/v1";
|
||||||
|
const projectId = process.env.APPWRITE_PROJECT_ID || "6a1058610003c5a13a05";
|
||||||
|
const databaseId = process.env.APPWRITE_DATABASE_ID || "woms-database";
|
||||||
|
const apiKey = process.env.APPWRITE_API_KEY;
|
||||||
|
|
||||||
|
export const PROVIDERS = [
|
||||||
|
{ provider: "Hetzner", purpose: "Server (Hosting aller Websites und Systeme)" },
|
||||||
|
{ provider: "Hetzner", purpose: "E-Mail-Postfächer" },
|
||||||
|
{ provider: "Porkbun", purpose: "Domains" },
|
||||||
|
{ provider: "Stripe", purpose: "Zahlungen der Abos" },
|
||||||
|
];
|
||||||
|
|
||||||
|
const require = createRequire(path.join(NODE_MODULES, "noop.js"));
|
||||||
|
|
||||||
|
function gitShow(repo, hash, file) {
|
||||||
|
return execFileSync("git", ["-C", REPOS[repo], "show", `${hash}:${file}`], { maxBuffer: 20 * 1024 * 1024 });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alles ausser React wird zu einem Platzhalter: Komponenten geben nur ihre Kinder aus,
|
||||||
|
// Link wird zu <a>, Icons verschwinden. Die Exportnamen kommen aus den Imports der Seite.
|
||||||
|
function stubFor(source, specifier) {
|
||||||
|
const names = new Set();
|
||||||
|
let hasDefault = false;
|
||||||
|
const re = /import\s+(?:(\w+)\s*,?\s*)?(?:\{([^}]*)\})?\s*from\s*["']([^"']+)["']/g;
|
||||||
|
for (const m of source.matchAll(re)) {
|
||||||
|
if (m[3] !== specifier) continue;
|
||||||
|
if (m[1]) hasDefault = true;
|
||||||
|
for (const n of (m[2] || "").split(",")) {
|
||||||
|
const name = n.trim().split(/\s+as\s+/)[0].replace(/^type\s+/, "");
|
||||||
|
if (name) names.add(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const lines = [
|
||||||
|
"import React from 'react';",
|
||||||
|
"const Pass = (p) => (p && p.children !== undefined ? React.createElement(React.Fragment, null, p.children) : null);",
|
||||||
|
];
|
||||||
|
for (const n of names) {
|
||||||
|
lines.push(n === "Link" || n === "NavLink"
|
||||||
|
? `export const ${n} = (p) => React.createElement('a', { href: p.to || p.href }, p.children);`
|
||||||
|
: /^[A-Z]/.test(n) ? `export const ${n} = Pass;` : `export const ${n} = () => undefined;`);
|
||||||
|
}
|
||||||
|
if (hasDefault) lines.push("export default Pass;");
|
||||||
|
return lines.join("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function renderTsx(source) {
|
||||||
|
const esbuild = require("esbuild");
|
||||||
|
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), "legal-"));
|
||||||
|
const entry = path.join(tmp, "page.tsx");
|
||||||
|
fs.writeFileSync(entry, source);
|
||||||
|
const result = await esbuild.build({
|
||||||
|
entryPoints: [entry],
|
||||||
|
bundle: true,
|
||||||
|
write: false,
|
||||||
|
format: "cjs",
|
||||||
|
platform: "node",
|
||||||
|
jsx: "automatic",
|
||||||
|
nodePaths: [NODE_MODULES],
|
||||||
|
external: ["react", "react-dom", "react/jsx-runtime"],
|
||||||
|
logLevel: "silent",
|
||||||
|
plugins: [{
|
||||||
|
name: "stub",
|
||||||
|
setup(b) {
|
||||||
|
b.onResolve({ filter: /.*/ }, (a) =>
|
||||||
|
a.kind === "entry-point" || /^react(\/jsx-runtime)?$/.test(a.path) ? undefined : { path: a.path, namespace: "stub" });
|
||||||
|
b.onLoad({ filter: /.*/, namespace: "stub" }, (a) => ({ contents: stubFor(source, a.path), loader: "js", resolveDir: NODE_MODULES }));
|
||||||
|
},
|
||||||
|
}],
|
||||||
|
});
|
||||||
|
fs.rmSync(tmp, { recursive: true, force: true });
|
||||||
|
const mod = { exports: {} };
|
||||||
|
new Function("module", "exports", "require", result.outputFiles[0].text)(mod, mod.exports, require);
|
||||||
|
const Page = mod.exports.default;
|
||||||
|
const React = require("react");
|
||||||
|
const { renderToStaticMarkup } = require("react-dom/server");
|
||||||
|
const html = renderToStaticMarkup(React.createElement(Page));
|
||||||
|
const main = /<main[\s\S]*<\/main>/.exec(html);
|
||||||
|
return main ? main[0] : html;
|
||||||
|
}
|
||||||
|
|
||||||
|
function wrap(title, entry, body) {
|
||||||
|
return `<!doctype html>
|
||||||
|
<html lang="de"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>${title} ${entry.version} – Archivkopie</title>
|
||||||
|
<style>body{font:16px/1.6 system-ui,sans-serif;max-width:820px;margin:0 auto;padding:24px;color:#111}
|
||||||
|
.archiv{background:#f3f4f6;border:1px solid #d1d5db;padding:8px 12px;border-radius:6px;font-size:13px;margin-bottom:24px}
|
||||||
|
svg{display:none}h1{font-size:28px}</style></head>
|
||||||
|
<body><div class="archiv">Archivkopie aus WOMS · ${title} ${entry.version} · gültig ab ${entry.validFrom} · Quelle ${entry.source}</div>
|
||||||
|
${body}
|
||||||
|
</body></html>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function buildFile(entry, title) {
|
||||||
|
const [repo, rest] = entry.source.split("@");
|
||||||
|
const [hash, file] = rest.split(":");
|
||||||
|
const raw = gitShow(repo, hash, file);
|
||||||
|
const name = `${entry.documentKey}-${entry.version}-${hash}.html`;
|
||||||
|
if (file.endsWith(".html")) return { name, content: raw };
|
||||||
|
const body = await renderTsx(raw.toString("utf8"));
|
||||||
|
return { name, content: Buffer.from(wrap(title, entry, body), "utf8") };
|
||||||
|
}
|
||||||
|
|
||||||
|
async function run() {
|
||||||
|
const { versions } = JSON.parse(fs.readFileSync(path.join(HERE, "legal-seed.json"), "utf8"));
|
||||||
|
const { DOCUMENTS } = await import("./setup-legal.mjs");
|
||||||
|
const titles = Object.fromEntries(DOCUMENTS.map((d) => [d.key, d.title]));
|
||||||
|
|
||||||
|
if (dryRun) {
|
||||||
|
if (outDir) fs.mkdirSync(outDir, { recursive: true });
|
||||||
|
for (const v of versions) {
|
||||||
|
const f = await buildFile(v, titles[v.documentKey]);
|
||||||
|
if (outDir) fs.writeFileSync(path.join(outDir, f.name), f.content);
|
||||||
|
console.log(`${v.documentKey} ${v.version} ${v.status} ab ${v.validFrom}: ${f.name} (${f.content.length} Bytes)`);
|
||||||
|
}
|
||||||
|
for (const p of PROVIDERS) console.log(`Anbieter: ${p.provider} – ${p.purpose}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!apiKey) {
|
||||||
|
console.error("APPWRITE_API_KEY required (oder --dry-run)");
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
const { Client, Databases, Storage, ID, Query } = await import("node-appwrite");
|
||||||
|
const { InputFile } = await import("node-appwrite/file");
|
||||||
|
const client = new Client().setEndpoint(endpoint).setProject(projectId).setKey(apiKey);
|
||||||
|
const db = new Databases(client);
|
||||||
|
const storage = new Storage(client);
|
||||||
|
|
||||||
|
let created = 0;
|
||||||
|
for (const v of versions) {
|
||||||
|
const found = await db.listDocuments(databaseId, "legalVersions", [Query.equal("source", v.source), Query.equal("documentKey", v.documentKey), Query.limit(1)]);
|
||||||
|
if (found.total > 0) {
|
||||||
|
console.log("vorhanden:", v.documentKey, v.version);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const f = await buildFile(v, titles[v.documentKey]);
|
||||||
|
const file = await storage.createFile("legal-files", ID.unique(), InputFile.fromBuffer(f.content, f.name));
|
||||||
|
const doc = { ...v, validTo: null, fileIds: [file.$id] };
|
||||||
|
await db.createDocument(databaseId, "legalVersions", ID.unique(), doc);
|
||||||
|
created++;
|
||||||
|
console.log("angelegt:", v.documentKey, v.version);
|
||||||
|
}
|
||||||
|
|
||||||
|
// validTo der abgeloesten Versionen: Tag vor der naechsten nicht-Entwurf-Version, nie vor dem eigenen Beginn
|
||||||
|
const all = (await db.listDocuments(databaseId, "legalVersions", [Query.limit(5000)])).documents;
|
||||||
|
for (const v of all.filter((x) => x.status === "superseded" && !x.validTo)) {
|
||||||
|
const next = all
|
||||||
|
.filter((x) => x.documentKey === v.documentKey && x.status !== "draft" && x.$id !== v.$id &&
|
||||||
|
(x.validFrom > v.validFrom || (x.validFrom === v.validFrom && x.version > v.version)))
|
||||||
|
.sort((a, b) => (a.validFrom + a.version).localeCompare(b.validFrom + b.version))[0];
|
||||||
|
if (!next) continue;
|
||||||
|
const d = new Date(`${next.validFrom}T00:00:00Z`);
|
||||||
|
d.setUTCDate(d.getUTCDate() - 1);
|
||||||
|
const before = d.toISOString().slice(0, 10);
|
||||||
|
await db.updateDocument(databaseId, "legalVersions", v.$id, { validTo: before < v.validFrom ? v.validFrom : before });
|
||||||
|
}
|
||||||
|
|
||||||
|
const existing = (await db.listDocuments(databaseId, "providerContracts", [Query.limit(5000)])).documents;
|
||||||
|
for (const p of PROVIDERS) {
|
||||||
|
if (existing.some((c) => c.provider === p.provider && c.purpose === p.purpose)) continue;
|
||||||
|
await db.createDocument(databaseId, "providerContracts", ID.unique(), { ...p, fileIds: [] });
|
||||||
|
console.log("Anbieter angelegt:", p.provider, p.purpose);
|
||||||
|
}
|
||||||
|
console.log(`Fertig: ${created} Versionen angelegt.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
run().catch((e) => {
|
||||||
|
console.error(e.message || e);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
@@ -0,0 +1,202 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
/**
|
||||||
|
* WOMS Rechtliches – Appwrite-Setup (idempotent).
|
||||||
|
* Legt die Sammlungen legalDocuments, legalVersions, providerContracts, den Bucket
|
||||||
|
* legal-files und die festen Rechtstext-Karten an. Versionen und Dateien bekommen
|
||||||
|
* bewusst keine Loeschrechte: das Archiv soll vollstaendig bleiben.
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
* node scripts/setup-legal.mjs --dry-run
|
||||||
|
* APPWRITE_API_KEY=... node scripts/setup-legal.mjs
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { pathToFileURL } from "node:url";
|
||||||
|
|
||||||
|
const dryRun = process.argv.includes("--dry-run");
|
||||||
|
const endpoint = process.env.APPWRITE_ENDPOINT || "https://appwrite.webklar.com/v1";
|
||||||
|
const projectId = process.env.APPWRITE_PROJECT_ID || "6a1058610003c5a13a05";
|
||||||
|
const databaseId = process.env.APPWRITE_DATABASE_ID || "woms-database";
|
||||||
|
const apiKey = process.env.APPWRITE_API_KEY;
|
||||||
|
|
||||||
|
const READ_WRITE = ['read("users")', 'create("users")', 'update("users")'];
|
||||||
|
const CRUD = [...READ_WRITE, 'delete("users")'];
|
||||||
|
|
||||||
|
const date = (key) => ({ key, type: "string", size: 10 });
|
||||||
|
|
||||||
|
export const COLLECTIONS = [
|
||||||
|
{
|
||||||
|
id: "legalDocuments",
|
||||||
|
name: "Rechtstexte",
|
||||||
|
perms: READ_WRITE,
|
||||||
|
attrs: [
|
||||||
|
{ key: "key", type: "string", size: 64, required: true },
|
||||||
|
{ key: "title", type: "string", size: 200, required: true },
|
||||||
|
{ key: "liveUrl", type: "string", size: 500 },
|
||||||
|
{ key: "sort", type: "integer", min: 0, max: 1000 },
|
||||||
|
],
|
||||||
|
indexes: [{ key: "idx_sort", type: "key", attributes: ["sort"] }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "legalVersions",
|
||||||
|
name: "Rechtstext-Versionen",
|
||||||
|
perms: READ_WRITE,
|
||||||
|
attrs: [
|
||||||
|
{ key: "documentKey", type: "string", size: 64, required: true },
|
||||||
|
{ key: "version", type: "string", size: 32, required: true },
|
||||||
|
date("validFrom"),
|
||||||
|
date("validTo"),
|
||||||
|
{ key: "status", type: "enum", elements: ["draft", "current", "superseded"], required: true },
|
||||||
|
{ key: "changeNote", type: "string", size: 5000 },
|
||||||
|
{ key: "fileIds", type: "string[]", size: 64 },
|
||||||
|
{ key: "source", type: "string", size: 300 },
|
||||||
|
],
|
||||||
|
indexes: [
|
||||||
|
{ key: "idx_documentKey", type: "key", attributes: ["documentKey"] },
|
||||||
|
{ key: "idx_source", type: "key", attributes: ["source"] },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "providerContracts",
|
||||||
|
name: "Anbieter-Verträge",
|
||||||
|
perms: CRUD,
|
||||||
|
attrs: [
|
||||||
|
{ key: "provider", type: "string", size: 200, required: true },
|
||||||
|
{ key: "purpose", type: "string", size: 300 },
|
||||||
|
{ key: "cost", type: "float" },
|
||||||
|
{ key: "costInterval", type: "enum", elements: ["month", "year"] },
|
||||||
|
date("startDate"),
|
||||||
|
{ key: "termMonths", type: "integer", min: 0, max: 1200 },
|
||||||
|
{ key: "renewalMonths", type: "integer", min: 0, max: 1200 },
|
||||||
|
{ key: "noticeValue", type: "integer", min: 0, max: 3650 },
|
||||||
|
{ key: "noticeUnit", type: "enum", elements: ["days", "months"] },
|
||||||
|
date("cancelledAt"),
|
||||||
|
date("endsAt"),
|
||||||
|
{ key: "note", type: "string", size: 5000 },
|
||||||
|
{ key: "fileIds", type: "string[]", size: 64 },
|
||||||
|
],
|
||||||
|
indexes: [{ key: "idx_provider", type: "key", attributes: ["provider"] }],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const BUCKET = {
|
||||||
|
id: "legal-files",
|
||||||
|
name: "Rechtliches Dateien",
|
||||||
|
perms: ['read("users")', 'create("users")'],
|
||||||
|
maxSize: 20 * 1024 * 1024,
|
||||||
|
extensions: ["pdf", "html", "htm", "png", "jpg", "jpeg", "webp", "doc", "docx"],
|
||||||
|
};
|
||||||
|
|
||||||
|
export const DOCUMENTS = [
|
||||||
|
{ key: "agb", title: "AGB", liveUrl: "https://webklar.com/agb" },
|
||||||
|
{ key: "abo-bedingungen", title: "Abo-Bedingungen", liveUrl: "https://project.webklar.com/abo-bedingungen.html" },
|
||||||
|
{ key: "avv", title: "AVV (Auftragsverarbeitung)", liveUrl: "https://project.webklar.com/abo-bedingungen.html" },
|
||||||
|
{ key: "datenschutz", title: "Datenschutzerklärung (Website und Portal)", liveUrl: "https://project.webklar.com/datenschutz.html" },
|
||||||
|
{ key: "impressum", title: "Impressum", liveUrl: "https://webklar.com/impressum" },
|
||||||
|
{ key: "widerruf", title: "Widerrufsbelehrung und -formular", liveUrl: "https://project.webklar.com/widerrufen.html" },
|
||||||
|
].map((d, i) => ({ ...d, sort: i + 1 }));
|
||||||
|
|
||||||
|
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
||||||
|
|
||||||
|
/** Wartet, bis Appwrite alle Attribute einer Sammlung fertig angelegt hat. */
|
||||||
|
export async function waitForAttributes(db, collectionId, { intervalMs = 1000, timeoutMs = 120000 } = {}) {
|
||||||
|
const until = Date.now() + timeoutMs;
|
||||||
|
for (;;) {
|
||||||
|
const { attributes } = await db.listAttributes(databaseId, collectionId);
|
||||||
|
const failed = attributes.filter((a) => a.status === "failed" || a.status === "stuck");
|
||||||
|
if (failed.length) {
|
||||||
|
throw new Error(`Attribut fehlgeschlagen in ${collectionId}: ${failed.map((a) => `${a.key} (${a.error || a.status})`).join(", ")}`);
|
||||||
|
}
|
||||||
|
if (attributes.every((a) => a.status === "available")) return;
|
||||||
|
if (Date.now() > until) throw new Error(`Attribute in ${collectionId} nach ${timeoutMs} ms nicht verfuegbar`);
|
||||||
|
await sleep(intervalMs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function createAttribute(db, collectionId, a) {
|
||||||
|
const req = Boolean(a.required);
|
||||||
|
switch (a.type) {
|
||||||
|
case "integer":
|
||||||
|
return db.createIntegerAttribute(databaseId, collectionId, a.key, req, a.min, a.max);
|
||||||
|
case "float":
|
||||||
|
return db.createFloatAttribute(databaseId, collectionId, a.key, req);
|
||||||
|
case "enum":
|
||||||
|
return db.createEnumAttribute(databaseId, collectionId, a.key, a.elements, req);
|
||||||
|
case "string[]":
|
||||||
|
return db.createStringAttribute(databaseId, collectionId, a.key, a.size, req, undefined, true);
|
||||||
|
default:
|
||||||
|
return db.createStringAttribute(databaseId, collectionId, a.key, a.size, req);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function run() {
|
||||||
|
if (dryRun) {
|
||||||
|
for (const c of COLLECTIONS) {
|
||||||
|
console.log(`Sammlung ${c.id} (${c.perms.join(", ")}): ${c.attrs.map((a) => a.key).join(", ")}`);
|
||||||
|
}
|
||||||
|
console.log(`Bucket ${BUCKET.id}: ${BUCKET.extensions.join(", ")}, max ${BUCKET.maxSize} Bytes`);
|
||||||
|
for (const d of DOCUMENTS) console.log(`Rechtstext ${d.key}: ${d.title}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!apiKey) {
|
||||||
|
console.error("APPWRITE_API_KEY required (oder --dry-run)");
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
const { Client, Databases, Storage } = await import("node-appwrite");
|
||||||
|
const client = new Client().setEndpoint(endpoint).setProject(projectId).setKey(apiKey);
|
||||||
|
const db = new Databases(client);
|
||||||
|
const storage = new Storage(client);
|
||||||
|
|
||||||
|
for (const c of COLLECTIONS) {
|
||||||
|
try {
|
||||||
|
await db.getCollection(databaseId, c.id);
|
||||||
|
await db.updateCollection(databaseId, c.id, c.name, c.perms, false, true);
|
||||||
|
console.log("Sammlung vorhanden:", c.id);
|
||||||
|
} catch (e) {
|
||||||
|
if (e.code !== 404) throw e;
|
||||||
|
await db.createCollection(databaseId, c.id, c.name, c.perms, false, true);
|
||||||
|
console.log("Sammlung angelegt:", c.id);
|
||||||
|
}
|
||||||
|
const existing = new Set((await db.listAttributes(databaseId, c.id)).attributes.map((a) => a.key));
|
||||||
|
for (const a of c.attrs) {
|
||||||
|
if (existing.has(a.key)) continue;
|
||||||
|
await createAttribute(db, c.id, a);
|
||||||
|
console.log(" Attribut", a.key);
|
||||||
|
await sleep(400);
|
||||||
|
}
|
||||||
|
await waitForAttributes(db, c.id);
|
||||||
|
const indexes = new Set((await db.listIndexes(databaseId, c.id)).indexes.map((i) => i.key));
|
||||||
|
for (const idx of c.indexes || []) {
|
||||||
|
if (indexes.has(idx.key)) continue;
|
||||||
|
await db.createIndex(databaseId, c.id, idx.key, idx.type, idx.attributes);
|
||||||
|
console.log(" Index", idx.key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await storage.getBucket(BUCKET.id);
|
||||||
|
console.log("Bucket vorhanden:", BUCKET.id);
|
||||||
|
} catch (e) {
|
||||||
|
if (e.code !== 404) throw e;
|
||||||
|
await storage.createBucket(BUCKET.id, BUCKET.name, BUCKET.perms, false, true, BUCKET.maxSize, BUCKET.extensions);
|
||||||
|
console.log("Bucket angelegt:", BUCKET.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const d of DOCUMENTS) {
|
||||||
|
try {
|
||||||
|
await db.getDocument(databaseId, "legalDocuments", d.key);
|
||||||
|
} catch (e) {
|
||||||
|
if (e.code !== 404) throw e;
|
||||||
|
await db.createDocument(databaseId, "legalDocuments", d.key, d);
|
||||||
|
console.log("Rechtstext angelegt:", d.key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log("Fertig.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Nur direkt aufgerufen ausfuehren; seed-legal.mjs importiert DOCUMENTS.
|
||||||
|
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
||||||
|
run().catch((e) => {
|
||||||
|
console.error(e.message || e);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
}
|
||||||
+29
-14
@@ -1,22 +1,24 @@
|
|||||||
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom'
|
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom'
|
||||||
import { AuthProvider, useAuth } from './context/AuthContext'
|
import { AuthProvider, useAuth } from './context/AuthContext'
|
||||||
import Navbar from './components/Navbar'
|
import Sidebar from './components/Navbar'
|
||||||
import Footer from './components/Footer'
|
import Footer from './components/Footer'
|
||||||
import LoginPage from './pages/LoginPage'
|
import LoginPage from './pages/LoginPage'
|
||||||
import TicketsPage from './pages/TicketsPage'
|
import TicketsPage from './pages/TicketsPage'
|
||||||
import DashboardPage from './pages/DashboardPage'
|
|
||||||
import AssetsPage from './pages/AssetsPage'
|
|
||||||
import PlanboardPage from './pages/PlanboardPage'
|
import PlanboardPage from './pages/PlanboardPage'
|
||||||
import ProjectsPage from './pages/ProjectsPage'
|
import ProjectsPage from './pages/ProjectsPage'
|
||||||
import ReportsPage from './pages/ReportsPage'
|
import AdminPage from './pages/AdminPage'
|
||||||
import DocsPage from './pages/DocsPage'
|
import CustomersPage from './pages/CustomersPage'
|
||||||
|
import CustomerDetailPage from './pages/CustomerDetailPage'
|
||||||
|
import FinancePage from './pages/FinancePage'
|
||||||
|
import LegalPage from './pages/LegalPage'
|
||||||
|
import ServerpulsPage from './pages/ServerpulsPage'
|
||||||
|
|
||||||
function ProtectedRoute({ children }) {
|
function ProtectedRoute({ children }) {
|
||||||
const { user, loading } = useAuth()
|
const { user, loading } = useAuth()
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return (
|
return (
|
||||||
<div className="text-center p-4">
|
<div className="text-center p-4" style={{ marginTop: 80 }}>
|
||||||
<div className="spinner"></div>
|
<div className="spinner"></div>
|
||||||
<p>Loading...</p>
|
<p>Loading...</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -38,12 +40,17 @@ function AppRoutes() {
|
|||||||
<Route path="/login" element={user ? <Navigate to="/tickets" replace /> : <LoginPage />} />
|
<Route path="/login" element={user ? <Navigate to="/tickets" replace /> : <LoginPage />} />
|
||||||
<Route path="/" element={<Navigate to="/tickets" replace />} />
|
<Route path="/" element={<Navigate to="/tickets" replace />} />
|
||||||
<Route path="/tickets" element={<ProtectedRoute><TicketsPage /></ProtectedRoute>} />
|
<Route path="/tickets" element={<ProtectedRoute><TicketsPage /></ProtectedRoute>} />
|
||||||
<Route path="/dashboard" element={<ProtectedRoute><DashboardPage /></ProtectedRoute>} />
|
<Route path="/customers" element={<ProtectedRoute><CustomersPage /></ProtectedRoute>} />
|
||||||
<Route path="/assets" element={<ProtectedRoute><AssetsPage /></ProtectedRoute>} />
|
<Route path="/customers/:id" element={<ProtectedRoute><CustomerDetailPage /></ProtectedRoute>} />
|
||||||
|
<Route path="/leads" element={<Navigate to="/tickets" replace />} />
|
||||||
|
<Route path="/finance" element={<ProtectedRoute><FinancePage /></ProtectedRoute>} />
|
||||||
|
<Route path="/rechtliches" element={<ProtectedRoute><LegalPage /></ProtectedRoute>} />
|
||||||
|
<Route path="/serverpuls" element={<ProtectedRoute><ServerpulsPage /></ProtectedRoute>} />
|
||||||
<Route path="/planboard" element={<ProtectedRoute><PlanboardPage /></ProtectedRoute>} />
|
<Route path="/planboard" element={<ProtectedRoute><PlanboardPage /></ProtectedRoute>} />
|
||||||
<Route path="/projects" element={<ProtectedRoute><ProjectsPage /></ProtectedRoute>} />
|
<Route path="/projects" element={<ProtectedRoute><ProjectsPage /></ProtectedRoute>} />
|
||||||
<Route path="/reports" element={<ProtectedRoute><ReportsPage /></ProtectedRoute>} />
|
<Route path="/admin" element={<ProtectedRoute><AdminPage /></ProtectedRoute>} />
|
||||||
<Route path="/docs" element={<ProtectedRoute><DocsPage /></ProtectedRoute>} />
|
{/* Alte Links (z. B. die entfernten Seiten Assets, Reports, Docs, Roadmaps) landen bei den Tickets */}
|
||||||
|
<Route path="*" element={<Navigate to="/tickets" replace />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -51,12 +58,20 @@ function AppRoutes() {
|
|||||||
function AppContent() {
|
function AppContent() {
|
||||||
const { user } = useAuth()
|
const { user } = useAuth()
|
||||||
|
|
||||||
|
if (!user) {
|
||||||
|
return <AppRoutes />
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div className="app-shell">
|
||||||
{user && <Navbar />}
|
<Sidebar />
|
||||||
|
<div className="app-main">
|
||||||
|
<div className="app-scroll">
|
||||||
<AppRoutes />
|
<AppRoutes />
|
||||||
{user && <Footer />}
|
</div>
|
||||||
</>
|
<Footer />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,94 @@
|
|||||||
|
Lato Regular 1.105 (lato-regular.ttf)
|
||||||
|
Copyright (c) 2010-2013 by tyPoland Lukasz Dziedzic with Reserved Font Name "Lato".
|
||||||
|
|
||||||
|
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||||
|
This license is copied below, and is also available with a FAQ at:
|
||||||
|
https://openfontlicense.org
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------
|
||||||
|
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||||
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
PREAMBLE
|
||||||
|
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||||
|
development of collaborative font projects, to support the font creation
|
||||||
|
efforts of academic and linguistic communities, and to provide a free and
|
||||||
|
open framework in which fonts may be shared and improved in partnership
|
||||||
|
with others.
|
||||||
|
|
||||||
|
The OFL allows the licensed fonts to be used, studied, modified and
|
||||||
|
redistributed freely as long as they are not sold by themselves. The
|
||||||
|
fonts, including any derivative works, can be bundled, embedded,
|
||||||
|
redistributed and/or sold with any software provided that any reserved
|
||||||
|
names are not used by derivative works. The fonts and derivatives,
|
||||||
|
however, cannot be released under any other type of license. The
|
||||||
|
requirement for fonts to remain under this license does not apply
|
||||||
|
to any document created using the fonts or their derivatives.
|
||||||
|
|
||||||
|
DEFINITIONS
|
||||||
|
"Font Software" refers to the set of files released by the Copyright
|
||||||
|
Holder(s) under this license and clearly marked as such. This may
|
||||||
|
include source files, build scripts and documentation.
|
||||||
|
|
||||||
|
"Reserved Font Name" refers to any names specified as such after the
|
||||||
|
copyright statement(s).
|
||||||
|
|
||||||
|
"Original Version" refers to the collection of Font Software components as
|
||||||
|
distributed by the Copyright Holder(s).
|
||||||
|
|
||||||
|
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||||
|
or substituting -- in part or in whole -- any of the components of the
|
||||||
|
Original Version, by changing formats or by porting the Font Software to a
|
||||||
|
new environment.
|
||||||
|
|
||||||
|
"Author" refers to any designer, engineer, programmer, technical
|
||||||
|
writer or other person who contributed to the Font Software.
|
||||||
|
|
||||||
|
PERMISSION & CONDITIONS
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||||
|
redistribute, and sell modified and unmodified copies of the Font
|
||||||
|
Software, subject to the following conditions:
|
||||||
|
|
||||||
|
1) Neither the Font Software nor any of its individual components,
|
||||||
|
in Original or Modified Versions, may be sold by itself.
|
||||||
|
|
||||||
|
2) Original or Modified Versions of the Font Software may be bundled,
|
||||||
|
redistributed and/or sold with any software, provided that each copy
|
||||||
|
contains the above copyright notice and this license. These can be
|
||||||
|
included either as stand-alone text files, human-readable headers or
|
||||||
|
in the appropriate machine-readable metadata fields within text or
|
||||||
|
binary files as long as those fields can be easily viewed by the user.
|
||||||
|
|
||||||
|
3) No Modified Version of the Font Software may use the Reserved Font
|
||||||
|
Name(s) unless explicit written permission is granted by the corresponding
|
||||||
|
Copyright Holder. This restriction only applies to the primary font name as
|
||||||
|
presented to the users.
|
||||||
|
|
||||||
|
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||||
|
Software shall not be used to promote, endorse or advertise any
|
||||||
|
Modified Version, except to acknowledge the contribution(s) of the
|
||||||
|
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||||
|
permission.
|
||||||
|
|
||||||
|
5) The Font Software, modified or unmodified, in part or in whole,
|
||||||
|
must be distributed entirely under this license, and must not be
|
||||||
|
distributed under any other license. The requirement for fonts to
|
||||||
|
remain under this license does not apply to any document created
|
||||||
|
using the Font Software.
|
||||||
|
|
||||||
|
TERMINATION
|
||||||
|
This license becomes null and void if any of the above conditions are
|
||||||
|
not met.
|
||||||
|
|
||||||
|
DISCLAIMER
|
||||||
|
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||||
|
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||||
|
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||||
|
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||||
|
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||||
Binary file not shown.
@@ -0,0 +1,154 @@
|
|||||||
|
import { useState } from 'react'
|
||||||
|
import { FaCodeBranch } from 'react-icons/fa'
|
||||||
|
import { FaLinkSlash } from 'react-icons/fa6'
|
||||||
|
import GiteaLinkButton from './GiteaLinkButton'
|
||||||
|
import PreviewLinkButton from './PreviewLinkButton'
|
||||||
|
import { suggestSubdomain } from '../lib/subdomain'
|
||||||
|
import { needsPreviewButton, assignSummary } from '../lib/projectAssign'
|
||||||
|
import { updateWebsiteProject, backfillProjectPushes } from '../lib/projectAdminApi'
|
||||||
|
|
||||||
|
const STATUS_COLORS = {
|
||||||
|
ready: '#10b981',
|
||||||
|
live: '#10b981',
|
||||||
|
online: '#10b981',
|
||||||
|
provisioning: '#f59e0b',
|
||||||
|
pending: '#f59e0b',
|
||||||
|
building: '#3b82f6',
|
||||||
|
error: '#ef4444',
|
||||||
|
failed: '#ef4444',
|
||||||
|
}
|
||||||
|
|
||||||
|
function StatusBadge({ label, value }) {
|
||||||
|
if (!value) return null
|
||||||
|
const color = STATUS_COLORS[String(value).toLowerCase()] || '#a0aec0'
|
||||||
|
return (
|
||||||
|
<span style={{ display: 'inline-flex', alignItems: 'center', gap: 6, fontSize: 12, color: '#cbd5e0', marginRight: 12 }}>
|
||||||
|
{label}:
|
||||||
|
<span style={{ display: 'inline-flex', alignItems: 'center', gap: 4, color }}>
|
||||||
|
<span style={{ width: 8, height: 8, borderRadius: '50%', background: color, display: 'inline-block' }} />
|
||||||
|
{value}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function AssignedProjectCard({ project, onUnassign, showActions = false, customerName = '', onChanged = () => {} }) {
|
||||||
|
const [showPreviewInput, setShowPreviewInput] = useState(false)
|
||||||
|
const [subdomain, setSubdomain] = useState('')
|
||||||
|
const [previewBusy, setPreviewBusy] = useState(false)
|
||||||
|
const [previewMessage, setPreviewMessage] = useState('')
|
||||||
|
const [pushBusy, setPushBusy] = useState(false)
|
||||||
|
const [pushMessage, setPushMessage] = useState('')
|
||||||
|
|
||||||
|
const openPreviewInput = () => {
|
||||||
|
setSubdomain(suggestSubdomain(customerName, project.projectName))
|
||||||
|
setPreviewMessage('')
|
||||||
|
setShowPreviewInput(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleEnablePreview = async () => {
|
||||||
|
setPreviewBusy(true)
|
||||||
|
setPreviewMessage('')
|
||||||
|
try {
|
||||||
|
const r = await updateWebsiteProject(project.$id, { projectType: 'preview', subdomain })
|
||||||
|
setPreviewMessage(`Preview läuft: ${r.previewUrl}`)
|
||||||
|
setShowPreviewInput(false)
|
||||||
|
onChanged()
|
||||||
|
} catch (err) {
|
||||||
|
setPreviewMessage(err.message)
|
||||||
|
} finally {
|
||||||
|
setPreviewBusy(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleBackfill = async () => {
|
||||||
|
setPushBusy(true)
|
||||||
|
setPushMessage('')
|
||||||
|
try {
|
||||||
|
const r = await backfillProjectPushes(project.$id)
|
||||||
|
setPushMessage(assignSummary(project.projectName, r).text)
|
||||||
|
onChanged()
|
||||||
|
} catch (err) {
|
||||||
|
setPushMessage(err.message)
|
||||||
|
} finally {
|
||||||
|
setPushBusy(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div style={{ background: 'rgba(30,41,59,0.5)', border: '1px solid rgba(59,130,246,0.25)', borderRadius: 10, padding: '12px 14px', marginBottom: 12 }}>
|
||||||
|
<div style={{ display: 'flex', gap: 8, alignItems: 'flex-start', justifyContent: 'space-between' }}>
|
||||||
|
<div style={{ minWidth: 0 }}>
|
||||||
|
<strong>{project.projectName}</strong>
|
||||||
|
{project.subdomain && <span className="text-grey" style={{ marginLeft: 8, fontSize: 13 }}>({project.subdomain})</span>}
|
||||||
|
{project.repoFullName && (
|
||||||
|
<div className="text-grey" style={{ fontSize: 12, marginTop: 4 }}>
|
||||||
|
<FaCodeBranch style={{ marginRight: 4 }} />{project.repoFullName}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<div style={{ display: 'flex', gap: 8, alignItems: 'center', flexShrink: 0 }}>
|
||||||
|
<PreviewLinkButton href={project.previewUrl} />
|
||||||
|
<GiteaLinkButton href={project.giteaRepoUrl} />
|
||||||
|
{showActions && onUnassign && (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
title="Vom Ticket lösen"
|
||||||
|
aria-label="Vom Ticket lösen"
|
||||||
|
onClick={() => onUnassign(project.$id)}
|
||||||
|
style={{ display: 'inline-flex', alignItems: 'center', justifyContent: 'center', width: 32, height: 32, borderRadius: 6, background: 'rgba(239, 68, 68, 0.12)', border: '1px solid rgba(239, 68, 68, 0.35)', color: '#f87171', cursor: 'pointer' }}
|
||||||
|
>
|
||||||
|
<FaLinkSlash size={16} />
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Status- und Provisioning-Zeile */}
|
||||||
|
<div style={{ marginTop: 10, display: 'flex', flexWrap: 'wrap', alignItems: 'center' }}>
|
||||||
|
<StatusBadge label="Status" value={project.status} />
|
||||||
|
<StatusBadge label="Provisioning" value={project.provisioningStatus} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{showActions && (
|
||||||
|
<div style={{ marginTop: 10 }}>
|
||||||
|
<div style={{ display: 'flex', gap: 8, flexWrap: 'wrap', alignItems: 'center' }}>
|
||||||
|
{needsPreviewButton(project) && !showPreviewInput && (
|
||||||
|
<button type="button" className="btn btn-sm" onClick={openPreviewInput}>
|
||||||
|
Preview einschalten
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
{showPreviewInput && (
|
||||||
|
<>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
style={{ maxWidth: 200 }}
|
||||||
|
value={subdomain}
|
||||||
|
onChange={(e) => setSubdomain(e.target.value)}
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="btn btn-sm"
|
||||||
|
disabled={!subdomain || previewBusy}
|
||||||
|
onClick={handleEnablePreview}
|
||||||
|
>
|
||||||
|
Einschalten
|
||||||
|
</button>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
<button type="button" className="btn btn-sm" disabled={pushBusy} onClick={handleBackfill}>
|
||||||
|
Pushes nachtragen
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{(previewMessage || pushMessage) && (
|
||||||
|
<div className="text-grey" style={{ marginTop: 6, fontSize: 12 }}>
|
||||||
|
{previewMessage && <div>{previewMessage}</div>}
|
||||||
|
{pushMessage && <div>{pushMessage}</div>}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
import { useEffect, useRef, useState } from 'react'
|
||||||
|
import { FaCheck, FaCopy, FaEye, FaEyeSlash } from 'react-icons/fa6'
|
||||||
|
|
||||||
|
async function copyText(text) {
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(text)
|
||||||
|
} catch {
|
||||||
|
const textarea = document.createElement('textarea')
|
||||||
|
textarea.value = text
|
||||||
|
textarea.setAttribute('readonly', '')
|
||||||
|
textarea.style.position = 'fixed'
|
||||||
|
textarea.style.left = '-9999px'
|
||||||
|
document.body.appendChild(textarea)
|
||||||
|
textarea.select()
|
||||||
|
document.execCommand('copy')
|
||||||
|
document.body.removeChild(textarea)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function CopyableCredential({ value, secret = false, label = 'Wert' }) {
|
||||||
|
const [visible, setVisible] = useState(!secret)
|
||||||
|
const [copied, setCopied] = useState(false)
|
||||||
|
const timeoutRef = useRef(null)
|
||||||
|
const text = String(value || '').trim()
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setVisible(!secret)
|
||||||
|
}, [secret, text])
|
||||||
|
|
||||||
|
useEffect(() => () => clearTimeout(timeoutRef.current), [])
|
||||||
|
|
||||||
|
if (!text) return <span className="credential-empty">–</span>
|
||||||
|
|
||||||
|
const handleCopy = async (event) => {
|
||||||
|
event.preventDefault()
|
||||||
|
event.stopPropagation()
|
||||||
|
await copyText(text)
|
||||||
|
setCopied(true)
|
||||||
|
clearTimeout(timeoutRef.current)
|
||||||
|
timeoutRef.current = setTimeout(() => setCopied(false), 1800)
|
||||||
|
}
|
||||||
|
|
||||||
|
const displayValue = secret && !visible ? '••••••••••••' : text
|
||||||
|
|
||||||
|
return (
|
||||||
|
<span className="credential">
|
||||||
|
<span
|
||||||
|
className={`credential-value ${secret && !visible ? 'is-masked' : ''}`}
|
||||||
|
title={secret && !visible ? `${label} anzeigen` : text}
|
||||||
|
>
|
||||||
|
{displayValue}
|
||||||
|
</span>
|
||||||
|
{secret && (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="credential-action"
|
||||||
|
onClick={(event) => {
|
||||||
|
event.preventDefault()
|
||||||
|
event.stopPropagation()
|
||||||
|
setVisible((current) => !current)
|
||||||
|
}}
|
||||||
|
title={visible ? `${label} ausblenden` : `${label} anzeigen`}
|
||||||
|
aria-label={visible ? `${label} ausblenden` : `${label} anzeigen`}
|
||||||
|
>
|
||||||
|
{visible ? <FaEyeSlash /> : <FaEye />}
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="credential-action"
|
||||||
|
onClick={handleCopy}
|
||||||
|
title={copied ? 'Kopiert' : `${label} kopieren`}
|
||||||
|
aria-label={copied ? `${label} kopiert` : `${label} kopieren`}
|
||||||
|
>
|
||||||
|
{copied ? <FaCheck className="credential-check" /> : <FaCopy />}
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getCustomerPortalPassword(customer) {
|
||||||
|
return customer?.portalPassword || customer?.password || ''
|
||||||
|
}
|
||||||
@@ -1,92 +1,119 @@
|
|||||||
import { useState } from 'react'
|
import { useState, useEffect, useMemo } from 'react'
|
||||||
import { FaTimes } from 'react-icons/fa'
|
import { FaTimes } from 'react-icons/fa'
|
||||||
|
import { useEmployees } from '../hooks/useEmployees'
|
||||||
|
import { databases, DATABASE_ID, COLLECTIONS, Query } from '../lib/appwrite'
|
||||||
|
import {
|
||||||
|
SERVICE_TYPES,
|
||||||
|
todayIso,
|
||||||
|
isoToGermanDate,
|
||||||
|
timeToWoms,
|
||||||
|
buildRequesterSuggestions,
|
||||||
|
rankSuggestions,
|
||||||
|
} from '../lib/ticketForm'
|
||||||
|
import { priorityFor } from '../lib/ticketStatus'
|
||||||
|
import { AutocompleteInput, DateTimeInput } from './ui'
|
||||||
|
|
||||||
|
// Neue Tickets gibt es aktuell nur fuer diese Arten; alte Tickets behalten ihre Art.
|
||||||
|
// Migration = ein Kunde, den wir von einem anderen Anbieter uebernehmen.
|
||||||
const TICKET_TYPES = [
|
const TICKET_TYPES = [
|
||||||
'Home Office', 'Holidays', 'Trip', 'Supportrequest', 'Change Request',
|
{ value: 'Webpage', label: 'Webpage' },
|
||||||
'Maintenance', 'Project', 'Controlling', 'Development', 'Documentation',
|
{ value: 'Migration', label: 'Migration (Übernahme von anderem Anbieter)' },
|
||||||
'Meeting/Conference', 'IT Management', 'IT Security', 'Procurement',
|
|
||||||
'Rollout', 'Emergency Call', 'Other Services'
|
|
||||||
]
|
]
|
||||||
|
|
||||||
const SYSTEMS = [
|
// Datum als "yyyy-mm-dd", Uhrzeit als "hh:mm" (Werte der Kalender-Felder).
|
||||||
'Account View', 'Client', 'Cofano', 'Credentials', 'Diamant', 'Docuware',
|
// Die Service-Art fragt das Formular nicht mehr ab: gespeichert wird Fernwartung.
|
||||||
'EDI', 'eMail', 'Employee', 'Invoice', 'LBase', 'Medical Office', 'Network',
|
const emptyForm = () => ({
|
||||||
'O365', 'PDF Viewer', 'Printer', 'Reports', 'Server', 'Time Tracking',
|
|
||||||
'TK', 'TOS', 'Vivendi NG', 'VGM', '(W)LAN', '(W)WAN', 'WOMS', 'n/a'
|
|
||||||
]
|
|
||||||
|
|
||||||
const RESPONSE_LEVELS = [
|
|
||||||
'USER', 'KEY USER', 'Helpdesk', 'Support', 'Admin', 'FS/FE', '24/7',
|
|
||||||
'TECH MGMT', 'Backoffice', 'BUSI MGMT', 'n/a'
|
|
||||||
]
|
|
||||||
|
|
||||||
const SERVICE_TYPES = ['Remote', 'On Site', 'Off Site']
|
|
||||||
|
|
||||||
const PRIORITIES = [
|
|
||||||
{ value: 0, label: 'None' },
|
|
||||||
{ value: 1, label: 'Low' },
|
|
||||||
{ value: 2, label: 'Medium' },
|
|
||||||
{ value: 3, label: 'High' },
|
|
||||||
{ value: 4, label: 'Critical' }
|
|
||||||
]
|
|
||||||
|
|
||||||
const today = new Date().toLocaleDateString('de-DE')
|
|
||||||
|
|
||||||
export default function CreateTicketModal({ isOpen, onClose, onCreate, customers = [] }) {
|
|
||||||
const [formData, setFormData] = useState({
|
|
||||||
customerId: '',
|
customerId: '',
|
||||||
type: 'Supportrequest',
|
type: TICKET_TYPES[0].value,
|
||||||
systemType: '',
|
serviceType: SERVICE_TYPES[0].value,
|
||||||
responseLevel: '',
|
urgent: false,
|
||||||
serviceType: 'Remote',
|
|
||||||
priority: 1,
|
|
||||||
topic: '',
|
topic: '',
|
||||||
requestedBy: '',
|
requestedBy: '',
|
||||||
requestedFor: '',
|
startDate: todayIso(),
|
||||||
startDate: today,
|
|
||||||
startTime: '',
|
startTime: '',
|
||||||
deadline: today,
|
deadline: todayIso(),
|
||||||
endTime: '',
|
endTime: '',
|
||||||
estimate: '30',
|
|
||||||
mailCopyTo: '',
|
|
||||||
sendNotification: false,
|
|
||||||
details: ''
|
details: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
|
export default function CreateTicketModal({ isOpen, onClose, onCreate, customers = [] }) {
|
||||||
|
const { employees } = useEmployees()
|
||||||
|
|
||||||
|
const [formData, setFormData] = useState(emptyForm)
|
||||||
|
const [recentTickets, setRecentTickets] = useState([])
|
||||||
|
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
|
const [error, setError] = useState('')
|
||||||
|
|
||||||
|
// Reset error when modal opens
|
||||||
|
useEffect(() => {
|
||||||
|
if (isOpen) setError('')
|
||||||
|
}, [isOpen])
|
||||||
|
|
||||||
|
// Namen aus den letzten Tickets fuer die Autovervollstaendigung
|
||||||
|
useEffect(() => {
|
||||||
|
if (!isOpen) return
|
||||||
|
let cancelled = false
|
||||||
|
databases
|
||||||
|
.listDocuments(DATABASE_ID, COLLECTIONS.WORKORDERS, [Query.orderDesc('$createdAt'), Query.limit(200)])
|
||||||
|
.then((response) => {
|
||||||
|
if (!cancelled) setRecentTickets(response.documents || [])
|
||||||
|
})
|
||||||
|
.catch((err) => console.warn('Vorschläge aus früheren Tickets nicht geladen:', err))
|
||||||
|
return () => {
|
||||||
|
cancelled = true
|
||||||
|
}
|
||||||
|
}, [isOpen])
|
||||||
|
|
||||||
|
const suggestions = useMemo(
|
||||||
|
() => buildRequesterSuggestions({ customers, employees, tickets: recentTickets }),
|
||||||
|
[customers, employees, recentTickets]
|
||||||
|
)
|
||||||
|
const getSuggestions = (text) => rankSuggestions(suggestions, text, { customerId: formData.customerId })
|
||||||
|
|
||||||
const handleChange = (field, value) => {
|
const handleChange = (field, value) => {
|
||||||
setFormData(prev => ({ ...prev, [field]: value }))
|
setFormData(prev => ({ ...prev, [field]: value }))
|
||||||
|
// Clear error when user makes changes
|
||||||
|
if (error) setError('')
|
||||||
|
}
|
||||||
|
|
||||||
|
// Das Ende darf nicht vor dem Start liegen, deshalb rueckt es mit
|
||||||
|
const handleStartDateChange = (value) => {
|
||||||
|
setFormData(prev => ({
|
||||||
|
...prev,
|
||||||
|
startDate: value,
|
||||||
|
deadline: value && prev.deadline && prev.deadline < value ? value : prev.deadline
|
||||||
|
}))
|
||||||
|
if (error) setError('')
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSubmit = async (e) => {
|
const handleSubmit = async (e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
|
setError('')
|
||||||
|
|
||||||
|
const customer = customers.find(c => c.$id === formData.customerId)
|
||||||
|
const { urgent, ...fields } = formData
|
||||||
try {
|
try {
|
||||||
await onCreate(formData)
|
const result = await onCreate({
|
||||||
onClose()
|
...fields,
|
||||||
setFormData({
|
priority: priorityFor(urgent),
|
||||||
customerId: '',
|
customerName: customer?.name || '',
|
||||||
type: 'Supportrequest',
|
customerLocation: customer?.location || '',
|
||||||
systemType: '',
|
startDate: isoToGermanDate(formData.startDate),
|
||||||
responseLevel: '',
|
startTime: timeToWoms(formData.startTime),
|
||||||
serviceType: 'Remote',
|
deadline: isoToGermanDate(formData.deadline),
|
||||||
priority: 1,
|
endTime: timeToWoms(formData.endTime)
|
||||||
topic: '',
|
|
||||||
requestedBy: '',
|
|
||||||
requestedFor: '',
|
|
||||||
startDate: today,
|
|
||||||
startTime: '',
|
|
||||||
deadline: today,
|
|
||||||
endTime: '',
|
|
||||||
estimate: '30',
|
|
||||||
mailCopyTo: '',
|
|
||||||
sendNotification: false,
|
|
||||||
details: ''
|
|
||||||
})
|
})
|
||||||
|
if (result.success) {
|
||||||
|
onClose()
|
||||||
|
setFormData(emptyForm())
|
||||||
|
} else {
|
||||||
|
setError(result.error || 'Fehler beim Erstellen des Tickets')
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error creating ticket:', error)
|
console.error('Error creating ticket:', error)
|
||||||
|
setError(error.message || 'Ein unerwarteter Fehler ist aufgetreten')
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
@@ -100,104 +127,73 @@ export default function CreateTicketModal({ isOpen, onClose, onCreate, customers
|
|||||||
<FaTimes />
|
<FaTimes />
|
||||||
</span>
|
</span>
|
||||||
<div className="overlay-content">
|
<div className="overlay-content">
|
||||||
<h2 className="mb-2">Create New Ticket</h2>
|
<h2 className="mb-2">Neues Ticket</h2>
|
||||||
|
|
||||||
|
{error && (
|
||||||
|
<div className="bg-red text-white p-2 mb-2" style={{ borderRadius: '4px' }}>
|
||||||
|
{error}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
<form onSubmit={handleSubmit}>
|
<form onSubmit={handleSubmit}>
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col col-6">
|
<div className="col col-6">
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<label className="form-label">Customer ID</label>
|
<label className="form-label">Kunde</label>
|
||||||
<select
|
<select
|
||||||
className="form-control"
|
className="form-control"
|
||||||
value={formData.customerId}
|
value={formData.customerId}
|
||||||
onChange={(e) => handleChange('customerId', e.target.value)}
|
onChange={(e) => handleChange('customerId', e.target.value)}
|
||||||
required
|
required
|
||||||
>
|
>
|
||||||
<option value="">Affected Customer</option>
|
<option value="">Kunde wählen</option>
|
||||||
{customers.map(c => (
|
{customers.map(c => (
|
||||||
<option key={c.id} value={c.id}>({c.code}) {c.name}</option>
|
<option key={c.$id} value={c.$id}>({c.code || ''}) {c.name || 'Unnamed'}</option>
|
||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<label className="form-label">Work Order Type</label>
|
<label className="form-label">Art</label>
|
||||||
<select
|
<select
|
||||||
className="form-control"
|
className="form-control"
|
||||||
value={formData.type}
|
value={formData.type}
|
||||||
onChange={(e) => handleChange('type', e.target.value)}
|
onChange={(e) => handleChange('type', e.target.value)}
|
||||||
>
|
>
|
||||||
{TICKET_TYPES.map(type => (
|
{TICKET_TYPES.map(type => (
|
||||||
<option key={type} value={type}>{type}</option>
|
<option key={type.value} value={type.value}>{type.label}</option>
|
||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<label className="form-label">Affected System</label>
|
<label style={{ display: 'flex', alignItems: 'center', gap: '8px', cursor: 'pointer' }}>
|
||||||
<select
|
<input
|
||||||
className="form-control"
|
type="checkbox"
|
||||||
value={formData.systemType}
|
checked={formData.urgent}
|
||||||
onChange={(e) => handleChange('systemType', e.target.value)}
|
onChange={(e) => handleChange('urgent', e.target.checked)}
|
||||||
required
|
/>
|
||||||
>
|
Dringend
|
||||||
<option value="">Affected System</option>
|
</label>
|
||||||
{SYSTEMS.map(sys => (
|
|
||||||
<option key={sys} value={sys}>{sys}</option>
|
|
||||||
))}
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="form-group">
|
<div className="form-group automatic-assignment-note">
|
||||||
<label className="form-label">Response Level</label>
|
<label className="form-label">Zuweisung</label>
|
||||||
<select
|
<p>
|
||||||
className="form-control"
|
{employees.length > 0
|
||||||
value={formData.responseLevel}
|
? `Automatisch an den Mitarbeiter mit der geringsten Anzahl offener Tickets (${employees.length} verfügbar).`
|
||||||
onChange={(e) => handleChange('responseLevel', e.target.value)}
|
: 'Es ist noch kein Mitarbeiter verfügbar. Das Ticket bleibt zunächst offen.'}
|
||||||
>
|
</p>
|
||||||
<option value="">Response Level</option>
|
|
||||||
{RESPONSE_LEVELS.map(level => (
|
|
||||||
<option key={level} value={level}>{level}</option>
|
|
||||||
))}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="form-group">
|
|
||||||
<label className="form-label">Service Type</label>
|
|
||||||
<select
|
|
||||||
className="form-control"
|
|
||||||
value={formData.serviceType}
|
|
||||||
onChange={(e) => handleChange('serviceType', e.target.value)}
|
|
||||||
>
|
|
||||||
{SERVICE_TYPES.map(type => (
|
|
||||||
<option key={type} value={type}>{type}</option>
|
|
||||||
))}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="form-group">
|
|
||||||
<label className="form-label">Priority</label>
|
|
||||||
<select
|
|
||||||
className="form-control"
|
|
||||||
value={formData.priority}
|
|
||||||
onChange={(e) => handleChange('priority', parseInt(e.target.value))}
|
|
||||||
required
|
|
||||||
>
|
|
||||||
<option value="">Priority Level</option>
|
|
||||||
{PRIORITIES.map(p => (
|
|
||||||
<option key={p.value} value={p.value}>{p.label}</option>
|
|
||||||
))}
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="col col-6">
|
<div className="col col-6">
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<label className="form-label">Topic</label>
|
<label className="form-label">Betreff</label>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
className="form-control"
|
className="form-control"
|
||||||
placeholder="Topic"
|
placeholder="Worum geht es?"
|
||||||
value={formData.topic}
|
value={formData.topic}
|
||||||
onChange={(e) => handleChange('topic', e.target.value)}
|
onChange={(e) => handleChange('topic', e.target.value)}
|
||||||
required
|
required
|
||||||
@@ -205,113 +201,50 @@ export default function CreateTicketModal({ isOpen, onClose, onCreate, customers
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<label className="form-label">Requested by</label>
|
<label className="form-label" htmlFor="ticket-requested-by">Angefragt von</label>
|
||||||
<input
|
<AutocompleteInput
|
||||||
type="text"
|
id="ticket-requested-by"
|
||||||
className="form-control"
|
|
||||||
placeholder="Name"
|
placeholder="Name"
|
||||||
value={formData.requestedBy}
|
value={formData.requestedBy}
|
||||||
onChange={(e) => handleChange('requestedBy', e.target.value)}
|
onChange={(value) => handleChange('requestedBy', value)}
|
||||||
|
getSuggestions={getSuggestions}
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<label className="form-label">Requested for</label>
|
<label className="form-label" htmlFor="ticket-start-date">Beginn</label>
|
||||||
<input
|
<DateTimeInput
|
||||||
type="text"
|
id="ticket-start-date"
|
||||||
className="form-control"
|
timeLabel="Uhrzeit Beginn"
|
||||||
placeholder="Name"
|
date={formData.startDate}
|
||||||
value={formData.requestedFor}
|
time={formData.startTime}
|
||||||
onChange={(e) => handleChange('requestedFor', e.target.value)}
|
onDateChange={handleStartDateChange}
|
||||||
|
onTimeChange={(value) => handleChange('startTime', value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<label className="form-label">Start Date & Time</label>
|
<label className="form-label" htmlFor="ticket-end-date">Deadline</label>
|
||||||
<div style={{ display: 'flex', gap: '8px' }}>
|
<DateTimeInput
|
||||||
<input
|
id="ticket-end-date"
|
||||||
type="text"
|
timeLabel="Uhrzeit Deadline"
|
||||||
className="form-control"
|
min={formData.startDate}
|
||||||
placeholder="dd.mm.yyyy"
|
date={formData.deadline}
|
||||||
value={formData.startDate}
|
time={formData.endTime}
|
||||||
onChange={(e) => handleChange('startDate', e.target.value)}
|
onDateChange={(value) => handleChange('deadline', value)}
|
||||||
style={{ flex: 1 }}
|
onTimeChange={(value) => handleChange('endTime', value)}
|
||||||
/>
|
/>
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
className="form-control"
|
|
||||||
placeholder="hhmm"
|
|
||||||
value={formData.startTime}
|
|
||||||
onChange={(e) => handleChange('startTime', e.target.value)}
|
|
||||||
style={{ flex: 1 }}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="form-group">
|
|
||||||
<label className="form-label">End Date & Time (Deadline)</label>
|
|
||||||
<div style={{ display: 'flex', gap: '8px' }}>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
className="form-control"
|
|
||||||
placeholder="dd.mm.yyyy"
|
|
||||||
value={formData.deadline}
|
|
||||||
onChange={(e) => handleChange('deadline', e.target.value)}
|
|
||||||
style={{ flex: 1 }}
|
|
||||||
/>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
className="form-control"
|
|
||||||
placeholder="hhmm"
|
|
||||||
value={formData.endTime}
|
|
||||||
onChange={(e) => handleChange('endTime', e.target.value)}
|
|
||||||
style={{ flex: 1 }}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="form-group">
|
|
||||||
<label className="form-label">Workload Estimate</label>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
className="form-control"
|
|
||||||
placeholder="xx minutes"
|
|
||||||
value={formData.estimate}
|
|
||||||
onChange={(e) => handleChange('estimate', e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="form-group">
|
|
||||||
<label className="form-label">Notification Recipient(s)</label>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
className="form-control"
|
|
||||||
placeholder="name@domain.xx"
|
|
||||||
value={formData.mailCopyTo}
|
|
||||||
onChange={(e) => handleChange('mailCopyTo', e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="form-group">
|
|
||||||
<label style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
checked={formData.sendNotification}
|
|
||||||
onChange={(e) => handleChange('sendNotification', e.target.checked)}
|
|
||||||
/>
|
|
||||||
Send Notification?
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<label className="form-label">Details</label>
|
<label className="form-label">Beschreibung</label>
|
||||||
<textarea
|
<textarea
|
||||||
className="form-control"
|
className="form-control"
|
||||||
rows={5}
|
rows={5}
|
||||||
placeholder="Details"
|
placeholder="Was soll gemacht werden?"
|
||||||
value={formData.details}
|
value={formData.details}
|
||||||
onChange={(e) => handleChange('details', e.target.value)}
|
onChange={(e) => handleChange('details', e.target.value)}
|
||||||
/>
|
/>
|
||||||
@@ -323,7 +256,7 @@ export default function CreateTicketModal({ isOpen, onClose, onCreate, customers
|
|||||||
className="btn btn-dark"
|
className="btn btn-dark"
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
>
|
>
|
||||||
{loading ? 'Creating...' : 'CREATE NOW'}
|
{loading ? 'Wird angelegt …' : 'Ticket anlegen'}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -0,0 +1,285 @@
|
|||||||
|
import { useState, useEffect } from 'react'
|
||||||
|
import { FaTimes } from 'react-icons/fa'
|
||||||
|
import { useAuth } from '../context/AuthContext'
|
||||||
|
import { SERVICE_TYPES, todayIso, isoToGermanDate, timeToWoms, minutesBetween } from '../lib/ticketForm'
|
||||||
|
import { TICKET_STATUSES, statusLabel } from '../lib/ticketStatus'
|
||||||
|
import { DateTimeInput } from './ui'
|
||||||
|
|
||||||
|
// Akquise-Tickets: Ergebnis des Kundenkontakts (statt technischer Status)
|
||||||
|
const ACQUISITION_STATUS = ['In Kontakt', 'Zugesagt', 'Abgesagt']
|
||||||
|
|
||||||
|
// Die sechs Status; ein alter Status (z. B. "Assigned") bleibt als aktuelle Auswahl sichtbar
|
||||||
|
function statusOptionsFor(current) {
|
||||||
|
if (!current || TICKET_STATUSES.some((s) => s.value === current)) return TICKET_STATUSES
|
||||||
|
return [{ value: current, label: `${statusLabel(current)} (bisher)` }, ...TICKET_STATUSES]
|
||||||
|
}
|
||||||
|
|
||||||
|
// Datum als "yyyy-mm-dd", Uhrzeit als "hh:mm" (Werte der Kalender-Felder).
|
||||||
|
// Die Service-Art kommt vom Ticket; das alte "Off Site" zaehlt als Fernwartung.
|
||||||
|
const initialForm = (workorder, newStatus) => ({
|
||||||
|
serviceType: SERVICE_TYPES.some(t => t.value === workorder?.serviceType)
|
||||||
|
? workorder.serviceType
|
||||||
|
: SERVICE_TYPES[0].value,
|
||||||
|
newStatus,
|
||||||
|
totalTime: 0,
|
||||||
|
startDate: todayIso(),
|
||||||
|
startTime: '',
|
||||||
|
endDate: todayIso(),
|
||||||
|
endTime: '',
|
||||||
|
details: '',
|
||||||
|
isComment: false,
|
||||||
|
countsToPlan: false
|
||||||
|
})
|
||||||
|
|
||||||
|
export default function CreateWorksheetModal({ isOpen, onClose, workorder, onCreate, aboHoursAllowed = true }) {
|
||||||
|
const { user } = useAuth()
|
||||||
|
|
||||||
|
const isAcquisition = workorder?.type === 'Akquise'
|
||||||
|
const statusOptions = isAcquisition
|
||||||
|
? ACQUISITION_STATUS.map((s) => ({ value: s, label: s }))
|
||||||
|
: statusOptionsFor(workorder?.status)
|
||||||
|
const defaultStatus = isAcquisition
|
||||||
|
? (ACQUISITION_STATUS.includes(workorder?.status) ? workorder.status : 'In Kontakt')
|
||||||
|
: (workorder?.status || 'Open')
|
||||||
|
|
||||||
|
const [formData, setFormData] = useState(() => initialForm(workorder, defaultStatus))
|
||||||
|
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
|
const [error, setError] = useState('')
|
||||||
|
const [autoCalculate, setAutoCalculate] = useState(true)
|
||||||
|
|
||||||
|
// Reset form wenn Modal geöffnet wird
|
||||||
|
useEffect(() => {
|
||||||
|
if (isOpen && workorder) {
|
||||||
|
setFormData(initialForm(workorder, defaultStatus))
|
||||||
|
setError('')
|
||||||
|
setAutoCalculate(true)
|
||||||
|
}
|
||||||
|
}, [isOpen, workorder, defaultStatus])
|
||||||
|
|
||||||
|
// Automatische Zeitberechnung
|
||||||
|
useEffect(() => {
|
||||||
|
if (!autoCalculate || formData.isComment) return
|
||||||
|
const minutes = minutesBetween(formData.startTime, formData.endTime)
|
||||||
|
if (minutes !== null) {
|
||||||
|
setFormData(prev => ({ ...prev, totalTime: minutes }))
|
||||||
|
}
|
||||||
|
}, [formData.startTime, formData.endTime, formData.isComment, autoCalculate])
|
||||||
|
|
||||||
|
const handleChange = (field, value) => {
|
||||||
|
setFormData(prev => ({ ...prev, [field]: value }))
|
||||||
|
|
||||||
|
// Wenn totalTime manuell geändert wird, deaktiviere Auto-Berechnung
|
||||||
|
if (field === 'totalTime') {
|
||||||
|
setAutoCalculate(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Das Ende darf nicht vor dem Start liegen, deshalb rueckt es mit
|
||||||
|
const handleStartDateChange = (value) => {
|
||||||
|
setFormData(prev => ({
|
||||||
|
...prev,
|
||||||
|
startDate: value,
|
||||||
|
endDate: value && prev.endDate && prev.endDate < value ? value : prev.endDate
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSubmit = async (e) => {
|
||||||
|
e.preventDefault()
|
||||||
|
setLoading(true)
|
||||||
|
setError('')
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!formData.details.trim()) {
|
||||||
|
setError('Bitte Details eingeben')
|
||||||
|
setLoading(false)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const worksheetData = {
|
||||||
|
woid: workorder.woid,
|
||||||
|
workorderId: workorder.$id,
|
||||||
|
serviceType: formData.serviceType,
|
||||||
|
oldStatus: workorder.status,
|
||||||
|
newStatus: formData.newStatus,
|
||||||
|
totalTime: formData.isComment ? 0 : parseInt(formData.totalTime) || 0,
|
||||||
|
startDate: isoToGermanDate(formData.startDate),
|
||||||
|
startTime: timeToWoms(formData.startTime),
|
||||||
|
endDate: isoToGermanDate(formData.endDate),
|
||||||
|
endTime: timeToWoms(formData.endTime),
|
||||||
|
details: formData.details,
|
||||||
|
isComment: formData.isComment,
|
||||||
|
countsToPlan: aboHoursAllowed && !formData.isComment && formData.countsToPlan,
|
||||||
|
employeeShort: user?.prefs?.shortCode || '' // Aus User-Preferences
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = await onCreate(worksheetData, user)
|
||||||
|
|
||||||
|
if (result.success) {
|
||||||
|
onClose()
|
||||||
|
} else {
|
||||||
|
setError(result.error || 'Fehler beim Speichern des Arbeitsblatts')
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error creating worksheet:', err)
|
||||||
|
setError(err.message || 'Ein unerwarteter Fehler ist aufgetreten')
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isOpen || !workorder) return null
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="overlay">
|
||||||
|
<span className="overlay-close" onClick={onClose}>
|
||||||
|
<FaTimes />
|
||||||
|
</span>
|
||||||
|
<div className="overlay-content">
|
||||||
|
<h2 className="mb-2">Neues Arbeitsblatt – Ticket {workorder.woid}</h2>
|
||||||
|
|
||||||
|
{error && (
|
||||||
|
<div className="bg-red text-white p-2 mb-2" style={{ borderRadius: '4px' }}>
|
||||||
|
{error}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<form onSubmit={handleSubmit}>
|
||||||
|
<div className="row">
|
||||||
|
<div className="col col-6">
|
||||||
|
<div className="form-group">
|
||||||
|
<label className="form-label">Art</label>
|
||||||
|
<select
|
||||||
|
className="form-control"
|
||||||
|
value={formData.serviceType}
|
||||||
|
onChange={(e) => handleChange('serviceType', e.target.value)}
|
||||||
|
required
|
||||||
|
>
|
||||||
|
{SERVICE_TYPES.map(type => (
|
||||||
|
<option key={type.value} value={type.value}>{type.label}</option>
|
||||||
|
))}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="form-group">
|
||||||
|
<label className="form-label">{isAcquisition ? 'Akquise-Ergebnis' : 'Neuer Status'}</label>
|
||||||
|
<select
|
||||||
|
className="form-control"
|
||||||
|
value={formData.newStatus}
|
||||||
|
onChange={(e) => handleChange('newStatus', e.target.value)}
|
||||||
|
required
|
||||||
|
>
|
||||||
|
{statusOptions.map(status => (
|
||||||
|
<option key={status.value} value={status.value}>{status.label}</option>
|
||||||
|
))}
|
||||||
|
</select>
|
||||||
|
{isAcquisition && (
|
||||||
|
<small style={{ color: '#a0aec0', fontSize: '12px' }}>
|
||||||
|
"Zugesagt" macht den Lead automatisch zum festen Kunden.
|
||||||
|
</small>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="form-group">
|
||||||
|
<label style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
checked={formData.isComment}
|
||||||
|
onChange={(e) => handleChange('isComment', e.target.checked)}
|
||||||
|
/>
|
||||||
|
Nur Kommentar (keine Arbeitszeit)
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{aboHoursAllowed && (
|
||||||
|
<div className="form-group">
|
||||||
|
<label style={{ display: 'flex', alignItems: 'center', gap: '8px' }} title="Zeit wird vom Stundenguthaben des Wartungs-Abos abgezogen und im Kundenportal angezeigt">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
checked={formData.countsToPlan && !formData.isComment}
|
||||||
|
disabled={formData.isComment}
|
||||||
|
onChange={(e) => handleChange('countsToPlan', e.target.checked)}
|
||||||
|
/>
|
||||||
|
Vom Abo-Stundenkonto abziehen
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="col col-6">
|
||||||
|
<div className="form-group">
|
||||||
|
<label className="form-label" htmlFor="worksheet-start-date">Beginn</label>
|
||||||
|
<DateTimeInput
|
||||||
|
id="worksheet-start-date"
|
||||||
|
timeLabel="Uhrzeit Beginn"
|
||||||
|
required
|
||||||
|
date={formData.startDate}
|
||||||
|
time={formData.startTime}
|
||||||
|
onDateChange={handleStartDateChange}
|
||||||
|
onTimeChange={(value) => handleChange('startTime', value)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="form-group">
|
||||||
|
<label className="form-label" htmlFor="worksheet-end-date">Ende</label>
|
||||||
|
<DateTimeInput
|
||||||
|
id="worksheet-end-date"
|
||||||
|
timeLabel="Uhrzeit Ende"
|
||||||
|
required
|
||||||
|
min={formData.startDate}
|
||||||
|
date={formData.endDate}
|
||||||
|
time={formData.endTime}
|
||||||
|
onDateChange={(value) => handleChange('endDate', value)}
|
||||||
|
onTimeChange={(value) => handleChange('endTime', value)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="form-group">
|
||||||
|
<label className="form-label">Arbeitszeit (Minuten)</label>
|
||||||
|
{/* Ganze Minuten: mit step 15 blockierte der Browser berechnete Zeiten wie 70 */}
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
className="form-control"
|
||||||
|
min="0"
|
||||||
|
step="1"
|
||||||
|
value={formData.totalTime}
|
||||||
|
onChange={(e) => handleChange('totalTime', e.target.value)}
|
||||||
|
disabled={formData.isComment}
|
||||||
|
placeholder="0"
|
||||||
|
/>
|
||||||
|
<small style={{ color: '#a0aec0', fontSize: '12px' }}>
|
||||||
|
{autoCalculate && formData.startTime && formData.endTime
|
||||||
|
? '✓ Automatisch berechnet'
|
||||||
|
: 'Manuell eingeben'}
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="form-group">
|
||||||
|
<label className="form-label">Was wurde gemacht?</label>
|
||||||
|
<textarea
|
||||||
|
className="form-control"
|
||||||
|
rows={5}
|
||||||
|
placeholder="Beschreibe die durchgeführten Arbeiten..."
|
||||||
|
value={formData.details}
|
||||||
|
onChange={(e) => handleChange('details', e.target.value)}
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="text-center mt-2">
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
className="btn btn-dark"
|
||||||
|
disabled={loading}
|
||||||
|
>
|
||||||
|
{loading ? 'Speichert …' : 'Speichern'}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,44 +1,34 @@
|
|||||||
import { FaUserPlus } from 'react-icons/fa6'
|
import { FaUserPlus } from 'react-icons/fa6'
|
||||||
|
import { useEmployees } from '../hooks/useEmployees'
|
||||||
// Diese Liste sollte aus der Datenbank kommen
|
|
||||||
const EDITORS = [
|
|
||||||
{ id: 'CHLE', name: 'Christian Lehmann' },
|
|
||||||
{ id: 'DIBR', name: 'Dietmar Bruckauf' },
|
|
||||||
{ id: 'DOAR', name: 'Dominik Armata' },
|
|
||||||
{ id: 'GRVO', name: 'Gregor Vowinkel' },
|
|
||||||
{ id: 'HADW', name: 'Hasan Dwiko' },
|
|
||||||
{ id: 'JEDI', name: 'Jessica Diaz' },
|
|
||||||
{ id: 'KNSO', name: 'Kenso Grimm' },
|
|
||||||
{ id: 'LUPL', name: 'Lukas Placzek' },
|
|
||||||
{ id: 'NIKI', name: 'Nikita Gaidach' },
|
|
||||||
{ id: 'MARK', name: 'Marco Kobza' },
|
|
||||||
{ id: 'MABA', name: 'Markus Bauer' },
|
|
||||||
{ id: 'MATS', name: 'Maksim Tschetschjotkin' },
|
|
||||||
{ id: 'PASI', name: 'Pascal Siegfried' },
|
|
||||||
{ id: 'NICT', name: 'Nico Stegmann' },
|
|
||||||
{ id: 'MEQU', name: 'Melissa Quednau' },
|
|
||||||
{ id: 'SASC', name: 'Saskia Schmahl' },
|
|
||||||
{ id: 'CHPA', name: 'Christin Paulus' },
|
|
||||||
{ id: 'SOSC', name: 'Sonja Schulze' },
|
|
||||||
{ id: 'WAWA', name: 'Walter Wawer' },
|
|
||||||
{ id: 'YAFO', name: 'Yannick Föller' },
|
|
||||||
{ id: 'TODE', name: 'Tobias Decker' }
|
|
||||||
]
|
|
||||||
|
|
||||||
export default function EditorDropdown({ value, onChange }) {
|
export default function EditorDropdown({ value, onChange }) {
|
||||||
|
const { employees } = useEmployees()
|
||||||
|
|
||||||
|
// Finde den zugewiesenen Mitarbeiter anhand der userId
|
||||||
|
const assignedEmployee = employees.find(emp => emp.userId === value)
|
||||||
|
|
||||||
|
// Zeige Kürzel wenn zugewiesen, sonst Icon
|
||||||
|
const displayValue = assignedEmployee?.shortcode || <FaUserPlus size={20} />
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="dropdown">
|
<div className="dropdown">
|
||||||
<button className="btn" style={{ background: 'inherit', color: 'inherit' }}>
|
<button className="btn" style={{ background: 'inherit', color: 'inherit' }}>
|
||||||
{value || <FaUserPlus size={20} />}
|
{displayValue}
|
||||||
</button>
|
</button>
|
||||||
<div className="dropdown-content">
|
<div className="dropdown-content">
|
||||||
{EDITORS.map(editor => (
|
|
||||||
<span
|
<span
|
||||||
key={editor.id}
|
|
||||||
className="dropdown-item"
|
className="dropdown-item"
|
||||||
onClick={() => onChange(editor.id)}
|
onClick={() => onChange('')}
|
||||||
>
|
>
|
||||||
{editor.name}
|
<em>(Unassigned)</em>
|
||||||
|
</span>
|
||||||
|
{employees.map(employee => (
|
||||||
|
<span
|
||||||
|
key={employee.$id}
|
||||||
|
className="dropdown-item"
|
||||||
|
onClick={() => onChange(employee.userId)}
|
||||||
|
>
|
||||||
|
{employee.displayName}{employee.shortcode ? ` (${employee.shortcode})` : ''}
|
||||||
</span>
|
</span>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,96 +0,0 @@
|
|||||||
import { useState, useRef } from 'react'
|
|
||||||
import { FaTimes, FaSpinner } from 'react-icons/fa'
|
|
||||||
import { storage, BUCKET_ID, ID } from '../lib/appwrite'
|
|
||||||
|
|
||||||
export default function FileUploadModal({ isOpen, onClose, workorderId, onUploadComplete }) {
|
|
||||||
const [uploading, setUploading] = useState(false)
|
|
||||||
const [dragOver, setDragOver] = useState(false)
|
|
||||||
const fileInputRef = useRef(null)
|
|
||||||
|
|
||||||
const handleDrop = async (e) => {
|
|
||||||
e.preventDefault()
|
|
||||||
setDragOver(false)
|
|
||||||
|
|
||||||
const file = e.dataTransfer.files[0]
|
|
||||||
if (file) {
|
|
||||||
await uploadFile(file)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleFileSelect = async (e) => {
|
|
||||||
const file = e.target.files[0]
|
|
||||||
if (file) {
|
|
||||||
await uploadFile(file)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const uploadFile = async (file) => {
|
|
||||||
// Validate file type
|
|
||||||
const allowedTypes = ['application/pdf', 'image/gif', 'image/png', 'image/jpeg']
|
|
||||||
if (!allowedTypes.includes(file.type)) {
|
|
||||||
alert('Only PDF, GIF, PNG, and JPEG files are allowed.')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
setUploading(true)
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await storage.createFile(
|
|
||||||
BUCKET_ID,
|
|
||||||
ID.unique(),
|
|
||||||
file
|
|
||||||
)
|
|
||||||
|
|
||||||
onUploadComplete?.(response)
|
|
||||||
onClose()
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Upload error:', error)
|
|
||||||
alert('Error uploading file: ' + error.message)
|
|
||||||
} finally {
|
|
||||||
setUploading(false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isOpen) return null
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="overlay">
|
|
||||||
<span className="overlay-close" onClick={onClose}>
|
|
||||||
<FaTimes />
|
|
||||||
</span>
|
|
||||||
<div className="overlay-content">
|
|
||||||
<h2 className="text-center mb-2">UPLOAD AREA</h2>
|
|
||||||
<p className="mb-2">Upload Attachments for WOID {workorderId}</p>
|
|
||||||
|
|
||||||
<div
|
|
||||||
className={`drop-zone ${dragOver ? 'border-green' : ''}`}
|
|
||||||
onDrop={handleDrop}
|
|
||||||
onDragOver={(e) => { e.preventDefault(); setDragOver(true) }}
|
|
||||||
onDragLeave={() => setDragOver(false)}
|
|
||||||
onClick={() => fileInputRef.current?.click()}
|
|
||||||
>
|
|
||||||
{uploading ? (
|
|
||||||
<div>
|
|
||||||
<FaSpinner className="spinner" size={32} />
|
|
||||||
<p className="mt-1">Uploading file...</p>
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<p>Drop file here (.pdf, .gif, .png, .jpg, .jpeg)</p>
|
|
||||||
<p className="mt-1">or</p>
|
|
||||||
<button className="btn btn-dark mt-1">Select File</button>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<input
|
|
||||||
ref={fileInputRef}
|
|
||||||
type="file"
|
|
||||||
accept=".pdf,.gif,.png,.jpg,.jpeg"
|
|
||||||
style={{ display: 'none' }}
|
|
||||||
onChange={handleFileSelect}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,12 +1,8 @@
|
|||||||
export default function Footer() {
|
export default function Footer() {
|
||||||
return (
|
return (
|
||||||
<footer className="footer">
|
<footer className="footer">
|
||||||
<p>
|
<p className="faint" style={{ fontSize: 13, margin: 0 }}>
|
||||||
WOMS 2.0 - Work Order Management System |
|
Webklar Ticket-Plattform · © {new Date().getFullYear()}
|
||||||
Powered by <a href="https://appwrite.io" target="_blank" rel="noopener noreferrer">Appwrite</a> & React
|
|
||||||
</p>
|
|
||||||
<p className="text-small text-grey">
|
|
||||||
© {new Date().getFullYear()} - All rights reserved
|
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import { SiGitea } from 'react-icons/si'
|
||||||
|
|
||||||
|
export default function GiteaLinkButton({ href, title = 'In Gitea oeffnen', size = 16 }) {
|
||||||
|
if (!href) return null
|
||||||
|
|
||||||
|
return (
|
||||||
|
<a
|
||||||
|
href={href}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
title={title}
|
||||||
|
aria-label={title}
|
||||||
|
style={{
|
||||||
|
display: 'inline-flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
width: 32,
|
||||||
|
height: 32,
|
||||||
|
borderRadius: 6,
|
||||||
|
background: 'rgba(99, 102, 241, 0.15)',
|
||||||
|
border: '1px solid rgba(99, 102, 241, 0.35)',
|
||||||
|
color: '#818cf8',
|
||||||
|
textDecoration: 'none',
|
||||||
|
flexShrink: 0,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<SiGitea size={size} />
|
||||||
|
</a>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,262 @@
|
|||||||
|
import { useState, useEffect, useCallback } from 'react'
|
||||||
|
import { FaFilePdf, FaPlus, FaLink, FaSpinner, FaRotate } from 'react-icons/fa6'
|
||||||
|
import { databases, DATABASE_ID, COLLECTIONS } from '../lib/appwrite'
|
||||||
|
import { integrationsApi, formatMoney, INVOICE_STATUS } from '../lib/integrationsApi'
|
||||||
|
import { useInvoices } from '../hooks/useInvoices'
|
||||||
|
import { customerStage, isInvoiceReady } from '../lib/leads'
|
||||||
|
|
||||||
|
const card = {
|
||||||
|
background: 'rgba(45, 55, 72, 0.5)',
|
||||||
|
borderRadius: '12px',
|
||||||
|
padding: '16px',
|
||||||
|
border: '1px solid rgba(16, 185, 129, 0.2)',
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function InvoicePanel({ ticket }) {
|
||||||
|
const [customer, setCustomer] = useState(null)
|
||||||
|
const [customerLoading, setCustomerLoading] = useState(true)
|
||||||
|
const [customerError, setCustomerError] = useState(null)
|
||||||
|
|
||||||
|
const loadCustomer = useCallback(async () => {
|
||||||
|
if (!ticket.customerId) {
|
||||||
|
setCustomer(null)
|
||||||
|
setCustomerLoading(false)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
setCustomerLoading(true)
|
||||||
|
try {
|
||||||
|
const doc = await databases.getDocument(DATABASE_ID, COLLECTIONS.CUSTOMERS, ticket.customerId)
|
||||||
|
setCustomer(doc)
|
||||||
|
setCustomerError(null)
|
||||||
|
} catch (err) {
|
||||||
|
setCustomerError(err.message)
|
||||||
|
setCustomer(null)
|
||||||
|
} finally {
|
||||||
|
setCustomerLoading(false)
|
||||||
|
}
|
||||||
|
}, [ticket.customerId])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
loadCustomer()
|
||||||
|
}, [loadCustomer])
|
||||||
|
|
||||||
|
const clientId = customer?.invoiceNinjaClientId || null
|
||||||
|
const { invoices, loading, error, refresh } = useInvoices(clientId)
|
||||||
|
|
||||||
|
if (customerLoading) {
|
||||||
|
return (
|
||||||
|
<div style={card}>
|
||||||
|
<FaSpinner className="spinner" /> Kunde wird geladen...
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ticket.customerId) {
|
||||||
|
return (
|
||||||
|
<div style={card}>
|
||||||
|
<p style={{ color: '#a0aec0', margin: 0 }}>Kein Kunde am Ticket verknüpft, keine Rechnungen verfügbar.</p>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div style={card}>
|
||||||
|
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: '12px' }}>
|
||||||
|
<h5 style={{ color: 'var(--dark-text)', fontWeight: 'bold', margin: 0, fontSize: '16px' }}>
|
||||||
|
Rechnungen {customer?.name ? `- ${customer.name}` : ''}
|
||||||
|
</h5>
|
||||||
|
{clientId && (
|
||||||
|
<button className="btn" onClick={refresh} title="Aktualisieren"
|
||||||
|
style={{ background: '#374151', color: 'white', border: 'none', padding: '6px 10px', borderRadius: '6px', cursor: 'pointer' }}>
|
||||||
|
<FaRotate />
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{customerError && <div className="text-red" style={{ marginBottom: 8 }}>{customerError}</div>}
|
||||||
|
|
||||||
|
{customer && customerStage(customer) === 'lead' ? (
|
||||||
|
<p style={{ color: '#a0aec0', margin: 0 }}>
|
||||||
|
Dieser Kunde ist noch ein Lead. Erst zum festen Kunden machen (im Kunden-Bereich, vollständige Daten nötig), dann sind Rechnungen möglich.
|
||||||
|
</p>
|
||||||
|
) : !clientId && !isInvoiceReady(customer) ? (
|
||||||
|
<p style={{ color: '#a0aec0', margin: 0 }}>
|
||||||
|
Rechnungsdaten unvollständig. Bitte im Kunden-Bereich Unternehmen, E-Mail, Straße, PLZ und Stadt ergänzen.
|
||||||
|
</p>
|
||||||
|
) : !clientId ? (
|
||||||
|
<LinkClient customer={customer} onLinked={loadCustomer} />
|
||||||
|
) : (
|
||||||
|
<InvoiceList invoices={invoices} loading={loading} error={error} />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------- Verknuepfung -----------
|
||||||
|
function LinkClient({ customer, onLinked }) {
|
||||||
|
const [search, setSearch] = useState(customer?.name || '')
|
||||||
|
const [results, setResults] = useState([])
|
||||||
|
const [busy, setBusy] = useState(false)
|
||||||
|
const [error, setError] = useState(null)
|
||||||
|
const [saving, setSaving] = useState(false)
|
||||||
|
|
||||||
|
const doSearch = async () => {
|
||||||
|
setBusy(true)
|
||||||
|
setError(null)
|
||||||
|
try {
|
||||||
|
const data = await integrationsApi.listClients(search)
|
||||||
|
setResults(data.clients || [])
|
||||||
|
} catch (err) {
|
||||||
|
setError(err.message)
|
||||||
|
} finally {
|
||||||
|
setBusy(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
doSearch()
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
const saveMapping = async (clientId) => {
|
||||||
|
setSaving(true)
|
||||||
|
setError(null)
|
||||||
|
try {
|
||||||
|
await databases.updateDocument(DATABASE_ID, COLLECTIONS.CUSTOMERS, customer.$id, {
|
||||||
|
invoiceNinjaClientId: clientId,
|
||||||
|
})
|
||||||
|
onLinked()
|
||||||
|
} catch (err) {
|
||||||
|
setError(err.message)
|
||||||
|
setSaving(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const createAndLink = async () => {
|
||||||
|
setSaving(true)
|
||||||
|
setError(null)
|
||||||
|
try {
|
||||||
|
const data = await integrationsApi.createClient({
|
||||||
|
name: customer.name || customer.companyName || 'Neuer Kunde',
|
||||||
|
email: customer.email || '',
|
||||||
|
phone: customer.phone || '',
|
||||||
|
address: customer.location || '',
|
||||||
|
})
|
||||||
|
if (data.client?.id) {
|
||||||
|
await saveMapping(data.client.id)
|
||||||
|
} else {
|
||||||
|
throw new Error('Client konnte nicht angelegt werden')
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
setError(err.message)
|
||||||
|
setSaving(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<p style={{ color: '#a0aec0', fontSize: '13px', marginTop: 0 }}>
|
||||||
|
Dieser Kunde ist noch nicht mit InvoiceNinja verknüpft.
|
||||||
|
</p>
|
||||||
|
<div style={{ display: 'flex', gap: '8px', marginBottom: '10px' }}>
|
||||||
|
<input
|
||||||
|
className="form-control"
|
||||||
|
style={{ margin: 0 }}
|
||||||
|
placeholder="InvoiceNinja-Kunde suchen …"
|
||||||
|
value={search}
|
||||||
|
onChange={(e) => setSearch(e.target.value)}
|
||||||
|
onKeyDown={(e) => e.key === 'Enter' && doSearch()}
|
||||||
|
/>
|
||||||
|
<button className="btn btn-green" style={{ margin: 0 }} onClick={doSearch} disabled={busy}>
|
||||||
|
{busy ? <FaSpinner className="spinner" /> : 'Suchen'}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{error && <div className="text-red" style={{ marginBottom: 8 }}>{error}</div>}
|
||||||
|
|
||||||
|
<div style={{ maxHeight: '180px', overflowY: 'auto', marginBottom: '10px' }}>
|
||||||
|
{results.map((c) => (
|
||||||
|
<div key={c.id} style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '8px', borderBottom: '1px solid rgba(255,255,255,0.06)' }}>
|
||||||
|
<div>
|
||||||
|
<strong style={{ color: 'var(--dark-text)' }}>{c.name}</strong>
|
||||||
|
{c.number ? <span style={{ color: '#a0aec0' }}> · {c.number}</span> : null}
|
||||||
|
{c.email ? <div style={{ color: '#a0aec0', fontSize: '12px' }}>{c.email}</div> : null}
|
||||||
|
</div>
|
||||||
|
<button className="btn btn-green" style={{ margin: 0 }} disabled={saving} onClick={() => saveMapping(c.id)}>
|
||||||
|
<FaLink /> Verknüpfen
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
{!busy && results.length === 0 && (
|
||||||
|
<p style={{ color: '#a0aec0', fontSize: '13px' }}>Keine Treffer.</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button className="btn" style={{ background: '#3b82f6', color: 'white', border: 'none', padding: '10px 16px', borderRadius: '8px', cursor: 'pointer' }} disabled={saving} onClick={createAndLink}>
|
||||||
|
{saving ? <FaSpinner className="spinner" /> : <><FaPlus /> Neuen InvoiceNinja-Kunden anlegen & verknüpfen</>}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------- Rechnungsliste ---------
|
||||||
|
// Nur anzeigen: neue Rechnungen entstehen direkt in InvoiceNinja
|
||||||
|
function InvoiceList({ invoices, loading, error }) {
|
||||||
|
const [openingId, setOpeningId] = useState(null)
|
||||||
|
|
||||||
|
const openPdf = async (id) => {
|
||||||
|
setOpeningId(id)
|
||||||
|
try {
|
||||||
|
await integrationsApi.openInvoicePdf(id)
|
||||||
|
} catch (err) {
|
||||||
|
alert('PDF konnte nicht geöffnet werden: ' + err.message)
|
||||||
|
} finally {
|
||||||
|
setOpeningId(null)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{error && <div className="text-red" style={{ marginBottom: 8 }}>{error}</div>}
|
||||||
|
|
||||||
|
{loading ? (
|
||||||
|
<p style={{ color: '#a0aec0' }}><FaSpinner className="spinner" /> Rechnungen werden geladen...</p>
|
||||||
|
) : invoices.length === 0 ? (
|
||||||
|
<p style={{ color: '#a0aec0', fontSize: '13px' }}>Noch keine Rechnungen für diesen Kunden.</p>
|
||||||
|
) : (
|
||||||
|
<div style={{ overflowX: 'auto' }}>
|
||||||
|
<table className="table" style={{ width: '100%', fontSize: '13px' }}>
|
||||||
|
<thead>
|
||||||
|
<tr style={{ color: '#a0aec0', textAlign: 'left' }}>
|
||||||
|
<th>Nr.</th><th>Datum</th><th>Fällig</th><th>Betrag</th><th>Offen</th><th>Status</th><th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{invoices.map((inv) => {
|
||||||
|
const st = INVOICE_STATUS[inv.status_id] || { label: '–', color: '#a0aec0' }
|
||||||
|
const overdue = Number(inv.balance) > 0 && inv.due_date && new Date(inv.due_date) < new Date()
|
||||||
|
return (
|
||||||
|
<tr key={inv.id}>
|
||||||
|
<td style={{ color: 'var(--dark-text)' }}>{inv.number || inv.id?.slice(-6)}</td>
|
||||||
|
<td style={{ color: '#cbd5e0' }}>{inv.date || '-'}</td>
|
||||||
|
<td style={{ color: overdue ? '#ef4444' : '#cbd5e0' }}>{inv.due_date || '-'}</td>
|
||||||
|
<td style={{ color: 'var(--dark-text)' }}>{formatMoney(inv.amount)}</td>
|
||||||
|
<td style={{ color: Number(inv.balance) > 0 ? '#f59e0b' : '#10b981' }}>{formatMoney(inv.balance)}</td>
|
||||||
|
<td><span style={{ color: st.color, fontWeight: 'bold' }}>{st.label}{overdue ? ' (überfällig)' : ''}</span></td>
|
||||||
|
<td>
|
||||||
|
<button className="btn" title="PDF öffnen" disabled={openingId === inv.id}
|
||||||
|
style={{ background: '#ef4444', color: 'white', border: 'none', padding: '6px 10px', borderRadius: '6px', cursor: 'pointer' }}
|
||||||
|
onClick={() => openPdf(inv.id)}>
|
||||||
|
{openingId === inv.id ? <FaSpinner className="spinner" /> : <FaFilePdf />}
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,245 @@
|
|||||||
|
import { useRef, useEffect } from 'react';
|
||||||
|
|
||||||
|
const LetterGlitch = ({
|
||||||
|
glitchColors = ['#2b4539', '#61dca3', '#61b3dc'],
|
||||||
|
className = '',
|
||||||
|
glitchSpeed = 50,
|
||||||
|
centerVignette = false,
|
||||||
|
outerVignette = true,
|
||||||
|
smooth = true,
|
||||||
|
characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$&*()-_+=/[]{};:<>.,0123456789'
|
||||||
|
}) => {
|
||||||
|
const canvasRef = useRef(null);
|
||||||
|
const animationRef = useRef(null);
|
||||||
|
const letters = useRef([]);
|
||||||
|
const grid = useRef({ columns: 0, rows: 0 });
|
||||||
|
const context = useRef(null);
|
||||||
|
const lastGlitchTime = useRef(Date.now());
|
||||||
|
|
||||||
|
const lettersAndSymbols = Array.from(characters);
|
||||||
|
|
||||||
|
const fontSize = 16;
|
||||||
|
const charWidth = 10;
|
||||||
|
const charHeight = 20;
|
||||||
|
|
||||||
|
const getRandomChar = () => {
|
||||||
|
return lettersAndSymbols[Math.floor(Math.random() * lettersAndSymbols.length)];
|
||||||
|
};
|
||||||
|
|
||||||
|
const getRandomColor = () => {
|
||||||
|
return glitchColors[Math.floor(Math.random() * glitchColors.length)];
|
||||||
|
};
|
||||||
|
|
||||||
|
const hexToRgb = hex => {
|
||||||
|
const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
||||||
|
hex = hex.replace(shorthandRegex, (m, r, g, b) => {
|
||||||
|
return r + r + g + g + b + b;
|
||||||
|
});
|
||||||
|
|
||||||
|
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
||||||
|
return result
|
||||||
|
? {
|
||||||
|
r: parseInt(result[1], 16),
|
||||||
|
g: parseInt(result[2], 16),
|
||||||
|
b: parseInt(result[3], 16)
|
||||||
|
}
|
||||||
|
: null;
|
||||||
|
};
|
||||||
|
|
||||||
|
const interpolateColor = (start, end, factor) => {
|
||||||
|
const result = {
|
||||||
|
r: Math.round(start.r + (end.r - start.r) * factor),
|
||||||
|
g: Math.round(start.g + (end.g - start.g) * factor),
|
||||||
|
b: Math.round(start.b + (end.b - start.b) * factor)
|
||||||
|
};
|
||||||
|
return `rgb(${result.r}, ${result.g}, ${result.b})`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const calculateGrid = (width, height) => {
|
||||||
|
const columns = Math.ceil(width / charWidth);
|
||||||
|
const rows = Math.ceil(height / charHeight);
|
||||||
|
return { columns, rows };
|
||||||
|
};
|
||||||
|
|
||||||
|
const initializeLetters = (columns, rows) => {
|
||||||
|
grid.current = { columns, rows };
|
||||||
|
const totalLetters = columns * rows;
|
||||||
|
letters.current = Array.from({ length: totalLetters }, () => ({
|
||||||
|
char: getRandomChar(),
|
||||||
|
color: getRandomColor(),
|
||||||
|
targetColor: getRandomColor(),
|
||||||
|
colorProgress: 1
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
const resizeCanvas = () => {
|
||||||
|
const canvas = canvasRef.current;
|
||||||
|
if (!canvas) return;
|
||||||
|
const parent = canvas.parentElement;
|
||||||
|
if (!parent) return;
|
||||||
|
|
||||||
|
const dpr = window.devicePixelRatio || 1;
|
||||||
|
const rect = parent.getBoundingClientRect();
|
||||||
|
|
||||||
|
canvas.width = rect.width * dpr;
|
||||||
|
canvas.height = rect.height * dpr;
|
||||||
|
|
||||||
|
canvas.style.width = `${rect.width}px`;
|
||||||
|
canvas.style.height = `${rect.height}px`;
|
||||||
|
|
||||||
|
if (context.current) {
|
||||||
|
context.current.setTransform(dpr, 0, 0, dpr, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
const { columns, rows } = calculateGrid(rect.width, rect.height);
|
||||||
|
initializeLetters(columns, rows);
|
||||||
|
|
||||||
|
drawLetters();
|
||||||
|
};
|
||||||
|
|
||||||
|
const drawLetters = () => {
|
||||||
|
if (!context.current || letters.current.length === 0) return;
|
||||||
|
const ctx = context.current;
|
||||||
|
const { width, height } = canvasRef.current.getBoundingClientRect();
|
||||||
|
ctx.clearRect(0, 0, width, height);
|
||||||
|
ctx.font = `${fontSize}px monospace`;
|
||||||
|
ctx.textBaseline = 'top';
|
||||||
|
|
||||||
|
letters.current.forEach((letter, index) => {
|
||||||
|
const x = (index % grid.current.columns) * charWidth;
|
||||||
|
const y = Math.floor(index / grid.current.columns) * charHeight;
|
||||||
|
ctx.fillStyle = letter.color;
|
||||||
|
ctx.fillText(letter.char, x, y);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const updateLetters = () => {
|
||||||
|
if (!letters.current || letters.current.length === 0) return;
|
||||||
|
|
||||||
|
const updateCount = Math.max(1, Math.floor(letters.current.length * 0.05));
|
||||||
|
|
||||||
|
for (let i = 0; i < updateCount; i++) {
|
||||||
|
const index = Math.floor(Math.random() * letters.current.length);
|
||||||
|
if (!letters.current[index]) continue;
|
||||||
|
|
||||||
|
letters.current[index].char = getRandomChar();
|
||||||
|
letters.current[index].targetColor = getRandomColor();
|
||||||
|
|
||||||
|
if (!smooth) {
|
||||||
|
letters.current[index].color = letters.current[index].targetColor;
|
||||||
|
letters.current[index].colorProgress = 1;
|
||||||
|
} else {
|
||||||
|
letters.current[index].colorProgress = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSmoothTransitions = () => {
|
||||||
|
let needsRedraw = false;
|
||||||
|
letters.current.forEach(letter => {
|
||||||
|
if (letter.colorProgress < 1) {
|
||||||
|
letter.colorProgress += 0.05;
|
||||||
|
if (letter.colorProgress > 1) letter.colorProgress = 1;
|
||||||
|
|
||||||
|
const startRgb = hexToRgb(letter.color);
|
||||||
|
const endRgb = hexToRgb(letter.targetColor);
|
||||||
|
if (startRgb && endRgb) {
|
||||||
|
letter.color = interpolateColor(startRgb, endRgb, letter.colorProgress);
|
||||||
|
needsRedraw = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (needsRedraw) {
|
||||||
|
drawLetters();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const animate = () => {
|
||||||
|
const now = Date.now();
|
||||||
|
if (now - lastGlitchTime.current >= glitchSpeed) {
|
||||||
|
updateLetters();
|
||||||
|
drawLetters();
|
||||||
|
lastGlitchTime.current = now;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (smooth) {
|
||||||
|
handleSmoothTransitions();
|
||||||
|
}
|
||||||
|
|
||||||
|
animationRef.current = requestAnimationFrame(animate);
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const canvas = canvasRef.current;
|
||||||
|
if (!canvas) return;
|
||||||
|
|
||||||
|
context.current = canvas.getContext('2d');
|
||||||
|
resizeCanvas();
|
||||||
|
animate();
|
||||||
|
|
||||||
|
let resizeTimeout;
|
||||||
|
|
||||||
|
const handleResize = () => {
|
||||||
|
clearTimeout(resizeTimeout);
|
||||||
|
resizeTimeout = setTimeout(() => {
|
||||||
|
cancelAnimationFrame(animationRef.current);
|
||||||
|
resizeCanvas();
|
||||||
|
animate();
|
||||||
|
}, 100);
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener('resize', handleResize);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
cancelAnimationFrame(animationRef.current);
|
||||||
|
window.removeEventListener('resize', handleResize);
|
||||||
|
};
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [glitchSpeed, smooth]);
|
||||||
|
|
||||||
|
const containerStyle = {
|
||||||
|
position: 'relative',
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
backgroundColor: '#000000',
|
||||||
|
overflow: 'hidden'
|
||||||
|
};
|
||||||
|
|
||||||
|
const canvasStyle = {
|
||||||
|
display: 'block',
|
||||||
|
width: '100%',
|
||||||
|
height: '100%'
|
||||||
|
};
|
||||||
|
|
||||||
|
const outerVignetteStyle = {
|
||||||
|
position: 'absolute',
|
||||||
|
top: 0,
|
||||||
|
left: 0,
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
pointerEvents: 'none',
|
||||||
|
background: 'radial-gradient(circle, rgba(0,0,0,0) 60%, rgba(0,0,0,1) 100%)'
|
||||||
|
};
|
||||||
|
|
||||||
|
const centerVignetteStyle = {
|
||||||
|
position: 'absolute',
|
||||||
|
top: 0,
|
||||||
|
left: 0,
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
pointerEvents: 'none',
|
||||||
|
background: 'radial-gradient(circle, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 60%)'
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div style={containerStyle} className={className}>
|
||||||
|
<canvas ref={canvasRef} style={canvasStyle} />
|
||||||
|
{outerVignette && <div style={outerVignetteStyle}></div>}
|
||||||
|
{centerVignette && <div style={centerVignetteStyle}></div>}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default LetterGlitch;
|
||||||
|
|
||||||
+125
-30
@@ -1,49 +1,144 @@
|
|||||||
import { Link, useNavigate } from 'react-router-dom'
|
import { useEffect, useState } from 'react'
|
||||||
|
import { Link, useLocation, useNavigate } from 'react-router-dom'
|
||||||
import { useAuth } from '../context/AuthContext'
|
import { useAuth } from '../context/AuthContext'
|
||||||
import { FaUser } from 'react-icons/fa'
|
import {
|
||||||
|
IconTicket,
|
||||||
|
IconUsers,
|
||||||
|
IconTargetArrow,
|
||||||
|
IconReportMoney,
|
||||||
|
IconScale,
|
||||||
|
IconActivityHeartbeat,
|
||||||
|
IconFolders,
|
||||||
|
IconCalendar,
|
||||||
|
IconSettings,
|
||||||
|
IconLogout,
|
||||||
|
IconLayoutSidebarLeftCollapse,
|
||||||
|
IconLayoutSidebarLeftExpand,
|
||||||
|
IconExternalLink,
|
||||||
|
} from '@tabler/icons-react'
|
||||||
|
import { openProjectAdmin } from '../lib/employeeAdminApi'
|
||||||
|
import { serverpulsApi } from '../lib/serverpulsApi'
|
||||||
|
|
||||||
export default function Navbar() {
|
export default function Sidebar() {
|
||||||
const { user, logout } = useAuth()
|
const { user, logout, isAdmin } = useAuth()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
|
const location = useLocation()
|
||||||
|
const [collapsed, setCollapsed] = useState(false)
|
||||||
|
const [switching, setSwitching] = useState(false)
|
||||||
|
const [pulseLevel, setPulseLevel] = useState('ok')
|
||||||
|
|
||||||
|
// Serverpuls-Punkt: nur Admins, beim Laden und alle 5 Minuten; Fehler bleiben still
|
||||||
|
useEffect(() => {
|
||||||
|
if (!isAdmin) { setPulseLevel('ok'); return undefined }
|
||||||
|
let dead = false
|
||||||
|
const load = () => {
|
||||||
|
serverpulsApi.overview()
|
||||||
|
.then((o) => { if (!dead) setPulseLevel(o?.level || 'ok') })
|
||||||
|
.catch(() => { if (!dead) setPulseLevel('ok') })
|
||||||
|
}
|
||||||
|
load()
|
||||||
|
const iv = setInterval(load, 5 * 60 * 1000)
|
||||||
|
return () => { dead = true; clearInterval(iv) }
|
||||||
|
}, [isAdmin])
|
||||||
|
|
||||||
|
const handleProjectAdmin = async () => {
|
||||||
|
setSwitching(true)
|
||||||
|
await openProjectAdmin()
|
||||||
|
}
|
||||||
|
|
||||||
const handleLogout = async () => {
|
const handleLogout = async () => {
|
||||||
await logout()
|
await logout()
|
||||||
navigate('/login')
|
navigate('/login')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Eine flache Liste: fuer ein kleines Team reichen acht Eintraege ohne Gruppen
|
||||||
|
const links = [
|
||||||
|
{ label: 'Tickets', href: '/tickets', icon: <IconTicket /> },
|
||||||
|
{ label: 'Planboard', href: '/planboard', icon: <IconCalendar /> },
|
||||||
|
{ label: 'Projekte', href: '/projects', icon: <IconFolders /> },
|
||||||
|
{ label: 'Kunden', href: '/customers', icon: <IconUsers /> },
|
||||||
|
// Leads liegen auf Eis (Lead-Automatik gestoppt 2026-09-30): grau, nicht klickbar
|
||||||
|
{ label: 'Leads', href: '/leads', icon: <IconTargetArrow />, paused: true },
|
||||||
|
{ label: 'Finanzen', href: '/finance', icon: <IconReportMoney /> },
|
||||||
|
{ label: 'Rechtliches', href: '/rechtliches', icon: <IconScale /> },
|
||||||
|
...(isAdmin ? [{ label: 'Serverpuls', href: '/serverpuls', icon: <IconActivityHeartbeat />, dot: pulseLevel }] : []),
|
||||||
|
...(isAdmin ? [{ label: 'Admin', href: '/admin', icon: <IconSettings /> }] : []),
|
||||||
|
]
|
||||||
|
|
||||||
|
const isActive = (href) =>
|
||||||
|
location.pathname === href || location.pathname.startsWith(href + '/')
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<nav className="navbar">
|
<aside className={`side ${collapsed ? 'collapsed' : ''}`}>
|
||||||
<div className="navbar-brand">
|
<div className="side-head">
|
||||||
<span>NetWEB</span>
|
<Link to="/" className="side-logo" title="Webklar">W</Link>
|
||||||
<img src="/logo.png" alt="" height="18" width="18" />
|
<div className="side-brand">
|
||||||
<span>Systems</span>
|
Webklar
|
||||||
|
<small>Ticket-Plattform</small>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul className="navbar-nav">
|
<nav className="side-nav">
|
||||||
<li><Link to="/tickets" className="nav-link">Tickets</Link></li>
|
<div className="side-group">
|
||||||
<li><Link to="/assets" className="nav-link">Assets</Link></li>
|
{links.map((link) => link.paused ? (
|
||||||
<li><Link to="/dashboard" className="nav-link">Dashboard</Link></li>
|
<span
|
||||||
<li><Link to="/planboard" className="nav-link">Planboard</Link></li>
|
key={link.href}
|
||||||
<li><Link to="/projects" className="nav-link">Projects</Link></li>
|
className="side-link side-link-paused"
|
||||||
<li><Link to="/reports" className="nav-link">Reports</Link></li>
|
title={`${link.label} (pausiert)`}
|
||||||
<li><Link to="/docs" className="nav-link">Docs</Link></li>
|
aria-disabled="true"
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div className="nav-right">
|
|
||||||
{user ? (
|
|
||||||
<button
|
|
||||||
onClick={handleLogout}
|
|
||||||
className="nav-link"
|
|
||||||
style={{ background: 'none', border: 'none', cursor: 'pointer' }}
|
|
||||||
>
|
>
|
||||||
<FaUser /> Logout, {user.name || user.email}
|
{link.icon}
|
||||||
</button>
|
<span className="side-link-label">{link.label}</span>
|
||||||
|
</span>
|
||||||
) : (
|
) : (
|
||||||
<Link to="/login" className="nav-link">
|
<Link
|
||||||
<FaUser /> Login
|
key={link.href}
|
||||||
</Link>
|
to={link.href}
|
||||||
|
className={`side-link ${isActive(link.href) ? 'active' : ''}`}
|
||||||
|
title={link.label}
|
||||||
|
>
|
||||||
|
{link.icon}
|
||||||
|
<span className="side-link-label">{link.label}</span>
|
||||||
|
{link.dot && link.dot !== 'ok' && (
|
||||||
|
<span
|
||||||
|
className={`side-dot side-dot-${link.dot}`}
|
||||||
|
data-testid="sp-nav-dot"
|
||||||
|
title={link.dot === 'critical' ? 'Critical-Warnung aktiv' : 'Warnung aktiv'}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
|
</Link>
|
||||||
|
))}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="side-link side-link-button"
|
||||||
|
onClick={handleProjectAdmin}
|
||||||
|
disabled={switching}
|
||||||
|
title="Projekt-Admin"
|
||||||
|
>
|
||||||
|
<IconExternalLink />
|
||||||
|
<span className="side-link-label">Projekt-Admin</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
<div className="side-foot">
|
||||||
|
{user && (
|
||||||
|
<div className="side-link" title={user.name || user.email} style={{ cursor: 'default' }}>
|
||||||
|
<div className="side-logo" style={{ width: 28, height: 28, fontSize: 12, background: 'linear-gradient(135deg,#667eea,#764ba2)' }}>
|
||||||
|
{(user.name || user.email || '?').charAt(0).toUpperCase()}
|
||||||
|
</div>
|
||||||
|
<span className="side-link-label text-ellipsis">{user.name || user.email}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<button className="side-toggle" onClick={handleLogout} title="Logout">
|
||||||
|
<IconLogout size={20} />
|
||||||
|
<span className="side-link-label">Logout</span>
|
||||||
|
</button>
|
||||||
|
<button className="side-toggle" onClick={() => setCollapsed((c) => !c)} title="Menue ein-/ausklappen">
|
||||||
|
{collapsed ? <IconLayoutSidebarLeftExpand size={20} /> : <IconLayoutSidebarLeftCollapse size={20} />}
|
||||||
|
<span className="side-link-label">Einklappen</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</aside>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import { FaEye } from 'react-icons/fa6'
|
||||||
|
|
||||||
|
export default function PreviewLinkButton({ href, title = 'Preview oeffnen', size = 16 }) {
|
||||||
|
if (!href) return null
|
||||||
|
|
||||||
|
return (
|
||||||
|
<a
|
||||||
|
href={href}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
title={title}
|
||||||
|
aria-label={title}
|
||||||
|
style={{
|
||||||
|
display: 'inline-flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
width: 32,
|
||||||
|
height: 32,
|
||||||
|
borderRadius: 6,
|
||||||
|
background: 'rgba(16, 185, 129, 0.15)',
|
||||||
|
border: '1px solid rgba(16, 185, 129, 0.35)',
|
||||||
|
color: '#34d399',
|
||||||
|
textDecoration: 'none',
|
||||||
|
flexShrink: 0,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<FaEye size={size} />
|
||||||
|
</a>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
const PRIORITIES = [
|
|
||||||
{ value: 0, label: 'None' },
|
|
||||||
{ value: 1, label: 'Low' },
|
|
||||||
{ value: 2, label: 'Medium' },
|
|
||||||
{ value: 3, label: 'High' },
|
|
||||||
{ value: 4, label: 'Critical' }
|
|
||||||
]
|
|
||||||
|
|
||||||
const PRIORITY_LABELS = {
|
|
||||||
0: 'NONE',
|
|
||||||
1: 'LOW',
|
|
||||||
2: 'MEDIUM',
|
|
||||||
3: 'HIGH',
|
|
||||||
4: 'CRITICAL'
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function PriorityDropdown({ value, onChange }) {
|
|
||||||
return (
|
|
||||||
<div className="dropdown">
|
|
||||||
<button className="btn" style={{ background: 'inherit', color: 'inherit' }}>
|
|
||||||
{PRIORITY_LABELS[value] || 'LOW'}
|
|
||||||
</button>
|
|
||||||
<div className="dropdown-content">
|
|
||||||
{PRIORITIES.map(priority => (
|
|
||||||
<span
|
|
||||||
key={priority.value}
|
|
||||||
className="dropdown-item"
|
|
||||||
onClick={() => onChange(priority.value)}
|
|
||||||
>
|
|
||||||
{priority.label}
|
|
||||||
</span>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
import { useEffect, useState } from 'react'
|
||||||
|
import { Link } from 'react-router-dom'
|
||||||
|
import { IconFolders } from '@tabler/icons-react'
|
||||||
|
import { StatusPill } from './ui/StatusPill'
|
||||||
|
import { databases, DATABASE_ID, COLLECTIONS, Query } from '../lib/appwrite'
|
||||||
|
import { useWebsiteProjects } from '../hooks/useWebsiteProjects'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Projekt-Kontextbox im Ticket: zeigt automatisch das zugewiesene Projekt
|
||||||
|
* und alle anderen Tickets desselben Kunden (klickbar).
|
||||||
|
* Rendert nichts, wenn dem Ticket kein Projekt zugewiesen ist.
|
||||||
|
*/
|
||||||
|
export default function ProjectContextPanel({ ticket }) {
|
||||||
|
const { fetchByTicketId } = useWebsiteProjects()
|
||||||
|
const [context, setContext] = useState(null)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let cancelled = false
|
||||||
|
async function load() {
|
||||||
|
try {
|
||||||
|
const assignedProjects = await fetchByTicketId(ticket.$id)
|
||||||
|
if (!assignedProjects.length) {
|
||||||
|
if (!cancelled) setContext(null)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const projectName = assignedProjects[0].projectName || ''
|
||||||
|
|
||||||
|
let otherTickets = []
|
||||||
|
if (ticket.customerId) {
|
||||||
|
const res = await databases.listDocuments(DATABASE_ID, COLLECTIONS.WORKORDERS, [
|
||||||
|
Query.equal('customerId', ticket.customerId),
|
||||||
|
Query.orderDesc('$createdAt'),
|
||||||
|
Query.limit(50),
|
||||||
|
])
|
||||||
|
otherTickets = res.documents.filter((t) => t.$id !== ticket.$id)
|
||||||
|
}
|
||||||
|
if (!cancelled) setContext({ projectName, otherTickets })
|
||||||
|
} catch {
|
||||||
|
if (!cancelled) setContext(null)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
load()
|
||||||
|
return () => { cancelled = true }
|
||||||
|
}, [ticket.$id, ticket.customerId, fetchByTicketId])
|
||||||
|
|
||||||
|
if (!context) return null
|
||||||
|
const { projectName, otherTickets } = context
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="ui-card pad" style={{ marginTop: 16 }}>
|
||||||
|
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', gap: 12, flexWrap: 'wrap', marginBottom: 10 }}>
|
||||||
|
<h5 style={{ fontWeight: 700, margin: 0, display: 'flex', alignItems: 'center', gap: 8 }}>
|
||||||
|
<IconFolders size={18} /> Projekt: {projectName || '-'}
|
||||||
|
</h5>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{!ticket.customerId ? (
|
||||||
|
<p className="faint" style={{ fontSize: 13, margin: 0 }}>
|
||||||
|
Kein Kunde zugeordnet — andere Tickets koennen nicht automatisch verknuepft werden.
|
||||||
|
</p>
|
||||||
|
) : !otherTickets.length ? (
|
||||||
|
<p className="faint" style={{ fontSize: 13, margin: 0 }}>
|
||||||
|
Keine weiteren Tickets zu diesem Kunden/Projekt.
|
||||||
|
</p>
|
||||||
|
) : (
|
||||||
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
|
||||||
|
{otherTickets.map((t) => (
|
||||||
|
<Link
|
||||||
|
key={t.$id}
|
||||||
|
to={`/tickets?woid=${t.woid}`}
|
||||||
|
style={{
|
||||||
|
display: 'flex', alignItems: 'center', gap: 10, fontSize: 13, color: 'var(--text)', textDecoration: 'none',
|
||||||
|
padding: '6px 8px', borderRadius: 8, border: '1px solid var(--border)',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<span className="muted" style={{ minWidth: 48, fontWeight: 700 }}>{t.woid}</span>
|
||||||
|
<span style={{ flex: 1, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
|
||||||
|
{t.topic || t.title || '-'}
|
||||||
|
</span>
|
||||||
|
<StatusPill status={t.status} />
|
||||||
|
</Link>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
import { FaTimes } from 'react-icons/fa'
|
|
||||||
import { format } from 'date-fns'
|
|
||||||
|
|
||||||
const STATUS_CLASSES = {
|
|
||||||
'Open': 'bg-red',
|
|
||||||
'Occupied': 'bg-blue-grey',
|
|
||||||
'Assigned': 'bg-teal',
|
|
||||||
'Awaiting': 'bg-amber',
|
|
||||||
'Closed': 'bg-grey'
|
|
||||||
}
|
|
||||||
|
|
||||||
const PRIORITY_CLASSES = {
|
|
||||||
0: 'bg-blue',
|
|
||||||
1: 'bg-green',
|
|
||||||
2: 'bg-amber',
|
|
||||||
3: 'bg-orange',
|
|
||||||
4: 'bg-red'
|
|
||||||
}
|
|
||||||
|
|
||||||
const PRIORITY_LABELS = {
|
|
||||||
0: 'NONE',
|
|
||||||
1: 'LOW',
|
|
||||||
2: 'MEDIUM',
|
|
||||||
3: 'HIGH',
|
|
||||||
4: 'CRITICAL'
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function QuickOverviewModal({ isOpen, onClose, workorders = [] }) {
|
|
||||||
if (!isOpen) return null
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="overlay">
|
|
||||||
<span className="overlay-close" onClick={onClose}>
|
|
||||||
<FaTimes />
|
|
||||||
</span>
|
|
||||||
<div className="overlay-content">
|
|
||||||
<h3 className="mb-2">WOMS Ticket Quick Overview</h3>
|
|
||||||
|
|
||||||
<table className="table" style={{ background: '#fff', color: '#000' }}>
|
|
||||||
<thead>
|
|
||||||
<tr className="bg-dark-grey text-white">
|
|
||||||
<th>WOID</th>
|
|
||||||
<th>Created</th>
|
|
||||||
<th>Type</th>
|
|
||||||
<th>System</th>
|
|
||||||
<th>CID & CLO</th>
|
|
||||||
<th>Requested by</th>
|
|
||||||
<th>Topic</th>
|
|
||||||
<th className="text-center">Priority</th>
|
|
||||||
<th className="text-right">Status</th>
|
|
||||||
<th>Editor</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{workorders.map(wo => (
|
|
||||||
<tr key={wo.$id} className="bg-white">
|
|
||||||
<td className="bg-dark-grey text-white text-small">
|
|
||||||
{wo.woid || wo.$id?.slice(-5)}
|
|
||||||
</td>
|
|
||||||
<td className="bg-light-grey text-small">
|
|
||||||
{format(new Date(wo.$createdAt || wo.createdAt), 'dd.MM.yyyy, HH:mm')}h
|
|
||||||
</td>
|
|
||||||
<td className="bg-light-grey text-small">{wo.type}</td>
|
|
||||||
<td className="bg-light-grey text-small">{wo.systemType || 'n/a'}</td>
|
|
||||||
<td className="text-small">{wo.customerCode} {wo.customerLocation}</td>
|
|
||||||
<td className="text-small">{wo.requestedBy}</td>
|
|
||||||
<td className="text-small">{wo.topic}</td>
|
|
||||||
<td className={`text-small text-center ${PRIORITY_CLASSES[wo.priority]}`}>
|
|
||||||
{PRIORITY_LABELS[wo.priority]}
|
|
||||||
</td>
|
|
||||||
<td className={`text-small text-right ${STATUS_CLASSES[wo.status]}`}>
|
|
||||||
{wo.status?.toUpperCase()}
|
|
||||||
</td>
|
|
||||||
<td className={`text-small ${STATUS_CLASSES[wo.status]}`}>
|
|
||||||
{wo.assignedTo || '-'}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
))}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<p className="mt-2 text-center">
|
|
||||||
Summary: Listed a total of {workorders.length} Workorders!
|
|
||||||
<br />EOL =)
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
const RESPONSE_LEVELS = [
|
|
||||||
{ value: 'KEY USER', label: 'Key User' },
|
|
||||||
{ value: 'Helpdesk', label: '1st Level' },
|
|
||||||
{ value: 'Support', label: '2nd Level' },
|
|
||||||
{ value: 'Admin', label: '3rd Level' },
|
|
||||||
{ value: 'FS/FE', label: 'FS/FE' },
|
|
||||||
{ value: '24/7', label: '24/7' },
|
|
||||||
{ value: 'TECH MGMT', label: 'Tech Mgmt' },
|
|
||||||
{ value: 'Backoffice', label: 'Backoffice' },
|
|
||||||
{ value: 'BUSI MGMT', label: 'Busi Mgmt' }
|
|
||||||
]
|
|
||||||
|
|
||||||
export default function ResponseDropdown({ value, onChange }) {
|
|
||||||
return (
|
|
||||||
<div className="dropdown">
|
|
||||||
<button className="btn" style={{ background: 'inherit', color: 'inherit' }}>
|
|
||||||
{value?.toUpperCase() || 'BACKOFFICE'}
|
|
||||||
</button>
|
|
||||||
<div className="dropdown-content">
|
|
||||||
{RESPONSE_LEVELS.map(level => (
|
|
||||||
<span
|
|
||||||
key={level.value}
|
|
||||||
className="dropdown-item"
|
|
||||||
onClick={() => onChange(level.value)}
|
|
||||||
>
|
|
||||||
{level.label}
|
|
||||||
</span>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,30 +1,19 @@
|
|||||||
const STATUSES = [
|
import { TICKET_STATUSES, statusLabel } from '../lib/ticketStatus'
|
||||||
'Open',
|
|
||||||
'Occupied',
|
|
||||||
'Assigned',
|
|
||||||
'Awaiting',
|
|
||||||
'Added Info',
|
|
||||||
'In Test',
|
|
||||||
'Halted',
|
|
||||||
'Aborted',
|
|
||||||
'Cancelled',
|
|
||||||
'Closed'
|
|
||||||
]
|
|
||||||
|
|
||||||
export default function StatusDropdown({ value, onChange }) {
|
export default function StatusDropdown({ value, onChange }) {
|
||||||
return (
|
return (
|
||||||
<div className="dropdown">
|
<div className="dropdown">
|
||||||
<button className="btn" style={{ background: 'inherit', color: 'inherit' }}>
|
<button className="btn" style={{ background: 'inherit', color: 'inherit' }}>
|
||||||
{value?.toUpperCase() || 'OPEN'}
|
{statusLabel(value)}
|
||||||
</button>
|
</button>
|
||||||
<div className="dropdown-content">
|
<div className="dropdown-content">
|
||||||
{STATUSES.map(status => (
|
{TICKET_STATUSES.map(status => (
|
||||||
<span
|
<span
|
||||||
key={status}
|
key={status.value}
|
||||||
className="dropdown-item"
|
className="dropdown-item"
|
||||||
onClick={() => onChange(status)}
|
onClick={() => onChange(status.value)}
|
||||||
>
|
>
|
||||||
{status}
|
{status.label}
|
||||||
</span>
|
</span>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,168 @@
|
|||||||
|
import { useState } from 'react'
|
||||||
|
import { FaChevronDown, FaPlay, FaStop, FaPlus } from 'react-icons/fa6'
|
||||||
|
import { formatDistanceToNow, format } from 'date-fns'
|
||||||
|
import { de } from 'date-fns/locale'
|
||||||
|
import StatusDropdown from './StatusDropdown'
|
||||||
|
import UrgentToggle from './UrgentToggle'
|
||||||
|
import EditorDropdown from './EditorDropdown'
|
||||||
|
import CreateWorksheetModal from './CreateWorksheetModal'
|
||||||
|
import WorksheetList from './WorksheetList'
|
||||||
|
import WorksheetTimesModal from './WorksheetTimesModal'
|
||||||
|
import WorksheetSummary from './WorksheetSummary'
|
||||||
|
import TicketProjects from './TicketProjects'
|
||||||
|
import ProjectContextPanel from './ProjectContextPanel'
|
||||||
|
import InvoicePanel from './InvoicePanel'
|
||||||
|
import Tabs from './ui/Tabs'
|
||||||
|
import Badge from './ui/Badge'
|
||||||
|
import { StatusPill, UrgentPill } from './ui/StatusPill'
|
||||||
|
import { useWorksheets } from '../hooks/useWorksheets'
|
||||||
|
import { useCustomerAbo } from '../hooks/useCustomerAbo'
|
||||||
|
import { useAuth } from '../context/AuthContext'
|
||||||
|
import { databases, DATABASE_ID, COLLECTIONS } from '../lib/appwrite'
|
||||||
|
import { canEditWorksheetTimes } from '../lib/ticketForm'
|
||||||
|
import { ticketTypeLabel } from '../lib/ticketStatus'
|
||||||
|
|
||||||
|
// Projekt / Preview steht mit im Details-Reiter
|
||||||
|
const TABS = [
|
||||||
|
{ id: 'details', label: 'Details' },
|
||||||
|
{ id: 'worksheets', label: 'Arbeitsblätter' },
|
||||||
|
{ id: 'invoices', label: 'Rechnungen' },
|
||||||
|
]
|
||||||
|
|
||||||
|
export default function TicketCard({ ticket, onUpdate }) {
|
||||||
|
const { user, employee } = useAuth()
|
||||||
|
const [expanded, setExpanded] = useState(false)
|
||||||
|
const [activeTab, setActiveTab] = useState('details')
|
||||||
|
const [showCreateWorksheet, setShowCreateWorksheet] = useState(false)
|
||||||
|
const [editTimesWorksheet, setEditTimesWorksheet] = useState(null)
|
||||||
|
// Abo-Stundenkonto gibt es nur bei Wartungs-Abo; erst laden, wenn Arbeitsblaetter gebraucht werden
|
||||||
|
const { hoursAllowed: aboHoursAllowed } = useCustomerAbo(
|
||||||
|
ticket.customerId,
|
||||||
|
(expanded && activeTab === 'worksheets') || showCreateWorksheet
|
||||||
|
)
|
||||||
|
|
||||||
|
const { worksheets, loading: worksheetsLoading, createWorksheet, updateWorksheet, updateWorksheetTimes, getTotalTime } = useWorksheets(
|
||||||
|
expanded ? ticket.woid : null
|
||||||
|
)
|
||||||
|
|
||||||
|
const createdAt = new Date(ticket.$createdAt || ticket.createdAt)
|
||||||
|
const elapsed = formatDistanceToNow(createdAt, { locale: de, addSuffix: true })
|
||||||
|
|
||||||
|
const stop = (e) => e.stopPropagation()
|
||||||
|
|
||||||
|
// Abo-Stunden: Arbeitszeit vom Stundenguthaben des Wartungs-Abos abziehen oder nicht
|
||||||
|
const handleTogglePlan = (ws) => updateWorksheet(ws.$id, { countsToPlan: !ws.countsToPlan })
|
||||||
|
|
||||||
|
const handleCreateWorksheet = async (worksheetData, currentUser) => {
|
||||||
|
const result = await createWorksheet(worksheetData, currentUser)
|
||||||
|
if (result.success && worksheetData.newStatus !== ticket.status) {
|
||||||
|
await onUpdate(ticket.$id, { status: worksheetData.newStatus })
|
||||||
|
}
|
||||||
|
// Akquise-Automatik: Ergebnis im Worksheet steuert den Kundenstatus
|
||||||
|
if (result.success && ticket.type === 'Akquise' && ticket.customerId) {
|
||||||
|
const outcome = worksheetData.newStatus
|
||||||
|
const next = outcome === 'Zugesagt' ? 'customer' : outcome === 'Abgesagt' ? 'lost' : null
|
||||||
|
if (next) {
|
||||||
|
try {
|
||||||
|
await databases.updateDocument(DATABASE_ID, COLLECTIONS.CUSTOMERS, ticket.customerId, {
|
||||||
|
customerStatus: next,
|
||||||
|
updatedAt: new Date().toISOString(),
|
||||||
|
})
|
||||||
|
} catch { /* nicht kritisch */ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={`tcard ${expanded ? 'open' : ''}`}>
|
||||||
|
<div className="tcard-main" onClick={() => setExpanded((e) => !e)}>
|
||||||
|
<div className="tcard-woid">
|
||||||
|
<span className="id">{ticket.woid || ticket.$id?.slice(-5)}</span>
|
||||||
|
<span className="age">{elapsed}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="tcard-body">
|
||||||
|
<div className="tcard-row1">
|
||||||
|
<span className="tcard-customer">{ticket.customerName || 'Unbekannt'}</span>
|
||||||
|
{ticket.customerLocation && <span className="tcard-loc">· {ticket.customerLocation}</span>}
|
||||||
|
</div>
|
||||||
|
<div className="tcard-topic">{ticket.topic || ticket.title || 'Kein Betreff'}</div>
|
||||||
|
<div className="tcard-badges">
|
||||||
|
<StatusPill status={ticket.status} />
|
||||||
|
<UrgentPill priority={ticket.priority} />
|
||||||
|
{ticket.type && <Badge tone="muted">{ticketTypeLabel(ticket.type)}</Badge>}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="tcard-side" onClick={stop}>
|
||||||
|
<div style={{ minWidth: 120 }}>
|
||||||
|
<StatusDropdown value={ticket.status} onChange={(v) => onUpdate(ticket.$id, { status: v })} />
|
||||||
|
</div>
|
||||||
|
<UrgentToggle value={ticket.priority} onChange={(v) => onUpdate(ticket.$id, { priority: v })} />
|
||||||
|
<FaChevronDown className={`chevron ${expanded ? 'up' : ''}`} onClick={() => setExpanded((e) => !e)} style={{ cursor: 'pointer' }} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{expanded && (
|
||||||
|
<div className="tcard-detail">
|
||||||
|
<div className="flex gap-3 wrap" style={{ marginBottom: 16, fontSize: 13 }}>
|
||||||
|
<span className="muted"><FaPlay style={{ color: 'var(--ok)' }} /> {ticket.startDate || format(createdAt, 'dd.MM.yyyy')}</span>
|
||||||
|
<span className="muted"><FaStop style={{ color: 'var(--danger)' }} /> {ticket.deadline || '-'}</span>
|
||||||
|
{ticket.requestedBy && <span className="muted">Angefragt von: {ticket.requestedBy}</span>}
|
||||||
|
<span className="grow" />
|
||||||
|
<div style={{ minWidth: 150 }}><EditorDropdown value={ticket.assignedTo} onChange={(v) => onUpdate(ticket.$id, { assignedTo: v })} /></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Tabs tabs={TABS} active={activeTab} onChange={setActiveTab} />
|
||||||
|
|
||||||
|
<div className="ticket-tab-content">
|
||||||
|
{activeTab === 'details' && (
|
||||||
|
<div>
|
||||||
|
<div className="ui-card pad" style={{ marginBottom: 16 }}>
|
||||||
|
<h5 style={{ fontWeight: 700, marginBottom: 12 }}>Ticket-Beschreibung</h5>
|
||||||
|
<p style={{ whiteSpace: 'pre-wrap', color: 'var(--text-muted)', lineHeight: 1.7, margin: 0 }}>
|
||||||
|
{ticket.details || 'Keine Details vorhanden.'}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<ProjectContextPanel ticket={ticket} />
|
||||||
|
<TicketProjects ticket={ticket} />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{activeTab === 'worksheets' && (
|
||||||
|
<div>
|
||||||
|
<div className="flex gap-2" style={{ marginBottom: 16 }}>
|
||||||
|
<button className="ui-btn ui-btn-primary grow" onClick={() => setShowCreateWorksheet(true)}>
|
||||||
|
<FaPlus /> Arbeitsblatt hinzufügen
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<WorksheetSummary worksheets={worksheets} />
|
||||||
|
<WorksheetList
|
||||||
|
worksheets={worksheets}
|
||||||
|
totalTime={getTotalTime()}
|
||||||
|
loading={worksheetsLoading}
|
||||||
|
canEditTimes={(ws) => canEditWorksheetTimes(ws, user, employee)}
|
||||||
|
onEditTimes={setEditTimesWorksheet}
|
||||||
|
onTogglePlan={handleTogglePlan}
|
||||||
|
aboHoursAllowed={aboHoursAllowed}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{activeTab === 'invoices' && <InvoicePanel ticket={ticket} />}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<CreateWorksheetModal isOpen={showCreateWorksheet} onClose={() => setShowCreateWorksheet(false)} workorder={ticket} onCreate={handleCreateWorksheet} aboHoursAllowed={aboHoursAllowed} />
|
||||||
|
{editTimesWorksheet && (
|
||||||
|
<WorksheetTimesModal
|
||||||
|
worksheet={editTimesWorksheet}
|
||||||
|
onClose={() => setEditTimesWorksheet(null)}
|
||||||
|
onSave={(ws, times) => updateWorksheetTimes(ws, times, user, employee)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,177 +0,0 @@
|
|||||||
import { useState } from 'react'
|
|
||||||
import { FaCaretDown } from 'react-icons/fa6'
|
|
||||||
|
|
||||||
const TICKET_TYPES = [
|
|
||||||
'Home Office', 'Holidays', 'Trip', 'Supportrequest', 'Change Request',
|
|
||||||
'Maintenance', 'Project', 'Controlling', 'Development', 'Documentation',
|
|
||||||
'Meeting/Conference', 'IT Management', 'IT Security', 'Procurement',
|
|
||||||
'Rollout', 'Emergency Call', 'Other Services'
|
|
||||||
]
|
|
||||||
|
|
||||||
const SYSTEMS = [
|
|
||||||
'Account View', 'Client', 'Cofano', 'Credentials', 'Diamant', 'Docuware',
|
|
||||||
'EDI', 'eMail', 'Employee', 'Invoice', 'LBase', 'Medical Office', 'Network',
|
|
||||||
'O365', 'PDF Viewer', 'Printer', 'Reports', 'Server', 'Time Tracking',
|
|
||||||
'TK', 'TOS', 'Vivendi NG', 'VGM', '(W)LAN', '(W)WAN', 'WOMS', 'n/a'
|
|
||||||
]
|
|
||||||
|
|
||||||
const STATUSES = [
|
|
||||||
'Open', 'Occupied', 'Assigned', 'Awaiting', 'Added Info',
|
|
||||||
'In Test', 'Halted', 'Aborted', 'Cancelled', 'Closed'
|
|
||||||
]
|
|
||||||
|
|
||||||
const PRIORITIES = [
|
|
||||||
{ value: 0, label: 'None' },
|
|
||||||
{ value: 1, label: 'Low' },
|
|
||||||
{ value: 2, label: 'Medium' },
|
|
||||||
{ value: 3, label: 'High' },
|
|
||||||
{ value: 4, label: 'Critical' }
|
|
||||||
]
|
|
||||||
|
|
||||||
export default function TicketFilters({ filters, onChange, onApply }) {
|
|
||||||
const [localFilters, setLocalFilters] = useState(filters)
|
|
||||||
|
|
||||||
const handleCheckboxChange = (category, value) => {
|
|
||||||
const current = localFilters[category] || []
|
|
||||||
const updated = current.includes(value)
|
|
||||||
? current.filter(v => v !== value)
|
|
||||||
: [...current, value]
|
|
||||||
setLocalFilters({ ...localFilters, [category]: updated })
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleInputChange = (field, value) => {
|
|
||||||
setLocalFilters({ ...localFilters, [field]: value })
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleApply = () => {
|
|
||||||
onChange(localFilters)
|
|
||||||
onApply()
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<tr className="bg-dark-grey text-white">
|
|
||||||
<td className="text-center">
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
placeholder="WOID"
|
|
||||||
className="form-control"
|
|
||||||
style={{ width: '80px', background: '#616161', color: '#fff', border: 'none' }}
|
|
||||||
value={localFilters.woid || ''}
|
|
||||||
onChange={(e) => handleInputChange('woid', e.target.value)}
|
|
||||||
/>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
placeholder="Created"
|
|
||||||
className="form-control"
|
|
||||||
style={{ width: '100px', background: '#616161', color: '#fff', border: 'none' }}
|
|
||||||
value={localFilters.createdDate || ''}
|
|
||||||
onChange={(e) => handleInputChange('createdDate', e.target.value)}
|
|
||||||
/>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div className="dropdown">
|
|
||||||
<button className="btn btn-dark">
|
|
||||||
Type / Location <FaCaretDown />
|
|
||||||
</button>
|
|
||||||
<div className="dropdown-content" style={{ maxHeight: '300px', overflowY: 'auto' }}>
|
|
||||||
{TICKET_TYPES.map(type => (
|
|
||||||
<label key={type} className="dropdown-item" style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
checked={(localFilters.type || []).includes(type)}
|
|
||||||
onChange={() => handleCheckboxChange('type', type)}
|
|
||||||
/>
|
|
||||||
{type}
|
|
||||||
</label>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div className="dropdown">
|
|
||||||
<button className="btn btn-dark">
|
|
||||||
System <FaCaretDown />
|
|
||||||
</button>
|
|
||||||
<div className="dropdown-content" style={{ maxHeight: '300px', overflowY: 'auto' }}>
|
|
||||||
{SYSTEMS.map(system => (
|
|
||||||
<label key={system} className="dropdown-item" style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
checked={(localFilters.system || []).includes(system)}
|
|
||||||
onChange={() => handleCheckboxChange('system', system)}
|
|
||||||
/>
|
|
||||||
{system}
|
|
||||||
</label>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
placeholder="Customer or Location"
|
|
||||||
className="form-control"
|
|
||||||
style={{ width: '150px', background: '#616161', color: '#fff', border: 'none' }}
|
|
||||||
value={localFilters.customer || ''}
|
|
||||||
onChange={(e) => handleInputChange('customer', e.target.value)}
|
|
||||||
/>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
placeholder="User or Topic"
|
|
||||||
className="form-control"
|
|
||||||
style={{ width: '150px', background: '#616161', color: '#fff', border: 'none' }}
|
|
||||||
value={localFilters.userTopic || ''}
|
|
||||||
onChange={(e) => handleInputChange('userTopic', e.target.value)}
|
|
||||||
/>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div className="dropdown">
|
|
||||||
<button className="btn btn-dark">
|
|
||||||
Status <FaCaretDown />
|
|
||||||
</button>
|
|
||||||
<div className="dropdown-content">
|
|
||||||
{STATUSES.map(status => (
|
|
||||||
<label key={status} className="dropdown-item" style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
checked={(localFilters.status || []).includes(status)}
|
|
||||||
onChange={() => handleCheckboxChange('status', status)}
|
|
||||||
/>
|
|
||||||
{status}
|
|
||||||
</label>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div className="dropdown">
|
|
||||||
<button className="btn btn-dark">
|
|
||||||
Priority <FaCaretDown />
|
|
||||||
</button>
|
|
||||||
<div className="dropdown-content">
|
|
||||||
{PRIORITIES.map(p => (
|
|
||||||
<label key={p.value} className="dropdown-item" style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
checked={(localFilters.priority || []).includes(p.value)}
|
|
||||||
onChange={() => handleCheckboxChange('priority', p.value)}
|
|
||||||
/>
|
|
||||||
{p.label}
|
|
||||||
</label>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td className="text-center">Approval</td>
|
|
||||||
<td className="text-center">
|
|
||||||
<button className="btn btn-green" onClick={handleApply}>
|
|
||||||
Apply!
|
|
||||||
</button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
import { useState, useEffect, useCallback } from 'react'
|
||||||
|
import { FaPlus, FaLink } from 'react-icons/fa6'
|
||||||
|
import { useWebsiteProjects } from '../hooks/useWebsiteProjects'
|
||||||
|
import { createProjectFromTemplate, importNewRepos } from '../lib/projectAdminApi'
|
||||||
|
import { isOutsideOrg, assignSummary } from '../lib/projectAssign'
|
||||||
|
import AssignedProjectCard from './AssignedProjectCard'
|
||||||
|
|
||||||
|
function slugify(v) {
|
||||||
|
return String(v || '').toLowerCase().replace(/[^a-z0-9-]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 100)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Zuordnen lassen sich echte Repos des gleichen Kunden oder ohne Kunden, die nicht
|
||||||
|
// archiviert, keine Vorlage und noch nicht an diesem Ticket sind
|
||||||
|
function assignableProjects(all, ticket, assignedIds) {
|
||||||
|
return (all || []).filter((p) =>
|
||||||
|
p.repoFullName &&
|
||||||
|
!assignedIds.has(p.$id) &&
|
||||||
|
p.status !== 'archived' &&
|
||||||
|
!p.isTemplate &&
|
||||||
|
(!p.customerId || p.customerId === ticket.customerId)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Projekte am Ticket: Liste, Zuweisen, Loesen und neues Projekt an einer Stelle.
|
||||||
|
// Loesen nimmt das Projekt nur vom Ticket; die Kundenzuordnung (Sichtbarkeit im Portal) bleibt.
|
||||||
|
export default function TicketProjects({ ticket }) {
|
||||||
|
const { fetchAllProjects, fetchByTicketId, assignProjects, unassignProject } = useWebsiteProjects()
|
||||||
|
const [assigned, setAssigned] = useState([])
|
||||||
|
const [available, setAvailable] = useState([])
|
||||||
|
const [selected, setSelected] = useState('')
|
||||||
|
const [showCreate, setShowCreate] = useState(false)
|
||||||
|
const [createForm, setCreateForm] = useState({ displayName: '', subdomain: '' })
|
||||||
|
const [busy, setBusy] = useState(false)
|
||||||
|
const [error, setError] = useState('')
|
||||||
|
const [importing, setImporting] = useState(false)
|
||||||
|
const [importHint, setImportHint] = useState('')
|
||||||
|
const [assignResult, setAssignResult] = useState(null)
|
||||||
|
|
||||||
|
const load = useCallback(async () => {
|
||||||
|
if (!ticket?.$id) return
|
||||||
|
const [all, mine] = await Promise.all([fetchAllProjects(), fetchByTicketId(ticket.$id)])
|
||||||
|
setAssigned(mine)
|
||||||
|
setAvailable(assignableProjects(all, ticket, new Set(mine.map((p) => p.$id))))
|
||||||
|
}, [ticket, fetchAllProjects, fetchByTicketId])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let cancelled = false
|
||||||
|
;(async () => {
|
||||||
|
setImporting(true)
|
||||||
|
setImportHint('')
|
||||||
|
try {
|
||||||
|
await importNewRepos()
|
||||||
|
} catch (err) {
|
||||||
|
if (!cancelled) setImportHint(`Neue Repos konnten nicht geladen werden (${err.message}).`)
|
||||||
|
} finally {
|
||||||
|
if (!cancelled) setImporting(false)
|
||||||
|
}
|
||||||
|
if (!cancelled) await load()
|
||||||
|
})()
|
||||||
|
return () => { cancelled = true }
|
||||||
|
}, [load])
|
||||||
|
|
||||||
|
const run = async (action) => {
|
||||||
|
setBusy(true)
|
||||||
|
setError('')
|
||||||
|
try {
|
||||||
|
await action()
|
||||||
|
await load()
|
||||||
|
} catch (err) {
|
||||||
|
setError(err.message || 'Aktion fehlgeschlagen')
|
||||||
|
} finally {
|
||||||
|
setBusy(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const assign = async () => {
|
||||||
|
setBusy(true)
|
||||||
|
setError('')
|
||||||
|
setAssignResult(null)
|
||||||
|
try {
|
||||||
|
const projectName = available.find((p) => p.$id === selected)?.projectName || ''
|
||||||
|
const r = await assignProjects([selected], { customerId: ticket.customerId || '', ticketId: ticket.$id })
|
||||||
|
const one = r.results[0]
|
||||||
|
setAssignResult(assignSummary(projectName, one.ok ? one.result : { error: one.error }))
|
||||||
|
if (r.success) setSelected('')
|
||||||
|
await load()
|
||||||
|
} catch (err) {
|
||||||
|
setError(err.message || 'Aktion fehlgeschlagen')
|
||||||
|
} finally {
|
||||||
|
setBusy(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const unassign = (projectId) => run(async () => {
|
||||||
|
const r = await unassignProject(projectId)
|
||||||
|
if (!r.success) throw new Error(r.error)
|
||||||
|
})
|
||||||
|
|
||||||
|
const create = (e) => {
|
||||||
|
e.preventDefault()
|
||||||
|
run(async () => {
|
||||||
|
const subdomain = slugify(createForm.subdomain)
|
||||||
|
await createProjectFromTemplate({
|
||||||
|
repoName: subdomain,
|
||||||
|
displayName: createForm.displayName,
|
||||||
|
subdomain,
|
||||||
|
customerId: ticket.customerId || '',
|
||||||
|
ticketId: ticket.$id,
|
||||||
|
})
|
||||||
|
setCreateForm({ displayName: '', subdomain: '' })
|
||||||
|
setShowCreate(false)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="ui-card pad ticket-projects">
|
||||||
|
<h5 style={{ fontWeight: 700, marginBottom: 12 }}>Projekte ({assigned.length})</h5>
|
||||||
|
{importing && <p className="muted" style={{ marginTop: 0 }}>Suche neue Repos …</p>}
|
||||||
|
{importHint && <div className="text-red" style={{ marginBottom: 8 }}>{importHint}</div>}
|
||||||
|
{error && <div className="text-red" style={{ marginBottom: 8 }}>{error}</div>}
|
||||||
|
{assigned.length === 0
|
||||||
|
? <p className="muted" style={{ marginTop: 0 }}>Noch kein Projekt an diesem Ticket.</p>
|
||||||
|
: assigned.map((p) => (
|
||||||
|
<AssignedProjectCard
|
||||||
|
key={p.$id}
|
||||||
|
project={p}
|
||||||
|
showActions
|
||||||
|
onUnassign={unassign}
|
||||||
|
customerName={ticket.customerName || ''}
|
||||||
|
onChanged={load}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
|
||||||
|
<div className="ticket-projects-assign">
|
||||||
|
<select className="form-control" aria-label="Projekt zuweisen" value={selected} onChange={(e) => setSelected(e.target.value)}>
|
||||||
|
<option value="">Projekt wählen …</option>
|
||||||
|
{available.map((p) => (
|
||||||
|
<option key={p.$id} value={p.$id}>
|
||||||
|
{p.projectName} ({p.subdomain || p.repoFullName})
|
||||||
|
{isOutsideOrg(p.repoFullName) ? ' – wird beim Zuweisen nach WEBklar verschoben' : ''}
|
||||||
|
</option>
|
||||||
|
))}
|
||||||
|
</select>
|
||||||
|
<button type="button" className="ui-btn" disabled={!selected || busy} onClick={assign}><FaLink /> Zuweisen</button>
|
||||||
|
<button type="button" className="ui-btn ui-btn-ghost" onClick={() => setShowCreate((s) => !s)}><FaPlus /> Neues Projekt</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{assignResult && (
|
||||||
|
<div style={{ marginTop: 8, fontSize: 13 }}>
|
||||||
|
<div>{assignResult.text}</div>
|
||||||
|
{assignResult.warnings.map((w, i) => (
|
||||||
|
<div key={i} className="muted" style={{ marginLeft: 12 }}>{w}</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{showCreate && (
|
||||||
|
<form className="ticket-projects-assign" onSubmit={create} style={{ marginTop: 8 }}>
|
||||||
|
<input className="form-control" placeholder="Anzeigename" value={createForm.displayName} onChange={(e) => setCreateForm((f) => ({ ...f, displayName: e.target.value }))} required />
|
||||||
|
<input className="form-control" placeholder="Subdomain" value={createForm.subdomain} onChange={(e) => setCreateForm((f) => ({ ...f, subdomain: e.target.value }))} required />
|
||||||
|
<button type="submit" className="ui-btn ui-btn-primary" disabled={busy}>{busy ? 'Wird angelegt …' : 'Anlegen & zuweisen'}</button>
|
||||||
|
</form>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,171 +0,0 @@
|
|||||||
import { useState } from 'react'
|
|
||||||
import { FaLock, FaLockOpen, FaPlay, FaStop, FaTruck, FaSackDollar, FaUserGear } from 'react-icons/fa6'
|
|
||||||
import { formatDistanceToNow, format } from 'date-fns'
|
|
||||||
import { de } from 'date-fns/locale'
|
|
||||||
import StatusDropdown from './StatusDropdown'
|
|
||||||
import PriorityDropdown from './PriorityDropdown'
|
|
||||||
import EditorDropdown from './EditorDropdown'
|
|
||||||
import ResponseDropdown from './ResponseDropdown'
|
|
||||||
|
|
||||||
const PRIORITY_CLASSES = {
|
|
||||||
0: 'priority-none',
|
|
||||||
1: 'priority-low',
|
|
||||||
2: 'priority-medium',
|
|
||||||
3: 'priority-high',
|
|
||||||
4: 'priority-critical'
|
|
||||||
}
|
|
||||||
|
|
||||||
const PRIORITY_LABELS = {
|
|
||||||
0: 'NONE',
|
|
||||||
1: 'LOW',
|
|
||||||
2: 'MEDIUM',
|
|
||||||
3: 'HIGH',
|
|
||||||
4: 'CRITICAL'
|
|
||||||
}
|
|
||||||
|
|
||||||
const STATUS_CLASSES = {
|
|
||||||
'Open': 'status-open',
|
|
||||||
'Occupied': 'status-occupied',
|
|
||||||
'Assigned': 'status-assigned',
|
|
||||||
'Awaiting': 'status-awaiting',
|
|
||||||
'Closed': 'status-closed'
|
|
||||||
}
|
|
||||||
|
|
||||||
const APPROVAL_ICONS = {
|
|
||||||
'pending': FaUserGear,
|
|
||||||
'approved': FaSackDollar,
|
|
||||||
'quote': FaSackDollar,
|
|
||||||
'shipping': FaTruck
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function TicketRow({ ticket, onUpdate, onExpand }) {
|
|
||||||
const [expanded, setExpanded] = useState(false)
|
|
||||||
const [locked, setLocked] = useState(true)
|
|
||||||
|
|
||||||
const createdAt = new Date(ticket.$createdAt || ticket.createdAt)
|
|
||||||
const elapsed = formatDistanceToNow(createdAt, { locale: de })
|
|
||||||
|
|
||||||
const handleStatusChange = (newStatus) => {
|
|
||||||
onUpdate(ticket.$id, { status: newStatus })
|
|
||||||
}
|
|
||||||
|
|
||||||
const handlePriorityChange = (newPriority) => {
|
|
||||||
onUpdate(ticket.$id, { priority: newPriority })
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleEditorChange = (newEditor) => {
|
|
||||||
onUpdate(ticket.$id, { assignedTo: newEditor })
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleResponseChange = (newResponse) => {
|
|
||||||
onUpdate(ticket.$id, { responseLevel: newResponse })
|
|
||||||
}
|
|
||||||
|
|
||||||
const toggleLock = () => {
|
|
||||||
if (locked) {
|
|
||||||
setExpanded(true)
|
|
||||||
onExpand?.(ticket.$id)
|
|
||||||
} else {
|
|
||||||
setExpanded(false)
|
|
||||||
}
|
|
||||||
setLocked(!locked)
|
|
||||||
}
|
|
||||||
|
|
||||||
const ApprovalIcon = APPROVAL_ICONS[ticket.approvalStatus] || FaUserGear
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<tr className="ticket-row">
|
|
||||||
<td className="ticket-id" rowSpan={2}>
|
|
||||||
<div>{ticket.woid || ticket.$id?.slice(-5)}</div>
|
|
||||||
<div className="ticket-time">{elapsed}</div>
|
|
||||||
</td>
|
|
||||||
<td className="ticket-info" rowSpan={2}>
|
|
||||||
<strong>{format(createdAt, 'dd.MM.yyyy')}</strong>
|
|
||||||
</td>
|
|
||||||
<td className="ticket-info" rowSpan={2}>
|
|
||||||
<strong>{ticket.type}</strong>
|
|
||||||
<br />
|
|
||||||
{ticket.serviceType || 'Remote'}
|
|
||||||
<br />
|
|
||||||
<FaPlay className="text-green" /> {ticket.startDate || format(createdAt, 'dd.MM.yyyy')}
|
|
||||||
<br />
|
|
||||||
<FaStop className="text-red" /> {ticket.deadline || '-'}
|
|
||||||
</td>
|
|
||||||
<td className="ticket-info" rowSpan={2}>
|
|
||||||
<strong>{ticket.systemType || 'n/a'}</strong>
|
|
||||||
</td>
|
|
||||||
<td rowSpan={2}>
|
|
||||||
<strong>{ticket.customerName || 'Unknown'}</strong>
|
|
||||||
<br />
|
|
||||||
{ticket.customerLocation || ''}
|
|
||||||
</td>
|
|
||||||
<td rowSpan={2}>
|
|
||||||
<strong>{ticket.requestedBy || '-'}</strong>
|
|
||||||
<br />
|
|
||||||
{ticket.requestedFor && <>Requested for: {ticket.requestedFor}<br /></>}
|
|
||||||
{ticket.topic}
|
|
||||||
</td>
|
|
||||||
<td className={`text-center ${STATUS_CLASSES[ticket.status] || 'status-open'}`}>
|
|
||||||
<StatusDropdown
|
|
||||||
value={ticket.status}
|
|
||||||
onChange={handleStatusChange}
|
|
||||||
/>
|
|
||||||
</td>
|
|
||||||
<td className={`text-center ${PRIORITY_CLASSES[ticket.priority] || 'priority-low'}`}>
|
|
||||||
<PriorityDropdown
|
|
||||||
value={ticket.priority}
|
|
||||||
onChange={handlePriorityChange}
|
|
||||||
/>
|
|
||||||
</td>
|
|
||||||
<td
|
|
||||||
className={`text-center ${ticket.approvalStatus === 'approved' ? 'bg-green' : 'bg-yellow'}`}
|
|
||||||
rowSpan={2}
|
|
||||||
style={{ verticalAlign: 'middle' }}
|
|
||||||
>
|
|
||||||
<ApprovalIcon size={24} />
|
|
||||||
</td>
|
|
||||||
<td
|
|
||||||
className="bg-dark-grey text-center text-white"
|
|
||||||
rowSpan={2}
|
|
||||||
style={{ verticalAlign: 'middle', cursor: 'pointer' }}
|
|
||||||
onClick={toggleLock}
|
|
||||||
>
|
|
||||||
{locked ? <FaLock size={24} /> : <FaLockOpen size={24} />}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr className="ticket-row">
|
|
||||||
<td className={`text-center ${STATUS_CLASSES[ticket.status] || 'status-open'}`}>
|
|
||||||
<EditorDropdown
|
|
||||||
value={ticket.assignedTo}
|
|
||||||
onChange={handleEditorChange}
|
|
||||||
/>
|
|
||||||
</td>
|
|
||||||
<td className={`text-center ${PRIORITY_CLASSES[ticket.priority] || 'priority-low'}`}>
|
|
||||||
<ResponseDropdown
|
|
||||||
value={ticket.responseLevel}
|
|
||||||
onChange={handleResponseChange}
|
|
||||||
/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{expanded && (
|
|
||||||
<>
|
|
||||||
<tr>
|
|
||||||
<td colSpan={10} className="p-2">
|
|
||||||
<div className="card">
|
|
||||||
<div className="card-header">Details - WOID {ticket.woid || ticket.$id}</div>
|
|
||||||
<div className="card-body">
|
|
||||||
<p><strong>Beschreibung:</strong></p>
|
|
||||||
<p>{ticket.details || 'Keine Details vorhanden.'}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
<tr className="spacer">
|
|
||||||
<td colSpan={10} style={{ height: '8px', background: '#fff' }}></td>
|
|
||||||
</tr>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { isUrgent, priorityFor } from '../lib/ticketStatus'
|
||||||
|
|
||||||
|
// Ein Klick markiert ein Ticket als dringend oder wieder als normal
|
||||||
|
export default function UrgentToggle({ value, onChange }) {
|
||||||
|
const urgent = isUrgent(value)
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className={`urgent-toggle${urgent ? ' on' : ''}`}
|
||||||
|
aria-pressed={urgent}
|
||||||
|
title={urgent ? 'Nicht mehr dringend' : 'Als dringend markieren'}
|
||||||
|
onClick={() => onChange(priorityFor(!urgent))}
|
||||||
|
>
|
||||||
|
Dringend
|
||||||
|
</button>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,306 @@
|
|||||||
|
import { useState } from 'react'
|
||||||
|
import { FaClock, FaUser, FaExchangeAlt, FaComment, FaChevronDown, FaChevronUp, FaPen, FaCheck } from 'react-icons/fa'
|
||||||
|
import { serviceTypeLabel, needsTimeEntry, worksheetTone } from '../lib/ticketForm'
|
||||||
|
import { statusLabel } from '../lib/ticketStatus'
|
||||||
|
|
||||||
|
// Kopffarbe je Zustand (worksheetTone): orange = Git-Zeit fehlt, gruen = Git-Zeit eingetragen
|
||||||
|
const TONES = {
|
||||||
|
'git-open': { border: '#f97316', base: 'linear-gradient(135deg, #f97316 0%, #ea580c 100%)', hover: 'linear-gradient(135deg, #ea580c 0%, #c2410c 100%)' },
|
||||||
|
'git-done': { border: '#10b981', base: 'linear-gradient(135deg, #10b981 0%, #059669 100%)', hover: 'linear-gradient(135deg, #059669 0%, #047857 100%)' },
|
||||||
|
comment: { border: '#3b82f6', base: 'linear-gradient(135deg, #3b82f6 0%, #2563eb 100%)', hover: 'linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%)' },
|
||||||
|
work: { border: '#4a5568', base: 'linear-gradient(135deg, #4a5568 0%, #2d3748 100%)', hover: 'linear-gradient(135deg, #2d3748 0%, #1a202c 100%)' },
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hinweise im farbigen Kopf: mit der grauen Badge-Schrift waeren sie kaum lesbar
|
||||||
|
const headerBadgeStyle = { background: 'rgba(255,255,255,0.3)', color: 'white', marginLeft: '8px' }
|
||||||
|
|
||||||
|
const headerButtonStyle = {
|
||||||
|
background: 'rgba(255,255,255,0.25)',
|
||||||
|
color: 'white',
|
||||||
|
border: '1px solid rgba(255,255,255,0.4)',
|
||||||
|
borderRadius: '6px',
|
||||||
|
padding: '2px 10px',
|
||||||
|
fontSize: '0.8rem',
|
||||||
|
marginRight: '8px',
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function WorksheetList({ worksheets, totalTime, loading, onTogglePlan, aboHoursAllowed = true, canEditTimes, onEditTimes }) {
|
||||||
|
const [expandedWorksheets, setExpandedWorksheets] = useState({})
|
||||||
|
if (loading) {
|
||||||
|
return (
|
||||||
|
<div className="text-center p-4">
|
||||||
|
<div className="spinner-border" role="status">
|
||||||
|
<span className="visually-hidden">Lädt …</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!worksheets || worksheets.length === 0) {
|
||||||
|
return (
|
||||||
|
<div className="alert alert-info" role="alert">
|
||||||
|
<FaComment className="me-2" />
|
||||||
|
Noch keine Arbeitsblätter. Leg das erste mit „Arbeitsblatt hinzufügen“ an.
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const formatTime = (minutes) => {
|
||||||
|
if (!minutes || minutes === 0) return '-'
|
||||||
|
const hours = Math.floor(minutes / 60)
|
||||||
|
const mins = minutes % 60
|
||||||
|
return hours > 0 ? `${hours}h ${mins}min` : `${mins}min`
|
||||||
|
}
|
||||||
|
|
||||||
|
const formatDateTime = (date, time) => {
|
||||||
|
if (!time) return date
|
||||||
|
const hours = time.substring(0, 2)
|
||||||
|
const mins = time.substring(2, 4)
|
||||||
|
return `${date} ${hours}:${mins}`
|
||||||
|
}
|
||||||
|
|
||||||
|
const toggleWorksheet = (wsid) => {
|
||||||
|
setExpandedWorksheets(prev => ({
|
||||||
|
...prev,
|
||||||
|
[wsid]: !prev[wsid]
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="worksheet-list">
|
||||||
|
{/* Worksheet-Einträge */}
|
||||||
|
<div className="timeline">
|
||||||
|
{worksheets.map((ws, index) => {
|
||||||
|
const isExpanded = expandedWorksheets[ws.wsid] || false
|
||||||
|
const isGit = ws.serviceType === 'GIT'
|
||||||
|
const tone = worksheetTone(ws)
|
||||||
|
const colors = TONES[tone]
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div key={ws.$id} className="timeline-item mb-4" style={{
|
||||||
|
animation: `fadeIn 0.5s ease-in-out ${index * 0.1}s backwards`
|
||||||
|
}}>
|
||||||
|
<div className="card border-0 shadow-sm overflow-hidden" style={{
|
||||||
|
borderLeft: `4px solid ${colors.border}`,
|
||||||
|
borderRadius: '8px',
|
||||||
|
transition: 'transform 0.2s ease, box-shadow 0.2s ease'
|
||||||
|
}} onMouseEnter={(e) => {
|
||||||
|
e.currentTarget.style.transform = 'translateY(-2px)'
|
||||||
|
e.currentTarget.style.boxShadow = '0 8px 16px rgba(0,0,0,0.1)'
|
||||||
|
}} onMouseLeave={(e) => {
|
||||||
|
e.currentTarget.style.transform = 'translateY(0)'
|
||||||
|
e.currentTarget.style.boxShadow = '0 2px 4px rgba(0,0,0,0.1)'
|
||||||
|
}}>
|
||||||
|
{/* Header - Immer sichtbar, klickbar */}
|
||||||
|
<div
|
||||||
|
className="card-header d-flex justify-content-between align-items-center py-3"
|
||||||
|
onClick={() => toggleWorksheet(ws.wsid)}
|
||||||
|
style={{
|
||||||
|
background: colors.base,
|
||||||
|
color: 'white',
|
||||||
|
border: 'none',
|
||||||
|
cursor: 'pointer',
|
||||||
|
userSelect: 'none',
|
||||||
|
transition: 'background 0.2s ease'
|
||||||
|
}}
|
||||||
|
onMouseEnter={(e) => {
|
||||||
|
e.currentTarget.style.background = colors.hover
|
||||||
|
}}
|
||||||
|
onMouseLeave={(e) => {
|
||||||
|
e.currentTarget.style.background = colors.base
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div className="d-flex align-items-center gap-3">
|
||||||
|
{isExpanded ? (
|
||||||
|
<FaChevronUp style={{ fontSize: '0.9rem', opacity: 0.8 }} />
|
||||||
|
) : (
|
||||||
|
<FaChevronDown style={{ fontSize: '0.9rem', opacity: 0.8 }} />
|
||||||
|
)}
|
||||||
|
<div>
|
||||||
|
<strong className="fs-6">WSID {ws.wsid}</strong>
|
||||||
|
{ws.isComment && !isGit && (
|
||||||
|
<span className="badge ms-2" style={headerBadgeStyle}>
|
||||||
|
<FaComment className="me-1" /> Kommentar
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
{tone === 'git-open' && (
|
||||||
|
<span className="badge ms-2" style={headerBadgeStyle}>
|
||||||
|
<FaClock className="me-1" /> Zeit offen
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
{tone === 'git-done' && (
|
||||||
|
<span className="badge ms-2" style={headerBadgeStyle}>
|
||||||
|
<FaCheck className="me-1" /> Zeit eingetragen
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
{ws.countsToPlan && !ws.isComment && (
|
||||||
|
<span className="badge ms-2" title="Wird vom Stundenguthaben des Wartungs-Abos abgezogen" style={{ ...headerBadgeStyle, background: '#9d3dfe' }}>
|
||||||
|
Abo-Stunden
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
{/* Collapsed: Mitarbeiter & Zeit im Header */}
|
||||||
|
{!isExpanded && (
|
||||||
|
<div className="d-flex align-items-center gap-3 ms-3">
|
||||||
|
<div className="d-flex align-items-center">
|
||||||
|
<FaUser style={{ fontSize: '0.9rem', marginRight: '0.5rem' }} />
|
||||||
|
<span style={{ fontSize: '0.9rem' }}>{ws.employeeName}</span>
|
||||||
|
</div>
|
||||||
|
{!ws.isComment && (
|
||||||
|
<div className="d-flex align-items-center">
|
||||||
|
<FaClock style={{ fontSize: '0.9rem', marginRight: '0.5rem' }} />
|
||||||
|
<span style={{ fontSize: '0.9rem' }}>{formatTime(ws.totalTime)}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<span className="badge" style={{
|
||||||
|
background: 'rgba(255,255,255,0.2)',
|
||||||
|
color: 'white',
|
||||||
|
fontSize: '0.8rem'
|
||||||
|
}}>{serviceTypeLabel(ws.serviceType)}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<div className="d-flex align-items-center gap-2">
|
||||||
|
{onEditTimes && canEditTimes?.(ws) && (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="btn btn-sm"
|
||||||
|
title="Beginn, Ende und Arbeitszeit ändern"
|
||||||
|
style={headerButtonStyle}
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation()
|
||||||
|
onEditTimes(ws)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{needsTimeEntry(ws)
|
||||||
|
? <><FaClock className="me-1" /> Zeit nachtragen</>
|
||||||
|
: <><FaPen className="me-1" /> Zeiten bearbeiten</>}
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
{onTogglePlan && !ws.isComment && Number(ws.totalTime) > 0 && (aboHoursAllowed || ws.countsToPlan) && (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="btn btn-sm"
|
||||||
|
title={ws.countsToPlan ? 'Nicht mehr vom Abo-Stundenkonto abziehen' : 'Vom Abo-Stundenkonto des Kunden abziehen'}
|
||||||
|
style={{
|
||||||
|
background: ws.countsToPlan ? '#9d3dfe' : 'rgba(255,255,255,0.15)',
|
||||||
|
color: 'white',
|
||||||
|
border: '1px solid rgba(255,255,255,0.4)',
|
||||||
|
borderRadius: '6px',
|
||||||
|
padding: '2px 10px',
|
||||||
|
fontSize: '0.8rem',
|
||||||
|
marginRight: '8px',
|
||||||
|
}}
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation()
|
||||||
|
onTogglePlan(ws)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{ws.countsToPlan ? '✓ Abo' : '+ Abo'}
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
<small style={{ opacity: 0.9 }}>
|
||||||
|
{formatDateTime(ws.startDate, ws.startTime) || formatDateTime(ws.endDate, ws.endTime)}
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Body - Nur wenn expanded */}
|
||||||
|
{isExpanded && (
|
||||||
|
<div
|
||||||
|
className="card-body p-4"
|
||||||
|
style={{
|
||||||
|
animation: 'slideDown 0.3s ease-out'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{/* Mitarbeiter & Zeit */}
|
||||||
|
<div className="row mb-3">
|
||||||
|
<div className="col-md-6">
|
||||||
|
<div className="d-flex align-items-center">
|
||||||
|
<FaUser className="me-2" style={{ color: '#10b981' }} />
|
||||||
|
<strong>{ws.employeeName}</strong>
|
||||||
|
{ws.employeeShort && (
|
||||||
|
<span className="badge ms-2" style={{
|
||||||
|
background: 'linear-gradient(135deg, #10b981 0%, #059669 100%)',
|
||||||
|
color: 'white'
|
||||||
|
}}>{ws.employeeShort}</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="col-md-6 text-md-end">
|
||||||
|
{!ws.isComment && (
|
||||||
|
<div className="d-flex align-items-center justify-content-md-end">
|
||||||
|
<FaClock className="me-2" style={{ color: '#10b981' }} />
|
||||||
|
<strong className="fs-5" style={{ color: '#10b981' }}>{formatTime(ws.totalTime)}</strong>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Service Type */}
|
||||||
|
<div className="mb-3">
|
||||||
|
<span className="badge px-3 py-2" style={{
|
||||||
|
background: 'linear-gradient(135deg, #4a5568 0%, #2d3748 100%)',
|
||||||
|
color: 'white',
|
||||||
|
fontSize: '0.85rem'
|
||||||
|
}}>{serviceTypeLabel(ws.serviceType)}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Status-Änderung */}
|
||||||
|
{ws.oldStatus !== ws.newStatus && (
|
||||||
|
<div className="mb-3 p-3 rounded-3" style={{
|
||||||
|
background: 'linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.1) 100%)'
|
||||||
|
}}>
|
||||||
|
<FaExchangeAlt className="me-2" style={{ color: '#10b981' }} />
|
||||||
|
<span className="text-muted">Status:</span>{' '}
|
||||||
|
<span className="badge" style={{ background: '#6b7280', color: 'white' }}>{statusLabel(ws.oldStatus)}</span>
|
||||||
|
<span className="mx-2" style={{ color: '#10b981' }}>→</span>
|
||||||
|
<span className="badge" style={{ background: '#10b981', color: 'white' }}>{statusLabel(ws.newStatus)}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Details */}
|
||||||
|
<div className="mt-3 p-3 rounded-3" style={{
|
||||||
|
background: 'rgba(16, 185, 129, 0.05)',
|
||||||
|
border: '1px solid rgba(16, 185, 129, 0.1)'
|
||||||
|
}}>
|
||||||
|
<small className="text-dark" style={{ whiteSpace: 'pre-wrap', lineHeight: '1.6' }}>
|
||||||
|
{ws.details}
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>{`
|
||||||
|
@keyframes fadeIn {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(20px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes slideDown {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
max-height: 0;
|
||||||
|
transform: translateY(-10px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
max-height: 1000px;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`}</style>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import { needsTimeEntry } from '../lib/ticketForm'
|
||||||
|
|
||||||
|
const formatTime = (minutes) => {
|
||||||
|
const hours = Math.floor(minutes / 60)
|
||||||
|
const mins = minutes % 60
|
||||||
|
return hours > 0 ? `${hours}h ${mins}min` : `${mins}min`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Eine Zeile ueber der Arbeitsblatt-Liste: Arbeitszeit, Anzahl, offene Git-Zeiten
|
||||||
|
export default function WorksheetSummary({ worksheets }) {
|
||||||
|
if (!worksheets || worksheets.length === 0) return null
|
||||||
|
const minutes = worksheets
|
||||||
|
.filter((ws) => !ws.isComment)
|
||||||
|
.reduce((sum, ws) => sum + (Number(ws.totalTime) || 0), 0)
|
||||||
|
const open = worksheets.filter(needsTimeEntry).length
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="worksheet-summary">
|
||||||
|
<span>Arbeitszeit gesamt <strong>{formatTime(minutes)}</strong></span>
|
||||||
|
<span>{worksheets.length} {worksheets.length === 1 ? 'Arbeitsblatt' : 'Arbeitsblätter'}</span>
|
||||||
|
{open > 0 && <span className="open">{open} {open === 1 ? 'Zeit offen' : 'Zeiten offen'}</span>}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
import { useState } from 'react'
|
||||||
|
import { FaTimes } from 'react-icons/fa'
|
||||||
|
import { isoToGermanDate, timeToWoms, germanDateToIso, womsTimeToInput, minutesBetween, isGitWorksheet, needsTimeEntry } from '../lib/ticketForm'
|
||||||
|
import { DateTimeInput } from './ui'
|
||||||
|
|
||||||
|
// Gespeichert ist dd.mm.yyyy / hhmm, die Kalender-Felder brauchen yyyy-mm-dd / hh:mm
|
||||||
|
const formFromWorksheet = (worksheet) => ({
|
||||||
|
startDate: germanDateToIso(worksheet.startDate || worksheet.endDate),
|
||||||
|
startTime: womsTimeToInput(worksheet.startTime),
|
||||||
|
endDate: germanDateToIso(worksheet.endDate || worksheet.startDate),
|
||||||
|
endTime: womsTimeToInput(worksheet.endTime)
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Beginn, Ende und Arbeitszeit eines Arbeitsblatts nachtraeglich aendern.
|
||||||
|
* Wer das darf, entscheidet canEditWorksheetTimes (lib/ticketForm).
|
||||||
|
*/
|
||||||
|
export default function WorksheetTimesModal({ worksheet, onClose, onSave }) {
|
||||||
|
const isGit = isGitWorksheet(worksheet)
|
||||||
|
const [formData, setFormData] = useState(() => formFromWorksheet(worksheet))
|
||||||
|
// null = die Arbeitszeit folgt Beginn und Ende. Passte sie schon vorher nicht dazu,
|
||||||
|
// wurde sie von Hand eingetragen (z.B. ohne Pause) und bleibt stehen.
|
||||||
|
const [manualTotal, setManualTotal] = useState(() => {
|
||||||
|
const stored = Number(worksheet.totalTime) || 0
|
||||||
|
return !stored || stored === minutesBetween(formData.startTime, formData.endTime) ? null : stored
|
||||||
|
})
|
||||||
|
const [saving, setSaving] = useState(false)
|
||||||
|
const [error, setError] = useState('')
|
||||||
|
|
||||||
|
const calculatedTotal = minutesBetween(formData.startTime, formData.endTime)
|
||||||
|
const totalTime = manualTotal ?? calculatedTotal ?? 0
|
||||||
|
|
||||||
|
const handleChange = (field, value) => {
|
||||||
|
setFormData(prev => ({ ...prev, [field]: value }))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Das Ende darf nicht vor dem Start liegen, deshalb rueckt es mit
|
||||||
|
const handleStartDateChange = (value) => {
|
||||||
|
setFormData(prev => ({
|
||||||
|
...prev,
|
||||||
|
startDate: value,
|
||||||
|
endDate: value && prev.endDate && prev.endDate < value ? value : prev.endDate
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSubmit = async (e) => {
|
||||||
|
e.preventDefault()
|
||||||
|
setSaving(true)
|
||||||
|
setError('')
|
||||||
|
try {
|
||||||
|
const result = await onSave(worksheet, {
|
||||||
|
startDate: isoToGermanDate(formData.startDate),
|
||||||
|
startTime: timeToWoms(formData.startTime),
|
||||||
|
endDate: isoToGermanDate(formData.endDate),
|
||||||
|
endTime: timeToWoms(formData.endTime),
|
||||||
|
totalTime: parseInt(totalTime, 10) || 0
|
||||||
|
})
|
||||||
|
if (result?.success) {
|
||||||
|
onClose()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
setError(result?.error || 'Speichern fehlgeschlagen')
|
||||||
|
} catch (err) {
|
||||||
|
setError(err.message || 'Speichern fehlgeschlagen')
|
||||||
|
}
|
||||||
|
setSaving(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="overlay">
|
||||||
|
<span className="overlay-close" onClick={onClose}>
|
||||||
|
<FaTimes />
|
||||||
|
</span>
|
||||||
|
<div className="overlay-content" style={{ maxWidth: 560 }}>
|
||||||
|
{/* Kurzer Titel: auf dem Handy laeuft ein langer unter das Schliessen-X */}
|
||||||
|
<h2 className="mb-2">{needsTimeEntry(worksheet) ? 'Zeit nachtragen' : 'Zeiten bearbeiten'}</h2>
|
||||||
|
<p className="text-grey" style={{ fontSize: '14px', marginBottom: '16px' }}>
|
||||||
|
WSID {worksheet.wsid}
|
||||||
|
{isGit && <><br />Das Ende ist der Zeitpunkt des Git-Pushs. Trag ein, wann die Arbeit begonnen hat.</>}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{error && (
|
||||||
|
<div className="bg-red text-white p-2 mb-2" style={{ borderRadius: '4px' }}>
|
||||||
|
{error}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<form onSubmit={handleSubmit}>
|
||||||
|
<div className="form-group">
|
||||||
|
<label className="form-label" htmlFor="worksheet-times-start">Beginn</label>
|
||||||
|
<DateTimeInput
|
||||||
|
id="worksheet-times-start"
|
||||||
|
timeLabel="Uhrzeit Beginn"
|
||||||
|
required
|
||||||
|
timeRequired={isGit}
|
||||||
|
date={formData.startDate}
|
||||||
|
time={formData.startTime}
|
||||||
|
onDateChange={handleStartDateChange}
|
||||||
|
onTimeChange={(value) => handleChange('startTime', value)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="form-group">
|
||||||
|
<label className="form-label" htmlFor="worksheet-times-end">Ende</label>
|
||||||
|
<DateTimeInput
|
||||||
|
id="worksheet-times-end"
|
||||||
|
timeLabel="Uhrzeit Ende"
|
||||||
|
required
|
||||||
|
min={formData.startDate}
|
||||||
|
date={formData.endDate}
|
||||||
|
time={formData.endTime}
|
||||||
|
onDateChange={(value) => handleChange('endDate', value)}
|
||||||
|
onTimeChange={(value) => handleChange('endTime', value)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="form-group">
|
||||||
|
<label className="form-label" htmlFor="worksheet-times-total">Arbeitszeit (Minuten)</label>
|
||||||
|
<input
|
||||||
|
id="worksheet-times-total"
|
||||||
|
type="number"
|
||||||
|
className="form-control"
|
||||||
|
min="0"
|
||||||
|
step="1"
|
||||||
|
value={totalTime}
|
||||||
|
onChange={(e) => setManualTotal(e.target.value)}
|
||||||
|
placeholder="0"
|
||||||
|
/>
|
||||||
|
<small style={{ color: '#a0aec0', fontSize: '12px' }}>
|
||||||
|
{manualTotal === null && calculatedTotal !== null
|
||||||
|
? '✓ Automatisch berechnet'
|
||||||
|
: 'Manuell eingeben'}
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="text-center mt-2">
|
||||||
|
<button type="submit" className="btn btn-dark" disabled={saving}>
|
||||||
|
{saving ? 'Speichert...' : 'Speichern'}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
import { useState } from 'react'
|
||||||
|
import { FaTimes } from 'react-icons/fa'
|
||||||
|
import { Button } from '../ui'
|
||||||
|
|
||||||
|
const FIELDS = ['provider', 'purpose', 'cost', 'costInterval', 'startDate', 'termMonths', 'renewalMonths', 'noticeValue', 'noticeUnit', 'note']
|
||||||
|
const NUMBERS = ['termMonths', 'renewalMonths', 'noticeValue']
|
||||||
|
|
||||||
|
function toForm(contract) {
|
||||||
|
const form = { costInterval: 'month', noticeUnit: 'months' }
|
||||||
|
for (const key of FIELDS) {
|
||||||
|
if (contract?.[key] !== null && contract?.[key] !== undefined) form[key] = String(contract[key])
|
||||||
|
}
|
||||||
|
return form
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Leere Felder werden null, damit die Fristenlogik "Fristen fehlen" erkennt. */
|
||||||
|
function toDoc(form) {
|
||||||
|
const doc = {}
|
||||||
|
for (const key of FIELDS) {
|
||||||
|
const raw = (form[key] ?? '').trim()
|
||||||
|
if (raw === '') doc[key] = null
|
||||||
|
else if (NUMBERS.includes(key)) doc[key] = parseInt(raw, 10)
|
||||||
|
else if (key === 'cost') doc[key] = parseFloat(raw.replace(',', '.'))
|
||||||
|
else doc[key] = raw
|
||||||
|
}
|
||||||
|
return doc
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function ContractForm({ contract, onSave, onClose }) {
|
||||||
|
const [form, setForm] = useState(() => toForm(contract))
|
||||||
|
const [files, setFiles] = useState([])
|
||||||
|
const [saving, setSaving] = useState(false)
|
||||||
|
const [error, setError] = useState(null)
|
||||||
|
const set = (key) => (e) => setForm((f) => ({ ...f, [key]: e.target.value }))
|
||||||
|
|
||||||
|
const submit = async (e) => {
|
||||||
|
e.preventDefault()
|
||||||
|
setSaving(true)
|
||||||
|
setError(null)
|
||||||
|
try {
|
||||||
|
await onSave(toDoc(form), files)
|
||||||
|
onClose()
|
||||||
|
} catch (err) {
|
||||||
|
setError(err.message)
|
||||||
|
setSaving(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const input = (key, label, props = {}) => (
|
||||||
|
<div className="form-group">
|
||||||
|
<label className="form-label">{label}</label>
|
||||||
|
<input className="form-control" name={key} value={form[key] || ''} onChange={set(key)} {...props} />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="overlay">
|
||||||
|
<span className="overlay-close" onClick={onClose}><FaTimes /></span>
|
||||||
|
<div className="overlay-content">
|
||||||
|
<h2 className="mb-2">{contract ? 'Vertrag bearbeiten' : 'Neuer Vertrag'}</h2>
|
||||||
|
{error && <div className="legal-error">{error}</div>}
|
||||||
|
<form onSubmit={submit}>
|
||||||
|
{input('provider', 'Anbieter', { required: true })}
|
||||||
|
{input('purpose', 'Wofür')}
|
||||||
|
<div className="legal-form-row">
|
||||||
|
{input('cost', 'Kosten (€)', { inputMode: 'decimal' })}
|
||||||
|
<div className="form-group">
|
||||||
|
<label className="form-label">pro</label>
|
||||||
|
<select className="form-control" name="costInterval" value={form.costInterval} onChange={set('costInterval')}>
|
||||||
|
<option value="month">Monat</option>
|
||||||
|
<option value="year">Jahr</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{input('startDate', 'Vertragsbeginn', { type: 'date' })}
|
||||||
|
<div className="legal-form-row">
|
||||||
|
{input('termMonths', 'Laufzeit (Monate, 0 = jederzeit kündbar)', { type: 'number', min: 0 })}
|
||||||
|
{input('renewalMonths', 'Verlängert sich um (Monate, 0 = endet)', { type: 'number', min: 0 })}
|
||||||
|
</div>
|
||||||
|
<div className="legal-form-row">
|
||||||
|
{input('noticeValue', 'Kündigungsfrist', { type: 'number', min: 0 })}
|
||||||
|
<div className="form-group">
|
||||||
|
<label className="form-label">Einheit</label>
|
||||||
|
<select className="form-control" name="noticeUnit" value={form.noticeUnit} onChange={set('noticeUnit')}>
|
||||||
|
<option value="months">Monate</option>
|
||||||
|
<option value="days">Tage</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="form-group">
|
||||||
|
<label className="form-label">Notiz</label>
|
||||||
|
<textarea className="form-control" name="note" rows={3} value={form.note || ''} onChange={set('note')} />
|
||||||
|
</div>
|
||||||
|
<div className="form-group">
|
||||||
|
<label className="form-label">Dateien hinzufügen</label>
|
||||||
|
<input type="file" multiple accept=".pdf,.html,.htm,.png,.jpg,.jpeg,.webp,.doc,.docx" onChange={(e) => setFiles([...e.target.files])} />
|
||||||
|
</div>
|
||||||
|
<div className="flex gap-2">
|
||||||
|
<Button variant="primary" type="submit" disabled={saving}>{saving ? 'Speichert …' : 'Speichern'}</Button>
|
||||||
|
<Button type="button" onClick={onClose}>Abbrechen</Button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
Loaded 100 of 173 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user