From 7cb20febbfd61e1f27306ffe0ca344740522eebb Mon Sep 17 00:00:00 2001 From: Stefan van Herwijnen Date: Wed, 2 Oct 2024 17:12:24 +0200 Subject: [PATCH] feat: allow searching for invoice clientDetails name --- packages/api/package.json | 4 +- packages/api/src/trpc/admin/invoices.ts | 10 +++- packages/app/package.json | 2 +- packages/app/src/pages/admin/BillsPage.vue | 20 ++++++-- packages/app/src/pages/admin/InvoicesPage.vue | 19 ++++++- packages/app/src/pages/admin/ReceiptsPage.vue | 20 +++++++- pnpm-lock.yaml | 50 ++++++++----------- 7 files changed, 86 insertions(+), 39 deletions(-) diff --git a/packages/api/package.json b/packages/api/package.json index 170187b..4691884 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -50,9 +50,9 @@ "@fastify/cors": "^10.0.1", "@fastify/middie": "9.0.2", "@fastify/static": "8.0.1", - "@modular-api/api": "^0.5.0", + "@modular-api/api": "^0.5.1", "@modular-api/fastify-cart": "^0.3.0", - "@modular-api/fastify-checkout": "^0.4.0", + "@modular-api/fastify-checkout": "^0.4.1", "@modular-api/fastify-oidc": "^0.6.0", "@mollie/api-client": "^4.0.0", "@slimfact/app": "^0.1.0", diff --git a/packages/api/src/trpc/admin/invoices.ts b/packages/api/src/trpc/admin/invoices.ts index 1a55f5d..304f994 100644 --- a/packages/api/src/trpc/admin/invoices.ts +++ b/packages/api/src/trpc/admin/invoices.ts @@ -234,6 +234,12 @@ export const adminInvoiceRoutes = ({ .object({ companyId: z.number().nullable().optional(), clientId: z.number().nullable().optional(), + clientDetails: z + .object({ + name: z.string().nullable() + }) + .nullable() + .optional(), status: z.nativeEnum(InvoiceStatus).nullable(), pagination: z .object({ @@ -252,11 +258,13 @@ export const adminInvoiceRoutes = ({ .optional() ) .query(async ({ input }) => { - const { companyId, clientId, status, pagination } = input || {} + const { companyId, clientId, clientDetails, status, pagination } = + input || {} if (fastify.checkout?.invoiceHandler) { const invoices = await fastify.checkout.invoiceHandler.getInvoices({ companyId, clientId, + clientDetails, status, options: { withPayments: true, diff --git a/packages/app/package.json b/packages/app/package.json index 0e28cc1..888e365 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -43,7 +43,7 @@ }, "devDependencies": { "@modular-api/fastify-cart": "^0.3.0", - "@modular-api/fastify-checkout": "^0.4.0", + "@modular-api/fastify-checkout": "^0.4.1", "@modular-api/quasar-components": "^0.3.0", "@quasar/extras": "1.16.12", "@quasar/quasar-ui-qcalendar": "4.0.0-beta.16", diff --git a/packages/app/src/pages/admin/BillsPage.vue b/packages/app/src/pages/admin/BillsPage.vue index ef6a556..8023077 100644 --- a/packages/app/src/pages/admin/BillsPage.vue +++ b/packages/app/src/pages/admin/BillsPage.vue @@ -22,7 +22,9 @@ v-model="clientId" :filtered-options="filteredClients" clearable + use-input @filter="onFilterClients" + @new-value="onNewValueClients" /> @@ -90,7 +92,7 @@ export default {