Compare commits
89 Commits
Author | SHA1 | Date | |
---|---|---|---|
1cf8fbb91d | |||
16bd7ec544 | |||
4d5a7b4f5e | |||
9922c0ae9d | |||
93314424d9 | |||
d14ac5d9af | |||
b4939147c4 | |||
2a33fc45de | |||
3a317de8f0 | |||
f626cd52fd | |||
6283ccff6d | |||
3893e148ab | |||
65fbde845e | |||
57d3a05a5a | |||
dfd50d5e78 | |||
73541796f6 | |||
e3e9900482 | |||
156078ff3a | |||
5d56c7128e | |||
98f887f51e | |||
f46947b6d4 | |||
c1b55c3579 | |||
6a2e290d54 | |||
7263464b89 | |||
7b88e62de0 | |||
d50ea60af9 | |||
ec559f5c72 | |||
c454620ae1 | |||
94c381fbfc | |||
06576b08d9 | |||
465a6f058a | |||
daf7499b4e | |||
fade9b8d62 | |||
611a5dd906 | |||
35645fc671 | |||
fab869eb58 | |||
6cd8f199c4 | |||
948a17b739 | |||
f2290cf77f | |||
0627b6ff33 | |||
24ba040537 | |||
997786be54 | |||
c4974787d4 | |||
a42bdaa721 | |||
49938a1085 | |||
d0a27fe095 | |||
d388bce528 | |||
aabb4540c9 | |||
ffde078238 | |||
9e320c4eb2 | |||
58ed5fe867 | |||
72676edc10 | |||
d5954eac89 | |||
68a2db28a1 | |||
13709de515 | |||
2c65d5f651 | |||
33ecb79e0b | |||
00bb197620 | |||
8e7d3da07f | |||
35e0d0a783 | |||
40196fa28f | |||
7b5e90e3bd | |||
3c48988e88 | |||
869acdcb18 | |||
91af1dfca0 | |||
c271bc1f60 | |||
9c04bb973e | |||
6d7298548b | |||
42a11abe61 | |||
3c6d2f7c45 | |||
d143d6c7b6 | |||
e6638b737d | |||
1f493e0a37 | |||
469ad0ce05 | |||
8a8c13e407 | |||
18974eb69b | |||
9e406ed7a3 | |||
8b82a44ad8 | |||
528baff7b5 | |||
e105dc4663 | |||
3f69ba6198 | |||
7e812eb835 | |||
ece7f984f7 | |||
6cfc2e0162 | |||
bbcd04fd21 | |||
89a5152ada | |||
e6f43ca10a | |||
da3ef358d2 | |||
d77ee8ef04 |
16
.env.example
Normal file
16
.env.example
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Flask-Konfiguration
|
||||||
|
FLASK_APP=app.py
|
||||||
|
FLASK_ENV=development
|
||||||
|
SECRET_KEY=your-secret-key-here
|
||||||
|
|
||||||
|
# Datenbank-Konfiguration
|
||||||
|
DATABASE_URL=sqlite:///customers.db
|
||||||
|
|
||||||
|
# Authentifizierung
|
||||||
|
STATIC_PASSWORD=your-static-password-here
|
||||||
|
|
||||||
|
# IP-Bereiche für direkten Zugriff (ohne Login)
|
||||||
|
ALLOWED_IP_RANGES=192.168.0.0/24,192.168.177.0/24,213.178.68.218/29
|
||||||
|
|
||||||
|
# Logging-Konfiguration
|
||||||
|
LOG_LEVEL=INFO
|
18
.gitignore
vendored
18
.gitignore
vendored
@@ -17,6 +17,7 @@ pip-delete-this-directory.txt
|
|||||||
.vscode/
|
.vscode/
|
||||||
*.swp
|
*.swp
|
||||||
*.swo
|
*.swo
|
||||||
|
*.bak
|
||||||
|
|
||||||
# Logs
|
# Logs
|
||||||
*.log
|
*.log
|
||||||
@@ -43,6 +44,21 @@ coverage.xml
|
|||||||
|
|
||||||
# Docker
|
# Docker
|
||||||
.docker/
|
.docker/
|
||||||
|
docker-compose.yml
|
||||||
|
|
||||||
# Daten
|
# Daten
|
||||||
spezexpo.csv
|
data/
|
||||||
|
|
||||||
|
# Virtual Environment
|
||||||
|
develop-eggs/
|
||||||
|
downloads/
|
||||||
|
eggs/
|
||||||
|
.eggs/
|
||||||
|
lib/
|
||||||
|
lib64/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
wheels/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
233
CHANGELOG.md
233
CHANGELOG.md
@@ -5,49 +5,216 @@ Alle wichtigen Änderungen an diesem Projekt werden in dieser Datei dokumentiert
|
|||||||
Das Format basiert auf [Keep a Changelog](https://keepachangelog.com/de/1.0.0/),
|
Das Format basiert auf [Keep a Changelog](https://keepachangelog.com/de/1.0.0/),
|
||||||
und dieses Projekt adhäriert zu [Semantic Versioning](https://semver.org/lang/de/).
|
und dieses Projekt adhäriert zu [Semantic Versioning](https://semver.org/lang/de/).
|
||||||
|
|
||||||
## [1.0.2] - 2024-03-19
|
## [Unreleased]
|
||||||
|
|
||||||
### Hinzugefügt
|
### Hinzugefügt
|
||||||
- Wetterinformationen für jeden Suchtreffer
|
- CSV-Export-Funktion für Suchergebnisse
|
||||||
- Integration der OpenWeather API
|
- Export-Button in der Benutzeroberfläche
|
||||||
- Wetter-Icons und Temperaturanzeige
|
- Automatische Formatierung der CSV-Datei mit allen relevanten Kundendaten
|
||||||
- Umgebungsvariablen für API-Keys
|
|
||||||
|
|
||||||
|
## [1.2.17] - 2024-03-19
|
||||||
### Geändert
|
### Geändert
|
||||||
- Anpassung der API-Antwortstruktur
|
- Optimierte Datenbankverbindungen für bessere Thread-Sicherheit
|
||||||
- Verbesserte Fehlerbehandlung für API-Anfragen
|
- Verbesserte Datenbankindizes für schnellere Suchen
|
||||||
|
- Verbesserte Fehlerbehandlung bei Datenbankoperationen
|
||||||
|
|
||||||
## [1.0.1] - 2024-03-19
|
## [1.2.16] - 2024-03-21
|
||||||
|
### Geändert
|
||||||
|
- Verbesserte Suchfunktion: Highlighting für allgemeine Suche in allen Feldern
|
||||||
|
- Optimierte Reset-Buttons in den Suchfeldern
|
||||||
|
- Verbesserte CSS-Styles für die Suchfeld-Icons
|
||||||
|
|
||||||
|
## [1.2.15] - 2024-03-20
|
||||||
### Hinzugefügt
|
### Hinzugefügt
|
||||||
- Neues Suchfeld für Telefonnummer
|
- Autovervollständigung für das Ort-Feld
|
||||||
- Reset-Icons für alle Suchfelder
|
- Neue API-Route für Ortsvorschläge
|
||||||
- Trefferzähler für Suchergebnisse
|
- Optimierte SQL-Abfragen für die Ortssuche
|
||||||
|
|
||||||
|
## [1.2.14] - 2024-03-20
|
||||||
|
### Hinzugefügt
|
||||||
|
- Autovervollständigung für das Fachrichtungsfeld
|
||||||
|
- Neue API-Route für Fachrichtungsvorschläge
|
||||||
|
- Optimierte SQL-Abfragen für die Fachrichtungssuche
|
||||||
|
|
||||||
|
## [1.2.13] - 2024-03-20
|
||||||
|
### Fixed
|
||||||
|
- Korrektur der Parameteranzahl in der SQL-Abfrage für die allgemeine Suche
|
||||||
|
- Behebung des Fehlers bei der Suche in allen Datenbankfeldern
|
||||||
|
|
||||||
|
## [v1.2.12] - 2024-03-19
|
||||||
### Geändert
|
### Geändert
|
||||||
- Verbesserte Positionierung der UI-Elemente
|
- Performance-Optimierung der Suchfunktion durch Reduzierung der Suchfelder
|
||||||
- Optimierte Suchlogik im Backend
|
- Verbesserte Suchgeschwindigkeit durch LIMIT in SQL-Abfragen
|
||||||
- CSV-Datei in data-Verzeichnis verschoben
|
- Optimiertes Debounce-Intervall für Live-Suche
|
||||||
- Allgemeine Suche um Telefonnummer erweitert
|
- Verbessertes Highlighting für Teilstrings in Suchergebnissen
|
||||||
|
|
||||||
|
## [v1.2.11] - 2024-03-19
|
||||||
|
### Geändert
|
||||||
|
- Einträge mit der Fachrichtung "intern" werden aus den Suchergebnissen gefiltert
|
||||||
|
- Verbesserte SQL-Abfrage für die Suchergebnisse
|
||||||
|
|
||||||
|
## [v1.2.10] - 2024-03-19
|
||||||
|
### Geändert
|
||||||
|
- Verbesserte Darstellung der Adress-Links mit Location- und Route-Icons
|
||||||
|
- Korrektur des Docker-Port-Mappings für bessere Erreichbarkeit
|
||||||
|
|
||||||
|
## [v1.2.9] - 2024-03-19
|
||||||
|
### Geändert
|
||||||
|
- Verbesserte Darstellung der Adress-Links mit Location- und Route-Icons
|
||||||
|
- Korrektur des Docker-Port-Mappings für bessere Erreichbarkeit
|
||||||
|
|
||||||
|
## [v1.2.8] - 2024-03-19
|
||||||
|
### Geändert
|
||||||
|
- Verbesserte Tag-Anzeige: Badge neben dem Teilen-Button mit farblicher Hervorhebung (blau für MEDISOFT, orange für MEDICONSULT)
|
||||||
|
|
||||||
|
## [v1.2.7] - 2024-03-19
|
||||||
|
### Geändert
|
||||||
|
- Korrektur der Feldreihenfolge in den Suchergebnissen
|
||||||
|
- Verbesserung der Tag-Anzeige
|
||||||
|
|
||||||
|
## [v1.2.6] - 2024-03-19
|
||||||
|
### Geändert
|
||||||
|
- Verbesserte Darstellung der Kundennummern in den Suchergebnissen
|
||||||
|
- Optimierte Anzeige der Kundennummern in der Detailansicht
|
||||||
|
- Anpassung der Kundennummernberechnung für die MEDISOFT-Integration
|
||||||
|
- Verbesserte Formatierung der Kundennummern in der Benutzeroberfläche
|
||||||
|
|
||||||
|
## [v1.2.5] - 2024-03-19
|
||||||
|
### Geändert
|
||||||
|
- Verbesserte Darstellung der Kundennummern in den Suchergebnissen
|
||||||
|
- Optimierte Anzeige der Kundennummern in der Detailansicht
|
||||||
|
- Anpassung der Kundennummernberechnung für die MEDISOFT-Integration
|
||||||
|
- Verbesserte Formatierung der Kundennummern in der Benutzeroberfläche
|
||||||
|
|
||||||
|
## [v1.2.4] - 2024-03-19
|
||||||
|
### Geändert
|
||||||
|
- Verbesserte Darstellung der Kundennummern in den Suchergebnissen
|
||||||
|
- Optimierte Anzeige der Kundennummern in der Detailansicht
|
||||||
|
- Anpassung der Kundennummernberechnung für die MEDISOFT-Integration
|
||||||
|
- Verbesserte Formatierung der Kundennummern in der Benutzeroberfläche
|
||||||
|
|
||||||
|
## [v1.2.3] - 2024-03-19
|
||||||
|
### Geändert
|
||||||
|
- Verbesserte Darstellung der Kundennummern in den Suchergebnissen
|
||||||
|
- Optimierte Anzeige der Kundennummern in der Detailansicht
|
||||||
|
- Anpassung der Kundennummernberechnung für die MEDISOFT-Integration
|
||||||
|
- Verbesserte Formatierung der Kundennummern in der Benutzeroberfläche
|
||||||
|
|
||||||
|
## [v1.2.2] - 2024-03-19
|
||||||
|
### Geändert
|
||||||
|
- Verbesserte Darstellung der Kundennummern in den Suchergebnissen
|
||||||
|
- Optimierte Anzeige der Kundennummern in der Detailansicht
|
||||||
|
- Anpassung der Kundennummernberechnung für die MEDISOFT-Integration
|
||||||
|
- Verbesserte Formatierung der Kundennummern in der Benutzeroberfläche
|
||||||
|
|
||||||
|
## [v1.2.1] - 2024-03-19
|
||||||
|
### Geändert
|
||||||
|
- Verbesserte Darstellung der Kundennummern in den Suchergebnissen
|
||||||
|
- Optimierte Anzeige der Kundennummern in der Detailansicht
|
||||||
|
- Anpassung der Kundennummernberechnung für die MEDISOFT-Integration
|
||||||
|
- Verbesserte Formatierung der Kundennummern in der Benutzeroberfläche
|
||||||
|
|
||||||
|
## [v1.2.0] - 2024-03-19
|
||||||
|
### Hinzugefügt
|
||||||
|
- Neue Spalte "Tag" in der Kundendatenbank
|
||||||
|
- Unterscheidung zwischen MEDISOFT und MEDICONSULT Kunden
|
||||||
|
- Filteroption für die Anzeige von MEDISOFT oder MEDICONSULT Kunden
|
||||||
|
- Verbesserte Darstellung der Kundennummern in den Suchergebnissen
|
||||||
|
- Optimierte Anzeige der Kundennummern in der Detailansicht
|
||||||
|
- Anpassung der Kundennummernberechnung für die MEDISOFT-Integration
|
||||||
|
- Verbesserte Formatierung der Kundennummern in der Benutzeroberfläche
|
||||||
|
|
||||||
|
## [v1.1.0] - 2024-03-19
|
||||||
|
### Hinzugefügt
|
||||||
|
- Neue Spalte "Tag" in der Kundendatenbank
|
||||||
|
- Unterscheidung zwischen MEDISOFT und MEDICONSULT Kunden
|
||||||
|
- Filteroption für die Anzeige von MEDISOFT oder MEDICONSULT Kunden
|
||||||
|
|
||||||
|
## [v1.0.0] - 2024-03-19
|
||||||
|
### Hinzugefügt
|
||||||
|
- Erste Version der Anwendung
|
||||||
|
- Grundlegende Suchfunktionalität
|
||||||
|
- Anzeige von Kundendetails
|
||||||
|
- Integration mit MEDISOFT
|
||||||
|
- Responsive Design
|
||||||
|
- IP-basierte Zugriffskontrolle
|
||||||
|
|
||||||
|
## [1.2.6] - 2024-03-19
|
||||||
|
### Geändert
|
||||||
|
- Verbesserte Suchfunktion: Keine Ergebnisse mehr bei leeren Suchfeldern
|
||||||
|
- Optimiertes Highlighting der Suchergebnisse für alle Suchfelder
|
||||||
|
- Fachrichtung wird jetzt in den Suchergebnissen hervorgehoben
|
||||||
|
|
||||||
|
## [1.2.5] - 2024-03-19
|
||||||
|
### Hinzugefügt
|
||||||
|
- Neues Suchfeld für Fachrichtung
|
||||||
|
- Index für das Fachrichtung-Feld in der Datenbank
|
||||||
|
- Fachrichtung in der allgemeinen Suche integriert
|
||||||
|
|
||||||
|
## [1.2.4] - 2024-03-19
|
||||||
|
### Geändert
|
||||||
|
- Performance-Optimierung: Indizes für alle Suchfelder hinzugefügt
|
||||||
|
- Verbesserte Suchgeschwindigkeit durch optimierte Datenbankindizes
|
||||||
|
- Zusammengesetzter Index für die häufigste Suchkombination (Name + Ort) hinzugefügt
|
||||||
|
|
||||||
|
## [1.2.3] - 2024-03-19
|
||||||
|
### Geändert
|
||||||
|
- Performance-Optimierung: Entfernung aller console.log Anweisungen
|
||||||
|
- Verbesserte Code-Qualität durch Entfernung von Debug-Ausgaben
|
||||||
|
|
||||||
|
## [1.2.2] - 2024-03-19
|
||||||
|
### Geändert
|
||||||
|
- Verbesserte Telefonnummern-Formatierung: Führende "0" wird immer hinzugefügt, wenn der Benutzer von einer erlaubten IP-Adresse zugreift
|
||||||
|
- Debug-Logging für Telefonnummern-Formatierung hinzugefügt
|
||||||
|
- Verbesserte Benutzerfreundlichkeit bei der Anzeige von Telefonnummern
|
||||||
|
|
||||||
### Behoben
|
### Behoben
|
||||||
- Korrektur der Icon-Anzeige in Suchfeldern
|
- Problem mit fehlender führender "0" bei Telefonnummern für autorisierte Benutzer
|
||||||
- Verbesserte Fehlerbehandlung beim Laden der CSV-Datei
|
|
||||||
|
|
||||||
## [1.0.0] - 2024-03-18
|
## [1.2.1] - 2024-03-18
|
||||||
|
### Geändert
|
||||||
|
- Verbesserte CSV-Import-Funktionalität mit pandas
|
||||||
|
- Korrektur des Login-Prozesses
|
||||||
|
- Verbesserte Fehlerbehandlung und Logging
|
||||||
|
- Anpassung der Spaltennamen für den CSV-Import
|
||||||
|
|
||||||
|
### Behoben
|
||||||
|
- Login-Prozess funktioniert jetzt korrekt mit dem Passwort aus der .env Datei
|
||||||
|
- CSV-Import verarbeitet Anführungszeichen korrekt
|
||||||
|
- Verbesserte Fehlerbehandlung beim Datenbankimport
|
||||||
|
|
||||||
|
## [1.2.0] - 2024-03-18
|
||||||
|
|
||||||
|
### Geändert
|
||||||
|
- IP-Subnetz-Prüfung korrigiert (CIDR-Notation wird jetzt korrekt ausgewertet)
|
||||||
|
- Debug-Logging für IP-Adressen hinzugefügt
|
||||||
|
- Beispiel-Umgebungsvariablen (.env.example) hinzugefügt
|
||||||
|
|
||||||
### Hinzugefügt
|
### Hinzugefügt
|
||||||
- Grundlegende Suchfunktionalität
|
- IP-basierte Zugriffssteuerung für medisoftware-Links
|
||||||
- Spezifische Suchfelder für:
|
- IP-basierte Zugriffssteuerung für Telefonnummern-Links
|
||||||
- Name
|
- Google Maps Integration für Adressen
|
||||||
- Ort
|
- Version im Footer angezeigt
|
||||||
- Kundennummer
|
|
||||||
- Fachrichtung
|
### Verbessert
|
||||||
- Allgemeine Suche über alle Felder
|
- Verbesserte Fehlerbehandlung bei der IP-Überprüfung
|
||||||
- Klickbare Links für:
|
- Bessere Dokumentation der Konfigurationsmöglichkeiten
|
||||||
- Telefonnummern
|
|
||||||
- E-Mail-Adressen
|
## [v1.1.0] - 2024-03-17
|
||||||
- Google Maps Integration
|
|
||||||
- Share-Funktion für Suchergebnisse
|
### Hinzugefügt
|
||||||
- Responsive Design mit Bootstrap
|
- Benutzer-Login für nicht-autorisierte IPs
|
||||||
- Live-Suche während der Eingabe
|
- Verbesserte Darstellung der Telefonnummern
|
||||||
|
- Responsive Design für mobile Geräte
|
||||||
|
|
||||||
|
### Verbessert
|
||||||
|
- Optimierte Suchfunktion
|
||||||
|
- Verbesserte Benutzeroberfläche
|
||||||
|
|
||||||
|
## [v1.0.0] - 2024-03-17
|
||||||
|
|
||||||
|
### Hinzugefügt
|
||||||
|
- Erste Version mit grundlegenden Suchfunktionen
|
||||||
|
- Echtzeit-Suche über Kundendaten
|
||||||
|
- Hervorhebung von Suchbegriffen in den Ergebnissen
|
||||||
|
- Klickbare Links für Telefonnummern, E-Mail-Adressen und Adressen
|
||||||
|
- Docker-Container für einfache Installation und Deployment
|
@@ -10,8 +10,12 @@ COPY requirements.txt .
|
|||||||
# Installiere Abhängigkeiten
|
# Installiere Abhängigkeiten
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# Kopiere den Anwendungscode
|
# Erstelle das data Verzeichnis und setze Berechtigungen
|
||||||
COPY . .
|
RUN mkdir -p /app/data && \
|
||||||
|
chmod 755 /app/data
|
||||||
|
|
||||||
|
# Kopiere die Anwendungsdateien
|
||||||
|
COPY . /app/
|
||||||
|
|
||||||
# Exponiere Port 5000
|
# Exponiere Port 5000
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
|
154
README.md
154
README.md
@@ -1,107 +1,129 @@
|
|||||||
# medisoftware Kundensuche
|
# medisoftware Kundensuche
|
||||||
|
|
||||||
Eine Webanwendung zur Suche in Kundendaten der medisoftware.
|
Eine einfache und effiziente Kundensuche für medisoftware Kunden.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Live-Suche in Kundendaten
|
- 🔍 Echtzeit-Suche über alle Kundendaten
|
||||||
- Spezifische Suchfelder für:
|
- 📱 Responsive Design für alle Geräte
|
||||||
- Name
|
- 🔒 IP-basierte Zugriffskontrolle
|
||||||
- Ort
|
- 🔗 Direkte Integration mit MEDISOFT
|
||||||
- Kundennummer
|
- 🏥 Unterscheidung zwischen MEDISOFT und MEDICONSULT Kunden
|
||||||
- Fachrichtung
|
- 🎨 Farbliche Hervorhebung der Kundentypen (blau für MEDISOFT, orange für MEDICONSULT)
|
||||||
- Telefonnummer
|
- 📍 Verbesserte Adress-Links mit Location- und Route-Icons
|
||||||
- Allgemeine Suche über alle Felder
|
|
||||||
- Klickbare Telefonnummern
|
## Version
|
||||||
- Klickbare E-Mail-Adressen
|
|
||||||
- Google Maps Integration für Adressen
|
Aktuelle Version: 1.2.16
|
||||||
- Share-Funktion für Suchergebnisse
|
|
||||||
- Trefferzähler
|
|
||||||
- Reset-Funktion für alle Suchfelder
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
1. Repository klonen:
|
1. Klonen Sie das Repository:
|
||||||
```bash
|
```bash
|
||||||
git clone https://gitea.elpatron.me/elpatron/medi-customers.git
|
git clone https://gitea.elpatron.me/elpatron/medi-customers.git
|
||||||
cd medi-customers
|
cd medi-customers
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Python-Abhängigkeiten installieren:
|
2. Erstellen Sie die erforderlichen Verzeichnisse:
|
||||||
```bash
|
```bash
|
||||||
pip install -r requirements.txt
|
mkdir -p data
|
||||||
```
|
```
|
||||||
|
|
||||||
3. CSV-Datei in das `data`-Verzeichnis kopieren:
|
3. Starten Sie die Anwendung mit Docker Compose:
|
||||||
```bash
|
```bash
|
||||||
mkdir data
|
docker-compose up --build
|
||||||
cp spezexpo.csv data/customers.csv
|
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Anwendung starten:
|
Die Anwendung ist dann unter `http://localhost:5000` erreichbar.
|
||||||
```bash
|
|
||||||
python app.py
|
|
||||||
```
|
|
||||||
|
|
||||||
Die Anwendung ist dann unter `http://localhost:5001` erreichbar.
|
## Entwicklung
|
||||||
|
|
||||||
|
Die Anwendung ist in Python mit Flask entwickelt und verwendet SQLite als Datenbank. Das Frontend wurde mit HTML, CSS und JavaScript implementiert.
|
||||||
|
|
||||||
|
## Lizenz
|
||||||
|
|
||||||
|
Alle Rechte vorbehalten. © 2024 medisoftware
|
||||||
|
|
||||||
|
## Konfiguration
|
||||||
|
|
||||||
|
Die Anwendung kann über folgende Umgebungsvariablen konfiguriert werden:
|
||||||
|
|
||||||
|
- `FLASK_APP`: Die Hauptanwendungsdatei (Standard: app.py)
|
||||||
|
- `FLASK_ENV`: Die Flask-Umgebung (development/production)
|
||||||
|
- `SECRET_KEY`: Der geheime Schlüssel für Flask-Sessions
|
||||||
|
- `DATABASE_URL`: Die URL zur SQLite-Datenbank
|
||||||
|
- `STATIC_PASSWORD`: Das Passwort für die Login-Seite
|
||||||
|
- `ALLOWED_IP_RANGES`: Komma-getrennte Liste von IP-Bereichen, die direkten Zugriff haben
|
||||||
|
- `LOG_LEVEL`: Das Logging-Level (INFO/DEBUG)
|
||||||
|
|
||||||
|
## IP-Bereiche
|
||||||
|
|
||||||
|
Die Anwendung unterstützt CIDR-Notation für IP-Bereiche. Beispiele:
|
||||||
|
- Einzelne IP: 192.168.1.1/32
|
||||||
|
- Subnetz: 192.168.1.0/24
|
||||||
|
- Größeres Netzwerk: 10.0.0.0/8
|
||||||
|
|
||||||
## API-Beispiele
|
## API-Beispiele
|
||||||
|
|
||||||
Die Such-API unterstützt folgende Parameter:
|
### Suche nach Name
|
||||||
|
|
||||||
### Spezifische Suche
|
|
||||||
```bash
|
```bash
|
||||||
# Nach Name suchen
|
curl "http://localhost:5001/search?name=Mustermann"
|
||||||
curl "http://localhost:5001/search?name=Schmidt"
|
```
|
||||||
|
|
||||||
# Nach Ort suchen
|
### Suche nach Ort
|
||||||
|
```bash
|
||||||
curl "http://localhost:5001/search?ort=Berlin"
|
curl "http://localhost:5001/search?ort=Berlin"
|
||||||
|
```
|
||||||
|
|
||||||
# Nach Kundennummer suchen
|
### Suche nach Kundennummer
|
||||||
|
```bash
|
||||||
curl "http://localhost:5001/search?kundennummer=12345"
|
curl "http://localhost:5001/search?kundennummer=12345"
|
||||||
|
```
|
||||||
|
|
||||||
# Nach Fachrichtung suchen
|
### Suche nach Fachrichtung
|
||||||
curl "http://localhost:5001/search?fachrichtung=Allgemeinmedizin"
|
```bash
|
||||||
|
curl "http://localhost:5001/search?fachrichtung=Zahnarzt"
|
||||||
|
```
|
||||||
|
|
||||||
# Nach Telefonnummer suchen
|
### Suche nach Telefon
|
||||||
|
```bash
|
||||||
curl "http://localhost:5001/search?telefon=030"
|
curl "http://localhost:5001/search?telefon=030"
|
||||||
|
|
||||||
# Kombinierte Suche
|
|
||||||
curl "http://localhost:5001/search?name=Schmidt&ort=Berlin&fachrichtung=Allgemeinmedizin"
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Allgemeine Suche
|
### Allgemeine Suche
|
||||||
```bash
|
```bash
|
||||||
# Suche in allen Feldern
|
curl "http://localhost:5001/search?q=Suchbegriff"
|
||||||
curl "http://localhost:5001/search?q=Schmidt"
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Beispiel-Response
|
### Kombinierte Suche
|
||||||
```json
|
```bash
|
||||||
[
|
# Suche nach Fachrichtung und Ort
|
||||||
{
|
curl "http://localhost:5001/search?fachrichtung=Zahnarzt&ort=Berlin"
|
||||||
"Vorname": "Max",
|
|
||||||
"Nachname": "Mustermann",
|
# Suche nach Name und Telefon
|
||||||
"Nummer": "12345",
|
curl "http://localhost:5001/search?name=Mustermann&telefon=030"
|
||||||
"Ort": "Berlin",
|
|
||||||
"Fachrichtung": "Allgemeinmedizin",
|
# Suche nach mehreren Kriterien
|
||||||
"Tel": "030123456",
|
curl "http://localhost:5001/search?fachrichtung=Zahnarzt&ort=Berlin&name=Schmidt"
|
||||||
"Email": "max@example.com"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Versionen
|
## Version
|
||||||
|
|
||||||
### v1.0.1
|
Aktuelle Version: [v1.2.4](CHANGELOG.md#v124---2024-03-19)
|
||||||
- Telefonnummer-Suchfeld hinzugefügt
|
|
||||||
- Reset-Icons für alle Suchfelder
|
|
||||||
- Verbesserte Positionierung der UI-Elemente
|
|
||||||
- Optimierte Suchlogik
|
|
||||||
- CSV-Datei in data-Verzeichnis verschoben
|
|
||||||
|
|
||||||
### v1.0.0
|
## Code-Statistiken
|
||||||
- Erste Version
|
|
||||||
- Grundlegende Suchfunktionalität
|
Language|files|blank|comment|code
|
||||||
- Klickbare Links für Telefon, E-Mail und Adressen
|
:-------|-------:|-------:|-------:|-------:
|
||||||
- Share-Funktion für Suchergebnisse
|
HTML|2|56|0|416
|
||||||
|
CSS|2|51|1|265
|
||||||
|
Markdown|2|66|0|236
|
||||||
|
Python|1|51|103|225
|
||||||
|
YAML|1|0|0|13
|
||||||
|
Dockerfile|1|8|9|11
|
||||||
|
Text|1|0|0|5
|
||||||
|
--------|--------|--------|--------|--------
|
||||||
|
SUM:|10|232|113|1171
|
||||||
|
|
||||||
|
## Lizenz
|
||||||
|
Alle Rechte vorbehalten. © 2025 medisoftware
|
478
app.py
478
app.py
@@ -1,121 +1,425 @@
|
|||||||
from flask import Flask, render_template, request, jsonify, url_for
|
from flask import Flask, render_template, request, jsonify, url_for, redirect, session
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
import requests
|
import sqlite3
|
||||||
from collections import defaultdict
|
from functools import wraps
|
||||||
|
from contextlib import contextmanager
|
||||||
|
import time
|
||||||
|
import threading
|
||||||
|
|
||||||
app = Flask(__name__, static_folder='static')
|
app = Flask(__name__, static_folder='static')
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
app.config['SECRET_KEY'] = os.environ.get('SECRET_KEY', 'dev')
|
||||||
|
app.config['ALLOWED_IP_RANGES'] = os.getenv('ALLOWED_IP_RANGES', '192.168.0.0/16,10.0.0.0/8').split(',')
|
||||||
|
app.config['VERSION'] = '1.2.17'
|
||||||
|
app.config['DATABASE'] = 'data/customers.db'
|
||||||
|
app.config['DATABASE_TIMEOUT'] = 20
|
||||||
|
app.config['DATABASE_POOL_SIZE'] = 5
|
||||||
|
|
||||||
|
logging.basicConfig(level=logging.INFO)
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
# Version der Anwendung
|
# Thread-lokaler Speicher für Datenbankverbindungen
|
||||||
VERSION = "1.0.4"
|
thread_local = threading.local()
|
||||||
|
|
||||||
# Pfad zur CSV-Datei
|
def get_db_connection():
|
||||||
CSV_FILE = "data/customers.csv"
|
"""Erstellt eine neue Datenbankverbindung für den aktuellen Thread"""
|
||||||
|
if not hasattr(thread_local, "connection"):
|
||||||
|
thread_local.connection = sqlite3.connect(app.config['DATABASE'], timeout=app.config['DATABASE_TIMEOUT'])
|
||||||
|
thread_local.connection.row_factory = sqlite3.Row
|
||||||
|
return thread_local.connection
|
||||||
|
|
||||||
# Lade Umgebungsvariablen
|
@contextmanager
|
||||||
load_dotenv()
|
def get_db():
|
||||||
|
"""Context Manager für Datenbankverbindungen"""
|
||||||
def clean_dataframe(df):
|
conn = get_db_connection()
|
||||||
"""Konvertiert NaN-Werte in None für JSON-Kompatibilität"""
|
|
||||||
return df.replace({np.nan: None})
|
|
||||||
|
|
||||||
# CSV-Datei laden
|
|
||||||
def load_data():
|
|
||||||
try:
|
try:
|
||||||
logger.info("Versuche CSV-Datei zu laden...")
|
yield conn
|
||||||
if not os.path.exists(CSV_FILE):
|
except Exception:
|
||||||
logger.error(f"CSV-Datei '{CSV_FILE}' nicht gefunden!")
|
conn.rollback()
|
||||||
return None
|
raise
|
||||||
|
finally:
|
||||||
|
conn.commit()
|
||||||
|
|
||||||
|
def init_db():
|
||||||
|
"""Initialisiert die SQLite-Datenbank mit der notwendigen Tabelle."""
|
||||||
|
with get_db() as conn:
|
||||||
|
c = conn.cursor()
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Erstelle die Kunden-Tabelle
|
||||||
|
c.execute('''
|
||||||
|
CREATE TABLE IF NOT EXISTS customers (
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
nummer TEXT,
|
||||||
|
name TEXT,
|
||||||
|
strasse TEXT,
|
||||||
|
plz TEXT,
|
||||||
|
ort TEXT,
|
||||||
|
telefon TEXT,
|
||||||
|
mobil TEXT,
|
||||||
|
email TEXT,
|
||||||
|
bemerkung TEXT,
|
||||||
|
fachrichtung TEXT,
|
||||||
|
tag TEXT,
|
||||||
|
handy TEXT,
|
||||||
|
tele_firma TEXT,
|
||||||
|
kontakt1 TEXT,
|
||||||
|
kontakt2 TEXT,
|
||||||
|
kontakt3 TEXT
|
||||||
|
)
|
||||||
|
''')
|
||||||
|
|
||||||
# Lade CSV mit Komma als Trennzeichen
|
# Optimierte Indizes für die häufigsten Suchanfragen
|
||||||
df = pd.read_csv(CSV_FILE, sep=',', encoding='utf-8', quotechar='"')
|
c.execute('CREATE INDEX IF NOT EXISTS idx_customers_name_ort ON customers(name, ort)')
|
||||||
# Entferne Anführungszeichen aus den Spaltennamen
|
c.execute('CREATE INDEX IF NOT EXISTS idx_customers_fachrichtung ON customers(fachrichtung)')
|
||||||
df.columns = df.columns.str.strip('"')
|
c.execute('CREATE INDEX IF NOT EXISTS idx_customers_tag ON customers(tag)')
|
||||||
# Entferne Anführungszeichen aus den Werten
|
c.execute('CREATE INDEX IF NOT EXISTS idx_customers_plz ON customers(plz)')
|
||||||
for col in df.columns:
|
|
||||||
if df[col].dtype == 'object':
|
# Zusammengesetzter Index für die häufigste Suchkombination
|
||||||
df[col] = df[col].str.strip('"')
|
c.execute('CREATE INDEX IF NOT EXISTS idx_customers_search ON customers(name, ort, fachrichtung, tag)')
|
||||||
df = clean_dataframe(df)
|
|
||||||
logger.info(f"CSV-Datei erfolgreich geladen. {len(df)} Einträge gefunden.")
|
logger.info('Datenbank initialisiert')
|
||||||
return df
|
except Exception as e:
|
||||||
|
logger.error(f'Fehler bei der Datenbankinitialisierung: {str(e)}')
|
||||||
|
raise
|
||||||
|
|
||||||
|
def isIPInSubnet(ip, subnet):
|
||||||
|
"""Überprüft, ob eine IP-Adresse in einem Subnetz liegt."""
|
||||||
|
try:
|
||||||
|
# Teile die IP und das Subnetz in ihre Komponenten
|
||||||
|
subnet_ip, bits = subnet.split('/')
|
||||||
|
ip_parts = [int(x) for x in ip.split('.')]
|
||||||
|
subnet_parts = [int(x) for x in subnet_ip.split('.')]
|
||||||
|
|
||||||
|
# Konvertiere IPs in 32-bit Zahlen
|
||||||
|
ip_num = (ip_parts[0] << 24) | (ip_parts[1] << 16) | (ip_parts[2] << 8) | ip_parts[3]
|
||||||
|
subnet_num = (subnet_parts[0] << 24) | (subnet_parts[1] << 16) | (subnet_parts[2] << 8) | subnet_parts[3]
|
||||||
|
|
||||||
|
# Erstelle die Subnetzmaske
|
||||||
|
mask = ~((1 << (32 - int(bits))) - 1)
|
||||||
|
|
||||||
|
# Prüfe, ob die IP im Subnetz liegt
|
||||||
|
return (ip_num & mask) == (subnet_num & mask)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Fehler beim Laden der CSV-Datei: {str(e)}")
|
logger.error(f"Fehler bei der IP-Überprüfung: {str(e)}")
|
||||||
return None
|
return False
|
||||||
|
|
||||||
|
def import_csv():
|
||||||
|
"""Importiert die CSV-Datei in die Datenbank"""
|
||||||
|
try:
|
||||||
|
with get_db() as conn:
|
||||||
|
c = conn.cursor()
|
||||||
|
|
||||||
|
# Lösche bestehende Daten
|
||||||
|
c.execute('DELETE FROM customers')
|
||||||
|
|
||||||
|
# Importiere MEDISOFT-Daten
|
||||||
|
if os.path.exists('data/customers.csv'):
|
||||||
|
logger.info("Importiere MEDISOFT-Daten...")
|
||||||
|
df = pd.read_csv('data/customers.csv', encoding='iso-8859-1')
|
||||||
|
df.columns = df.columns.str.strip().str.replace('"', '')
|
||||||
|
df = df.apply(lambda x: x.str.strip().str.replace('"', '') if x.dtype == "object" else x)
|
||||||
|
|
||||||
|
# Filtere Datensätze mit Fachrichtung "intern"
|
||||||
|
df = df[df['Fachrichtung'].str.lower() != 'intern']
|
||||||
|
|
||||||
|
# Bereite die Daten für den Batch-Insert vor
|
||||||
|
data = [(
|
||||||
|
row['VorNachname'], row['Nummer'], row['Strasse'], row['PLZ'], row['Ort'],
|
||||||
|
row['Tel'], row['Tel'], row['mail'], row['Fachrichtung'], 'medisoft',
|
||||||
|
row['Handy'], row['Tele Firma'], row['Kontakt1'], row['Kontakt2'], row['Kontakt3']
|
||||||
|
) for _, row in df.iterrows()]
|
||||||
|
|
||||||
|
# Führe Batch-Insert durch
|
||||||
|
c.executemany('''
|
||||||
|
INSERT INTO customers (
|
||||||
|
name, nummer, strasse, plz, ort, telefon, mobil, email,
|
||||||
|
fachrichtung, tag, handy, tele_firma, kontakt1, kontakt2, kontakt3
|
||||||
|
)
|
||||||
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||||
|
''', data)
|
||||||
|
else:
|
||||||
|
logger.warning("MEDISOFT CSV-Datei nicht gefunden")
|
||||||
|
|
||||||
|
# Importiere MEDICONSULT-Daten
|
||||||
|
if os.path.exists('data/customers_snk.csv'):
|
||||||
|
logger.info("Importiere MEDICONSULT-Daten...")
|
||||||
|
df_snk = pd.read_csv('data/customers_snk.csv', encoding='iso-8859-1')
|
||||||
|
df_snk.columns = df_snk.columns.str.strip().str.replace('"', '')
|
||||||
|
df_snk = df_snk.apply(lambda x: x.str.strip().str.replace('"', '') if x.dtype == "object" else x)
|
||||||
|
|
||||||
|
# Filtere Datensätze mit Fachrichtung "intern"
|
||||||
|
df_snk = df_snk[df_snk['Fachrichtung'].str.lower() != 'intern']
|
||||||
|
|
||||||
|
# Bereite die Daten für den Batch-Insert vor
|
||||||
|
data = [(
|
||||||
|
row['VorNachname'], row['Nummer'], row['Strasse'], row['PLZ'], row['Ort'],
|
||||||
|
row['Tel'], row['Tel'], row['mail'], row['Fachrichtung'], 'mediconsult',
|
||||||
|
row['Handy'], row['Tele Firma'], row['Kontakt1'], row['Kontakt2'], row['Kontakt3']
|
||||||
|
) for _, row in df_snk.iterrows()]
|
||||||
|
|
||||||
|
# Führe Batch-Insert durch
|
||||||
|
c.executemany('''
|
||||||
|
INSERT INTO customers (
|
||||||
|
name, nummer, strasse, plz, ort, telefon, mobil, email,
|
||||||
|
fachrichtung, tag, handy, tele_firma, kontakt1, kontakt2, kontakt3
|
||||||
|
)
|
||||||
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||||
|
''', data)
|
||||||
|
else:
|
||||||
|
logger.warning("MEDICONSULT CSV-Datei nicht gefunden")
|
||||||
|
|
||||||
|
logger.info("CSV-Daten erfolgreich in die Datenbank importiert")
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Fehler beim Importieren der CSV-Datei: {str(e)}")
|
||||||
|
raise
|
||||||
|
|
||||||
|
@app.route('/login', methods=['GET', 'POST'])
|
||||||
|
def login():
|
||||||
|
# Überprüfe, ob die Client-IP in einem der erlaubten Bereiche liegt
|
||||||
|
client_ip = request.headers.get('X-Forwarded-For', request.remote_addr)
|
||||||
|
|
||||||
|
# Überprüfe, ob die Client-IP in einem der erlaubten Bereichen liegt
|
||||||
|
is_allowed = any(isIPInSubnet(client_ip, range.strip()) for range in app.config['ALLOWED_IP_RANGES'] if range.strip())
|
||||||
|
|
||||||
|
if is_allowed:
|
||||||
|
logger.info(f"Client-IP {client_ip} ist in einem erlaubten Bereich, automatischer Login")
|
||||||
|
session['logged_in'] = True
|
||||||
|
return redirect(url_for('index'))
|
||||||
|
|
||||||
|
if request.method == 'POST':
|
||||||
|
password = request.form.get('password')
|
||||||
|
if password == STATIC_PASSWORD:
|
||||||
|
session['logged_in'] = True
|
||||||
|
logger.info("Erfolgreicher Login")
|
||||||
|
return redirect(url_for('index'))
|
||||||
|
else:
|
||||||
|
logger.warning("Falsches Passwort eingegeben")
|
||||||
|
return render_template('login.html', error="Falsches Passwort")
|
||||||
|
|
||||||
|
logger.info("Zeige Login-Seite")
|
||||||
|
return render_template('login.html')
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def index():
|
def index():
|
||||||
return render_template('index.html')
|
logger.info(f"Index-Route aufgerufen. Session Status: {session}")
|
||||||
|
if not session.get('logged_in'):
|
||||||
|
logger.info("Benutzer nicht eingeloggt, Weiterleitung zum Login")
|
||||||
|
return redirect(url_for('login'))
|
||||||
|
|
||||||
|
client_ip = request.headers.get('X-Forwarded-For', request.remote_addr)
|
||||||
|
logger.info(f"Client-IP: {client_ip}")
|
||||||
|
logger.info(f"Erlaubte IP-Bereiche: {app.config['ALLOWED_IP_RANGES']}")
|
||||||
|
return render_template('index.html', allowed_ip_ranges=','.join(app.config['ALLOWED_IP_RANGES']), version=app.config['VERSION'])
|
||||||
|
|
||||||
@app.route('/search')
|
@app.route('/search', methods=['GET', 'POST'])
|
||||||
def search():
|
def search():
|
||||||
|
if not session.get('logged_in'):
|
||||||
|
return jsonify({'error': 'Nicht eingeloggt'}), 401
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# CSV-Datei laden
|
if request.method == 'POST':
|
||||||
df = load_data()
|
data = request.get_json()
|
||||||
if df is None:
|
search_query = data.get('query', '')
|
||||||
return jsonify({"error": "Datenbank konnte nicht geladen werden"}), 500
|
tag = data.get('tag', 'medisoft')
|
||||||
|
|
||||||
# Suchparameter aus der URL holen
|
|
||||||
name = request.args.get('name', '').strip()
|
|
||||||
ort = request.args.get('ort', '').strip()
|
|
||||||
kundennummer = request.args.get('kundennummer', '').strip()
|
|
||||||
fachrichtung = request.args.get('fachrichtung', '').strip()
|
|
||||||
telefon = request.args.get('telefon', '').strip()
|
|
||||||
query = request.args.get('q', '').strip()
|
|
||||||
|
|
||||||
# Wenn keine spezifischen Suchkriterien angegeben sind, aber eine allgemeine Suche
|
|
||||||
if not any([name, ort, kundennummer, fachrichtung, telefon]) and query:
|
|
||||||
# Suche in allen relevanten Feldern
|
|
||||||
mask = (
|
|
||||||
df['Vorname'].str.contains(query, case=False, na=False) |
|
|
||||||
df['Nachname'].str.contains(query, case=False, na=False) |
|
|
||||||
df['Ort'].str.contains(query, case=False, na=False) |
|
|
||||||
df['Nummer'].astype(str).str.contains(query, case=False, na=False) |
|
|
||||||
df['Fachrichtung'].str.contains(query, case=False, na=False) |
|
|
||||||
df['Tel'].astype(str).str.contains(query, case=False, na=False)
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
# Spezifische Suche
|
search_query = request.args.get('q', '')
|
||||||
mask = pd.Series(True, index=df.index)
|
name = request.args.get('name', '')
|
||||||
|
ort = request.args.get('ort', '')
|
||||||
|
nummer = request.args.get('nummer', '')
|
||||||
|
plz = request.args.get('plz', '')
|
||||||
|
fachrichtung = request.args.get('fachrichtung', '')
|
||||||
|
tag = request.args.get('tag', 'medisoft')
|
||||||
|
|
||||||
|
with get_db() as conn:
|
||||||
|
c = conn.cursor()
|
||||||
|
|
||||||
|
# Baue die SQL-Abfrage
|
||||||
|
sql_query = '''
|
||||||
|
SELECT
|
||||||
|
nummer,
|
||||||
|
name,
|
||||||
|
strasse,
|
||||||
|
plz,
|
||||||
|
ort,
|
||||||
|
telefon,
|
||||||
|
mobil,
|
||||||
|
email,
|
||||||
|
fachrichtung,
|
||||||
|
tag,
|
||||||
|
handy,
|
||||||
|
tele_firma,
|
||||||
|
kontakt1,
|
||||||
|
kontakt2,
|
||||||
|
kontakt3
|
||||||
|
FROM customers
|
||||||
|
WHERE 1=1
|
||||||
|
'''
|
||||||
|
params = []
|
||||||
|
|
||||||
|
# Füge die Suchbedingungen hinzu
|
||||||
|
if search_query:
|
||||||
|
# Optimierte Suche mit FTS (Full Text Search)
|
||||||
|
sql_query += """
|
||||||
|
AND (
|
||||||
|
name LIKE ? OR
|
||||||
|
nummer LIKE ? OR
|
||||||
|
fachrichtung LIKE ? OR
|
||||||
|
ort LIKE ? OR
|
||||||
|
plz LIKE ? OR
|
||||||
|
strasse LIKE ? OR
|
||||||
|
telefon LIKE ? OR
|
||||||
|
mobil LIKE ? OR
|
||||||
|
email LIKE ? OR
|
||||||
|
bemerkung LIKE ? OR
|
||||||
|
tag LIKE ? OR
|
||||||
|
handy LIKE ? OR
|
||||||
|
tele_firma LIKE ? OR
|
||||||
|
kontakt1 LIKE ? OR
|
||||||
|
kontakt2 LIKE ? OR
|
||||||
|
kontakt3 LIKE ?
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
search_term = f"%{search_query}%"
|
||||||
|
params.extend([search_term] * 16) # 16 Felder für die allgemeine Suche
|
||||||
|
|
||||||
if name:
|
if name:
|
||||||
name_mask = (
|
sql_query += " AND name LIKE ?"
|
||||||
df['Vorname'].str.contains(name, case=False, na=False) |
|
params.append(f"%{name}%")
|
||||||
df['Nachname'].str.contains(name, case=False, na=False)
|
|
||||||
)
|
|
||||||
mask &= name_mask
|
|
||||||
|
|
||||||
if ort:
|
if ort:
|
||||||
ort_mask = df['Ort'].str.contains(ort, case=False, na=False)
|
sql_query += " AND ort LIKE ?"
|
||||||
mask &= ort_mask
|
params.append(f"%{ort}%")
|
||||||
|
|
||||||
if kundennummer:
|
if nummer:
|
||||||
kundennummer_mask = df['Nummer'].astype(str).str.contains(kundennummer, case=False, na=False)
|
sql_query += " AND nummer LIKE ?"
|
||||||
mask &= kundennummer_mask
|
params.append(f"%{nummer}%")
|
||||||
|
|
||||||
|
if plz:
|
||||||
|
sql_query += " AND plz LIKE ?"
|
||||||
|
params.append(f"%{plz}%")
|
||||||
|
|
||||||
if fachrichtung:
|
if fachrichtung:
|
||||||
fachrichtung_mask = df['Fachrichtung'].str.contains(fachrichtung, case=False, na=False)
|
sql_query += " AND fachrichtung LIKE ?"
|
||||||
mask &= fachrichtung_mask
|
params.append(f"%{fachrichtung}%")
|
||||||
|
|
||||||
if telefon:
|
# Filter nach Tag
|
||||||
telefon_mask = df['Tel'].astype(str).str.contains(telefon, case=False, na=False)
|
if tag != 'all':
|
||||||
mask &= telefon_mask
|
sql_query += " AND tag = ?"
|
||||||
|
params.append(tag)
|
||||||
results = df[mask].to_dict('records')
|
|
||||||
logger.info(f"{len(results)} Ergebnisse gefunden")
|
# Füge LIMIT hinzu und optimiere die Sortierung
|
||||||
|
sql_query += " ORDER BY name LIMIT 100"
|
||||||
return jsonify({
|
|
||||||
'results': results,
|
# Führe die Abfrage aus
|
||||||
'total': len(results)
|
c.execute(sql_query, params)
|
||||||
})
|
results = c.fetchall()
|
||||||
|
|
||||||
|
formatted_results = []
|
||||||
|
for row in results:
|
||||||
|
customer = {
|
||||||
|
'nummer': row[0],
|
||||||
|
'name': row[1],
|
||||||
|
'strasse': row[2],
|
||||||
|
'plz': row[3],
|
||||||
|
'ort': row[4],
|
||||||
|
'telefon': row[5],
|
||||||
|
'mobil': row[6],
|
||||||
|
'email': row[7],
|
||||||
|
'fachrichtung': row[8],
|
||||||
|
'tag': row[9],
|
||||||
|
'handy': row[10],
|
||||||
|
'tele_firma': row[11],
|
||||||
|
'kontakt1': row[12],
|
||||||
|
'kontakt2': row[13],
|
||||||
|
'kontakt3': row[14]
|
||||||
|
}
|
||||||
|
formatted_results.append(customer)
|
||||||
|
|
||||||
|
return jsonify(formatted_results)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Fehler bei der Suche: {str(e)}")
|
logger.error(f"Fehler bei der Suche: {str(e)}")
|
||||||
return jsonify({"error": str(e)}), 500
|
return jsonify({'error': str(e)}), 500
|
||||||
|
|
||||||
|
@app.route('/api/fachrichtungen')
|
||||||
|
def get_fachrichtungen():
|
||||||
|
try:
|
||||||
|
search_term = request.args.get('q', '').lower()
|
||||||
|
with get_db() as conn:
|
||||||
|
c = conn.cursor()
|
||||||
|
|
||||||
|
# Hole alle eindeutigen Fachrichtungen, die mit dem Suchbegriff übereinstimmen
|
||||||
|
c.execute('''
|
||||||
|
SELECT DISTINCT fachrichtung
|
||||||
|
FROM customers
|
||||||
|
WHERE fachrichtung IS NOT NULL
|
||||||
|
AND fachrichtung != ''
|
||||||
|
AND LOWER(fachrichtung) LIKE ?
|
||||||
|
ORDER BY fachrichtung
|
||||||
|
LIMIT 10
|
||||||
|
''', (f'%{search_term}%',))
|
||||||
|
|
||||||
|
fachrichtungen = [row[0] for row in c.fetchall()]
|
||||||
|
return jsonify(fachrichtungen)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Fehler beim Abrufen der Fachrichtungen: {str(e)}")
|
||||||
|
return jsonify([])
|
||||||
|
|
||||||
|
@app.route('/api/orte')
|
||||||
|
def get_orte():
|
||||||
|
try:
|
||||||
|
search_term = request.args.get('q', '').lower()
|
||||||
|
with get_db() as conn:
|
||||||
|
c = conn.cursor()
|
||||||
|
|
||||||
|
# Hole alle eindeutigen Orte, die mit dem Suchbegriff übereinstimmen
|
||||||
|
c.execute('''
|
||||||
|
SELECT DISTINCT ort
|
||||||
|
FROM customers
|
||||||
|
WHERE ort IS NOT NULL
|
||||||
|
AND ort != ''
|
||||||
|
AND LOWER(ort) LIKE ?
|
||||||
|
ORDER BY ort
|
||||||
|
LIMIT 10
|
||||||
|
''', (f'%{search_term}%',))
|
||||||
|
|
||||||
|
orte = [row[0] for row in c.fetchall()]
|
||||||
|
return jsonify(orte)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Fehler beim Abrufen der Orte: {str(e)}")
|
||||||
|
return jsonify([])
|
||||||
|
|
||||||
|
def init_app(app):
|
||||||
|
"""Initialisiert die Anwendung mit allen notwendigen Einstellungen."""
|
||||||
|
with app.app_context():
|
||||||
|
try:
|
||||||
|
# Stelle sicher, dass der data-Ordner existiert
|
||||||
|
os.makedirs('data', exist_ok=True)
|
||||||
|
|
||||||
|
# Lösche die alte Datenbank, falls sie existiert
|
||||||
|
if os.path.exists(app.config['DATABASE']):
|
||||||
|
try:
|
||||||
|
os.remove(app.config['DATABASE'])
|
||||||
|
logger.info(f"Alte Datenbank {app.config['DATABASE']} wurde gelöscht")
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Fehler beim Löschen der alten Datenbank: {str(e)}")
|
||||||
|
|
||||||
|
# Initialisiere die Datenbank
|
||||||
|
init_db()
|
||||||
|
# Importiere die CSV-Daten
|
||||||
|
import_csv()
|
||||||
|
logger.info("Anwendung erfolgreich initialisiert")
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Fehler bei der Initialisierung: {str(e)}")
|
||||||
|
raise
|
||||||
|
|
||||||
|
# Initialisiere die App
|
||||||
|
init_app(app)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(debug=True, port=5001)
|
app.run(debug=True, port=5001)
|
1172
data/customers.csv
1172
data/customers.csv
File diff suppressed because it is too large
Load Diff
@@ -1,14 +0,0 @@
|
|||||||
version: '3.8'
|
|
||||||
|
|
||||||
services:
|
|
||||||
web:
|
|
||||||
build: .
|
|
||||||
ports:
|
|
||||||
- "5001:5000"
|
|
||||||
volumes:
|
|
||||||
- .:/app
|
|
||||||
environment:
|
|
||||||
- FLASK_APP=app.py
|
|
||||||
- FLASK_ENV=development
|
|
||||||
- FLASK_DEBUG=1
|
|
||||||
command: flask run --host=0.0.0.0
|
|
13
docker-compose.yml.example
Normal file
13
docker-compose.yml.example
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
services:
|
||||||
|
web:
|
||||||
|
build: .
|
||||||
|
ports:
|
||||||
|
- "5001:5000"
|
||||||
|
volumes:
|
||||||
|
- ./data:/app/data
|
||||||
|
environment:
|
||||||
|
- FLASK_APP=app.py
|
||||||
|
- FLASK_ENV=production
|
||||||
|
- LOGIN_PASSWORD=changeme
|
||||||
|
- ALLOWED_IP_RANGES=213.178.68.218/29,192.168.0.0/24,192.168.177.0/24
|
||||||
|
command: flask run --host=0.0.0.0
|
387
static/css/styles.css
Normal file
387
static/css/styles.css
Normal file
@@ -0,0 +1,387 @@
|
|||||||
|
body {
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-content {
|
||||||
|
flex: 1 0 auto;
|
||||||
|
padding: 2rem 0;
|
||||||
|
margin-bottom: 4rem; /* Platz für die fixierte Fußzeile */
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-container {
|
||||||
|
max-width: 800px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-card {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-card:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading {
|
||||||
|
display: none;
|
||||||
|
text-align: center;
|
||||||
|
margin: 2rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phone-link, .email-link, .address-link, .customer-link {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #0d6efd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phone-link:hover, .email-link:hover, .address-link:hover, .customer-link:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-icon, .reset-icon {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
color: #6c757d;
|
||||||
|
cursor: pointer;
|
||||||
|
display: none;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reset-icon {
|
||||||
|
right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-icon {
|
||||||
|
right: 35px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reset-icon.visible {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-icon.visible {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customer-number {
|
||||||
|
color: #6c757d;
|
||||||
|
font-size: 0.9em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
flex-shrink: 0;
|
||||||
|
text-align: center;
|
||||||
|
padding: 1rem;
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
border-top: 1px solid #dee2e6;
|
||||||
|
width: 100%;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
.share-feedback {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 20px;
|
||||||
|
right: 20px;
|
||||||
|
background: #28a745;
|
||||||
|
color: white;
|
||||||
|
padding: 8px 16px;
|
||||||
|
border-radius: 4px;
|
||||||
|
display: none;
|
||||||
|
animation: fadeOut 2s forwards;
|
||||||
|
z-index: 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fadeOut {
|
||||||
|
0% { opacity: 1; }
|
||||||
|
70% { opacity: 1; }
|
||||||
|
100% { opacity: 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-top: 1rem;
|
||||||
|
padding-top: 1rem;
|
||||||
|
border-top: 1px solid #e9ecef;
|
||||||
|
}
|
||||||
|
|
||||||
|
.share-button {
|
||||||
|
padding: 0.5rem 1rem;
|
||||||
|
border-radius: 20px;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
background-color: #0d6efd;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.share-button:hover {
|
||||||
|
background-color: #0b5ed7;
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.share-button i {
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-fields {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||||
|
gap: 1rem;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-field {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-group {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reset-icon {
|
||||||
|
position: absolute;
|
||||||
|
right: 40px;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
cursor: pointer;
|
||||||
|
color: #6c757d;
|
||||||
|
z-index: 10;
|
||||||
|
padding: 0.375rem;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-group input:not(:placeholder-shown) + .reset-icon {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reset-icon:hover {
|
||||||
|
color: #dc3545;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-icon {
|
||||||
|
position: absolute;
|
||||||
|
right: 10px;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
color: #6c757d;
|
||||||
|
z-index: 10;
|
||||||
|
padding: 0.375rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-counts {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
padding: 0.5rem;
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-count {
|
||||||
|
background-color: #e9ecef;
|
||||||
|
padding: 4px 12px;
|
||||||
|
border-radius: 12px;
|
||||||
|
font-size: 0.9em;
|
||||||
|
color: #6c757d;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-count.visible {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.location-pin {
|
||||||
|
color: #dc3545;
|
||||||
|
margin-left: 4px;
|
||||||
|
font-size: 1.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customer-card {
|
||||||
|
background: white;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customer-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: flex-start;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customer-name {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customer-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customer-details {
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customer-details p {
|
||||||
|
margin: 0.25rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customer-details strong {
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phone-link, .email-link, .customer-link {
|
||||||
|
color: #007bff;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phone-link:hover, .email-link:hover, .customer-link:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-text {
|
||||||
|
margin-right: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-link, .route-link {
|
||||||
|
color: #6c757d;
|
||||||
|
text-decoration: none;
|
||||||
|
margin-left: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-link:hover, .route-link:hover {
|
||||||
|
color: #343a40;
|
||||||
|
}
|
||||||
|
|
||||||
|
.location-pin, .route-pin {
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge {
|
||||||
|
font-size: 0.8rem;
|
||||||
|
padding: 0.35em 0.65em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-sm {
|
||||||
|
padding: 0.25rem 0.5rem;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer-content {
|
||||||
|
padding: 1rem;
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
border-top: 1px solid #dee2e6;
|
||||||
|
width: 100%;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer-link {
|
||||||
|
color: #0d6efd;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer-link:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.general-search {
|
||||||
|
max-width: 800px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.general-search .input-group {
|
||||||
|
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.general-search .form-control {
|
||||||
|
height: 3.5rem;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
padding: 0.75rem 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.general-search .search-icon,
|
||||||
|
.general-search .reset-icon {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
padding: 0 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-options {
|
||||||
|
font-size: 0.9em;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-options .form-check {
|
||||||
|
margin-right: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-options .form-check-input {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-options .form-check-label {
|
||||||
|
cursor: pointer;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-tag {
|
||||||
|
padding: 4px 8px;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 0.9em;
|
||||||
|
font-weight: 500;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-medisoft {
|
||||||
|
background-color: #1976d2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-mediconsult {
|
||||||
|
background-color: #ff9800;
|
||||||
|
}
|
||||||
|
|
||||||
|
.autocomplete-items {
|
||||||
|
position: absolute;
|
||||||
|
border: 1px solid #d4d4d4;
|
||||||
|
border-top: none;
|
||||||
|
z-index: 99;
|
||||||
|
top: 100%;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
background-color: white;
|
||||||
|
max-height: 200px;
|
||||||
|
overflow-y: auto;
|
||||||
|
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.autocomplete-items div {
|
||||||
|
padding: 8px 12px;
|
||||||
|
cursor: pointer;
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.autocomplete-items div:hover {
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
}
|
512
static/js/main.js
Normal file
512
static/js/main.js
Normal file
@@ -0,0 +1,512 @@
|
|||||||
|
let searchTimeout;
|
||||||
|
let lastResults = [];
|
||||||
|
let fachrichtungTimeout;
|
||||||
|
let ortTimeout;
|
||||||
|
let currentPage = 1;
|
||||||
|
let totalPages = 1;
|
||||||
|
let currentResults = [];
|
||||||
|
let currentSearchQuery = '';
|
||||||
|
let currentFilters = {
|
||||||
|
fachrichtung: '',
|
||||||
|
plz: '',
|
||||||
|
ort: ''
|
||||||
|
};
|
||||||
|
|
||||||
|
function createPhoneLink(phone) {
|
||||||
|
if (!phone) return '';
|
||||||
|
|
||||||
|
const clientIP = document.querySelector('meta[name="client-ip"]').content;
|
||||||
|
const allowedIPRanges = document.querySelector('meta[name="allowed-ip-ranges"]').content.split(',');
|
||||||
|
|
||||||
|
// Überprüfen, ob die Client-IP in einem der erlaubten Bereiche liegt
|
||||||
|
const isAllowed = allowedIPRanges.some(range => isIPInSubnet(clientIP, range.trim()));
|
||||||
|
|
||||||
|
// Entferne alle nicht-numerischen Zeichen
|
||||||
|
let cleanNumber = phone.replace(/\D/g, '');
|
||||||
|
|
||||||
|
// Formatiere die Nummer
|
||||||
|
let formattedNumber = cleanNumber;
|
||||||
|
if (cleanNumber.length === 11) {
|
||||||
|
formattedNumber = cleanNumber.replace(/(\d{4})(\d{7})/, '$1-$2');
|
||||||
|
} else if (cleanNumber.length === 10) {
|
||||||
|
formattedNumber = cleanNumber.replace(/(\d{3})(\d{7})/, '$1-$2');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Erstelle den Link
|
||||||
|
return `<a href="tel:${cleanNumber}" class="phone-link">${formattedNumber}</a>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createEmailLink(email) {
|
||||||
|
if (!email) return '';
|
||||||
|
return `<a href="mailto:${email}" class="email-link">${email}</a>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function highlightText(text, searchTerm) {
|
||||||
|
if (!searchTerm || !text) return text;
|
||||||
|
|
||||||
|
// Teile den Suchbegriff in einzelne Wörter
|
||||||
|
const searchWords = searchTerm.split(/\s+/).filter(word => word.length > 0);
|
||||||
|
|
||||||
|
// Wenn keine Wörter gefunden wurden, gebe den ursprünglichen Text zurück
|
||||||
|
if (searchWords.length === 0) return text;
|
||||||
|
|
||||||
|
// Erstelle einen regulären Ausdruck für alle Suchwörter
|
||||||
|
const regexPattern = searchWords
|
||||||
|
.map(word => word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
|
||||||
|
.join('|');
|
||||||
|
|
||||||
|
// Erstelle den regulären Ausdruck
|
||||||
|
const regex = new RegExp(`(${regexPattern})`, 'gi');
|
||||||
|
|
||||||
|
// Ersetze alle Übereinstimmungen mit mark-Tags
|
||||||
|
return text.replace(regex, '<mark>$1</mark>');
|
||||||
|
}
|
||||||
|
|
||||||
|
function createAddressLink(street, plz, city) {
|
||||||
|
if (!street || !plz || !city) return '';
|
||||||
|
const address = `${street}, ${plz} ${city}`;
|
||||||
|
const searchQuery = encodeURIComponent(address);
|
||||||
|
const routeQuery = encodeURIComponent(address);
|
||||||
|
return `<span class="address-text">${address}</span>
|
||||||
|
<a href="https://www.google.com/maps/search/?api=1&query=${searchQuery}"
|
||||||
|
class="address-link" target="_blank" rel="noopener noreferrer">
|
||||||
|
<i class="fa-solid fa-location-dot location-pin"></i>
|
||||||
|
</a>
|
||||||
|
<a href="https://www.google.com/maps/dir/?api=1&destination=${routeQuery}"
|
||||||
|
class="route-link" target="_blank" rel="noopener noreferrer">
|
||||||
|
<i class="fa-solid fa-route route-pin"></i>
|
||||||
|
</a>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function adjustCustomerNumber(number) {
|
||||||
|
return number - 12000;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isIPInSubnet(ip, subnet) {
|
||||||
|
// Teile die IP und das Subnetz in ihre Komponenten
|
||||||
|
const [subnetIP, bits] = subnet.split('/');
|
||||||
|
const ipParts = ip.split('.').map(Number);
|
||||||
|
const subnetParts = subnetIP.split('.').map(Number);
|
||||||
|
|
||||||
|
// Konvertiere IPs in 32-bit Zahlen
|
||||||
|
const ipNum = (ipParts[0] << 24) | (ipParts[1] << 16) | (ipParts[2] << 8) | ipParts[3];
|
||||||
|
const subnetNum = (subnetParts[0] << 24) | (subnetParts[1] << 16) | (subnetParts[2] << 8) | subnetParts[3];
|
||||||
|
|
||||||
|
// Erstelle die Subnetzmaske
|
||||||
|
const mask = ~((1 << (32 - bits)) - 1);
|
||||||
|
|
||||||
|
// Prüfe, ob die IP im Subnetz liegt
|
||||||
|
return (ipNum & mask) === (subnetNum & mask);
|
||||||
|
}
|
||||||
|
|
||||||
|
function createCustomerLink(nummer) {
|
||||||
|
const clientIP = document.querySelector('meta[name="client-ip"]').content;
|
||||||
|
const allowedIPRanges = document.querySelector('meta[name="allowed-ip-ranges"]').content.split(',');
|
||||||
|
|
||||||
|
// Überprüfe, ob die Client-IP in einem der erlaubten Bereiche liegt
|
||||||
|
const isAllowed = allowedIPRanges.some(range => {
|
||||||
|
const trimmedRange = range.trim();
|
||||||
|
return isIPInSubnet(clientIP, trimmedRange);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (isAllowed) {
|
||||||
|
const adjustedNumber = adjustCustomerNumber(nummer);
|
||||||
|
return `<a href="medisw:openkkbefe/P${adjustedNumber}?NetGrp=4" class="customer-link">${nummer}</a>`;
|
||||||
|
} else {
|
||||||
|
return nummer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function showCopyFeedback() {
|
||||||
|
const feedback = document.getElementById('shareFeedback');
|
||||||
|
feedback.style.display = 'block';
|
||||||
|
feedback.style.opacity = '1';
|
||||||
|
|
||||||
|
feedback.addEventListener('animationend', () => {
|
||||||
|
feedback.style.display = 'none';
|
||||||
|
}, { once: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
async function copyCustomerLink(customerNumber) {
|
||||||
|
const url = new URL(window.location.href);
|
||||||
|
url.searchParams.set('kundennummer', customerNumber);
|
||||||
|
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(url.toString());
|
||||||
|
showCopyFeedback();
|
||||||
|
} catch (err) {
|
||||||
|
// Fehlerbehandlung ohne console.log
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateResultCounts() {
|
||||||
|
const resultCount = document.getElementById('result-count');
|
||||||
|
const exportButton = document.getElementById('exportButton');
|
||||||
|
|
||||||
|
if (lastResults && lastResults.length > 0) {
|
||||||
|
resultCount.textContent = `${lastResults.length} Ergebnisse gefunden`;
|
||||||
|
resultCount.style.display = 'inline';
|
||||||
|
exportButton.style.display = 'inline-block';
|
||||||
|
} else {
|
||||||
|
resultCount.textContent = '';
|
||||||
|
resultCount.style.display = 'none';
|
||||||
|
exportButton.style.display = 'none';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function exportToCSV() {
|
||||||
|
if (!lastResults || lastResults.length === 0) return;
|
||||||
|
|
||||||
|
// CSV-Header definieren
|
||||||
|
const headers = [
|
||||||
|
'Nummer',
|
||||||
|
'Name',
|
||||||
|
'Fachrichtung',
|
||||||
|
'Straße',
|
||||||
|
'PLZ',
|
||||||
|
'Ort',
|
||||||
|
'Telefon',
|
||||||
|
'Mobil',
|
||||||
|
'Handy',
|
||||||
|
'Telefon Firma',
|
||||||
|
'E-Mail',
|
||||||
|
'Kontakt 1',
|
||||||
|
'Kontakt 2',
|
||||||
|
'Kontakt 3',
|
||||||
|
'Tags'
|
||||||
|
];
|
||||||
|
|
||||||
|
// CSV-Daten erstellen
|
||||||
|
const csvRows = [headers];
|
||||||
|
|
||||||
|
lastResults.forEach(customer => {
|
||||||
|
const row = [
|
||||||
|
customer.nummer,
|
||||||
|
customer.name,
|
||||||
|
customer.fachrichtung,
|
||||||
|
customer.strasse,
|
||||||
|
customer.plz,
|
||||||
|
customer.ort,
|
||||||
|
customer.telefon,
|
||||||
|
customer.mobil,
|
||||||
|
customer.handy,
|
||||||
|
customer.tele_firma,
|
||||||
|
customer.email,
|
||||||
|
customer.kontakt1,
|
||||||
|
customer.kontakt2,
|
||||||
|
customer.kontakt3,
|
||||||
|
(customer.tags || []).join(';')
|
||||||
|
].map(value => {
|
||||||
|
// Werte mit Kommas oder Anführungszeichen in Anführungszeichen setzen
|
||||||
|
if (value && (value.includes(',') || value.includes('"') || value.includes('\n'))) {
|
||||||
|
return `"${value.replace(/"/g, '""')}"`;
|
||||||
|
}
|
||||||
|
return value || '';
|
||||||
|
});
|
||||||
|
|
||||||
|
csvRows.push(row);
|
||||||
|
});
|
||||||
|
|
||||||
|
// CSV-String erstellen
|
||||||
|
const csvContent = csvRows.map(row => row.join(',')).join('\n');
|
||||||
|
|
||||||
|
// Blob erstellen und Download starten
|
||||||
|
const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
|
||||||
|
const link = document.createElement('a');
|
||||||
|
const url = URL.createObjectURL(blob);
|
||||||
|
|
||||||
|
link.setAttribute('href', url);
|
||||||
|
link.setAttribute('download', `kundensuche_${new Date().toISOString().split('T')[0]}.csv`);
|
||||||
|
link.style.visibility = 'hidden';
|
||||||
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
|
document.body.removeChild(link);
|
||||||
|
}
|
||||||
|
|
||||||
|
function exportToVCF(customer) {
|
||||||
|
if (!customer) return;
|
||||||
|
|
||||||
|
const vcfData = [
|
||||||
|
'BEGIN:VCARD',
|
||||||
|
'VERSION:3.0',
|
||||||
|
`FN:${customer.name || ''}`,
|
||||||
|
`N:${customer.name || ''};;;`,
|
||||||
|
`TEL;TYPE=CELL:${customer.telefon || ''}`,
|
||||||
|
`TEL;TYPE=HOME:${customer.mobil || ''}`,
|
||||||
|
`EMAIL:${customer.email || ''}`,
|
||||||
|
`ADR;TYPE=HOME:;;${customer.strasse || ''};${customer.plz || ''};${customer.ort || ''};`,
|
||||||
|
`ORG:${customer.fachrichtung || ''}`,
|
||||||
|
'END:VCARD'
|
||||||
|
].join('\n');
|
||||||
|
|
||||||
|
const blob = new Blob([vcfData], { type: 'text/vcard;charset=utf-8' });
|
||||||
|
const url = window.URL.createObjectURL(blob);
|
||||||
|
const a = document.createElement('a');
|
||||||
|
a.href = url;
|
||||||
|
a.download = `kontakt_${customer.name || ''}_${new Date().toISOString().split('T')[0]}.vcf`;
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
window.URL.revokeObjectURL(url);
|
||||||
|
document.body.removeChild(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
function displayResults(results) {
|
||||||
|
const resultsDiv = document.getElementById('results');
|
||||||
|
const resultCount = document.getElementById('result-count');
|
||||||
|
const generalSearchTerm = document.getElementById('q').value;
|
||||||
|
const nameSearchTerm = document.getElementById('nameInput').value;
|
||||||
|
const fachrichtungSearchTerm = document.getElementById('fachrichtungInput').value;
|
||||||
|
|
||||||
|
if (!results || results.length === 0) {
|
||||||
|
resultsDiv.innerHTML = '<p>Keine Ergebnisse gefunden.</p>';
|
||||||
|
resultCount.textContent = '';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
resultCount.textContent = `${results.length} Ergebnisse`;
|
||||||
|
lastResults = results;
|
||||||
|
|
||||||
|
const resultsHTML = results.map(customer => {
|
||||||
|
// Hilfsfunktion zum Erstellen von Feldern nur wenn sie Werte haben
|
||||||
|
const createFieldIfValue = (label, value, formatter = (v) => v) => {
|
||||||
|
if (!value || value === 'N/A' || value === 'n/a' || value === 'N/a' || (typeof value === 'string' && value.trim() === '')) return '';
|
||||||
|
const formattedValue = formatter(value);
|
||||||
|
return `<p class="mb-1"><strong>${label}:</strong> ${formattedValue}</p>`;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Highlighting für alle Felder
|
||||||
|
const highlightField = (value) => {
|
||||||
|
if (!value) return value;
|
||||||
|
let highlighted = value;
|
||||||
|
if (nameSearchTerm) {
|
||||||
|
highlighted = highlightText(highlighted, nameSearchTerm);
|
||||||
|
}
|
||||||
|
if (fachrichtungSearchTerm) {
|
||||||
|
highlighted = highlightText(highlighted, fachrichtungSearchTerm);
|
||||||
|
}
|
||||||
|
if (generalSearchTerm) {
|
||||||
|
highlighted = highlightText(highlighted, generalSearchTerm);
|
||||||
|
}
|
||||||
|
return highlighted;
|
||||||
|
};
|
||||||
|
|
||||||
|
return `
|
||||||
|
<div class="customer-card">
|
||||||
|
<div class="customer-header">
|
||||||
|
<h3 class="customer-name">${highlightField(customer.name)}</h3>
|
||||||
|
<div class="customer-actions">
|
||||||
|
<span class="badge ${(customer.tag || 'medisoft') === 'medisoft' ? 'bg-primary' : 'bg-warning text-dark'}">${(customer.tag || 'medisoft').toUpperCase()}</span>
|
||||||
|
<button class="btn btn-sm btn-outline-primary" onclick="copyCustomerLink('${customer.nummer}')" title="Link kopieren">
|
||||||
|
<i class="fas fa-link"></i>
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-sm btn-outline-primary" onclick='exportToVCF(${JSON.stringify(customer).replace(/'/g, "\\'")})' title="Als VCF exportieren">
|
||||||
|
<i class="bi bi-person-vcard"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="customer-details">
|
||||||
|
${createFieldIfValue('Nummer', highlightField(customer.nummer), createCustomerLink)}
|
||||||
|
${createFieldIfValue('Adresse', (customer.strasse && customer.plz && customer.ort) ? true : false,
|
||||||
|
() => createAddressLink(
|
||||||
|
customer.strasse,
|
||||||
|
highlightField(customer.plz),
|
||||||
|
highlightField(customer.ort)
|
||||||
|
))}
|
||||||
|
${createFieldIfValue('Telefon', highlightField(customer.telefon), createPhoneLink)}
|
||||||
|
${createFieldIfValue('Mobil', highlightField(customer.mobil), createPhoneLink)}
|
||||||
|
${createFieldIfValue('Handy', highlightField(customer.handy), createPhoneLink)}
|
||||||
|
${createFieldIfValue('E-Mail', highlightField(customer.email), createEmailLink)}
|
||||||
|
${createFieldIfValue('Fachrichtung', highlightField(customer.fachrichtung))}
|
||||||
|
${createFieldIfValue('Kontakt 1', highlightField(customer.kontakt1), createPhoneLink)}
|
||||||
|
${createFieldIfValue('Kontakt 2', highlightField(customer.kontakt2), createPhoneLink)}
|
||||||
|
${createFieldIfValue('Kontakt 3', highlightField(customer.kontakt3), createPhoneLink)}
|
||||||
|
${customer.tags && customer.tags.length > 0 ? `
|
||||||
|
<p class="mb-0"><strong>Tags:</strong>
|
||||||
|
${customer.tags.map(tag => `<span class="badge bg-primary me-1">${tag}</span>`).join('')}
|
||||||
|
</p>
|
||||||
|
` : ''}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
}).join('');
|
||||||
|
|
||||||
|
resultsDiv.innerHTML = resultsHTML;
|
||||||
|
updateResultCounts();
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearInput(inputId) {
|
||||||
|
document.getElementById(inputId).value = '';
|
||||||
|
searchCustomers();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function searchCustomers() {
|
||||||
|
let searchTimeout;
|
||||||
|
const loading = document.getElementById('loading');
|
||||||
|
const results = document.getElementById('results');
|
||||||
|
const generalSearch = document.getElementById('q').value;
|
||||||
|
const nameSearch = document.getElementById('nameInput').value;
|
||||||
|
const ortSearch = document.getElementById('ortInput').value;
|
||||||
|
const nummerSearch = document.getElementById('nummerInput').value;
|
||||||
|
const plzSearch = document.getElementById('plzInput').value;
|
||||||
|
const fachrichtungSearch = document.getElementById('fachrichtungInput').value;
|
||||||
|
const tagFilter = document.getElementById('tagFilter').value;
|
||||||
|
currentSearchQuery = generalSearch;
|
||||||
|
currentPage = 1;
|
||||||
|
|
||||||
|
// Zeige Ladeanimation
|
||||||
|
loading.style.display = 'block';
|
||||||
|
results.innerHTML = '';
|
||||||
|
|
||||||
|
// Setze Timeout zurück
|
||||||
|
clearTimeout(searchTimeout);
|
||||||
|
|
||||||
|
// Verzögerte Suche
|
||||||
|
searchTimeout = setTimeout(async () => {
|
||||||
|
try {
|
||||||
|
// Baue die Suchanfrage
|
||||||
|
const params = new URLSearchParams();
|
||||||
|
if (generalSearch) params.append('q', generalSearch);
|
||||||
|
if (nameSearch) params.append('name', nameSearch);
|
||||||
|
if (ortSearch) params.append('ort', ortSearch);
|
||||||
|
if (nummerSearch) params.append('nummer', nummerSearch);
|
||||||
|
if (plzSearch) params.append('plz', plzSearch);
|
||||||
|
if (fachrichtungSearch) params.append('fachrichtung', fachrichtungSearch);
|
||||||
|
if (tagFilter) params.append('tag', tagFilter);
|
||||||
|
|
||||||
|
const response = await fetch('/search?' + params.toString());
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error('Netzwerkantwort war nicht ok');
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = await response.json();
|
||||||
|
displayResults(data);
|
||||||
|
} catch (error) {
|
||||||
|
results.innerHTML = '<p>Ein Fehler ist aufgetreten. Bitte versuchen Sie es später erneut.</p>';
|
||||||
|
} finally {
|
||||||
|
loading.style.display = 'none';
|
||||||
|
}
|
||||||
|
}, 300);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setupFachrichtungAutocomplete() {
|
||||||
|
const fachrichtungInput = document.getElementById('fachrichtungInput');
|
||||||
|
const autocompleteList = document.createElement('div');
|
||||||
|
autocompleteList.className = 'autocomplete-items';
|
||||||
|
fachrichtungInput.parentNode.appendChild(autocompleteList);
|
||||||
|
|
||||||
|
fachrichtungInput.addEventListener('input', function() {
|
||||||
|
clearTimeout(fachrichtungTimeout);
|
||||||
|
const searchTerm = this.value;
|
||||||
|
|
||||||
|
if (searchTerm.length < 2) {
|
||||||
|
autocompleteList.style.display = 'none';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fachrichtungTimeout = setTimeout(() => {
|
||||||
|
fetch(`/api/fachrichtungen?q=${encodeURIComponent(searchTerm)}`)
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
autocompleteList.innerHTML = '';
|
||||||
|
if (data.length > 0) {
|
||||||
|
data.forEach(item => {
|
||||||
|
const div = document.createElement('div');
|
||||||
|
div.textContent = item;
|
||||||
|
div.addEventListener('click', () => {
|
||||||
|
fachrichtungInput.value = item;
|
||||||
|
autocompleteList.style.display = 'none';
|
||||||
|
searchCustomers();
|
||||||
|
});
|
||||||
|
autocompleteList.appendChild(div);
|
||||||
|
});
|
||||||
|
autocompleteList.style.display = 'block';
|
||||||
|
} else {
|
||||||
|
autocompleteList.style.display = 'none';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, 300);
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener('click', function(e) {
|
||||||
|
if (!fachrichtungInput.contains(e.target) && !autocompleteList.contains(e.target)) {
|
||||||
|
autocompleteList.style.display = 'none';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function setupOrtAutocomplete() {
|
||||||
|
const ortInput = document.getElementById('ortInput');
|
||||||
|
const autocompleteList = document.createElement('div');
|
||||||
|
autocompleteList.className = 'autocomplete-items';
|
||||||
|
ortInput.parentNode.appendChild(autocompleteList);
|
||||||
|
|
||||||
|
ortInput.addEventListener('input', function() {
|
||||||
|
clearTimeout(ortTimeout);
|
||||||
|
const searchTerm = this.value;
|
||||||
|
|
||||||
|
if (searchTerm.length < 2) {
|
||||||
|
autocompleteList.style.display = 'none';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ortTimeout = setTimeout(() => {
|
||||||
|
fetch(`/api/orte?q=${encodeURIComponent(searchTerm)}`)
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
autocompleteList.innerHTML = '';
|
||||||
|
if (data.length > 0) {
|
||||||
|
data.forEach(item => {
|
||||||
|
const div = document.createElement('div');
|
||||||
|
div.textContent = item;
|
||||||
|
div.addEventListener('click', () => {
|
||||||
|
ortInput.value = item;
|
||||||
|
autocompleteList.style.display = 'none';
|
||||||
|
searchCustomers();
|
||||||
|
});
|
||||||
|
autocompleteList.appendChild(div);
|
||||||
|
});
|
||||||
|
autocompleteList.style.display = 'block';
|
||||||
|
} else {
|
||||||
|
autocompleteList.style.display = 'none';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, 300);
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener('click', function(e) {
|
||||||
|
if (!ortInput.contains(e.target) && !autocompleteList.contains(e.target)) {
|
||||||
|
autocompleteList.style.display = 'none';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Event-Listener für die URL-Parameter und Autocomplete-Setup
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
const kundennummer = urlParams.get('kundennummer');
|
||||||
|
const name = urlParams.get('name');
|
||||||
|
const ort = urlParams.get('ort');
|
||||||
|
const plz = urlParams.get('plz');
|
||||||
|
|
||||||
|
if (kundennummer) {
|
||||||
|
document.getElementById('nummerInput').value = kundennummer;
|
||||||
|
searchCustomers();
|
||||||
|
}
|
||||||
|
if (name) {
|
||||||
|
document.getElementById('nameInput').value = name;
|
||||||
|
searchCustomers();
|
||||||
|
}
|
||||||
|
if (ort) {
|
||||||
|
document.getElementById('ortInput').value = ort;
|
||||||
|
searchCustomers();
|
||||||
|
}
|
||||||
|
if (plz) {
|
||||||
|
document.getElementById('plzInput').value = plz;
|
||||||
|
searchCustomers();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup Autocomplete
|
||||||
|
setupFachrichtungAutocomplete();
|
||||||
|
setupOrtAutocomplete();
|
||||||
|
});
|
BIN
static/medisoftware_logo_rb_200.png
Normal file
BIN
static/medisoftware_logo_rb_200.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.4 KiB |
@@ -3,430 +3,113 @@
|
|||||||
<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">
|
||||||
|
<meta name="client-ip" content="{{ request.headers.get('X-Forwarded-For', request.remote_addr) }}">
|
||||||
|
<meta name="allowed-ip-ranges" content="{{ allowed_ip_ranges }}">
|
||||||
<title>medisoftware Kundensuche</title>
|
<title>medisoftware Kundensuche</title>
|
||||||
<link rel="icon" type="image/x-icon" href="{{ url_for('static', filename='favicon.ico') }}">
|
<link rel="icon" type="image/x-icon" href="{{ url_for('static', filename='favicon.ico') }}">
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" rel="stylesheet">
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" rel="stylesheet">
|
||||||
<style>
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
body {
|
<link href="{{ url_for('static', filename='css/styles.css') }}" rel="stylesheet">
|
||||||
min-height: 100vh;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
.main-content {
|
|
||||||
flex: 1 0 auto;
|
|
||||||
padding: 2rem 0;
|
|
||||||
}
|
|
||||||
.search-container {
|
|
||||||
max-width: 800px;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
.result-card {
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
.result-card:hover {
|
|
||||||
transform: translateY(-2px);
|
|
||||||
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
|
|
||||||
}
|
|
||||||
.loading {
|
|
||||||
display: none;
|
|
||||||
text-align: center;
|
|
||||||
margin: 2rem 0;
|
|
||||||
}
|
|
||||||
.phone-link, .email-link, .address-link, .customer-link {
|
|
||||||
text-decoration: none;
|
|
||||||
color: #0d6efd;
|
|
||||||
}
|
|
||||||
.phone-link:hover, .email-link:hover, .address-link:hover, .customer-link:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
.search-icon, .reset-icon {
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
color: #6c757d;
|
|
||||||
cursor: pointer;
|
|
||||||
display: none;
|
|
||||||
z-index: 10;
|
|
||||||
}
|
|
||||||
.reset-icon {
|
|
||||||
right: 10px;
|
|
||||||
}
|
|
||||||
.search-icon {
|
|
||||||
right: 35px;
|
|
||||||
}
|
|
||||||
.reset-icon.visible {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
.search-icon.visible {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
.customer-number {
|
|
||||||
color: #6c757d;
|
|
||||||
font-size: 0.9em;
|
|
||||||
}
|
|
||||||
.footer {
|
|
||||||
flex-shrink: 0;
|
|
||||||
text-align: center;
|
|
||||||
padding: 1rem;
|
|
||||||
background-color: #f8f9fa;
|
|
||||||
border-top: 1px solid #dee2e6;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.share-feedback {
|
|
||||||
position: fixed;
|
|
||||||
bottom: 20px;
|
|
||||||
right: 20px;
|
|
||||||
background: #28a745;
|
|
||||||
color: white;
|
|
||||||
padding: 8px 16px;
|
|
||||||
border-radius: 4px;
|
|
||||||
display: none;
|
|
||||||
animation: fadeOut 2s forwards;
|
|
||||||
z-index: 1000;
|
|
||||||
}
|
|
||||||
@keyframes fadeOut {
|
|
||||||
0% { opacity: 1; }
|
|
||||||
70% { opacity: 1; }
|
|
||||||
100% { opacity: 0; }
|
|
||||||
}
|
|
||||||
.card-actions {
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-end;
|
|
||||||
margin-top: 1rem;
|
|
||||||
}
|
|
||||||
.share-button {
|
|
||||||
padding: 5px 10px;
|
|
||||||
border-radius: 15px;
|
|
||||||
font-size: 0.9em;
|
|
||||||
}
|
|
||||||
.search-fields {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
||||||
gap: 1rem;
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
}
|
|
||||||
.search-field {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
.input-group {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
.result-counts {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
padding: 0.5rem;
|
|
||||||
background-color: #f8f9fa;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.result-count {
|
|
||||||
background-color: #e9ecef;
|
|
||||||
padding: 4px 12px;
|
|
||||||
border-radius: 12px;
|
|
||||||
font-size: 0.9em;
|
|
||||||
color: #6c757d;
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.result-count.visible {
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
.location-pin {
|
|
||||||
color: #dc3545;
|
|
||||||
margin-left: 4px;
|
|
||||||
font-size: 1.2em;
|
|
||||||
}
|
|
||||||
.weather-info {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
margin-left: 10px;
|
|
||||||
font-size: 0.9em;
|
|
||||||
color: #666;
|
|
||||||
}
|
|
||||||
.weather-info img {
|
|
||||||
width: 24px;
|
|
||||||
height: 24px;
|
|
||||||
margin-right: 4px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="main-content">
|
<div class="main-content">
|
||||||
<div class="container search-container">
|
<div class="container">
|
||||||
<h1 class="text-center mb-4">medisoftware Kundensuche</h1>
|
<div class="text-center mb-4">
|
||||||
|
<a href="https://medisoftware.de" target="_blank" rel="noopener noreferrer"><img src="{{ url_for('static', filename='medisoftware_logo_rb_200.png') }}" alt="medisoftware Logo" class="img-fluid" style="max-width: 200px;"></a>
|
||||||
<div class="input-group mb-4 position-relative">
|
|
||||||
<input type="text" id="searchInput" class="form-control form-control-lg"
|
|
||||||
placeholder="Allgemeine Suche...">
|
|
||||||
<i class="fa-solid fa-xmark reset-icon" id="searchReset"></i>
|
|
||||||
<span class="search-icon">🔍</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="search-container">
|
||||||
|
<h1 class="text-center mb-4">Kundensuche</h1>
|
||||||
|
|
||||||
|
<div class="general-search mb-4">
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="text" id="q" class="form-control form-control-lg" placeholder="Allgemeine Suche" oninput="searchCustomers()">
|
||||||
|
<i class="fas fa-times reset-icon" onclick="clearInput('q')"></i>
|
||||||
|
<i class="fas fa-search search-icon"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="search-fields">
|
<div class="search-fields">
|
||||||
<div class="search-field">
|
<div class="search-field">
|
||||||
<input type="text" id="nameInput" class="form-control"
|
<div class="input-group">
|
||||||
placeholder="Name...">
|
<input type="text" id="nameInput" class="form-control" placeholder="Name" oninput="searchCustomers()">
|
||||||
<i class="fa-solid fa-xmark reset-icon" id="nameReset"></i>
|
<i class="fas fa-times reset-icon" onclick="clearInput('nameInput')"></i>
|
||||||
</div>
|
<i class="fas fa-search search-icon"></i>
|
||||||
<div class="search-field">
|
</div>
|
||||||
<input type="text" id="ortInput" class="form-control"
|
</div>
|
||||||
placeholder="Ort...">
|
|
||||||
<i class="fa-solid fa-xmark reset-icon" id="ortReset"></i>
|
<div class="search-field">
|
||||||
</div>
|
<div class="input-group">
|
||||||
<div class="search-field">
|
<input type="text" id="ortInput" class="form-control" placeholder="Ort" oninput="searchCustomers()">
|
||||||
<input type="text" id="kundennummerInput" class="form-control"
|
<i class="fas fa-times reset-icon" onclick="clearInput('ortInput')"></i>
|
||||||
placeholder="Kundennummer...">
|
<i class="fas fa-search search-icon"></i>
|
||||||
<i class="fa-solid fa-xmark reset-icon" id="kundennummerReset"></i>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="search-field">
|
|
||||||
<input type="text" id="fachrichtungInput" class="form-control"
|
<div class="search-field">
|
||||||
placeholder="Fachrichtung...">
|
<div class="input-group">
|
||||||
<i class="fa-solid fa-xmark reset-icon" id="fachrichtungReset"></i>
|
<input type="text" id="nummerInput" class="form-control" placeholder="Kundennummer" oninput="searchCustomers()">
|
||||||
</div>
|
<i class="fas fa-times reset-icon" onclick="clearInput('nummerInput')"></i>
|
||||||
<div class="search-field">
|
<i class="fas fa-search search-icon"></i>
|
||||||
<input type="text" id="telefonInput" class="form-control"
|
</div>
|
||||||
placeholder="Telefon...">
|
</div>
|
||||||
<i class="fa-solid fa-xmark reset-icon" id="telefonReset"></i>
|
|
||||||
</div>
|
<div class="search-field">
|
||||||
</div>
|
<div class="input-group">
|
||||||
|
<input type="text" id="plzInput" class="form-control" placeholder="PLZ" oninput="searchCustomers()">
|
||||||
|
<i class="fas fa-times reset-icon" onclick="clearInput('plzInput')"></i>
|
||||||
|
<i class="fas fa-search search-icon"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="result-counts">
|
<div class="search-field">
|
||||||
<span id="generalCount" class="result-count"></span>
|
<div class="input-group">
|
||||||
</div>
|
<input type="text" id="fachrichtungInput" class="form-control" placeholder="Fachrichtung" oninput="searchCustomers()">
|
||||||
|
<i class="fas fa-times reset-icon" onclick="clearInput('fachrichtungInput')"></i>
|
||||||
|
<i class="fas fa-search search-icon"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="loading" class="loading">
|
<div class="search-field">
|
||||||
<div class="spinner-border text-primary" role="status">
|
<div class="input-group">
|
||||||
<span class="visually-hidden">Laden...</span>
|
<select id="tagFilter" class="form-select" onchange="searchCustomers()">
|
||||||
|
<option value="medisoft" selected>MEDISOFT</option>
|
||||||
|
<option value="mediconsult">MEDICONSULT</option>
|
||||||
|
<option value="all">Alle</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="results" class="mt-4">
|
<div id="result-counts" class="mt-2">
|
||||||
<!-- Hier werden die Suchergebnisse angezeigt -->
|
<span id="result-count"></span>
|
||||||
|
<button id="exportButton" class="btn btn-sm btn-outline-primary ms-2" onclick="exportToCSV()" style="display: none;">
|
||||||
|
<i class="bi bi-file-earmark-spreadsheet"></i> Als CSV exportieren
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="loading" class="loading">
|
||||||
|
<div class="spinner-border text-primary" role="status">
|
||||||
|
<span class="visually-hidden">Laden...</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="results"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="shareFeedback" class="share-feedback">
|
<div id="shareFeedback" class="share-feedback">
|
||||||
Link kopiert!
|
Link in die Zwischenablage kopiert!
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<p class="mb-0">(c) 2025 <a href="https://medisoftware.de" target="_blank" rel="noopener noreferrer" class="text-decoration-none">medisoftware</a></p>
|
<div class="footer-content">
|
||||||
|
Proudly made with ❤️ and 🍺 by <a href="https://www.medisoftware.de" target="_blank" class="footer-link">medisoftware</a>
|
||||||
|
<div style="font-size: 0.8em;">Version: {{ version }}</div>
|
||||||
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script>
|
<script src="{{ url_for('static', filename='js/main.js') }}"></script>
|
||||||
let searchTimeout;
|
|
||||||
let lastResults = [];
|
|
||||||
|
|
||||||
function createPhoneLink(phone) {
|
|
||||||
if (!phone) return 'N/A';
|
|
||||||
const cleaned = phone.replace(/\D/g, '');
|
|
||||||
const telLink = '0' + cleaned;
|
|
||||||
return `<a href="tel:${telLink}" class="phone-link">${phone}</a>`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function createEmailLink(email) {
|
|
||||||
if (!email) return 'N/A';
|
|
||||||
return `<a href="mailto:${email}" class="email-link">${email}</a>`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function createAddressLink(street, plz, city) {
|
|
||||||
if (!street || !plz || !city) return 'N/A';
|
|
||||||
const address = `${street}, ${plz} ${city}`;
|
|
||||||
const searchQuery = encodeURIComponent(address);
|
|
||||||
return `${address}
|
|
||||||
<a href="https://www.google.com/maps/search/?api=1&query=${searchQuery}"
|
|
||||||
class="address-link" target="_blank" rel="noopener noreferrer">
|
|
||||||
<i class="fa-solid fa-location-pin location-pin"></i>
|
|
||||||
</a>`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function createCustomerLink(customerNumber) {
|
|
||||||
if (!customerNumber) return 'N/A';
|
|
||||||
return `<a href="medisw:openkkbefe/P${customerNumber}?NetGrp=4"
|
|
||||||
class="customer-link" target="_blank" rel="noopener noreferrer">
|
|
||||||
${customerNumber}
|
|
||||||
</a>`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function showCopyFeedback() {
|
|
||||||
const feedback = document.getElementById('shareFeedback');
|
|
||||||
feedback.style.display = 'block';
|
|
||||||
feedback.style.opacity = '1';
|
|
||||||
|
|
||||||
feedback.addEventListener('animationend', () => {
|
|
||||||
feedback.style.display = 'none';
|
|
||||||
}, { once: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
async function copyCustomerLink(customerNumber) {
|
|
||||||
const url = new URL(window.location.href);
|
|
||||||
url.searchParams.set('kundennummer', customerNumber);
|
|
||||||
|
|
||||||
try {
|
|
||||||
await navigator.clipboard.writeText(url.toString());
|
|
||||||
showCopyFeedback();
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Fehler beim Kopieren:', err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateResultCounts() {
|
|
||||||
// Nur Gesamtzahl anzeigen
|
|
||||||
const generalCount = lastResults.length;
|
|
||||||
document.getElementById('generalCount').textContent =
|
|
||||||
generalCount > 0 ? `${generalCount} Treffer gefunden` : '';
|
|
||||||
document.getElementById('generalCount').classList.toggle('visible', generalCount > 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
function searchCustomers() {
|
|
||||||
const name = document.getElementById('nameInput').value;
|
|
||||||
const ort = document.getElementById('ortInput').value;
|
|
||||||
const kundennummer = document.getElementById('kundennummerInput').value;
|
|
||||||
const fachrichtung = document.getElementById('fachrichtungInput').value;
|
|
||||||
const telefon = document.getElementById('telefonInput').value;
|
|
||||||
const query = document.getElementById('searchInput').value;
|
|
||||||
|
|
||||||
// Prüfe, ob mindestens ein Suchfeld ausgefüllt ist
|
|
||||||
if (!name && !ort && !kundennummer && !fachrichtung && !telefon && !query) {
|
|
||||||
document.getElementById('results').innerHTML = '';
|
|
||||||
lastResults = [];
|
|
||||||
updateResultCounts();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lade-Animation anzeigen
|
|
||||||
document.getElementById('loading').style.display = 'block';
|
|
||||||
document.getElementById('results').innerHTML = '';
|
|
||||||
|
|
||||||
// URL-Parameter erstellen
|
|
||||||
const params = new URLSearchParams();
|
|
||||||
if (name) params.append('name', name);
|
|
||||||
if (ort) params.append('ort', ort);
|
|
||||||
if (kundennummer) params.append('kundennummer', kundennummer);
|
|
||||||
if (fachrichtung) params.append('fachrichtung', fachrichtung);
|
|
||||||
if (telefon) params.append('telefon', telefon);
|
|
||||||
if (query) params.append('q', query);
|
|
||||||
|
|
||||||
fetch(`/search?${params.toString()}`)
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
if (data.error) {
|
|
||||||
showError(data.error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const resultsContainer = document.getElementById('results');
|
|
||||||
resultsContainer.innerHTML = '';
|
|
||||||
|
|
||||||
if (data.results && data.results.length > 0) {
|
|
||||||
data.results.forEach(customer => {
|
|
||||||
const card = document.createElement('div');
|
|
||||||
card.className = 'card mb-3';
|
|
||||||
card.innerHTML = `
|
|
||||||
<div class="card-body">
|
|
||||||
<h5 class="card-title">${customer.Vorname} ${customer.Nachname}</h5>
|
|
||||||
<p class="card-text">
|
|
||||||
<strong>Kundennummer:</strong> ${customer.Nummer}<br>
|
|
||||||
<strong>Fachrichtung:</strong> ${customer.Fachrichtung || 'N/A'}<br>
|
|
||||||
<strong>Adresse:</strong> ${createAddressLink(customer.Strasse, customer.PLZ, customer.Ort)}
|
|
||||||
${customer.weather ? `
|
|
||||||
<span class="weather-info">
|
|
||||||
<img src="http://openweathermap.org/img/wn/${customer.weather.icon}@2x.png"
|
|
||||||
alt="${customer.weather.description}"
|
|
||||||
title="${customer.weather.description}">
|
|
||||||
${customer.weather.temperature}°C
|
|
||||||
</span>
|
|
||||||
` : ''}
|
|
||||||
<br>
|
|
||||||
<strong>Telefon:</strong> ${createPhoneLink(customer.Tel)}<br>
|
|
||||||
<strong>E-Mail:</strong> ${createEmailLink(customer.mail)}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
resultsContainer.appendChild(card);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Zeige die Anzahl der Treffer an
|
|
||||||
const totalResults = document.getElementById('total-results');
|
|
||||||
if (totalResults) {
|
|
||||||
totalResults.textContent = `${data.total} Treffer gefunden`;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
resultsContainer.innerHTML = '<div class="alert alert-info">Keine Ergebnisse gefunden.</div>';
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.error('Fehler:', error);
|
|
||||||
document.getElementById('results').innerHTML =
|
|
||||||
`<div class="alert alert-danger">${error.message}</div>`;
|
|
||||||
lastResults = [];
|
|
||||||
updateResultCounts();
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
document.getElementById('loading').style.display = 'none';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Event-Listener für die Live-Suche
|
|
||||||
const searchInputs = [
|
|
||||||
document.getElementById('nameInput'),
|
|
||||||
document.getElementById('ortInput'),
|
|
||||||
document.getElementById('kundennummerInput'),
|
|
||||||
document.getElementById('fachrichtungInput'),
|
|
||||||
document.getElementById('telefonInput'),
|
|
||||||
document.getElementById('searchInput')
|
|
||||||
];
|
|
||||||
|
|
||||||
const resetIcons = [
|
|
||||||
document.getElementById('nameReset'),
|
|
||||||
document.getElementById('ortReset'),
|
|
||||||
document.getElementById('kundennummerReset'),
|
|
||||||
document.getElementById('fachrichtungReset'),
|
|
||||||
document.getElementById('telefonReset'),
|
|
||||||
document.getElementById('searchReset')
|
|
||||||
];
|
|
||||||
|
|
||||||
searchInputs.forEach((input, index) => {
|
|
||||||
input.addEventListener('input', function() {
|
|
||||||
clearTimeout(searchTimeout);
|
|
||||||
searchTimeout = setTimeout(searchCustomers, 300);
|
|
||||||
|
|
||||||
// Reset-Icon anzeigen/verstecken
|
|
||||||
resetIcons[index].classList.toggle('visible', this.value.length > 0);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Reset-Funktionalität
|
|
||||||
resetIcons[index].addEventListener('click', function() {
|
|
||||||
searchInputs[index].value = '';
|
|
||||||
searchCustomers();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// URL-Parameter beim Laden der Seite prüfen
|
|
||||||
window.addEventListener('load', function() {
|
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
|
||||||
const name = urlParams.get('name');
|
|
||||||
const ort = urlParams.get('ort');
|
|
||||||
const kundennummer = urlParams.get('kundennummer');
|
|
||||||
const fachrichtung = urlParams.get('fachrichtung');
|
|
||||||
const telefon = urlParams.get('telefon');
|
|
||||||
const query = urlParams.get('q');
|
|
||||||
|
|
||||||
if (name) document.getElementById('nameInput').value = name;
|
|
||||||
if (ort) document.getElementById('ortInput').value = ort;
|
|
||||||
if (kundennummer) document.getElementById('kundennummerInput').value = kundennummer;
|
|
||||||
if (fachrichtung) document.getElementById('fachrichtungInput').value = fachrichtung;
|
|
||||||
if (telefon) document.getElementById('telefonInput').value = telefon;
|
|
||||||
if (query) document.getElementById('searchInput').value = query;
|
|
||||||
|
|
||||||
if (name || ort || kundennummer || fachrichtung || telefon || query) {
|
|
||||||
searchCustomers();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
60
templates/login.html
Normal file
60
templates/login.html
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>medisoftware Kundensuche</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.main-content {
|
||||||
|
flex: 1 0 auto;
|
||||||
|
padding: 2rem 0;
|
||||||
|
margin-bottom: 4rem; /* Platz für die fixierte Fußzeile */
|
||||||
|
}
|
||||||
|
.footer {
|
||||||
|
flex-shrink: 0;
|
||||||
|
text-align: center;
|
||||||
|
padding: 1rem;
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
border-top: 1px solid #dee2e6;
|
||||||
|
width: 100%;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container mt-5">
|
||||||
|
<div class="text-center mb-4">
|
||||||
|
<img src="{{ url_for('static', filename='medisoftware_logo_rb_200.png') }}" alt="medisoftware Logo" class="img-fluid" style="max-width: 200px;">
|
||||||
|
</div>
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<h2 class="text-center">Login</h2>
|
||||||
|
<form method="POST" action="/login">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="password" class="form-label">Passwort</label>
|
||||||
|
<input type="password" class="form-control" id="password" name="password" required>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary w-100">Einloggen</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<footer class="footer">
|
||||||
|
<div class="footer-content">
|
||||||
|
Proudly made with ❤️ and 🍺 by <a href="https://www.medisoftware.de" target="_blank" class="footer-link">medisoftware</a>
|
||||||
|
<div style="font-size: 0.8em;">Version: v1.2.3</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
Reference in New Issue
Block a user