add default settings for childs, add option to hide fields

This commit is contained in:
Harald Bamberger
2023-03-09 16:46:15 +01:00
parent 6a65468bb0
commit c62d89d25c
4 changed files with 49 additions and 15 deletions
+18 -1
View File
@@ -102,7 +102,24 @@ export default [
type: 'vertragsbestandteillist',
guioptions: {
title: 'Befristung',
vertragsbestandteiltyp: 'vertragsbestandteilfreitext'
vertragsbestandteiltyp: 'vertragsbestandteilfreitext',
childdefaults: {
guioptions: {
canhavegehaltsbestandteile: false,
disabled: [
'freitexttyp'
],
hidden: [
'titel',
'freitext'
]
},
data: {
freitexttyp: "befristung",
titel: "Befristung",
freitext: "befristeter Dienstvertrag"
}
}
},
children: []
}
@@ -7,7 +7,7 @@ export default {
<div class="border-bottom py-2 mb-3">
<div class="row g-2 py-2">
<div class="col-7">
<select v-model="freitexttyp" class="form-select form-select-sm" aria-label=".form-select-sm example">
<select v-model="freitexttyp" :disabled="isinputdisabled('freitexttyp')" class="form-select form-select-sm" aria-label=".form-select-sm example">
<option value="" selected>Freitexttyp wählen</option>
<option value="allin">AllIn</option>
<option value="ersatzkraft">Ersatzarbeitskraft</option>
@@ -21,19 +21,19 @@ export default {
<button v-if="isremoveable" type="button" class="btn-close btn-sm p-2 float-end" @click="removeVB" aria-label="Close"></button>
</div>
</div>
<div class="row g-2 py-2">
<div class="row g-2 py-2" v-show="showinput('titel')">
<div class="col-11">
<input v-model="titel" type="text" class="form-control form-control-sm" placeholder="Titel" aria-label="Titel">
</div>
<div class="col-1">&nbsp;</div>
</div>
<div class="row g-2 py-2">
<div class="row g-2 py-2" v-show="showinput('freitext')">
<div class="col-11">
<textarea v-model="freitext" rows="5" class="form-control form-control-sm" placeholder="Freitext" aria-label="Freitext"></textarea>
</div>
<div class="col-1">&nbsp;</div>
</div>
<gehaltsbestandteilhelper ref="gbh" v-bind:preset="getgehaltsbestandteile"></gehaltsbestandteilhelper>
<gehaltsbestandteilhelper ref="gbh" v-if="canhavegehaltsbestandteile" v-bind:preset="getgehaltsbestandteile"></gehaltsbestandteilhelper>
</div>
`,
components: {
@@ -76,6 +76,9 @@ export default {
removeVB: function() {
this.$emit('removeVB', {id: this.config.guioptions.id});
},
getGehaltsbestandteilePayload: function() {
return (!this.$refs?.gbh === undefined) ? this.$refs.gbh.getPayload() : [];
},
getPayload: function() {
return {
type: 'vertragsbestandteilfreitext',
@@ -87,7 +90,7 @@ export default {
kuendigungsrelevant: this.kuendigungsrelevant,
gueltigkeit: this.$refs.gueltigkeit.getPayload()
},
gbs: this.$refs.gbh.getPayload()
gbs: this.getGehaltsbestandteilePayload()
};
}
}
@@ -14,7 +14,7 @@ export default {
<div class="col">
<a class="fs-6 fw-light" href="javascript:void(0);" @click="addVB"><i class="fas fa-plus-square"></i></a>
&nbsp;
<em>{{ title }}</em>
<em>{{ title }}{{ childcount }}</em>
</div>
</div>
<component ref="parts" v-bind:is="config.type" v-for="config in getChildren()"
@@ -63,12 +63,18 @@ export default {
}
var vbid = uuid.get_uuid();
var guioptions = (this.preset.guioptions?.childdefaults?.guioptions !== undefined)
? JSON.parse(JSON.stringify(this.preset.guioptions.childdefaults.guioptions))
: {};
guioptions.id = vbid;
guioptions.removeable = true;
var data = (this.preset.guioptions?.childdefaults?.data !== undefined)
? JSON.parse(JSON.stringify(this.preset.guioptions.childdefaults.data))
: {};
this.store.addVB(vbid, {
type: this.vertragsbestandteiltyp,
guioptions: {
id: vbid,
removeable: true
}
guioptions: guioptions,
data: data
});
this.children.push(vbid);
},
@@ -82,10 +88,7 @@ export default {
getPayload: function() {
this.payload = {
type: 'vertragsbestandteillist',
guioptions: {
title: this.title,
vertragsbestandteiltyp: this.vertragsbestandteiltyp
},
guioptions: JSON.parse(JSON.stringify(this.preset.guioptions)),
children: JSON.parse(JSON.stringify(this.children))
};
this.updateVBsInStore();
@@ -108,5 +111,10 @@ export default {
return vbs;
}
},
computed: {
childcount: function() {
return (this.children.length > 0) ? ' (' + this.children.length + ')' : '';
}
}
}
+6
View File
@@ -8,6 +8,12 @@ export default {
return false;
}
return this.config.guioptions.disabled.includes(inputname);
},
showinput: function(inputname) {
if( this.config?.guioptions?.hidden === undefined ) {
return true;
}
return !this.config.guioptions.hidden.includes(inputname);
}
},
computed: {