Commit 0110b2ee authored by Kevin Robert's avatar Kevin Robert
Browse files

UNOTOPLYS-173 : Mise en place de l'ajout d'un item à un écran.

parent 9cc2c80c
...@@ -8,6 +8,7 @@ import OaInput from '@/components/forms/input/oa-input.vue'; ...@@ -8,6 +8,7 @@ import OaInput from '@/components/forms/input/oa-input.vue';
import OaTextarea from '@/components/forms/textarea/oa-textarea.vue'; import OaTextarea from '@/components/forms/textarea/oa-textarea.vue';
import {IScreen, Screen, screenValidate} from '@/shared/model/screen.model'; import {IScreen, Screen, screenValidate} from '@/shared/model/screen.model';
import ScreenService from '@/entities/screen/screen.service'; import ScreenService from '@/entities/screen/screen.service';
import Icon from '@/components/icon/icon.vue';
@Component({ @Component({
components: { components: {
...@@ -16,6 +17,7 @@ import ScreenService from '@/entities/screen/screen.service'; ...@@ -16,6 +17,7 @@ import ScreenService from '@/entities/screen/screen.service';
OaInput, OaInput,
OaTextarea, OaTextarea,
StepToolbar, StepToolbar,
Icon,
}, },
}) })
export default class ScreenEdit extends Vue { export default class ScreenEdit extends Vue {
...@@ -25,6 +27,8 @@ export default class ScreenEdit extends Vue { ...@@ -25,6 +27,8 @@ export default class ScreenEdit extends Vue {
public screen: IScreen = new Screen(); public screen: IScreen = new Screen();
public newItemType: string = '';
beforeRouteEnter(to, from, next) { beforeRouteEnter(to, from, next) {
next(vm => { next(vm => {
vm.handleNavigationChange(to); vm.handleNavigationChange(to);
...@@ -97,5 +101,11 @@ export default class ScreenEdit extends Vue { ...@@ -97,5 +101,11 @@ export default class ScreenEdit extends Vue {
this.save(); this.save();
} }
public setNewItemType(type) {
this.newItemType = type;
}
public addItem() {
this.screen.itemsList.push({type: this.newItemType});
}
} }
...@@ -27,6 +27,12 @@ ...@@ -27,6 +27,12 @@
</div> </div>
<screen-item-edit :componentConfiguration="item" @itemEdit="saveItemChange"></screen-item-edit> <screen-item-edit :componentConfiguration="item" @itemEdit="saveItemChange"></screen-item-edit>
</div> </div>
<div class="p-2 bg-blue-100">
<oa-input id="0" :label="$t('screen.label.newItemType')" :value="newItemType" required="true" @update="setNewItemType" />
<button @click="addItem" class="flex items-center p-2 text-red-600 transition hover:bg-red-600 focus:ring hover:text-red-100">
<icon name="add"></icon>
</button>
</div>
</div> </div>
</section> </section>
</main> </main>
......
...@@ -42,7 +42,8 @@ ...@@ -42,7 +42,8 @@
"label": "Référence", "label": "Référence",
"helpText": "Cette information est utilisée pour définir l'URL de l'étape (ex: https://apply.univ-nantes.fr/form/staps/<strong>ref1</strong>)" "helpText": "Cette information est utilisée pour définir l'URL de l'étape (ex: https://apply.univ-nantes.fr/form/staps/<strong>ref1</strong>)"
}, },
"description": "Description" "description": "Description",
"newItemType": "Type de l'item à ajouter"
}, },
"items": { "items": {
"newLabelPlaceholder": "Ajouter un libellé ...", "newLabelPlaceholder": "Ajouter un libellé ...",
......
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