sr-npm 1.7.742 → 1.7.744
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 -12
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 = `${currentSecondarySearchJobs.length} Jobs`:
|
|
178
179
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.TotalJobsCountText).text = `${currentJobs.length} Jobs`;
|
|
179
180
|
}
|
|
180
181
|
|
|
@@ -297,7 +298,7 @@ async function loadJobsRepeater(_$w) {
|
|
|
297
298
|
async function applyJobFilters(_$w) {
|
|
298
299
|
let tempFilteredJobs=[];
|
|
299
300
|
let finalFilteredJobs=[];
|
|
300
|
-
secondarySearchIsFilled? finalFilteredJobs=
|
|
301
|
+
secondarySearchIsFilled? finalFilteredJobs=allsecondarySearchJobs:finalFilteredJobs=alljobs;
|
|
301
302
|
let addedJobsIds=[]
|
|
302
303
|
// AND across categories, OR within each category
|
|
303
304
|
for (const [key, values] of selectedByField.entries()) {
|
|
@@ -325,12 +326,13 @@ async function loadJobsRepeater(_$w) {
|
|
|
325
326
|
finalFilteredJobs=tempFilteredJobs;
|
|
326
327
|
tempFilteredJobs=[];
|
|
327
328
|
}
|
|
329
|
+
secondarySearchIsFilled? currentSecondarySearchJobs=finalFilteredJobs:currentJobs=finalFilteredJobs;
|
|
328
330
|
|
|
329
|
-
currentJobs=finalFilteredJobs;
|
|
331
|
+
//currentJobs=finalFilteredJobs;
|
|
330
332
|
const jobsFirstPage=currentJobs.slice(0,pagination.pageSize);
|
|
331
333
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER).data = jobsFirstPage;
|
|
332
334
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationCurrentText).text = jobsFirstPage.length.toString();
|
|
333
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationTotalCountText).text = currentJobs.length.toString();
|
|
335
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationTotalCountText).text = secondarySearchIsFilled? currentSecondarySearchJobs.length.toString():currentJobs.length.toString();
|
|
334
336
|
if(jobsFirstPage.length===0) {
|
|
335
337
|
await _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_MULTI_STATE_BOX).changeState("noJobs");
|
|
336
338
|
}
|
|
@@ -346,7 +348,7 @@ function handlePaginationButtons(_$w)
|
|
|
346
348
|
handlePageUrlParam();
|
|
347
349
|
pagination.currentPage===1? _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PAGE_BUTTON_PREVIOUS).disable():_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PAGE_BUTTON_PREVIOUS).enable();
|
|
348
350
|
if(secondarySearchIsFilled) {
|
|
349
|
-
pagination.currentPage>=Math.ceil(
|
|
351
|
+
pagination.currentPage>=Math.ceil(currentSecondarySearchJobs.length/pagination.pageSize)? _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PAGE_BUTTON_NEXT).disable():_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PAGE_BUTTON_NEXT).enable();
|
|
350
352
|
}
|
|
351
353
|
else {
|
|
352
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();
|
|
@@ -367,7 +369,7 @@ async function refreshFacetCounts(_$w,clearAll=false) {
|
|
|
367
369
|
|
|
368
370
|
console.log("refreshing facet counts");
|
|
369
371
|
|
|
370
|
-
secondarySearchIsFilled? countJobsPerField(
|
|
372
|
+
secondarySearchIsFilled? countJobsPerField(currentSecondarySearchJobs):countJobsPerField(currentJobs);
|
|
371
373
|
// const fieldIds = Array.from(optionsByFieldId.keys());
|
|
372
374
|
// const currentJobsIds=currentJobs.map(job=>job._id);
|
|
373
375
|
// for (const fieldId of fieldIds) {
|
|
@@ -432,17 +434,18 @@ function primarySearch(_$w,query) {
|
|
|
432
434
|
}
|
|
433
435
|
async function secondarySearch(_$w,query) {
|
|
434
436
|
if(query.length===0) {
|
|
435
|
-
|
|
437
|
+
// allsecondarySearchJobs=currentJobs;
|
|
436
438
|
secondarySearchIsFilled=false;
|
|
437
439
|
}
|
|
438
440
|
else {
|
|
439
|
-
|
|
441
|
+
allsecondarySearchJobs=currentJobs.filter(job=>job.title.toLowerCase().includes(query));
|
|
442
|
+
currentSecondarySearchJobs=allsecondarySearchJobs;
|
|
440
443
|
}
|
|
441
444
|
|
|
442
|
-
const jobsFirstPage=
|
|
445
|
+
const jobsFirstPage=allsecondarySearchJobs.slice(0,pagination.pageSize);
|
|
443
446
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER).data = jobsFirstPage;
|
|
444
447
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationCurrentText).text = jobsFirstPage.length.toString();
|
|
445
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationTotalCountText).text =
|
|
448
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationTotalCountText).text = allsecondarySearchJobs.length.toString();
|
|
446
449
|
pagination.currentPage=1;
|
|
447
450
|
if(jobsFirstPage.length===0) {
|
|
448
451
|
await _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_MULTI_STATE_BOX).changeState("noJobs");
|
|
@@ -454,7 +457,7 @@ async function secondarySearch(_$w,query) {
|
|
|
454
457
|
handlePaginationButtons(_$w);
|
|
455
458
|
updateTotalJobsCountText(_$w);
|
|
456
459
|
await refreshFacetCounts(_$w); //false for clearAll, true for secondarySearch
|
|
457
|
-
return
|
|
460
|
+
return allsecondarySearchJobs;
|
|
458
461
|
}
|
|
459
462
|
async function bindSearchInput(_$w) {
|
|
460
463
|
const primarySearchDebounced = debounce(() => {
|