This commit is contained in:
parent
71e469542a
commit
c2e4380f18
|
@ -40,12 +40,7 @@ const itemPackingTypesOptions = ref([]);
|
||||||
}"
|
}"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FormModel
|
<FormModel :url-update="`ItemTypes/${route.params.id}`" model="ItemType" auto-load>
|
||||||
:url="`ItemTypes/${route.params.id}`"
|
|
||||||
:url-update="`ItemTypes/${route.params.id}`"
|
|
||||||
model="itemTypeBasicData"
|
|
||||||
auto-load
|
|
||||||
>
|
|
||||||
<template #form="{ data }">
|
<template #form="{ data }">
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnInput v-model="data.code" :label="t('shared.code')" />
|
<VnInput v-model="data.code" :label="t('shared.code')" />
|
||||||
|
|
|
@ -3,11 +3,13 @@ import VnCard from 'components/common/VnCard.vue';
|
||||||
import ItemTypeDescriptor from 'src/pages/Item/ItemType/Card/ItemTypeDescriptor.vue';
|
import ItemTypeDescriptor from 'src/pages/Item/ItemType/Card/ItemTypeDescriptor.vue';
|
||||||
import ItemTypeFilter from 'src/pages/Item/ItemType/ItemTypeFilter.vue';
|
import ItemTypeFilter from 'src/pages/Item/ItemType/ItemTypeFilter.vue';
|
||||||
import ItemTypeSearchbar from '../ItemTypeSearchbar.vue';
|
import ItemTypeSearchbar from '../ItemTypeSearchbar.vue';
|
||||||
|
import filter from './ItemTypeFilter.js';
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnCard
|
<VnCard
|
||||||
data-key="ItemTypeSummary"
|
data-key="ItemType"
|
||||||
url="ItemTypes"
|
url="ItemTypes"
|
||||||
|
:filter="filter"
|
||||||
:descriptor="ItemTypeDescriptor"
|
:descriptor="ItemTypeDescriptor"
|
||||||
:filter-panel="ItemTypeFilter"
|
:filter-panel="ItemTypeFilter"
|
||||||
search-data-key="ItemTypeList"
|
search-data-key="ItemTypeList"
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
|
|
||||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
|
import filter from './ItemTypeFilter.js';
|
||||||
import useCardDescription from 'src/composables/useCardDescription';
|
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
|
@ -22,45 +20,29 @@ const $props = defineProps({
|
||||||
});
|
});
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
|
||||||
|
|
||||||
const itemTypeFilter = {
|
|
||||||
include: [
|
|
||||||
{ relation: 'worker' },
|
|
||||||
{ relation: 'category' },
|
|
||||||
{ relation: 'itemPackingType' },
|
|
||||||
{ relation: 'temperature' },
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
const entityId = computed(() => {
|
const entityId = computed(() => {
|
||||||
return $props.id || route.params.id;
|
return $props.id || route.params.id;
|
||||||
});
|
});
|
||||||
|
|
||||||
const data = ref(useCardDescription());
|
|
||||||
const setData = (entity) => (data.value = useCardDescription(entity.code, entity.id));
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CardDescriptor
|
<CardDescriptor
|
||||||
module="ItemType"
|
module="ItemType"
|
||||||
:url="`ItemTypes/${entityId}`"
|
:url="`ItemTypes/${entityId}`"
|
||||||
:filter="itemTypeFilter"
|
:filter="filter"
|
||||||
:title="data.title"
|
title="code"
|
||||||
:subtitle="data.subtitle"
|
data-key="ItemType"
|
||||||
@on-fetch="setData"
|
|
||||||
data-key="entry"
|
|
||||||
>
|
>
|
||||||
<template #body="{ entity }">
|
<template #body="{ entity }">
|
||||||
<VnLv :label="t('shared.code')" :value="entity.code" />
|
<VnLv :label="$t('shared.code')" :value="entity.code" />
|
||||||
<VnLv :label="t('shared.name')" :value="entity.name" />
|
<VnLv :label="$t('shared.name')" :value="entity.name" />
|
||||||
<VnLv :label="t('shared.worker')">
|
<VnLv :label="$t('shared.worker')">
|
||||||
<template #value>
|
<template #value>
|
||||||
<span class="link">{{ entity.worker?.firstName }}</span>
|
<span class="link">{{ entity.worker?.firstName }}</span>
|
||||||
<WorkerDescriptorProxy :id="entity.worker?.id" />
|
<WorkerDescriptorProxy :id="entity.worker?.id" />
|
||||||
</template>
|
</template>
|
||||||
</VnLv>
|
</VnLv>
|
||||||
<VnLv :label="t('shared.category')" :value="entity.category?.name" />
|
<VnLv :label="$t('shared.category')" :value="entity.category?.name" />
|
||||||
</template>
|
</template>
|
||||||
</CardDescriptor>
|
</CardDescriptor>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
export default {
|
||||||
|
include: [
|
||||||
|
{ relation: 'worker' },
|
||||||
|
{ relation: 'category' },
|
||||||
|
{ relation: 'itemPackingType' },
|
||||||
|
{ relation: 'temperature' },
|
||||||
|
],
|
||||||
|
};
|
|
@ -3,7 +3,7 @@ import { ref, computed, onUpdated } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
|
import filter from './ItemTypeFilter.js';
|
||||||
import CardSummary from 'components/ui/CardSummary.vue';
|
import CardSummary from 'components/ui/CardSummary.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import VnToSummary from 'src/components/ui/VnToSummary.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 entityId = computed(() => $props.id || route.params.id);
|
||||||
const summaryRef = ref();
|
const summaryRef = ref();
|
||||||
const itemType = ref();
|
const itemType = ref();
|
||||||
|
@ -43,8 +34,8 @@ async function setItemTypeData(data) {
|
||||||
<CardSummary
|
<CardSummary
|
||||||
ref="summaryRef"
|
ref="summaryRef"
|
||||||
:url="`ItemTypes/${entityId}`"
|
:url="`ItemTypes/${entityId}`"
|
||||||
data-key="ItemTypeSummary"
|
data-key="ItemType"
|
||||||
:filter="itemTypeFilter"
|
:filter="filter"
|
||||||
@on-fetch="(data) => setItemTypeData(data)"
|
@on-fetch="(data) => setItemTypeData(data)"
|
||||||
class="full-width"
|
class="full-width"
|
||||||
>
|
>
|
||||||
|
|
Loading…
Reference in New Issue