import LandlordLayout from "@/Layouts/LandlordLayout"; import { Link, router } from "@inertiajs/react"; import { Plus, Edit, Trash2, Globe } from "lucide-react"; import { useState } from "react"; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "@/Components/ui/alert-dialog"; interface Tenant { id: string; name: string; email: string | null; is_active: boolean; created_at: string; domains: string[]; } interface Props { tenants: Tenant[]; } export default function TenantIndex({ tenants }: Props) { const [deleteTarget, setDeleteTarget] = useState(null); const handleDelete = () => { if (deleteTarget) { router.delete(route("landlord.tenants.destroy", deleteTarget.id)); setDeleteTarget(null); } }; return (
{/* Header */}

客戶管理

管理系統中的所有客戶

新增客戶
{/* Table */}
{tenants.length === 0 ? ( ) : ( tenants.map((tenant) => ( )) )}
ID 名稱 域名 狀態 建立時間 操作
尚無客戶資料,請點擊「新增客戶」建立第一個客戶
{tenant.id}

{tenant.name}

{tenant.email && (

{tenant.email}

)}
{tenant.domains.length > 0 ? (
{tenant.domains.map((domain) => ( {domain} ))}
) : ( )}
{tenant.is_active ? "啟用" : "停用"} {tenant.created_at}
{/* Delete Confirmation */} setDeleteTarget(null)}> 確定要刪除這個客戶嗎? 刪除客戶將會同時刪除其資料庫和所有資料,此操作無法復原。 取消 確定刪除
); }