sr-npm 1.7.741 → 1.7.743
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 +1 -1
- package/pages/careersMultiBoxesPage.js +15 -11
package/package.json
CHANGED
|
@@ -12,7 +12,8 @@ let alljobs=[] // all jobs in the database
|
|
|
12
12
|
let allvaluesobjects=[] // all values in the database
|
|
13
13
|
let valueToJobs={} // valueId -> array of jobIds
|
|
14
14
|
let currentJobs=[] // current jobs that are displayed in the jobs repeater
|
|
15
|
-
let
|
|
15
|
+
let allsecondarySearchJobs=[] // secondary search results that are displayed in the jobs repeater
|
|
16
|
+
let currentSecondarySearchJobs=[] // current secondary search results that are displayed in the jobs repeater
|
|
16
17
|
let secondarySearchIsFilled=false // whether the secondary search is filled with results
|
|
17
18
|
const pagination = {
|
|
18
19
|
pageSize: 10,
|
|
@@ -174,7 +175,7 @@ async function loadJobsRepeater(_$w) {
|
|
|
174
175
|
}
|
|
175
176
|
|
|
176
177
|
function updateTotalJobsCountText(_$w) {
|
|
177
|
-
secondarySearchIsFilled? _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.TotalJobsCountText).text = `${
|
|
178
|
+
secondarySearchIsFilled? _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.TotalJobsCountText).text = `${allsecondarySearchJobs.length} Jobs`:
|
|
178
179
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.TotalJobsCountText).text = `${currentJobs.length} Jobs`;
|
|
179
180
|
}
|
|
180
181
|
|
|
@@ -296,7 +297,8 @@ async function loadJobsRepeater(_$w) {
|
|
|
296
297
|
|
|
297
298
|
async function applyJobFilters(_$w) {
|
|
298
299
|
let tempFilteredJobs=[];
|
|
299
|
-
let finalFilteredJobs=
|
|
300
|
+
let finalFilteredJobs=[];
|
|
301
|
+
secondarySearchIsFilled? finalFilteredJobs=allsecondarySearchJobs:finalFilteredJobs=alljobs;
|
|
300
302
|
let addedJobsIds=[]
|
|
301
303
|
// AND across categories, OR within each category
|
|
302
304
|
for (const [key, values] of selectedByField.entries()) {
|
|
@@ -324,8 +326,9 @@ async function loadJobsRepeater(_$w) {
|
|
|
324
326
|
finalFilteredJobs=tempFilteredJobs;
|
|
325
327
|
tempFilteredJobs=[];
|
|
326
328
|
}
|
|
329
|
+
secondarySearchIsFilled? currentSecondarySearchJobs=finalFilteredJobs:currentJobs=finalFilteredJobs;
|
|
327
330
|
|
|
328
|
-
currentJobs=finalFilteredJobs;
|
|
331
|
+
//currentJobs=finalFilteredJobs;
|
|
329
332
|
const jobsFirstPage=currentJobs.slice(0,pagination.pageSize);
|
|
330
333
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER).data = jobsFirstPage;
|
|
331
334
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationCurrentText).text = jobsFirstPage.length.toString();
|
|
@@ -345,7 +348,7 @@ function handlePaginationButtons(_$w)
|
|
|
345
348
|
handlePageUrlParam();
|
|
346
349
|
pagination.currentPage===1? _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PAGE_BUTTON_PREVIOUS).disable():_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PAGE_BUTTON_PREVIOUS).enable();
|
|
347
350
|
if(secondarySearchIsFilled) {
|
|
348
|
-
pagination.currentPage>=Math.ceil(
|
|
351
|
+
pagination.currentPage>=Math.ceil(allsecondarySearchJobs.length/pagination.pageSize)? _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PAGE_BUTTON_NEXT).disable():_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PAGE_BUTTON_NEXT).enable();
|
|
349
352
|
}
|
|
350
353
|
else {
|
|
351
354
|
pagination.currentPage>=Math.ceil(currentJobs.length/pagination.pageSize)? _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PAGE_BUTTON_NEXT).disable():_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PAGE_BUTTON_NEXT).enable();
|
|
@@ -366,7 +369,7 @@ async function refreshFacetCounts(_$w,clearAll=false) {
|
|
|
366
369
|
|
|
367
370
|
console.log("refreshing facet counts");
|
|
368
371
|
|
|
369
|
-
secondarySearchIsFilled? countJobsPerField(
|
|
372
|
+
secondarySearchIsFilled? countJobsPerField(allsecondarySearchJobs):countJobsPerField(currentJobs);
|
|
370
373
|
// const fieldIds = Array.from(optionsByFieldId.keys());
|
|
371
374
|
// const currentJobsIds=currentJobs.map(job=>job._id);
|
|
372
375
|
// for (const fieldId of fieldIds) {
|
|
@@ -431,17 +434,18 @@ function primarySearch(_$w,query) {
|
|
|
431
434
|
}
|
|
432
435
|
async function secondarySearch(_$w,query) {
|
|
433
436
|
if(query.length===0) {
|
|
434
|
-
|
|
437
|
+
allsecondarySearchJobs=currentJobs;
|
|
435
438
|
secondarySearchIsFilled=false;
|
|
436
439
|
}
|
|
437
440
|
else {
|
|
438
|
-
|
|
441
|
+
allsecondarySearchJobs=currentJobs.filter(job=>job.title.toLowerCase().includes(query));
|
|
442
|
+
currentSecondarySearchJobs=allsecondarySearchJobs;
|
|
439
443
|
}
|
|
440
444
|
|
|
441
|
-
const jobsFirstPage=
|
|
445
|
+
const jobsFirstPage=allsecondarySearchJobs.slice(0,pagination.pageSize);
|
|
442
446
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER).data = jobsFirstPage;
|
|
443
447
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationCurrentText).text = jobsFirstPage.length.toString();
|
|
444
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationTotalCountText).text =
|
|
448
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationTotalCountText).text = allsecondarySearchJobs.length.toString();
|
|
445
449
|
pagination.currentPage=1;
|
|
446
450
|
if(jobsFirstPage.length===0) {
|
|
447
451
|
await _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_MULTI_STATE_BOX).changeState("noJobs");
|
|
@@ -453,7 +457,7 @@ async function secondarySearch(_$w,query) {
|
|
|
453
457
|
handlePaginationButtons(_$w);
|
|
454
458
|
updateTotalJobsCountText(_$w);
|
|
455
459
|
await refreshFacetCounts(_$w); //false for clearAll, true for secondarySearch
|
|
456
|
-
return
|
|
460
|
+
return allsecondarySearchJobs;
|
|
457
461
|
}
|
|
458
462
|
async function bindSearchInput(_$w) {
|
|
459
463
|
const primarySearchDebounced = debounce(() => {
|