Changeset 299af01 for src/sections
- Timestamp:
- 02/26/25 14:27:26 (6 weeks ago)
- Branches:
- main
- Children:
- 3c5302a
- Parents:
- 057453c
- Location:
- src/sections
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sections/auth/firebase/firebase-login-view.tsx
r057453c r299af01 74 74 const renderHead = ( 75 75 <Stack spacing={2} sx={{ mb: 5 }}> 76 <Typography variant="h4">Sign in to MVP Masters</Typography>76 <Typography variant="h4">Sign in to AgencyOS</Typography> 77 77 </Stack> 78 78 ); -
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 ( -
src/sections/user/customer-new-edit-form.tsx
r057453c r299af01 53 53 }, 54 54 vatNumber: currentCustomer?.vatNumber || '', 55 companyId: currentCustomer?.companyId || '',56 55 companyNumber: currentCustomer?.companyNumber || '', 57 56 id: currentCustomer?.id || '', … … 86 85 const logoUrl = await uploadToFirebaseStorage(logoFile, storagePath); 87 86 88 // const customersRef = collection(db, 'customers');89 // await addDoc(customersRef, { ...data, logoUrl });90 87 await createCustomer({ ...data, logoUrl }); 91 88 -
src/sections/user/customer-quick-edit-form.tsx
r057453c r299af01 14 14 import DialogContent from '@mui/material/DialogContent'; 15 15 // types 16 import { Customer, customerSchema } from 'src/schemas';16 import { Customer, updateCustomerSchema } from 'src/schemas'; 17 17 // assets 18 18 import { countries } from 'src/assets/data'; … … 21 21 import { useSnackbar } from 'src/components/snackbar'; 22 22 import FormProvider, { RHFSelect, RHFTextField, RHFAutocomplete } from 'src/components/hook-form'; 23 import { doc, setDoc } from 'firebase/firestore'; 24 import { db } from 'src/lib/firebase'; 25 import { mutate } from 'swr'; 26 import { collections } from 'src/lib/firestore'; 23 import { updateCustomer } from 'src/api/customer'; 27 24 28 25 // ---------------------------------------------------------------------- … … 58 55 }, 59 56 vatNumber: currentCustomer?.vatNumber || '', 60 companyId: currentCustomer?.companyId || '',61 57 companyNumber: currentCustomer?.companyNumber || '', 62 58 id: currentCustomer?.id || '', … … 68 64 69 65 const methods = useForm({ 70 resolver: zodResolver( customerSchema),66 resolver: zodResolver(updateCustomerSchema), 71 67 defaultValues, 72 68 }); … … 80 76 const onSubmit = handleSubmit(async (data) => { 81 77 try { 78 console.log('currentCustomer', currentCustomer); 82 79 if (!currentCustomer) return; 83 // await new Promise((resolve) => setTimeout(resolve, 500)); 84 85 const docRef = doc(db, 'customers', currentCustomer.id!); 86 await setDoc(docRef, data, { merge: true }); 87 mutate(collections.customer); 80 console.log('data', data); 81 await updateCustomer(currentCustomer.id!, data); 88 82 89 83 reset(); … … 93 87 } catch (error) { 94 88 console.error(error); 89 enqueueSnackbar('Update failed!', { variant: 'error' }); 95 90 } 96 91 });
Note:
See TracChangeset
for help on using the changeset viewer.