big pagination update - split models into pages
This commit is contained in:
@ -141,9 +141,7 @@
|
||||
<script>
|
||||
import Sortable from 'sortablejs'
|
||||
import { mapState, mapGetters, mapActions } from 'vuex'
|
||||
import arrayMove from 'array-move'
|
||||
//import RawDisplayer from './RawDisplayer'
|
||||
import { paginateModels } from '@/pagination'
|
||||
import DragListHeading from './DragListHeading'
|
||||
import AddProductDialog from './AddProductDialog'
|
||||
import AddSectionDialog from './AddSectionDialog'
|
||||
@ -244,19 +242,6 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
reorderModel(fromIndex, toIndex) {
|
||||
let models = this.selectedModels
|
||||
arrayMove.mutate(models, fromIndex, toIndex)
|
||||
let pages = paginateModels(models)
|
||||
this.setSectionPages({ section: this.selectedSection, pages: pages })
|
||||
},
|
||||
|
||||
reorderMaterial(fromIndex, toIndex) {
|
||||
let mats = this.selectedMaterials
|
||||
arrayMove.mutate(mats, fromIndex, toIndex)
|
||||
this.setModelMaterials({ model: this.selectedModel, materials: mats })
|
||||
},
|
||||
|
||||
popSectionInfo(id) {
|
||||
this.selectSection(id)
|
||||
this.showSectionInfoDialog = true
|
||||
@ -287,8 +272,8 @@ export default {
|
||||
'selectModel',
|
||||
'selectMaterial',
|
||||
'reorderSection',
|
||||
'setSectionPages',
|
||||
'setModelMaterials',
|
||||
'reorderModel',
|
||||
'reorderMaterial',
|
||||
'moveModelToSection',
|
||||
'moveMaterialToSection',
|
||||
]),
|
||||
@ -318,7 +303,9 @@ export default {
|
||||
},
|
||||
onEnd: function(evt) {
|
||||
if (evt.from === evt.to) {
|
||||
me.reorderModel(evt.oldIndex, evt.newIndex)
|
||||
me.reorderModel({ section: me.selectedSection,
|
||||
fromIndex: evt.oldIndex,
|
||||
toIndex: evt.newIndex })
|
||||
} else {
|
||||
// dropped on a section.
|
||||
let models = me.selectedModels
|
||||
@ -349,7 +336,10 @@ export default {
|
||||
},
|
||||
onEnd: function(evt) {
|
||||
if (evt.from === evt.to) {
|
||||
me.reorderMaterial(evt.oldIndex, evt.newIndex)
|
||||
me.reorderMaterial({ section: me.selectedSection,
|
||||
model: me.selectedModel,
|
||||
fromIndex: evt.oldIndex,
|
||||
toIndex: evt.newIndex })
|
||||
} else {
|
||||
// dropped on a section.
|
||||
let mats = me.selectedMaterials
|
||||
@ -360,6 +350,7 @@ export default {
|
||||
|
||||
if (me.selectedSection.id !== newSection.id) {
|
||||
me.moveMaterialToSection({ material: mat,
|
||||
oldSection: me.selectedSection,
|
||||
oldModel: me.selectedModel,
|
||||
newSection: newSection })
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user