update SectionInfoDialog to work again
This commit is contained in:
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
<v-list-tile-action>
|
<v-list-tile-action>
|
||||||
<span class="group">
|
<span class="group">
|
||||||
<v-btn icon @click.stop="popInfo(item.id)">
|
<v-btn icon @click.stop="popSectionInfo(item.id)">
|
||||||
<v-icon small color="grey lighten-1">info</v-icon>
|
<v-icon small color="grey lighten-1">info</v-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<v-btn icon @click.stop="popDelete(item.id)">
|
<v-btn icon @click.stop="popDelete(item.id)">
|
||||||
@ -131,6 +131,7 @@
|
|||||||
|
|
||||||
<AddProductDialog v-model="showAddProductDialog"/>
|
<AddProductDialog v-model="showAddProductDialog"/>
|
||||||
<AddSectionDialog v-model="showAddSectionDialog"/>
|
<AddSectionDialog v-model="showAddSectionDialog"/>
|
||||||
|
<SectionInfoDialog v-model="showSectionInfoDialog"/>
|
||||||
|
|
||||||
</v-container>
|
</v-container>
|
||||||
</template>
|
</template>
|
||||||
@ -144,18 +145,21 @@ import { paginateModels } from '@/pagination'
|
|||||||
import DragListHeading from './DragListHeading'
|
import DragListHeading from './DragListHeading'
|
||||||
import AddProductDialog from './AddProductDialog'
|
import AddProductDialog from './AddProductDialog'
|
||||||
import AddSectionDialog from './AddSectionDialog'
|
import AddSectionDialog from './AddSectionDialog'
|
||||||
|
import SectionInfoDialog from './SectionInfoDialog'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
DragListHeading,
|
DragListHeading,
|
||||||
AddProductDialog,
|
AddProductDialog,
|
||||||
AddSectionDialog,
|
AddSectionDialog,
|
||||||
|
SectionInfoDialog,
|
||||||
//RawDisplayer,
|
//RawDisplayer,
|
||||||
},
|
},
|
||||||
|
|
||||||
data: () => ({
|
data: () => ({
|
||||||
showAddProductDialog: false,
|
showAddProductDialog: false,
|
||||||
showAddSectionDialog: true,
|
showAddSectionDialog: false,
|
||||||
|
showSectionInfoDialog: false,
|
||||||
}),
|
}),
|
||||||
computed: {
|
computed: {
|
||||||
...mapState([
|
...mapState([
|
||||||
@ -184,11 +188,6 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
selectSection(id) {
|
|
||||||
console.log('select section', id)
|
|
||||||
this.$store.dispatch('selectSection', id)
|
|
||||||
},
|
|
||||||
|
|
||||||
selectModel(id) {
|
selectModel(id) {
|
||||||
console.log('select model', id)
|
console.log('select model', id)
|
||||||
this.$store.dispatch('selectModel', id)
|
this.$store.dispatch('selectModel', id)
|
||||||
@ -245,7 +244,13 @@ export default {
|
|||||||
this.setModelMaterials({ model: this.selectedModel, materials: mats })
|
this.setModelMaterials({ model: this.selectedModel, materials: mats })
|
||||||
},
|
},
|
||||||
|
|
||||||
|
popSectionInfo(id) {
|
||||||
|
this.selectSection(id)
|
||||||
|
this.showSectionInfoDialog = true
|
||||||
|
},
|
||||||
|
|
||||||
...mapActions([
|
...mapActions([
|
||||||
|
'selectSection',
|
||||||
'reorderSection',
|
'reorderSection',
|
||||||
'setSectionPages',
|
'setSectionPages',
|
||||||
'setModelMaterials',
|
'setModelMaterials',
|
||||||
|
|||||||
@ -2,17 +2,16 @@
|
|||||||
<div class="text-xs-center">
|
<div class="text-xs-center">
|
||||||
<v-dialog v-model="show" width="250">
|
<v-dialog v-model="show" width="250">
|
||||||
<v-card>
|
<v-card>
|
||||||
<v-toolbar dark dense>
|
<DialogHeading title="Section Info">
|
||||||
<v-toolbar-title>Section Info</v-toolbar-title>
|
<v-btn icon @click="show = false" class="ma-0 pa-0">
|
||||||
<v-spacer></v-spacer>
|
<v-icon color="white">clear</v-icon>
|
||||||
<v-btn icon @click="show = false"><v-icon>close</v-icon></v-btn>
|
</v-btn>
|
||||||
</v-toolbar>
|
</DialogHeading>
|
||||||
|
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
<v-text-field v-model="name" label="Name" required></v-text-field>
|
<v-text-field v-model="name" label="Name" required></v-text-field>
|
||||||
<input v-model="families"/>
|
{{sectionModelCount}} {{sectionModelCount | pluralize('model') }}<br/>
|
||||||
<input v-model="models"/>
|
{{sectionMaterialCount}} {{sectionMaterialCount | pluralize('material') }}
|
||||||
<input v-model="materials"/>
|
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
|
|
||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
@ -26,41 +25,80 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// https://stackoverflow.com/questions/48035310/open-a-vuetify-dialog-from-a-component-template-in-vuejs
|
import DialogHeading from './DialogHeading'
|
||||||
|
import { mapGetters, mapActions } from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
components: {
|
||||||
|
DialogHeading,
|
||||||
|
},
|
||||||
data: () => ({
|
data: () => ({
|
||||||
models: '5 models',
|
|
||||||
materials: '12 materials'
|
|
||||||
}),
|
}),
|
||||||
props: {
|
props: {
|
||||||
value: Boolean,
|
value: Boolean,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
show: {
|
show: {
|
||||||
get () {
|
get() {
|
||||||
return this.value
|
return this.value
|
||||||
},
|
},
|
||||||
set (value) {
|
set(value) {
|
||||||
this.$emit('input', value)
|
this.$emit('input', value)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
name: {
|
name: {
|
||||||
get () {
|
get() {
|
||||||
var sectionID = this.$store.getters.SELECTED_SECTION_ID
|
var section = this.selectedSection()
|
||||||
var section = this.$store.getters.CAT_SECTION(sectionID)
|
|
||||||
return section ? section.name : '(none)'
|
return section ? section.name : '(none)'
|
||||||
},
|
},
|
||||||
set (value) {
|
set(value) {
|
||||||
var sectionID = this.$store.getters.SELECTED_SECTION_ID
|
var section = this.selectedSection()
|
||||||
this.$store.dispatch('SET_CAT_SECTION_NAME',
|
this.setSectionName({ section: section, name: value })
|
||||||
{ id: sectionID, name: value })
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
families () {
|
|
||||||
// TODO
|
sectionModelCount() {
|
||||||
return this.$store.getters.CAT_FAMILIES
|
let section = this.selectedSection()
|
||||||
}
|
if (section) {
|
||||||
}
|
let modelFunc = this.sectionModels()
|
||||||
|
let models = modelFunc(section)
|
||||||
|
if (models) {
|
||||||
|
return models.length
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
},
|
||||||
|
|
||||||
|
sectionMaterialCount() {
|
||||||
|
let count = 0
|
||||||
|
let section = this.selectedSection()
|
||||||
|
if (section) {
|
||||||
|
let modelFunc = this.sectionModels()
|
||||||
|
let models = modelFunc(section)
|
||||||
|
if (models) {
|
||||||
|
for (let model of models) {
|
||||||
|
if (model.ids) {
|
||||||
|
count += model.ids.length
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
...mapGetters([
|
||||||
|
'selectedSection',
|
||||||
|
'sectionModels',
|
||||||
|
]),
|
||||||
|
...mapActions([
|
||||||
|
'setSectionName',
|
||||||
|
]),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,6 @@ export const store = new Vuex.Store({
|
|||||||
catalog: null,
|
catalog: null,
|
||||||
materials: {},
|
materials: {},
|
||||||
selectedSectionID: null,
|
selectedSectionID: null,
|
||||||
//selectedFamilyID: null,
|
|
||||||
selectedModelID: null,
|
selectedModelID: null,
|
||||||
selectedMaterial: null,
|
selectedMaterial: null,
|
||||||
loadingCatalog: false,
|
loadingCatalog: false,
|
||||||
@ -190,6 +189,10 @@ export const store = new Vuex.Store({
|
|||||||
state.catalog.sections.push(section)
|
state.catalog.sections.push(section)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setSectionName(state, { section, name }) {
|
||||||
|
section.name = name
|
||||||
|
},
|
||||||
|
|
||||||
reorderSection(state, { from, to }) {
|
reorderSection(state, { from, to }) {
|
||||||
if (from === to) return
|
if (from === to) return
|
||||||
state.catalog.sections = arrayMove(state.catalog.sections, from, to)
|
state.catalog.sections = arrayMove(state.catalog.sections, from, to)
|
||||||
@ -293,6 +296,10 @@ export const store = new Vuex.Store({
|
|||||||
commit('addSection', section)
|
commit('addSection', section)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setSectionName({ commit }, payload) {
|
||||||
|
commit('setSectionName', payload)
|
||||||
|
},
|
||||||
|
|
||||||
reorderSection({ commit }, payload) {
|
reorderSection({ commit }, payload) {
|
||||||
commit('reorderSection', payload)
|
commit('reorderSection', payload)
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user