From 8e3e138ef8139643e539faba01e4df3b91ef4d6f Mon Sep 17 00:00:00 2001 From: laxmanhalaki Date: Tue, 2 Dec 2025 21:05:45 +0530 Subject: [PATCH] summary tab made visible for paricipants create rquest pay load alteration for simple payload --- src/components/workflow/ResumeModal.tsx | 114 ++++++++++++++++++ src/hooks/useRequestDetails.ts | 50 +++++++- .../CreateRequest/utils/payloadBuilders.ts | 61 +++++----- src/pages/RequestDetail/RequestDetail.tsx | 84 +++++-------- .../components/QuickActionsSidebar.tsx | 31 ++--- .../components/tabs/OverviewTab.tsx | 11 +- src/services/workflowApi.ts | 40 +++--- 7 files changed, 260 insertions(+), 131 deletions(-) create mode 100644 src/components/workflow/ResumeModal.tsx diff --git a/src/components/workflow/ResumeModal.tsx b/src/components/workflow/ResumeModal.tsx new file mode 100644 index 0000000..d73ae97 --- /dev/null +++ b/src/components/workflow/ResumeModal.tsx @@ -0,0 +1,114 @@ +import { useState } from 'react'; +import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from '@/components/ui/dialog'; +import { Button } from '@/components/ui/button'; +import { Label } from '@/components/ui/label'; +import { Textarea } from '@/components/ui/textarea'; +import { Loader2, Play } from 'lucide-react'; +import { toast } from 'sonner'; +import { resumeWorkflow } from '@/services/workflowApi'; + +interface ResumeModalProps { + isOpen: boolean; + onClose: () => void; + requestId: string; + onSuccess?: () => void | Promise; +} + +export function ResumeModal({ isOpen, onClose, requestId, onSuccess }: ResumeModalProps) { + const [notes, setNotes] = useState(''); + const [submitting, setSubmitting] = useState(false); + + const handleSubmit = async () => { + try { + setSubmitting(true); + await resumeWorkflow(requestId, notes.trim() || undefined); + toast.success('Workflow resumed successfully'); + + // Wait for parent to refresh data before closing modal + if (onSuccess) { + await onSuccess(); + } + + setNotes(''); + onClose(); + } catch (error: any) { + console.error('Failed to resume workflow:', error); + toast.error(error?.response?.data?.error || error?.response?.data?.message || 'Failed to resume workflow'); + } finally { + setSubmitting(false); + } + }; + + const handleClose = () => { + if (!submitting) { + setNotes(''); + onClose(); + } + }; + + return ( + + + + + + Resume Workflow + + + +
+
+

+ Note: Resuming will restart TAT calculations and notifications. The workflow will continue from where it was paused. +

+
+ +
+ +