#7283 #7831 itemMigration #553

Merged
carlossa merged 77 commits from 7283-itemMigration into dev 2024-10-25 07:09:13 +00:00
1 changed files with 17 additions and 18 deletions
Showing only changes of commit bae0b4de35 - Show all commits

View File

@ -13,7 +13,6 @@ import CreateSpecieForm from './CreateSpecieForm.vue';
const route = useRoute();
const { t } = useI18n();
const itemBotanicalsRef = ref(null);
const itemGenusOptions = ref([]);
const itemSpeciesOptions = ref([]);
const itemBotanicals = ref([]);
@ -31,22 +30,19 @@ const onSpecieCreated = (response, formData) => {
const entityId = computed(() => {
return route.params.id;
});
onMounted(async () => {
itemBotanicalsForm.itemFk = entityId.value;
itemBotanicals.value = await itemBotanicalsRef.value.fetch();
if (itemBotanicals.value.length > 0)
Object.assign(itemBotanicalsForm, itemBotanicals.value[0]);
});
// onMounted(async () => {
// itemBotanicalsForm.itemFk = entityId.value;
// // itemBotanicals.value = await itemBotanicalsRef.value.fetch();
// if (itemBotanicals.value.length > 0)
// Object.assign(itemBotanicalsForm, itemBotanicals.value[0]);
// });
async function handleItemBotanical(data) {
itemBotanicalsForm = data;
// if (data.length > 0) Object.assign(itemBotanicalsForm, itemBotanicals.value[0]);
}
</script>
<template>
<FetchData
ref="itemBotanicalsRef"
url="ItemBotanicals"
:filter="{
where: { itemFk: entityId },
}"
@on-fetch="(data) => (itemBotanicals = data)"
/>
<!-- <FetchData ref="itemBotanicalsRef" @on-fetch="(data) => (itemBotanicals = data)" /> -->
<FetchData
url="Genera"
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
@ -60,11 +56,14 @@ onMounted(async () => {
auto-load
/>
<FormModel
url="ItemBotanicals"
url-update="ItemBotanicals"
model="entry"
model="item"
auto-load
:form-initial-data="itemBotanicalsForm"
:clear-store-on-unmount="false"
:filter="{
where: { itemFk: entityId },
}"
@on-fetch="handleItemBotanical"
>
<template #form="{ data }">
<VnRow>