Line 100... |
Line 100... |
100 |
});
|
100 |
});
|
101 |
}
|
101 |
}
|
Line 102... |
Line 102... |
102 |
|
102 |
|
103 |
// Style et affichage des input type="range"
|
103 |
// Style et affichage des input type="range"
|
104 |
function inputRangeDisplayNumber() {
|
104 |
function inputRangeDisplayNumber() {
|
105 |
$( '#zone-supp' ).on( 'input' , '.range input[type="range"]' , function () {
|
- |
|
106 |
$( this ).next( 'input[type="number"]' ).val ( $( this ).val() );
|
- |
|
107 |
});
|
- |
|
108 |
$( '#zone-supp' ).on( 'input' , '.range input[type="number"]' , function () {
|
105 |
$( '#zone-appli' ).on( 'input' , 'input[type="range"]' , function () {
|
109 |
$( this ).prev( 'input[type="range"]' ).val ( $( this ).val() );
|
106 |
$( this ).siblings( '.range-live-value' ).text( $( this ).val() );
|
110 |
});
|
107 |
});
|
Line 111... |
Line 108... |
111 |
}
|
108 |
}
|
112 |
|
109 |
|
Line 140... |
Line 137... |
140 |
// Html du formulaire du nouveaux champs inséré dans le dom
|
137 |
// Html du formulaire du nouveaux champs inséré dans le dom
|
141 |
$( '#new-fields' ).append(
|
138 |
$( '#new-fields' ).append(
|
142 |
'<fieldset data-id="' + fieldIndex + '" class="new-field">'+
|
139 |
'<fieldset data-id="' + fieldIndex + '" class="new-field">'+
|
143 |
'<h3>Nouveau champ :<br><strong class="field-title" data-id="' + fieldIndex + '"></strong></h3>'+
|
140 |
'<h3>Nouveau champ :<br><strong class="field-title" data-id="' + fieldIndex + '"></strong></h3>'+
|
144 |
// Nom du champ
|
141 |
// Nom du champ
|
- |
|
142 |
'<div class="row">'+
|
- |
|
143 |
'<div class="col-sm-12 mt-3">'+
|
145 |
'<label for="field-name" title="Donnez un titre à votre champ">Nom du champ *</label>'+
|
144 |
'<label for="field-name" title="Donnez un titre à votre champ">Nom du champ *</label>'+
|
146 |
'<input type="text" name="field-name" data-id="' + fieldIndex + '" class="field-name" placeholder="Titre de votre champ" title="Le titre du champ" required>'+
|
145 |
'<input type="text" name="field-name" data-id="' + fieldIndex + '" class="field-name form-control" placeholder="Titre de votre champ" title="Le titre du champ" required>'+
|
- |
|
146 |
'</div>'+
|
147 |
// Clé du champ
|
147 |
// Clé du champ
|
- |
|
148 |
'<div class="col-sm-12 mt-3">'+
|
148 |
'<label for="field-key" title="Nom du champ dans la base de données">'+
|
149 |
'<label for="field-key" title="Nom du champ dans la base de données">'+
|
149 |
'Clé du champ *'+
|
150 |
'Clé du champ *'+
|
150 |
'</label>'+
|
151 |
'</label>'+
|
151 |
'<input type="text" name="field-key" data-id="' + fieldIndex + '" class="field-key" placeholder="Clé du champ" pattern="^(?:[a-z]+(?:(?:[A-Z]+[a-z]+)+)?|[a-z]+(?:(?:-[a-z]+)+)?)$" title="Clé Unique en Camelcase ou minuscule séparés par tirets, pas d\'accents pas de caractères spéciaux." required>'+
|
152 |
'<input type="text" name="field-key" data-id="' + fieldIndex + '" class="field-key form-control" placeholder="Clé du champ" pattern="^(?:[a-z]+(?:(?:[A-Z]+[a-z]+)+)?|[a-z]+(?:(?:-[a-z]+)+)?)$" title="Clé Unique en Camelcase ou minuscule séparés par tirets, pas d\'accents pas de caractères spéciaux." required>'+
|
- |
|
153 |
'</div>'+
|
152 |
'<p class="message">' +
|
154 |
'<p class="message ml-2 mr-2">' +
|
153 |
'<i class="fa fa-exclamation-triangle" aria-hidden="true" style="color:#ff5d55"></i> '+
|
155 |
'<i class="fa fa-exclamation-triangle" aria-hidden="true" style="color:#ff5d55"></i> '+
|
154 |
'Une clé doit être unique<br>' +
|
156 |
'Une clé doit être unique<br>' +
|
155 |
'En "camelCase" (ecriture chameau)<br>'+
|
157 |
'En "camelCase" (ecriture chameau)<br>'+
|
156 |
'Ou en minuscule avec tirets ("-") si nécessaire<br>'+
|
158 |
'Ou en minuscule avec tirets ("-") si nécessaire<br>'+
|
157 |
'Pas d\'espaces, aucuns caractères spéciaux (accents, cédilles, etc.).' +
|
159 |
'Pas d\'espaces, aucuns caractères spéciaux (accents, cédilles, etc.).' +
|
158 |
'</p>' +
|
160 |
'</p>' +
|
159 |
// Type de champ
|
161 |
// Type de champ
|
160 |
'<label for="field-element" title="Quel type de champ">Type de champ *</label>'+
|
162 |
'<div class="col-sm-12 mt-3 add-field-select" data-id="' + fieldIndex + '">'+
|
161 |
'<div class="select-wrapper add-field-select" data-id="' + fieldIndex + '">'+
|
163 |
'<label for="field-element" title="Quel type de champ">Type de champ *</label>'+
|
162 |
'<select name="field-element" data-id="' + fieldIndex + '" class="field-element">'+
|
164 |
'<select name="field-element" data-id="' + fieldIndex + '" class="field-element form-control">'+
|
163 |
'<option value="text">Champ texte</option>'+
|
165 |
'<option value="text">Champ texte</option>'+
|
164 |
'<option value="email">Champ email</option>'+
|
166 |
'<option value="email">Champ email</option>'+
|
165 |
'<option value="textarea">Champ rédaction</option>'+
|
167 |
'<option value="textarea">Champ rédaction</option>'+
|
166 |
'<option value="select">Menu déroulant</option>'+
|
168 |
'<option value="select">Menu déroulant</option>'+
|
167 |
'<option value="checkbox">Cases à cocher</option>'+
|
169 |
'<option value="checkbox">Cases à cocher</option>'+
|
168 |
'<option value="list-checkbox">Liste de cases à cocher</option>'+
|
170 |
'<option value="list-checkbox">Liste de cases à cocher</option>'+
|
169 |
'<option value="radio">Boutons radio</option>'+
|
171 |
'<option value="radio">Boutons radio</option>'+
|
170 |
'<option value="date">Calendrier</option>'+
|
172 |
'<option value="date">Calendrier</option>'+
|
171 |
'<option value="range">Curseur (entre 2 bornes)</option>'+
|
173 |
'<option value="range">Curseur (entre 2 bornes)</option>'+
|
172 |
'<option value="number">Nombre</option>'+
|
174 |
'<option value="number">Nombre</option>'+
|
173 |
'</select>'+
|
175 |
'</select>'+
|
174 |
'</div>'+
|
176 |
'</div>'+
|
175 |
// Checkbox "champ requis"
|
177 |
// Checkbox "champ requis"
|
- |
|
178 |
'<div class="col-sm-12 radio mt-3">'+
|
176 |
'<label for="field-is_mandatory" title="Ce champ est obligatoire">Champ requis ?</label>'+
|
179 |
'<label class="radio-label" for="field-is_mandatory" title="Ce champ est obligatoire">'+
|
177 |
'<input type="checkbox" name="field-is_mandatory" data-id="' + fieldIndex + '" class="field-is_mandatory">'+
|
180 |
'<input type="checkbox" name="field-is_mandatory" data-id="' + fieldIndex + '" class="field-is_mandatory form-control">'+
|
- |
|
181 |
'Champ requis ?'+
|
- |
|
182 |
'</label>'+
|
- |
|
183 |
'</div>'+
|
178 |
// Unité des valeurs
|
184 |
// Unité des valeurs
|
- |
|
185 |
'<div class="col-sm-12 mt-3">'+
|
179 |
'<label for="field-unit" title="Unité de mesure de vos valeurs">Unités ( cm, kg, ha, etc.)</label>'+
|
186 |
'<label for="field-unit" title="Unité de mesure de vos valeurs">Unités ( cm, kg, ha, etc.)</label>'+
|
180 |
'<input type="text" name="field-unit" data-id="' + fieldIndex + '" class="field-unit" placeholder="symbole de vos unités">'+
|
187 |
'<input type="text" name="field-unit" data-id="' + fieldIndex + '" class="field-unit form-control" placeholder="symbole de vos unités">'+
|
- |
|
188 |
'</div>'+
|
181 |
// Tooltip
|
189 |
// Tooltip
|
- |
|
190 |
'<div class="col-sm-12 mt-3">'+
|
182 |
'<label for="field-description" title="Ajoutez une info-bulle">Info-bulle</label>'+
|
191 |
'<label for="field-description" title="Ajoutez une info-bulle">Info-bulle</label>'+
|
183 |
'<input type="text" name="field-description" data-id="' + fieldIndex + '" class="field-description" placeholder="Quelques mots">'+
|
192 |
'<input type="text" name="field-description" data-id="' + fieldIndex + '" class="field-description form-control" placeholder="Quelques mots">'+
|
- |
|
193 |
'</div>'+
|
184 |
// Import d'une image d'aide à afficher en popup
|
194 |
// Import d'une image d'aide à afficher en popup
|
185 |
'<div class="input-file-container">'+
|
195 |
'<div class="input-file-row row">'+
|
- |
|
196 |
'<div class="input-file-container col-sm-10">'+
|
186 |
'<input type="file" class="input-file field-help" name="field-help' + fieldIndex + '" data-id="' + fieldIndex + '" id="help-doc-' + fieldIndex + '" accept="image/*">'+
|
197 |
'<input type="file" class="input-file field-help" name="field-help' + fieldIndex + '" data-id="' + fieldIndex + '" id="help-doc-' + fieldIndex + '" accept="image/*">'+
|
187 |
'<label for="field-help' + fieldIndex + '" class="label-file"><i class="fas fa-download"></i> Popup aide image (.jpg)</label>'+
|
198 |
'<label for="field-help' + fieldIndex + '" class="label-file"><i class="fas fa-download"></i> Popup aide image (.jpg)</label>'+
|
- |
|
199 |
'</div>'+
|
- |
|
200 |
'<div class="btn btn-danger btn-sm remove-file" name="remove-file" data-id="' + fieldIndex + '" title="Supprimer le fichier"><i class="fas fa-times" aria-hidden="true"></i></div>'+
|
- |
|
201 |
'<div class="file-return help-doc-' + fieldIndex + ' hidden"></div>'+
|
- |
|
202 |
'</div>'+
|
- |
|
203 |
// Boutons supprimer
|
- |
|
204 |
'<div class="col-sm-12 mt-3">'+
|
- |
|
205 |
'<label for="remove-field">Supprimer</label>'+
|
- |
|
206 |
'<div class="remove-field button" name="remove-field" data-id="' + fieldIndex + '" title="Supprimer un champ"><i class="fa fa-skull" aria-hidden="true"></i></div>'+
|
- |
|
207 |
'</div>'+
|
188 |
'</div>'+
|
208 |
'</div>'+
|
189 |
'<div class="remove-file button" name="remove-file" data-id="' + fieldIndex + '" title="Supprimer le fichier"><i class="fas fa-times" aria-hidden="true"></i></div>'+
|
- |
|
190 |
'<div class="file-return help-doc-' + fieldIndex + ' hidden"></div>'+
|
- |
|
191 |
// Boutons supprimer
|
- |
|
192 |
'<label for="remove-field">Supprimer</label>'+
|
- |
|
193 |
'<div class="remove-field button" name="remove-field" data-id="' + fieldIndex + '" title="Supprimer un champ"><i class="fa fa-skull" aria-hidden="true"></i></div>'+
|
- |
|
194 |
'</fieldset>'
|
209 |
'</fieldset>'
|
195 |
);
|
210 |
);
|
196 |
// Animation de l'affichage
|
211 |
// Animation de l'affichage
|
197 |
$( 'fieldset.new-field[data-id="' + fieldIndex + '"]').hide().show( 200 );
|
212 |
$( 'fieldset.new-field[data-id="' + fieldIndex + '"]').hide().show( 200 );
|
198 |
}
|
213 |
}
|
Line 220... |
Line 235... |
220 |
function onChangeFieldTypeCollectDetails( fieldIndex ) {
|
235 |
function onChangeFieldTypeCollectDetails( fieldIndex ) {
|
221 |
// On insère les champs par défaut de recueil d'informations
|
236 |
// On insère les champs par défaut de recueil d'informations
|
222 |
displayFieldDetailsCollect(
|
237 |
displayFieldDetailsCollect(
|
223 |
fieldIndex,
|
238 |
fieldIndex,
|
224 |
// Placeholder (champ type text par défaut)
|
239 |
// Placeholder (champ type text par défaut)
|
- |
|
240 |
'<div class="col-sm-12 mt-3">'+
|
225 |
'<label for="aide-saisie" title="Aidez les utilisateurs en deux ou 3 mots ou chiffres à comprendre ce que doit contenir le champ">Texte d\'aide à la saisie</label>'+
|
241 |
'<label for="aide-saisie" title="Aidez les utilisateurs en deux ou 3 mots ou chiffres à comprendre ce que doit contenir le champ">Texte d\'aide à la saisie</label>'+
|
226 |
'<input type="text" name="aide-saisie" data-id="' + fieldIndex + '" class="aide-saisie" placeholder="Ce que doit contenir le champ">'
|
242 |
'<input type="text" name="aide-saisie" data-id="' + fieldIndex + '" class="aide-saisie form-control" placeholder="Ce que doit contenir le champ">'+
|
- |
|
243 |
'</div>'
|
227 |
);
|
244 |
);
|
228 |
// Sinon :
|
245 |
// Sinon :
|
229 |
$( '.field-element[data-id="' + fieldIndex + '"]' ).change( function() {
|
246 |
$( '.field-element[data-id="' + fieldIndex + '"]' ).change( function() {
|
230 |
// On intialise l'index pour les listes la variable qui contiendra un id pour chaque option
|
247 |
// On intialise l'index pour les listes la variable qui contiendra un id pour chaque option
|
231 |
var valueIndex = 0;
|
248 |
var valueIndex = 0;
|
Line 235... |
Line 252... |
235 |
$( this ).remove();
|
252 |
$( this ).remove();
|
236 |
});
|
253 |
});
|
Line 237... |
Line 254... |
237 |
|
254 |
|
238 |
// Html de recueil de données en fonction de l'élément choisi
|
255 |
// Html de recueil de données en fonction de l'élément choisi
|
239 |
switch( $( this ).val() ) {
|
- |
|
240 |
case 'number':
|
256 |
switch( $( this ).val() ) {
|
- |
|
257 |
case 'range':
|
241 |
case 'range':
|
258 |
case 'number':
|
242 |
displayFieldDetailsCollect(
|
259 |
displayFieldDetailsCollect(
|
- |
|
260 |
fieldIndex,
|
243 |
fieldIndex,
|
261 |
'<p class="message">'+
|
- |
|
262 |
'<i class="fa fa-exclamation-triangle" aria-hidden="true" style="color:#ff5d55"></i> '+
|
- |
|
263 |
'Ne pas oublier de prévisualiser !!<br>'+
|
- |
|
264 |
'Vérifier le bon fonctionnement et changer, si nécessaire, les valeurs de défaut, incrémentation (step), min et max.<br>'+
|
- |
|
265 |
'Si le navigateur considère que certaines valeurs sont incohérentes il pourrait les modifier automatiquement'+
|
244 |
'<p class="message"><i class="fa fa-exclamation-triangle" aria-hidden="true" style="color:#ff5d55"></i> Ne pas oublier de changer, si nécessaire, les valeurs step, min et max</p>' +
|
266 |
'</p>' +
|
- |
|
267 |
// Placeholder
|
245 |
// Placeholder
|
268 |
'<div class="col-sm-12 mt-3">'+
|
246 |
'<label for="aide-saisie" title="Deux ou 3 mots ou chiffres pour comprendre ce que doit contenir le champ (ex: min 20, 10 par 10, etc.)">Texte d\'aide à la saisie</label>'+
|
269 |
'<label for="aide-saisie" title="Deux ou 3 mots ou chiffres pour comprendre ce que doit contenir le champ (ex: min 20, 10 par 10, etc.)">Texte d\'aide à la saisie</label>'+
|
- |
|
270 |
'<input type="text" name="aide-saisie" data-id="' + fieldIndex + '" class="aide-saisie form-control" placeholder="Ce que doit contenir le champ">'+
|
247 |
'<input type="text" name="aide-saisie" data-id="' + fieldIndex + '" class="aide-saisie" placeholder="Ce que doit contenir le champ">'+
|
271 |
'</div>'+
|
- |
|
272 |
// Valeur par défaut
|
248 |
// Valeur par défaut
|
273 |
'<div class="col-sm-12 mt-3">'+
|
249 |
'<label for="default" title="Valeur par défaut">Valeur par défaut</label>'+
|
274 |
'<label for="default" title="Valeur par défaut">Valeur par défaut</label>'+
|
- |
|
275 |
'<input type="number" name="default" data-id="' + fieldIndex + '" class="default form-control" step="0.01" lang="en">'+
|
250 |
'<input type="number" name="default" data-id="' + fieldIndex + '" class="default" step="0.01" lang="en">'+
|
276 |
'</div>'+
|
- |
|
277 |
// Incrémentation ( attribut step="" )
|
251 |
// Incrémentation ( attribut step="" )
|
278 |
'<div class="col-sm-12 mt-3">'+
|
252 |
'<label for="step" title="De 10 en 10, de 0.5 en 0.5, etc.">Incrémentation (step) :<br>defaut = +1</label>'+
|
279 |
'<label for="step" title="De 10 en 10, de 0.5 en 0.5, etc.">Incrémentation (step)</label>'+
|
- |
|
280 |
'<input type="number" name="step" data-id="' + fieldIndex + '" class="step form-control" step="0.01" value="1" lang="en">'+
|
253 |
'<input type="number" name="step" data-id="' + fieldIndex + '" class="step" step="0.01" value="1" lang="en">'+
|
281 |
'</div>'+
|
- |
|
282 |
// Min
|
254 |
// Min
|
283 |
'<div class="col-sm-12 mt-3">'+
|
255 |
'<label for="min" title="valeur min">Valeur minimale</label>'+
|
284 |
'<label for="min" title="valeur min">Valeur minimale</label>'+
|
- |
|
285 |
'<input type="number" name="min" data-id="' + fieldIndex + '" class="min form-control" step="0.01" value="0" lang="en">'+
|
256 |
'<input type="number" name="min" data-id="' + fieldIndex + '" class="min" step="0.01" value="0" lang="en">'+
|
286 |
'</div>'+
|
- |
|
287 |
// Max
|
257 |
// Max
|
288 |
'<div class="col-sm-12 mt-3">'+
|
258 |
'<label for="max" title="valeur max">Valeur maximale</label>'+
|
289 |
'<label for="max" title="valeur max">Valeur maximale</label>'+
|
- |
|
290 |
'<input type="number" name="max" data-id="' + fieldIndex + '" class="max form-control" step="0.01" value="1" lang="en">'+
|
259 |
'<input type="number" name="max" data-id="' + fieldIndex + '" class="max" step="0.01" value="1" lang="en">'
|
291 |
'</div>'
|
260 |
);
|
292 |
);
|
Line 261... |
Line 293... |
261 |
break;
|
293 |
break;
|
262 |
|
294 |
|
263 |
case 'date':
|
295 |
case 'date':
|
264 |
displayFieldDetailsCollect(
|
296 |
displayFieldDetailsCollect(
|
- |
|
297 |
fieldIndex,
|
265 |
fieldIndex,
|
298 |
// Date min
|
266 |
// Date min
|
299 |
'<div class="col-sm-12 mt-3">'+
|
- |
|
300 |
'<label for="min" title="date min">Date minimale</label>'+
|
267 |
'<label for="min" title="date min">Date minimale</label>'+
|
301 |
'<input type="date" name="min" data-id="' + fieldIndex + '" class="min form-control" pattern="(^(((0[1-9]|1[0-9]|2[0-8])[\/](0[1-9]|1[012]))|((29|30|31)[\/](0[13578]|1[02]))|((29|30)[\/](0[4,6,9]|11)))[\/](19|[2-9][0-9])\d\d$)|(^29[\/]02[\/](19|[2-9][0-9])(00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96)$)" title="jj/mm/aaaa">'+
|
- |
|
302 |
'</div>'+
|
268 |
'<input type="date" name="min" data-id="' + fieldIndex + '" class="min" pattern="(^(((0[1-9]|1[0-9]|2[0-8])[\/](0[1-9]|1[012]))|((29|30|31)[\/](0[13578]|1[02]))|((29|30)[\/](0[4,6,9]|11)))[\/](19|[2-9][0-9])\d\d$)|(^29[\/]02[\/](19|[2-9][0-9])(00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96)$)" title="jj/mm/aaaa">'+
|
303 |
// Date max
|
269 |
// Date max
|
304 |
'<div class="col-sm-12 mt-3">'+
|
- |
|
305 |
'<label for="max" title="date max">Date maximale</label>'+
|
270 |
'<label for="max" title="date max">Date maximale</label>'+
|
306 |
'<input type="date" name="max" data-id="' + fieldIndex + '" class="max form-control" pattern="(^(((0[1-9]|1[0-9]|2[0-8])[\/](0[1-9]|1[012]))|((29|30|31)[\/](0[13578]|1[02]))|((29|30)[\/](0[4,6,9]|11)))[\/](19|[2-9][0-9])\d\d$)|(^29[\/]02[\/](19|[2-9][0-9])(00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96)$)" title="jj/mm/aaaa">'+
|
271 |
'<input type="date" name="max" data-id="' + fieldIndex + '" class="max" pattern="(^(((0[1-9]|1[0-9]|2[0-8])[\/](0[1-9]|1[012]))|((29|30|31)[\/](0[13578]|1[02]))|((29|30)[\/](0[4,6,9]|11)))[\/](19|[2-9][0-9])\d\d$)|(^29[\/]02[\/](19|[2-9][0-9])(00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96)$)" title="jj/mm/aaaa">'
|
307 |
'</div>'
|
Line 272... |
Line 308... |
272 |
);
|
308 |
);
|
273 |
break;
|
309 |
break;
|
Line 281... |
Line 317... |
281 |
'<p class="message element-message">' +
|
317 |
'<p class="message element-message">' +
|
282 |
'<i class="fa fa-exclamation-triangle" aria-hidden="true" style="color:#ff5d55"></i> ' +
|
318 |
'<i class="fa fa-exclamation-triangle" aria-hidden="true" style="color:#ff5d55"></i> ' +
|
283 |
'Entrez au moins une valeur de ' + $( this ).children( 'option:selected' ).text() +
|
319 |
'Entrez au moins une valeur de ' + $( this ).children( 'option:selected' ).text() +
|
284 |
'</p>'+
|
320 |
'</p>'+
|
285 |
// Première option
|
321 |
// Première option
|
286 |
'<div class="new-value" data-list-value-id="' + valueIndex +'">'+
|
322 |
'<div class="new-value center-block row" data-list-value-id="' + valueIndex +'">'+
|
287 |
// Recueil d'une valeur de la liste
|
323 |
// Recueil d'une valeur de la liste
|
- |
|
324 |
'<div class="col-sm-12 mt-3">'+
|
288 |
'<label for="list-value">Valeur *:</label>'+
|
325 |
'<label for="list-value">Valeur *:</label>'+
|
289 |
'<input type="text" name="list-value" data-id="' + fieldIndex + '" class="list-value" data-list-value-id="' + valueIndex +'" placeholder="Une des valeurs de la liste" required>'+
|
326 |
'<input type="text" name="list-value" data-id="' + fieldIndex + '" class="list-value form-control" data-list-value-id="' + valueIndex +'" placeholder="Une des valeurs de la liste" required>'+
|
- |
|
327 |
'</div>' +
|
290 |
// Checkbox valeur par défaut
|
328 |
// Checkbox valeur par défaut
|
- |
|
329 |
'<div class="col-sm-12 radio mt-3">'+
|
291 |
'<label for="is-defaut-value" title="Ceci est la valeur par défaut">Valeur par défaut</label>'+
|
330 |
'<label for="is-defaut-value" title="Ceci est la valeur par défaut" class="radio-label">'+
|
292 |
'<input type="checkbox" name="is-defaut-value" data-id="' + fieldIndex + '" class="is-defaut-value" title="entrez une valeur pour activer cette case" data-list-value-id="' + valueIndex +'" disabled >'+
|
331 |
'<input type="checkbox" name="is-defaut-value" data-id="' + fieldIndex + '" class="is-defaut-value" title="entrez une valeur pour activer cette case" data-list-value-id="' + valueIndex +'" disabled >'+
|
- |
|
332 |
'Valeur par défaut'+
|
- |
|
333 |
'</label>'+
|
- |
|
334 |
'</div>' +
|
293 |
'</div>' +
|
335 |
'</div>' +
|
294 |
// Bouton ajout d'une valeur à la liste
|
336 |
// Bouton ajout d'une valeur à la liste
|
- |
|
337 |
'<div class="col-sm-12 mt-3 add-value-container" data-id="' + fieldIndex + '">'+
|
295 |
'<label for="add-value" class="add-value" data-id="' + fieldIndex + '" title="Ajouter une valeur à la liste">Ajouter une valeur</label>'+
|
338 |
'<label for="add-value" class="add-value" data-id="' + fieldIndex + '" title="Ajouter une valeur à la liste">Ajouter une valeur</label>'+
|
296 |
'<div class="button add-value-button" name="add-value" data-id="' + fieldIndex + '" title="Ajouter une valeur à la liste"><i class="fa fa-puzzle-piece" aria-hidden="true"></i></div>'+
|
339 |
'<div class="button add-value-button" name="add-value" data-id="' + fieldIndex + '" title="Ajouter une valeur à la liste"><i class="fa fa-puzzle-piece" aria-hidden="true"></i></div>'+
|
- |
|
340 |
'</div>' +
|
297 |
// checkbox ajouter une valeur "Autre:"
|
341 |
// checkbox ajouter une valeur "Autre:"
|
- |
|
342 |
'<div class="col-sm-12 radio mt-3">'+
|
298 |
'<label for="option-other-value" title="Ajouter une option \'Autre:\' à la fin">Valeur "Autre"</label>'+
|
343 |
'<label for="option-other-value" title="Ajouter une option \'Autre:\' à la fin" class="radio-label">'+
|
299 |
'<input type="checkbox" name="option-other-value" data-id="' + fieldIndex + '" class="option-other-value" title="Ajouter une option \'Autre\' à la fin">'
|
344 |
'<input type="checkbox" name="option-other-value" data-id="' + fieldIndex + '" class="option-other-value" title="Ajouter une option \'Autre\' à la fin">'+
|
- |
|
345 |
'Valeur "Autre"'+
|
- |
|
346 |
'</label>'+
|
- |
|
347 |
'</div>'
|
300 |
);
|
348 |
);
|
301 |
break;
|
349 |
break;
|
Line 302... |
Line 350... |
302 |
|
350 |
|
303 |
case 'email':
|
351 |
case 'email':
|
304 |
case 'text':
|
352 |
case 'text':
|
305 |
case 'textarea':
|
353 |
case 'textarea':
|
306 |
default:
|
354 |
default:
|
307 |
displayFieldDetailsCollect(
|
355 |
displayFieldDetailsCollect(
|
308 |
fieldIndex,
|
356 |
fieldIndex,
|
- |
|
357 |
// Placeholder
|
309 |
// Placeholder
|
358 |
'<div class="col-sm-12 mt-3">'+
|
310 |
'<label for="aide-saisie" title="Aidez les utilisateurs en deux ou 3 mots ou chiffres à comprendre ce que doit contenir le champ">Texte d\'aide à la saisie</label>'+
|
359 |
'<label for="aide-saisie" title="Aidez les utilisateurs en deux ou 3 mots ou chiffres à comprendre ce que doit contenir le champ">Texte d\'aide à la saisie</label>'+
|
- |
|
360 |
'<input type="text" name="aide-saisie form-control" data-id="' + fieldIndex + '" class="aide-saisie" placeholder="Ce que doit contenir le champ">'+
|
311 |
'<input type="text" name="aide-saisie" data-id="' + fieldIndex + '" class="aide-saisie" placeholder="Ce que doit contenir le champ">'
|
361 |
'</div>'
|
312 |
);
|
362 |
);
|
313 |
break;
|
363 |
break;
|
314 |
}
|
364 |
}
|
315 |
// Ajout des valeurs possibles
|
365 |
// Ajout des valeurs possibles
|
Line 319... |
Line 369... |
319 |
}
|
369 |
}
|
Line 320... |
Line 370... |
320 |
|
370 |
|
321 |
// Insertion dans le dom des champs de recueil d'informations
|
371 |
// Insertion dans le dom des champs de recueil d'informations
|
322 |
function displayFieldDetailsCollect( fieldIndex , fieldDetails ) {
|
372 |
function displayFieldDetailsCollect( fieldIndex , fieldDetails ) {
|
323 |
$( '.add-field-select[data-id="' + fieldIndex + '"]' ).after(
|
373 |
$( '.add-field-select[data-id="' + fieldIndex + '"]' ).after(
|
324 |
'<div class="field-details" data-id="' + fieldIndex + '">' +
|
374 |
'<div class="field-details col-sm-11 mt-3 row" data-id="' + fieldIndex + '">' +
|
325 |
fieldDetails +
|
375 |
fieldDetails +
|
326 |
'</div>'
|
376 |
'</div>'
|
327 |
).hide().show( 200);
|
377 |
).hide().show( 200);
|
Line 331... |
Line 381... |
331 |
|
381 |
|
332 |
// Ajout des options des listes (deroulantes, cases à cocher etc.)
|
382 |
// Ajout des options des listes (deroulantes, cases à cocher etc.)
|
333 |
function onClickAddNewValueToList( fieldIndex , valueIndex ) {
|
383 |
function onClickAddNewValueToList( fieldIndex , valueIndex ) {
|
334 |
$( '.add-value-button[data-id="' + fieldIndex + '"]' ).click( function() {
|
384 |
$( '.add-value-button[data-id="' + fieldIndex + '"]' ).click( function() {
|
335 |
valueIndex++;
|
385 |
valueIndex++;
|
336 |
$( '.add-value[data-id="' + fieldIndex + '"]' ).before(
|
386 |
$( '.add-value-container[data-id="' + fieldIndex + '"]' ).before(
|
337 |
'<div class="new-value" data-list-value-id="' + valueIndex +'">'+
|
387 |
'<div class="new-value center-block row" data-list-value-id="' + valueIndex +'">'+
|
- |
|
388 |
// Recueil d'une valeur de la liste
|
338 |
// Recueil d'une valeur de la liste
|
389 |
'<div class="col-sm-12 mt-3">'+
|
339 |
'<label for="list-value">Valeur *:</label>'+
|
390 |
'<label for="list-value">Valeur *:</label>'+
|
- |
|
391 |
'<input type="text" name="list-value" data-id="' + fieldIndex + '" class="list-value form-control" data-list-value-id="' + valueIndex +'" placeholder="Une des valeurs de la liste" required>'+
|
340 |
'<input type="text" name="list-value" data-id="' + fieldIndex + '" class="list-value" data-list-value-id="' + valueIndex +'" placeholder="Une des valeurs de la liste" required>'+
|
392 |
'</div>' +
|
341 |
// Checkbox valeur par défaut+bouton supprimer
|
- |
|
342 |
'<div class="row">'+
|
393 |
// Checkbox valeur par défaut+bouton supprimer
|
343 |
'<div class="col-md-5">'+
|
394 |
'<div class="col-sm-12 mt-3 row">'+
|
344 |
// Valeur par défaut
|
- |
|
345 |
'<label for="is-defaut-value" title="Ceci est la valeur par défaut">Valeur par défaut</label>'+
|
- |
|
346 |
'<input type="checkbox" name="is-defaut-value" data-id="' + fieldIndex + '" class="is-defaut-value" title="entrez une valeur pour activer cette case" data-list-value-id="' + valueIndex +'" disabled >'+
|
- |
|
347 |
'</div>'+
|
395 |
// Bouton supprimer une option
|
348 |
'<div class="col-md-5">'+
|
- |
|
349 |
// Bouton supprimer une option
|
- |
|
350 |
'<label for="remove-value">supprimer valeur</label>'+
|
396 |
'<div class="col-sm-5">'+
|
351 |
'<div class="remove-value button" name="remove-value" data-id="' + fieldIndex + '" data-list-value-id="' + valueIndex + '" title="Supprimer une valeur"><i class="fa fa-trash" aria-hidden="true"></i></div>'+
|
397 |
'<div class="remove-value button" name="remove-value" data-id="' + fieldIndex + '" data-list-value-id="' + valueIndex + '" title="Supprimer une valeur"><i class="fa fa-trash" aria-hidden="true"></i></div>'+
|
- |
|
398 |
'</div>'+
|
- |
|
399 |
// Valeur par défaut
|
- |
|
400 |
'<div class="col-sm-7 radio">'+
|
- |
|
401 |
'<label for="is-defaut-value" title="Ceci est la valeur par défaut" class="radio-label">'+
|
- |
|
402 |
'<input type="checkbox" name="is-defaut-value" data-id="' + fieldIndex + '" class="is-defaut-value" title="entrez une valeur pour activer cette case" data-list-value-id="' + valueIndex +'" disabled >'+
|
- |
|
403 |
'Valeur défaut'+
|
- |
|
404 |
'</label>'+
|
352 |
'</div>'+
|
405 |
'</div>'+
|
353 |
'</div>'+
|
406 |
'</div>'+
|
354 |
'</div>'
|
407 |
'</div>'
|
355 |
).hide().show( 200);
|
408 |
).hide().show( 200);
|
356 |
// Une seule valeur par défaut pour select et radio
|
409 |
// Une seule valeur par défaut pour select et radio
|
Line 361... |
Line 414... |
361 |
}
|
414 |
}
|
Line 362... |
Line 415... |
362 |
|
415 |
|
363 |
// Activer la checkbox de valeur par default uniquement si une valeur est entrée
|
416 |
// Activer la checkbox de valeur par default uniquement si une valeur est entrée
|
364 |
function onInputListValueLabelEnableDefaultCheckbox() {
|
417 |
function onInputListValueLabelEnableDefaultCheckbox() {
|
365 |
$( '#new-fields' ).on( 'input' , '.list-value' , function() {
|
418 |
$( '#new-fields' ).on( 'input' , '.list-value' , function() {
|
366 |
var thisValue = $( this ).parent( '.new-value' );
|
419 |
var $thisDefautValue = $( '.is-defaut-value[data-id="' + $( this ).data( 'id' ) + '"][data-list-value-id="' + $( this ).data( 'list-value-id' ) + '"]' );
|
367 |
if( '' !== $( this ).val() ) {
|
420 |
if( '' !== $( this ).val() ) {
|
368 |
$( '.is-defaut-value', thisValue ).removeAttr( 'disabled' );
|
421 |
$thisDefautValue.removeAttr( 'disabled' );
|
369 |
} else {
|
422 |
} else {
|
370 |
$( '.is-defaut-value', thisValue ).attr( 'disabled', true ).attr( 'checked' , false );
|
423 |
$thisDefautValue.attr( 'disabled', true ).attr( 'checked' , false );
|
371 |
}
|
424 |
}
|
372 |
});
|
425 |
});
|
Line 373... |
Line 426... |
373 |
}
|
426 |
}
|
Line 408... |
Line 461... |
408 |
$( '.field-key' ).change( function () {
|
461 |
$( '.field-key' ).change( function () {
|
409 |
let count = $( '.field-key' ).length;
|
462 |
let count = $( '.field-key' ).length;
|
Line 410... |
Line 463... |
410 |
|
463 |
|
411 |
for(var index = 0 ; index < count ; index++) {
|
464 |
for(var index = 0 ; index < count ; index++) {
|
412 |
let thisFieldKey = $( '.field-key[data-id="' + index + '"]' );
|
465 |
let thisFieldKey = $( '.field-key[data-id="' + index + '"]' );
|
413 |
// Le champ avec cet index paourrait avoir été supprimé
|
466 |
// Le champ avec cet index pourrait avoir été supprimé
|
414 |
if( 0 < thisFieldKey.length ) {
|
467 |
if( 0 < thisFieldKey.length ) {
|
415 |
for( var otherIndex = 0 ; otherIndex < count ; otherIndex++ ) {
|
468 |
for( var otherIndex = 0 ; otherIndex < count ; otherIndex++ ) {
|
416 |
let otherFieldKey = $( '.field-key[data-id="' + otherIndex + '"]' );
|
469 |
let otherFieldKey = $( '.field-key[data-id="' + otherIndex + '"]' );
|
417 |
// Le champ avec cet index pourrait avoir été supprimé
|
470 |
// Le champ avec cet index pourrait avoir été supprimé
|
Line 609... |
Line 662... |
609 |
if( $.isEmptyObject( datasToSubmit[ resultArrayIndex ].fieldValues ) ){
|
662 |
if( $.isEmptyObject( datasToSubmit[ resultArrayIndex ].fieldValues ) ){
|
610 |
delete datasToSubmit[ resultArrayIndex ].fieldValues;
|
663 |
delete datasToSubmit[ resultArrayIndex ].fieldValues;
|
611 |
}
|
664 |
}
|
612 |
// Copie d'un champ de fichier d'aide dans le bloc d'envoi
|
665 |
// Copie d'un champ de fichier d'aide dans le bloc d'envoi
|
613 |
if( 0 < $( '.field-help' , thisFieldset ).get(0).files.length ) {
|
666 |
if( 0 < $( '.field-help' , thisFieldset ).get(0).files.length ) {
|
614 |
console.log( $( '.field-help' , thisFieldset ).get(0).files[0].type );
|
- |
|
615 |
// Présence d'un document d'aide
|
667 |
// Présence d'un document d'aide
|
616 |
datasToSubmit[ resultArrayIndex ].help = $( '.field-help' , thisFieldset ).get(0).files[0].type;
|
668 |
datasToSubmit[ resultArrayIndex ].help = $( '.field-help' , thisFieldset ).get(0).files[0].type;
|
617 |
$( '.field-help' , thisFieldset ).clone()
|
669 |
$( '.field-help' , thisFieldset ).clone()
|
618 |
.attr( 'name' , 'help-' + datasToSubmit[ resultArrayIndex ].key )// l'attribut name prend la valeur de la clé
|
670 |
.attr( 'name' , 'help-' + datasToSubmit[ resultArrayIndex ].key )// l'attribut name prend la valeur de la clé
|
619 |
.appendTo( '#help-doc-submit' );
|
671 |
.appendTo( '#help-doc-submit' );
|
Line 737... |
Line 789... |
737 |
|
789 |
|
738 |
// Prévisualisation
|
790 |
// Prévisualisation
|
739 |
function DisplayClassicFields() {
|
791 |
function DisplayClassicFields() {
|
740 |
// Affichage du titre du widget
|
792 |
// Affichage du titre du widget
|
741 |
renderFields( $( '#titre' ) , $( '.widget-renderer h1' ) );
|
- |
|
742 |
// Affichage du nom du projet
|
- |
|
743 |
renderFields( $( '#projet' ) , $( '.projet-description' ));
|
793 |
renderFields( $( '#titre' ) , $( '.widget-renderer h1' ) );
|
744 |
// Affichage de la description
|
794 |
// Affichage de la description
|
- |
|
795 |
renderFields( $( '#description' ) , $( '.preview-description' ) );
|
- |
|
796 |
// Affichage referentiel
|
- |
|
797 |
$( '#label-taxon span' ).text( ' (' + $( '#referentiel' ).val() + ')' );
|
- |
|
798 |
$( '#referentiel' ).change( function() {
|
- |
|
799 |
$( '#label-taxon span' ).text( ' (' + $( this ).val() + ')' );
|
- |
|
800 |
});
|
745 |
renderFields( $( '#description' ) , $( '.preview-description' ) );
|
801 |
|
746 |
// Affichage du logo s'il existe déjà
|
802 |
// Affichage du logo s'il existe déjà
|
747 |
if( 0 !== $( '#logo' ).val().length || $( '#logo' )[0].defaultValue ) {
|
803 |
if( 0 !== $( '#logo' ).val().length || $( '#logo' )[0].defaultValue ) {
|
748 |
$( '#preview-logo' ).append(
|
804 |
$( '#preview-logo' ).append(
|
749 |
'<img src="' +
|
805 |
'<img src="' +
|
Line 768... |
Line 824... |
768 |
}
|
824 |
}
|
769 |
});
|
825 |
});
|
770 |
// Affichage de l'image de fond
|
826 |
// Affichage de l'image de fond
|
771 |
$('#image_fond.input-file').change( function ( event ) {
|
827 |
$('#image_fond.input-file').change( function ( event ) {
|
772 |
if( !$.isEmptyObject( event.target.files[0] ) ) {
|
828 |
if( !$.isEmptyObject( event.target.files[0] ) ) {
|
773 |
$( '.widget-renderer' ).css('background' ,'url(' + URL.createObjectURL( event.target.files[0] ) + ') no-repeat center');
|
829 |
$( '.widget-renderer' ).css('background' ,'url(' + URL.createObjectURL( event.target.files[0] ) + ') no-repeat fixed center center');
|
774 |
} else {
|
830 |
} else {
|
775 |
$( '.widget-renderer' )[0].style.removeProperty( 'background' );
|
831 |
$( '.widget-renderer' )[0].style.removeProperty( 'background' );
|
776 |
}
|
832 |
}
|
777 |
});
|
833 |
});
|
778 |
}
|
834 |
}
|
Line 861... |
Line 917... |
861 |
// Élément requis
|
917 |
// Élément requis
|
862 |
if( fieldIsMandatory ) {
|
918 |
if( fieldIsMandatory ) {
|
863 |
// Attribut required pour le listes
|
919 |
// Attribut required pour le listes
|
864 |
commonFieldsHtml.fieldInput.mandatoryAttr = ' required="required"';
|
920 |
commonFieldsHtml.fieldInput.mandatoryAttr = ' required="required"';
|
865 |
// Nom du champ (éléments listes)
|
921 |
// Nom du champ (éléments listes)
|
866 |
listFieldsHtml.containerContent += ' *';
|
922 |
listFieldsHtml.containerContent = '* ' + listFieldsHtml.containerContent;
|
867 |
// Nom du champ (éléments simples)
|
923 |
// Nom du champ (éléments simples)
|
868 |
commonFieldsHtml.fieldLabel.labelContent += ' *';
|
924 |
commonFieldsHtml.fieldLabel.labelContent = '* ' + commonFieldsHtml.fieldLabel.labelContent;
|
869 |
}
|
925 |
}
|
870 |
// Infobulle
|
926 |
// Infobulle
|
871 |
if( '' !== fieldTooltip ) {
|
927 |
if( '' !== fieldTooltip ) {
|
872 |
commonFieldsHtml.titleAttr = ' title="' + fieldTooltip + '"';
|
928 |
commonFieldsHtml.titleAttr = ' title="' + fieldTooltip + '"';
|
873 |
}
|
929 |
}
|
Line 876... |
Line 932... |
876 |
commonFieldsHtml.fieldInput.placeholderAttr = ' placeholder="' + fieldPlaceholder + '"';
|
932 |
commonFieldsHtml.fieldInput.placeholderAttr = ' placeholder="' + fieldPlaceholder + '"';
|
877 |
}
|
933 |
}
|
878 |
// Fichier d'aide
|
934 |
// Fichier d'aide
|
879 |
if( '' !== fieldHelp ) {
|
935 |
if( '' !== fieldHelp ) {
|
880 |
// Bouton 'aide'
|
936 |
// Bouton 'aide'
|
881 |
commonFieldsHtml.helpButton = '<div class="button help-button"><i class="fas fa-info-circle"></i></div>';
|
937 |
commonFieldsHtml.helpButton = '<div class="help-button btn btn-outline-info btn-sm border-0"><i class="fas fa-info-circle"></i></div>';
|
882 |
// classe 'aide'
|
938 |
// classe 'aide'
|
883 |
commonFieldsHtml.helpClass = ' and-help';
|
939 |
commonFieldsHtml.helpClass = ' and-help';
|
884 |
}
|
940 |
}
|
885 |
// html à ajouter en fonction de l'élément choisi
|
941 |
// html à ajouter en fonction de l'élément choisi
|
886 |
switch( fieldElement ) {
|
942 |
switch( fieldElement ) {
|
887 |
case 'checkbox' :
|
943 |
case 'checkbox' :
|
888 |
case 'radio' :
|
944 |
case 'radio' :
|
889 |
listFieldsHtml.containerClass = ' class="' + fieldElement +'"';
|
945 |
listFieldsHtml.containerClass = ' class="' + fieldElement +'"';
|
- |
|
946 |
commonFieldsHtml.fieldLabel.classAttr = ' class="radio-label"';
|
890 |
fieldHtml =
|
947 |
fieldHtml =
|
891 |
// Conteneur
|
948 |
// Conteneur
|
892 |
'<div' +
|
949 |
'<div' +
|
893 |
// Class="L'élément choisi"
|
950 |
// Class="L'élément choisi"
|
894 |
listFieldsHtml.containerClass +
|
951 |
listFieldsHtml.containerClass +
|
Line 899... |
Line 956... |
899 |
// Info bulle
|
956 |
// Info bulle
|
900 |
commonFieldsHtml.titleAttr +
|
957 |
commonFieldsHtml.titleAttr +
|
901 |
' >'+
|
958 |
' >'+
|
902 |
// Nom du champ
|
959 |
// Nom du champ
|
903 |
// Classe 'and-help'
|
960 |
// Classe 'and-help'
|
904 |
'<div class="list-label' + commonFieldsHtml.helpClass + '">' +
|
961 |
'<div class="mt-3 list-label' + commonFieldsHtml.helpClass + '">' +
|
905 |
// Label
|
962 |
// Label
|
906 |
listFieldsHtml.containerContent +
|
963 |
listFieldsHtml.containerContent +
|
907 |
'</div>' +
|
- |
|
908 |
// Bouton 'help'
|
964 |
// Bouton 'help'
|
909 |
commonFieldsHtml.helpButton;
|
965 |
commonFieldsHtml.helpButton +
|
- |
|
966 |
'</div>';
|
910 |
// On déroule les différentes valeurs
|
967 |
// On déroule les différentes valeurs
|
911 |
for( let i = 0; i < count; i++ ) {
|
968 |
for( let i = 0; i < count; i++ ) {
|
912 |
let fieldOption = fieldOptions[i];
|
969 |
let fieldOption = fieldOptions[i];
|
913 |
// L'id de input
|
970 |
// L'id de input
|
914 |
listFieldsHtml.inputIdAttr = ' id="' + fieldOption.optionValue + '"';
|
971 |
listFieldsHtml.inputIdAttr = ' id="' + fieldOption.optionValue + '"';
|
Line 928... |
Line 985... |
928 |
'<label' +
|
985 |
'<label' +
|
929 |
// For
|
986 |
// For
|
930 |
listFieldsHtml.forAttr +
|
987 |
listFieldsHtml.forAttr +
|
931 |
// value-id
|
988 |
// value-id
|
932 |
listFieldsHtml.optionIdAttr +
|
989 |
listFieldsHtml.optionIdAttr +
|
933 |
// Class="nom du champ"
|
990 |
// Class du label
|
934 |
commonFieldsHtml.fieldInput.classAttr +
|
991 |
commonFieldsHtml.fieldLabel.classAttr +
|
935 |
'>' +
|
992 |
'>' +
|
936 |
'<input' +
|
993 |
'<input' +
|
937 |
// Type
|
994 |
// Type
|
938 |
commonFieldsHtml.fieldInput.typeAttr +
|
995 |
commonFieldsHtml.fieldInput.typeAttr +
|
939 |
// Id
|
996 |
// Id
|
Line 958... |
Line 1015... |
958 |
// Si valeur "autre" est cochée
|
1015 |
// Si valeur "autre" est cochée
|
959 |
if( fieldOtherValue ) {
|
1016 |
if( fieldOtherValue ) {
|
960 |
fieldHtml +=
|
1017 |
fieldHtml +=
|
961 |
'<label for="other"' +
|
1018 |
'<label for="other"' +
|
962 |
commonFieldsHtml.dataIdAttr +
|
1019 |
commonFieldsHtml.dataIdAttr +
|
- |
|
1020 |
commonFieldsHtml.fieldLabel.classAttr +
|
963 |
'>' +
|
1021 |
'>' +
|
964 |
'<input' +
|
1022 |
'<input' +
|
965 |
commonFieldsHtml.fieldInput.typeAttr +
|
1023 |
commonFieldsHtml.fieldInput.typeAttr +
|
966 |
' id="other"' +
|
1024 |
' id="other-' + fieldElement + '-' + index + '"' +
|
967 |
commonFieldsHtml.fieldInput.nameAttr +
|
1025 |
commonFieldsHtml.fieldInput.nameAttr +
|
968 |
' value="other"' +
|
1026 |
' value="other"' +
|
969 |
commonFieldsHtml.fieldInput.classAttr +
|
1027 |
commonFieldsHtml.fieldInput.classAttr +
|
970 |
commonFieldsHtml.dataIdAttr +
|
1028 |
commonFieldsHtml.dataIdAttr +
|
971 |
'>' +
|
1029 |
'>' +
|
Line 974... |
Line 1032... |
974 |
// Fin du conteneur
|
1032 |
// Fin du conteneur
|
975 |
fieldHtml += '</div>';
|
1033 |
fieldHtml += '</div>';
|
976 |
break;
|
1034 |
break;
|
Line 977... |
Line 1035... |
977 |
|
1035 |
|
- |
|
1036 |
case 'list-checkbox':
|
978 |
case 'list-checkbox':
|
1037 |
commonFieldsHtml.fieldLabel.classAttr = ' class="radio-label"';
|
979 |
fieldHtml =
|
1038 |
fieldHtml =
|
980 |
// Classe 'and-help'
|
1039 |
// Classe 'and-help'
|
981 |
'<div class="multiselect ' + fieldElement + commonFieldsHtml.helpClass + '"' +
|
1040 |
'<div class="multiselect add-field-select' + commonFieldsHtml.helpClass + '"' +
|
982 |
// DataId
|
1041 |
// DataId
|
983 |
commonFieldsHtml.dataIdAttr +
|
1042 |
commonFieldsHtml.dataIdAttr +
|
984 |
'>' +
|
1043 |
'>' +
|
985 |
'<label>' +
|
1044 |
'<label>' +
|
986 |
// Nom du champ
|
1045 |
// Nom du champ
|
- |
|
1046 |
listFieldsHtml.containerContent +
|
- |
|
1047 |
// Bouton 'help'
|
987 |
listFieldsHtml.containerContent +
|
1048 |
commonFieldsHtml.helpButton +
|
988 |
'</label>' +
|
1049 |
'</label>' +
|
989 |
'<div class="selectBox"' +
|
- |
|
990 |
// DataId
|
- |
|
991 |
commonFieldsHtml.dataIdAttr +
|
- |
|
992 |
'>' +
|
1050 |
'<div class="mt-3">'+
|
993 |
'<select' +
|
1051 |
'<div class="selectBox"' +
|
994 |
// DataId
|
1052 |
// DataId
|
995 |
commonFieldsHtml.dataIdAttr +
|
- |
|
996 |
// Required
|
- |
|
997 |
commonFieldsHtml.fieldInput.mandatoryAttr +
|
- |
|
998 |
// Info bulle
|
- |
|
999 |
commonFieldsHtml.titleAttr +
|
1053 |
commonFieldsHtml.dataIdAttr +
|
- |
|
1054 |
'>' +
|
- |
|
1055 |
'<select' +
|
- |
|
1056 |
// DataId
|
- |
|
1057 |
commonFieldsHtml.dataIdAttr +
|
- |
|
1058 |
// Required
|
- |
|
1059 |
commonFieldsHtml.fieldInput.mandatoryAttr +
|
- |
|
1060 |
// Info bulle
|
- |
|
1061 |
commonFieldsHtml.titleAttr +
|
- |
|
1062 |
// Class
|
- |
|
1063 |
' class="form-control ' + fieldElement + '"' +
|
1000 |
'>' +
|
1064 |
'>' +
|
1001 |
// Apparait dans la barre de sélection
|
1065 |
// Apparait dans la barre de sélection
|
1002 |
'<option>Plusieurs choix possibles</option>' +
|
1066 |
'<option>Plusieurs choix possibles</option>' +
|
1003 |
'</select>' +
|
1067 |
'</select>' +
|
1004 |
'<div class="overSelect"></div>' +
|
1068 |
'<div class="overSelect"></div>' +
|
1005 |
'</div>' +
|
1069 |
'</div>' +
|
1006 |
'<div class="checkboxes hidden"' +
|
1070 |
'<div class="checkboxes hidden"' +
|
1007 |
// DataId
|
1071 |
// DataId
|
1008 |
commonFieldsHtml.dataIdAttr +
|
1072 |
commonFieldsHtml.dataIdAttr +
|
1009 |
'>';
|
1073 |
'>';
|
1010 |
// On déroule les différentes valeurs
|
1074 |
// On déroule les différentes valeurs
|
1011 |
for( let i = 0; i < count; i++ ) {
|
1075 |
for( let i = 0; i < count; i++ ) {
|
1012 |
let fieldOption = fieldOptions[i];
|
1076 |
let fieldOption = fieldOptions[i];
|
1013 |
// Type="checkbox"
|
1077 |
// Type="checkbox"
|
Line 1030... |
Line 1094... |
1030 |
'<label' +
|
1094 |
'<label' +
|
1031 |
// For
|
1095 |
// For
|
1032 |
listFieldsHtml.forAttr +
|
1096 |
listFieldsHtml.forAttr +
|
1033 |
// value-id
|
1097 |
// value-id
|
1034 |
listFieldsHtml.optionIdAttr +
|
1098 |
listFieldsHtml.optionIdAttr +
|
- |
|
1099 |
// Class du label
|
- |
|
1100 |
commonFieldsHtml.fieldLabel.classAttr+
|
1035 |
'>' +
|
1101 |
'>' +
|
1036 |
'<input type="checkbox"' +
|
1102 |
'<input type="checkbox"' +
|
1037 |
// Id
|
1103 |
// Id
|
1038 |
listFieldsHtml.inputIdAttr +
|
1104 |
listFieldsHtml.inputIdAttr +
|
1039 |
// value-id
|
1105 |
// value-id
|
Line 1059... |
Line 1125... |
1059 |
'<label for="other"' +
|
1125 |
'<label for="other"' +
|
1060 |
// DataId
|
1126 |
// DataId
|
1061 |
commonFieldsHtml.dataIdAttr +
|
1127 |
commonFieldsHtml.dataIdAttr +
|
1062 |
'>' +
|
1128 |
'>' +
|
1063 |
'<input type="checkbox"' +
|
1129 |
'<input type="checkbox"' +
|
1064 |
' id="other"' +
|
1130 |
' id="other-' + fieldElement + '-' + index + '"' +
|
1065 |
commonFieldsHtml.fieldInput.nameAttr +
|
1131 |
commonFieldsHtml.fieldInput.nameAttr +
|
1066 |
' value="other"' +
|
1132 |
' value="other"' +
|
1067 |
commonFieldsHtml.fieldInput.classAttr +
|
1133 |
commonFieldsHtml.fieldInput.classAttr +
|
1068 |
// DataId
|
1134 |
// DataId
|
1069 |
commonFieldsHtml.dataIdAttr +
|
1135 |
commonFieldsHtml.dataIdAttr +
|
1070 |
'>' +
|
1136 |
'>' +
|
1071 |
'Autre</label>';
|
1137 |
'Autre</label>';
|
1072 |
}
|
1138 |
}
|
1073 |
// Fermeture des conteneurs .multiselect .checkboxes
|
1139 |
// Fermeture des conteneurs .multiselect .checkboxes
|
1074 |
fieldHtml +=
|
1140 |
fieldHtml +=
|
1075 |
'</div>'+
|
1141 |
'</div>'+
|
1076 |
'</div>' +
|
1142 |
'</div>'+
|
1077 |
// Bouton 'help'
|
1143 |
'</div>';
|
1078 |
commonFieldsHtml.helpButton;
|
- |
|
1079 |
break;
|
1144 |
break;
|
Line 1080... |
Line 1145... |
1080 |
|
1145 |
|
- |
|
1146 |
case 'select':
|
- |
|
1147 |
commonFieldsHtml.fieldInput.classAttr = commonFieldsHtml.fieldInput.classAttr.slice(0, -1);
|
1081 |
case 'select':
|
1148 |
commonFieldsHtml.fieldInput.classAttr += ' form-control"';
|
1082 |
fieldHtml =
|
- |
|
1083 |
'<label' +
|
- |
|
1084 |
commonFieldsHtml.fieldLabel.forAttr +
|
- |
|
1085 |
// Info bulle
|
- |
|
1086 |
commonFieldsHtml.titleAttr +
|
- |
|
1087 |
'>' +
|
- |
|
1088 |
// Nom du champ
|
- |
|
1089 |
listFieldsHtml.containerContent +
|
- |
|
1090 |
'</label>' +
|
1149 |
fieldHtml =
|
1091 |
// Conteneur/Wrapper
|
1150 |
// Conteneur/Wrapper
|
1092 |
// +Classe 'and-help'
|
1151 |
// +Classe 'and-help'
|
1093 |
'<div class="select-wrapper add-field-select ' + fieldElement + commonFieldsHtml.helpClass + '"' +
|
1152 |
'<div class="add-field-select ' + fieldElement + commonFieldsHtml.helpClass + '"' +
|
1094 |
// DataID
|
1153 |
// DataID
|
1095 |
commonFieldsHtml.dataIdAttr +
|
1154 |
commonFieldsHtml.dataIdAttr +
|
- |
|
1155 |
'>' +
|
- |
|
1156 |
'<label class="mt-3"' +
|
- |
|
1157 |
commonFieldsHtml.fieldLabel.forAttr +
|
- |
|
1158 |
// Info bulle
|
- |
|
1159 |
commonFieldsHtml.titleAttr +
|
- |
|
1160 |
'>' +
|
- |
|
1161 |
// Nom du champ
|
- |
|
1162 |
listFieldsHtml.containerContent +
|
- |
|
1163 |
// Bouton 'help'
|
- |
|
1164 |
commonFieldsHtml.helpButton +
|
1096 |
'>' +
|
1165 |
'</label>' +
|
1097 |
'<select' +
|
1166 |
'<select' +
|
1098 |
commonFieldsHtml.fieldInput.nameAttr +
|
1167 |
commonFieldsHtml.fieldInput.nameAttr +
|
1099 |
' id="' + fieldKey + '"' +
|
1168 |
' id="' + fieldKey + '"' +
|
1100 |
// Class
|
1169 |
// Class
|
Line 1140... |
Line 1209... |
1140 |
}
|
1209 |
}
|
1141 |
// Fermeture des conteneurs
|
1210 |
// Fermeture des conteneurs
|
1142 |
fieldHtml +=
|
1211 |
fieldHtml +=
|
1143 |
'</select>' +
|
1212 |
'</select>' +
|
1144 |
// Fin du conteneur/wrapper
|
1213 |
// Fin du conteneur/wrapper
|
1145 |
'</div>' +
|
1214 |
'</div>';
|
1146 |
// Bouton 'help'
|
- |
|
1147 |
commonFieldsHtml.helpButton;
|
- |
|
1148 |
break;
|
1215 |
break;
|
Line 1149... |
Line 1216... |
1149 |
|
1216 |
|
- |
|
1217 |
case 'textarea':
|
- |
|
1218 |
// Ouvrir l'attribut class (suppression de '"')
|
- |
|
1219 |
commonFieldsHtml.fieldInput.classAttr = commonFieldsHtml.fieldInput.classAttr.slice(0, -1);
|
- |
|
1220 |
// Classe 'custom-range'
|
1150 |
case 'textarea':
|
1221 |
commonFieldsHtml.fieldInput.classAttr += ' form-control"';
|
1151 |
// Classe 'and-help'
|
1222 |
// Classe 'and-help'
|
1152 |
commonFieldsHtml.fieldLabel.classAttr = ' class="' + commonFieldsHtml.helpClass + '"';
|
1223 |
commonFieldsHtml.fieldLabel.classAttr = ' class="mt-3 ' + commonFieldsHtml.helpClass + '"';
|
1153 |
// Autres attributs
|
1224 |
// Autres attributs
|
Line 1154... |
Line 1225... |
1154 |
commonFieldsHtml.fieldInput.otherAttr += ' id="' + fieldKey + '"';
|
1225 |
commonFieldsHtml.fieldInput.otherAttr += ' id="' + fieldKey + '"';
|
1155 |
|
1226 |
|
Line 1164... |
Line 1235... |
1164 |
// Autres attributs
|
1235 |
// Autres attributs
|
1165 |
commonFieldsHtml.fieldLabel.otherAttr +
|
1236 |
commonFieldsHtml.fieldLabel.otherAttr +
|
1166 |
'>' +
|
1237 |
'>' +
|
1167 |
// Nom du champ
|
1238 |
// Nom du champ
|
1168 |
commonFieldsHtml.fieldLabel.labelContent +
|
1239 |
commonFieldsHtml.fieldLabel.labelContent +
|
- |
|
1240 |
// Bouton 'help'
|
- |
|
1241 |
commonFieldsHtml.helpButton +
|
1169 |
'</label>' +
|
1242 |
'</label>' +
|
1170 |
// Bouton 'help'
|
- |
|
1171 |
commonFieldsHtml.helpButton +
|
- |
|
1172 |
'<textarea' +
|
1243 |
'<textarea' +
|
1173 |
// Name
|
1244 |
// Name
|
1174 |
commonFieldsHtml.fieldInput.nameAttr +
|
1245 |
commonFieldsHtml.fieldInput.nameAttr +
|
1175 |
// DataId
|
1246 |
// DataId
|
1176 |
commonFieldsHtml.dataIdAttr +
|
1247 |
commonFieldsHtml.dataIdAttr +
|
Line 1186... |
Line 1257... |
1186 |
commonFieldsHtml.fieldInput.otherAttr +
|
1257 |
commonFieldsHtml.fieldInput.otherAttr +
|
1187 |
'></textarea>';
|
1258 |
'></textarea>';
|
1188 |
break;
|
1259 |
break;
|
Line 1189... |
Line 1260... |
1189 |
|
1260 |
|
- |
|
1261 |
case 'range':
|
- |
|
1262 |
// Ouvrir l'attribut class (suppression de '"')
|
- |
|
1263 |
commonFieldsHtml.fieldInput.classAttr = commonFieldsHtml.fieldInput.classAttr.slice(0, -1);
|
- |
|
1264 |
// Classe 'custom-range'
|
1190 |
case 'range':
|
1265 |
commonFieldsHtml.fieldInput.classAttr += ' custom-range form-control pl-3"';
|
1191 |
// Classe 'and-help'
|
1266 |
// Classe 'and-help'
|
1192 |
commonFieldsHtml.fieldLabel.classAttr = ' class="' + commonFieldsHtml.helpClass + '"';
|
1267 |
commonFieldsHtml.fieldLabel.classAttr = ' class="mt-3 ' + commonFieldsHtml.helpClass + '"';
|
1193 |
// Step
|
1268 |
// Step
|
1194 |
if( '' !== fieldStep ) {
|
1269 |
if( '' !== fieldStep ) {
|
1195 |
commonFieldsHtml.fieldInput.otherAttr += ' step="' + fieldStep + '"';
|
1270 |
commonFieldsHtml.fieldInput.otherAttr += ' step="' + fieldStep + '"';
|
1196 |
}
|
1271 |
}
|
Line 1200... |
Line 1275... |
1200 |
}
|
1275 |
}
|
1201 |
//Max
|
1276 |
//Max
|
1202 |
if( '' !== fieldMax ) {
|
1277 |
if( '' !== fieldMax ) {
|
1203 |
commonFieldsHtml.fieldInput.otherAttr += ' max="' + fieldMax + '"';
|
1278 |
commonFieldsHtml.fieldInput.otherAttr += ' max="' + fieldMax + '"';
|
1204 |
}
|
1279 |
}
|
1205 |
|
- |
|
1206 |
fieldHtml =
|
1280 |
fieldHtml =
|
1207 |
'<div' +
|
1281 |
'<div' +
|
1208 |
' class="range"' +
|
1282 |
' class="range"' +
|
1209 |
' id="' + fieldKey + '"' +
|
1283 |
' id="' + fieldKey + '"' +
|
1210 |
'>' +
|
1284 |
'>' +
|
Line 1218... |
Line 1292... |
1218 |
// Autres attributs
|
1292 |
// Autres attributs
|
1219 |
commonFieldsHtml.fieldLabel.otherAttr +
|
1293 |
commonFieldsHtml.fieldLabel.otherAttr +
|
1220 |
'>' +
|
1294 |
'>' +
|
1221 |
// Nom du champ
|
1295 |
// Nom du champ
|
1222 |
commonFieldsHtml.fieldLabel.labelContent +
|
1296 |
commonFieldsHtml.fieldLabel.labelContent +
|
- |
|
1297 |
// Bouton 'help'
|
- |
|
1298 |
commonFieldsHtml.helpButton +
|
1223 |
'</label>' +
|
1299 |
'</label>' +
|
- |
|
1300 |
'<div class="col-sm-12 row" style="max-width=100%">' +
|
1224 |
// Bouton 'help'
|
1301 |
// Visualiser min max et la valeur de range
|
1225 |
commonFieldsHtml.helpButton +
|
1302 |
'<p class="col-sm-2 range-values text-center font-weight-bold">'+
|
1226 |
'<input' +
|
1303 |
'Min ' + fieldMin +
|
1227 |
// Type
|
1304 |
'</p>'+
|
- |
|
1305 |
'<div class="range-live-value range-values text-center font-weight-bold col-sm-7">'+
|
1228 |
commonFieldsHtml.fieldInput.typeAttr +
|
1306 |
fieldDefaultNum +
|
1229 |
// Name
|
1307 |
'</div>'+
|
1230 |
commonFieldsHtml.fieldInput.nameAttr +
|
1308 |
'<p class="col-sm-2 range-values text-center font-weight-bold">'+
|
1231 |
// DataId
|
- |
|
1232 |
commonFieldsHtml.dataIdAttr +
|
1309 |
'Max ' + fieldMax +
|
1233 |
// Class
|
1310 |
'</p>' +
|
- |
|
1311 |
|
1234 |
commonFieldsHtml.fieldInput.classAttr +
|
1312 |
'<input' +
|
1235 |
// Info-bulle
|
1313 |
// Type
|
1236 |
commonFieldsHtml.titleAttr +
|
1314 |
commonFieldsHtml.fieldInput.typeAttr +
|
1237 |
// Required
|
1315 |
// Name
|
1238 |
commonFieldsHtml.fieldInput.mandatoryAttr +
|
1316 |
commonFieldsHtml.fieldInput.nameAttr +
|
1239 |
// Default
|
1317 |
// DataId
|
1240 |
' value="' + fieldDefaultNum + '"' +
|
1318 |
commonFieldsHtml.dataIdAttr +
|
1241 |
// Autres attributs
|
1319 |
// Class
|
1242 |
commonFieldsHtml.fieldInput.otherAttr +
|
1320 |
commonFieldsHtml.fieldInput.classAttr +
|
1243 |
'>' +
|
- |
|
1244 |
'<input' +
|
- |
|
1245 |
' type="number"' +
|
1321 |
// Info-bulle
|
1246 |
' name="' + fieldKey + 'Output"' +
|
1322 |
commonFieldsHtml.titleAttr +
|
1247 |
// Info-bulle
|
1323 |
// Required
|
1248 |
commonFieldsHtml.titleAttr +
|
1324 |
commonFieldsHtml.fieldInput.mandatoryAttr +
|
1249 |
// Placeholder
|
1325 |
// Default
|
1250 |
commonFieldsHtml.fieldInput.placeholderAttr +
|
- |
|
1251 |
' value="' + fieldDefaultNum + '"' +
|
1326 |
' value="' + fieldDefaultNum + '"' +
|
1252 |
// Autres attributs
|
1327 |
// Autres attributs
|
1253 |
commonFieldsHtml.fieldInput.otherAttr +
|
1328 |
commonFieldsHtml.fieldInput.otherAttr +
|
1254 |
// DataId
|
1329 |
'>' +
|
1255 |
commonFieldsHtml.dataIdAttr +
|
- |
|
1256 |
'>' +
|
1330 |
'</div>'
|
1257 |
'</div>';
|
1331 |
'</div>';
|
1258 |
break;
|
1332 |
break;
|
Line 1259... |
Line 1333... |
1259 |
|
1333 |
|
1260 |
case 'number':
|
1334 |
case 'number':
|
Line 1264... |
Line 1338... |
1264 |
}
|
1338 |
}
|
1265 |
case 'date':
|
1339 |
case 'date':
|
1266 |
// Ouvrir l'attribut class (suppression de '"')
|
1340 |
// Ouvrir l'attribut class (suppression de '"')
|
1267 |
commonFieldsHtml.fieldInput.classAttr = commonFieldsHtml.fieldInput.classAttr.slice(0, -1);
|
1341 |
commonFieldsHtml.fieldInput.classAttr = commonFieldsHtml.fieldInput.classAttr.slice(0, -1);
|
1268 |
// Classe 'and-help'
|
1342 |
// Classe 'and-help'
|
1269 |
commonFieldsHtml.fieldInput.classAttr += commonFieldsHtml.helpClass + '"';
|
1343 |
commonFieldsHtml.fieldInput.classAttr += commonFieldsHtml.helpClass + ' form-control"';
|
1270 |
// Min
|
1344 |
// Min
|
1271 |
if( '' !== fieldMin ) {
|
1345 |
if( '' !== fieldMin ) {
|
1272 |
commonFieldsHtml.fieldInput.otherAttr += ' min="' + fieldMin + '"';
|
1346 |
commonFieldsHtml.fieldInput.otherAttr += ' min="' + fieldMin + '"';
|
1273 |
}
|
1347 |
}
|
1274 |
// Max
|
1348 |
// Max
|
1275 |
if( '' !== fieldMax ) {
|
1349 |
if( '' !== fieldMax ) {
|
1276 |
commonFieldsHtml.fieldInput.otherAttr += ' max="' + fieldMax + '"';
|
1350 |
commonFieldsHtml.fieldInput.otherAttr += ' max="' + fieldMax + '"';
|
1277 |
}
|
1351 |
}
|
- |
|
1352 |
// Class du label
|
- |
|
1353 |
commonFieldsHtml.fieldLabel.classAttr = 'class="mt-3"';
|
1278 |
fieldHtml =
|
1354 |
fieldHtml =
|
1279 |
'<div class="number">' +
|
1355 |
'<div class="number">' +
|
1280 |
'<label' +
|
1356 |
'<label' +
|
1281 |
// For
|
1357 |
// For
|
1282 |
commonFieldsHtml.fieldLabel.forAttr +
|
1358 |
commonFieldsHtml.fieldLabel.forAttr +
|
Line 1287... |
Line 1363... |
1287 |
// Autres attributs
|
1363 |
// Autres attributs
|
1288 |
commonFieldsHtml.fieldLabel.otherAttr +
|
1364 |
commonFieldsHtml.fieldLabel.otherAttr +
|
1289 |
'>' +
|
1365 |
'>' +
|
1290 |
// Nom du champ
|
1366 |
// Nom du champ
|
1291 |
commonFieldsHtml.fieldLabel.labelContent +
|
1367 |
commonFieldsHtml.fieldLabel.labelContent +
|
- |
|
1368 |
// Bouton 'help'
|
- |
|
1369 |
commonFieldsHtml.helpButton +
|
1292 |
'</label>' +
|
1370 |
'</label>' +
|
1293 |
'<input' +
|
1371 |
'<input' +
|
1294 |
// Type
|
1372 |
// Type
|
1295 |
commonFieldsHtml.fieldInput.typeAttr +
|
1373 |
commonFieldsHtml.fieldInput.typeAttr +
|
1296 |
// Name
|
1374 |
// Name
|
Line 1308... |
Line 1386... |
1308 |
// Default
|
1386 |
// Default
|
1309 |
' value="' + fieldDefaultNum + '"' +
|
1387 |
' value="' + fieldDefaultNum + '"' +
|
1310 |
// Autres attributs
|
1388 |
// Autres attributs
|
1311 |
commonFieldsHtml.fieldInput.otherAttr +
|
1389 |
commonFieldsHtml.fieldInput.otherAttr +
|
1312 |
'>' +
|
1390 |
'>' +
|
1313 |
// Bouton 'help'
|
- |
|
1314 |
commonFieldsHtml.helpButton +
|
- |
|
1315 |
'</div>';
|
1391 |
'</div>';
|
1316 |
break;
|
1392 |
break;
|
Line 1317... |
Line 1393... |
1317 |
|
1393 |
|
1318 |
case 'text' :
|
1394 |
case 'text' :
|
1319 |
case 'email':
|
1395 |
case 'email':
|
1320 |
default:
|
1396 |
default:
|
1321 |
// Ouvrir l'attribut class (suppression de '"')
|
1397 |
// Ouvrir l'attribut class (suppression de '"')
|
1322 |
commonFieldsHtml.fieldInput.classAttr = commonFieldsHtml.fieldInput.classAttr.slice(0, -1);
|
1398 |
commonFieldsHtml.fieldInput.classAttr = commonFieldsHtml.fieldInput.classAttr.slice(0, -1);
|
1323 |
// Classe 'and-help'
|
1399 |
// Classe 'and-help'
|
- |
|
1400 |
commonFieldsHtml.fieldInput.classAttr += commonFieldsHtml.helpClass + ' form-control"';
|
- |
|
1401 |
// Class du label
|
Line 1324... |
Line 1402... |
1324 |
commonFieldsHtml.fieldInput.classAttr += commonFieldsHtml.helpClass + '"';
|
1402 |
commonFieldsHtml.fieldLabel.classAttr = 'class="mt-3"';
|
1325 |
|
1403 |
|
1326 |
fieldHtml =
|
1404 |
fieldHtml =
|
1327 |
'<label' +
|
1405 |
'<label' +
|
Line 1334... |
Line 1412... |
1334 |
// Autres attributs
|
1412 |
// Autres attributs
|
1335 |
commonFieldsHtml.fieldLabel.otherAttr +
|
1413 |
commonFieldsHtml.fieldLabel.otherAttr +
|
1336 |
'>' +
|
1414 |
'>' +
|
1337 |
// Nom du champ
|
1415 |
// Nom du champ
|
1338 |
commonFieldsHtml.fieldLabel.labelContent +
|
1416 |
commonFieldsHtml.fieldLabel.labelContent +
|
- |
|
1417 |
// Bouton 'help'
|
- |
|
1418 |
commonFieldsHtml.helpButton +
|
1339 |
'</label>' +
|
1419 |
'</label>' +
|
1340 |
'<input' +
|
1420 |
'<input' +
|
1341 |
// Type
|
1421 |
// Type
|
1342 |
commonFieldsHtml.fieldInput.typeAttr +
|
1422 |
commonFieldsHtml.fieldInput.typeAttr +
|
1343 |
// Name
|
1423 |
// Name
|
Line 1352... |
Line 1432... |
1352 |
commonFieldsHtml.fieldInput.placeholderAttr +
|
1432 |
commonFieldsHtml.fieldInput.placeholderAttr +
|
1353 |
// Required
|
1433 |
// Required
|
1354 |
commonFieldsHtml.fieldInput.mandatoryAttr +
|
1434 |
commonFieldsHtml.fieldInput.mandatoryAttr +
|
1355 |
// Autres attributs
|
1435 |
// Autres attributs
|
1356 |
commonFieldsHtml.fieldInput.otherAttr +
|
1436 |
commonFieldsHtml.fieldInput.otherAttr +
|
1357 |
'>' +
|
1437 |
'>';
|
1358 |
// Bouton 'help'
|
- |
|
1359 |
commonFieldsHtml.helpButton;
|
- |
|
1360 |
break;
|
1438 |
break;
|
1361 |
}
|
1439 |
}
|
1362 |
return fieldHtml;
|
1440 |
return fieldHtml;
|
1363 |
}
|
1441 |
}
|
Line 1384... |
Line 1462... |
1384 |
|
1462 |
|
1385 |
// Faire apparaitre un champ text "Autre"
|
1463 |
// Faire apparaitre un champ text "Autre"
|
1386 |
function onOtherOption( thisFieldset , index ) {
|
1464 |
function onOtherOption( thisFieldset , index ) {
|
1387 |
// Ce champ (dans la prévisualisation)
|
1465 |
// Ce champ (dans la prévisualisation)
|
1388 |
var thisPreviewFieldset = $( '.preview-fields[data-id="' + index + '"]'),
|
1466 |
var thisPreviewFieldset = $( '.preview-fields[data-id="' + index + '"]'),
|
1389 |
//L'élément choisi
|
1467 |
// L'élément choisi
|
1390 |
element = $('.field-element' , thisFieldset ).val(),
|
1468 |
element = $('.field-element' , thisFieldset ).val(),
|
1391 |
// Où insérer le champ "Autre"
|
1469 |
// Où insérer le champ "Autre"
|
1392 |
$element = $( '.' + element , thisPreviewFieldset ),
|
1470 |
$element = $( '.' + element , thisPreviewFieldset ),
|
1393 |
// html du champ "Autre"
|
1471 |
// html du champ "Autre"
|
- |
|
1472 |
collectOther =
|
1394 |
collectOther =
|
1473 |
'<div class="col-sm-12 mt-1 collect-other-block">'+
|
1395 |
'<label data-id="' + index + '" for="collect-other">Autre option :</label>' +
|
1474 |
'<label data-id="' + index + '" for="collect-other" style="font-weight:300">Autre option :</label>' +
|
- |
|
1475 |
'<input type="text" name="collect-other" data-id="' + index + '" class="collect-other form-control" >'+
|
1396 |
'<input type="text" name="collect-other" data-id="' + index + '" class="collect-other" >';
|
1476 |
'</div>';
|
1397 |
// Pouvoir supprimer le champ "Autre"
|
1477 |
// Pouvoir supprimer le champ "Autre"
|
1398 |
function optionRemove( thisPreviewFieldset ) {
|
- |
|
1399 |
$( 'label[for="collect-other"]' , thisPreviewFieldset ).remove();
|
1478 |
function optionRemove( thisPreviewFieldset ) {
|
1400 |
$( 'input.collect-other' , thisPreviewFieldset ).remove();
|
1479 |
$( '.collect-other-block' , thisPreviewFieldset ).remove();
|
Line 1401... |
Line 1480... |
1401 |
}
|
1480 |
}
|
1402 |
|
1481 |
|
1403 |
switch( element ) {
|
1482 |
switch( element ) {
|
Line 1425... |
Line 1504... |
1425 |
optionRemove( thisPreviewFieldset );
|
1504 |
optionRemove( thisPreviewFieldset );
|
1426 |
}
|
1505 |
}
|
1427 |
});
|
1506 |
});
|
1428 |
break;
|
1507 |
break;
|
Line 1429... |
Line -... |
1429 |
|
- |
|
1430 |
case 'checkbox' :
|
1508 |
|
1431 |
case 'list-checkbox' :
|
1509 |
case 'list-checkbox' :
|
1432 |
// Lorsque "Autre" est coché
|
1510 |
// Lorsque "Autre" est coché
|
- |
|
1511 |
$( 'input#other-' + element + '-' + index, thisPreviewFieldset ).on( 'click' , function () {
|
- |
|
1512 |
// Insertion du champ "Autre" après les boutons
|
- |
|
1513 |
if( $( this ).is( ':checked' ) ) {
|
- |
|
1514 |
$( '.checkboxes', thisPreviewFieldset ).append( collectOther );
|
- |
|
1515 |
} else {
|
- |
|
1516 |
// Suppression du champ autre
|
- |
|
1517 |
optionRemove( thisPreviewFieldset );
|
- |
|
1518 |
}
|
- |
|
1519 |
});
|
- |
|
1520 |
break;
|
- |
|
1521 |
case 'checkbox' :
|
- |
|
1522 |
// Lorsque "Autre" est coché
|
1433 |
$( 'input#other' , thisPreviewFieldset ).on( 'click' , function () {
|
1523 |
$( 'input#other-' + element + '-' + index, thisPreviewFieldset ).on( 'click' , function () {
|
1434 |
// Insertion du champ "Autre" après les boutons
|
1524 |
// Insertion du champ "Autre" après les boutons
|
1435 |
if( $( this ).is( ':checked' ) ) {
|
1525 |
if( $( this ).is( ':checked' ) ) {
|
1436 |
$element.after( collectOther );
|
1526 |
$element.after( collectOther );
|
1437 |
} else {
|
1527 |
} else {
|
Line 1467... |
Line 1557... |
1467 |
var thisFieldset = $( 'fieldset[data-id="' + index + '"]');
|
1557 |
var thisFieldset = $( 'fieldset[data-id="' + index + '"]');
|
1468 |
// Certains indices peuvent correspondre à un champ supprimé
|
1558 |
// Certains indices peuvent correspondre à un champ supprimé
|
1469 |
if( 0 < $( thisFieldset ).length ) {
|
1559 |
if( 0 < $( thisFieldset ).length ) {
|
1470 |
// Prévisualisation d'un champ
|
1560 |
// Prévisualisation d'un champ
|
1471 |
$( '#zone-supp .preview-container' ).append(
|
1561 |
$( '#zone-supp .preview-container' ).append(
|
1472 |
'<div class="preview-fields" data-id="' + index + '">'+
|
1562 |
'<div class="preview-fields col-sm-12 row" data-id="' + index + '">'+
|
1473 |
onClickPreviewField( thisFieldset , index ) +
|
1563 |
onClickPreviewField( thisFieldset , index ) +
|
1474 |
'</div>'
|
1564 |
'</div>'
|
1475 |
);
|
1565 |
);
|
1476 |
// Ajout/suppression d'un champ texte "Autre"
|
1566 |
// Ajout/suppression d'un champ texte "Autre"
|
1477 |
if( $( '.option-other-value' , thisFieldset ).is( ':checked' ) ) {
|
1567 |
if( $( '.option-other-value' , thisFieldset ).is( ':checked' ) ) {
|
Line 1500... |
Line 1590... |
1500 |
$( '#print_content' ).append( '<p>Erreur : le fichier n\'est pas une image</p>' );
|
1590 |
$( '#print_content' ).append( '<p>Erreur : le fichier n\'est pas une image</p>' );
|
1501 |
}
|
1591 |
}
|
1502 |
// Sortie avec la touche escape
|
1592 |
// Sortie avec la touche escape
|
1503 |
$( '#help-modal' ).modal( { keyboard : true } );
|
1593 |
$( '#help-modal' ).modal( { keyboard : true } );
|
1504 |
// Affichage
|
1594 |
// Affichage
|
1505 |
$( '#help-modal' ).modal( 'show' );
|
1595 |
$( '#help-modal' ).modal({ show: true });
|
1506 |
// Remplacer l'autofocus qui ne fonctionne plus en HTML5
|
1596 |
// Remplacer l'autofocus qui ne fonctionne plus en HTML5
|
1507 |
// Message dans la doc de bootstrap :
|
1597 |
// Message dans la doc de bootstrap :
|
1508 |
// Due to how HTML5 defines its semantics,
|
1598 |
// Due to how HTML5 defines its semantics,
|
1509 |
// the autofocus HTML attribute has no effect in Bootstrap modals.
|
1599 |
// the autofocus HTML attribute has no effect in Bootstrap modals.
|
1510 |
// To achieve the same effect, use some custom JavaScript
|
1600 |
// To achieve the same effect, use some custom JavaScript
|
Line 1527... |
Line 1617... |
1527 |
var datasToSubmit = new Array();
|
1617 |
var datasToSubmit = new Array();
|
1528 |
// Variable permettant un seul affichage du titre
|
1618 |
// Variable permettant un seul affichage du titre
|
1529 |
// de la prévisualisation pour les nouveaux champs
|
1619 |
// de la prévisualisation pour les nouveaux champs
|
1530 |
var firstClick = true;
|
1620 |
var firstClick = true;
|
Line -... |
Line 1621... |
- |
|
1621 |
|
- |
|
1622 |
// Positionnement de la prévisualisation
|
- |
|
1623 |
$( window ).ready( function() {
|
- |
|
1624 |
});
|
1531 |
|
1625 |
|
- |
|
1626 |
jQuery( document ).ready( function() {
|
- |
|
1627 |
// reset de tous les formulaires
|
- |
|
1628 |
$( 'form' ).each( function() {
|
- |
|
1629 |
$( this )[0].reset();
|
1532 |
jQuery( document ).ready( function() {
|
1630 |
});
|
1533 |
// Identifiant de champ
|
1631 |
// Identifiant de champ
|
1534 |
var fieldIndex = 0;
|
1632 |
var fieldIndex = 0;
|
1535 |
// Ajout de nouveaux champs
|
1633 |
// Ajout de nouveaux champs
|
1536 |
onClickAddNewFields( fieldIndex );
|
1634 |
onClickAddNewFields( fieldIndex );
|