sr-npm 3.1.24 → 3.1.25
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,
|
|
@@ -285,11 +287,16 @@ async function handleParams(_$w,param,values) {
|
|
|
285
287
|
let fieldTitle=field.title.toLowerCase().replace(' ', '');
|
|
286
288
|
fieldTitle==="brands"? fieldTitle="brand":fieldTitle;
|
|
287
289
|
ActivateURLOnchange=false;
|
|
290
|
+
const previousSelectedSize=selectedByField.size;
|
|
288
291
|
if (updated.length) {
|
|
289
292
|
selectedByField.set(fieldId, updated);
|
|
293
|
+
|
|
294
|
+
|
|
290
295
|
queryParams.add({ [fieldTitle] : updated.map(val=>encodeURIComponent(val)).join(',') });
|
|
291
296
|
} else {
|
|
292
297
|
selectedByField.delete(fieldId);
|
|
298
|
+
handleConsiderAllJobs(previousSelectedSize,selectedByField.size);
|
|
299
|
+
|
|
293
300
|
queryParams.remove([fieldTitle ]);
|
|
294
301
|
}
|
|
295
302
|
|
|
@@ -398,8 +405,12 @@ async function loadJobsRepeater(_$w) {
|
|
|
398
405
|
let fieldTitle=field.title.toLowerCase().replace(' ', '');
|
|
399
406
|
fieldTitle==="brands"? fieldTitle="brand":fieldTitle;
|
|
400
407
|
ActivateURLOnchange=false;
|
|
408
|
+
const previousSelectedSize=selectedByField.size;
|
|
409
|
+
|
|
401
410
|
if (selected && selected.length) {
|
|
402
411
|
selectedByField.set(field._id, selected);
|
|
412
|
+
|
|
413
|
+
|
|
403
414
|
if(fieldTitle==="brand" || fieldTitle==="storename") {
|
|
404
415
|
//in this case we need the label not valueid
|
|
405
416
|
const valueLabels=getValueFromValueId(selected,value);
|
|
@@ -410,7 +421,8 @@ async function loadJobsRepeater(_$w) {
|
|
|
410
421
|
}
|
|
411
422
|
|
|
412
423
|
} else {
|
|
413
|
-
selectedByField.delete(field._id);
|
|
424
|
+
selectedByField.delete(field._id);
|
|
425
|
+
handleConsiderAllJobs(previousSelectedSize,selectedByField.size);
|
|
414
426
|
queryParams.remove([fieldTitle ]);
|
|
415
427
|
}
|
|
416
428
|
|
|
@@ -451,14 +463,34 @@ function getValueFromValueId(valueIds, value) {
|
|
|
451
463
|
updateTotalJobsCountText(_$w);
|
|
452
464
|
}
|
|
453
465
|
|
|
466
|
+
function handleConsiderAllJobs(previousSelectedSize,currentSelectedSize) {
|
|
467
|
+
if(previousSelectedSize===2 && currentSelectedSize===1) {
|
|
468
|
+
|
|
469
|
+
considerAllJobs=true;
|
|
470
|
+
}
|
|
471
|
+
else{
|
|
472
|
+
considerAllJobs=false;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
|
|
454
476
|
function updateOptionsUI(_$w,fieldTitle, fieldId, searchQuery,clearAll=false) {
|
|
455
477
|
let base = optionsByFieldId.get(fieldId) || [];
|
|
456
|
-
|
|
478
|
+
let countsMap=countsByFieldId.get(fieldId) || new Map();
|
|
479
|
+
if(considerAllJobs)
|
|
480
|
+
{
|
|
481
|
+
const selectedFieldId=Array.from( selectedByField.keys() )[0]
|
|
482
|
+
if(selectedFieldId===fieldId) {
|
|
483
|
+
const relevantFields=allvaluesobjects.filter(val=>val.customField===selectedFieldId)
|
|
484
|
+
countsMap = new Map(relevantFields.map(val=>[val.valueId, val.count]));
|
|
485
|
+
considerAllJobs=false;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
457
488
|
if(dontUpdateThisCheckBox===fieldId && !clearAll && selectedByField.has(fieldId) )
|
|
458
489
|
{
|
|
459
490
|
dontUpdateThisCheckBox=null;
|
|
460
491
|
return;
|
|
461
492
|
}
|
|
493
|
+
|
|
462
494
|
let filteredbase=[]
|
|
463
495
|
for (const element of base)
|
|
464
496
|
{
|
|
@@ -613,8 +645,8 @@ async function refreshFacetCounts(_$w,clearAll=false) {
|
|
|
613
645
|
|
|
614
646
|
function countJobsPerField(jobs) {
|
|
615
647
|
const fieldIds = Array.from(optionsByFieldId.keys());
|
|
648
|
+
|
|
616
649
|
const currentJobsIds=jobs.map(job=>job._id);
|
|
617
|
-
|
|
618
650
|
for (const fieldId of fieldIds) {
|
|
619
651
|
let currentoptions = optionsByFieldId.get(fieldId)
|
|
620
652
|
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) {
|