diff --git a/src/components/dv/CallDetail.tsx b/src/components/dv/CallDetail.tsx index babfbe5..60925c8 100644 --- a/src/components/dv/CallDetail.tsx +++ b/src/components/dv/CallDetail.tsx @@ -1,3 +1,4 @@ +import { useEffect } from 'react'; import { orderBookingClient } from '../../api/clients'; import { ORDER_BOOKING } from '../../api/config'; import type { WiredDetailViewProps } from './OrderDetail'; @@ -6,9 +7,15 @@ import { Spinner } from '../reusable/Spinner'; import { EmptyState } from '../reusable/EmptyState'; import { CallCard } from '../cards/CallCard'; -export function CallDetail({ instanceId }: WiredDetailViewProps) { +export function CallDetail({ instanceId, onDataLoad }: WiredDetailViewProps) { const { data, loading, error } = useDetailViewData(orderBookingClient, ORDER_BOOKING.detailViews.CALLS, instanceId); + useEffect(() => { + if (data && onDataLoad) { + onDataLoad(data); + } + }, [data, onDataLoad]); + if (error) return ; if (loading) return
; if (!data) return ; diff --git a/src/components/dv/OrderDetail.tsx b/src/components/dv/OrderDetail.tsx index c7fea06..b112efd 100644 --- a/src/components/dv/OrderDetail.tsx +++ b/src/components/dv/OrderDetail.tsx @@ -1,3 +1,4 @@ +import { useEffect } from 'react'; import { orderBookingClient } from '../../api/clients'; import { ORDER_BOOKING } from '../../api/config'; import { useDetailViewData } from './useDetailViewData'; @@ -6,15 +7,22 @@ import { OrderCard } from '../cards/OrderCard'; export interface WiredDetailViewProps { instanceId: string | number; columns?: 1 | 2 | 3; + onDataLoad?: (data: any) => void; } -export function OrderDetail({ instanceId }: WiredDetailViewProps) { +export function OrderDetail({ instanceId, onDataLoad }: WiredDetailViewProps) { const { data, config, loading, error } = useDetailViewData( orderBookingClient, ORDER_BOOKING.detailViews.ORDERS, instanceId ); + useEffect(() => { + if (data && onDataLoad) { + onDataLoad(data); + } + }, [data, onDataLoad]); + if (loading) return
Loading Order Details...
; if (error) return
{error}
; if (!data) return
No data found.
; diff --git a/src/screens/CallsPage.tsx b/src/screens/CallsPage.tsx index 06f963b..337bac5 100644 --- a/src/screens/CallsPage.tsx +++ b/src/screens/CallsPage.tsx @@ -112,7 +112,7 @@ export function CallsPage() { > {instanceId != null && ( <> - +
{isFabOpen && (
@@ -143,6 +143,8 @@ export function CallsPage() { Place Order ); + } else if (stateName.includes('no order') || stateName.includes('non-productive') || stateName.includes('non productive')) { + return null; } return ( ); + } else if (stateName.includes('no order') || stateName.includes('non-productive') || stateName.includes('non productive')) { + return null; } return (