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

Merge branch 'redmine-issues/17629' into redmine-issues/19163

parents 2d5110f8 f5e8e6b1
No related branches found
No related tags found
1 merge request!747REDMINE_ISSUE-19163 | Tests automatisés - Signalements non-géographiques
......@@ -108,11 +108,14 @@ body {
display: flex !important;
}
.pointer:hover {
cursor: pointer;
cursor: pointer !important;
}
.dimmer-anchor {
position: relative;
}
.full-width {
width: 100%;
}
/* ---------------------------------- */
/* MAIN */
/* ---------------------------------- */
......
<template>
<div
v-if="field && field.field_type === 'char'"
:class="['field', { disabled }]"
:class="['field', { 'disabled': field.disabled }]"
:data-field_type="field.field_type"
data-test="extra-form"
name="extra-form"
>
<label
v-if="displayLabels"
:for="field.name"
:class="{ required: field.is_mandatory }"
<div
v-if="field && field.field_type === 'boolean'"
:class="['ui checkbox', { 'disabled': field.disabled }]"
>
{{ field.label }}
</label>
<input
:id="field.name"
:value="field.value"
type="text"
:name="field.name"
:required="field.is_mandatory"
@blur="updateStore_extra_form"
>
<ul
v-if="field.is_mandatory && error"
:id="`errorlist-extra-form-${field.name}`"
class="errorlist"
>
<li>
{{ error }}
</li>
</ul>
</div>
<div
v-else-if="field && field.field_type === 'list'"
:class="['field', { disabled }]"
>
<label
v-if="displayLabels"
:for="field.name"
:class="{ required: field.is_mandatory }"
>
{{ field.label }}
</label>
<Dropdown
:options="field.options"
:selected="selected_extra_form_list"
:selection.sync="selected_extra_form_list"
:required="field.is_mandatory"
:search="true"
:clearable="true"
/>
<ul
v-if="field.is_mandatory && error"
:id="`errorlist-extra-form-${field.name}`"
class="errorlist"
>
<li>
{{ error }}
</li>
</ul>
</div>
<input
:id="field.name"
type="checkbox"
:checked="field.value"
:name="field.name"
@change="updateStore_extra_form"
>
<label :for="field.name">
{{ displayLabels ? field.label : '' }}
</label>
</div>
<div
v-else-if="field && field.field_type === 'pre_recorded_list'"
:class="['field', { disabled }]"
>
<label
v-if="displayLabels"
:for="field.name"
:class="{ required: field.is_mandatory }"
>
{{ field.label }}
</label>
<Multiselect
v-model="selectedPrerecordedValue"
:options="
selectedPrerecordedListValues[field.options[0]] ? selectedPrerecordedListValues[field.options[0]] : []
"
:options-limit="10"
:allow-empty="!field.is_mandatory"
track-by="label"
label="label"
:reset-after="false"
select-label=""
selected-label=""
deselect-label=""
:searchable="true"
:placeholder="'Recherchez une valeur de la liste pré-définie ...'"
:show-no-results="true"
:loading="loadingPrerecordedListValues"
:clear-on-select="false"
:preserve-search="false"
@search-change="search"
@select="selectPrerecordedValue"
>
<template slot="clear">
<div
v-if="selectedPrerecordedValue"
class="multiselect__clear"
@click.prevent.stop="clearPrerecordedValue"
>
<i
class="close icon"
aria-hidden="true"
/>
</div>
</template>
<span slot="noResult">
Aucun résultat.
</span>
<span slot="noOptions">
Saisissez les premiers caractères ...
</span>
</Multiselect>
<ul
v-if="field.is_mandatory && error"
:id="`errorlist-extra-form-${field.name}`"
class="errorlist"
>
<li>
{{ error }}
</li>
</ul>
</div>
<template v-else>
<label
v-if="displayLabels"
:for="field.name"
:class="{ required: field.is_mandatory }"
>
{{ field.label }}
</label>
<div
v-else-if="field && field.field_type === 'multi_choices_list'"
:class="['field', { disabled }]"
>
<label
v-if="displayLabels"
:for="field.name"
:class="{ required: field.is_mandatory }"
>
{{ field.label }}
</label>
<div class="checkbox_list">
<div
v-for="option in field.options"
:key="option"
class="ui checkbox"
<input
v-if="field && field.field_type === 'char'"
:id="field.name"
:value="field.value"
type="text"
:name="field.name"
:required="field.is_mandatory"
@blur="updateStore_extra_form"
>
<input
:id="option"
type="checkbox"
:checked="field.value && field.value.includes(option)"
:name="option"
@change="selectMultipleCheckbox"
>
<label :for="option">
{{ option }}
</label>
</div>
</div>
<ul
v-if="field.is_mandatory && error"
:id="`errorlist-extra-form-${field.name}`"
class="errorlist"
>
<li>
{{ error }}
</li>
</ul>
</div>
<div
v-else-if="field && field.field_type === 'integer'"
:class="['field', { disabled }]"
>
<label
v-if="displayLabels"
:for="field.name"
:class="{ required: field.is_mandatory }"
>
{{ field.label }}
</label>
<div class="ui input">
<!-- //* si click sur fléche dans champ input, pas de focus, donc pas de blur, donc utilisation de @change -->
<textarea
v-else-if="field && field.field_type === 'text'"
:value="field.value"
:name="field.name"
:required="field.is_mandatory"
rows="3"
@blur="updateStore_extra_form"
/>
<input
v-else-if="field && field.field_type === 'integer'"
:id="field.name"
:value="field.value"
type="number"
......@@ -183,126 +58,101 @@
:required="field.is_mandatory"
@change="updateStore_extra_form"
>
</div>
<ul
v-if="field.is_mandatory && error"
:id="`errorlist-extra-form-${field.name}`"
class="errorlist"
>
<li>
{{ error }}
</li>
</ul>
</div>
<div
v-else-if="field && field.field_type === 'boolean'"
:class="['field', { disabled }]"
>
<div :class="['ui checkbox', { disabled }]">
<input
v-else-if="field && field.field_type === 'decimal'"
:id="field.name"
type="checkbox"
:checked="field.value"
:value="field.value"
type="number"
step=".01"
:name="field.name"
:required="field.is_mandatory"
@change="updateStore_extra_form"
>
<label :for="field.name">
{{ displayLabels ? field.label : '' }}
</label>
</div>
</div>
<div
v-else-if="field && field.field_type === 'date'"
:class="['field', { disabled }]"
>
<label
v-if="displayLabels"
:for="field.name"
:class="{ required: field.is_mandatory }"
>
{{ field.label }}
</label>
<input
:id="field.name"
:value="field.value"
type="date"
:name="field.name"
:required="field.is_mandatory"
@change="updateStore_extra_form"
>
<ul
v-if="field.is_mandatory && error"
:id="`errorlist-extra-form-${field.name}`"
class="errorlist"
>
<li>
{{ error }}
</li>
</ul>
</div>
<div
v-else-if="field && field.field_type === 'decimal'"
:class="['field', { disabled }]"
>
<label
v-if="displayLabels"
:for="field.name"
:class="{ required: field.is_mandatory }"
>
{{ field.label }}
</label>
<div class="ui input">
<input
v-else-if="field && field.field_type === 'date'"
:id="field.name"
:value="field.value"
type="number"
step=".01"
type="date"
:name="field.name"
:required="field.is_mandatory"
@change="updateStore_extra_form"
>
</div>
<ul
v-if="field.is_mandatory && error"
:id="`errorlist-extra-form-${field.name}`"
class="errorlist"
>
<li>
{{ error }}
</li>
</ul>
</div>
<div
v-else-if="field && field.field_type === 'text'"
:class="['field', { disabled }]"
>
<label
v-if="displayLabels"
:for="field.name"
:class="{ required: field.is_mandatory }"
>
{{ field.label }}
</label>
<textarea
:value="field.value"
:name="field.name"
:required="field.is_mandatory"
rows="3"
@blur="updateStore_extra_form"
/>
<ul
v-if="field.is_mandatory && error"
:id="`errorlist-extra-form-${field.name}`"
class="errorlist"
>
<li>
{{ error }}
</li>
</ul>
<Dropdown
v-else-if="field && field.field_type === 'list'"
:options="field.options"
:selected="selected_extra_form_list"
:selection.sync="selected_extra_form_list"
:required="field.is_mandatory"
:search="true"
:clearable="true"
/>
<div
v-else-if="field && field.field_type === 'multi_choices_list'"
class="checkbox_list"
>
<div
v-for="option in field.options"
:key="option"
class="ui checkbox"
>
<input
:id="option"
type="checkbox"
:checked="field.value && field.value.includes(option)"
:name="option"
@change="selectMultipleCheckbox"
>
<label :for="option">
{{ option }}
</label>
</div>
</div>
<Multiselect
v-else-if="field && field.field_type === 'pre_recorded_list'"
v-model="selectedPrerecordedValue"
:options="selectedPrerecordedListValues[field.options[0]] || []"
:options-limit="10"
:allow-empty="!field.is_mandatory"
track-by="label"
label="label"
:reset-after="false"
select-label=""
selected-label=""
deselect-label=""
:searchable="true"
:placeholder="'Recherchez une valeur de la liste pré-définie ...'"
:show-no-results="true"
:loading="loadingPrerecordedListValues"
:clear-on-select="false"
:preserve-search="false"
@search-change="search"
@select="selectPrerecordedValue"
>
<template slot="clear">
<div
v-if="selectedPrerecordedValue"
class="multiselect__clear"
@click.prevent.stop="clearPrerecordedValue"
>
<i
class="close icon"
aria-hidden="true"
/>
</div>
</template>
<span slot="noResult">
Aucun résultat.
</span>
<span slot="noOptions">
Saisissez les premiers caractères ...
</span>
</Multiselect>
</template>
</div>
</template>
......@@ -369,10 +219,6 @@ export default {
displayLabels() {
return this.$route.name === 'editer-signalement' || this.$route.name === 'ajouter-signalement' || this.$route.name === 'editer-attribut-signalement';
},
disabled () {
return this.field.disabled;
}
},
watch: {
......
......@@ -32,8 +32,8 @@
<FeatureExtraForm
v-if="conditioningCustForm"
:id="conditioningCustForm.label"
class="full-width"
ref="extraForm"
class="field"
name="conditioning-value"
:field="{...conditioningCustForm, value: config.conditionValue}"
:is-conditional-field="true"
......@@ -60,9 +60,9 @@
<div>
<FeatureExtraForm
:id="`forced-value-for-${customForm.name}`"
class="full-width"
ref="extraForm"
class="field"
name="conditioning-value"
name="forced-value"
:field="{...customForm, value: config.forcedValue}"
:is-conditional-field="true"
@update:condition-value="updateForcedValue($event)"
......
......@@ -144,6 +144,7 @@
<div
v-if="selectedFieldType === 'Liste de valeurs pré-enregistrées'"
class="field required"
data-test="prerecorded-list-option"
>
<label>{{
form.options.label
......@@ -232,9 +233,15 @@
type="checkbox"
name="conditional-custom-field"
:checked="form.conditional_field_config.value"
@change="setConditionalCustomForm($event)"
@change="setConditionalCustomForm"
>
<label>Activation conditionnelle</label>
<label
class="pointer"
for="conditional-custom-field"
@click="setConditionalCustomForm"
>
Activation conditionnelle
</label>
</div>
<div
......@@ -535,8 +542,8 @@ export default {
this.updateStore();
},
setConditionalCustomForm(e) {
if (e.target.checked) {
setConditionalCustomForm() {
if (this.form.conditional_field_config.value === null) {
// retrieve existing value when the user uncheck and check again, if no value defined create an empty object
this.form.conditional_field_config.value = this.customForm.conditional_field_config || {};
} else {
......
<template>
<div class="item">
<div
:id="project.title"
class="item"
data-test="project-list-item"
>
<div class="ui tiny image">
<img
:src="
......
import featureAPI from '@/services/feature-api';
import { isNil } from 'lodash';
import { isEqual, isNil } from 'lodash';
export function formatStringDate(stringDate) {
const date = new Date(stringDate);
......@@ -241,7 +241,7 @@ export function checkFieldForcedValue(field, extraForms) {
//* find the extraForm field conditioning the forced value
const conditioningField = extraForms.find((xtraForm) => xtraForm.name === config.conditionField);
//* if found check that its value match the condtionValue
if (conditioningField && conditioningField.value === config.conditionValue) {
if (conditioningField && isEqual(conditioningField.value, config.conditionValue)) {
//* set this value with the forced value and disable the form field
field.value = config.forcedValue;
field.disabled = true;
......
......@@ -9,6 +9,7 @@
v-if="user && user.can_create_project && isOnline"
:to="{ name: 'project_create', params: { action: 'create' } }"
class="ui green basic button"
data-test="create-project"
>
<i
class="plus icon"
......@@ -22,6 +23,7 @@
name: 'project_type_list',
}"
class="ui blue basic button"
data-test="to-project-models"
>
<i
class="copy icon"
......@@ -56,19 +58,20 @@
<div
v-if="projects"
class="ui divided items dimmable dimmed"
data-test="project-list"
>
<div
:class="{ active: loading }"
class="ui inverted dimmer"
>
<div class="ui loader" />
</div>
<ProjectsListItem
v-for="project in projects"
:key="project.slug"
:project="project"
/>
<div class="ui loader" />
</div>
<ProjectsListItem
v-for="project in projects"
:key="project.slug"
:project="project"
/>
<span
v-if="!projects || projects.length === 0"
......
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