Commit 3b649f3d authored by François-Xavier Lebastard's avatar François-Xavier Lebastard
Browse files

fix (MR) : correction remarque de MR

parent 5b4c7e2a
......@@ -32,13 +32,13 @@ export default class Panel extends Vue {
public selectScreen(screen) {
if (screen.id != this.idScreen) {
this.$router.push({
name: "ScreenEditComponent",
name: 'ScreenEditComponent',
params: {
idWorkspace: this.idWorkspace,
idForm: this.idForm,
idScreen: screen.id
}
})
idScreen: screen.id,
},
});
}
}
}
import Vue from 'vue';
import {Component, Prop} from 'vue-property-decorator';
import { Component, Prop } from 'vue-property-decorator';
import OaInput from '../../forms/input/oa-input.vue';
import OaTextarea from '@/components/forms/textarea/oa-textarea.vue';
......@@ -36,5 +36,4 @@ export default class RadioEdit extends Vue {
public notifyChange() {
this.$emit('itemEdit');
}
}
<template>
<main>
<div class="mb-8 border-b-2">
<oa-input id="0" label="Type" :value="configuration.type" required="true" disabled="true"/>
<oa-textarea id="0" label="Contenu" :value="configuration.content" required="true" @update="setContent"/>
<oa-input id="0" label="Référence" :value="configuration.reference" required="true" @update="setReference"/>
<oa-input id="0" label="Condition d'affichage" :value="configuration.displayCondition" required="true" @update="setDisplayCondition"/>
<oa-input id="0" label="Style" :value="configuration.style" required="true" @update="setStyleAffichage"/>
<oa-input id="type" :label="$t('screen.item.message.type')" :value="configuration.type" required="true" disabled="true" />
<oa-textarea
id="content"
:label="$t('screen.item.message.content')"
:value="configuration.content"
required="true"
@update="setContent"
/>
<oa-input
id="reference"
:label="$t('screen.item.message.reference')"
:value="configuration.reference"
required="true"
@update="setReference"
/>
<oa-input
id="displayCondition"
:label="$t('screen.item.message.displayCondition')"
:value="configuration.displayCondition"
required="true"
@update="setDisplayCondition"
/>
<oa-input
id="style"
:label="$t('screen.item.message.style')"
:value="configuration.style"
required="true"
@update="setStyleAffichage"
/>
</div>
</main>
</template>
......
......@@ -52,13 +52,13 @@ export default class RadioEdit extends Vue {
}
public deleteItem(choice) {
this.configuration.choices = this.configuration.choices.filter((element) => element !== choice);
this.configuration.choices = this.configuration.choices.filter(element => element !== choice);
this.notifyChange();
}
public updateNewChoiceLabel(editable) {
this.newChoiceLabel = editable.target.textContent;
};
}
public updateNewChoiceValue(editable) {
this.newChoiceValue = editable.target.textContent;
......@@ -72,7 +72,7 @@ export default class RadioEdit extends Vue {
this.configuration.choices.push({
label: this.newChoiceLabel,
value: this.newChoiceValue,
score: this.newChoiceScore
score: this.newChoiceScore,
});
this.notifyChange();
}
......
<template>
<main>
<div class="mb-8 border-b-2">
<oa-input id="0" label="Type" :value="configuration.type" required="true" disabled="true"/>
<oa-input id="0" label="Question" :value="configuration.question" required="true" @update="setQuestion"/>
<oa-input id="0" label="Référence" :value="configuration.reference" required="true" @update="setReference"/>
<oa-input id="0" label="Condition d'affichage" :value="configuration.displayCondition" required="true" @update="setDisplayCondition"/>
<oa-input id="type" :label="$t('screen.item.radio.type')" :value="configuration.type" required="true" disabled="true" />
<oa-input
id="question"
:label="$t('screen.item.radio.question')"
:value="configuration.question"
required="true"
@update="setQuestion"
/>
<oa-input
id="reference"
:label="$t('screen.item.radio.reference')"
:value="configuration.reference"
required="true"
@update="setReference"
/>
<oa-input
id="displayCondition"
:label="$t('screen.item.radio.displayCondition')"
:value="configuration.displayCondition"
required="true"
@update="setDisplayCondition"
/>
<h3 class="text-lg mb-2">Propositions de réponses</h3>
<div class="bg-white border border-gray-200 rounded-md">
......@@ -14,35 +31,46 @@
</div>
<table class="w-full bg-white border-t">
<thead class="font-bold">
<tr class="border-b-2">
<th class="p-2 text-left w-1/2">Libellé</th>
<th class="p-2 text-right w-6">Valeur</th>
<th class="p-2 text-center">Score</th>
<th class="p-2 text-center">Actions</th>
</tr>
<tr class="border-b-2">
<th class="p-2 text-left w-1/2">Libellé</th>
<th class="p-2 text-right w-6">Valeur</th>
<th class="p-2 text-center">Score</th>
<th class="p-2 text-center">Actions</th>
</tr>
</thead>
<tbody>
<tr v-for="(choice, index) in configuration.choices" :key="index" class="text-left align-top border-b">
<td class="p-2 focus:ring" contenteditable="true" @blur="updateChoiceLabel($event, choice)">{{choice.label}}</td>
<td class="p-2 focus:ring" contenteditable="true" @blur="updateChoiceValue($event, choice)">{{choice.value}}</td>
<td class="p-2 font-mono text-center focus:ring" contenteditable="true" @blur="updateChoiceScore">{{choice.score}}</td>
<td class="align-middle text-center">
<button @click="deleteItem(choice)"
class="flex items-center p-2 text-red-600 transition hover:bg-red-600 focus:ring hover:text-red-100">
<icon name="trash"></icon>
</button>
</td>
</tr>
<tr class="text-left align-top border-b text-gray-500">
<td class="p-2 focus:ring focus:text-gray-900" contenteditable="true" @blur="updateNewChoiceLabel">{{ $t('screen.items.newLabelPlaceholder') }}</td>
<td class="p-2 focus:ring focus:text-gray-900" contenteditable="true" @blur="updateNewChoiceValue">{{ $t('screen.items.newValuePlaceholder') }}</td>
<td class="p-2 font-mono text-center focus:ring" contenteditable="true" @blur="updateNewChoiceScore">{{ $t('screen.items.newScorePlaceholder') }}</td>
<td class="align-middle text-right">
<button @click="addItem" class="flex items-center p-2 text-blue-600 transition hover:bg-blue-600 focus:ring hover:text-blue-100">
<icon name="add"></icon>
</button>
</td>
</tr>
<tr v-for="(choice, index) in configuration.choices" :key="index" class="text-left align-top border-b">
<td class="p-2 focus:ring" contenteditable="true" @blur="updateChoiceLabel($event, choice)">{{ choice.label }}</td>
<td class="p-2 focus:ring" contenteditable="true" @blur="updateChoiceValue($event, choice)">{{ choice.value }}</td>
<td class="p-2 font-mono text-center focus:ring" contenteditable="true" @blur="updateChoiceScore">{{ choice.score }}</td>
<td class="align-middle text-center">
<button
@click="deleteItem(choice)"
class="flex items-center p-2 text-red-600 transition hover:bg-red-600 focus:ring hover:text-red-100"
>
<icon name="trash"></icon>
</button>
</td>
</tr>
<tr class="text-left align-top border-b text-gray-500">
<td class="p-2 focus:ring focus:text-gray-900" contenteditable="true" @blur="updateNewChoiceLabel">
{{ $t('screen.items.newLabelPlaceholder') }}
</td>
<td class="p-2 focus:ring focus:text-gray-900" contenteditable="true" @blur="updateNewChoiceValue">
{{ $t('screen.items.newValuePlaceholder') }}
</td>
<td class="p-2 font-mono text-center focus:ring" contenteditable="true" @blur="updateNewChoiceScore">
{{ $t('screen.items.newScorePlaceholder') }}
</td>
<td class="align-middle text-right">
<button
@click="addItem"
class="flex items-center p-2 text-blue-600 transition hover:bg-blue-600 focus:ring hover:text-blue-100"
>
<icon name="add"></icon>
</button>
</td>
</tr>
</tbody>
</table>
</div>
......
import Vue from 'vue';
import Component from 'vue-class-component';
import {Prop} from "vue-property-decorator";
import { Prop } from 'vue-property-decorator';
@Component
export default class ScreenItemEdit extends Vue {
@Prop()
public componentConfiguration;
......
......@@ -6,6 +6,8 @@ export interface IScreen {
description?: any;
defaultNextScreenReference?: any;
items?: any;
itemsList?: [];
index?: number;
previousName?: string;
previousId?: number;
nextId?: number;
......
import Vue from 'vue';
import {Component, Inject} from 'vue-property-decorator';
import { Component, Inject } from 'vue-property-decorator';
import ScreenItemEdit from '@/components/screen-item/screen-item-edit.vue';
import StepToolbar from '@/components/step-toolbar/step-toolbar.vue';
import OaButton from '@/components/button/oa-button.vue';
import OaInput from '@/components/forms/input/oa-input.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 Icon from '@/components/icon/icon.vue';
......@@ -31,24 +31,24 @@ export default class ScreenEdit extends Vue {
beforeRouteEnter(to, from, next) {
next(vm => {
vm.handleNavigationChange(to);
})
vm.handleNavigationChange(to.params);
});
}
beforeRouteUpdate(to, from, next) {
this.handleNavigationChange(to);
this.handleNavigationChange(to.params);
next();
}
public handleNavigationChange(to) {
this.$store.commit('setIdWorkspace', to.params.idWorkspace);
this.$store.commit('setIdForm', to.params.idForm);
this.$store.commit('setIdScreen', to.params.idScreen);
this.$store.dispatch('loadScreens', to.params.idForm);
if (to.params.idScreen) {
this.retrieveScreen(to.params.idScreen);
public handleNavigationChange({ idWorkspace, idForm, idScreen }) {
this.$store.commit('setIdWorkspace', idWorkspace);
this.$store.commit('setIdForm', idForm);
this.$store.commit('setIdScreen', idScreen);
this.$store.dispatch('loadScreens', idForm);
if (idScreen) {
this.retrieveScreen(idScreen);
} else {
this.retrieveFirstScreenOfForm(to.params.idForm);
this.retrieveFirstScreenOfForm(idForm);
}
}
......@@ -120,6 +120,6 @@ export default class ScreenEdit extends Vue {
}
public addItem() {
this.screen.itemsList.push({type: this.newItemType});
this.screen.itemsList.push({ type: this.newItemType });
}
}
......@@ -2,10 +2,10 @@
<main>
<section class="max-w-4xl mx-auto p-9">
<h1 class="mb-6 text-3xl">{{ $t('screen.label.step', { num: stepNum }) }}</h1>
<oa-input id="0" :label="$t('screen.label.title')" :value="screen.name" required="true" @update="setName" />
<oa-input id="0" :label="$t('screen.label.titleBo')" :value="screen.nameBo" required="true" @update="setNameBo" />
<oa-input id="title" :label="$t('screen.label.title')" :value="screen.name" required="true" @update="setName" />
<oa-input id="titleBo" :label="$t('screen.label.titleBo')" :value="screen.nameBo" required="true" @update="setNameBo" />
<oa-input
id="1"
id="reference"
:label="$t('screen.label.reference.label')"
:value="screen.reference"
required="true"
......@@ -23,7 +23,7 @@
<div class="mb-8 border-b-2">
<div v-for="(item, index) in screen.itemsList" :key="index">
<div class="bg-blue-100 mb-8 flex w-auto items-center">
<h2 class="p-2 font-bold uppercase text-blue-600 text-xs">Section {{ index }}</h2>
<h2 class="p-2 font-bold uppercase text-blue-600 text-xs">{{ $t('screen.label.section') }} {{ index }}</h2>
</div>
<screen-item-edit :componentConfiguration="item" @itemEdit="saveItemChange"></screen-item-edit>
</div>
......
......@@ -60,4 +60,8 @@ export default class WorkspaceView extends Vue {
public getFormLink(idForm: string): string {
return `/admin/workspace/${this.idWorkspace}/form/${idForm}/view`;
}
public getWorkspaceLink(): string {
return `/admin/workspace/${this.idWorkspace}/form/creation`;
}
}
<template>
<main>
<section class="max-w-6xl px-4 mx-auto py-9 xl:px-0">
<toolbar
title="Formulaires"
addActionName="Ajouter un formulaire"
:actionLink="'/admin/workspace/' + idWorkspace + '/form/creation'"
></toolbar>
<toolbar title="Formulaires" addActionName="Ajouter un formulaire" :actionLink="getWorkspaceLink()"></toolbar>
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4">
<card
v-for="(form, index) in forms"
......
......@@ -31,5 +31,40 @@
"reference": "reference du screen pour constituer l&#39;URL"
}
}
},
"screen": {
"add": "Ajouter un écran",
"label": {
"step": "Étape {{ num }}",
"title": "Titre de l’étape",
"section": "Section",
"titleBo": "Titre de l'étape (seulement pour le backoffice)",
"reference": {
"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>)"
},
"description": "Description",
"newItemType": "Type de l'item à ajouter"
},
"items": {
"newLabelPlaceholder": "Ajouter un libellé ...",
"newValuePlaceholder": "Ma valeur ...",
"newScorePlaceholder": "0"
},
"item": {
"message": {
"type": "Type",
"content": "Contenu",
"reference": "Référence",
"displayCondition": "Condition d'affichage",
"style": "Style"
},
"radio": {
"type": "Type",
"question": "Question",
"reference": "Référence",
"displayCondition": "Condition d'affichage"
}
}
}
}
......@@ -37,6 +37,7 @@
"label": {
"step": "Étape {{ num }}",
"title": "Titre de l’étape",
"section": "Section",
"titleBo": "Titre de l'étape (seulement pour le backoffice)",
"reference": {
"label": "Référence",
......@@ -46,9 +47,24 @@
"newItemType": "Type de l'item à ajouter"
},
"items": {
"newLabelPlaceholder": "Ajouter un libellé ...",
"newValuePlaceholder": "Ma valeur ...",
"newLabelPlaceholder": "Ajouter un libellé...",
"newValuePlaceholder": "Ma valeur...",
"newScorePlaceholder": "0"
},
"item": {
"message": {
"type": "Type",
"content": "Contenu",
"reference": "Référence",
"displayCondition": "Condition d'affichage",
"style": "Style"
},
"radio": {
"type": "Type",
"question": "Question",
"reference": "Référence",
"displayCondition": "Condition d'affichage"
}
}
}
}
......@@ -150,16 +150,11 @@ class NavigationServiceTest {
*/
@BeforeEach
void initTest() {
// TODO KRO : Corriger les tests suite à la modification du modèle de données des écrans.
form = new Form().name(FIRST_FORM_TITLE).reference(FIRST_FORM_REFERENCE).description("description").publicationState(FormPublicationState.PUBLISHED);
Set<Screen> screenList = new HashSet<>();
firstScreen = new Screen().name(FIRST_SCREEN_TITLE).nameBo(FIRST_SCREEN_TITLE).index(1).reference(FIRST_SCREEN_REFERENCE).description("first screen of the form").defaultNextScreenReference("").items("[]").form(form);
secondScreen = new Screen().name(SECOND_SCREEN_TITLE).nameBo(SECOND_SCREEN_TITLE).index(2).reference(SECOND_SCREEN_REFERENCE).description("second screen of the form").defaultNextScreenReference("").items("[]").form(form);
// .previous(firstScreen);
thirdScreen = new Screen().name(THIRD_SCREEN_TITLE).nameBo(THIRD_SCREEN_TITLE).index(3).reference(THIRD_SCREEN_REFERENCE).description("third screen of the form").defaultNextScreenReference("").items("[]").form(form);
// .previous(secondScreen);
// firstScreen.setNext(secondScreen);
// secondScreen.setNext(thirdScreen);
screenList.add(firstScreen);
screenList.add(secondScreen);
screenList.add(thirdScreen);
......
......@@ -77,12 +77,6 @@ class ScreenNavigationServiceTest extends AbstractTest {
screen3.setId(3L);
screen4 = new Screen().name("screen 04").index(4).reference("S04").items(readTestResource("screen04Item.json")).form(form);
screen4.setId(4L);
// screen1.next(screen2);
// screen2.previous(screen1);
// screen2.next(screen3);
// screen3.previous(screen2);
// screen3.next(screen4);
// screen4.previous(screen3);
final ServiceConverter serviceConverter = new ServiceConverter();
screenMapper = new ScreenMapperImpl(new FormMapperImpl(), new NextScreenExpressionDTOMapperImpl());
screenMapper.setServiceConverter(serviceConverter);
......
......@@ -159,9 +159,6 @@ public class FormApiDelegateImplIT {
secondScreen = new Screen().name(SECOND_SCREEN_TITLE).nameBo(SECOND_SCREEN_TITLE).index(2).reference(SECOND_SCREEN_REFERENCE).description("second screen of the form").defaultNextScreenReference("").items("[]").form(form);
// .previous(firstScreen);
thirdScreen = new Screen().name(THIRD_SCREEN_TITLE).nameBo(THIRD_SCREEN_TITLE).index(3).reference(THIRD_SCREEN_REFERENCE).description("third screen of the form").defaultNextScreenReference("").items("[]").form(form);
// .previous(secondScreen);
// firstScreen.setNext(secondScreen);
// secondScreen.setNext(thirdScreen);
screenList.add(firstScreen);
screenList.add(secondScreen);
screenList.add(thirdScreen);
......
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