mirror of
https://github.com/sysadminsmedia/homebox.git
synced 2025-12-26 23:21:39 +01:00
ProductBarcode: architecture: move to strongly typed DialogID and parameters
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<BaseModal dialog-id="create-location" :title="$t('components.location.create_modal.title')">
|
||||
<BaseModal :dialog-id="DialogID.CreateLocation" :title="$t('components.location.create_modal.title')">
|
||||
<form class="flex flex-col gap-2" @submit.prevent="create()">
|
||||
<LocationSelector v-model="form.parent" />
|
||||
<FormTextField
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { DialogID } from "@/components/ui/dialog-provider/utils";
|
||||
import { toast } from "@/components/ui/sonner";
|
||||
import { Button, ButtonGroup } from "~/components/ui/button";
|
||||
import BaseModal from "@/components/App/CreateModal.vue";
|
||||
@@ -41,7 +42,7 @@
|
||||
|
||||
const { activeDialog, closeDialog } = useDialog();
|
||||
|
||||
useDialogHotkey("create-location", { code: "Digit3", shift: true });
|
||||
useDialogHotkey(DialogID.CreateLocation, { code: "Digit3", shift: true });
|
||||
|
||||
const loading = ref(false);
|
||||
const focused = ref(false);
|
||||
@@ -54,7 +55,7 @@
|
||||
watch(
|
||||
() => activeDialog.value,
|
||||
active => {
|
||||
if (active && active.id === "create-location") {
|
||||
if (active && active === DialogID.CreateLocation) {
|
||||
if (locationId.value) {
|
||||
const found = locations.value.find(l => l.id === locationId.value);
|
||||
form.parent = found || null;
|
||||
@@ -113,7 +114,7 @@
|
||||
reset();
|
||||
|
||||
if (close) {
|
||||
closeDialog("create-location");
|
||||
closeDialog(DialogID.CreateLocation);
|
||||
navigateTo(`/location/${data.id}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user