Compare commits

..

18 Commits

31 changed files with 21177 additions and 17960 deletions

7
.gitignore vendored
View File

@@ -109,4 +109,9 @@ Thumbs.db
.npm
# Optional eslint cache
.eslintcache
.eslintcache
# Ignore contents of premium folder in public repo
premium/*
!premium/README-PREMIUM.md
!premium/.gitkeep

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "premium"]
path = premium
url = https://github.com/donpat1to/Schichtenplaner-Pro.git

View File

@@ -1,7 +1,7 @@
# Multi-stage build for combined frontend + backend
FROM node:20-bullseye AS backend-builder
WORKDIR /app/backend
WORKDIR /app
# Install Python + OR-Tools
RUN apt-get update && apt-get install -y python3 python3-pip build-essential \
@@ -10,21 +10,22 @@ RUN apt-get update && apt-get install -y python3 python3-pip build-essential \
# Create symlink so python3 is callable as python
RUN ln -sf /usr/bin/python3 /usr/bin/python
# Copy backend files
COPY backend/package*.json ./
COPY backend/tsconfig.json ./
# Copy ALL package files (root + backend)
COPY package*.json ./
COPY backend/package.json ./backend/
# Install backend dependencies
RUN npm ci
# Install dependencies using workspaces
RUN npm ci --workspace=backend
# Copy backend source
COPY backend/src/ ./src/
COPY backend/src/ ./backend/src/
COPY backend/tsconfig.json ./backend/
# Build backend
RUN npm run build
RUN npm run build --workspace=backend
# Copy database files manually
RUN cp -r src/database/ dist/database/
RUN cp -r backend/src/database/ backend/dist/database/
# Verify Python and OR-Tools installation
RUN python -c "from ortools.sat.python import cp_model; print('OR-Tools installed successfully')"
@@ -32,21 +33,22 @@ RUN python -c "from ortools.sat.python import cp_model; print('OR-Tools installe
# Frontend build stage
FROM node:20-bullseye AS frontend-builder
WORKDIR /app/frontend
WORKDIR /app
# Copy frontend files
COPY frontend/package*.json ./
COPY frontend/tsconfig.json ./
# Copy ALL package files (root + frontend)
COPY package*.json ./
COPY frontend/package.json ./frontend/
# Install frontend dependencies
RUN npm ci
# Install dependencies using workspaces
RUN npm ci --workspace=frontend
# Copy frontend source
COPY frontend/src/ ./src/
COPY frontend/public/ ./public/
COPY frontend/src/ ./frontend/src/
COPY frontend/public/ ./frontend/public/
COPY frontend/tsconfig.json ./frontend/
# Build frontend
RUN npm run build
RUN npm run build --workspace=frontend
# Production stage
FROM node:20-bookworm
@@ -60,9 +62,9 @@ RUN npm install -g pm2
RUN mkdir -p /app/data
# Copy backend built files
COPY --from=backend-builder /app/backend/package*.json ./
COPY --from=backend-builder /app/backend/dist/ ./dist/
COPY --from=backend-builder /app/backend/node_modules/ ./node_modules/
COPY --from=backend-builder /app/node_modules/ ./node_modules/
COPY --from=backend-builder /app/backend/package.json ./
# Copy frontend built files
COPY --from=frontend-builder /app/frontend/build/ ./frontend-build/

21
LICENSE-COMMERCIAL Normal file
View File

@@ -0,0 +1,21 @@
COMMERCIAL LICENSE AGREEMENT
Copyright (c) 2025 Patrick Mahnke-Hartmann
This software, "Schichtenplaner", is offered under a dual licensing model.
1. Open-Source License
You may use this software under the terms of the MIT License
(see LICENSE file) for non-commercial, personal, or educational use.
2. Commercial License
Commercial use of this software requires a separate paid license.
This includes, but is not limited to:
- Use in proprietary, for-profit, or internal business applications
- Use within paid services or SaaS offerings
- Integration into commercial software or distributions
To obtain a commercial license, please contact:
📧 patrick@mahnke-hartmann.dev
or open an inquiry via GitHub: https://github.com/donpat1to/Schichtenplaner
Without a valid commercial license, all commercial rights are reserved.

View File

@@ -2,4 +2,14 @@
Aufteilung der Schichten unter Mitarbeitern
du knlich
## 🧾 License
This project uses a **dual license model**:
- **Community Edition:** Licensed under [MIT](./LICENSE) for personal and non-commercial use.
- **Commercial Edition:** A [commercial license](./LICENSE-COMMERCIAL) is required for any for-profit or business use.
To obtain a commercial license, contact:
📧 patrick@mahnke-hartmann.dev
[![License: MIT & Commercial](https://img.shields.io/badge/license-MIT%20%7C%20Commercial-purple)](#license)

View File

@@ -33,4 +33,4 @@
"typescript": "^5.0.0",
"tsx": "^4.0.0"
}
}
}

View File

@@ -1,3 +1,4 @@
// backend/src/services/databaseService
import sqlite3 from 'sqlite3';
import path from 'path';
import { fileURLToPath } from 'url';

View File

@@ -1,19 +1,22 @@
// backend/tsconfig.json
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"allowJs": true,
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
"include": [
"src/**/*"
],
"exclude": [
"node_modules",
"dist"
]
}

17666
frontend/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -2,6 +2,7 @@
"name": "frontend",
"version": "0.1.0",
"private": true,
"type": "module",
"dependencies": {
"@testing-library/dom": "^10.4.1",
"@testing-library/jest-dom": "^6.9.1",

View File

@@ -1,6 +1,6 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"short_name": "SP",
"name": "schichtenplaner",
"icons": [
{
"src": "favicon.ico",

View File

@@ -1,4 +1,4 @@
// frontend/src/App.tsx - KORRIGIERT MIT LAYOUT
// frontend/src/App.tsx - ONE-REPO SAFE WITHOUT DYNAMIC IMPORTS
import React from 'react';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import { AuthProvider, useAuth } from './contexts/AuthContext';
@@ -16,6 +16,38 @@ import Settings from './pages/Settings/Settings';
import Help from './pages/Help/Help';
import Setup from './pages/Setup/Setup';
// Free Footer Link Pages (always available)
import FAQ from './components/Layout/FooterLinks/FAQ/FAQ';
import About from './components/Layout/FooterLinks/About/About';
import Features from './components/Layout/FooterLinks/Features/Features';
import { CommunityContact, CommunityLegalPage } from './components/Layout/FooterLinks/CommunityLinks/communityLinks';
// Feature flag from environment
const ENABLE_PRO = process.env.ENABLE_PRO === 'true';
// Conditional Premium Components
let PremiumContact: React.FC = CommunityContact;
let PremiumPrivacy: React.FC = () => <CommunityLegalPage title="Datenschutz" />;
let PremiumImprint: React.FC = () => <CommunityLegalPage title="Impressum" />;
let PremiumTerms: React.FC = () => <CommunityLegalPage title="AGB" />;
// Load premium components only when ENABLE_PRO is true
if (ENABLE_PRO) {
try {
// Use require with type assertions to avoid dynamic import issues
const premiumModule = require('@premium-frontend/components/FooterLinks');
if (premiumModule.Contact) PremiumContact = premiumModule.Contact;
if (premiumModule.Privacy) PremiumPrivacy = premiumModule.Privacy;
if (premiumModule.Imprint) PremiumImprint = premiumModule.Imprint;
if (premiumModule.Terms) PremiumTerms = premiumModule.Terms;
console.log('✅ Premium components loaded successfully');
} catch (error) {
console.warn('⚠️ Premium components not available, using community fallbacks:', error);
}
}
// Protected Route Component
const ProtectedRoute: React.FC<{ children: React.ReactNode; roles?: string[] }> = ({
children,
@@ -49,11 +81,27 @@ const ProtectedRoute: React.FC<{ children: React.ReactNode; roles?: string[] }>
return <Layout>{children}</Layout>;
};
// Public Route Component (without Layout for footer pages)
const PublicRoute: React.FC<{ children: React.ReactNode }> = ({ children }) => {
const { user, loading } = useAuth();
if (loading) {
return (
<div style={{ textAlign: 'center', padding: '40px' }}>
<div> Lade Anwendung...</div>
</div>
);
}
return user ? <Layout>{children}</Layout> : <>{children}</>;
};
// Main App Content
const AppContent: React.FC = () => {
const { loading, needsSetup, user } = useAuth();
console.log('🏠 AppContent rendering - loading:', loading, 'needsSetup:', needsSetup, 'user:', user);
console.log('🎯 Premium features enabled:', ENABLE_PRO);
// Während des Ladens
if (loading) {
@@ -80,52 +128,32 @@ const AppContent: React.FC = () => {
console.log('✅ Showing protected routes for user:', user.email);
return (
<Routes>
<Route path="/" element={
<ProtectedRoute>
<Dashboard />
</ProtectedRoute>
} />
<Route path="/shift-plans" element={
<ProtectedRoute>
<ShiftPlanList />
</ProtectedRoute>
} />
<Route path="/shift-plans/new" element={
<ProtectedRoute roles={['admin', 'maintenance']}>
<ShiftPlanCreate />
</ProtectedRoute>
} />
<Route path="/shift-plans/:id/edit" element={
<ProtectedRoute roles={['admin', 'maintenance']}>
<ShiftPlanEdit />
</ProtectedRoute>
} />
<Route path="/shift-plans/:id" element={
<ProtectedRoute>
<ShiftPlanView />
</ProtectedRoute>
} />
<Route path="/employees" element={
<ProtectedRoute roles={['admin', 'maintenance']}>
<EmployeeManagement />
</ProtectedRoute>
} />
<Route path="/settings" element={
<ProtectedRoute>
<Settings />
</ProtectedRoute>
} />
<Route path="/help" element={
<ProtectedRoute>
<Help />
</ProtectedRoute>
} />
{/* Protected Routes (require login) */}
<Route path="/" element={<ProtectedRoute><Dashboard /></ProtectedRoute>} />
<Route path="/shift-plans" element={<ProtectedRoute><ShiftPlanList /></ProtectedRoute>} />
<Route path="/shift-plans/new" element={<ProtectedRoute roles={['admin', 'maintenance']}><ShiftPlanCreate /></ProtectedRoute>} />
<Route path="/shift-plans/:id/edit" element={<ProtectedRoute roles={['admin', 'maintenance']}><ShiftPlanEdit /></ProtectedRoute>} />
<Route path="/shift-plans/:id" element={<ProtectedRoute><ShiftPlanView /></ProtectedRoute>} />
<Route path="/employees" element={<ProtectedRoute roles={['admin', 'maintenance']}><EmployeeManagement /></ProtectedRoute>} />
<Route path="/settings" element={<ProtectedRoute><Settings /></ProtectedRoute>} />
<Route path="/help" element={<ProtectedRoute><Help /></ProtectedRoute>} />
{/* Public Footer Link Pages (always available) */}
<Route path="/faq" element={<PublicRoute><FAQ /></PublicRoute>} />
<Route path="/about" element={<PublicRoute><About /></PublicRoute>} />
<Route path="/features" element={<PublicRoute><Features /></PublicRoute>} />
{/* PREMIUM Footer Link Pages (conditionally available) */}
<Route path="/contact" element={<PublicRoute><PremiumContact /></PublicRoute>} />
<Route path="/privacy" element={<PublicRoute><PremiumPrivacy /></PublicRoute>} />
<Route path="/imprint" element={<PublicRoute><PremiumImprint /></PublicRoute>} />
<Route path="/terms" element={<PublicRoute><PremiumTerms /></PublicRoute>} />
{/* Auth Routes */}
<Route path="/login" element={<Login />} />
<Route path="*" element={
<ProtectedRoute>
<Dashboard />
</ProtectedRoute>
} />
{/* Catch-all Route */}
<Route path="*" element={<ProtectedRoute><Dashboard /></ProtectedRoute>} />
</Routes>
);
};

View File

@@ -182,20 +182,6 @@ const Footer: React.FC = () => {
>
Funktionen
</a>
<a
href="/pricing"
style={styles.footerLink}
onMouseEnter={(e) => {
e.currentTarget.style.color = '#FBFAF6';
e.currentTarget.style.transform = 'translateX(4px)';
}}
onMouseLeave={(e) => {
e.currentTarget.style.color = 'rgba(251, 250, 246, 0.7)';
e.currentTarget.style.transform = 'translateX(0)';
}}
>
Preise
</a>
</div>
</div>

View File

@@ -0,0 +1,76 @@
// frontend/src/pages/About/About.tsx
import React from 'react';
const About: React.FC = () => {
return (
<div style={{ padding: '40px 20px', maxWidth: '800px', margin: '0 auto' }}>
<h1>👨💻 Über uns</h1>
<div style={{
backgroundColor: 'white',
borderRadius: '12px',
padding: '30px',
marginTop: '20px',
boxShadow: '0 4px 6px rgba(0,0,0,0.1)',
border: '1px solid #e0e0e0',
lineHeight: 1.6
}}>
<h2 style={{ color: '#2c3e50' }}>Unser Team</h2>
<div style={{ display: 'flex', alignItems: 'center', marginTop: '20px', padding: '20px', backgroundColor: '#f8f9fa', borderRadius: '8px' }}>
<div style={{ marginRight: '20px' }}>
<div style={{
width: '80px',
height: '80px',
backgroundColor: '#3498db',
borderRadius: '50%',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
color: 'white',
fontSize: '2rem',
fontWeight: 'bold'
}}>
P
</div>
</div>
<div>
<h3 style={{ color: '#2c3e50', margin: '0 0 5px 0' }}>Patrick</h3>
<p style={{ color: '#6c757d', margin: '0 0 10px 0' }}>
Full-Stack Developer & Projektleiter
</p>
<p style={{ margin: 0, fontSize: '0.9rem' }}>
GitHub: <a href="https://github.com/donpat1to" style={{ color: '#3498db' }}>donpat1to</a><br/>
E-Mail: <a href="mailto:dev.patrick@inca-vikingo.de" style={{ color: '#3498db' }}>dev.patrick@inca-vikingo.de</a>
</p>
</div>
</div>
<h3 style={{ color: '#3498db', marginTop: '30px' }}>🚀 Unsere Mission</h3>
<p>
Wir entwickeln intelligente Lösungen für die Personalplanung,
die Zeit sparen und faire Schichtverteilung gewährleisten.
</p>
<h3 style={{ color: '#3498db', marginTop: '25px' }}>💻 Technologie</h3>
<p>
Unser Stack umfasst moderne Technologien:
</p>
<ul>
<li>Frontend: React, TypeScript</li>
<li>Backend: Node.js, Express</li>
<li>Optimierung: Google OR-Tools CP-SAT</li>
<li>Datenbank: SQLite/PostgreSQL</li>
</ul>
<h3 style={{ color: '#3498db', marginTop: '25px' }}>📈 Entwicklung</h3>
<p>
Schichtenplaner wird kontinuierlich weiterentwickelt und
basiert auf Feedback unserer Nutzer.
</p>
</div>
</div>
);
};
export default About;

View File

@@ -0,0 +1,37 @@
import React from 'react';
export const CommunityContact: React.FC = () => (
<div style={{ padding: '40px 20px', maxWidth: '800px', margin: '0 auto' }}>
<h1>📞 Kontakt</h1>
<div style={{ backgroundColor: 'white', borderRadius: '12px', padding: '30px', marginTop: '20px' }}>
<h2 style={{ color: '#2c3e50' }}>Community Edition</h2>
<p>Kontaktfunktionen sind in der Premium Edition verfügbar.</p>
<p>
<a href="/features" style={{ color: '#3498db' }}>
Zu den Features
</a>
</p>
</div>
</div>
);
export const CommunityLegalPage: React.FC<{ title: string }> = ({ title }) => (
<div style={{ padding: '40px 20px', maxWidth: '800px', margin: '0 auto' }}>
<h1>📄 {title}</h1>
<div style={{ backgroundColor: 'white', borderRadius: '12px', padding: '30px', marginTop: '20px' }}>
<h2 style={{ color: '#2c3e50' }}>Community Edition</h2>
<p>Rechtliche Dokumentation ist in der Premium Edition verfügbar.</p>
<p>
<a href="/features" style={{ color: '#3498db' }}>
Erfahren Sie mehr über Premium
</a>
</p>
</div>
</div>
);
// Optional: Barrel export für einfachere Imports
export default {
CommunityContact,
CommunityLegalPage
};

View File

@@ -0,0 +1,103 @@
// frontend/src/pages/FAQ/FAQ.tsx
import React, { useState } from 'react';
const FAQ: React.FC = () => {
const [openItems, setOpenItems] = useState<number[]>([]);
const toggleItem = (index: number) => {
setOpenItems(prev =>
prev.includes(index)
? prev.filter(i => i !== index)
: [...prev, index]
);
};
const faqItems = [
{
question: "Wie funktioniert der Scheduling-Algorithmus?",
answer: "Unser System verwendet Google's OR-Tools CP-SAT Solver, um optimale Schichtzuweisungen basierend auf Verfügbarkeiten, Vertragstypen und Geschäftsregeln zu berechnen."
},
{
question: "Was bedeuten die Verfügbarkeits-Level 1, 2 und 3?",
answer: "Level 1: Bevorzugt (Mitarbeiter möchte diese Schicht), Level 2: Verfügbar (kann arbeiten), Level 3: Nicht verfügbar (kann nicht arbeiten)."
},
{
question: "Wie werden Vertragstypen berücksichtigt?",
answer: "Kleine Verträge: 1 Schicht pro Woche, Große Verträge: 2 Schichten pro Woche. Das System weist genau diese Anzahl zu."
},
{
question: "Kann ich manuelle Anpassungen vornehmen?",
answer: "Ja, nach dem automatischen Scheduling können Sie Zuordnungen manuell anpassen und optimieren."
},
{
question: "Was passiert bei unterbesetzten Schichten?",
answer: "Das System zeigt eine Warnung an und versucht, alternative Lösungen zu finden. In kritischen Fällen müssen manuelle Anpassungen vorgenommen werden."
},
{
question: "Wie lange dauert die Planungserstellung?",
answer: "Typischerweise 30-105 Sekunden, abhängig von der Anzahl der Mitarbeiter und Schichten."
}
];
return (
<div style={{ padding: '40px 20px', maxWidth: '800px', margin: '0 auto' }}>
<h1> Häufige Fragen (FAQ)</h1>
<div style={{
backgroundColor: 'white',
borderRadius: '12px',
marginTop: '20px',
boxShadow: '0 4px 6px rgba(0,0,0,0.1)',
border: '1px solid #e0e0e0'
}}>
{faqItems.map((item, index) => (
<div key={index} style={{
borderBottom: index < faqItems.length - 1 ? '1px solid #e0e0e0' : 'none',
padding: '20px 30px'
}}>
<div
onClick={() => toggleItem(index)}
style={{
cursor: 'pointer',
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center'
}}
>
<h3 style={{
color: '#2c3e50',
margin: 0,
fontSize: '1.1rem'
}}>
{item.question}
</h3>
<span style={{
fontSize: '1.5rem',
color: '#3498db',
transform: openItems.includes(index) ? 'rotate(45deg)' : 'rotate(0)',
transition: 'transform 0.2s ease'
}}>
+
</span>
</div>
{openItems.includes(index) && (
<div style={{
marginTop: '15px',
padding: '15px',
backgroundColor: '#f8f9fa',
borderRadius: '8px',
color: '#6c757d',
lineHeight: 1.6
}}>
{item.answer}
</div>
)}
</div>
))}
</div>
</div>
);
};
export default FAQ;

View File

@@ -0,0 +1,111 @@
// frontend/src/pages/Features/Features.tsx
import React from 'react';
const Features: React.FC = () => {
const features = [
{
icon: "🤖",
title: "Automatisches Scheduling",
description: "Intelligenter Algorithmus erstellt optimale Schichtpläne basierend auf Verfügbarkeiten und Regeln"
},
{
icon: "⚡",
title: "Schnelle Berechnung",
description: "Google OR-Tools CP-SAT Solver findet Lösungen in 30-105 Sekunden"
},
{
icon: "👥",
title: "Flexible Regelkonfiguration",
description: "Anpassbare Geschäftsregeln für Trainee-Betreuung, Alleinarbeit, Vertragstypen"
},
{
icon: "📊",
title: "Echtzeit-Validierung",
description: "Automatische Erkennung von Regelverletzungen und Konflikten"
},
{
icon: "🔒",
title: "Lokale Datenspeicherung",
description: "Alle Daten bleiben in Ihrer Infrastruktur - volle Kontrolle und Datenschutz"
},
{
icon: "🎯",
title: "Präferenz-basiert",
description: "Berücksichtigt Mitarbeiterwünsche für höhere Zufriedenheit"
}
];
return (
<div style={{ padding: '40px 20px', maxWidth: '1000px', margin: '0 auto' }}>
<h1> Funktionen</h1>
<div style={{
backgroundColor: 'white',
borderRadius: '12px',
padding: '30px',
marginTop: '20px',
boxShadow: '0 4px 6px rgba(0,0,0,0.1)',
border: '1px solid #e0e0e0'
}}>
<h2 style={{ color: '#2c3e50', textAlign: 'center', marginBottom: '40px' }}>
Alles, was Sie für die perfekte Schichtplanung benötigen
</h2>
<div style={{
display: 'grid',
gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))',
gap: '30px'
}}>
{features.map((feature, index) => (
<div key={index} style={{
padding: '25px',
backgroundColor: '#f8f9fa',
borderRadius: '12px',
border: '2px solid #e9ecef',
textAlign: 'center',
transition: 'transform 0.2s ease, box-shadow 0.2s ease'
}}>
<div style={{
fontSize: '3rem',
marginBottom: '15px'
}}>
{feature.icon}
</div>
<h3 style={{
color: '#2c3e50',
margin: '0 0 15px 0'
}}>
{feature.title}
</h3>
<p style={{
color: '#6c757d',
margin: 0,
lineHeight: 1.5
}}>
{feature.description}
</p>
</div>
))}
</div>
<div style={{
marginTop: '40px',
padding: '25px',
backgroundColor: '#e8f4fd',
borderRadius: '12px',
border: '2px solid #b8d4f0',
textAlign: 'center'
}}>
<h3 style={{ color: '#2980b9', margin: '0 0 15px 0' }}>
🚀 Starter Sie durch
</h3>
<p style={{ color: '#2c3e50', margin: 0 }}>
Erstellen Sie Ihren ersten optimierten Schichtplan in wenigen Minuten.
</p>
</div>
</div>
</div>
);
};
export default Features;

View File

@@ -20,7 +20,7 @@ interface AuthContextType {
}
const AuthContext = createContext<AuthContextType | undefined>(undefined);
const API_BASE_URL = process.env.REACT_APP_API_BASE_URL || 'http://localhost:3002/api';
const API_BASE_URL = process.env.REACT_APP_API_BASE_URL || '/api';
interface AuthProviderProps {
children: ReactNode;

View File

@@ -1,17 +1,20 @@
// frontend/src/pages/Auth/Login.tsx - KORRIGIERT
import React, { useState, useEffect } from 'react';
// frontend/src/pages/Auth/Login.tsx - UPDATED PASSWORD SECTION
import React, { useState, useEffect, useRef } from 'react';
import { useNavigate } from 'react-router-dom';
import { useAuth } from '../../contexts/AuthContext';
import { useNotification } from '../../contexts/NotificationContext';
import { employeeService } from '../../services/employeeService';
const Login: React.FC = () => {
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const [showPassword, setShowPassword] = useState(false);
const [loading, setLoading] = useState(false);
const { login, user } = useAuth();
const { showNotification } = useNotification();
const navigate = useNavigate();
const holdTimeoutRef = useRef<NodeJS.Timeout | null>(null);
const passwordInputRef = useRef<HTMLInputElement>(null);
useEffect(() => {
if (user) {
@@ -20,6 +23,47 @@ const Login: React.FC = () => {
}
}, [user, navigate]);
// Cleanup timeouts on unmount
useEffect(() => {
return () => {
if (holdTimeoutRef.current) {
clearTimeout(holdTimeoutRef.current);
}
};
}, []);
const handleMouseDown = () => {
// Start timeout to show password after a brief delay (300ms)
holdTimeoutRef.current = setTimeout(() => {
setShowPassword(true);
}, 300);
};
const handleMouseUp = () => {
// Clear the timeout if user releases before delay completes
if (holdTimeoutRef.current) {
clearTimeout(holdTimeoutRef.current);
holdTimeoutRef.current = null;
}
// Always hide password on release
setShowPassword(false);
};
const handleTouchStart = (e: React.TouchEvent) => {
e.preventDefault(); // Prevent context menu on mobile
handleMouseDown();
};
const handleTouchEnd = (e: React.TouchEvent) => {
e.preventDefault();
handleMouseUp();
};
// Prevent context menu on long press
const handleContextMenu = (e: React.MouseEvent) => {
e.preventDefault();
};
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
setLoading(true);
@@ -35,7 +79,6 @@ const Login: React.FC = () => {
message: `Willkommen zurück!`
});
// Navigiere zur Startseite
navigate('/');
} catch (error: any) {
@@ -50,7 +93,6 @@ const Login: React.FC = () => {
}
};
// Wenn bereits eingeloggt, zeige Ladeanzeige
if (user) {
return (
<div style={{ textAlign: 'center', padding: '40px' }}>
@@ -77,7 +119,7 @@ const Login: React.FC = () => {
}}>
<h2 style={{ textAlign: 'center', marginBottom: '30px' }}>Anmeldung</h2>
<div style={{ marginBottom: '20px' }}>
<div style={{ marginBottom: '20px', width: '100%' }}>
<label style={{ display: 'block', marginBottom: '8px', fontWeight: 'bold' }}>
E-Mail
</label>
@@ -87,7 +129,7 @@ const Login: React.FC = () => {
onChange={(e) => setEmail(e.target.value)}
required
style={{
width: '100%',
width: '94.5%',
padding: '10px',
border: '1px solid #ddd',
borderRadius: '4px',
@@ -97,24 +139,57 @@ const Login: React.FC = () => {
/>
</div>
<div style={{ marginBottom: '30px' }}>
<div style={{ marginBottom: '30px', width: '100%' }}>
<label style={{ display: 'block', marginBottom: '8px', fontWeight: 'bold' }}>
Passwort
</label>
<input
type="password"
value={password}
onChange={(e) => setPassword(e.target.value)}
required
style={{
width: '100%',
padding: '10px',
border: '1px solid #ddd',
borderRadius: '4px',
fontSize: '16px'
}}
placeholder="Ihr Passwort"
/>
<div style={{ position: 'relative' }}>
<input
ref={passwordInputRef}
type={showPassword ? 'text' : 'password'}
value={password}
onChange={(e) => setPassword(e.target.value)}
required
style={{
width: '94.5%',
padding: '10px',
paddingRight: '10px',
border: '1px solid #ddd',
borderRadius: '4px',
fontSize: '16px'
}}
placeholder="Ihr Passwort"
/>
<button
type="button"
onMouseDown={handleMouseDown}
onMouseUp={handleMouseUp}
onMouseLeave={handleMouseUp} // Handle mouse leaving while pressed
onTouchStart={handleTouchStart}
onTouchEnd={handleTouchEnd}
onTouchCancel={handleTouchEnd} // Handle touch cancellation
onContextMenu={handleContextMenu}
style={{
position: 'absolute',
right: '10px',
top: '50%',
transform: 'translateY(-50%)',
background: 'none',
border: 'none',
cursor: 'pointer',
padding: '1px',
borderRadius: '1px',
backgroundColor: showPassword ? '#e0e0e0' : 'transparent',
transition: 'background-color 0.2s',
userSelect: 'none',
WebkitUserSelect: 'none',
touchAction: 'manipulation'
}}
title="Gedrückt halten zum Anzeigen des Passworts"
>
{showPassword ? '👁' : '👁'}
</button>
</div>
</div>
<button
@@ -123,7 +198,7 @@ const Login: React.FC = () => {
style={{
width: '100%',
padding: '12px',
backgroundColor: loading ? '#ccc' : '#007bff',
backgroundColor: loading ? '#ccc' : '#51258f',
color: 'white',
border: 'none',
borderRadius: '4px',

View File

@@ -1,81 +1,46 @@
// frontend/src/pages/Help/Help.tsx
import React, { useState, useEffect } from 'react';
import React from 'react';
const Help: React.FC = () => {
const [currentStage, setCurrentStage] = useState(0);
const [isAnimating, setIsAnimating] = useState(false);
const businessRules = [
{ rule: "Mitarbeiter werden nur Schichten zugewiesen, für die sie sich eingetragen haben", critical: true },
{ rule: "Maximal 1 Schicht pro Tag pro Mitarbeiter", critical: true },
{ rule: "Schichten haben Mindest- und Maximalkapazitäten", critical: true },
{ rule: "Trainees benötigen erfahrene Begleitung in jeder Schicht", critical: true },
{ rule: "Mitarbeiter, die nicht alleine arbeiten können, müssen Begleitung haben", critical: true },
{ rule: "Vertragslimits: Klein=1 Schicht/Woche, Groß=2 Schichten/Woche", critical: true },
{ rule: "Manager werden automatisch ihren bevorzugten Schichten zugewiesen", critical: false }
];
const algorithmStages = [
const schedulingStages = [
{
title: "📊 Phase A: Reguläre Mitarbeiterplanung",
description: "Zuweisung aller Mitarbeiter außer Manager",
steps: [
"Grundabdeckung: Mindestens 1 Mitarbeiter pro Schicht",
"Erfahrene Mitarbeiter werden bevorzugt",
"Verhindere 'Neu allein' Situationen",
"Fülle Schichten bis zur Zielbesetzung"
],
color: "#3498db"
title: "1. Verfügbarkeitsprüfung",
description: "Nur Mitarbeiter, die sich für Schichten eingetragen haben (Verfügbarkeit 1 oder 2), werden berücksichtigt."
},
{
title: "👑 Phase B: Manager-Einfügung",
description: "Manager wird seinen bevorzugten Schichten zugewiesen",
steps: [
"Manager wird festen Schichten zugewiesen",
"Erfahrene Mitarbeiter werden zu Manager-Schichten hinzugefügt",
"Bei Problemen: Austausch oder Bewegung von Mitarbeitern",
"Fallback: Nicht-erfahrene als Backup"
],
color: "#e74c3c"
title: "2. Modellaufbau",
description: "Das System erstellt ein mathematisches Modell mit allen Variablen und Constraints."
},
{
title: "🔧 Phase C: Reparatur & Validierung",
description: "Probleme erkennen und automatisch beheben",
steps: [
"Überbesetzte erfahrene Mitarbeiter identifizieren",
"Mitarbeiter-Pool für Neuverteilung erstellen",
"Priorisierte Zuweisung zu Problem-Schichten",
"Finale Validierung aller Geschäftsregeln"
],
color: "#2ecc71"
title: "3. CP-SAT Optimierung",
description: "Google's Constraint Programming Solver findet die beste Zuordnung unter allen Regeln."
},
{
title: "✅ Finale Prüfung",
description: "Zusammenfassung und Freigabe",
steps: [
"Reparatur-Bericht generieren",
"Kritische vs. nicht-kritische Probleme klassifizieren",
"Veröffentlichungsstatus bestimmen",
"Benutzerfreundliche Zusammenfassung anzeigen"
],
color: "#f39c12"
title: "4. Manager-Zuweisung",
description: "Manager werden automatisch ihren Wunschschichten (Verfügbarkeit 1) zugeordnet."
},
{
title: "5. Validierung",
description: "Die Lösung wird auf Regelverletzungen geprüft und ein Bericht generiert."
}
];
const businessRules = [
{ rule: "Manager darf nicht allein arbeiten", critical: true },
{ rule: "Erfahrene mit canWorkAlone: false dürfen nicht allein arbeiten", critical: true },
{ rule: "Keine leeren Schichten", critical: true },
{ rule: "Keine 'Neu allein' Situationen", critical: true },
{ rule: "Manager sollte mit erfahrenem Mitarbeiter arbeiten", critical: false },
{ rule: "Vertragslimits einhalten", critical: true },
{ rule: "Nicht zu viele erfahrene Mitarbeiter in einer Schicht", critical: false }
const preferenceLevels = [
{ level: 1, label: "Bevorzugt", description: "Mitarbeiter möchte diese Schicht unbedingt arbeiten", color: "#27ae60" },
{ level: 2, label: "Verfügbar", description: "Mitarbeiter ist verfügbar für diese Schicht", color: "#f39c12" },
{ level: 3, label: "Nicht verfügbar", description: "Mitarbeiter kann diese Schicht nicht arbeiten", color: "#e74c3c" }
];
useEffect(() => {
const interval = setInterval(() => {
if (isAnimating) {
setCurrentStage((prev) => (prev + 1) % algorithmStages.length);
}
}, 3000);
return () => clearInterval(interval);
}, [isAnimating]);
const toggleAnimation = () => {
setIsAnimating(!isAnimating);
};
return (
<div style={{ padding: '20px', maxWidth: '1200px', margin: '0 auto' }}>
<h1> Hilfe & Support - Scheduling Algorithmus</h1>
@@ -89,7 +54,7 @@ const Help: React.FC = () => {
boxShadow: '0 4px 6px rgba(0,0,0,0.1)',
border: '1px solid #e0e0e0'
}}>
<h2 style={{ color: '#2c3e50', marginBottom: '20px' }}>📋 Validierungs Regeln</h2>
<h2 style={{ color: '#2c3e50', marginBottom: '20px' }}>📋 Geschäftsregeln</h2>
<div style={{ display: 'grid', gap: '10px' }}>
{businessRules.map((rule, index) => (
<div
@@ -120,14 +85,14 @@ const Help: React.FC = () => {
color: rule.critical ? '#e74c3c' : '#f39c12',
fontWeight: 'bold'
}}>
{rule.critical ? 'KRITISCH' : 'WARNUNG'}
{rule.critical ? 'HART' : 'WEICH'}
</span>
</div>
))}
</div>
</div>
{/* Algorithm Explanation */}
{/* Scheduling Process */}
<div style={{
backgroundColor: 'white',
borderRadius: '12px',
@@ -136,45 +101,125 @@ const Help: React.FC = () => {
boxShadow: '0 4px 6px rgba(0,0,0,0.1)',
border: '1px solid #e0e0e0'
}}>
<h2 style={{ color: '#2c3e50', marginBottom: '20px' }}>🎯 Wie der Algorithmus funktioniert</h2>
<h2 style={{ color: '#2c3e50', marginBottom: '20px' }}> Scheduling-Prozess</h2>
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))', gap: '20px' }}>
<div>
<h4 style={{ color: '#3498db' }}>🏗 Phasen-basierter Ansatz</h4>
<p>Der Algorithmus arbeitet in klar definierten Phasen, um komplexe Probleme schrittweise zu lösen und Stabilität zu gewährleisten.</p>
</div>
</div>
<div style={{ display: 'grid', gap: '15px' }}>
{schedulingStages.map((stage, index) => (
<div key={index} style={{
padding: '20px',
backgroundColor: '#f8f9fa',
borderRadius: '8px',
border: '2px solid #e9ecef',
display: 'flex',
alignItems: 'flex-start'
}}>
<div style={{
backgroundColor: '#3498db',
color: 'white',
borderRadius: '50%',
width: '30px',
height: '30px',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
fontWeight: 'bold',
marginRight: '15px',
flexShrink: 0
}}>
{index + 1}
</div>
<div>
<h4 style={{ color: '#2c3e50', margin: '0 0 8px 0' }}>{stage.title}</h4>
<p style={{ color: '#6c757d', margin: 0 }}>{stage.description}</p>
</div>
</div>
))}
</div>
</div>
{/* Preference Levels */}
<div style={{
marginTop: '25px',
padding: '20px',
backgroundColor: '#e8f4fd',
borderRadius: '8px',
border: '1px solid #b8d4f0'
}}>
<h4 style={{ color: '#2980b9', marginTop: 0 }}>💡 Tipps für beste Ergebnisse</h4>
<ul style={{ margin: 0, paddingLeft: '20px' }}>
<li>Stellen Sie sicher, dass alle Mitarbeiter ihre Verfügbarkeit eingetragen haben</li>
<li>Überprüfen Sie die Vertragstypen (klein = 1 Schicht/Woche, groß = 2 Schichten/Woche)</li>
<li>Markieren Sie erfahrene Mitarbeiter, die alleine arbeiten können</li>
<li>Planen Sie Manager-Verfügbarkeit im Voraus</li>
</ul>
</div>
<style>{`
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.02); }
100% { transform: scale(1); }
}
backgroundColor: 'white',
borderRadius: '12px',
padding: '30px',
marginTop: '20px',
boxShadow: '0 4px 6px rgba(0,0,0,0.1)',
border: '1px solid #e0e0e0'
}}>
<h2 style={{ color: '#2c3e50', marginBottom: '20px' }}>🎯 Verfügbarkeits-Level</h2>
@keyframes glow {
0% { box-shadow: 0 0 5px rgba(52, 152, 219, 0.5); }
50% { box-shadow: 0 0 20px rgba(52, 152, 219, 0.8); }
100% { box-shadow: 0 0 5px rgba(52, 152, 219, 0.5); }
}
`}</style>
<div style={{ display: 'grid', gap: '12px' }}>
{preferenceLevels.map((pref) => (
<div key={pref.level} style={{
padding: '15px',
backgroundColor: `${pref.color}15`,
border: `2px solid ${pref.color}`,
borderRadius: '8px',
display: 'flex',
alignItems: 'center'
}}>
<div style={{
backgroundColor: pref.color,
color: 'white',
borderRadius: '6px',
padding: '8px 12px',
fontWeight: 'bold',
marginRight: '15px',
minWidth: '120px',
textAlign: 'center'
}}>
Level {pref.level}: {pref.label}
</div>
<span style={{ color: '#2c3e50' }}>{pref.description}</span>
</div>
))}
</div>
</div>
{/* Tips */}
<div style={{
marginTop: '25px',
padding: '25px',
backgroundColor: '#e8f4fd',
borderRadius: '12px',
border: '2px solid #b8d4f0'
}}>
<h3 style={{ color: '#2980b9', marginTop: 0 }}>💡 Best Practices für erfolgreiches Scheduling</h3>
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))', gap: '15px', marginTop: '15px' }}>
<div>
<h4 style={{ color: '#2980b9' }}>Vor dem Scheduling</h4>
<ul style={{ margin: 0, paddingLeft: '20px', color: '#2c3e50' }}>
<li>Stellen Sie sicher, dass alle Mitarbeiter ihre Verfügbarkeit eingetragen haben</li>
<li>Überprüfen Sie die Mitarbeiterprofile (Trainee/Erfahren, Alleinarbeit möglich)</li>
<li>Bestätigen Sie die Vertragstypen und Schichtanforderungen</li>
</ul>
</div>
<div>
<h4 style={{ color: '#2980b9' }}>Nach dem Scheduling</h4>
<ul style={{ margin: 0, paddingLeft: '20px', color: '#2c3e50' }}>
<li>Prüfen Sie den Lösungsbericht auf Verletzungen</li>
<li>Kontrollieren Sie unterbesetzte Schichten</li>
<li>Validieren Sie Trainee-Betreuung und Alleinarbeits-Regeln</li>
</ul>
</div>
</div>
</div>
{/* Technical Info */}
<div style={{
marginTop: '25px',
padding: '20px',
backgroundColor: '#fff3cd',
borderRadius: '8px',
border: '1px solid #ffeaa7'
}}>
<h4 style={{ color: '#856404', marginTop: 0 }}>🔧 Technische Informationen</h4>
<p style={{ color: '#856404', margin: 0 }}>
<strong>Lösungsalgorithmus:</strong> Google OR-Tools CP-SAT Solver
<strong> Fallback:</strong> TypeScript-basierter Solver
<strong> Maximale Laufzeit:</strong> 105 Sekunden
</p>
</div>
</div>
);
};

View File

@@ -1,5 +1,5 @@
// frontend/src/pages/Settings/Settings.tsx
import React, { useState, useEffect } from 'react';
// frontend/src/pages/Settings/Settings.tsx - UPDATED WITH NEW STYLES
import React, { useState, useEffect, useRef } from 'react';
import { useAuth } from '../../contexts/AuthContext';
import { employeeService } from '../../services/employeeService';
import { useNotification } from '../../contexts/NotificationContext';
@@ -27,6 +27,16 @@ const Settings: React.FC = () => {
confirmPassword: ''
});
// Password visibility states
const [showCurrentPassword, setShowCurrentPassword] = useState(false);
const [showNewPassword, setShowNewPassword] = useState(false);
const [showConfirmPassword, setShowConfirmPassword] = useState(false);
// Refs for timeout management
const currentPasswordTimeoutRef = useRef<NodeJS.Timeout | null>(null);
const newPasswordTimeoutRef = useRef<NodeJS.Timeout | null>(null);
const confirmPasswordTimeoutRef = useRef<NodeJS.Timeout | null>(null);
useEffect(() => {
if (currentUser) {
setProfileForm({
@@ -36,6 +46,17 @@ const Settings: React.FC = () => {
}
}, [currentUser]);
// Cleanup timeouts on unmount
useEffect(() => {
return () => {
[currentPasswordTimeoutRef, newPasswordTimeoutRef, confirmPasswordTimeoutRef].forEach(ref => {
if (ref.current) {
clearTimeout(ref.current);
}
});
};
}, []);
const handleProfileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const { name, value } = e.target;
setProfileForm(prev => ({
@@ -52,6 +73,67 @@ const Settings: React.FC = () => {
}));
};
// Password visibility handlers for current password
const handleCurrentPasswordMouseDown = () => {
currentPasswordTimeoutRef.current = setTimeout(() => {
setShowCurrentPassword(true);
}, 300);
};
const handleCurrentPasswordMouseUp = () => {
if (currentPasswordTimeoutRef.current) {
clearTimeout(currentPasswordTimeoutRef.current);
currentPasswordTimeoutRef.current = null;
}
setShowCurrentPassword(false);
};
// Password visibility handlers for new password
const handleNewPasswordMouseDown = () => {
newPasswordTimeoutRef.current = setTimeout(() => {
setShowNewPassword(true);
}, 300);
};
const handleNewPasswordMouseUp = () => {
if (newPasswordTimeoutRef.current) {
clearTimeout(newPasswordTimeoutRef.current);
newPasswordTimeoutRef.current = null;
}
setShowNewPassword(false);
};
// Password visibility handlers for confirm password
const handleConfirmPasswordMouseDown = () => {
confirmPasswordTimeoutRef.current = setTimeout(() => {
setShowConfirmPassword(true);
}, 300);
};
const handleConfirmPasswordMouseUp = () => {
if (confirmPasswordTimeoutRef.current) {
clearTimeout(confirmPasswordTimeoutRef.current);
confirmPasswordTimeoutRef.current = null;
}
setShowConfirmPassword(false);
};
// Touch event handlers
const handleTouchStart = (setter: () => void) => (e: React.TouchEvent) => {
e.preventDefault();
setter();
};
const handleTouchEnd = (cleanup: () => void) => (e: React.TouchEvent) => {
e.preventDefault();
cleanup();
};
// Prevent context menu
const handleContextMenu = (e: React.MouseEvent) => {
e.preventDefault();
};
const handleProfileUpdate = async (e: React.FormEvent) => {
e.preventDefault();
if (!currentUser) return;
@@ -180,11 +262,6 @@ const Settings: React.FC = () => {
);
}
// Get full name for display
const getFullName = () => {
return `${currentUser.firstname || ''} ${currentUser.lastname || ''}`.trim();
};
return (
<div style={styles.container}>
{/* Left Sidebar with Tabs */}
@@ -443,77 +520,137 @@ const Settings: React.FC = () => {
<form onSubmit={handlePasswordUpdate} style={{ marginTop: '2rem' }}>
<div style={styles.formGridCompact}>
{/* Current Password Field */}
<div style={styles.field}>
<label style={styles.fieldLabel}>
Aktuelles Passwort *
</label>
<input
type="password"
name="currentPassword"
value={passwordForm.currentPassword}
onChange={handlePasswordChange}
required
style={styles.fieldInput}
placeholder="Aktuelles Passwort"
onFocus={(e) => {
e.target.style.borderColor = '#1a1325';
e.target.style.boxShadow = '0 0 0 3px rgba(26, 19, 37, 0.1)';
}}
onBlur={(e) => {
e.target.style.borderColor = '#e8e8e8';
e.target.style.boxShadow = 'none';
}}
/>
<div style={styles.fieldInputContainer}>
<input
type={showCurrentPassword ? 'text' : 'password'}
name="currentPassword"
value={passwordForm.currentPassword}
onChange={handlePasswordChange}
required
style={styles.fieldInputWithIcon}
placeholder="Aktuelles Passwort"
onFocus={(e) => {
e.target.style.borderColor = '#1a1325';
e.target.style.boxShadow = '0 0 0 3px rgba(26, 19, 37, 0.1)';
}}
onBlur={(e) => {
e.target.style.borderColor = '#e8e8e8';
e.target.style.boxShadow = 'none';
}}
/>
<button
type="button"
onMouseDown={handleCurrentPasswordMouseDown}
onMouseUp={handleCurrentPasswordMouseUp}
onMouseLeave={handleCurrentPasswordMouseUp}
onTouchStart={handleTouchStart(handleCurrentPasswordMouseDown)}
onTouchEnd={handleTouchEnd(handleCurrentPasswordMouseUp)}
onTouchCancel={handleTouchEnd(handleCurrentPasswordMouseUp)}
onContextMenu={handleContextMenu}
style={{
...styles.passwordToggleButton,
backgroundColor: showCurrentPassword ? 'rgba(26, 19, 37, 0.1)' : 'transparent'
}}
title="Gedrückt halten zum Anzeigen des Passworts"
>
{showCurrentPassword ? '👁' : '👁'}
</button>
</div>
</div>
{/* New Password Field */}
<div style={styles.field}>
<label style={styles.fieldLabel}>
Neues Passwort *
</label>
<input
type="password"
name="newPassword"
value={passwordForm.newPassword}
onChange={handlePasswordChange}
required
minLength={6}
style={styles.fieldInput}
placeholder="Mindestens 6 Zeichen"
onFocus={(e) => {
e.target.style.borderColor = '#1a1325';
e.target.style.boxShadow = '0 0 0 3px rgba(26, 19, 37, 0.1)';
}}
onBlur={(e) => {
e.target.style.borderColor = '#e8e8e8';
e.target.style.boxShadow = 'none';
}}
/>
<div style={styles.fieldInputContainer}>
<input
type={showNewPassword ? 'text' : 'password'}
name="newPassword"
value={passwordForm.newPassword}
onChange={handlePasswordChange}
required
minLength={6}
style={styles.fieldInputWithIcon}
placeholder="Mindestens 6 Zeichen"
onFocus={(e) => {
e.target.style.borderColor = '#1a1325';
e.target.style.boxShadow = '0 0 0 3px rgba(26, 19, 37, 0.1)';
}}
onBlur={(e) => {
e.target.style.borderColor = '#e8e8e8';
e.target.style.boxShadow = 'none';
}}
/>
<button
type="button"
onMouseDown={handleNewPasswordMouseDown}
onMouseUp={handleNewPasswordMouseUp}
onMouseLeave={handleNewPasswordMouseUp}
onTouchStart={handleTouchStart(handleNewPasswordMouseDown)}
onTouchEnd={handleTouchEnd(handleNewPasswordMouseUp)}
onTouchCancel={handleTouchEnd(handleNewPasswordMouseUp)}
onContextMenu={handleContextMenu}
style={{
...styles.passwordToggleButton,
backgroundColor: showNewPassword ? 'rgba(26, 19, 37, 0.1)' : 'transparent'
}}
title="Gedrückt halten zum Anzeigen des Passworts"
>
{showNewPassword ? '👁' : '👁'}
</button>
</div>
<div style={styles.fieldHint}>
Das Passwort muss mindestens 6 Zeichen lang sein.
</div>
</div>
{/* Confirm Password Field */}
<div style={styles.field}>
<label style={styles.fieldLabel}>
Neues Passwort bestätigen *
</label>
<input
type="password"
name="confirmPassword"
value={passwordForm.confirmPassword}
onChange={handlePasswordChange}
required
style={styles.fieldInput}
placeholder="Passwort wiederholen"
onFocus={(e) => {
e.target.style.borderColor = '#1a1325';
e.target.style.boxShadow = '0 0 0 3px rgba(26, 19, 37, 0.1)';
}}
onBlur={(e) => {
e.target.style.borderColor = '#e8e8e8';
e.target.style.boxShadow = 'none';
}}
/>
<div style={styles.fieldInputContainer}>
<input
type={showConfirmPassword ? 'text' : 'password'}
name="confirmPassword"
value={passwordForm.confirmPassword}
onChange={handlePasswordChange}
required
style={styles.fieldInputWithIcon}
placeholder="Passwort wiederholen"
onFocus={(e) => {
e.target.style.borderColor = '#1a1325';
e.target.style.boxShadow = '0 0 0 3px rgba(26, 19, 37, 0.1)';
}}
onBlur={(e) => {
e.target.style.borderColor = '#e8e8e8';
e.target.style.boxShadow = 'none';
}}
/>
<button
type="button"
onMouseDown={handleConfirmPasswordMouseDown}
onMouseUp={handleConfirmPasswordMouseUp}
onMouseLeave={handleConfirmPasswordMouseUp}
onTouchStart={handleTouchStart(handleConfirmPasswordMouseDown)}
onTouchEnd={handleTouchEnd(handleConfirmPasswordMouseUp)}
onTouchCancel={handleTouchEnd(handleConfirmPasswordMouseUp)}
onContextMenu={handleContextMenu}
style={{
...styles.passwordToggleButton,
backgroundColor: showConfirmPassword ? 'rgba(26, 19, 37, 0.1)' : 'transparent'
}}
title="Gedrückt halten zum Anzeigen des Passworts"
>
{showConfirmPassword ? '👁' : '👁'}
</button>
</div>
</div>
</div>

View File

@@ -1,4 +1,5 @@
export const styles = {
// frontend/src/pages/Settings/type/SettingsType.tsx - CORRECTED
export const styles = {
container: {
display: 'flex',
minHeight: 'calc(100vh - 120px)',
@@ -121,11 +122,17 @@
display: 'flex',
flexDirection: 'column' as const,
gap: '0.5rem',
width: '100%',
},
fieldLabel: {
fontSize: '0.9rem',
fontWeight: 600,
color: '#161718',
width: '100%',
},
fieldInputContainer: {
position: 'relative' as const,
width: '100%',
},
fieldInput: {
padding: '0.875rem 1rem',
@@ -135,6 +142,20 @@
background: '#FBFAF6',
transition: 'all 0.3s cubic-bezier(0.4, 0, 0.2, 1)',
color: '#161718',
width: '100%',
boxSizing: 'border-box' as const,
},
fieldInputWithIcon: {
padding: '0.875rem 1rem',
border: '1.5px solid #e8e8e8',
borderRadius: '8px',
fontSize: '0.95rem',
background: '#FBFAF6',
transition: 'all 0.3s cubic-bezier(0.4, 0, 0.2, 1)',
color: '#161718',
width: '100%',
paddingRight: '40px',
boxSizing: 'border-box' as const,
},
fieldInputDisabled: {
padding: '0.875rem 1rem',
@@ -144,11 +165,29 @@
background: 'rgba(26, 19, 37, 0.05)',
color: '#666',
cursor: 'not-allowed',
width: '100%',
boxSizing: 'border-box' as const,
},
fieldHint: {
fontSize: '0.8rem',
color: '#888',
marginTop: '0.25rem',
width: '100%',
},
passwordToggleButton: {
position: 'absolute' as const,
right: '10px',
top: '50%',
transform: 'translateY(-50%)',
background: 'none',
border: 'none',
cursor: 'pointer',
padding: '5px',
borderRadius: '4px',
transition: 'background-color 0.2s',
userSelect: 'none' as const,
WebkitUserSelect: 'none' as const,
touchAction: 'manipulation' as const,
},
actions: {
display: 'flex',

View File

@@ -2,6 +2,8 @@
import React, { useState } from 'react';
import { useAuth } from '../../contexts/AuthContext';
const API_BASE_URL = '/api';
const Setup: React.FC = () => {
const [step, setStep] = useState(1);
const [formData, setFormData] = useState({
@@ -73,7 +75,7 @@ const Setup: React.FC = () => {
console.log('🚀 Sending setup request...', payload);
const response = await fetch('http://localhost:3002/api/setup/admin', {
const response = await fetch(`${API_BASE_URL}/setup/admin`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',

View File

@@ -1,6 +1,6 @@
// frontend/src/services/authService.ts
import { Employee } from '../models/Employee';
const API_BASE = process.env.REACT_APP_API_BASE_URL || 'http://localhost:3002/api';
const API_BASE = process.env.REACT_APP_API_BASE_URL || '/api';
export interface LoginRequest {
email: string;

View File

@@ -1,7 +1,7 @@
// frontend/src/services/employeeService.ts
import { Employee, CreateEmployeeRequest, UpdateEmployeeRequest, EmployeeAvailability } from '../models/Employee';
const API_BASE_URL = 'http://localhost:3002/api';
const API_BASE_URL = '/api';
const getAuthHeaders = () => {
const token = localStorage.getItem('token');

View File

@@ -4,9 +4,7 @@ import { Employee, EmployeeAvailability } from '../models/Employee';
import { authService } from './authService';
import { AssignmentResult, ScheduleRequest } from '../models/scheduling';
const API_BASE_URL = 'http://localhost:3002/api';
const API_BASE_URL = '/api';
// Helper function to get auth headers
const getAuthHeaders = () => {

View File

@@ -3,7 +3,7 @@ import { authService } from './authService';
import { ShiftPlan, CreateShiftPlanRequest, ScheduledShift, CreateShiftFromTemplateRequest } from '../models/ShiftPlan';
import { TEMPLATE_PRESETS } from '../models/defaults/shiftPlanDefaults';
const API_BASE = 'http://localhost:3002/api/shift-plans';
const API_BASE_URL = '/api/shift-plans';
// Helper function to get auth headers
const getAuthHeaders = () => {
@@ -25,7 +25,7 @@ const handleResponse = async (response: Response) => {
export const shiftPlanService = {
async getShiftPlans(): Promise<ShiftPlan[]> {
const response = await fetch(API_BASE, {
const response = await fetch(API_BASE_URL, {
headers: {
'Content-Type': 'application/json',
...authService.getAuthHeaders()
@@ -50,7 +50,7 @@ export const shiftPlanService = {
},
async getShiftPlan(id: string): Promise<ShiftPlan> {
const response = await fetch(`${API_BASE}/${id}`, {
const response = await fetch(`${API_BASE_URL}/${id}`, {
headers: {
'Content-Type': 'application/json',
...authService.getAuthHeaders()
@@ -69,7 +69,7 @@ export const shiftPlanService = {
},
async createShiftPlan(plan: CreateShiftPlanRequest): Promise<ShiftPlan> {
const response = await fetch(API_BASE, {
const response = await fetch(API_BASE_URL, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
@@ -90,7 +90,7 @@ export const shiftPlanService = {
},
async updateShiftPlan(id: string, plan: Partial<ShiftPlan>): Promise<ShiftPlan> {
const response = await fetch(`${API_BASE}/${id}`, {
const response = await fetch(`${API_BASE_URL}/${id}`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
@@ -111,7 +111,7 @@ export const shiftPlanService = {
},
async deleteShiftPlan(id: string): Promise<void> {
const response = await fetch(`${API_BASE}/${id}`, {
const response = await fetch(`${API_BASE_URL}/${id}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
@@ -130,7 +130,7 @@ export const shiftPlanService = {
// Get specific template or plan
getTemplate: async (id: string): Promise<ShiftPlan> => {
const response = await fetch(`${API_BASE}/${id}`, {
const response = await fetch(`${API_BASE_URL}/${id}`, {
headers: getAuthHeaders()
});
return handleResponse(response);
@@ -142,7 +142,7 @@ export const shiftPlanService = {
console.log('🔄 Attempting to regenerate scheduled shifts...');
// You'll need to add this API endpoint to your backend
const response = await fetch(`${API_BASE}/${planId}/regenerate-shifts`, {
const response = await fetch(`${API_BASE_URL}/${planId}/regenerate-shifts`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
@@ -162,7 +162,7 @@ export const shiftPlanService = {
// Create new plan
createPlan: async (data: CreateShiftPlanRequest): Promise<ShiftPlan> => {
const response = await fetch(`${API_BASE}`, {
const response = await fetch(`${API_BASE_URL}`, {
method: 'POST',
headers: getAuthHeaders(),
body: JSON.stringify(data),
@@ -177,7 +177,7 @@ export const shiftPlanService = {
endDate: string;
isTemplate?: boolean;
}): Promise<ShiftPlan> => {
const response = await fetch(`${API_BASE}/from-preset`, {
const response = await fetch(`${API_BASE_URL}/from-preset`, {
method: 'POST',
headers: getAuthHeaders(),
body: JSON.stringify(data),
@@ -204,7 +204,7 @@ export const shiftPlanService = {
try {
console.log('🔄 Clearing assignments for plan:', planId);
const response = await fetch(`${API_BASE}/${planId}/clear-assignments`, {
const response = await fetch(`${API_BASE_URL}/${planId}/clear-assignments`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',

20128
package-lock.json generated

File diff suppressed because it is too large Load Diff

23
package.json Normal file
View File

@@ -0,0 +1,23 @@
{
"name": "schichtenplaner-monorepo",
"private": true,
"workspaces": [
"frontend",
"backend",
"premium"
],
"scripts": {
"dev:frontend": "cd frontend && npm run dev",
"dev:backend": "cd backend && npm run dev",
"build:all": "npm run build:premium && npm run build:backend && npm run build:frontend",
"build:premium": "cd premium && npm run build",
"build:backend": "cd backend && npm run build",
"build:frontend": "cd frontend && npm run build",
"type-check": "npm run type-check:all",
"type-check:all": "cd premium && npx tsc --noEmit && cd ../backend && npx tsc --noEmit && cd ../frontend && npx tsc --noEmit",
"clean": "rm -rf premium/dist backend/dist frontend/dist"
},
"devDependencies": {
"typescript": "^5.3.3"
}
}

1
premium Submodule

Submodule premium added at ce4b3fd6e0

52
tsconfig.base.json Normal file
View File

@@ -0,0 +1,52 @@
{
"compilerOptions": {
/* LANGUAGE AND ENVIRONMENT */
"target": "ES2022",
"lib": ["ES2022"],
/* MODULES */
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"resolveJsonModule": true,
/* TYPE CHECKING */
"strict": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"exactOptionalPropertyTypes": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
/* EMIT */
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"removeComments": false,
/* INTEROP CONSTRAINTS */
"allowJs": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
/* COMPATIBILITY */
"isolatedModules": true,
"types": ["vite/client", "node"]
},
"include": [
"/premium/**/*"
],
"exclude": [
"node_modules",
"dist",
"build",
"coverage",
"*.test.*",
"*.spec.*"
]
}