diff --git a/src/components/CrudModel.vue b/src/components/CrudModel.vue index a37a2b2a9..25048ba89 100644 --- a/src/components/CrudModel.vue +++ b/src/components/CrudModel.vue @@ -83,7 +83,7 @@ const isLoading = ref(false); const hasChanges = ref(false); const originalData = ref(); const vnPaginateRef = ref(); -const formData = ref([]); +const formData = ref(); const saveButtonRef = ref(null); const watchChanges = ref(); const formUrl = computed(() => $props.url); @@ -298,6 +298,10 @@ watch(formUrl, async () => { }); - diff --git a/src/components/common/VnSelect.vue b/src/components/common/VnSelect.vue index 32a8db16f..8c70cbef7 100644 --- a/src/components/common/VnSelect.vue +++ b/src/components/common/VnSelect.vue @@ -183,7 +183,7 @@ const arrayData = useArrayData(arrayDataKey, { searchUrl: false, mapKey: $attrs['map-key'], }); - +const someIsLoading = computed(() => isLoading.value || arrayData.isLoading); function findKeyInOptions() { if (!$props.options) return; return filter($props.modelValue, $props.options)?.length; @@ -366,7 +366,8 @@ function getCaption(opt) { virtual-scroll-slice-size="options.length" hide-bottom-space :input-debounce="useURL ? '300' : '0'" - :loading="isLoading" + :loading="someIsLoading" + :disable="someIsLoading" @virtual-scroll="onScroll" @keydown="handleKeyDown" :data-cy="$attrs.dataCy ?? $attrs.label + '_select'" diff --git a/src/components/ui/EntityDescriptor.vue b/src/components/ui/EntityDescriptor.vue index e6adaa5f7..751a6bd9c 100644 --- a/src/components/ui/EntityDescriptor.vue +++ b/src/components/ui/EntityDescriptor.vue @@ -44,8 +44,7 @@ onBeforeMount(async () => { }); // It enables to load data only once if the module is the same as the dataKey - if (!isSameDataKey.value || !route.params.id || $props.id !== route.params.id) - await getData(); + if (!isSameDataKey.value || !route.params.id) await getData(); watch( () => [$props.url, $props.filter], async () => { diff --git a/src/pages/Item/Card/ItemTags.vue b/src/pages/Item/Card/ItemTags.vue index ab26b9cae..87d42e25b 100644 --- a/src/pages/Item/Card/ItemTags.vue +++ b/src/pages/Item/Card/ItemTags.vue @@ -89,7 +89,6 @@ const insertTag = (rows) => { :default-remove="false" :user-filter="{ fields: ['id', 'itemFk', 'tagFk', 'value', 'priority'], - where: { itemFk: route.params.id }, include: { relation: 'tag', scope: { @@ -97,6 +96,7 @@ const insertTag = (rows) => { }, }, }" + :filter="{ where: { itemFk: route.params.id } }" order="priority" auto-load @on-fetch="onItemTagsFetched" diff --git a/src/pages/Item/composables/cloneItem.js b/src/pages/Item/composables/cloneItem.js index 2421c0808..4e19661ca 100644 --- a/src/pages/Item/composables/cloneItem.js +++ b/src/pages/Item/composables/cloneItem.js @@ -11,26 +11,19 @@ export function cloneItem() { const router = useRouter(); const cloneItem = async (entityId) => { const { id } = entityId; - try { - const { data } = await axios.post(`Items/${id ?? entityId}/clone`); - router.push({ name: 'ItemTags', params: { id: data.id } }); - } catch (err) { - console.error('Error cloning item'); - } + const { data } = await axios.post(`Items/${id ?? entityId}/clone`); + router.push({ name: 'ItemTags', params: { id: data.id } }); }; const openCloneDialog = async (entityId) => { - quasar - .dialog({ - component: VnConfirm, - componentProps: { - title: t('item.descriptor.clone.title'), - message: t('item.descriptor.clone.subTitle'), - }, - }) - .onOk(async () => { - await cloneItem(entityId); - }); + quasar.dialog({ + component: VnConfirm, + componentProps: { + title: t('item.descriptor.clone.title'), + message: t('item.descriptor.clone.subTitle'), + promise: () => cloneItem(entityId), + }, + }); }; return { openCloneDialog }; } diff --git a/src/pages/Supplier/Card/SupplierFiscalData.vue b/src/pages/Supplier/Card/SupplierFiscalData.vue index 4293bd41a..2feb0e39a 100644 --- a/src/pages/Supplier/Card/SupplierFiscalData.vue +++ b/src/pages/Supplier/Card/SupplierFiscalData.vue @@ -11,10 +11,10 @@ import VnSelect from 'src/components/common/VnSelect.vue'; import VnLocation from 'src/components/common/VnLocation.vue'; import VnAccountNumber from 'src/components/common/VnAccountNumber.vue'; import VnCheckbox from 'src/components/common/VnCheckbox.vue'; - +import { useArrayData } from 'src/composables/useArrayData'; const route = useRoute(); const { t } = useI18n(); - +const arrayData = useArrayData('Supplier'); const sageTaxTypesOptions = ref([]); const sageWithholdingsOptions = ref([]); const sageTransactionTypesOptions = ref([]); @@ -89,6 +89,7 @@ function handleLocation(data, location) { }" auto-load :clear-store-on-unmount="false" + @on-data-saved="arrayData.fetch({})" >