Skip to content
Snippets Groups Projects
Commit cb3318ab authored by Timothee P's avatar Timothee P :sunflower:
Browse files

WIP: add forced_value_config form to feature type form

parent 6721ff7a
No related branches found
No related tags found
1 merge request!607REDMINE_ISSUE-17628 | Forcer la valeur d'un champ selon une condition
<template> <template>
<div <div
:id="`custom_form-${form.position.value}`" :id="`custom_form-${form.name.value}`"
class="ui teal segment pers-field" class="ui teal segment pers-field"
> >
<div class="custom-field-header"> <div class="custom-field-header">
...@@ -225,6 +225,7 @@ ...@@ -225,6 +225,7 @@
</li> </li>
</ul> </ul>
</div> </div>
<div class="ui checkbox"> <div class="ui checkbox">
<input <input
type="checkbox" type="checkbox"
...@@ -253,7 +254,33 @@ ...@@ -253,7 +254,33 @@
{{ error }} {{ error }}
</li> </li>
</ul> </ul>
<div>
<div
v-if="form.forced_value_config.value"
>
<div
v-for="[conditioningField, conditioningValue] in Object.entries(form.forced_value_config.value)"
:key="conditioningField + conditioningValue"
>
conditioningField = {{ conditioningField }}
conditioningValue = {{ conditioningValue }}
</div>
</div>
<button
id="add-forced-value"
@click.prevent="addForcedValue"
class="ui compact basic button"
>
<i
class="ui plus icon"
aria-hidden="true"
/>
Ajouter une valeur forcée selon la valeur d'un autre champ
</button>
</div>
</div> </div>
</div> </div>
</template> </template>
...@@ -363,6 +390,10 @@ export default { ...@@ -363,6 +390,10 @@ export default {
conditional_field_config: { conditional_field_config: {
errors: [], errors: [],
value: null, value: null,
},
forced_value_config: {
errors: [],
value: null,
} }
}, },
selectedPrerecordedList: null, selectedPrerecordedList: null,
...@@ -487,6 +518,11 @@ export default { ...@@ -487,6 +518,11 @@ export default {
this.updateStore(); this.updateStore();
}, },
addForcedValue() {
console.log('addForcedValue');
this.form.forced_value_config.value = this.customForm.forced_value_config || { test: 'value' };
},
updateStore() { updateStore() {
const data = { const data = {
dataKey: this.customForm.dataKey, dataKey: this.customForm.dataKey,
......
...@@ -10,9 +10,6 @@ ...@@ -10,9 +10,6 @@
<form <form
v-if="project" v-if="project"
id="form-type-edit" id="form-type-edit"
action=""
method="post"
enctype="multipart/form-data"
class="ui form" class="ui form"
> >
<h1 v-if="action === 'create'"> <h1 v-if="action === 'create'">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment