sr-npm 1.7.898 → 1.7.899
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
|
@@ -47,6 +47,7 @@ async function clearAll(_$w) {
|
|
|
47
47
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SECONDARY_SEARCH_INPUT).value='';
|
|
48
48
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value='';
|
|
49
49
|
secondarySearchIsFilled=false;
|
|
50
|
+
currentJobs=alljobs;
|
|
50
51
|
await updateJobsAndNumbersAndFilters(_$w,true);
|
|
51
52
|
}
|
|
52
53
|
}
|
|
@@ -74,7 +75,7 @@ async function handleUrlParams(_$w,urlParams) {
|
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
if(applyFiltering || keyword) {
|
|
77
|
-
await updateJobsAndNumbersAndFilters(_$w,false
|
|
78
|
+
await updateJobsAndNumbersAndFilters(_$w,false);
|
|
78
79
|
}
|
|
79
80
|
if(urlParams.page) {
|
|
80
81
|
if(Number.isNaN(Number(urlParams.page)) || Number(urlParams.page)<=1 || Number(urlParams.page)>Math.ceil(currentJobs.length/pagination.pageSize)) {
|
|
@@ -218,7 +219,6 @@ async function loadJobsRepeater(_$w) {
|
|
|
218
219
|
}
|
|
219
220
|
|
|
220
221
|
function updateTotalJobsCountText(_$w) {
|
|
221
|
-
console.log("currentJobs inisde updateTotalJobsCountText: ",currentJobs)
|
|
222
222
|
secondarySearchIsFilled? _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.TotalJobsCountText).text = `${currentSecondarySearchJobs.length} Jobs`:
|
|
223
223
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.TotalJobsCountText).text = `${currentJobs.length} Jobs`;
|
|
224
224
|
}
|
|
@@ -287,8 +287,8 @@ async function loadJobsRepeater(_$w) {
|
|
|
287
287
|
|
|
288
288
|
|
|
289
289
|
|
|
290
|
-
async function updateJobsAndNumbersAndFilters(_$w,clearAll=false
|
|
291
|
-
await applyJobFilters(_$w
|
|
290
|
+
async function updateJobsAndNumbersAndFilters(_$w,clearAll=false) {
|
|
291
|
+
await applyJobFilters(_$w); // re-query jobs
|
|
292
292
|
await refreshFacetCounts(_$w,clearAll); // recompute and update counts in all lists
|
|
293
293
|
await updateSelectedValuesRepeater(_$w);
|
|
294
294
|
updateTotalJobsCountText(_$w);
|
|
@@ -296,15 +296,7 @@ async function loadJobsRepeater(_$w) {
|
|
|
296
296
|
|
|
297
297
|
function updateOptionsUI(_$w,fieldTitle, fieldId, searchQuery,clearAll=false) {
|
|
298
298
|
let base = optionsByFieldId.get(fieldId) || [];
|
|
299
|
-
console.log("base: ",base)
|
|
300
|
-
console.log("optionsByFieldId : ",optionsByFieldId)
|
|
301
|
-
console.log("countsByFieldId : ",countsByFieldId)
|
|
302
299
|
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
300
|
|
|
309
301
|
if(dontUpdateThisCheckBox===fieldId && !clearAll)
|
|
310
302
|
{
|
|
@@ -319,7 +311,6 @@ async function loadJobsRepeater(_$w) {
|
|
|
319
311
|
filteredbase.push(element)
|
|
320
312
|
}
|
|
321
313
|
}
|
|
322
|
-
console.log("filteredbase: ",filteredbase)
|
|
323
314
|
// Build display options with counts
|
|
324
315
|
const withCounts = filteredbase.map(o => {
|
|
325
316
|
const count = countsMap.get(o.value)
|
|
@@ -329,7 +320,6 @@ async function loadJobsRepeater(_$w) {
|
|
|
329
320
|
};
|
|
330
321
|
});
|
|
331
322
|
// Apply search
|
|
332
|
-
console.log("withCounts: ",withCounts)
|
|
333
323
|
const filtered = searchQuery
|
|
334
324
|
? withCounts.filter(o => (o.label || '').toLowerCase().includes(searchQuery))
|
|
335
325
|
: withCounts;
|
|
@@ -338,20 +328,18 @@ async function loadJobsRepeater(_$w) {
|
|
|
338
328
|
let prevSelected=[]
|
|
339
329
|
clearAll? prevSelected=[]:prevSelected= _$w(`#${FiltersIds[fieldTitle]}CheckBox`).value;
|
|
340
330
|
const visibleSet = new Set(filtered.map(o => o.value));
|
|
341
|
-
console.log("visibleSet: ",visibleSet)
|
|
342
331
|
const preserved = prevSelected.filter(v => visibleSet.has(v));
|
|
343
|
-
console.log("preserved: ",preserved)
|
|
344
332
|
_$w(`#${FiltersIds[fieldTitle]}CheckBox`).options = filtered;
|
|
345
333
|
_$w(`#${FiltersIds[fieldTitle]}CheckBox`).value = preserved;
|
|
346
334
|
}
|
|
347
335
|
|
|
348
|
-
async function applyJobFilters(_$w
|
|
336
|
+
async function applyJobFilters(_$w) {
|
|
349
337
|
let tempFilteredJobs=[];
|
|
350
338
|
let finalFilteredJobs=[];
|
|
351
|
-
secondarySearchIsFilled? finalFilteredJobs=allsecondarySearchJobs:finalFilteredJobs=
|
|
352
|
-
if(keyword) {
|
|
353
|
-
|
|
354
|
-
}
|
|
339
|
+
secondarySearchIsFilled? finalFilteredJobs=allsecondarySearchJobs:finalFilteredJobs=currentJobs;
|
|
340
|
+
// if(keyword) {
|
|
341
|
+
// finalFilteredJobs=currentJobs
|
|
342
|
+
// }
|
|
355
343
|
let addedJobsIds=new Set();
|
|
356
344
|
// AND across categories, OR within each category
|
|
357
345
|
for (const [key, values] of selectedByField.entries()) {
|
|
@@ -442,21 +430,16 @@ async function refreshFacetCounts(_$w,clearAll=false) {
|
|
|
442
430
|
const currentJobsIds=jobs.map(job=>job._id);
|
|
443
431
|
|
|
444
432
|
for (const fieldId of fieldIds) {
|
|
445
|
-
console.log("fieldId: ",fieldId)
|
|
446
|
-
console.log("optionsByFieldId: ",optionsByFieldId)
|
|
447
|
-
console.log("valueToJobs: ",valueToJobs)
|
|
448
433
|
let currentoptions=optionsByFieldId.get(fieldId)
|
|
449
434
|
let counter=new Map();
|
|
450
435
|
for(const option of currentoptions) {
|
|
451
436
|
for (const jobId of currentJobsIds) {
|
|
452
|
-
console.log("current jobId: ",jobId)
|
|
453
437
|
if (valueToJobs[option.value].includes(jobId)) {
|
|
454
438
|
counter.set(option.value, (counter.get(option.value) || 0) + 1);
|
|
455
439
|
}
|
|
456
440
|
}
|
|
457
441
|
}
|
|
458
442
|
countsByFieldId.set(fieldId, counter);
|
|
459
|
-
console.log("countsByFieldId: ",countsByFieldId)
|
|
460
443
|
}
|
|
461
444
|
}
|
|
462
445
|
|