import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout'; import { Head, Link, router, usePage } from '@inertiajs/react'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/Components/ui/select'; import { Badge } from '@/Components/ui/badge'; import { Button } from '@/Components/ui/button'; import { Tabs, TabsList, TabsTrigger } from '@/Components/ui/tabs'; import { ArrowLeft, Timer, Package, ClipboardList, Play, CheckCircle2, Pencil, ArrowRight } from 'lucide-react'; export default function ProjectLayout({ project, allowedTransitions, children, currentTab }: { project: any, allowedTransitions?: any[], children: React.ReactNode, currentTab: string }) { const params = new URLSearchParams(typeof window !== 'undefined' ? window.location.search : ''); const backTo = params.get('back_to'); const handleBack = (e: React.MouseEvent) => { if (backTo === 'inventory') { router.visit(route('inventory.index')); } else if (typeof window !== 'undefined') { if (window.history.length > 1) { window.history.back(); } else { router.visit(route('projects.index')); } } }; const statusLabel = (s: string) => s?.replace(/_/g, ' ').replace(/\b\w/g, c => c.toUpperCase()) || ''; const handleTransition = (status: string) => { router.patch(route('projects.transition', project.ulid), { status }); }; const handleTabChange = (val: string) => { // Kept for backward compatibility if needed, but tabs are removed }; const { projects } = usePage().props; return (

{project.name}

{project.code}

{statusLabel(project.status)}
{allowedTransitions && allowedTransitions.map((t: any) => ( ))}
) : undefined } >
{!project ? (

Select a Project

Choose a project to view its {currentTab.replace('-', ' ')} data.

{projects && projects.length > 0 ? (
{projects.map((p: any) => (
{ const url = new URL(window.location.href); url.searchParams.set('project', p.ulid); window.location.href = url.toString(); }} className="group relative flex flex-col items-start justify-between rounded-xl border border-gray-200 bg-white p-6 shadow-sm transition-all hover:border-emerald-500 hover:shadow-md cursor-pointer overflow-hidden" >

{p.name}

{p.code}

{p.status && {statusLabel(p.status)}}
Click to select
Open
))}
) : (

No projects found

There are no active projects available for your account.

)}
) : ( children )}
); }