Commit 8dd219f8 authored by janis.streib's avatar janis.streib 🦉
Browse files

FMT + automartically fill presets on update

parent 8d436c34
<template>
<b-modal v-if="object_definition != null" @ok="commit()" cancel-variant="outline-secondary" cancel-title="Abbrechen"
:ok-title="function2text(object_function)"
:ok-variant="function2variant(object_function)" size="lg" scrollable :busy="object_definition == null"
:id="modal_id"
:title="object_definition.name.replace(/^\w/, c => c.toUpperCase()) + ' ' + function2text(object_function)"
:static="false"
@show="shown">
<form :id="modal_id + '-dbeditform'" v-if="object_definition != null">
<template v-if="!non_optionals_order">
<template v-for="(data,attr) in object_functions[object_function].parameters">
<DataEditField :object_attribute="data" :attribute_preset="presets[attr]"
:attribute_reference_name="object_definition_reference_names_by_attribute[attr]"
:attribute_referencing="object_definition_referencing_by_attribute[attr]"
:attribute_name="attr"
:input_reducer="input_reducer[attr]"
v-bind:key="attr"
v-if="data.new.isRequired || non_optionals.includes(attr)"></DataEditField>
</template>
<template>
<b-link v-b-toggle.collapse-optional>Optionale Parameter</b-link>
<b-collapse id="collapse-optional">
<hr/>
<template v-for="(data,attr) in object_functions[object_function].parameters">
<DataEditField :object_attribute="data" :attribute_preset="presets[attr]"
:attribute_reference_name="object_definition_reference_names_by_attribute[attr]"
:attribute_referencing="object_definition_referencing_by_attribute[attr]"
:attribute_name="attr"
:input_reducer="input_reducer[attr]"
v-bind:key="attr"
v-if="!data.new.isRequired && !non_optionals.includes(attr)"></DataEditField>
</template>
<b-modal v-if="object_definition != null" @ok="commit()" cancel-variant="outline-secondary" cancel-title="Abbrechen"
:ok-title="function2text(object_function)"
:ok-variant="function2variant(object_function)" size="lg" scrollable :busy="object_definition == null"
:id="modal_id"
:title="object_definition.name.replace(/^\w/, c => c.toUpperCase()) + ' ' + function2text(object_function)"
:static="false"
@show="shown">
<form :id="modal_id + '-dbeditform'" v-if="object_definition != null">
<template v-if="!non_optionals_order">
<template v-for="(data,attr) in object_functions[object_function].parameters">
<DataEditField :object_attribute="data" :attribute_preset="computedPresets[attr]"
:attribute_reference_name="object_definition_reference_names_by_attribute[attr]"
:attribute_referencing="object_definition_referencing_by_attribute[attr]"
:attribute_name="attr"
:input_reducer="input_reducer[attr]"
v-bind:key="attr"
v-if="data.new.isRequired || non_optionals.includes(attr)"></DataEditField>
</template>
<template>
<b-link v-b-toggle.collapse-optional>Optionale Parameter</b-link>
<b-collapse id="collapse-optional">
<hr/>
<template v-for="(data,attr) in object_functions[object_function].parameters">
<DataEditField :object_attribute="data" :attribute_preset="computedPresets[attr]"
:attribute_reference_name="object_definition_reference_names_by_attribute[attr]"
:attribute_referencing="object_definition_referencing_by_attribute[attr]"
:attribute_name="attr"
:input_reducer="input_reducer[attr]"
v-bind:key="attr"
v-if="!data.new.isRequired && !non_optionals.includes(attr)"></DataEditField>
</template>
</b-collapse>
</template>
</b-collapse>
</template>
</template>
<template v-else>
<template v-for="attr in non_optionals_order">
<DataEditField :object_attribute="object_functions[object_function].parameters[attr]"
:attribute_preset="computedPresets[attr]"
:attribute_reference_name="object_definition_reference_names_by_attribute[attr]"
:attribute_referencing="object_definition_referencing_by_attribute[attr]"
:attribute_name="attr"
:input_reducer="input_reducer[attr]"
v-bind:key="attr"></DataEditField>
</template>
<template v-else>
<template v-for="attr in non_optionals_order">
<DataEditField :object_attribute="object_functions[object_function].parameters[attr]"
:attribute_preset="presets[attr]"
:attribute_reference_name="object_definition_reference_names_by_attribute[attr]"
:attribute_referencing="object_definition_referencing_by_attribute[attr]"
:attribute_name="attr"
:input_reducer="input_reducer[attr]"
v-bind:key="attr"></DataEditField>
</template>
<template>
<b-link v-b-toggle.collapse-optional>Optionale Parameter</b-link>
<b-collapse id="collapse-optional">
<hr/>
<template v-for="(data,attr) in object_functions[object_function].parameters">
<DataEditField :object_attribute="data" :attribute_preset="presets[attr]"
:attribute_reference_name="object_definition_reference_names_by_attribute[attr]"
:attribute_referencing="object_definition_referencing_by_attribute[attr]"
:attribute_name="attr"
:input_reducer="input_reducer[attr]"
v-bind:key="attr"
v-if="!non_optionals_order.includes(attr)"></DataEditField>
</template>
<template>
<b-link v-b-toggle.collapse-optional>Optionale Parameter</b-link>
<b-collapse id="collapse-optional">
<hr/>
<template v-for="(data,attr) in object_functions[object_function].parameters">
<DataEditField :object_attribute="data" :attribute_preset="computedPresets[attr]"
:attribute_reference_name="object_definition_reference_names_by_attribute[attr]"
:attribute_referencing="object_definition_referencing_by_attribute[attr]"
:attribute_name="attr"
:input_reducer="input_reducer[attr]"
v-bind:key="attr"
v-if="!non_optionals_order.includes(attr)"></DataEditField>
</template>
</b-collapse>
</template>
</b-collapse>
</template>
</form>
</b-modal>
</template>
</form>
</b-modal>
</template>
<script>
......@@ -236,6 +236,14 @@ export default {
}
}
},
computed: {
computedPresets() {
if (this.object_function === 'update') {
return this.old_data
}
return this.presets
}
},
watch: {
$props: {
immediate: true,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment