Chris7811 commited on
Commit
e778fe5
·
verified ·
1 Parent(s): 35dd8b0

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +647 -651
index.html CHANGED
@@ -1,674 +1,670 @@
1
- import React, { useState, useEffect, useMemo } from 'react';
2
- import { initializeApp } from 'firebase/app';
3
- import {
4
- getFirestore,
5
- collection,
6
- doc,
7
- onSnapshot,
8
- addDoc,
9
- deleteDoc,
10
- updateDoc,
11
- arrayUnion,
12
- serverTimestamp
13
- } from 'firebase/firestore';
14
- import {
15
- getAuth,
16
- signInAnonymously,
17
- signInWithCustomToken,
18
- onAuthStateChanged
19
- } from 'firebase/auth';
20
- import {
21
- FileText,
22
- Trophy,
23
- History,
24
- Plus,
25
- Trash2,
26
- User,
27
- Package,
28
- Shield,
29
- CheckCircle2,
30
- Users,
31
- BarChart3,
32
- ArrowRight,
33
- AlertTriangle,
34
- UserPlus,
35
- Archive,
36
- Save,
37
- X,
38
- Calendar,
39
- Crown,
40
- Clock,
41
- ChevronRight,
42
- TrendingUp,
43
- Activity,
44
- Layers,
45
- LayoutDashboard
46
- } from 'lucide-react';
47
-
48
- // --- Firebase Configuration ---
49
- const firebaseConfig = JSON.parse(__firebase_config);
50
- const app = initializeApp(firebaseConfig);
51
- const auth = getAuth(app);
52
- const db = getFirestore(app);
53
- const appId = typeof __app_id !== 'undefined' ? __app_id : 'black-oath-v1';
54
-
55
- // --- Rang-Konfiguration (Hierarchie und Farben) ---
56
- const RANK_ORDER = {
57
- "Leader": { level: 1, color: "border-amber-400 text-amber-400 bg-amber-400/5", label: "LEADER" },
58
- "Rang 6": { level: 2, color: "border-slate-300 text-slate-300 bg-slate-300/5", label: "RANG 6" },
59
- "Rang 5": { level: 3, color: "border-blue-400 text-blue-400 bg-blue-400/5", label: "RANG 5" },
60
- "Rang 4": { level: 4, color: "border-emerald-400 text-emerald-400 bg-emerald-400/5", label: "RANG 4" },
61
- "Rang 3": { level: 5, color: "border-purple-400 text-purple-400 bg-purple-400/5", label: "RANG 3" },
62
- "Rang 2": { level: 6, color: "border-orange-400 text-orange-400 bg-orange-400/5", label: "RANG 2" },
63
- "Rang 1": { level: 7, color: "border-rose-500 text-rose-500 bg-rose-500/5", label: "RANG 1" }
64
- };
65
-
66
- export default function App() {
67
- const [user, setUser] = useState(null);
68
- const [activeTab, setActiveTab] = useState('contracts');
69
- const [contracts, setContracts] = useState([]);
70
- const [contributions, setContributions] = useState([]);
71
- const [members, setMembers] = useState([]);
72
- const [isAddingContract, setIsAddingContract] = useState(false);
73
- const [numResources, setNumResources] = useState(1);
74
- const [isAddingMember, setIsAddingMember] = useState(false);
75
- const [joiningContract, setJoiningContract] = useState(null);
76
- const [selectedContract, setSelectedContract] = useState(null);
77
- const [loading, setLoading] = useState(true);
78
- const [expandedStats, setExpandedStats] = useState(null);
79
-
80
- // Auth Initialization
81
- useEffect(() => {
82
- const initAuth = async () => {
83
- try {
84
- if (typeof __initial_auth_token !== 'undefined' && __initial_auth_token) {
85
- await signInWithCustomToken(auth, __initial_auth_token);
86
- } else {
87
- await signInAnonymously(auth);
88
  }
89
- } catch (error) { console.error("Auth Error:", error); }
90
- };
91
- initAuth();
92
- const unsubscribe = onAuthStateChanged(auth, setUser);
93
- return () => unsubscribe();
94
- }, []);
95
-
96
- // Data Sync
97
- useEffect(() => {
98
- if (!user) return;
99
- const path = (col) => collection(db, 'artifacts', appId, 'public', 'data', col);
100
-
101
- const unsubC = onSnapshot(path('contracts'), (snap) => {
102
- setContracts(snap.docs.map(d => ({ id: d.id, ...d.data() })));
103
- setLoading(false);
104
- });
105
- const unsubCo = onSnapshot(path('contributions'), (snap) => setContributions(snap.docs.map(d => ({ id: d.id, ...d.data() }))));
106
- const unsubM = onSnapshot(path('members'), (snap) => setMembers(snap.docs.map(d => ({ id: d.id, ...d.data() }))));
107
-
108
- return () => { unsubC(); unsubCo(); unsubM(); };
109
- }, [user]);
110
-
111
- // --- Actions ---
112
- const handleAddContract = async (e) => {
113
- e.preventDefault();
114
- const f = new FormData(e.target);
115
- const resourceList = Array.from({ length: numResources }).map((_, i) => ({
116
- name: f.get(`resName_${i}`),
117
- target: parseInt(f.get(`resTarget_${i}`))
118
- }));
119
-
120
- try {
121
- await addDoc(collection(db, 'artifacts', appId, 'public', 'data', 'contracts'), {
122
- name: f.get('name'),
123
- description: f.get('description'),
124
- resources: resourceList,
125
- minParticipants: parseInt(f.get('minParticipants') || 1),
126
- status: 'active',
127
- participants: [],
128
- date: new Date().toLocaleDateString('de-DE'),
129
- createdAt: serverTimestamp()
130
- });
131
- setIsAddingContract(false);
132
- setNumResources(1);
133
- } catch (err) { console.error(err); }
134
- };
135
-
136
- const completeContract = async (id) => {
137
- if (!window.confirm("Vertrag als ERLEDIGT markieren? Er erscheint dann im Management-Fenster.")) return;
138
- try {
139
- const now = new Date();
140
- const contractRef = doc(db, 'artifacts', appId, 'public', 'data', 'contracts', id);
141
- await updateDoc(contractRef, {
142
- status: 'completed',
143
- completedAt: serverTimestamp(),
144
- completedDate: now.toLocaleDateString('de-DE'),
145
- completedTime: now.toLocaleTimeString('de-DE', { hour: '2-digit', minute: '2-digit' })
146
- });
147
- } catch (err) { console.error("Completion Error:", err); }
148
- };
149
-
150
- const archiveContract = async (id) => {
151
- try {
152
- const contractRef = doc(db, 'artifacts', appId, 'public', 'data', 'contracts', id);
153
- await updateDoc(contractRef, { status: 'archived' });
154
- } catch (err) { console.error("Archival Error:", err); }
155
- };
156
-
157
- const deleteContractPermanently = async (id) => {
158
- if (!window.confirm("Diesen Vertrag und alle Beiträge permanent löschen?")) return;
159
- await deleteDoc(doc(db, 'artifacts', appId, 'public', 'data', 'contracts', id));
160
- contributions.filter(c => c.contractId === id).forEach(async c => {
161
- await deleteDoc(doc(db, 'artifacts', appId, 'public', 'data', 'contributions', c.id));
162
- });
163
- };
164
-
165
- const addContribution = async (e) => {
166
- e.preventDefault();
167
- if (!selectedContract) return;
168
- const f = new FormData(e.target);
169
- const now = new Date();
170
- try {
171
- await addDoc(collection(db, 'artifacts', appId, 'public', 'data', 'contributions'), {
172
- contractId: selectedContract.id,
173
- contractName: selectedContract.name,
174
- resourceName: f.get('resourceName'),
175
- userName: f.get('memberName'),
176
- amount: parseInt(f.get('amount')),
177
- timestamp: serverTimestamp(),
178
- date: now.toLocaleDateString('de-DE'),
179
- time: now.toLocaleTimeString('de-DE', { hour: '2-digit', minute: '2-digit' })
180
- });
181
- setSelectedContract(null);
182
- } catch (err) { console.error(err); }
183
- };
184
-
185
- const handleJoin = async (id, name) => {
186
- try {
187
- await updateDoc(doc(db, 'artifacts', appId, 'public', 'data', 'contracts', id), {
188
- participants: arrayUnion(name)
189
- });
190
- setJoiningContract(null);
191
- } catch (err) { console.error(err); }
192
- };
193
-
194
- // --- Member Actions ---
195
- const addMember = async (e) => {
196
- e.preventDefault();
197
- const f = new FormData(e.target);
198
- try {
199
- await addDoc(collection(db, 'artifacts', appId, 'public', 'data', 'members'), {
200
- name: f.get('memberName'),
201
- rank: f.get('memberRank'),
202
- createdAt: serverTimestamp()
203
- });
204
- setIsAddingMember(false);
205
- } catch (err) { console.error(err); }
206
- };
207
-
208
- const deleteMember = async (id) => {
209
- if (window.confirm("Mitglied entfernen?")) await deleteDoc(doc(db, 'artifacts', appId, 'public', 'data', 'members', id));
210
- };
211
-
212
- // --- Data Memos ---
213
- const activeContractsList = contracts.filter(c => c.status === 'active');
214
- const finishedContractsList = useMemo(() =>
215
- contracts.filter(c => c.status === 'completed').sort((a,b) => (b.completedAt?.seconds || 0) - (a.completedAt?.seconds || 0)),
216
- [contracts]);
217
- const archivedHistoryList = contracts.filter(c => c.status === 'archived');
218
-
219
- const getResProgress = (cid, name) => contributions.filter(c => c.contractId === cid && c.resourceName === name).reduce((s, curr) => s + curr.amount, 0);
220
-
221
- const stats = useMemo(() => {
222
- const res = {};
223
- members.forEach(m => { res[m.name] = { total: 0, rank: m.rank, materials: {}, logs: [] }; });
224
- contributions.forEach(c => {
225
- if(res[c.userName]) {
226
- res[c.userName].total += c.amount;
227
- res[c.userName].materials[c.resourceName] = (res[c.userName].materials[c.resourceName] || 0) + c.amount;
228
- res[c.userName].logs.push(c);
229
- }
230
- });
231
- const list = Object.entries(res).map(([name, data]) => ({ name, ...data })).sort((a, b) => b.total - a.total);
232
- const max = Math.max(...list.map(s => s.total), 1);
233
- return { list, max };
234
- }, [contributions, members]);
235
-
236
- const sortedMembers = useMemo(() => [...members].sort((a, b) => (RANK_ORDER[a.rank]?.level || 99) - (RANK_ORDER[b.rank]?.level || 99)), [members]);
237
-
238
- if (loading) return (
239
- <div className="min-h-screen bg-black flex items-center justify-center font-mono">
240
- <div className="text-center animate-pulse">
241
- <div className="w-16 h-16 bg-white border-4 border-neutral-800 flex items-center justify-center mx-auto mb-4 shadow-2xl shadow-white/5">
242
- <span className="text-black font-black text-xl">BO</span>
243
  </div>
244
- <p className="text-[10px] uppercase font-bold tracking-[0.5em] text-neutral-500">Black Oath Core Access...</p>
245
- </div>
246
- </div>
247
- );
248
-
249
- return (
250
- <div className="min-h-screen bg-black text-white font-sans selection:bg-white selection:text-black pb-20">
251
- <header className="bg-black border-b border-neutral-900 p-6 sticky top-0 z-40 backdrop-blur-2xl bg-opacity-95">
252
- <div className="max-w-7xl mx-auto flex flex-col lg:flex-row justify-between items-center gap-6">
253
- <div className="flex items-center gap-4">
254
- <div className="w-10 h-10 bg-white flex items-center justify-center border-2 border-neutral-800 shadow-xl">
255
- <span className="text-black text-sm font-black">BO</span>
256
- </div>
257
- <div>
258
- <h1 className="text-xl font-serif font-bold tracking-widest uppercase">Black Oath</h1>
259
- <p className="text-[8px] text-neutral-600 font-bold uppercase mt-0.5 tracking-tighter">Familien Business System</p>
260
  </div>
261
- </div>
262
- <nav className="flex bg-neutral-950 p-1 border border-neutral-900 shadow-2xl rounded-sm overflow-hidden">
263
- {[
264
- { id: 'contracts', icon: LayoutDashboard, label: 'Zentrale' },
265
- { id: 'members', icon: Users, label: 'Familie' },
266
- { id: 'leaderboard', icon: Trophy, label: 'Rangfolge' },
267
- { id: 'history', icon: History, label: 'Archiv' }
268
- ].map(tab => (
269
- <button key={tab.id} onClick={() => setActiveTab(tab.id)} className={`flex items-center gap-2.5 px-6 py-2 transition-all text-[9px] font-bold uppercase tracking-widest ${activeTab === tab.id ? 'bg-white text-black' : 'text-neutral-500 hover:text-white'}`}>
270
- <tab.icon size={13} /> <span>{tab.label}</span>
271
- </button>
272
- ))}
273
- </nav>
274
- </div>
275
- </header>
276
-
277
- <main className="max-w-7xl mx-auto p-6 lg:p-12">
278
- {activeTab === 'contracts' && (
279
- <div className="grid grid-cols-1 xl:grid-cols-4 gap-12 animate-in fade-in duration-500">
280
- <div className="xl:col-span-3 space-y-10">
281
- <div className="flex justify-between items-end border-b border-neutral-900 pb-6">
282
- <div>
283
- <h2 className="text-xl font-serif font-bold uppercase tracking-widest text-neutral-200">Arbeitsverträge</h2>
284
- <p className="text-[9px] text-neutral-600 uppercase font-black tracking-widest font-mono">Aktive Operationen</p>
285
- </div>
286
- <button onClick={() => setIsAddingContract(true)} className="bg-white text-black px-6 py-3 font-black text-[9px] uppercase tracking-widest flex items-center gap-2 active:scale-95 transition-all shadow-xl hover:bg-neutral-200">
287
- <Plus size={14} /> Neuer Kontrakt
288
- </button>
289
- </div>
290
-
291
- <div className="grid grid-cols-1 md:grid-cols-2 gap-8">
292
- {activeContractsList.length === 0 ? (
293
- <div className="col-span-full py-48 text-center border-2 border-dashed border-neutral-900 opacity-20"><Shield size={80} className="mx-auto mb-4 text-white" /><p className="text-xs uppercase tracking-widest font-mono">Keine aktiven Aufträge im System</p></div>
294
- ) : (
295
- activeContractsList.map(c => {
296
- const teamCount = (c.participants || []).length;
297
- const isMinOk = teamCount >= (c.minParticipants || 1);
298
- const resArray = c.resources || [];
299
- const allDone = resArray.length > 0 && resArray.every(r => getResProgress(c.id, r.name) >= r.target);
300
- return (
301
- <div key={c.id} className="bg-neutral-950 border border-neutral-800 p-8 group hover:border-white transition-all flex flex-col relative shadow-2xl overflow-hidden rounded-sm">
302
- <div className="mb-6">
303
- <div className="flex justify-between items-start mb-4">
304
- <span className="text-[8px] uppercase font-black text-neutral-600 font-mono tracking-tighter">REF: {c.id.slice(0,6)}</span>
305
- <span className="text-[9px] text-neutral-700 font-mono flex items-center gap-1 font-black">{c.date}</span>
306
- </div>
307
- <h3 className="text-xl font-bold uppercase tracking-wider text-white mb-4 leading-tight">{c.name}</h3>
308
- <p className="text-xs text-neutral-500 italic mb-8 line-clamp-2 h-8">{c.description}</p>
309
-
310
- <div className="space-y-4 bg-black/50 p-5 border border-neutral-900 shadow-inner rounded-sm">
311
- {resArray.map((res, i) => {
312
- const cur = getResProgress(c.id, res.name);
313
- const p = Math.min(100, Math.round((cur / res.target) * 100));
314
- return (
315
- <div key={i} className="space-y-1.5">
316
- <div className="flex justify-between text-[9px] font-black uppercase tracking-widest font-mono">
317
- <span className="text-neutral-500">{res.name}</span>
318
- <span className={p >= 100 ? "text-amber-400" : "text-white"}>{cur.toLocaleString()} / {res.target.toLocaleString()}</span>
319
- </div>
320
- <div className="h-[2px] w-full bg-neutral-900 relative shadow-inner overflow-hidden"><div className={`absolute h-full transition-all duration-1000 ${p >= 100 ? 'bg-amber-400 shadow-[0_0_10px_rgba(251,191,36,0.6)]' : 'bg-white'}`} style={{ width: `${p}%` }} /></div>
321
- </div>
322
- );
323
- })}
324
- </div>
325
- </div>
326
-
327
- <div className={`p-4 border mb-8 ${isMinOk ? 'border-neutral-700' : 'border-rose-900/40 opacity-60'}`}>
328
- <div className="flex items-center justify-between text-[9px] uppercase font-black mb-3">
329
- <span className={isMinOk ? 'text-white' : 'text-rose-500'}>{isMinOk ? 'Operativ Bereit' : 'Mitglieder gesucht'}</span>
330
- <span className="font-mono">{teamCount} / {c.minParticipants} MIN</span>
331
- </div>
332
- <div className="flex flex-wrap gap-1.5">
333
- {(c.participants || []).map((p, i) => <span key={i} className="text-[8px] bg-neutral-900 px-1.5 py-0.5 border border-neutral-800 text-neutral-400 font-bold uppercase tracking-tighter">{p}</span>)}
334
- </div>
335
- </div>
336
 
337
- <div className="mt-auto grid grid-cols-2 gap-3 pt-6 border-t border-neutral-900">
338
- <button onClick={() => setJoiningContract(c)} className="col-span-2 py-4 bg-white text-black text-[10px] font-black uppercase tracking-widest hover:bg-neutral-200 active:scale-95 transition-all flex items-center justify-center gap-2 rounded-sm"><UserPlus size={14}/> Übernehmen</button>
339
- <button onClick={() => setSelectedContract(c)} disabled={teamCount === 0} className="py-3 bg-neutral-900 text-white text-[9px] font-bold border border-neutral-800 hover:border-white transition-all uppercase active:scale-95 disabled:opacity-20 rounded-sm">Abgabe</button>
340
- <button onClick={() => completeContract(c.id)} className={`py-3 text-[9px] font-bold border transition-all uppercase active:scale-95 rounded-sm ${allDone ? 'bg-amber-400 text-black border-amber-400 animate-pulse' : 'bg-black text-neutral-600 border-neutral-800 hover:text-white hover:border-white'}`}>Erledigt</button>
341
- </div>
342
- </div>
343
- );
344
- })
345
- )}
346
- </div>
347
  </div>
348
 
349
- <div className="xl:col-span-1 border-l border-neutral-900 pl-8 space-y-10">
350
- <div className="flex items-center gap-3 text-neutral-500 uppercase tracking-widest font-black text-[11px] font-mono"><Clock size={16} /> Zuletzt Beendet</div>
351
- <div className="space-y-6 max-h-[1200px] overflow-y-auto pr-2 custom-scrollbar">
352
- {finishedContractsList.length === 0 ? <p className="text-[10px] text-neutral-800 uppercase italic text-center font-mono opacity-50">Keine abgeschlossenen Daten</p> :
353
- finishedContractsList.map(c => {
354
- const contractContribs = contributions.filter(co => co.contractId === c.id);
355
- const breakdown = contractContribs.reduce((acc, curr) => {
356
- acc[curr.userName] = (acc[curr.userName] || 0) + curr.amount;
357
- return acc;
358
- }, {});
359
-
360
- return (
361
- <div key={c.id} className="p-6 border border-neutral-800 bg-neutral-950/50 group hover:border-neutral-600 transition-all relative animate-in slide-in-from-right-4 shadow-xl rounded-sm overflow-hidden">
362
- <div className="flex justify-between items-start mb-5 font-mono">
363
- <div className="text-[8px] font-black uppercase text-amber-400 bg-amber-400/10 px-1.5 py-0.5 border border-amber-400/20">Besiegelt</div>
364
- <span className="text-[8px] text-neutral-700 tracking-tighter">{c.completedDate} • {c.completedTime}</span>
365
- </div>
366
- <h4 className="text-[14px] font-bold text-white uppercase tracking-wider mb-5 font-serif leading-snug">{c.name}</h4>
367
-
368
- <div className="space-y-3 border-y border-neutral-900 py-4 mb-6">
369
- <div className="text-[9px] text-neutral-600 uppercase font-black tracking-widest mb-2 flex items-center gap-2 font-sans"><BarChart3 size={12}/> Abschluss-Statistik:</div>
370
- {Object.entries(breakdown).map(([name, amount], i) => (
371
- <div key={i} className="flex justify-between items-center text-[10px] font-mono border-b border-neutral-900/50 pb-1.5 last:border-0">
372
- <span className="text-neutral-500 font-sans">{name}</span>
373
- <span className="text-white font-black">{amount.toLocaleString()} EH</span>
374
- </div>
375
- ))}
376
- </div>
377
-
378
- <div className="flex gap-2">
379
- <button onClick={() => archiveContract(c.id)} className="flex-1 bg-white text-black py-2.5 text-[9px] font-black uppercase tracking-widest hover:bg-neutral-200 active:scale-95 transition-all flex items-center justify-center gap-2 shadow-lg rounded-sm"><Archive size={14} /> Archivieren</button>
380
- <button onClick={() => deleteContractPermanently(c.id)} className="p-2.5 border border-neutral-900 text-neutral-700 hover:text-rose-500 active:scale-90 transition-all rounded-sm"><Trash2 size={14} /></button>
381
- </div>
382
- </div>
383
- );
384
- })
385
- }
386
- </div>
387
  </div>
388
- </div>
389
- )}
390
-
391
- {activeTab === 'members' && (
392
- <div className="max-w-7xl mx-auto space-y-24 animate-in fade-in duration-700">
393
- <div className="flex justify-between items-end border-b border-neutral-900 pb-10">
394
- <div><h2 className="text-5xl font-serif font-bold uppercase tracking-[0.3em]">Familie</h2><p className="text-[11px] text-neutral-600 uppercase font-bold mt-2 italic font-mono tracking-widest">Die Black Oath Hierarchie</p></div>
395
- <button onClick={() => setIsAddingMember(true)} className="bg-white text-black px-10 py-5 font-black text-[10px] uppercase tracking-widest flex items-center gap-3 active:scale-95 transition-all shadow-xl hover:bg-neutral-200 rounded-sm">
396
- <UserPlus size={18} /> Registrieren
397
- </button>
398
- </div>
399
- <div className="space-y-16">
400
- {Object.keys(RANK_ORDER).map(r => {
401
- const ms = sortedMembers.filter(m => m.rank === r);
402
- if (ms.length === 0) return null;
403
- return (
404
- <div key={r} className="space-y-10">
405
- <div className="flex items-center gap-8"><div className={`px-8 py-3 border-l-4 font-black uppercase text-[14px] tracking-[0.6em] shadow-xl ${RANK_ORDER[r].color} rounded-sm`}>{RANK_ORDER[r].label}</div><div className="h-[1px] flex-grow bg-neutral-900 opacity-50" /></div>
406
- <div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 gap-10">
407
- {ms.map(m => (
408
- <div key={m.id} className={`p-10 border-t-2 relative group hover:border-white transition-all shadow-2xl bg-neutral-950/20 ${RANK_ORDER[m.rank].color} rounded-sm shadow-inner shadow-white/5`}>
409
- <button onClick={() => deleteMember(m.id)} className="absolute top-4 right-4 opacity-0 group-hover:opacity-100 text-neutral-700 hover:text-rose-500 transition-all active:scale-90"><Trash2 size={18}/></button>
410
- {m.rank === "Leader" && <Crown size={32} className="mb-6 text-amber-400" />}
411
- <h4 className="text-2xl font-bold uppercase tracking-widest text-white leading-tight font-serif">{m.name}</h4>
412
- </div>
413
- ))}
414
- </div>
415
- </div>
416
- );
417
- })}
418
- </div>
419
- </div>
420
- )}
421
-
422
- {activeTab === 'leaderboard' && (
423
- <div className="max-w-6xl mx-auto space-y-24 animate-in fade-in duration-700">
424
- <div className="text-center">
425
- <h2 className="text-7xl font-serif font-bold text-white uppercase tracking-[0.5em] tracking-tighter">Statistik</h2>
426
- <div className="h-[2px] w-48 bg-white mx-auto my-12 opacity-80 shadow-[0_0_20px_rgba(255,255,255,0.5)]" />
427
- <p className="text-neutral-600 italic text-lg tracking-[0.4em] uppercase font-mono tracking-tighter font-black">Individual Performance Analytics</p>
428
  </div>
429
-
430
- <div className="bg-neutral-950 border border-neutral-900 p-20 overflow-x-auto shadow-2xl relative rounded-sm group/chart overflow-hidden">
431
- <div className="absolute inset-0 bg-gradient-to-b from-white/[0.03] to-transparent pointer-events-none" />
432
- <div className="flex items-end gap-10 h-[450px] min-w-[900px] mb-12 border-b border-neutral-900/50 pb-8 relative z-10">
433
- {stats.list.map((s, i) => (
434
- <div key={i} className="flex-1 flex flex-col items-center gap-12 group/bar">
435
- <div className="w-full bg-black/50 relative border-x border-neutral-900/30 flex items-end shadow-inner h-full overflow-hidden">
436
- <div
437
- className="w-full bg-white transition-all duration-[2000ms] group-hover/bar:bg-amber-400 relative shadow-[0_0_40px_rgba(255,255,255,0.15)] rounded-t-sm"
438
- style={{ height: `${(s.total / stats.max) * 100}%` }}
439
- >
440
- <div className="absolute top-[-50px] w-full text-center opacity-0 group-hover/bar:opacity-100 transition-all transform -translate-y-2 group-hover/bar:translate-y-0 duration-300">
441
- <span className="text-[12px] font-black bg-white text-black px-4 py-2 shadow-2xl border border-black font-mono tracking-tighter">{s.total.toLocaleString()}</span>
 
 
 
 
 
 
 
 
442
  </div>
443
- <div className="absolute inset-x-0 bottom-0 h-full bg-gradient-to-t from-black/30 to-transparent" />
444
- </div>
445
  </div>
446
- <div className="h-20 flex items-start justify-center">
447
- <span className="text-[11px] uppercase font-black tracking-widest text-neutral-600 rotate-45 origin-left whitespace-nowrap group-hover/bar:text-white transition-colors duration-500 font-mono tracking-tighter block">{s.name}</span>
 
 
 
 
 
 
448
  </div>
449
- </div>
450
- ))}
451
- </div>
452
  </div>
453
-
454
- <div className="space-y-10">
455
- <div className="flex items-center gap-6 text-neutral-500 uppercase tracking-[0.5em] font-bold text-[14px] border-b border-neutral-900 pb-8 font-sans">
456
- <Activity size={20} /> Mitglieder-Statistiken
457
- </div>
458
- <div className="grid grid-cols-1 gap-8">
459
- {stats.list.map((stat, idx) => (
460
- <div key={stat.name} className="bg-neutral-950 border border-neutral-800 overflow-hidden hover:border-neutral-500 transition-all shadow-xl group rounded-sm">
461
- <div className="p-10 flex flex-col md:flex-row justify-between items-center gap-10">
462
- <div className="flex items-center gap-12">
463
- <div className="w-20 h-20 rounded-full border-2 border-neutral-800 flex items-center justify-center text-3xl font-serif font-black bg-black group-hover:border-white transition-colors shadow-inner">#{idx + 1}</div>
464
- <div className="font-sans">
465
- <div className="flex items-center gap-6 mb-3">
466
- <h4 className="text-3xl font-bold uppercase tracking-[0.1em] text-white font-serif">{stat.name}</h4>
467
- <span className="text-[11px] bg-neutral-900 border border-neutral-800 px-4 py-1.5 text-neutral-500 font-black uppercase tracking-[0.2em] rounded-sm">{stat.rank}</span>
468
- </div>
469
- <div className="flex items-center gap-5 text-neutral-500 text-[13px] uppercase tracking-[0.3em] font-black">
470
- <TrendingUp size={18} className="text-amber-400" />
471
- Ertrag: <span className="text-white font-mono text-2xl ml-2 tracking-tighter">{stat.total.toLocaleString()} EH</span>
472
- </div>
473
- </div>
474
- </div>
475
-
476
- <button
477
- onClick={() => setExpandedStats(expandedStats === stat.name ? null : stat.name)}
478
- className="px-10 py-5 border border-neutral-800 hover:bg-white hover:text-black transition-all font-black text-[12px] uppercase tracking-[0.4em] flex items-center gap-4 active:scale-95 shadow-xl font-sans rounded-sm"
479
- >
480
- {expandedStats === stat.name ? 'Collapse' : 'Details einsehen'}
481
- <ChevronRight size={20} className={`transition-transform duration-500 ${expandedStats === stat.name ? 'rotate-90 text-amber-500' : ''}`} />
482
- </button>
483
  </div>
484
-
485
- {expandedStats === stat.name && (
486
- <div className="border-t border-neutral-900 bg-black/80 p-12 animate-in slide-in-from-top-4 duration-500 font-sans">
487
- <div className="grid grid-cols-1 lg:grid-cols-3 gap-16">
488
- <div className="space-y-10">
489
- <h5 className="text-[13px] uppercase font-black tracking-[0.5em] text-amber-400 border-b border-neutral-800 pb-5 flex items-center gap-3"><Layers size={16}/> Ressourcen-Bilanz</h5>
490
- <div className="space-y-6">
491
- {Object.entries(stat.materials).length === 0 ? (
492
- <p className="text-xs text-neutral-700 italic font-mono uppercase tracking-widest">Keine Daten</p>
493
- ) : (
494
- Object.entries(stat.materials).map(([res, amount]) => (
495
- <div key={res} className="flex justify-between items-center border-b border-neutral-900 pb-4 font-mono">
496
- <span className="text-[12px] uppercase font-black tracking-widest text-neutral-400 font-sans">{res}</span>
497
- <span className="text-2xl font-black text-white tracking-tighter">{amount.toLocaleString()}</span>
498
- </div>
499
- ))
500
- )}
501
- </div>
502
- </div>
503
- <div className="lg:col-span-2 space-y-10">
504
- <h5 className="text-[13px] uppercase font-black tracking-[0.5em] text-neutral-500 border-b border-neutral-800 pb-5 flex items-center gap-3"><Clock size={16}/> Chronik der Einlagerungen</h5>
505
- <div className="grid grid-cols-1 gap-4 max-h-[500px] overflow-y-auto pr-6 custom-scrollbar font-mono">
506
- {(stat.logs || []).length === 0 ? (
507
- <p className="text-xs text-neutral-700 italic font-mono text-center py-10 uppercase">Chronik leer</p>
508
- ) : (
509
- stat.logs.sort((a,b) => (b.timestamp?.seconds || 0) - (a.timestamp?.seconds || 0)).map((log, i) => (
510
- <div key={i} className="p-6 bg-neutral-900/30 border border-neutral-800 flex justify-between items-center group/item hover:border-neutral-600 transition-all font-mono shadow-xl relative overflow-hidden rounded-sm">
511
- <div className="absolute left-0 top-0 w-1 h-full bg-neutral-800 group-hover/item:bg-amber-400 transition-all" />
512
- <div className="flex items-center gap-10">
513
- <div className="text-neutral-700 flex flex-col items-center border-r border-neutral-800 pr-10 uppercase text-[11px] tracking-tighter leading-tight font-black">
514
- <span>{log.date}</span>
515
- <span className="mt-1 opacity-50 tracking-widest">{log.time}</span>
516
- </div>
517
- <div className="font-sans">
518
- <div className="text-[10px] text-neutral-600 uppercase font-black mb-1.5 opacity-50 flex items-center gap-2"><Layers size={10}/> {log.contractName}</div>
519
- <div className="text-[15px] text-white font-black uppercase tracking-widest">{log.resourceName}</div>
520
- </div>
521
- </div>
522
- <div className="text-xl font-black group-hover/item:text-amber-400 transition-colors">
523
- +{log.amount.toLocaleString()}
524
- </div>
525
- </div>
526
- ))
527
- )}
528
- </div>
529
- </div>
530
- </div>
531
- </div>
532
- )}
533
- </div>
534
- ))}
535
- </div>
536
  </div>
537
- </div>
538
- )}
539
-
540
- {activeTab === 'history' && (
541
- <div className="max-w-6xl mx-auto space-y-16 animate-in fade-in duration-700">
542
- <div className="flex justify-between items-end border-b border-neutral-900 pb-10">
543
- <h2 className="text-6xl font-serif font-bold text-white uppercase tracking-[0.5em]">Archiv</h2>
544
- <div className="text-[12px] text-neutral-700 font-bold uppercase tracking-[0.5em] flex items-center gap-6 bg-neutral-950 px-10 py-5 border border-neutral-900 shadow-xl font-mono"><BarChart3 size={18} /> Black Oath Annalen</div>
545
- </div>
546
-
547
- <div className="space-y-16">
548
- {archivedHistoryList.length === 0 ? (
549
- <div className="py-72 text-center border-2 border-neutral-900 bg-neutral-950/10 italic tracking-[0.6em] uppercase text-sm text-neutral-800 shadow-inner rounded-sm">Das Archiv ist aktuell leer</div>
550
- ) : (
551
- archivedHistoryList.sort((a,b) => (b.completedAt?.seconds || 0) - (a.completedAt?.seconds || 0)).map((contract) => (
552
- <div key={contract.id} className="bg-neutral-950 border border-neutral-800 p-16 flex flex-col gap-12 hover:border-white transition-all group shadow-2xl relative animate-in zoom-in-95 rounded-sm shadow-inner shadow-white/5">
553
- <div className="absolute top-0 right-0 p-8 flex gap-6">
554
- <button onClick={() => deleteContractPermanently(contract.id)} className="text-neutral-900 hover:text-rose-900 transition-colors p-2 active:scale-90 shadow-2xl"><Trash2 size={26} /></button>
555
- </div>
556
- <div>
557
- <span className="text-[11px] text-neutral-600 uppercase font-bold tracking-[0.4em] block mb-4 border-l-4 border-neutral-800 pl-6 italic opacity-50 font-black">Versiegelt</span>
558
- <h3 className="text-5xl font-bold text-white uppercase tracking-[0.1em] leading-tight font-serif">{contract.name}</h3>
559
- <p className="text-[11px] text-neutral-700 font-mono mt-6 uppercase tracking-[0.3em] font-bold bg-neutral-900 p-3 border border-neutral-800 inline-block tracking-tighter">Initialdatum: {contract.date} | Versiegelt am: {contract.completedDate} • {contract.completedTime}</p>
560
- </div>
561
- <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-12 border-y border-neutral-900 py-12 font-mono">
562
- <div><p className="text-[11px] text-neutral-700 uppercase font-black tracking-widest mb-4 font-sans opacity-50">Ertrag Total</p><p className="text-3xl font-bold text-white">{(contributions.filter(c => c.contractId === contract.id).reduce((s,c) => s + c.amount, 0)).toLocaleString()} EH</p></div>
563
- <div><p className="text-[11px] text-neutral-700 uppercase font-black tracking-widest mb-4 font-sans opacity-50">Truppe (OP)</p><p className="text-3xl font-bold text-white tracking-[0.2em] font-mono">{(contract.participants || []).length}</p></div>
564
- <div className="flex items-center justify-end opacity-10"><div className="w-16 h-16 bg-white flex items-center justify-center border-4 border-neutral-800 shadow-xl shadow-white/5"><span className="text-black text-2xl font-black font-serif tracking-tighter">BO</span></div></div>
565
- </div>
566
- </div>
567
- ))
568
- )}
569
- </div>
570
- </div>
571
- )}
572
- </main>
573
-
574
- {/* --- Modal: Arbeitsvertrag anlegen --- */}
575
- {isAddingContract && (
576
- <div className="fixed inset-0 z-50 flex items-center justify-center p-6 bg-black/98 backdrop-blur-3xl overflow-y-auto">
577
- <div className="bg-black border border-neutral-800 w-full max-w-2xl animate-in zoom-in-95 my-auto shadow-[0_0_100px_rgba(255,255,255,0.1)] rounded-sm overflow-hidden">
578
- <div className="bg-neutral-950 p-6 border-b border-neutral-900 flex justify-between items-center shadow-xl">
579
- <div className="space-y-1">
580
- <h3 className="text-lg font-serif font-bold text-white uppercase tracking-[0.4em] font-black">Arbeitsverträge</h3>
581
- <p className="text-[8px] text-neutral-600 uppercase font-black tracking-[0.3em] font-mono">Mission-Setup</p>
582
- </div>
583
- <button onClick={() => { setIsAddingContract(false); setNumResources(1); }} className="text-neutral-700 hover:text-white transition-colors active:scale-90"><X size={20}/></button>
584
  </div>
585
- <form onSubmit={handleAddContract} className="p-8 space-y-6 font-mono">
586
- <input required name="name" className="w-full bg-neutral-950 border border-neutral-800 px-5 py-3 text-white focus:border-white outline-none uppercase tracking-[0.1em] shadow-inner text-sm font-bold rounded-sm" placeholder="TITEL" />
587
- <textarea name="description" className="w-full bg-neutral-950 border border-neutral-800 px-5 py-3 text-white focus:border-white outline-none h-16 italic shadow-inner text-xs rounded-sm" placeholder="Infos..." />
588
- <div className="space-y-4">
589
- <div className="grid grid-cols-1 gap-3 max-h-60 overflow-y-auto pr-3 custom-scrollbar">
590
- {Array.from({ length: numResources }).map((_, i) => (
591
- <div key={i} className="grid grid-cols-2 gap-4 p-4 border border-neutral-900 bg-neutral-950 shadow-inner animate-in slide-in-from-left-2 relative group overflow-hidden rounded-sm">
592
- <div className="absolute top-0 left-0 w-1 h-full bg-neutral-800 group-hover:bg-amber-400 transition-all"></div>
593
- <div className="space-y-1"><label className="text-[8px] text-neutral-700 uppercase font-black">Res {i+1}</label><input required name={`resName_${i}`} className="w-full bg-black border-b border-neutral-800 px-1 py-1 text-xs focus:border-white outline-none uppercase font-bold" placeholder="Ware" /></div>
594
- <div className="space-y-1"><label className="text-[8px] text-neutral-700 uppercase font-black">Soll</label><input required name={`resTarget_${i}`} type="number" className="w-full bg-black border-b border-neutral-800 px-1 py-1 text-xs focus:border-white outline-none font-black" placeholder="000" /></div>
595
  </div>
596
- ))}
597
  </div>
598
- {numResources < 9 && (
599
- <div className="pt-2 flex flex-wrap justify-center gap-2">
600
- {[2,3,4,5,6,7,8,9].filter(n => n > numResources).map(n => (
601
- <button key={n} type="button" onClick={() => setNumResources(n)} className="px-3 py-1 text-[8px] font-black border border-neutral-800 text-neutral-600 hover:border-white hover:text-white transition-all uppercase active:scale-95 shadow-xl">+ Fenster {n}</button>
602
- ))}
603
- </div>
604
- )}
605
- </div>
606
- <div className="pt-6 border-t border-neutral-900 flex items-center justify-between">
607
- <div className="flex items-center gap-3 bg-neutral-950 border border-neutral-800 px-4 py-2 shadow-inner rounded-sm">
608
- <label className="text-[9px] text-neutral-700 uppercase font-black tracking-[0.2em] whitespace-nowrap">MIN OP:</label>
609
- <input required name="minParticipants" type="number" defaultValue="1" min="1" className="w-8 bg-transparent text-white focus:outline-none text-xs font-black border-b border-neutral-800 text-center" />
610
  </div>
611
- <div className="flex gap-4">
612
- <button type="button" onClick={() => { setIsAddingContract(false); setNumResources(1); }} className="px-6 py-3 text-neutral-700 hover:text-white uppercase font-black tracking-widest transition-all text-[9px] active:scale-90">Abbruch</button>
613
- <button type="submit" className="bg-white text-black px-8 py-3 font-black uppercase tracking-widest active:scale-95 transition-all text-[9px] shadow-xl hover:bg-neutral-200 rounded-sm">Signieren</button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
614
  </div>
615
- </div>
616
- </form>
617
- </div>
618
- </div>
619
- )}
620
-
621
- {/* Mitglied registrieren */}
622
- {isAddingMember && (
623
- <div className="fixed inset-0 z-50 flex items-center justify-center p-6 bg-black/98 backdrop-blur-3xl">
624
- <div className="bg-black border border-neutral-800 w-full max-w-xl animate-in zoom-in-95 shadow-2xl overflow-hidden rounded-sm font-sans">
625
- <div className="bg-neutral-950 p-12 border-b border-neutral-900 shadow-xl flex justify-between items-center font-serif"><h3 className="text-3xl font-bold text-white uppercase tracking-widest">Registrierung</h3><button onClick={() => setIsAddingMember(false)} className="text-neutral-700 hover:text-white active:scale-90"><X size={32}/></button></div>
626
- <form onSubmit={addMember} className="p-12 space-y-12">
627
- <div className="space-y-3"><label className="text-[10px] text-neutral-600 uppercase font-black tracking-widest ml-1 font-mono">Operator-ID</label><input required name="memberName" className="w-full bg-neutral-950 border border-neutral-800 px-8 py-7 text-white focus:border-white outline-none uppercase tracking-[0.3em] shadow-inner text-lg font-bold font-mono rounded-sm" placeholder="NAME" /></div>
628
- <div className="space-y-5"><label className="text-[10px] text-neutral-600 font-bold uppercase tracking-widest ml-1 font-mono">Rangstufe:</label><select name="memberRank" className="w-full bg-neutral-950 border border-neutral-800 px-8 py-7 text-white focus:border-white outline-none uppercase tracking-[0.4em] appearance-none shadow-inner text-base font-black font-mono tracking-tighter rounded-sm">{Object.keys(RANK_ORDER).reverse().map(rk => <option key={rk} value={rk}>{rk}</option>)}</select></div>
629
- <div className="flex gap-10 pt-10 border-t border-neutral-900 font-mono"><button type="submit" className="flex-1 bg-white text-black px-4 py-7 font-black uppercase tracking-[0.6em] active:scale-95 transition-all shadow-xl text-sm rounded-sm">Bestätigen</button></div>
630
- </form>
631
- </div>
632
- </div>
633
- )}
634
-
635
- {joiningContract && (
636
- <div className="fixed inset-0 z-50 flex items-center justify-center p-6 bg-black/95 backdrop-blur-2xl">
637
- <div className="bg-black border border-neutral-800 w-full max-w-5xl animate-in zoom-in-95 overflow-y-auto max-h-[90vh] shadow-2xl rounded-sm">
638
- <div className="bg-neutral-950 p-12 border-b border-neutral-900 flex justify-between items-center shadow-xl"><h3 className="text-4xl font-serif font-bold text-white uppercase tracking-[0.5em] tracking-tighter font-black">Zuweisung</h3><button onClick={() => setJoiningContract(null)} className="text-neutral-700 hover:text-white transition-colors p-2 active:scale-90"><X size={44}/></button></div>
639
- <div className="p-12 grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 gap-10">
640
- {members.length === 0 ? <div className="col-span-full py-20 text-center shadow-inner rounded-sm"><p className="text-neutral-600 uppercase tracking-widest font-black mb-8 font-mono">Keine Daten verfügbar</p><button onClick={() => { setJoiningContract(null); setActiveTab('members'); }} className="text-white underline uppercase text-[11px] tracking-widest font-mono font-black">Register aufrufen</button></div> :
641
- members.map(m => {
642
- const isJoined = (joiningContract.participants || []).includes(m.name);
643
- return (
644
- <button key={m.id} disabled={isJoined} onClick={() => handleJoin(joiningContract.id, m.name)} className={`p-10 border-t-2 text-left transition-all shadow-2xl flex flex-col ${isJoined ? 'border-neutral-900 opacity-20 cursor-not-allowed shadow-none' : 'border-neutral-800 hover:border-white hover:bg-white active:scale-95 group relative overflow-hidden rounded-sm'}`}>
645
- <span className="block text-[11px] uppercase font-black tracking-widest mb-4 opacity-40 font-mono tracking-tighter group-hover:text-black">{m.rank}</span>
646
- <span className={`text-xl font-black uppercase tracking-widest font-serif ${!isJoined ? 'text-white group-hover:text-black' : ''}`}>{m.name}</span>
647
- </button>
648
- );
649
- })}
650
  </div>
651
- </div>
652
- </div>
653
- )}
654
-
655
- {selectedContract && (
656
- <div className="fixed inset-0 z-50 flex items-center justify-center p-6 bg-black/98 backdrop-blur-3xl">
657
- <div className="bg-black border border-neutral-800 w-full max-w-xl animate-in slide-in-from-top-12 shadow-2xl overflow-hidden rounded-sm font-mono">
658
- <div className="bg-neutral-950 p-10 border-b border-neutral-900 text-center shadow-xl relative font-sans">
659
- <button onClick={() => setSelectedContract(null)} className="absolute top-6 right-6 text-neutral-700 hover:text-white active:scale-90 transition-all font-mono"><X size={28}/></button>
660
- <h3 className="text-3xl font-serif font-bold text-white uppercase tracking-[0.4em] tracking-tighter font-black font-serif">Abgabe</h3>
661
- <p className="text-[11px] text-neutral-400 font-black mt-8 uppercase tracking-widest border border-neutral-800 inline-block px-10 py-3 shadow-inner font-mono tracking-tighter rounded-sm">{selectedContract.name}</p>
 
 
 
 
 
 
662
  </div>
663
- <form onSubmit={addContribution} className="p-12 space-y-10">
664
- <div className="space-y-4"><label className="text-[11px] text-neutral-600 font-black uppercase tracking-[0.5em] block ml-1 tracking-tighter">Identität</label><select required name="memberName" defaultValue="" className="w-full bg-neutral-950 border border-neutral-800 px-8 py-6 text-white focus:border-white outline-none uppercase tracking-[0.2em] appearance-none shadow-inner text-base font-black tracking-tighter rounded-sm shadow-black"><option value="" disabled>Auswählen...</option>{(selectedContract.participants || []).map(name => <option key={name} value={name}>{name}</option>)}</select></div>
665
- <div className="space-y-4"><label className="text-[11px] text-neutral-600 font-black uppercase tracking-[0.5em] block ml-1 tracking-tighter">Ressource</label><select required name="resourceName" defaultValue="" className="w-full bg-neutral-950 border border-neutral-800 px-8 py-6 text-white focus:border-white outline-none uppercase tracking-[0.2em] appearance-none shadow-inner text-base font-black tracking-tighter rounded-sm shadow-black"><option value="" disabled>Auswählen...</option>{(selectedContract.resources || []).map(res => <option key={res.name} value={res.name}>{res.name}</option>)}</select></div>
666
- <div className="space-y-4"><label className="text-[11px] text-neutral-600 font-black uppercase tracking-[0.5em] block ml-1 tracking-tighter font-black">Menge</label><div className="relative"><Package className="absolute left-8 top-1/2 -translate-y-1/2 text-neutral-700 font-sans" size={32} /><input required name="amount" type="number" className="w-full bg-neutral-950 border border-neutral-800 pl-24 pr-8 py-8 text-white focus:border-white outline-none text-5xl shadow-inner font-black tracking-tighter rounded-sm shadow-black" placeholder="000" /></div></div>
667
- <div className="flex gap-10 pt-10 border-t border-neutral-900 font-mono shadow-xl"><button type="submit" className="flex-1 bg-white text-black px-4 py-7 font-black uppercase tracking-[0.8em] active:scale-95 transition-all shadow-[0_0_50px_rgba(255,255,255,0.2)] text-sm rounded-sm">Bestätigen</button></div>
668
- </form>
669
- </div>
670
  </div>
671
- )}
672
  </div>
673
- );
674
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="de">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Mitarbeiter App</title>
7
+ <script src="https://unpkg.com/react@18/umd/react.development.js"></script>
8
+ <script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
9
+ <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
10
+ <script src="https://cdn.tailwindcss.com"></script>
11
+ </head>
12
+ <body>
13
+ <div id="root"></div>
14
+
15
+ <script type="text/babel">
16
+ <!DOCTYPE html>
17
+ <html lang="de">
18
+ <head>
19
+ <meta charset="UTF-8">
20
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
21
+ <title>Black Oath | Business OS v12.3</title>
22
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700;800;900&display=swap" rel="stylesheet">
23
+ <style>
24
+ :root {
25
+ --bg-main: #050505;
26
+ --sidebar-bg: #0a0a0a;
27
+ --card-bg: #0c0c0c;
28
+ --accent: #ffffff;
29
+ --border: #1a1a1a;
30
+ --border-bright: #333333;
31
+ --text-dim: #888888;
32
+ --success: #4CAF50;
33
+ --warning: #f1c40f;
34
+ --error: #e74c3c;
35
+ --info: #00A3FF;
36
+
37
+ /* Rank Colors */
38
+ --color-leader: #ffd700;
39
+ --color-rank6: #e5e4e2;
40
+ --color-rank5: #cd7f32;
41
+ --color-rank4: #3498db;
42
+ --color-rank3: #2ecc71;
43
+ --color-rank2: #95a5a6;
44
+ --color-rank1: #555555;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  }
46
+
47
+ * { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; -webkit-font-smoothing: antialiased; }
48
+ body { background-color: var(--bg-main); color: var(--accent); display: flex; height: 100vh; overflow: hidden; }
49
+
50
+ /* --- SIDEBAR --- */
51
+ .sidebar { width: 280px; background-color: var(--sidebar-bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 30px 0; flex-shrink: 0; }
52
+ .sidebar-header { padding: 0 25px 30px 25px; border-bottom: 1px solid var(--border); margin-bottom: 20px; text-align: center; }
53
+ .family-title-side { font-weight: 900; letter-spacing: 3px; text-transform: uppercase; font-size: 1.2rem; color: #fff; }
54
+ .family-subtitle-side { font-size: 0.6rem; color: var(--text-dim); letter-spacing: 5px; margin-top: 5px; }
55
+
56
+ .nav-group { padding: 0 15px; flex-grow: 1; overflow-y: auto; }
57
+ .nav-item { display: flex; align-items: center; padding: 12px 15px; color: var(--text-dim); text-decoration: none; border-radius: 12px; margin-bottom: 5px; font-size: 0.85rem; font-weight: 600; transition: all 0.2s; cursor: pointer; }
58
+ .nav-item:hover, .nav-item.active { background: rgba(255,255,255,0.05); color: var(--accent); }
59
+ .nav-item i { margin-right: 15px; width: 20px; text-align: center; font-style: normal; }
60
+
61
+ /* --- MAIN CONTENT --- */
62
+ .main-content { flex-grow: 1; overflow-y: auto; padding: 40px; background: radial-gradient(circle at top right, #111, #050505); position: relative; }
63
+ .view-section { display: none; }
64
+ .view-section.active { display: block; animation: fadeIn 0.4s ease-out; }
65
+ @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
66
+
67
+ /* --- HERO BANNER --- */
68
+ .hero-banner {
69
+ display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
70
+ background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, transparent 100%);
71
+ padding: 60px 40px; border-radius: 35px; border: 1px solid var(--border); margin-bottom: 50px; box-shadow: 0 30px 60px rgba(0,0,0,0.6);
72
+ }
73
+ .hero-logo-container {
74
+ width: 240px; height: 240px; background: #fff; border-radius: 35px;
75
+ display: flex; align-items: center; justify-content: center; overflow: hidden;
76
+ border: 6px solid #fff; box-shadow: 0 0 50px rgba(255,255,255,0.2);
77
+ margin-bottom: 30px; padding: 15px;
78
+ }
79
+ .hero-logo-container img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
80
+ .hero-text h1 { font-size: 4rem; font-weight: 900; letter-spacing: -2px; line-height: 1.1; }
81
+
82
+ .dashboard-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-bottom: 40px; }
83
+ .stat-card { background: var(--card-bg); border: 1px solid var(--border-bright); padding: 30px; border-radius: 20px; text-align: center; }
84
+ .stat-card h2 { font-size: 2.2rem; font-weight: 800; }
85
+ .stat-card span { display: block; color: var(--text-dim); font-size: 0.8rem; text-transform: uppercase; font-weight: 700; margin-bottom: 5px; }
86
+ .stat-card.active-highlight h2 { color: var(--success); text-shadow: 0 0 15px rgba(76, 175, 80, 0.4); }
87
+
88
+ .card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 24px; padding: 30px; margin-bottom: 25px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
89
+ .card-header { margin-bottom: 20px; font-size: 0.95rem; font-weight: 800; text-transform: uppercase; color: #fff; border-bottom: 1px solid var(--border); padding-bottom: 15px; display: flex; justify-content: space-between; align-items: center; }
90
+
91
+ /* --- DASHBOARD BOXES --- */
92
+ .dash-display-box { background: #000; padding: 25px; border-radius: 20px; border: 1px solid #222; min-height: 150px; position: relative; overflow-y: auto; }
93
+ .dash-display-box::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
94
+ .box-news::before { background: var(--warning); }
95
+ .box-missions::before { background: var(--info); }
96
+ .news-text { font-size: 1.1rem; line-height: 1.6; color: #efefef; font-weight: 500; white-space: pre-wrap; }
97
+
98
+ /* --- MITGLIEDER PYRAMIDE --- */
99
+ .members-pyramid { display: flex; flex-direction: column; align-items: center; gap: 50px; padding-bottom: 80px; }
100
+ .pyramid-rank-section { width: 100%; display: flex; flex-direction: column; align-items: center; }
101
+ .rank-label-divider { width: 100%; display: flex; align-items: center; justify-content: center; margin-bottom: 25px; }
102
+ .rank-label-divider::before, .rank-label-divider::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--border-bright), transparent); }
103
+ .rank-label-text { padding: 0 25px; font-size: 0.75rem; font-weight: 900; letter-spacing: 5px; text-transform: uppercase; color: var(--text-dim); }
104
+ .rank-members-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 25px; width: 100%; }
105
+
106
+ .member-card {
107
+ background: linear-gradient(145deg, #0f0f0f, #070707); border: 1px solid var(--border); border-radius: 24px; padding: 30px;
108
+ display: flex; flex-direction: column; align-items: center; transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); min-width: 240px; position: relative;
109
+ }
110
+ .member-card::after { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 5px; background: var(--border-bright); opacity: 0.5; }
111
+ .member-card:hover { transform: translateY(-10px); border-color: rgba(255,255,255,0.2); box-shadow: 0 20px 40px rgba(0,0,0,0.8); }
112
+ .card-leader { border-color: var(--color-leader); }
113
+ .card-leader::after { background: var(--color-leader); opacity: 1; box-shadow: 0 0 10px var(--color-leader); }
114
+ .card-leader .member-name { color: var(--color-leader); }
115
+ .member-avatar { width: 70px; height: 70px; background: #1a1a1a; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-bottom: 15px; font-weight: 900; border: 2px solid var(--border-bright); font-size: 1.5rem; color: #fff; }
116
+ .member-name { font-weight: 800; margin-bottom: 2px; font-size: 1.1rem; }
117
+ .rank-title-small { font-size: 0.65rem; font-weight: 900; text-transform: uppercase; margin-bottom: 5px; opacity: 0.8; letter-spacing: 1px; }
118
+ .member-stars { color: #333; font-size: 0.85rem; margin-bottom: 15px; letter-spacing: 2px; }
119
+ .star-active { color: var(--color-leader); }
120
+
121
+ /* --- VERTRAEGE REDESIGN --- */
122
+ .con-card { background: #0c0c0c; border: 1px solid var(--border); border-radius: 24px; padding: 0; margin-bottom: 30px; overflow: hidden; display: flex; flex-direction: column; }
123
+ .con-header { padding: 25px; background: #0f0f0f; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
124
+ .con-body { display: grid; grid-template-columns: 1fr 1fr; gap: 0; min-height: 250px; }
125
+
126
+ .con-info-pane { padding: 25px; border-right: 1px solid var(--border); background: #0c0c0c; }
127
+ .con-logs-pane { padding: 25px; background: #080808; }
128
+
129
+ .con-status-badge { font-size: 0.6rem; font-weight: 900; text-transform: uppercase; padding: 5px 12px; border-radius: 6px; letter-spacing: 1px; }
130
+ .con-title { font-size: 1.4rem; font-weight: 900; color: #fff; margin-top: 5px; }
131
+
132
+ .pane-title { font-size: 0.65rem; color: var(--text-dim); text-transform: uppercase; font-weight: 900; letter-spacing: 1.5px; margin-bottom: 15px; display: block; }
133
+
134
+ .resource-list-display { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
135
+ .resource-row-display { display: flex; justify-content: space-between; align-items: center; background: #000; padding: 12px 15px; border-radius: 12px; border: 1px solid #111; font-size: 0.85rem; }
136
+
137
+ .participant-grid-new { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
138
+ .participant-item { background: #000; border: 1px solid #222; border-radius: 10px; padding: 10px; text-align: center; font-size: 0.75rem; position: relative; transition: 0.2s; cursor: pointer; }
139
+ .participant-item.active { border-color: var(--info); background: rgba(0,163,255,0.05); color: #fff; }
140
+ .participant-item .contribution-sum { display: block; font-weight: 900; color: var(--success); margin-top: 4px; font-size: 0.7rem; }
141
+
142
+ .con-footer { padding: 20px 25px; background: #0f0f0f; border-top: 1px solid var(--border); display: flex; gap: 15px; }
143
+
144
+ /* --- FINANZEN --- */
145
+ .transaction-list { display: flex; flex-direction: column; gap: 10px; }
146
+ .transaction-item { background: #080808; border: 1px solid #1a1a1a; padding: 15px 20px; border-radius: 15px; display: flex; justify-content: space-between; align-items: center; }
147
+ .type-revenue { color: var(--success); }
148
+ .type-expense { color: var(--error); }
149
+
150
+ /* --- ADMIN SWITCHES --- */
151
+ .switch { position: relative; display: inline-block; width: 44px; height: 22px; }
152
+ .switch input { opacity: 0; width: 0; height: 0; }
153
+ .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #222; transition: .4s; border-radius: 34px; border: 1px solid #333; }
154
+ .slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
155
+ input:checked + .slider { background-color: var(--success); border-color: var(--success); }
156
+ input:checked + .slider:before { transform: translateX(22px); }
157
+
158
+ .admin-table { width: 100%; border-collapse: collapse; }
159
+ .admin-table th { padding: 15px; text-align: left; font-size: 0.7rem; color: var(--text-dim); text-transform: uppercase; border-bottom: 1px solid #222; }
160
+ .admin-table td { padding: 15px; border-bottom: 1px solid #111; font-size: 0.85rem; }
161
+
162
+ /* --- BUTTONS --- */
163
+ .btn { background: #fff; color: #000; border: none; padding: 12px 24px; border-radius: 12px; font-weight: 800; cursor: pointer; text-transform: uppercase; font-size: 0.75rem; transition: 0.2s; }
164
+ .btn:hover { transform: translateY(-2px); opacity: 0.9; }
165
+ .btn-blue { background: var(--info); color: #fff; }
166
+ .btn-ghost { background: transparent; border: 1px solid #333; color: #888; padding: 8px 15px; border-radius: 8px; }
167
+ .btn-danger { background: var(--error); color: #fff; }
168
+
169
+ .input-field { width: 100%; background: #000; border: 1px solid var(--border-bright); padding: 14px; border-radius: 12px; color: #fff; outline: none; }
170
+ .capital-display-btn { width: 100%; padding: 40px; border-radius: 30px; border: 2px solid var(--success); background: linear-gradient(180deg, rgba(76, 175, 80, 0.05) 0%, transparent 100%); color: #fff; font-size: 2rem; font-weight: 900; margin-top: 30px; text-align: center; }
171
+ .hidden { display: none !important; }
172
+
173
+ .status-tag { font-weight: 900; font-size: 0.7rem; padding: 4px 10px; border-radius: 6px; text-transform: uppercase; }
174
+ .tag-active { background: rgba(0, 163, 255, 0.1); color: var(--info); border: 1px solid var(--info); }
175
+ .tag-done { background: rgba(76, 175, 80, 0.1); color: var(--success); border: 1px solid var(--success); }
176
+ .tag-waiting { background: rgba(241, 196, 15, 0.1); color: var(--warning); border: 1px solid var(--warning); }
177
+
178
+ .overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); z-index: 1000; display: flex; align-items: center; justify-content: center; }
179
+ .overlay-content { background: var(--card-bg); border: 1px solid var(--border-bright); padding: 30px; border-radius: 25px; width: 90%; max-width: 500px; }
180
+ </style>
181
+ </head>
182
+ <body>
183
+
184
+ <aside class="sidebar">
185
+ <div class="sidebar-header">
186
+ <div class="family-title-side">BLACK OATH</div>
187
+ <div class="family-subtitle-side">BUSINESS OS</div>
 
 
 
 
 
 
 
 
 
 
 
 
188
  </div>
189
+ <nav class="nav-group" id="sideNav">
190
+ <div class="nav-item active" onclick="showView('dashboard', this)"><i>📊</i> Dashboard</div>
191
+ <div class="nav-item" id="nav-members" onclick="showView('members', this)"><i>👥</i> Mitglieder</div>
192
+ <div class="nav-item" id="nav-contracts" onclick="showView('contracts', this)"><i>📄</i> Verträge</div>
193
+ <div class="nav-item" id="nav-stats" onclick="showView('stats', this)"><i>📈</i> Beteiligung</div>
194
+ <div class="nav-item" id="nav-finances" onclick="showView('finances', this)"><i>💰</i> Finanzen</div>
195
+ <div class="nav-item" id="nav-admin" onclick="showView('admin', this)" style="color:var(--warning)"><i>⚙️</i> Admin</div>
196
+ </nav>
197
+ </aside>
198
+
199
+ <main class="main-content">
200
+ <header class="top-bar" style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px;">
201
+ <div class="page-title"><h1 id="viewTitle">DASHBOARD</h1></div>
202
+ <div style="background: rgba(255,255,255,0.05); border: 1px solid #333; padding: 8px 20px; border-radius: 30px; font-size: 0.75rem; font-weight: 800;">
203
+ SECURED SYSTEM v12.3
 
204
  </div>
205
+ </header>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
 
207
+ <!-- DASHBOARD -->
208
+ <section id="dashboard" class="view-section active">
209
+ <div class="hero-banner">
210
+ <div class="hero-logo-container">
211
+ <img src="https://media.discordapp.net/attachments/1488241616345895033/1488852178058739762/Black_Oath.png?ex=69d38f24&is=69d23da4&hm=8c055c9d30b2bd479e51b436fb9de67e349d3bb1f930d12c8d8ef946bd435fbe&=&format=webp&quality=lossless&width=882&height=882" alt="Logo" onerror="this.src='image_aca644.jpg'">
212
+ </div>
213
+ <div class="hero-text">
214
+ <span>SYSTEMSTATUS: ONLINE</span>
215
+ <h1>BLACK OATH</h1>
216
+ </div>
217
  </div>
218
 
219
+ <div class="dashboard-grid">
220
+ <div class="stat-card"><span>Mitglieder</span><h2 id="dashMemberCount">0</h2></div>
221
+ <div class="stat-card" id="activeContractStatCard"><span>Verträge</span><h2 id="dashContractCount">0</h2></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
222
  </div>
223
+
224
+ <div style="display: grid; grid-template-columns: 1.2fr 1.8fr; gap: 30px;">
225
+ <div class="card">
226
+ <div class="card-header">Laufende Missionen</div>
227
+ <div class="dash-display-box box-missions" id="dashContractStatus"></div>
228
+ </div>
229
+ <div class="card">
230
+ <div class="card-header">Tagesnachricht</div>
231
+ <div class="dash-display-box box-news">
232
+ <div class="news-text" id="announcementText">Warten auf Führung...</div>
233
+ </div>
234
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
235
  </div>
236
+ </section>
237
+
238
+ <!-- MITGLIEDER PYRAMIDE -->
239
+ <section id="members" class="view-section">
240
+ <div class="members-pyramid" id="memberPyramid"></div>
241
+ </section>
242
+
243
+ <!-- VERTRAEGE -->
244
+ <section id="contracts" class="view-section">
245
+ <div style="display: grid; grid-template-columns: 1fr 1.6fr; gap: 30px;">
246
+ <div class="card">
247
+ <div class="card-header">Auftrag ausschreiben</div>
248
+ <div class="input-group"><label>Bezeichnung</label><input type="text" id="conName" class="input-field" placeholder="z.B. Waffenlieferung"></div>
249
+ <div class="input-group"><label>Erteilt von</label><select id="conCreatedBy" class="input-field c-name-list"></select></div>
250
+ <div class="input-group">
251
+ <label>Ressourcen-Anforderungen</label>
252
+ <div id="conResourceInputs">
253
+ <div class="res-input-row" style="display:flex; gap:10px; margin-bottom:10px;">
254
+ <input type="text" class="input-field res-name" placeholder="Material" style="flex: 2;">
255
+ <input type="number" class="input-field res-qty" placeholder="Ziel" style="flex: 1;">
256
+ </div>
257
  </div>
258
+ <button class="btn-ghost" onclick="addResourceInputRow()">+ Ressource hinzufügen</button>
 
259
  </div>
260
+ <div class="input-group">
261
+ <label>Mindest-Teilnehmer</label>
262
+ <select id="conMinCount" class="input-field">
263
+ <option value="1">1 Mitglied</option><option value="2">2 Mitglieder</option>
264
+ <option value="3" selected>3 Mitglieder</option><option value="4">4 Mitglieder</option>
265
+ <option value="5">5 Mitglieder</option>
266
+ <option value="9">9 Mitglieder</option>
267
+ </select>
268
  </div>
269
+ <button class="btn btn-blue" style="width:100%" onclick="saveNewContract()">Vertrag speichern</button>
270
+ </div>
271
+ <div id="conList"></div>
272
  </div>
273
+ </section>
274
+
275
+ <!-- BETEILIGUNG -->
276
+ <section id="stats" class="view-section">
277
+ <div class="card">
278
+ <div class="card-header">Leistungs-Übersicht</div>
279
+ <div class="stats-filter-bar">
280
+ <button class="filter-btn active" id="f-week" onclick="setStatsFilter('week')">Woche</button>
281
+ <button class="filter-btn" id="f-month" onclick="setStatsFilter('month')">Monat</button>
282
+ <button class="filter-btn" id="f-all" onclick="setStatsFilter('all')">Gesamt</button>
283
+ </div>
284
+ <div id="statsContent"></div>
285
+ </div>
286
+ <div class="card">
287
+ <div class="card-header">Ewiges Ranking</div>
288
+ <div id="statsRankingList"></div>
289
+ </div>
290
+ </section>
291
+
292
+ <!-- FINANZEN -->
293
+ <section id="finances" class="view-section">
294
+ <div style="display: grid; grid-template-columns: 1.2fr 1.8fr; gap: 30px;">
295
+ <div class="card">
296
+ <div class="card-header">Buchung</div>
297
+ <div class="input-group">
298
+ <label>Kategorie</label>
299
+ <select id="finType" class="input-field">
300
+ <option value="revenue">Einnahme (+)</option>
301
+ <option value="expense">Ausgabe (-)</option>
302
+ </select>
303
  </div>
304
+ <div class="input-group"><label>Betrag ($)</label><input type="number" id="finAmount" class="input-field" placeholder="Summe"></div>
305
+ <div class="input-group"><label>Grund</label><textarea id="finNote" class="input-field" style="height:80px" placeholder="Details..."></textarea></div>
306
+ <button class="btn btn-blue" style="width:100%" onclick="saveFinance()">Buchen</button>
307
+ </div>
308
+ <div class="card">
309
+ <div class="card-header">Finanz-Historie</div>
310
+ <div class="transaction-list" id="finTableBody"></div>
311
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
312
  </div>
313
+ <div class="capital-display-btn" id="fullCapitalBtn">Familienkapital: 0$</div>
314
+ </section>
315
+
316
+ <!-- ADMIN -->
317
+ <section id="admin" class="view-section">
318
+ <div class="card">
319
+ <div class="card-header">Sicherheits-Matrix</div>
320
+ <div class="admin-matrix-card">
321
+ <table class="admin-table">
322
+ <thead><tr><th>Rang</th><th>Mitgl.</th><th>Vertr.</th><th>Stats</th><th>Finanz</th><th>News</th><th>Verw.</th></tr></thead>
323
+ <tbody id="adminPermMatrix"></tbody>
324
+ </table>
325
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
326
  </div>
327
+
328
+ <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 30px;">
329
+ <div id="adminNewsSection" class="hidden">
330
+ <div class="card">
331
+ <div class="card-header">Tagesnachricht</div>
332
+ <textarea id="adminNewsInput" class="input-field" style="height: 100px; margin-bottom: 15px;"></textarea>
333
+ <button class="btn btn-blue" style="width:100%" onclick="updateNews()">Update senden</button>
 
 
 
334
  </div>
 
335
  </div>
336
+ <div id="adminManageContracts" class="hidden">
337
+ <div class="card">
338
+ <div class="card-header">Verträge & Missionen zurücksetzen</div>
339
+ <p style="font-size:0.7rem; color:var(--text-dim); margin-bottom:15px;">Löscht alle aktuell laufenden Verträge unwiderruflich aus der Liste.</p>
340
+ <button class="btn btn-danger" style="width:100%" onclick="resetContracts()">Alle Verträge löschen</button>
341
+ </div>
 
 
 
 
 
 
342
  </div>
343
+ </div>
344
+
345
+ <div id="adminManageMembers" class="hidden">
346
+ <div class="card">
347
+ <div class="card-header">Mitglieder Verwaltung</div>
348
+ <div style="display: grid; grid-template-columns: 1fr 1fr 100px; gap: 15px; margin-bottom: 15px;">
349
+ <input type="text" id="admName" class="input-field" placeholder="Name">
350
+ <input type="text" id="admUid" class="input-field" placeholder="UID">
351
+ <input type="text" id="admRank" class="input-field" placeholder="Rang (1-6/L)">
352
+ </div>
353
+ <button class="btn" onclick="adminAddMember()">Hinzufügen</button>
354
+ </div>
355
+ <div class="card">
356
+ <div class="card-header">Mitgliederliste</div>
357
+ <div class="admin-matrix-card">
358
+ <table class="admin-table">
359
+ <thead><tr><th>Name</th><th>UID</th><th>Rang</th><th style="text-align:right">Aktion</th></tr></thead>
360
+ <tbody id="adminMemberList"></tbody>
361
+ </table>
362
+ </div>
363
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
364
  </div>
365
+
366
+ <button class="btn btn-danger" style="width:100%; padding: 20px; border-radius: 20px;" onclick="resetSystem()">SYSTEM VOLL-RESET</button>
367
+ </section>
368
+
369
+ </main>
370
+
371
+ <!-- LOGGING OVERLAY -->
372
+ <div id="logOverlay" class="overlay hidden">
373
+ <div class="overlay-content">
374
+ <div class="card-header" style="border:none; margin-bottom:10px;">Einlagerung protokollieren</div>
375
+ <p style="font-size:0.75rem; color:var(--text-dim); margin-bottom:15px;">Wähle das Mitglied und trage das Material ein:</p>
376
+ <div id="logParticipantList" style="display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:15px; max-height:150px; overflow-y:auto; padding:5px; background:#000; border-radius:10px; border:1px solid #111;"></div>
377
+ <div class="input-group"><label>Material</label><input type="text" id="logMaterial" class="input-field"></div>
378
+ <div class="input-group"><label>Menge</label><input type="number" id="logAmount" class="input-field"></div>
379
+ <div style="display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:20px;">
380
+ <button class="btn-ghost" onclick="closeLogOverlay()">Abbrechen</button>
381
+ <button class="btn btn-blue" onclick="submitLogEntry()">Speichern</button>
382
  </div>
 
 
 
 
 
 
 
383
  </div>
 
384
  </div>
385
+
386
+ <script>
387
+ const initialMembers = [
388
+ {n: "Bryan Cooper", id: "84748", r: "Leader"}, {n: "Ashley Vaughn", id: "53743", r: "6"},
389
+ {n: "Sari Hund", id: "57362", r: "6"}, {n: "Michael Cooper", id: "84761", r: "6"},
390
+ {n: "Naomi Ferguson", id: "108674", r: "6"}, {n: "Luka Dark", id: "6423", r: "5"},
391
+ {n: "Luka Darco", id: "17470", r: "5"}, {n: "Sam Vaughn", id: "48984", r: "5"},
392
+ {n: "Brent Perkins", id: "65534", r: "5"}, {n: "Basti Darco", id: "82394", r: "5"},
393
+ {n: "Tommy Mann", id: "85444", r: "5"}, {n: "Bernd Baumann", id: "90863", r: "5"},
394
+ {n: "Hansi Peter", id: "105352", r: "5"}, {n: "Captain Iglo", id: "108672", r: "5"},
395
+ {n: "Gismo Hund", id: "88049", r: "4"}, {n: "Leo Dawson", id: "86799", r: "3"},
396
+ {n: "Rio Bischkik", id: "78531", r: "2"}, {n: "Jack Norris", id: "122471", r: "2"},
397
+ {n: "Adeline Clark", id: "116135", r: "1"}
398
+ ];
399
+
400
+ const defaultPerms = {
401
+ "Leader": { members: true, contracts: true, stats: true, finances: true, editNews: true, manageMembers: true },
402
+ "6": { members: true, contracts: true, stats: true, finances: true, editNews: true, manageMembers: true },
403
+ "5": { members: true, contracts: true, stats: true, finances: false, editNews: false, manageMembers: false },
404
+ "4": { members: true, contracts: true, stats: true, finances: false, editNews: false, manageMembers: false },
405
+ "3": { members: true, contracts: true, stats: true, finances: false, editNews: false, manageMembers: false },
406
+ "2": { members: true, contracts: true, stats: true, finances: false, editNews: false, manageMembers: false },
407
+ "1": { members: true, contracts: true, stats: true, finances: false, editNews: false, manageMembers: false }
408
+ };
409
+
410
+ let state = {
411
+ members: JSON.parse(localStorage.getItem('bo_members')) || initialMembers,
412
+ contracts: JSON.parse(localStorage.getItem('bo_contracts')) || [],
413
+ archivedContracts: JSON.parse(localStorage.getItem('bo_archived')) || [],
414
+ finances: JSON.parse(localStorage.getItem('bo_fin')) || [],
415
+ perms: JSON.parse(localStorage.getItem('bo_perms')) || defaultPerms,
416
+ news: localStorage.getItem('bo_news') || "Sicherheitsprotokoll aktiv.",
417
+ currentRank: "Leader", currentUser: "Bryan Cooper", activeLogConId: null, selectedLogMember: null, statsFilter: 'week'
418
+ };
419
+
420
+ function save() {
421
+ localStorage.setItem('bo_members', JSON.stringify(state.members));
422
+ localStorage.setItem('bo_contracts', JSON.stringify(state.contracts));
423
+ localStorage.setItem('bo_archived', JSON.stringify(state.archivedContracts));
424
+ localStorage.setItem('bo_fin', JSON.stringify(state.finances));
425
+ localStorage.setItem('bo_perms', JSON.stringify(state.perms));
426
+ localStorage.setItem('bo_news', state.news);
427
+ updateUI();
428
+ }
429
+
430
+ function showView(id, el) {
431
+ document.querySelectorAll('.view-section').forEach(s => s.classList.remove('active'));
432
+ document.getElementById(id).classList.add('active');
433
+ document.querySelectorAll('.nav-item').forEach(i => i.classList.remove('active'));
434
+ if(el) el.classList.add('active');
435
+ document.getElementById('viewTitle').innerText = id.toUpperCase();
436
+ updateUI();
437
+ }
438
+
439
+ // --- CONTRACTS ---
440
+ function addResourceInputRow() {
441
+ const container = document.getElementById('conResourceInputs');
442
+ const div = document.createElement('div');
443
+ div.className = 'res-input-row'; div.style.display = "flex"; div.style.gap = "10px"; div.style.marginBottom = "10px";
444
+ div.innerHTML = `<input type="text" class="input-field res-name" placeholder="Material" style="flex: 2;"><input type="number" class="input-field res-qty" placeholder="Ziel" style="flex: 1;">`;
445
+ container.appendChild(div);
446
+ }
447
+
448
+ function saveNewContract() {
449
+ const n = document.getElementById('conName').value, created = document.getElementById('conCreatedBy').value, min = parseInt(document.getElementById('conMinCount').value);
450
+ const resNames = document.querySelectorAll('.res-name'), resQtys = document.querySelectorAll('.res-qty');
451
+ let resources = [];
452
+ resNames.forEach((input, i) => { if(input.value && resQtys[i].value) resources.push({ name: input.value, target: parseInt(resQtys[i].value) }); });
453
+ if(!n || !created || resources.length === 0) return alert("Prüfen!");
454
+ state.contracts.unshift({ id: Date.now(), name: n, resources: resources, createdBy: created, minRequired: min, participants: [], logs: [], date: new Date().toLocaleDateString() });
455
+ save();
456
+ document.getElementById('conName').value = "";
457
+ document.getElementById('conResourceInputs').innerHTML = `<div class="res-input-row" style="display:flex; gap:10px; margin-bottom:10px;"><input type="text" class="input-field res-name" placeholder="Eisen" style="flex: 2;"><input type="number" class="input-field res-qty" placeholder="Menge" style="flex: 1;"></div>`;
458
+ }
459
+
460
+ function toggleParticipant(conId, memberName) {
461
+ const c = state.contracts.find(x => x.id === conId);
462
+ const idx = c.participants.indexOf(memberName);
463
+ if(idx > -1) c.participants.splice(idx, 1); else c.participants.push(memberName);
464
+ save();
465
+ }
466
+
467
+ function openLogOverlay(conId) {
468
+ state.activeLogConId = conId;
469
+ const c = state.contracts.find(x => x.id === conId);
470
+ const container = document.getElementById('logParticipantList');
471
+ container.innerHTML = c.participants.map(p => `<div class="participant-item" style="padding:15px;" onclick="selectLogMember(this, '${p}')">${p}</div>`).join('') || '<p style="font-size:0.7rem; color:var(--error); grid-column:1/-1; text-align:center;">Keiner angemeldet.</p>';
472
+ document.getElementById('logMaterial').value = ""; document.getElementById('logAmount').value = "";
473
+ document.getElementById('logOverlay').classList.remove('hidden');
474
+ }
475
+
476
+ function selectLogMember(el, name) {
477
+ document.querySelectorAll('#logParticipantList .participant-item').forEach(b => b.classList.remove('active'));
478
+ el.classList.add('active'); state.selectedLogMember = name;
479
+ }
480
+
481
+ function closeLogOverlay() { document.getElementById('logOverlay').classList.add('hidden'); }
482
+
483
+ function submitLogEntry() {
484
+ const mat = document.getElementById('logMaterial').value, am = parseInt(document.getElementById('logAmount').value);
485
+ if(!state.selectedLogMember || !mat || isNaN(am)) return alert("Unvollständig!");
486
+ const c = state.contracts.find(x => x.id === state.activeLogConId);
487
+ c.logs.push({ name: state.selectedLogMember, amount: am, material: mat, timestamp: Date.now(), date: new Date().toLocaleDateString(), conName: c.name });
488
+ save(); closeLogOverlay();
489
+ }
490
+
491
+ function archiveAndDeleteContract(id) {
492
+ if(confirm("Mission archivieren? Daten bleiben im Ranking.")) {
493
+ const c = state.contracts.find(x => x.id === id);
494
+ state.archivedContracts.unshift(JSON.parse(JSON.stringify(c)));
495
+ state.contracts = state.contracts.filter(x => x.id !== id);
496
+ save();
497
+ }
498
+ }
499
+
500
+ function resetContracts() {
501
+ if(confirm("Willst du wirklich ALLE laufenden Verträge löschen?")) {
502
+ state.contracts = []; save(); alert("Verträge zurückgesetzt.");
503
+ }
504
+ }
505
+
506
+ function getStars(rank) {
507
+ let count = rank === "Leader" ? 7 : parseInt(rank) || 0;
508
+ let s = ""; for(let i=0; i<7; i++) s += i < count ? "<span class='star-active'>★</span>" : "<span>☆</span>";
509
+ return s;
510
+ }
511
+
512
+ function getRankFullTitle(rank) { return rank === 'Leader' ? 'Leader' : 'Rang ' + rank; }
513
+
514
+ function setStatsFilter(f) {
515
+ state.statsFilter = f;
516
+ document.querySelectorAll('.filter-btn').forEach(b => b.classList.remove('active'));
517
+ document.getElementById('f-' + f).classList.add('active');
518
+ updateUI();
519
+ }
520
+
521
+ function saveFinance() {
522
+ const t = document.getElementById('finType').value, a = parseInt(document.getElementById('finAmount').value);
523
+ if(!a) return alert("Summe!");
524
+ state.finances.unshift({ type: t, amount: a, note: document.getElementById('finNote').value, date: new Date().toLocaleDateString() });
525
+ save();
526
+ }
527
+
528
+ function adminAddMember() {
529
+ const n = document.getElementById('admName').value, u = document.getElementById('admUid').value, r = document.getElementById('admRank').value;
530
+ if(!n || !u || !r) return alert("Fehler!");
531
+ state.members.push({n, id:u, r}); save();
532
+ }
533
+
534
+ function updateNews() {
535
+ const val = document.getElementById('adminNewsInput').value;
536
+ if(val) { state.news = val; save(); }
537
+ }
538
+
539
+ function updateUI() {
540
+ const p = state.perms[state.currentRank] || defaultPerms["1"];
541
+
542
+ // Admin Modules Toggle
543
+ document.getElementById('adminNewsSection').classList.toggle('hidden', !p.editNews);
544
+ document.getElementById('adminManageMembers').classList.toggle('hidden', !p.manageMembers);
545
+ document.getElementById('adminManageContracts').classList.toggle('hidden', !p.manageMembers);
546
+ document.getElementById('nav-admin').style.display = (state.currentRank === "Leader" || state.currentRank === "6" || p.manageMembers) ? 'flex' : 'none';
547
+
548
+ // Dashboard
549
+ document.getElementById('dashMemberCount').innerText = state.members.length;
550
+ document.getElementById('announcementText').innerText = state.news;
551
+ const activeConsCount = state.contracts.filter(c => c.participants.length >= c.minRequired).length;
552
+ document.getElementById('dashContractCount').innerText = activeConsCount;
553
+ document.getElementById('activeContractStatCard').classList.toggle('active-highlight', activeConsCount > 0);
554
+
555
+ document.getElementById('dashContractStatus').innerHTML = state.contracts.map(c => {
556
+ const totalTarget = c.resources.reduce((s, r) => s + r.target, 0), currentGot = c.logs.reduce((s, l) => s + l.amount, 0);
557
+ const isDone = currentGot >= totalTarget, isActive = c.participants.length >= c.minRequired && !isDone;
558
+ let bCl = 'tag-waiting'; let bTx = `Warten (${c.participants.length}/${c.minRequired})`;
559
+ if(isDone) { bCl = 'tag-done'; bTx = 'Erledigt'; } else if(isActive) { bCl = 'tag-active'; bTx = 'Aktiv'; }
560
+ return `<div class="status-row"><span>${c.name}</span><span class="status-tag ${bCl}">${bTx}</span></div>`;
561
+ }).join('') || '<p style="text-align:center; padding:10px; color:#333">Keine Missionen.</p>';
562
+
563
+ // Pyramid
564
+ const rO = ["Leader", "6", "5", "4", "3", "2", "1"];
565
+ document.getElementById('memberPyramid').innerHTML = rO.map(rank => {
566
+ const ms = state.members.filter(m => m.r === rank);
567
+ if(ms.length === 0) return "";
568
+ return `<div class="pyramid-rank-section"><div class="rank-label-divider"><span class="rank-label-text">${getRankFullTitle(rank)}</span></div><div class="rank-members-row">${ms.map(m => `<div class="member-card ${m.r==='Leader'?'card-leader':''}"><div class="member-avatar">${m.n.charAt(0)}</div><span class="member-name">${m.n}</span><div class="rank-title-small">${getRankFullTitle(m.r)}</div><div class="member-stars">${getStars(m.r)}</div><span class="member-rank-badge">ID: ${m.id}</span></div>`).join('')}</div></div>`;
569
+ }).join('');
570
+
571
+ // Contracts View (Redesign)
572
+ document.getElementById('conList').innerHTML = state.contracts.map(c => {
573
+ const currentGot = c.logs.reduce((s, l) => s + l.amount, 0), totalTarget = c.resources.reduce((s, r) => s + r.target, 0);
574
+ const isDone = currentGot >= totalTarget, isActive = c.participants.length >= c.minRequired && !isDone;
575
+
576
+ return `
577
+ <div class="con-card">
578
+ <div class="con-header">
579
+ <div>
580
+ <span class="con-status-badge ${isDone?'tag-done':(isActive?'tag-active':'tag-waiting')}">${isDone?'Erledigt':(isActive?'Aktiv':'Suche Team')}</span>
581
+ <div class="con-title">${c.name}</div>
582
+ </div>
583
+ <button class="btn-ghost" style="color:var(--error); border-color:var(--error)" onclick="archiveAndDeleteContract(${c.id})">Entfernen</button>
584
+ </div>
585
+ <div class="con-body">
586
+ <div class="con-info-pane">
587
+ <span class="pane-title">Auftragsdetails</span>
588
+ <div style="font-size:0.8rem; margin-bottom:15px; color:var(--text-dim);">Erteilt von: <b style="color:#fff">${c.createdBy}</b> | Min: <b>${c.minRequired}</b></div>
589
+ <div class="resource-list-display">
590
+ ${c.resources.map(r => {
591
+ const got = c.logs.filter(l => l.material.toLowerCase() === r.name.toLowerCase()).reduce((s,l) => s+l.amount, 0);
592
+ return `<div class="resource-row-display"><span>${r.name}</span><strong>${got} / ${r.target}</strong></div>`;
593
+ }).join('')}
594
+ </div>
595
+ </div>
596
+ <div class="con-logs-pane">
597
+ <span class="pane-title">Einsatz-Team & Beteiligung</span>
598
+ <div class="participant-grid-new">
599
+ ${state.members.map(m => {
600
+ const sel = c.participants.includes(m.n);
601
+ const contr = c.logs.filter(l => l.name === m.n).reduce((s,l) => s+l.amount, 0);
602
+ return `<div class="participant-item ${sel?'active':''}" onclick="toggleParticipant(${c.id}, '${m.n}')">
603
+ ${m.n.split(' ')[0]}
604
+ ${sel && contr > 0 ? `<span class="contribution-sum">${contr} Stk</span>` : ''}
605
+ </div>`;
606
+ }).join('')}
607
+ </div>
608
+ </div>
609
+ </div>
610
+ <div class="con-footer">
611
+ ${!isDone ? `<button class="btn btn-blue" style="flex:1" onclick="openLogOverlay(${c.id})">Einlagerung protokollieren</button>` : `<span style="flex:1; text-align:center; color:var(--success); font-weight:900;">MISSION ABGESCHLOSSEN</span>`}
612
+ </div>
613
+ </div>
614
+ `;
615
+ }).join('') || '<p style="text-align:center; padding:40px; color:var(--text-dim)">Keine aktiven Verträge vorhanden.</p>';
616
+
617
+ // Stats View
618
+ const nowT = new Date().getTime();
619
+ let pData = {};
620
+ state.contracts.concat(state.archivedContracts).forEach(c => {
621
+ c.logs.forEach(l => {
622
+ let v = true;
623
+ if(state.statsFilter === 'week' && (nowT - l.timestamp) > 604800000) v = false;
624
+ if(state.statsFilter === 'month' && (nowT - l.timestamp) > 2592000000) v = false;
625
+ if(v) {
626
+ if(!pData[l.name]) pData[l.name] = { total: 0, details: [] };
627
+ pData[l.name].total += l.amount;
628
+ pData[l.name].details.push({ conName: c.name, material: l.material, amount: l.amount });
629
+ }
630
+ });
631
+ });
632
+ const sP = Object.entries(pData).sort((a,b) => b[1].total - a[1].total), maxP = sP[0]?.[1].total || 1;
633
+ document.getElementById('statsContent').innerHTML = sP.map(([n, d]) => `<div style="margin-bottom:25px; background: rgba(255,255,255,0.01); padding: 20px; border-radius: 20px; border: 1px solid var(--border);"><div style="display:flex; justify-content:space-between; font-size:0.9rem; font-weight: 800;"><span>${n}</span><strong>${d.total} Einheiten</strong></div><div class="bar-bg"><div class="bar-fill" style="width:${(d.total/maxP)*100}%"></div></div><div style="font-size:0.7rem; color:var(--text-dim); margin-top:10px;">${d.details.map(det => `<span style="display:inline-block; background:#111; padding:2px 6px; border-radius:4px; margin:2px;">${det.amount} ${det.material} <i style="color:var(--info)">(${det.conName})</i></span>`).join('')}</div></div>`).join('') || '<p style="text-align:center; padding:40px;">Keine Daten.</p>';
634
+
635
+ // Ranking
636
+ let rData = {};
637
+ state.archivedContracts.forEach(c => {
638
+ c.logs.forEach(l => { if(!rData[l.name]) rData[l.name] = { total: 0, count: 0 }; rData[l.name].total += l.amount; rData[l.name].count++; });
639
+ });
640
+ const sR = Object.entries(rData).sort((a,b) => b[1].total - a[1].total);
641
+ document.getElementById('statsRankingList').innerHTML = sR.map(([n, d], i) => `<div class="ranking-card"><div class="rank-number ${i<3?'rank-'+(i+1):''}">${i+1}</div><div style="flex-grow:1"><div style="display:flex; justify-content:space-between;"><strong>${n}</strong><span style="color:var(--success); font-weight:900">${d.total} Einheiten</span></div><div style="font-size:0.7rem; color:var(--text-dim); margin-top:5px;">Missionen: ${d.count}</div></div></div>`).join('') || '<p style="text-align:center; padding:20px;">Ranking leer.</p>';
642
+
643
+ // Finances
644
+ let totalCap = state.finances.reduce((acc, f) => acc + (f.type === 'revenue' ? f.amount : -f.amount), 0);
645
+ document.getElementById('fullCapitalBtn').innerText = "Familienkapital: " + totalCap.toLocaleString() + "$";
646
+ document.getElementById('finTableBody').innerHTML = state.finances.map(f => `<div class="transaction-item"><div class="info"><strong>${f.note || 'Transaktion'}</strong><span style="font-size:0.65rem; color:var(--text-dim);">${f.date}</span></div><div class="amount ${f.type==='revenue'?'type-revenue':'type-expense'}">${f.type==='revenue'?'+':'-'} ${f.amount.toLocaleString()}$</div></div>`).join('') || '<p style="text-align:center; padding:20px; color:#333">Keine Buchungen.</p>';
647
+
648
+ // Admin List
649
+ document.getElementById('adminMemberList').innerHTML = state.members.map(m => `<tr><td><b>${m.n}</b></td><td>${m.id}</td><td><span class="status-tag tag-active" style="font-size:0.6rem;">${m.r}</span></td><td style="text-align:right">${p.manageMembers ? `<button class="btn-ghost" style="color:var(--error); border-color:var(--error);" onclick="state.members = state.members.filter(x => x.id !== '${m.id}'); save();">X</button>` : '-'}</td></tr>`).join('');
650
+
651
+ // Matrix
652
+ const rMatrix = ["6", "5", "4", "3", "2", "1"];
653
+ document.getElementById('adminPermMatrix').innerHTML = rMatrix.map(r => `<tr><td><strong>Rang ${r}</strong></td>${['members', 'contracts', 'stats', 'finances', 'editNews', 'manageMembers'].map(key => `<td><label class="switch"><input type="checkbox" ${state.perms[r][key] ? 'checked' : ''} onchange="state.perms['${r}']['${key}'] = !state.perms['${r}']['${key}']; save();"><span class="slider"></span></label></td>`).join('')}</tr>`).join('');
654
+
655
+ updateDropdowns();
656
+ }
657
+
658
+ function updateDropdowns() {
659
+ const html = '<option value="">Wählen...</option>' + state.members.map(m => `<option value="${m.n}">${m.n}</option>`).sort().join('');
660
+ document.querySelectorAll('select.c-name-list').forEach(s => { const v = s.value; s.innerHTML = html; s.value = v; });
661
+ }
662
+
663
+ function resetSystem() { if(confirm("ALLES LÖSCHEN?")) { localStorage.clear(); location.reload(); } }
664
+ window.onload = () => updateUI();
665
+ </script>
666
+ </body>
667
+ </html>
668
+ </script>
669
+ </body>
670
+ </html>