Changeset 299af01 for src/sections/invoice
- Timestamp:
- 02/26/25 14:27:26 (6 weeks ago)
- Branches:
- main
- Children:
- 3c5302a
- Parents:
- 057453c
- Location:
- src/sections/invoice
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sections/invoice/invoice-new-edit-form.tsx
r057453c r299af01 209 209 const invoicePdf = <InvoicePDF invoice={writeData as Invoice} currentStatus="pending" />; 210 210 const blob: Blob = await pdf(invoicePdf).toBlob(); 211 const storagePath: string = `invoices/${writeData.invoiceTo.name} /${id}-${writeData.invoiceNumber}.pdf`;211 const storagePath: string = `invoices/${writeData.invoiceTo.name}-${writeData.invoiceNumber}.pdf`; 212 212 await uploadToFirebaseStorage(blob, storagePath); 213 213 … … 269 269 const invoicePdf = <InvoicePDF invoice={writeData as Invoice} currentStatus="pending" />; 270 270 const blob: Blob = await pdf(invoicePdf).toBlob(); 271 const storagePath: string = `invoices/${data.invoiceTo.name} /${currentInvoice.id}-${data.invoiceNumber}.pdf`;271 const storagePath: string = `invoices/${data.invoiceTo.name}-${data.invoiceNumber}.pdf`; 272 272 await uploadToFirebaseStorage(blob, storagePath); 273 273 … … 335 335 const invoicePdf = <InvoicePDF invoice={writeData as Invoice} currentStatus="pending" />; 336 336 const blob: Blob = await pdf(invoicePdf).toBlob(); 337 const storagePath: string = `invoices/${data.invoiceTo.name} /${id}-${data.invoiceNumber}.pdf`;337 const storagePath: string = `invoices/${data.invoiceTo.name}-${data.invoiceNumber}.pdf`; 338 338 await uploadToFirebaseStorage(blob, storagePath); 339 339 -
src/sections/invoice/view/invoice-list-view.tsx
r057453c r299af01 49 49 import InvoiceTableToolbar from '../invoice-table-toolbar'; 50 50 import MailCompose from '../mail-compose'; 51 import { useFetchAnalytics } from 'src/api/invoice/use-fetch-analytics'; 52 import { endpoints } from 'src/utils/axios'; 51 53 52 54 // ---------------------------------------------------------------------- … … 208 210 // ); 209 211 212 const { 213 analytics: analyticsData, 214 isAnalyticsLoading, 215 analyticsError, 216 } = useFetchAnalytics(filters.startDate); 217 210 218 useEffect(() => { 211 if (tableData) { 212 const getAnalytics = async () => { 213 const analyticsStats = await getTotalAmountForAllStatuses(tableData); 214 setAnalytics(analyticsStats); 215 }; 216 getAnalytics(); 219 if (analyticsData) { 220 setAnalytics(analyticsData); 217 221 } 218 }, [tableData]); 222 }, [analyticsData]); 223 224 useEffect(() => { 225 if (analyticsError) { 226 console.error('Failed to load analytics:', analyticsError); 227 } 228 }, [analyticsError]); 219 229 220 230 const getPercentByStatus = (status: string) => … … 272 282 await deleteInvoiceMutation(invoice.id); 273 283 await deleteFromFirebaseStorage( 274 `invoices/${invoice.invoiceTo.name} /${invoice.id}-${invoice.invoiceNumber}.pdf`284 `invoices/${invoice.invoiceTo.name}-${invoice.invoiceNumber}.pdf` 275 285 ); 276 286 277 mutate( invoiceMutationKey);287 mutate(endpoints.invoice); 278 288 }, 279 289 [filters.startDate, invoiceMutationKey] … … 332 342 setFilters(defaultFilters); 333 343 }, []); 344 345 if (isAnalyticsLoading) { 346 // Show loading state 347 } 334 348 335 349 return (
Note:
See TracChangeset
for help on using the changeset viewer.