diff --git a/src/pages/ManualInvoicesPage.jsx b/src/pages/ManualInvoicesPage.jsx
index 3c9b946..e98834a 100644
--- a/src/pages/ManualInvoicesPage.jsx
+++ b/src/pages/ManualInvoicesPage.jsx
@@ -1,4 +1,5 @@
import { useState } from 'react'
+import { useLocation } from 'react-router-dom'
import { Container, Button } from 'react-bootstrap'
import { Helmet } from 'react-helmet-async'
import { toast } from 'react-toastify'
@@ -8,12 +9,16 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faPen } from '@fortawesome/pro-light-svg-icons'
import { Grid, ManualInvoiceModal } from '../components'
-import { useGetManualInvoicesQuery, useLazyGetEnumsQuery, useUpdateStatusesMutation } from '../services/manual-invoices'
+import {
+ useGetManualInvoicesQuery,
+ useLazyGetEnumsQuery,
+ useUpdateStatusesMutation,
+ useGenerateGroupedInvoiceMutation,
+} from '../services/manual-invoices'
import { useLazyGetOrganizationsFlatWithAddressQuery } from '../services/organizations'
import { useLazyGetUsersQuery } from '../services/users'
import { gridContextMenu, downloadCsvFile } from '../utils'
import { mapPathnameToInvoiceType } from '../constants/invoices'
-import { useLocation } from 'react-router-dom'
const INVOICE_STATUSES = ['En préparation', 'A traiter', 'Exportée', 'Non transmissible', 'Annulée', 'Envoyée']
@@ -40,6 +45,7 @@ export function ManualInvoicesPage() {
const [fetchUsers, { data: users }] = useLazyGetUsersQuery()
const [fetchEnums, { data: enums }] = useLazyGetEnumsQuery()
const [updateStatuses, { isLoading: isStatusesUpdating }] = useUpdateStatusesMutation()
+ const [generateGroupedInvoices, { isLoading: isGeneratingGroupedInvoices }] = useGenerateGroupedInvoiceMutation()
const location = useLocation()
@@ -388,6 +394,20 @@ export function ManualInvoicesPage() {
+
+
{isManualInvoiceModalOpen && (
({
+ url: 'grouped',
+ method: 'POST',
+ body: { type },
+ }),
+ }),
}),
})
@@ -49,4 +56,5 @@ export const {
useCreateManualInvoiceMutation,
useUpdateManualInvoiceMutation,
useRemoveManualInvoiceMutation,
+ useGenerateGroupedInvoiceMutation,
} = manualInvoicesApi