sr-npm 1.7.1234 → 1.7.1236
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -37,6 +37,8 @@ let currentSecondarySearchJobs=[] // current secondary search results that are d
|
|
|
37
37
|
let secondarySearchIsFilled=false // whether the secondary search is filled with results
|
|
38
38
|
let keywordAllJobs; // all jobs that are displayed in the jobs repeater when the keyword is filled
|
|
39
39
|
let ActivateURLOnchange=true; // whether to activate the url onchange
|
|
40
|
+
let considerAllJobs=false; // whether to consider all jobs or not
|
|
41
|
+
|
|
40
42
|
const pagination = {
|
|
41
43
|
pageSize: 10,
|
|
42
44
|
currentPage: 1,
|
|
@@ -85,6 +87,7 @@ async function clearAll(_$w,urlOnChange=false) {
|
|
|
85
87
|
|
|
86
88
|
for(const field of allfields) {
|
|
87
89
|
_$w(`#${FiltersIds[field.title]}CheckBox`).selectedIndices = [];
|
|
90
|
+
_$w(`#${FiltersIds[field.title]}input`).value='';
|
|
88
91
|
}
|
|
89
92
|
selectedByField.clear();
|
|
90
93
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SECONDARY_SEARCH_INPUT).value='';
|
|
@@ -92,6 +95,7 @@ async function clearAll(_$w,urlOnChange=false) {
|
|
|
92
95
|
secondarySearchIsFilled=false;
|
|
93
96
|
currentJobs=alljobs;
|
|
94
97
|
keywordAllJobs=undefined;
|
|
98
|
+
|
|
95
99
|
if(!urlOnChange) {
|
|
96
100
|
console.log("inside clearAll removing url params");
|
|
97
101
|
ActivateURLOnchange=false;
|
|
@@ -285,11 +289,16 @@ async function handleParams(_$w,param,values) {
|
|
|
285
289
|
let fieldTitle=field.title.toLowerCase().replace(' ', '');
|
|
286
290
|
fieldTitle==="brands"? fieldTitle="brand":fieldTitle;
|
|
287
291
|
ActivateURLOnchange=false;
|
|
292
|
+
const previousSelectedSize=selectedByField.size;
|
|
288
293
|
if (updated.length) {
|
|
289
294
|
selectedByField.set(fieldId, updated);
|
|
295
|
+
|
|
296
|
+
|
|
290
297
|
queryParams.add({ [fieldTitle] : updated.map(val=>encodeURIComponent(val)).join(',') });
|
|
291
298
|
} else {
|
|
292
299
|
selectedByField.delete(fieldId);
|
|
300
|
+
handleConsiderAllJobs(previousSelectedSize,selectedByField.size);
|
|
301
|
+
|
|
293
302
|
queryParams.remove([fieldTitle ]);
|
|
294
303
|
}
|
|
295
304
|
|
|
@@ -398,8 +407,12 @@ async function loadJobsRepeater(_$w) {
|
|
|
398
407
|
let fieldTitle=field.title.toLowerCase().replace(' ', '');
|
|
399
408
|
fieldTitle==="brands"? fieldTitle="brand":fieldTitle;
|
|
400
409
|
ActivateURLOnchange=false;
|
|
410
|
+
const previousSelectedSize=selectedByField.size;
|
|
411
|
+
|
|
401
412
|
if (selected && selected.length) {
|
|
402
413
|
selectedByField.set(field._id, selected);
|
|
414
|
+
|
|
415
|
+
|
|
403
416
|
if(fieldTitle==="brand" || fieldTitle==="storename") {
|
|
404
417
|
//in this case we need the label not valueid
|
|
405
418
|
const valueLabels=getValueFromValueId(selected,value);
|
|
@@ -410,7 +423,8 @@ async function loadJobsRepeater(_$w) {
|
|
|
410
423
|
}
|
|
411
424
|
|
|
412
425
|
} else {
|
|
413
|
-
selectedByField.delete(field._id);
|
|
426
|
+
selectedByField.delete(field._id);
|
|
427
|
+
handleConsiderAllJobs(previousSelectedSize,selectedByField.size);
|
|
414
428
|
queryParams.remove([fieldTitle ]);
|
|
415
429
|
}
|
|
416
430
|
|
|
@@ -451,14 +465,34 @@ function getValueFromValueId(valueIds, value) {
|
|
|
451
465
|
updateTotalJobsCountText(_$w);
|
|
452
466
|
}
|
|
453
467
|
|
|
468
|
+
function handleConsiderAllJobs(previousSelectedSize,currentSelectedSize) {
|
|
469
|
+
if(previousSelectedSize===2 && currentSelectedSize===1) {
|
|
470
|
+
|
|
471
|
+
considerAllJobs=true;
|
|
472
|
+
}
|
|
473
|
+
else{
|
|
474
|
+
considerAllJobs=false;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
454
478
|
function updateOptionsUI(_$w,fieldTitle, fieldId, searchQuery,clearAll=false) {
|
|
455
479
|
let base = optionsByFieldId.get(fieldId) || [];
|
|
456
|
-
|
|
480
|
+
let countsMap=countsByFieldId.get(fieldId) || new Map();
|
|
481
|
+
if(considerAllJobs)
|
|
482
|
+
{
|
|
483
|
+
const selectedFieldId=Array.from( selectedByField.keys() )[0]
|
|
484
|
+
if(selectedFieldId===fieldId) {
|
|
485
|
+
const relevantFields=allvaluesobjects.filter(val=>val.customField===selectedFieldId)
|
|
486
|
+
countsMap = new Map(relevantFields.map(val=>[val.valueId, val.count]));
|
|
487
|
+
considerAllJobs=false;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
457
490
|
if(dontUpdateThisCheckBox===fieldId && !clearAll && selectedByField.has(fieldId) )
|
|
458
491
|
{
|
|
459
492
|
dontUpdateThisCheckBox=null;
|
|
460
493
|
return;
|
|
461
494
|
}
|
|
495
|
+
|
|
462
496
|
let filteredbase=[]
|
|
463
497
|
for (const element of base)
|
|
464
498
|
{
|
|
@@ -613,8 +647,8 @@ async function refreshFacetCounts(_$w,clearAll=false) {
|
|
|
613
647
|
|
|
614
648
|
function countJobsPerField(jobs) {
|
|
615
649
|
const fieldIds = Array.from(optionsByFieldId.keys());
|
|
650
|
+
|
|
616
651
|
const currentJobsIds=jobs.map(job=>job._id);
|
|
617
|
-
|
|
618
652
|
for (const fieldId of fieldIds) {
|
|
619
653
|
let currentoptions = optionsByFieldId.get(fieldId)
|
|
620
654
|
let counter=new Map();
|
package/pages/pagesUtils.js
CHANGED
|
@@ -78,13 +78,7 @@ function getFieldByTitle(title,allFields) {
|
|
|
78
78
|
|
|
79
79
|
function getCorrectOption(value,options,param) {
|
|
80
80
|
const standardizedValue = normalizeString(value.toLowerCase())
|
|
81
|
-
|
|
82
|
-
{
|
|
83
|
-
//option.value is the id,
|
|
84
|
-
return options.find(option=>normalizeString(option.value.toLowerCase())===standardizedValue);
|
|
85
|
-
}
|
|
86
|
-
//option.label is what we see live in the UI
|
|
87
|
-
return options.find(option=>normalizeString(option.label.toLowerCase())===standardizedValue);
|
|
81
|
+
return options.find(option=>normalizeString(option.value.toLowerCase())===standardizedValue || normalizeString(option.label.toLowerCase())===standardizedValue);
|
|
88
82
|
}
|
|
89
83
|
|
|
90
84
|
function getOptionIndexFromCheckBox(options,value) {
|