sr-npm 1.7.740 → 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 +15 -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,12 +362,11 @@ function handlePageUrlParam() {
|
|
|
360
362
|
}
|
|
361
363
|
|
|
362
364
|
}
|
|
363
|
-
async function refreshFacetCounts(_$w,clearAll=false
|
|
365
|
+
async function refreshFacetCounts(_$w,clearAll=false) {
|
|
364
366
|
|
|
365
367
|
console.log("refreshing facet counts");
|
|
366
368
|
|
|
367
|
-
|
|
368
|
-
secondarySearch? countJobsPerField(secondarySearchJobs):countJobsPerField(currentJobs);
|
|
369
|
+
secondarySearchIsFilled? countJobsPerField(secondarySearchJobs):countJobsPerField(currentJobs);
|
|
369
370
|
// const fieldIds = Array.from(optionsByFieldId.keys());
|
|
370
371
|
// const currentJobsIds=currentJobs.map(job=>job._id);
|
|
371
372
|
// for (const fieldId of fieldIds) {
|
|
@@ -431,6 +432,7 @@ function primarySearch(_$w,query) {
|
|
|
431
432
|
async function secondarySearch(_$w,query) {
|
|
432
433
|
if(query.length===0) {
|
|
433
434
|
secondarySearchJobs=currentJobs;
|
|
435
|
+
secondarySearchIsFilled=false;
|
|
434
436
|
}
|
|
435
437
|
else {
|
|
436
438
|
secondarySearchJobs=currentJobs.filter(job=>job.title.toLowerCase().includes(query));
|
|
@@ -447,9 +449,10 @@ async function secondarySearch(_$w,query) {
|
|
|
447
449
|
else{
|
|
448
450
|
await _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_MULTI_STATE_BOX).changeState("searchResult");
|
|
449
451
|
}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
452
|
+
secondarySearchIsFilled=true
|
|
453
|
+
handlePaginationButtons(_$w);
|
|
454
|
+
updateTotalJobsCountText(_$w);
|
|
455
|
+
await refreshFacetCounts(_$w); //false for clearAll, true for secondarySearch
|
|
453
456
|
return secondarySearchJobs;
|
|
454
457
|
}
|
|
455
458
|
async function bindSearchInput(_$w) {
|