From 13fc5e9abb51b11b729ef54630c229023c9bcd7e Mon Sep 17 00:00:00 2001 From: Marius Mutu Date: Sun, 4 Jan 2026 05:49:10 +0200 Subject: [PATCH] fix(data-entry): Show action buttons after saving new receipt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Vue Router reuses the component when navigating from create to view mode, so onMounted doesn't run again and loadReceipt() was never called. This left receipt.value as null, causing the Edit/Submit buttons to not appear. Added a watcher for route.params.id that loads the receipt when navigating from create to view mode, and resets the form when navigating back to create. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../views/receipts/ReceiptCreateView.vue | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/modules/data-entry/views/receipts/ReceiptCreateView.vue b/src/modules/data-entry/views/receipts/ReceiptCreateView.vue index a67e488..5471a3a 100644 --- a/src/modules/data-entry/views/receipts/ReceiptCreateView.vue +++ b/src/modules/data-entry/views/receipts/ReceiptCreateView.vue @@ -914,6 +914,48 @@ const syncSuppliersIfNeeded = async () => { } } +// Watch for route param changes - reload receipt when navigating from create to view +// This handles the case where Vue Router reuses the component instance +watch( + () => route.params.id, + async (newId, oldId) => { + if (newId && newId !== oldId) { + // Navigated to a receipt (view or edit mode) + console.log('[ReceiptCreateView] Route changed to receipt:', newId) + await loadReceipt() + } else if (!newId && oldId) { + // Navigated back to create mode - reset state + console.log('[ReceiptCreateView] Route changed to create mode') + receipt.value = null + existingAttachments.value = [] + selectedFiles.value = [] + ocrData.value = null + form.value = { + receipt_type: 'bon_fiscal', + direction: 'cheltuiala', + receipt_date: new Date(), + amount: null, + partner_name: null, + cui: '', + ocr_raw_text: '', + expense_type_code: null, + payment_mode: null, + cash_register_id: null, + cash_register_name: null, + cash_register_account: null, + receipt_number: '', + description: '', + company_id: getSelectedCompanyId(), + tva_breakdown: [], + tva_total: null, + items_count: null, + vendor_address: '', + payment_methods: [], + } + } + } +) + // Watch for company changes - sync suppliers in background watch( () => companyStore.selectedCompany,