"use client"; import { useState, useTransition } from "react"; import { useRouter } from "next/navigation"; import { CheckCheck, Loader2 } from "lucide-react"; import { toast } from "sonner"; import { Button } from "@/components/ui/button"; import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "@/components/ui/dialog"; import { bulkAcceptPendingJobsAction } from "@/lib/appwrite/job-actions"; export function BulkAcceptButton({ count }: { count: number }) { const router = useRouter(); const [open, setOpen] = useState(false); const [pending, startTransition] = useTransition(); if (count === 0) return null; function onConfirm() { startTransition(async () => { const res = await bulkAcceptPendingJobsAction(); if (res.ok) { toast.success(`${res.accepted ?? 0} iş işleme alındı.`); setOpen(false); router.refresh(); } else { toast.error(res.error ?? "İşlem başarısız."); } }); } return ( {count} iş işleme alınsın mı? Tüm bekleyen işler aynı anda işleme alınır; her birinde alt yapı üretimine başlanmış sayılır. Klinikler ayrı ayrı bilgilendirilir. ); }