sr-npm 1.7.739 → 1.7.741
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 +16 -12
package/package.json
CHANGED
|
@@ -13,6 +13,7 @@ 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
15
|
let secondarySearchJobs=[] // secondary search results that are displayed in the jobs repeater
|
|
16
|
+
let secondarySearchIsFilled=false // whether the secondary search is filled with results
|
|
16
17
|
const pagination = {
|
|
17
18
|
pageSize: 10,
|
|
18
19
|
currentPage: 1,
|
|
@@ -31,6 +32,7 @@ async function careersMultiBoxesPageOnReady(_$w,urlParams) {
|
|
|
31
32
|
}
|
|
32
33
|
selectedByField.clear();
|
|
33
34
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SECONDARY_SEARCH_INPUT).value='';
|
|
35
|
+
secondarySearchIsFilled=false;
|
|
34
36
|
await updateJobsAndNumbersAndFilters(_$w,true);
|
|
35
37
|
}
|
|
36
38
|
});
|
|
@@ -171,8 +173,8 @@ async function loadJobsRepeater(_$w) {
|
|
|
171
173
|
handlePaginationButtons(_$w);
|
|
172
174
|
}
|
|
173
175
|
|
|
174
|
-
function updateTotalJobsCountText(_$w
|
|
175
|
-
|
|
176
|
+
function updateTotalJobsCountText(_$w) {
|
|
177
|
+
secondarySearchIsFilled? _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.TotalJobsCountText).text = `${secondarySearchJobs.length} Jobs`:
|
|
176
178
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.TotalJobsCountText).text = `${currentJobs.length} Jobs`;
|
|
177
179
|
}
|
|
178
180
|
|
|
@@ -245,9 +247,9 @@ async function loadJobsRepeater(_$w) {
|
|
|
245
247
|
|
|
246
248
|
|
|
247
249
|
|
|
248
|
-
async function updateJobsAndNumbersAndFilters(_$w) {
|
|
250
|
+
async function updateJobsAndNumbersAndFilters(_$w,clearAll=false) {
|
|
249
251
|
await applyJobFilters(_$w); // re-query jobs
|
|
250
|
-
await refreshFacetCounts(_$w); // recompute and update counts in all lists
|
|
252
|
+
await refreshFacetCounts(_$w,clearAll); // recompute and update counts in all lists
|
|
251
253
|
await updateSelectedValuesRepeater(_$w);
|
|
252
254
|
updateTotalJobsCountText(_$w);
|
|
253
255
|
}
|
|
@@ -338,11 +340,11 @@ async function loadJobsRepeater(_$w) {
|
|
|
338
340
|
handlePaginationButtons(_$w);
|
|
339
341
|
}
|
|
340
342
|
|
|
341
|
-
function handlePaginationButtons(_$w
|
|
343
|
+
function handlePaginationButtons(_$w)
|
|
342
344
|
{
|
|
343
345
|
handlePageUrlParam();
|
|
344
346
|
pagination.currentPage===1? _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PAGE_BUTTON_PREVIOUS).disable():_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PAGE_BUTTON_PREVIOUS).enable();
|
|
345
|
-
if(
|
|
347
|
+
if(secondarySearchIsFilled) {
|
|
346
348
|
pagination.currentPage>=Math.ceil(secondarySearchJobs.length/pagination.pageSize)? _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PAGE_BUTTON_NEXT).disable():_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PAGE_BUTTON_NEXT).enable();
|
|
347
349
|
}
|
|
348
350
|
else {
|
|
@@ -360,11 +362,11 @@ function handlePageUrlParam() {
|
|
|
360
362
|
}
|
|
361
363
|
|
|
362
364
|
}
|
|
363
|
-
async function refreshFacetCounts(_$w,clearAll=false
|
|
365
|
+
async function refreshFacetCounts(_$w,clearAll=false) {
|
|
366
|
+
|
|
364
367
|
console.log("refreshing facet counts");
|
|
365
368
|
|
|
366
|
-
|
|
367
|
-
secondarySearch? countJobsPerField(secondarySearchJobs):countJobsPerField(currentJobs);
|
|
369
|
+
secondarySearchIsFilled? countJobsPerField(secondarySearchJobs):countJobsPerField(currentJobs);
|
|
368
370
|
// const fieldIds = Array.from(optionsByFieldId.keys());
|
|
369
371
|
// const currentJobsIds=currentJobs.map(job=>job._id);
|
|
370
372
|
// for (const fieldId of fieldIds) {
|
|
@@ -430,6 +432,7 @@ function primarySearch(_$w,query) {
|
|
|
430
432
|
async function secondarySearch(_$w,query) {
|
|
431
433
|
if(query.length===0) {
|
|
432
434
|
secondarySearchJobs=currentJobs;
|
|
435
|
+
secondarySearchIsFilled=false;
|
|
433
436
|
}
|
|
434
437
|
else {
|
|
435
438
|
secondarySearchJobs=currentJobs.filter(job=>job.title.toLowerCase().includes(query));
|
|
@@ -446,9 +449,10 @@ async function secondarySearch(_$w,query) {
|
|
|
446
449
|
else{
|
|
447
450
|
await _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_MULTI_STATE_BOX).changeState("searchResult");
|
|
448
451
|
}
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
+
secondarySearchIsFilled=true
|
|
453
|
+
handlePaginationButtons(_$w);
|
|
454
|
+
updateTotalJobsCountText(_$w);
|
|
455
|
+
await refreshFacetCounts(_$w); //false for clearAll, true for secondarySearch
|
|
452
456
|
return secondarySearchJobs;
|
|
453
457
|
}
|
|
454
458
|
async function bindSearchInput(_$w) {
|