From 389e8f2de6754e44ec31e5a67f68fba95fc02b3b Mon Sep 17 00:00:00 2001 From: Bruno Da Silva Date: Mon, 26 Mar 2018 15:59:44 +0000 Subject: [PATCH] search widget : widget datetime the "advanced" (datetime) mode and the "less" (date only) modes are now less linked over each other if you choose a date, you loose the time. Previously, the time was keeped hiddenly. SVN:b1162[5537] --- .../search_form_criteria_date_abstract.js | 22 ++++++++++++++----- js/search/search_form_criteria_date_time.js | 6 +++-- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/js/search/search_form_criteria_date_abstract.js b/js/search/search_form_criteria_date_abstract.js index 51074890b..b812388ad 100644 --- a/js/search/search_form_criteria_date_abstract.js +++ b/js/search/search_form_criteria_date_abstract.js @@ -40,7 +40,9 @@ $(function() // "show_on_advanced": true, => is the input displaye on "more" or "less" mode advanced is an lais for "more" in the css // "synced_with": "from_time", => from and until has both two input (datepicker and datetimepicker). each time one input change, the other one has to change // "getter_code":"from_time" => iTop expect datetime to always provide time, so we must always use the datetimepicker in order to compute the value to be sent to iTop event if whe are in the display mode "less" with datepicker visible + // "getter_suffix": " 00:00:00", => iTop expect datetime to always provide time, so either we use the "getter_code" or we add a suffix to force the time // "title_getter_code":"from", => if present, the title will be computed base on the given input code. Because the datetime widget title area is not large enought, so we remove the time info, in order to do so we use this. + } ] }, @@ -264,22 +266,32 @@ $(function() var aValues = []; var aInputsParam = me.options.aInputsParam; var aInputsParamLength = aInputsParam.length; - var bAdvancedMode = (oOpElem.find('adanced').length > 0); + var bAdvancedMode = (me.element.find('.sfc_form_group.advanced').length > 0); + + var sValue = ''; + var sLabel = ''; + for (var i = 0; i < aInputsParamLength; i++) { var oInputParam = aInputsParam[i]; - var oInputElemForLabel = oOpElem.find('input[name="'+oInputParam.code+'"]'); + + sLabel = oOpElem.find('input[name="'+oInputParam.code+'"]').val(); + if (typeof oInputParam.show_on_advanced == 'undefined' || bAdvancedMode == oInputParam.show_on_advanced) { if (typeof oInputParam.getter_code != 'undefined') { - oInputElemForValue = oOpElem.find('input[name="'+oInputParam.getter_code+'"]'); + sValue = oOpElem.find('input[name="'+oInputParam.getter_code+'"]').val(); + } + else if (typeof oInputParam.getter_suffix != 'undefined') + { + sValue = sLabel + oInputParam.getter_suffix; } else { - oInputElemForValue = oInputElemForLabel; + sValue = sLabel; } - aValues[oInputParam.value_index] = {value: oInputElemForValue.val(), label: oInputElemForLabel.val()}; + aValues[oInputParam.value_index] = {value: sValue, label: sLabel}; } } diff --git a/js/search/search_form_criteria_date_time.js b/js/search/search_form_criteria_date_time.js index c823a18ec..e849f50d3 100644 --- a/js/search/search_form_criteria_date_time.js +++ b/js/search/search_form_criteria_date_time.js @@ -25,7 +25,8 @@ $(function() "value_index": 0, "onclose_show" : "until", "synced_with": "from_time", - "getter_code":"from_time", + //"getter_code":"from_time", + "getter_suffix":" 00:00:00", }, { "code": "from_time", @@ -46,7 +47,8 @@ $(function() "show_on_advanced": false, "value_index": 1, "synced_with": "until_time", - "getter_code":"until_time", + //"getter_code":"until_time", + "getter_suffix":" 23:59:59", }, { "code": "until_time",