Commit 6c251d72 authored by Alexandre Goldstein's avatar Alexandre Goldstein
Browse files

feat/16380: indent + syntax

parent ee4c146c
Pipeline #12496 failed with stages
in 43 seconds
......@@ -266,7 +266,7 @@ FulltextSearchForm = {
var text = this.form.find('[name="searchForm_inputSearch"]').val().trim();
if (text) {
query.text = text
query.text = text;
}
var profileReference = $('#profileSelection').data('profileReference');
......@@ -338,6 +338,7 @@ FulltextSearchForm = {
break;
} else if ($(this).hasClass('dateTimePicker')) {
var operation = ($(this).data('range') == 'start') ? ">=" : "<=";
// TODO fix datetime sent in params with a date conversion (done @rm/archives/search.html)
value = name + operation + "'" + $(this).data('DateTimePicker').date().format('YYYY-MM-DD HH:MM:SS') + "'";
// Fill start and end values
......@@ -432,4 +433,9 @@ FulltextSearchForm = {
$('#fullTextSearchForm').onEvent("setSearchBarClass.recordsManagement", function(e, newClass) {
$('#fullTextSearchForm').addClass(newClass);
});
function convertDate(data) {
var stringSplitted = data.split('-');
return stringSplitted[2] + '-' + stringSplitted[1] + '-' + stringSplitted[0];
};
</script>
......@@ -190,7 +190,7 @@
var helperText = $("#helperSelect :selected").text();
var helperName = helper.attr("helperName");
var helperType = helper.attr('type');
var formatDateTime = helper.attr('format');
var helperFormat = helper.attr('format');
if (helperText) {
var row = $('<li/>').addClass('helper').appendTo($("#helperList"));
......@@ -203,8 +203,8 @@
.prev()
.remove();
if (formatDateTime === "datetime") {
helperType = formatDateTime;
if (helperFormat === "datetime") {
helperType = helperFormat;
}
switch (helperType) {
......@@ -221,187 +221,187 @@
.remove();
break;
case 'text':
case 'string':
var helperInput = $('<li/>').addClass("helperContent col-sm-8 padding-5").appendTo(row);
$('#helperValueMin')
.clone()
.attr('placeholder','Valeur')
.attr('id', generateUniqIdentifier())
.attr('type','text')
.attr('name', helperName)
.appendTo(helperInput)
.prev()
.remove();
break;
case 'text':
case 'string':
var helperInput = $('<li/>').addClass("helperContent col-sm-8 padding-5").appendTo(row);
$('#helperValueMin')
.clone()
.attr('placeholder','Valeur')
.attr('id', generateUniqIdentifier())
.attr('type','text')
.attr('name', helperName)
.appendTo(helperInput)
.prev()
.remove();
break;
// 1-dropdown if enumeration, 2-typeahead if external Ref, 3-simple text, 4-label+text
case 'name':
var enumeration = helper.attr("data-enumeration");
dropdownList = JSON.parse(enumeration);
if (dropdownList) {
var enumNames = helper.attr("data-enumName");
var dropdownValues = [];
$.each(dropdownList, function(key, value)
{
dropdownValues.push('<option value="'+ key +'">'+ value +'</option>');
});
var helperMin = $('<li/>').addClass("helperContent col-sm-8 padding-5").appendTo(row);
$('#helperDropdown')
.clone()
.attr('id', generateUniqIdentifier())
.attr('name', helperName)
.removeClass('hide')
.addClass(' ')
.html(dropdownValues.join(''))
.appendTo(helperMin);
}
else if (helper.attr('externalRef') == 1) {
var helperMin = $('<li/>').addClass("helperContent col-sm-8 padding-5").appendTo(row);
$('#helperValueMin')
.clone()
.attr('type','text')
.attr('placeholder','Valeur')
.attr('id', generateUniqIdentifier())
.addClass('externalRefField')
.attr('name', helperName)
.appendTo(helperMin)
.prev()
.remove();
getTypeahead();
}
else {
var helperMin = $('<li/>').addClass("helperContent col-sm-8 padding-5").appendTo(row);
$('#helperValueMin')
.clone()
.attr('type','text')
.attr('id', generateUniqIdentifier())
.attr('placeholder','Valeur')
.attr('name', helperName)
.appendTo(helperMin)
.prev()
.remove();
}
break;
// 1-dropdown if enumeration, 2-typeahead if external Ref, 3-simple text, 4-label+text
case 'name':
var enumeration = helper.attr("data-enumeration");
dropdownList = JSON.parse(enumeration);
case 'number':
var helperMin = $('<li/>').addClass("helperContent col-sm-4 padding-5").appendTo(row);
var helperMax = $('<li/>').addClass("numberMax helperContent col-sm-4 padding-5").appendTo(row);
if (dropdownList) {
var enumNames = helper.attr("data-enumName");
var dropdownValues = [];
$('#helperValueMin')
.clone()
.attr('id', generateUniqIdentifier())
.attr('type','number')
.attr('placeholder','Minimum')
.attr('data-range','start')
.attr('name', helperName)
.appendTo(helperMin)
.prev()
.remove();
$('#helperValueMax')
$.each(dropdownList, function(key, value)
{
dropdownValues.push('<option value="'+ key +'">'+ value +'</option>');
});
var helperInput = $('<li/>').addClass("helperContent col-sm-8 padding-5").appendTo(row);
$('#helperDropdown')
.clone()
.attr('id', generateUniqIdentifier())
.attr('type','number')
.attr('placeholder','Maximum')
.attr('data-range','end')
.attr('name', helperName)
.appendTo(helperMax)
.prev()
.remove();
break;
case 'date':
var helperMin = $('<li/>').addClass("startDate helperContent col-sm-4 padding-5").appendTo(row);
var helperMax = $('<li/>').addClass("endDate helperContent col-sm-4 padding-5").appendTo(row);
var valueMinIdentifier = generateUniqIdentifier();
var valueMaxIdentifier = generateUniqIdentifier();
.removeClass('hide')
.addClass(' ')
.html(dropdownValues.join(''))
.appendTo(helperInput);
}
else if (helper.attr('externalRef') == 1) {
var helperInput = $('<li/>').addClass("helperContent col-sm-8 padding-5").appendTo(row);
$('#helperValueMin')
.clone()
.attr('type','text')
.attr('placeholder','Date de début')
.attr('data-range','start')
.attr('placeholder','Valeur')
.attr('id', generateUniqIdentifier())
.addClass('externalRefField')
.attr('name', helperName)
.attr('id', valueMinIdentifier)
.addClass('datePicker')
.appendTo(helperMin)
.appendTo(helperInput)
.prev()
.remove();
$('#helperValueMax')
getTypeahead();
}
else {
var helperInput = $('<li/>').addClass("helperContent col-sm-8 padding-5").appendTo(row);
$('#helperValueMin')
.clone()
.attr('type','text')
.attr('placeholder','Date de fin')
.attr('data-range','end')
.attr('id', generateUniqIdentifier())
.attr('placeholder','Valeur')
.attr('name', helperName)
.attr('id', valueMaxIdentifier)
.addClass('datePicker')
.appendTo(helperMax)
.appendTo(helperInput)
.prev()
.remove();
}
break;
$('#' + valueMinIdentifier).datepicker({ language: "fr", todayHighlight: true, todayBtn: true, format:'dd-mm-yyyy' });
$('#' + valueMaxIdentifier).datepicker({ language: "fr", todayHighlight: true, todayBtn: true, format:'dd-mm-yyyy' });
break;
case 'number':
var helperMin = $('<li/>').addClass("helperContent col-sm-4 padding-5").appendTo(row);
var helperMax = $('<li/>').addClass("helperContent col-sm-4 padding-5").appendTo(row);
$('#helperValueMin')
.clone()
.attr('id', generateUniqIdentifier())
.attr('type','number')
.attr('placeholder','Minimum')
.attr('data-range','start')
.attr('name', helperName)
.appendTo(helperMin)
.prev()
.remove();
$('#helperValueMax')
.clone()
.attr('id', generateUniqIdentifier())
.attr('type','number')
.attr('placeholder','Maximum')
.attr('data-range','end')
.attr('name', helperName)
.appendTo(helperMax)
.prev()
.remove();
break;
case 'datetime':
var helperMin = $('<li/>').addClass("startDate helperContent col-sm-4 padding-5").appendTo(row);
var helperMax = $('<li/>').addClass("endDate helperContent col-sm-4 padding-5").appendTo(row);
var valueMinIdentifier = generateUniqIdentifier();
var valueMaxIdentifier = generateUniqIdentifier();
case 'date':
var helperMin = $('<li/>').addClass("startDate helperContent col-sm-4 padding-5").appendTo(row);
var helperMax = $('<li/>').addClass("endDate helperContent col-sm-4 padding-5").appendTo(row);
var valueMinIdentifier = generateUniqIdentifier();
var valueMaxIdentifier = generateUniqIdentifier();
$('#helperValueMin')
.clone()
.attr('type','text')
.attr('placeholder','Date de début')
.attr('data-range','start')
.attr('name', helperName)
.attr('id', valueMinIdentifier)
.addClass('datePicker')
.appendTo(helperMin)
.prev()
.remove();
$('#helperValueMax')
.clone()
.attr('type','text')
.attr('placeholder','Date de fin')
.attr('data-range','end')
.attr('name', helperName)
.attr('id', valueMaxIdentifier)
.addClass('datePicker')
.appendTo(helperMax)
.prev()
.remove();
$('#' + valueMinIdentifier).datepicker({ language: "fr", todayHighlight: true, todayBtn: true, format:'dd-mm-yyyy' });
$('#' + valueMaxIdentifier).datepicker({ language: "fr", todayHighlight: true, todayBtn: true, format:'dd-mm-yyyy' });
$('#helperValueMin')
.clone()
.attr('type','text')
.attr('placeholder','Date et heure de début')
.attr('data-range','start')
.attr('name', helperName)
.attr('id', valueMinIdentifier)
.addClass('dateTimePicker')
.appendTo(helperMin)
.prev()
.remove();
$('#helperValueMax')
.clone()
.attr('type','text')
.attr('placeholder','Date et heure de fin')
.attr('data-range','end')
.attr('name', helperName)
.attr('id', valueMaxIdentifier)
.addClass('dateTimePicker')
.appendTo(helperMax)
.prev()
.remove();
break;
dateTimePickerParams = JSON.parse($('#datetimePickerParams').val());
$('#' + valueMinIdentifier).datetimepicker(dateTimePickerParams);
$('#' + valueMaxIdentifier).datetimepicker(dateTimePickerParams);
break;
case 'datetime':
var helperMin = $('<li/>').addClass("startDate helperContent col-sm-4 padding-5").appendTo(row);
var helperMax = $('<li/>').addClass("endDate helperContent col-sm-4 padding-5").appendTo(row);
var valueMinIdentifier = generateUniqIdentifier();
var valueMaxIdentifier = generateUniqIdentifier();
$('#helperValueMin')
.clone()
.attr('type','text')
.attr('placeholder','Date et heure de début')
.attr('data-range','start')
.attr('name', helperName)
.attr('id', valueMinIdentifier)
.addClass('dateTimePicker')
.appendTo(helperMin)
.prev()
.remove();
$('#helperValueMax')
.clone()
.attr('type','text')
.attr('placeholder','Date et heure de fin')
.attr('data-range','end')
.attr('name', helperName)
.attr('id', valueMaxIdentifier)
.addClass('dateTimePicker')
.appendTo(helperMax)
.prev()
.remove();
dateTimePickerParams = JSON.parse($('#datetimePickerParams').val());
$('#' + valueMinIdentifier).datetimepicker(dateTimePickerParams);
$('#' + valueMaxIdentifier).datetimepicker(dateTimePickerParams);
break;
case 'boolean':
var helperMin = $('<li/>').addClass("helperContent col-sm-8 padding-5").appendTo(row);
var helperCheckbox = $('#helperToggle')
.clone()
.attr('type','checkbox')
.attr('name', helperName);
$(function() {
$(helperCheckbox).bootstrapToggle({
on: 'Activé',
off: 'Désactivé',
width: '18%',
size: 'normal',
onstyle:'toggleOn',
offstyle:'toggleOff'
});
})
helperCheckbox.appendTo(helperMin);
break;
case 'boolean':
var helperInput = $('<li/>').addClass("helperContent col-sm-8 padding-5").appendTo(row);
var helperCheckbox = $('#helperToggle')
.clone()
.attr('type','checkbox')
.attr('name', helperName);
$(function() {
$(helperCheckbox).bootstrapToggle({
on: 'Activé',
off: 'Désactivé',
width: '18%',
size: 'normal',
onstyle:'toggleOn',
offstyle:'toggleOff'
});
})
helperCheckbox.appendTo(helperInput);
break;
default:
return;
default:
return;
}
var buttonColumn = $('<li/>').appendTo(row);
......
Supports Markdown
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