c3lf-system-3/src/components/EditItem.vue
2019-12-23 21:09:30 +01:00

47 lines
1.1 KiB
Vue

<template>
<div>
<h6>Editing Item <span class="badge badge-secondary">#{{ item.item_uid }}</span></h6>
<InputPhoto
:model="item"
field="file"
:on-capture="storeImage"
/>
<InputString
label="description"
:model="item"
field="description"
:validation-fn="str => str && str.length > 0"
/>
<InputCombo
label="box"
:model="item"
nameKey="box"
uniqueKey="cid"
:options="boxes"
/>
</div>
</template>
<script>
import InputString from './inputs/InputString';
import InputCombo from './inputs/InputCombo';
import { mapGetters } from 'vuex';
import InputPhoto from './inputs/InputPhoto';
export default {
name: 'EditItem',
components: {InputPhoto, InputCombo, InputString },
props: ['item'],
computed: {
...mapGetters(['getBoxes']),
boxes({ getBoxes }) {
return getBoxes.map(obj => ({cid: obj.cid, box: obj.name}));
}
},
methods: {
storeImage(image) {
this.item.dataImage = image;
}
}
};
</script>