From 877070fc71ff266af64d9f1c374bbf05bdc76c0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20H=C3=B6ffken?= Date: Fri, 8 Dec 2023 07:20:26 +0100 Subject: [PATCH] Redirect to mete to add barcode on click (#14) Add the option to click on the warning that the barcode is not known, so that we can directly add it in mete. To achieve this I added the `url` prop to `Mete.vue`. NOTE: I had to cast `this.$root` to any - if you have better ideas please share! I assume this is quite hacky - nicer approaches welcome. And help wanted to fix the checks :upside_down_face: To test this add `this.addFromBarcode('asdf?!<');` to `Register.vue`'s `mounted` function. --- src/App.vue | 11 ++++++++++- src/components/Mete.vue | 8 +++++++- src/components/Register.vue | 3 ++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/App.vue b/src/App.vue index 12370c6..b15f293 100644 --- a/src/App.vue +++ b/src/App.vue @@ -26,7 +26,7 @@ - + @@ -49,6 +49,7 @@ export default defineComponent({ return { menu: false, mete: false, + meteUrl: '/mete', storno: false, }; }, @@ -85,6 +86,14 @@ export default defineComponent({ goMete($event: Event) { $event.preventDefault(); + this.meteUrl = '/mete'; + this.menu = false; + this.mete = true; + }, + addNewBarCode($event: Event, barcode: string) { + $event.preventDefault(); + + this.meteUrl = '/mete/barcodes/new?id=' + encodeURIComponent(barcode); this.menu = false; this.mete = true; }, diff --git a/src/components/Mete.vue b/src/components/Mete.vue index 3b2de2a..e173ccf 100644 --- a/src/components/Mete.vue +++ b/src/components/Mete.vue @@ -1,5 +1,5 @@