Rebuild as InnungsApp project: replace stadtwerke analysis with full documentation
- PRD: vollständige Produktspezifikation (5 Module, Scope, Akzeptanzkriterien) - ARCHITECTURE: Tech Stack, Ordnerstruktur, Multi-Tenancy, Push, Kosten - DATABASE_SCHEMA: Vollständiges SQL-Schema mit RLS Policies und Views - USER_STORIES: 40+ Stories nach Rolle (Admin, Mitglied, Azubi, Obermeister) - PERSONAS: 5 detaillierte Nutzerprofile mit Alltag, Zitaten und Erwartungen - BUSINESS_MODEL: Preistabellen, Unit Economics, Revenue-Projektionen, Distribution - ROADMAP: 6 Phasen, Sprint-Planung, Meilensteine und KPIs - COMPETITIVE_ANALYSIS: Wettbewerbsmatrix, USPs, Preispositionierung - API_DESIGN: Supabase Query Patterns, Edge Functions, Realtime Subscriptions - ONBOARDING_FLOWS: 7 User Flows von Setup bis Fehlerfall - GTM_STRATEGY: 3-Phasen-Vertrieb, Outreach-Sequenz, Einwandbehandlung - AZUBI_MODULE: Video-Feed, 1-Click-Apply, Chat, Berichtsheft, Quiz - DSGVO_KONZEPT: Rechtsgrundlagen, TOMs, AVV, Minderjährige, Incident Response - FEATURES_BACKLOG: 72 Features nach MoSCoW + Technische Schulden Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
'use client'
|
||||
|
||||
import { trpc } from '@/lib/trpc-client'
|
||||
import { useRouter } from 'next/navigation'
|
||||
|
||||
export function DeactivateButton({ id }: { id: string }) {
|
||||
const router = useRouter()
|
||||
const mutation = trpc.stellen.deactivate.useMutation({
|
||||
onSuccess: () => router.refresh(),
|
||||
})
|
||||
|
||||
return (
|
||||
<button
|
||||
onClick={() => mutation.mutate({ id })}
|
||||
disabled={mutation.isPending}
|
||||
className="text-sm text-red-600 hover:underline disabled:opacity-50"
|
||||
>
|
||||
Deaktivieren
|
||||
</button>
|
||||
)
|
||||
}
|
||||
78
innungsapp/apps/admin/app/dashboard/stellen/page.tsx
Normal file
78
innungsapp/apps/admin/app/dashboard/stellen/page.tsx
Normal file
@@ -0,0 +1,78 @@
|
||||
import { prisma } from '@innungsapp/shared'
|
||||
import { auth } from '@/lib/auth'
|
||||
import { headers } from 'next/headers'
|
||||
import { redirect } from 'next/navigation'
|
||||
import { format } from 'date-fns'
|
||||
import { de } from 'date-fns/locale'
|
||||
import { DeactivateButton } from './DeactivateButton'
|
||||
|
||||
export default async function StellenPage() {
|
||||
const session = await auth.api.getSession({ headers: await headers() })
|
||||
if (!session?.user) redirect('/login')
|
||||
const userRole = await prisma.userRole.findFirst({
|
||||
where: { userId: session.user.id, role: 'admin' },
|
||||
})
|
||||
if (!userRole) redirect('/dashboard')
|
||||
|
||||
const stellen = await prisma.stelle.findMany({
|
||||
where: { orgId: userRole.orgId },
|
||||
include: { member: { select: { name: true, betrieb: true } } },
|
||||
orderBy: [{ aktiv: 'desc' }, { createdAt: 'desc' }],
|
||||
})
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold text-gray-900">Lehrlingsbörse</h1>
|
||||
<p className="text-gray-500 mt-1">
|
||||
{stellen.filter((s) => s.aktiv).length} aktive Angebote
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="bg-white rounded-xl border shadow-sm overflow-hidden">
|
||||
<table className="w-full data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Betrieb</th>
|
||||
<th>Sparte</th>
|
||||
<th>Stellen</th>
|
||||
<th>Lehrjahr</th>
|
||||
<th>Vergütung</th>
|
||||
<th>Eingestellt</th>
|
||||
<th>Status</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{stellen.map((s) => (
|
||||
<tr key={s.id} className={!s.aktiv ? 'opacity-50' : ''}>
|
||||
<td>
|
||||
<p className="font-medium text-gray-900">{s.member.betrieb}</p>
|
||||
<p className="text-xs text-gray-500">{s.member.name}</p>
|
||||
</td>
|
||||
<td>{s.sparte}</td>
|
||||
<td className="text-center">{s.stellenAnz}</td>
|
||||
<td>{s.lehrjahr ?? '—'}</td>
|
||||
<td>{s.verguetung ?? '—'}</td>
|
||||
<td>{format(s.createdAt, 'dd.MM.yyyy', { locale: de })}</td>
|
||||
<td>
|
||||
<span
|
||||
className={`px-2 py-0.5 rounded-full text-xs font-medium ${s.aktiv ? 'bg-green-100 text-green-700' : 'bg-gray-100 text-gray-500'}`}
|
||||
>
|
||||
{s.aktiv ? 'Aktiv' : 'Inaktiv'}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
{s.aktiv && <DeactivateButton id={s.id} />}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
{stellen.length === 0 && (
|
||||
<div className="text-center py-8 text-gray-500">Noch keine Stellenangebote</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user