'use client'
import { CheckCircle2Icon, XCircleIcon } from 'lucide-react'
import { useActionState } from 'react'
import {
cancelActionPlanFormAction,
markActionPlanRealizedFormAction,
} from '@/app/(campaign)/campanha/(app)/planos/[slug]/lifecycleFormActions'
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/Alert'
import {
AlertDialog,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from '@/components/ui/AlertDialog'
import { Button } from '@/components/ui/button'
import { Spinner } from '@/components/ui/Spinner'
type LifecycleDialogProps = {
planId: number
}
export const CancelActionPlanDialog = ({ planId }: LifecycleDialogProps) => {
const [state, action, pending] = useActionState(cancelActionPlanFormAction, {})
return (
Cancelar este plano?
O plano será marcado como cancelado. Os dados permanecem preservados no sistema.
{state.message ? (
Não foi possível cancelar{state.message}
) : null}
)
}
export const MarkActionPlanRealizedDialog = ({ planId }: LifecycleDialogProps) => {
const [state, action, pending] = useActionState(markActionPlanRealizedFormAction, {})
return (
Marcar este plano como realizado?
Use esta ação após a execução da atividade. O status não poderá voltar a rascunho ou
planejado por aqui.
{state.message ? (
Não foi possível concluir{state.message}
) : null}
)
}