diff --git a/ayanova/src/views/adm-global-select-templates.vue b/ayanova/src/views/adm-global-select-templates.vue index 2e4e3d02..6e6fd996 100644 --- a/ayanova/src/views/adm-global-select-templates.vue +++ b/ayanova/src/views/adm-global-select-templates.vue @@ -27,7 +27,7 @@ > -
WORKING ARRAY: {{ workingArray }}
+ - +
+ fa-step-backward + fa-backward + fa-forward + fa-step-forward +
- --> + @@ -161,6 +158,48 @@ export default { t: function(tKey) { return window.$gz.translation.get(tKey); }, + includeChanged: function(item) { + window.$gz.form.setFormState({ + vm: this, + dirty: true + }); + }, + move: function(direction, index) { + var totalItems = this.workingArray.length; + var newIndex = 0; + //calculate new index + switch (direction) { + case "start": + newIndex = 0; + break; + case "left": + newIndex = index - 1; + if (newIndex < 0) { + newIndex = 0; + } + break; + case "right": + newIndex = index + 1; + if (newIndex > totalItems - 1) { + newIndex = totalItems - 1; + } + + break; + case "end": + newIndex = totalItems - 1; + break; + } + + this.workingArray.splice( + newIndex, + 0, + this.workingArray.splice(index, 1)[0] + ); + window.$gz.form.setFormState({ + vm: this, + dirty: true + }); + }, templateSelected: function() { if (this.formState.dirty) { window.$gz.dialog.confirmLeaveUnsaved().then(dialogResult => { @@ -433,7 +472,7 @@ function synthesizeWorkingArray(vm) { for (var i = 0; i < vm.availableFields.length; i++) { var afItem = vm.availableFields[i]; //skip the active column - if (afItem.isActive == true) { + if (afItem.isActiveColumn == true) { continue; } //is this field already in the template and was added above?