diff --git a/public/js/apps/vbform/presets.js b/public/js/apps/vbform/presets.js index 70f23809f..3971a4bf9 100644 --- a/public/js/apps/vbform/presets.js +++ b/public/js/apps/vbform/presets.js @@ -59,9 +59,7 @@ export default [ data: { dienstverhaeltnisid: null }, - vbs: { - - } + vbs: {} }, { type: 'preset', diff --git a/public/js/apps/vbform/vbform.js b/public/js/apps/vbform/vbform.js index 2431e10b9..c70e4d06f 100644 --- a/public/js/apps/vbform/vbform.js +++ b/public/js/apps/vbform/vbform.js @@ -62,15 +62,19 @@ Vue.createApp({ 'vbformhelper': vbformhelper }, created: function() { - var vbs = JSON.parse(JSON.stringify(this.preset.vbs)); - for( var key in vbs ) { - this.store.addVB(key, vbs[key]); - } - this.store.setDV(JSON.parse(JSON.stringify(this.preset.data))); + this.presettostore(); }, methods: { presetselected: function(preset) { this.preset = preset; + this.presettostore(); + }, + presettostore: function() { + var vbs = JSON.parse(JSON.stringify(this.preset.vbs)); + for( var key in vbs ) { + this.store.addVB(key, vbs[key]); + } + this.store.setDV(JSON.parse(JSON.stringify(this.preset.data))); }, processJSON: function(payload) { this.vbhjson = payload; diff --git a/public/js/components/vbform/gehaltsbestandteil.js b/public/js/components/vbform/gehaltsbestandteil.js index 6c53501b1..f6833b0ce 100644 --- a/public/js/components/vbform/gehaltsbestandteil.js +++ b/public/js/components/vbform/gehaltsbestandteil.js @@ -62,17 +62,13 @@ export default { }, methods: { setDataFromConfig: function() { - if( typeof this.config.data === 'undefined' ) { - return; - } - - if( typeof this.config.data.gehaltstyp !== 'undefined' ) { + if( typeof this.config?.data?.gehaltstyp !== 'undefined' ) { this.gehaltstyp = this.config.data.gehaltstyp; } - if( typeof this.config.data.betrag !== 'undefined' ) { + if( typeof this.config?.data?.betrag !== 'undefined' ) { this.betrag = this.config.data.betrag; } - if( typeof this.config.data.valorisierung !== 'undefined' ) { + if( typeof this.config?.data?.valorisierung !== 'undefined' ) { this.valorisierung = this.config.data.valorisierung; } }, @@ -82,7 +78,7 @@ export default { getPayload: function() { return { type: this.config.type, - guioptions: this.config.guioptions, + guioptions: JSON.parse(JSON.stringify(this.config.guioptions)), data: { gehaltstyp: this.gehaltstyp, betrag: this.betrag, diff --git a/public/js/components/vbform/presets_chooser.js b/public/js/components/vbform/presets_chooser.js index a77a4b7ac..1d80d7651 100644 --- a/public/js/components/vbform/presets_chooser.js +++ b/public/js/components/vbform/presets_chooser.js @@ -1,3 +1,5 @@ +import store from './vbsharedstate.js'; + export default { template: `