Files
DiceCloud/app/imports/ui/creature/buildTree/FillSlotButton.vue
Stefan Zermatten abb8890070 Build card being converted into build tree
Still need to be able to delete fillers
2022-05-02 12:32:14 +02:00

56 lines
1.3 KiB
Vue

<template functional>
<v-btn
v-if="!model.quantityExpected || !model.quantityExpected.value || model.spaceLeft"
icon
:data-id="`slot-add-button-${model._id}`"
class="slot-add-button accent--text"
@click="fillSlot()"
>
<v-icon>mdi-plus</v-icon>
</v-btn>
</template>
<script lang="js">
import insertPropertyFromLibraryNode from '/imports/api/creature/creatureProperties/methods/insertPropertyFromLibraryNode.js';
export default {
inject: {
context: { default: {} }
},
props: {
model: {
type: Object,
required: true,
},
},
methods: {
fillSlot(){
let slotId = this.model._id;
let creatureId = this.context.creatureId;
this.$store.commit('pushDialogStack', {
component: 'slot-fill-dialog',
elementId: `slot-add-button-${slotId}`,
data: {
slotId,
creatureId,
},
callback(nodeIds){
if (!nodeIds || !nodeIds.length) return;
let newPropertyId = insertPropertyFromLibraryNode.call({
nodeIds,
parentRef: {
'id': slotId,
'collection': 'creatureProperties',
},
});
return `slot-child-${newPropertyId}`;
}
});
},
},
}
</script>
<style>
</style>