43 lines
1.7 KiB
JavaScript
43 lines
1.7 KiB
JavaScript
Vue.component('WarehouseArticlePacket', {
|
|
//language=Vue
|
|
template: `
|
|
<tt-card>
|
|
<tt-table-crud @openHistory="historyModal = true; historyModalId = $event.id" ref="WarehouseArticlePacketCrud">
|
|
|
|
<template v-slot:subitems="{row}">
|
|
<template v-for="item in JSON.parse(row.subItems)">
|
|
<span v-if="articles.find(article => article.value === item.id)">
|
|
{{item.amount + 'x '}}{{articles.find(article => article.value === item.id).text}}<br>
|
|
</span>
|
|
<span v-else></span>
|
|
</template>
|
|
</template>
|
|
|
|
<template v-slot:subitems-modal="{crudModalData}">
|
|
<tt-positions-manager :config="WarehouseArticlePacketItemsConfig" v-model="crudModalData.subItems"/>
|
|
</template>
|
|
|
|
</tt-table-crud>
|
|
</tt-card>
|
|
`, data() {
|
|
return {
|
|
window: window,
|
|
historyModal: false,
|
|
historyModalId: null,
|
|
WarehouseArticlePacketItemsConfig: {
|
|
fields: {
|
|
id: {type: 'input-article', label: 'Artikel', customFieldReference: 'WarehouseArticle'},
|
|
amount: {type: 'input', label: 'Menge', inputType: 'number'},
|
|
},
|
|
validateFormOptions: [
|
|
{key: 'id', message: 'Bitte füllen Sie den Artikel aus'},
|
|
{key: 'amount', message: 'Bitte füllen Sie die Menge aus'},
|
|
]
|
|
},
|
|
articles: [],
|
|
}
|
|
}, beforeMount() {
|
|
this.articles = window['TT_CONFIG']['CRUD_CONFIG'].columns.find(column => column.key === 'subItems').modal.items;
|
|
}
|
|
})
|