mirror of
https://github.com/sysadminsmedia/homebox.git
synced 2025-12-21 21:33:02 +01:00
ProductBarcode: add barcode processing in frontend
This commit is contained in:
@@ -56,7 +56,7 @@
|
|||||||
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { activeDialog, closeDialog } = useDialog();
|
const { activeDialog, openDialog, closeDialog } = useDialog();
|
||||||
const open = computed(() => activeDialog.value && activeDialog.value.id === "scanner");
|
const open = computed(() => activeDialog.value && activeDialog.value.id === "scanner");
|
||||||
|
|
||||||
const sources = ref<MediaDeviceInfo[]>([]);
|
const sources = ref<MediaDeviceInfo[]>([]);
|
||||||
@@ -66,6 +66,7 @@
|
|||||||
const codeReader = new BrowserMultiFormatReader();
|
const codeReader = new BrowserMultiFormatReader();
|
||||||
const errorMessage = ref<string | null>(null);
|
const errorMessage = ref<string | null>(null);
|
||||||
const detectedBarcode = ref<string>("");
|
const detectedBarcode = ref<string>("");
|
||||||
|
const api = useUserApi();
|
||||||
|
|
||||||
const handleError = (error: unknown) => {
|
const handleError = (error: unknown) => {
|
||||||
console.error("Scanner error:", error);
|
console.error("Scanner error:", error);
|
||||||
@@ -85,6 +86,46 @@
|
|||||||
|
|
||||||
const handleButtonClick = () => {
|
const handleButtonClick = () => {
|
||||||
console.log("Button clicked!");
|
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 () => {
|
const startScanner = async () => {
|
||||||
|
|||||||
@@ -310,6 +310,13 @@
|
|||||||
form.location = found;
|
form.location = found;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(active.params)
|
||||||
|
{
|
||||||
|
form.name = active.params.name;
|
||||||
|
form.description = active.params.description;
|
||||||
|
}
|
||||||
|
|
||||||
if (labelId.value) {
|
if (labelId.value) {
|
||||||
form.labels = labels.value.filter(l => l.id === labelId.value).map(l => l.id);
|
form.labels = labels.value.filter(l => l.id === labelId.value).map(l => l.id);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user