feat: refs #6919 sync item-type
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-11-15 13:01:47 +01:00
parent 71e469542a
commit c2e4380f18
5 changed files with 23 additions and 45 deletions

View File

@ -40,12 +40,7 @@ const itemPackingTypesOptions = ref([]);
}"
auto-load
/>
<FormModel
:url="`ItemTypes/${route.params.id}`"
:url-update="`ItemTypes/${route.params.id}`"
model="itemTypeBasicData"
auto-load
>
<FormModel :url-update="`ItemTypes/${route.params.id}`" model="ItemType" auto-load>
<template #form="{ data }">
<VnRow>
<VnInput v-model="data.code" :label="t('shared.code')" />

View File

@ -3,11 +3,13 @@ import VnCard from 'components/common/VnCard.vue';
import ItemTypeDescriptor from 'src/pages/Item/ItemType/Card/ItemTypeDescriptor.vue';
import ItemTypeFilter from 'src/pages/Item/ItemType/ItemTypeFilter.vue';
import ItemTypeSearchbar from '../ItemTypeSearchbar.vue';
import filter from './ItemTypeFilter.js';
</script>
<template>
<VnCard
data-key="ItemTypeSummary"
data-key="ItemType"
url="ItemTypes"
:filter="filter"
:descriptor="ItemTypeDescriptor"
:filter-panel="ItemTypeFilter"
search-data-key="ItemTypeList"

View File

@ -1,13 +1,11 @@
<script setup>
import { ref, computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import useCardDescription from 'src/composables/useCardDescription';
import filter from './ItemTypeFilter.js';
const $props = defineProps({
id: {
@ -22,45 +20,29 @@ const $props = defineProps({
});
const route = useRoute();
const { t } = useI18n();
const itemTypeFilter = {
include: [
{ relation: 'worker' },
{ relation: 'category' },
{ relation: 'itemPackingType' },
{ relation: 'temperature' },
],
};
const entityId = computed(() => {
return $props.id || route.params.id;
});
const data = ref(useCardDescription());
const setData = (entity) => (data.value = useCardDescription(entity.code, entity.id));
</script>
<template>
<CardDescriptor
module="ItemType"
:url="`ItemTypes/${entityId}`"
:filter="itemTypeFilter"
:title="data.title"
:subtitle="data.subtitle"
@on-fetch="setData"
data-key="entry"
:filter="filter"
title="code"
data-key="ItemType"
>
<template #body="{ entity }">
<VnLv :label="t('shared.code')" :value="entity.code" />
<VnLv :label="t('shared.name')" :value="entity.name" />
<VnLv :label="t('shared.worker')">
<VnLv :label="$t('shared.code')" :value="entity.code" />
<VnLv :label="$t('shared.name')" :value="entity.name" />
<VnLv :label="$t('shared.worker')">
<template #value>
<span class="link">{{ entity.worker?.firstName }}</span>
<WorkerDescriptorProxy :id="entity.worker?.id" />
</template>
</VnLv>
<VnLv :label="t('shared.category')" :value="entity.category?.name" />
<VnLv :label="$t('shared.category')" :value="entity.category?.name" />
</template>
</CardDescriptor>
</template>

View File

@ -0,0 +1,8 @@
export default {
include: [
{ relation: 'worker' },
{ relation: 'category' },
{ relation: 'itemPackingType' },
{ relation: 'temperature' },
],
};

View File

@ -3,7 +3,7 @@ import { ref, computed, onUpdated } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import filter from './ItemTypeFilter.js';
import CardSummary from 'components/ui/CardSummary.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import VnToSummary from 'src/components/ui/VnToSummary.vue';
@ -21,15 +21,6 @@ const $props = defineProps({
},
});
const itemTypeFilter = {
include: [
{ relation: 'worker' },
{ relation: 'category' },
{ relation: 'itemPackingType' },
{ relation: 'temperature' },
],
};
const entityId = computed(() => $props.id || route.params.id);
const summaryRef = ref();
const itemType = ref();
@ -43,8 +34,8 @@ async function setItemTypeData(data) {
<CardSummary
ref="summaryRef"
:url="`ItemTypes/${entityId}`"
data-key="ItemTypeSummary"
:filter="itemTypeFilter"
data-key="ItemType"
:filter="filter"
@on-fetch="(data) => setItemTypeData(data)"
class="full-width"
>