From 09ca04fee6fcd884b7eb3304a4251beb43a34a2f Mon Sep 17 00:00:00 2001 From: laxmanhalaki Date: Tue, 17 Mar 2026 19:50:06 +0530 Subject: [PATCH] added shared summary notify and allowed current approver to add approver --- .../layout/PageLayout/PageLayout.tsx | 14 ++++++ .../workNote/WorkNoteChat/WorkNoteChat.tsx | 10 ++-- .../CreateRequest/ApprovalWorkflowStep.tsx | 46 +++++-------------- src/custom/pages/RequestDetail.tsx | 5 +- src/dealer-claim/pages/RequestDetail.tsx | 2 +- src/pages/Notifications/Notifications.tsx | 13 ++++++ .../components/QuickActionsSidebar.tsx | 5 +- .../components/tabs/WorkNotesTab.tsx | 6 +-- 8 files changed, 54 insertions(+), 47 deletions(-) diff --git a/src/components/layout/PageLayout/PageLayout.tsx b/src/components/layout/PageLayout/PageLayout.tsx index 689dc03..4f6ba7e 100644 --- a/src/components/layout/PageLayout/PageLayout.tsx +++ b/src/components/layout/PageLayout/PageLayout.tsx @@ -108,6 +108,20 @@ export function PageLayout({ children, currentPage = 'dashboard', onNavigate, on // Navigate to the request if URL provided if (notification.actionUrl && onNavigate) { + // PRIORITY: For shared summaries or specific action URLs, use them directly + if (notification.actionUrl && ( + notification.notificationType === 'summary_shared' || + notification.actionUrl.includes('shared-summaries') + )) { + console.log('[PageLayout] Navigating to shared summary:', notification.actionUrl); + const targetUrl = notification.actionUrl.startsWith('/') + ? notification.actionUrl.substring(1) + : notification.actionUrl; + onNavigate(targetUrl); + setNotificationsOpen(false); + return; + } + // Extract request number from URL (e.g., /request/REQ-2025-12345) const requestNumber = notification.metadata?.requestNumber; if (requestNumber) { diff --git a/src/components/workNote/WorkNoteChat/WorkNoteChat.tsx b/src/components/workNote/WorkNoteChat/WorkNoteChat.tsx index dc81250..828dc60 100644 --- a/src/components/workNote/WorkNoteChat/WorkNoteChat.tsx +++ b/src/components/workNote/WorkNoteChat/WorkNoteChat.tsx @@ -79,10 +79,10 @@ interface WorkNoteChatProps { skipSocketJoin?: boolean; // Set to true when embedded in RequestDetail (to avoid double join) requestTitle?: string; // Optional title for display onAttachmentsExtracted?: (attachments: any[]) => void; // Callback to pass attachments to parent - isInitiator?: boolean; // Whether current user is the initiator isSpectator?: boolean; // Whether current user is a spectator (view-only) currentLevels?: any[]; // Current approval levels for add approver modal onAddApprover?: (email: string, tatHours: number, level: number) => Promise; // Callback to add approver + canAddApprover?: boolean; // Whether the current user can add approvers maxApprovalLevels?: number; // Maximum allowed approval levels from system policy onPolicyViolation?: (violations: Array<{ type: string; message: string; currentValue?: number; maxValue?: number }>) => void; // Callback for policy violations } @@ -145,7 +145,7 @@ const FileIcon = ({ type }: { type: string }) => { return ; }; -export function WorkNoteChat({ requestId, messages: externalMessages, onSend, skipSocketJoin = false, requestTitle, onAttachmentsExtracted, isInitiator = false, isSpectator = false, currentLevels = [], onAddApprover, maxApprovalLevels, onPolicyViolation }: WorkNoteChatProps) { +export function WorkNoteChat({ requestId, messages: externalMessages, onSend, skipSocketJoin = false, requestTitle, onAttachmentsExtracted, isSpectator = false, currentLevels = [], onAddApprover, canAddApprover, maxApprovalLevels, onPolicyViolation }: WorkNoteChatProps) { const routeParams = useParams<{ requestId: string }>(); const effectiveRequestId = requestId || routeParams.requestId || ''; const [message, setMessage] = useState(''); @@ -1743,8 +1743,8 @@ export function WorkNoteChat({ requestId, messages: externalMessages, onSend, sk

Quick Actions

- {/* Only initiator can add approvers */} - {isInitiator && ( + {/* Only initiator or current approver can add approvers in custom flows */} + {canAddApprover && (