diff --git a/src/components/pages/marketing/pdf/DeliveryOrderExport.tsx b/src/components/pages/marketing/pdf/DeliveryOrderExport.tsx index cdf18652..79238fb0 100644 --- a/src/components/pages/marketing/pdf/DeliveryOrderExport.tsx +++ b/src/components/pages/marketing/pdf/DeliveryOrderExport.tsx @@ -6,7 +6,6 @@ import { useMemo, useState } from 'react'; import { formatDate, formatNumber, formatVechicleNumber } from '@/lib/helper'; import pdfStyles from '@/components/pages/marketing/pdf/styles/MarketingPDFStyles'; import toast from 'react-hot-toast'; -import { useSearchParams } from 'next/navigation'; interface DeliveryOrderExportProps { data?: Marketing; @@ -20,9 +19,6 @@ const DeliveryOrderExport = ({ }: DeliveryOrderExportProps) => { const [isGeneratingPDF, setIsGeneratingPDF] = useState(false); const salesData = data; - const searchParams = useSearchParams(); - const action = searchParams.get('action'); - const id = searchParams.get('id'); const handleDownloadPDF = async () => { if (!salesData) { @@ -53,7 +49,6 @@ const DeliveryOrderExport = ({ toast.error('Failed to generate PDF. Please try again.'); } finally { setIsGeneratingPDF(false); - window.location.href = `/marketing?action=${action}&id=${id}`; } }; @@ -92,7 +87,7 @@ const PDFDocument = ({ return ( deliveryOrder.deliveries?.reduce((a, b) => a + b.total_price, 0) ?? 0 ); - }, []); + }, [deliveryOrder.deliveries]); return ( diff --git a/src/components/pages/marketing/pdf/SalesOrderExport.tsx b/src/components/pages/marketing/pdf/SalesOrderExport.tsx index 55eb3b5b..7e4168a9 100644 --- a/src/components/pages/marketing/pdf/SalesOrderExport.tsx +++ b/src/components/pages/marketing/pdf/SalesOrderExport.tsx @@ -6,7 +6,6 @@ import { useMemo, useState } from 'react'; import { formatDate, formatNumber } from '@/lib/helper'; import pdfStyles from '@/components/pages/marketing/pdf/styles/MarketingPDFStyles'; import toast from 'react-hot-toast'; -import { useSearchParams } from 'next/navigation'; interface SalesOrderExportProps { data?: Marketing; @@ -16,9 +15,6 @@ interface SalesOrderExportProps { const SalesOrderExport = ({ data }: SalesOrderExportProps) => { const [isGeneratingPDF, setIsGeneratingPDF] = useState(false); const salesData = data; - const searchParams = useSearchParams(); - const action = searchParams.get('action'); - const id = searchParams.get('id'); const handleDownloadPDF = async () => { if (!salesData) { @@ -47,7 +43,6 @@ const SalesOrderExport = ({ data }: SalesOrderExportProps) => { toast.error('Failed to generate PDF. Please try again.'); } finally { setIsGeneratingPDF(false); - window.location.href = `/marketing?action=${action}&id=${id}`; } };