|
|
|
|
<template>
|
|
|
|
|
<div class="row grass-border" id="field">
|
|
|
|
|
<div :class="'crop-field '+(!field.data ? 'empty' : '')"
|
|
|
|
|
v-on:click="plant(field.id)"
|
|
|
|
|
v-on:contextmenu="cropInformation(field.id)"
|
|
|
|
|
v-for="field in fields"
|
|
|
|
|
v-bind:key="field.id">
|
|
|
|
|
{{ field.id }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import Modal from 'bootstrap/js/src/modal'
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "CropField",
|
|
|
|
|
computed: {
|
|
|
|
|
fields() {
|
|
|
|
|
return this.$store.state.cropField;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
plant(id) {
|
|
|
|
|
this.$store.commit('selectField', id);
|
|
|
|
|
const modal = new Modal(document.getElementById('cropInventoryModal'))
|
|
|
|
|
modal.toggle();
|
|
|
|
|
},
|
|
|
|
|
cropInformation(id) {
|
|
|
|
|
this.$store.commit('selectField', id);
|
|
|
|
|
|
|
|
|
|
if (!this.$store.getters.selectedField.data) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const modal = new Modal(document.getElementById('cropInformationModal'))
|
|
|
|
|
modal.toggle();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
#field {
|
|
|
|
|
margin: 1em 0.5em 6em 0.5em;
|
|
|
|
|
padding-bottom: 0;
|
|
|
|
|
background-color: #5A3C28;
|
|
|
|
|
align-content: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.crop-field {
|
|
|
|
|
width: 3.7em;
|
|
|
|
|
height: 3.7em;
|
|
|
|
|
border-radius: 14px;
|
|
|
|
|
background-image: url('@/assets/field/tile057.png');
|
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
|
background-size: 100%;
|
|
|
|
|
margin: 3px auto;
|
|
|
|
|
}
|
|
|
|
|
</style>
|