sr-npm 1.7.898 → 1.7.900
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
|
@@ -16,6 +16,7 @@ let currentJobs=[] // current jobs that are displayed in the jobs repeater
|
|
|
16
16
|
let allsecondarySearchJobs=[] // secondary search results that are displayed in the jobs repeater
|
|
17
17
|
let currentSecondarySearchJobs=[] // current secondary search results that are displayed in the jobs repeater
|
|
18
18
|
let secondarySearchIsFilled=false // whether the secondary search is filled with results
|
|
19
|
+
let keywordAllJobs=[] // all jobs that are displayed in the jobs repeater when the keyword is filled
|
|
19
20
|
const pagination = {
|
|
20
21
|
pageSize: 10,
|
|
21
22
|
currentPage: 1,
|
|
@@ -47,6 +48,8 @@ async function clearAll(_$w) {
|
|
|
47
48
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SECONDARY_SEARCH_INPUT).value='';
|
|
48
49
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value='';
|
|
49
50
|
secondarySearchIsFilled=false;
|
|
51
|
+
currentJobs=alljobs;
|
|
52
|
+
keywordAllJobs=alljobs;
|
|
50
53
|
await updateJobsAndNumbersAndFilters(_$w,true);
|
|
51
54
|
}
|
|
52
55
|
}
|
|
@@ -61,7 +64,8 @@ async function handleUrlParams(_$w,urlParams) {
|
|
|
61
64
|
applyFiltering=await primarySearch(_$w, decodeURIComponent(urlParams.keyword), alljobs);
|
|
62
65
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value=decodeURIComponent(urlParams.keyword);
|
|
63
66
|
keyword=true;
|
|
64
|
-
currentJobs=_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOB_RESULTS_REPEATER).data;
|
|
67
|
+
currentJobs=_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOB_RESULTS_REPEATER).data;
|
|
68
|
+
keywordAllJobs=_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOB_RESULTS_REPEATER).data;
|
|
65
69
|
}
|
|
66
70
|
if(urlParams.brand) {
|
|
67
71
|
applyFiltering=await handleParams(_$w,"brand",urlParams.brand)
|
|
@@ -218,7 +222,6 @@ async function loadJobsRepeater(_$w) {
|
|
|
218
222
|
}
|
|
219
223
|
|
|
220
224
|
function updateTotalJobsCountText(_$w) {
|
|
221
|
-
console.log("currentJobs inisde updateTotalJobsCountText: ",currentJobs)
|
|
222
225
|
secondarySearchIsFilled? _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.TotalJobsCountText).text = `${currentSecondarySearchJobs.length} Jobs`:
|
|
223
226
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.TotalJobsCountText).text = `${currentJobs.length} Jobs`;
|
|
224
227
|
}
|
|
@@ -296,15 +299,7 @@ async function loadJobsRepeater(_$w) {
|
|
|
296
299
|
|
|
297
300
|
function updateOptionsUI(_$w,fieldTitle, fieldId, searchQuery,clearAll=false) {
|
|
298
301
|
let base = optionsByFieldId.get(fieldId) || [];
|
|
299
|
-
console.log("base: ",base)
|
|
300
|
-
console.log("optionsByFieldId : ",optionsByFieldId)
|
|
301
|
-
console.log("countsByFieldId : ",countsByFieldId)
|
|
302
302
|
const countsMap = countsByFieldId.get(fieldId) || new Map();
|
|
303
|
-
console.log("countsMap: ",countsMap)
|
|
304
|
-
console.log("fieldTitle: ",fieldTitle)
|
|
305
|
-
console.log("fieldId: ",fieldId)
|
|
306
|
-
console.log("searchQuery: ",searchQuery)
|
|
307
|
-
console.log("clearAll: ",clearAll)
|
|
308
303
|
|
|
309
304
|
if(dontUpdateThisCheckBox===fieldId && !clearAll)
|
|
310
305
|
{
|
|
@@ -319,7 +314,6 @@ async function loadJobsRepeater(_$w) {
|
|
|
319
314
|
filteredbase.push(element)
|
|
320
315
|
}
|
|
321
316
|
}
|
|
322
|
-
console.log("filteredbase: ",filteredbase)
|
|
323
317
|
// Build display options with counts
|
|
324
318
|
const withCounts = filteredbase.map(o => {
|
|
325
319
|
const count = countsMap.get(o.value)
|
|
@@ -329,7 +323,6 @@ async function loadJobsRepeater(_$w) {
|
|
|
329
323
|
};
|
|
330
324
|
});
|
|
331
325
|
// Apply search
|
|
332
|
-
console.log("withCounts: ",withCounts)
|
|
333
326
|
const filtered = searchQuery
|
|
334
327
|
? withCounts.filter(o => (o.label || '').toLowerCase().includes(searchQuery))
|
|
335
328
|
: withCounts;
|
|
@@ -338,9 +331,7 @@ async function loadJobsRepeater(_$w) {
|
|
|
338
331
|
let prevSelected=[]
|
|
339
332
|
clearAll? prevSelected=[]:prevSelected= _$w(`#${FiltersIds[fieldTitle]}CheckBox`).value;
|
|
340
333
|
const visibleSet = new Set(filtered.map(o => o.value));
|
|
341
|
-
console.log("visibleSet: ",visibleSet)
|
|
342
334
|
const preserved = prevSelected.filter(v => visibleSet.has(v));
|
|
343
|
-
console.log("preserved: ",preserved)
|
|
344
335
|
_$w(`#${FiltersIds[fieldTitle]}CheckBox`).options = filtered;
|
|
345
336
|
_$w(`#${FiltersIds[fieldTitle]}CheckBox`).value = preserved;
|
|
346
337
|
}
|
|
@@ -350,7 +341,7 @@ async function loadJobsRepeater(_$w) {
|
|
|
350
341
|
let finalFilteredJobs=[];
|
|
351
342
|
secondarySearchIsFilled? finalFilteredJobs=allsecondarySearchJobs:finalFilteredJobs=alljobs;
|
|
352
343
|
if(keyword) {
|
|
353
|
-
finalFilteredJobs=
|
|
344
|
+
finalFilteredJobs=keywordAllJobs
|
|
354
345
|
}
|
|
355
346
|
let addedJobsIds=new Set();
|
|
356
347
|
// AND across categories, OR within each category
|
|
@@ -442,21 +433,16 @@ async function refreshFacetCounts(_$w,clearAll=false) {
|
|
|
442
433
|
const currentJobsIds=jobs.map(job=>job._id);
|
|
443
434
|
|
|
444
435
|
for (const fieldId of fieldIds) {
|
|
445
|
-
console.log("fieldId: ",fieldId)
|
|
446
|
-
console.log("optionsByFieldId: ",optionsByFieldId)
|
|
447
|
-
console.log("valueToJobs: ",valueToJobs)
|
|
448
436
|
let currentoptions=optionsByFieldId.get(fieldId)
|
|
449
437
|
let counter=new Map();
|
|
450
438
|
for(const option of currentoptions) {
|
|
451
439
|
for (const jobId of currentJobsIds) {
|
|
452
|
-
console.log("current jobId: ",jobId)
|
|
453
440
|
if (valueToJobs[option.value].includes(jobId)) {
|
|
454
441
|
counter.set(option.value, (counter.get(option.value) || 0) + 1);
|
|
455
442
|
}
|
|
456
443
|
}
|
|
457
444
|
}
|
|
458
445
|
countsByFieldId.set(fieldId, counter);
|
|
459
|
-
console.log("countsByFieldId: ",countsByFieldId)
|
|
460
446
|
}
|
|
461
447
|
}
|
|
462
448
|
|