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

Change order after dragNdrop & add option button

parent 5ab31a04
No related branches found
No related tags found
1 merge request!587REDMINE_ISSUE-17413 | Nouveau formulaire de création des listes de valeurs
...@@ -171,25 +171,39 @@ ...@@ -171,25 +171,39 @@
<label :for="form.options.id_for_label">{{ <label :for="form.options.id_for_label">{{
form.options.label form.options.label
}}</label> }}</label>
<div :id="`list-options-${customForm.dataKey}`"> <div>
<div <div :id="`list-options-${customForm.dataKey}`">
v-for="(option, index) in form.options.value" <div
:key="option" v-for="(option, index) in form.options.value"
:id="option" :id="option"
class="draggable-row" :key="`${option}-${index}`"
> class="draggable-row"
<i >
class="th icon" <i
aria-hidden="true" class="th icon"
/> aria-hidden="true"
<input />
:value="option" <input
type="text" :value="option"
:maxlength="form.options.field.max_length" type="text"
:name="form.options.html_name" :maxlength="form.options.field.max_length"
class="options-field" :name="form.options.html_name"
@change="updateOptionValue(index, $event)" class="options-field"
@change="updateOptionValue(index, $event)"
>
</div>
</div>
<div class="ui buttons">
<a
class="ui compact small icon left floated button teal basic"
@click="addOption"
> >
<i
class="ui plus icon"
aria-hidden="true"
/>
<span>&nbsp;Ajouter une option</span>
</a>
</div> </div>
</div> </div>
<ul <ul
...@@ -204,7 +218,6 @@ ...@@ -204,7 +218,6 @@
</li> </li>
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
...@@ -413,7 +426,9 @@ export default { ...@@ -413,7 +426,9 @@ export default {
}, },
updateOptionOrder(e) { updateOptionOrder(e) {
console.log(e, e.target.childNodes); const currentOptionsList = Array.from(e.target.childNodes).map((el) => el.id);
this.form.options.value = currentOptionsList;
this.updateStore();
}, },
initSortable() { initSortable() {
...@@ -426,6 +441,10 @@ export default { ...@@ -426,6 +441,10 @@ export default {
}); });
}, },
addOption() {
console.log('addOption');
},
updateStore() { updateStore() {
const data = { const data = {
dataKey: this.customForm.dataKey, dataKey: this.customForm.dataKey,
......
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