/* eslint-disable @typescript-eslint/no-explicit-any */ import { Head, Link, usePage } from '@inertiajs/react'; import React from 'react'; import { Button } from '@/components/ui/button'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Separator } from '@/components/ui/separator'; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "@/components/ui/tooltip"; // Import Tooltip import AppLayout from '@/layouts/app-layout'; interface Department { id: number; name: string; description: string; employees_count: number; } interface PageProps { departments: Department[]; [key: string]: unknown; } interface SharedData { flash: { success?: string; error?: string; }; } export default function Index({ departments }: PageProps) { const { flash } = usePage().props as SharedData; return (
{/* Page Header */}

Data Departemen

Kelola struktur organisasi dan unit kerja.

{/* Flash Messages */} {flash?.success && (
{flash.success}
)} {flash?.error && (
{flash.error}
)} Daftar Departemen
{departments.length > 0 ? ( departments.map((dept) => ( )) ) : ( )}
Nama Departemen Deskripsi Total Karyawan Aksi
{dept.name} {dept.description || '-'} 0 ? 'bg-blue-100 text-blue-800' : 'bg-gray-100 text-gray-600'}`}> {dept.employees_count} {dept.employees_count > 0 ? (

Akses Ditolak

Masih ada {dept.employees_count} karyawan aktif di sini.

) : ( { if (!confirm('Hapus departemen ini?')) e.preventDefault(); }} className="inline-flex items-center justify-center rounded-md text-sm font-medium h-9 px-3 text-red-600 hover:bg-red-50 transition-colors" > Hapus )}
Belum ada data departemen.
); }