Commit 399925e5 authored by Iker Hurtado's avatar Iker Hurtado
Browse files

Add the checkboxes that modify the search by Elements and Formula

parent bd7b7018
......@@ -7684,7 +7684,7 @@
</div>
<button class="search-btn" >Search</button>
</div>
......@@ -7816,13 +7816,17 @@
}else if (this.queryTypes[i] === 'MN'){
queryObj.bool.filter.push(this._getESSimpleMatch('material_name', item));
}
else if (this.queryTypes[i] === 'E') elements.push(item);
else if (this.queryTypes[i] === 'E')
elements.push(item);
//else if (this.queryTypes[i] !== 'S'){ // property }
});
if (elements.length > 0) // If there are elements (there is no formula or material name)
if (elements.length > 0){ // If there are elements (there is no formula or material name)
queryObj.bool.filter.push(this._getFieldESMatch('atom_labels', elements, true));//getAtomsESMatch(elements));
console.log('getAllowOtherElementsYYYYYYYYYYYYY: '+this.elementTable.getAllowOtherElements());
}
///atom_labels": { "operator": "and",
......@@ -8173,6 +8177,14 @@
this.element.innerHTML=
`
<div style="padding-bottom: 20px;">
<input type="checkbox" class="allow-other-elements" value="">
Allow other elements
<br>
<input type="checkbox" class="multiples-of-formula" value="">
Include multiples of formula
<br>
<input type="text" class="formula-text-field"
placeholder="Add formula to the search query above" >
<button class="adding-formula-btn" disabled>Add to query</button>
......@@ -8610,8 +8622,11 @@
this.element = document.createElement('div');
this.element.setAttribute('id','elementable');
let tempHtml= `<input type="checkbox" class="allow-other-elements" value="">
Allow other elements`;
// header with dropdown
let tempHtml= '<div class="element-info"></div>';
tempHtml+= '<div class="element-info"></div>';
tempHtml+= '<div class="ptWrapper">';
......@@ -8809,6 +8824,11 @@
}
}
getAllowOtherElements(){
return this.element.querySelector('.allow-other-elements').checked;
}
} // class ElemenTable
......@@ -8835,6 +8855,9 @@
}
}
// EXPORTS
module.exports = ElemenTable;
......
......@@ -158,8 +158,11 @@ class ElemenTable{
this.element = document.createElement('div');
this.element.setAttribute('id','elementable');
let tempHtml= `<input type="checkbox" class="allow-other-elements" value="">
Allow other elements`;
// header with dropdown
let tempHtml= '<div class="element-info"></div>';
tempHtml+= '<div class="element-info"></div>';
tempHtml+= '<div class="ptWrapper">';
......@@ -357,6 +360,11 @@ class ElemenTable{
}
}
getAllowOtherElements(){
return this.element.querySelector('.allow-other-elements').checked;
}
} // class ElemenTable
......@@ -383,5 +391,8 @@ function getElement(e){
}
}
// EXPORTS
module.exports = ElemenTable;
......@@ -77,7 +77,7 @@ class NewSearchMod {
</div>
<button class="search-btn" >Search</button>
</div>
......@@ -209,13 +209,17 @@ class NewSearchMod {
}else if (this.queryTypes[i] === 'MN'){
queryObj.bool.filter.push(this._getESSimpleMatch('material_name', item));
}
else if (this.queryTypes[i] === 'E') elements.push(item);
else if (this.queryTypes[i] === 'E')
elements.push(item);
//else if (this.queryTypes[i] !== 'S'){ // property }
});
if (elements.length > 0) // If there are elements (there is no formula or material name)
if (elements.length > 0){ // If there are elements (there is no formula or material name)
queryObj.bool.filter.push(this._getFieldESMatch('atom_labels', elements, true));//getAtomsESMatch(elements));
console.log('getAllowOtherElementsYYYYYYYYYYYYY: '+this.elementTable.getAllowOtherElements());
}
///atom_labels": { "operator": "and",
......@@ -566,6 +570,14 @@ class FormulaBox{
this.element.innerHTML=
`
<div style="padding-bottom: 20px;">
<input type="checkbox" class="allow-other-elements" value="">
Allow other elements
<br>
<input type="checkbox" class="multiples-of-formula" value="">
Include multiples of formula
<br>
<input type="text" class="formula-text-field"
placeholder="Add formula to the search query above" >
<button class="adding-formula-btn" disabled>Add to query</button>
......
Markdown is supported
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