From a74e148da4e98c352c74da53dbaed894faf8edae Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 19 Dec 2023 02:34:45 +0100 Subject: [PATCH] pages/orders and pages/clients: add missing logic in handleSubmit in clients, adding 1 to total was missing in orders, adding the added memeber to the list and adding to total was missing --- pages/clients.vue | 1 + pages/orders.vue | 8 ++++++++ server/api/orders/[id].get.ts | 1 + 3 files changed, 10 insertions(+) diff --git a/pages/clients.vue b/pages/clients.vue index f85620e..743158a 100644 --- a/pages/clients.vue +++ b/pages/clients.vue @@ -98,6 +98,7 @@ async function handleSubmit() { }, ); clients.value.unshift(result); + count.value.count++; } catch (e) { console.error(e); submitting.value = false; diff --git a/pages/orders.vue b/pages/orders.vue index 4dbcfb7..b583479 100644 --- a/pages/orders.vue +++ b/pages/orders.vue @@ -93,6 +93,14 @@ async function handleSubmit() { body: formData.value, }, ); + orders.value.unshift({ + ...result, + imported_products_count: result.imported_products.length, + work_count: result.work.length, + // NOTE: currently all newly created orders on this page are valued zero + value: 0, + }); + count.value.count++; } catch (e) { console.error(e); submitting.value = false; diff --git a/server/api/orders/[id].get.ts b/server/api/orders/[id].get.ts index a98bca9..aad124e 100644 --- a/server/api/orders/[id].get.ts +++ b/server/api/orders/[id].get.ts @@ -25,6 +25,7 @@ export async function getOrder(id: bigint) { offer: true, }, }, + client: true, }, });