Initialize three instructed search tabs
This commit is contained in:
@@ -1262,6 +1262,7 @@ const syncSearchAddButton=panel=>{
|
||||
const getSearchRows=panel=>{
|
||||
const registryChecked=[...panel.querySelectorAll('.filter-check')].some(label=>label.textContent.includes('Входящие в Реестр ОПК')&&label.querySelector('input')?.checked);
|
||||
const systemformingChecked=[...panel.querySelectorAll('.filter-check')].some(label=>label.textContent.includes('Системообразующие организации')&&label.querySelector('input')?.checked);
|
||||
const strategicChecked=[...panel.querySelectorAll('.filter-check')].some(label=>label.textContent.includes('Стратегические')&&label.querySelector('input')?.checked);
|
||||
const isUlyanovskQuery=panel.querySelector('[name="region"]')?.value==='Ульяновская обл.'&®istryChecked&&systemformingChecked;
|
||||
const manager=panel.querySelector('[name="manager"]')?.value.trim().toLocaleLowerCase('ru-RU')||'';
|
||||
const ministry=panel.querySelector('[name="ministry"]')?.value||'';
|
||||
@@ -1275,7 +1276,7 @@ const getSearchRows=panel=>{
|
||||
const isSaturnQuery=identifier.includes('7610052644')||(
|
||||
panel.querySelector('[name="region"]')?.value==='Ярославская обл.'&&
|
||||
(activity==='Производство с наукой'||industry==='Производство с наукой')&&
|
||||
ministry.includes('промышленности и торговли')&®istryChecked
|
||||
ministry.includes('промышленности и торговли')&®istryChecked&&strategicChecked
|
||||
);
|
||||
return isRksQuery||isRoscosmosQuery?[
|
||||
...(isRoscosmosQuery?[['Государственная корпорация по космической деятельности «Роскосмос»','7702388027','Москва г.','Ракетно-космическая промышленность','okb-roscosmos']]:[]),
|
||||
@@ -1738,6 +1739,57 @@ const initializeFilterPanel=panel=>{
|
||||
getFilterPanels().forEach(initializeFilterPanel);
|
||||
document.addEventListener('click',()=>closeCustomSelects());
|
||||
renumberFilterTabs();
|
||||
const defaultSearchPresets=[
|
||||
{
|
||||
fields:{region:'Ульяновская обл.'},
|
||||
checks:['Входящие в Реестр ОПК','Системообразующие организации']
|
||||
},
|
||||
{
|
||||
fields:{
|
||||
manager:'Емельянов Константин Владимирович',
|
||||
ministry:'Государственная корпорация по космической деятельности «Роскосмос»'
|
||||
},
|
||||
checks:['Входящие в Реестр ОПК']
|
||||
},
|
||||
{
|
||||
fields:{
|
||||
activity:'Производство с наукой',
|
||||
region:'Ярославская обл.',
|
||||
ministry:'Министерство промышленности и торговли Российской Федерации'
|
||||
},
|
||||
checks:['Входящие в Реестр ОПК','Стратегические (расп.№1226)']
|
||||
}
|
||||
];
|
||||
const applyDefaultSearchPreset=(panel,preset)=>{
|
||||
Object.entries(preset.fields).forEach(([name,value])=>{
|
||||
const control=panel.querySelector(`[name="${name}"]`);
|
||||
if(!control)return;
|
||||
control.value=value;
|
||||
control.dispatchEvent(new Event('input',{bubbles:true}));
|
||||
control.dispatchEvent(new Event('change',{bubbles:true}));
|
||||
});
|
||||
preset.checks.forEach(labelText=>{
|
||||
const check=[...panel.querySelectorAll('.filter-check')].find(label=>normalizeFilterText(label.querySelector(':scope > span')?.textContent)===labelText);
|
||||
const checkbox=check?.querySelector('input[type="checkbox"]');
|
||||
if(!checkbox)return;
|
||||
checkbox.checked=true;
|
||||
checkbox.dispatchEvent(new Event('change',{bubbles:true}));
|
||||
});
|
||||
};
|
||||
const initializeDefaultSearchTabs=()=>{
|
||||
defaultSearchPresets.forEach((preset,index)=>{
|
||||
const panelName=index===0?'primary':`primary${index+1}`;
|
||||
if(index>0){
|
||||
filterPanelSequence=index+1;
|
||||
createFilterTab(panelName);
|
||||
}
|
||||
const panel=document.getElementById(`filterPanel${panelName[0].toUpperCase()}${panelName.slice(1)}`);
|
||||
applyDefaultSearchPreset(panel,preset);
|
||||
updateSearchResults(panel);
|
||||
});
|
||||
setFilterPanel('primary');
|
||||
};
|
||||
initializeDefaultSearchTabs();
|
||||
searchResults.addEventListener('click',event=>openSearchResult(event.target));
|
||||
searchResults.addEventListener('keydown',event=>{
|
||||
if(event.key==='Enter'||event.key===' '){
|
||||
|
||||
Reference in New Issue
Block a user