A continuation of HomeBox the inventory and organization system built for the Home User
ProductBarcode: add barcode processing in frontend
Crumb Owlc3af4ac4ac79
diff --git a/frontend/components/App/ScannerModal.vue b/frontend/components/App/ScannerModal.vueindex 9d9e495e..83c23b74 100644--- a/frontend/components/App/ScannerModal.vue+++ b/frontend/components/App/ScannerModal.vue@@ -56,7 +56,7 @@const { t } = useI18n();- const { activeDialog, closeDialog } = useDialog();+ const { activeDialog, openDialog, closeDialog } = useDialog();const open = computed(() => activeDialog.value && activeDialog.value.id === "scanner");const sources = ref<MediaDeviceInfo[]>([]);@@ -66,6 +66,7 @@const codeReader = new BrowserMultiFormatReader();const errorMessage = ref<string | null>(null);const detectedBarcode = ref<string>("");+ const api = useUserApi();const handleError = (error: unknown) => {console.error("Scanner error:", error);@@ -85,6 +86,46 @@const handleButtonClick = () => {console.log("Button clicked!");++ getQRCodeUrl();+ // console.log("Value::: ", productEAN);++ /* const route2 = useRoute();++ const currentURL = window.location.href;+ // Adjust route import as needed+ console.log(route2(`/getproductfromean`)); */+ };++/*+ function openCreateModal(ItemCreate ic) {+ this.$emit('open-modal', ic)+ }+ */++ async function getQRCodeUrl() {+ /* const { isCanceled } = await confirm.open(+ "Are you sure you want to ensure all assets have an ID? This can take a while and cannot be undone."+ );++ if (isCanceled) {+ return;+ } */++ const result = await api.actions.getEAN(detectedBarcode.value);++ // this.$store.commit('setScannedData', result);++ if(result.error)+ return++ openDialog("create-item", result.data);++ /* if (result.error) {+ toast.error("Failed to ensure asset IDs.");+ } */++ // toast.success(`${result.data.completed} assets have been updated.`);};const startScanner = async () => {diff --git a/frontend/components/Item/CreateModal.vue b/frontend/components/Item/CreateModal.vueindex ec935f47..b6a5ab5d 100644--- a/frontend/components/Item/CreateModal.vue+++ b/frontend/components/Item/CreateModal.vue@@ -310,6 +310,13 @@form.location = found;}}++ if(active.params)+ {+ form.name = active.params.name;+ form.description = active.params.description;+ }+if (labelId.value) {form.labels = labels.value.filter(l => l.id === labelId.value).map(l => l.id);}