Advanced search: WIP POC, UI/UX.

SVN:b1162[5493]
This commit is contained in:
Guillaume Lajarige
2018-03-22 16:52:35 +00:00
parent 73e1e3422d
commit 32809ae7d4
5 changed files with 31 additions and 4 deletions

View File

@@ -112,9 +112,11 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
$sSearchNbSelected = addslashes(Dict::S('UI:SearchValue:NbSelected'));
$this->add_dict_entry('UI:FillAllMandatoryFields');
$this->add_dict_entries('UI:Search:');
$this->add_dict_entries('UI:Button:');
$this->add_dict_entries('Error:');
$this->add_dict_entries('UI:Button:');
$this->add_dict_entries('UI:Search:');
$this->add_dict_entry('UI:UndefinedObject');
$this->add_dict_entries('Enum:Undefined');
if (!$this->IsPrintableVersion())

View File

@@ -15,11 +15,11 @@ $(function()
'values': [],
'oql': '',
'is_removable': true, // Not used for now. If we come to show locked criterion they will need to have this flag set to false.
'is_null_allowed': false,
'field': {
'label': '',
'allowed_values': null,
'is_null_allowed': false,
},
// Available operators. They can be extended or restricted by derivated widgets (see this._initOperators() for more informations)
'available_operators': {

View File

@@ -18,7 +18,15 @@ $(function()
'code': 'in',
'rank': 10,
},
'=': null, // Remove this one from enum widget.
'=': null, // Remove this one from enum widget.
'empty': null, // Remove as it will be handle by the "null" value in the "IN" operator
'not_empty': null, // Remove as it will be handle by the "null" value in the "IN" operator
},
// Null value
'null_value': {
'code': null,
'label': Dict.S('Enum:Undefined'),
},
},
@@ -93,6 +101,18 @@ $(function()
// - Allowed values
var oAllowedValuesElem = $('<div class="sfc_opc_mc_items"></div>');
// - Null value is allowed
// TODO: We might want to move this into the allowed_values for a standard behavior. But that needs to know how to send the "null" value to the server.
if(this.options.field.is_null_allowed === true)
{
var sItemId = 'value_' + sOpId + '_null';
var sValCode = this.options.null_value.code;
var sValLabel = this.options.null_value.label;
var oValueElem = $('<div class="sfc_opc_mc_item" data-value-code="' + sValCode + '"></div>')
.append('<label for="' + sItemId + '"><input type="checkbox" id="' + sItemId + '" value="' + sValCode + '"/>' + sValLabel + '</label>')
.appendTo(oAllowedValuesElem);
}
// - Regular allowed values
if(this.options.field.allowed_values.values !== undefined)
{
var aSortedValues = this._sortValuesByLabel(this.options.field.allowed_values.values);

View File

@@ -9,6 +9,10 @@ $(function()
// default options
options:
{
// Null value
'null_value': {
'label': Dict.S('UI:UndefinedObject'),
}
},

View File

@@ -446,6 +446,7 @@ $(function()
code: oFieldDef.code,
widget: oFieldDef.widget,
allowed_values: oFieldDef.allowed_values,
is_null_allowed: oFieldDef.is_null_allowed,
};
}