sr-npm 1.7.718 → 1.7.720
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 +20 -18
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@ 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 secondarySearchJobs=[] // secondary search results that are displayed in the jobs repeater
|
|
16
16
|
const pagination = {
|
|
17
17
|
pageSize: 10,
|
|
18
18
|
currentPage: 1,
|
|
@@ -25,6 +25,9 @@ async function careersMultiBoxesPageOnReady(_$w,urlParams) {
|
|
|
25
25
|
await bindSearchInput(_$w);
|
|
26
26
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.CLEAR_ALL_BUTTON_ID).onClick(async () => {
|
|
27
27
|
if(selectedByField.size>0) {
|
|
28
|
+
for(const field of allfields) {
|
|
29
|
+
_$w(`#${FiltersIds[field.title]}CheckBox`).selectedIndices = [];
|
|
30
|
+
}
|
|
28
31
|
selectedByField.clear();
|
|
29
32
|
await updateJobsAndNumbersAndFilters(_$w,true);
|
|
30
33
|
}
|
|
@@ -307,10 +310,15 @@ async function loadJobsRepeater(_$w) {
|
|
|
307
310
|
handlePaginationButtons(_$w);
|
|
308
311
|
}
|
|
309
312
|
|
|
310
|
-
function handlePaginationButtons(_$w)
|
|
313
|
+
function handlePaginationButtons(_$w,secondarySearch=false)
|
|
311
314
|
{
|
|
312
315
|
pagination.currentPage===1? _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PAGE_BUTTON_PREVIOUS).disable():_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PAGE_BUTTON_PREVIOUS).enable();
|
|
316
|
+
if(secondarySearch) {
|
|
317
|
+
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();
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
313
320
|
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();
|
|
321
|
+
}
|
|
314
322
|
}
|
|
315
323
|
async function refreshFacetCounts(_$w,clearAll=false) {
|
|
316
324
|
const fieldIds = Array.from(optionsByFieldId.keys());
|
|
@@ -356,28 +364,22 @@ function primarySearch(_$w,query) {
|
|
|
356
364
|
}
|
|
357
365
|
function secondarySearch(_$w,query) {
|
|
358
366
|
console.log("secondary search query: ", query);
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
else
|
|
366
|
-
{
|
|
367
|
-
currentJobsBeforeSecondarySearch=currentJobs;
|
|
368
|
-
console.log("current jobs before secondary search length: ", currentJobsBeforeSecondarySearch.length);
|
|
369
|
-
console.log("current jobs before secondary search: ", currentJobsBeforeSecondarySearch);
|
|
370
|
-
currentJobs=currentJobs.filter(job=>job.title.toLowerCase().includes(query));
|
|
367
|
+
if(query.length===0) {
|
|
368
|
+
secondarySearchJobs=currentJobs;
|
|
369
|
+
}
|
|
370
|
+
else {
|
|
371
|
+
secondarySearchJobs=currentJobs.filter(job=>job.title.toLowerCase().includes(query));
|
|
372
|
+
}
|
|
371
373
|
console.log("current jobs length: ", currentJobs.length);
|
|
372
374
|
console.log("current jobs: ", currentJobs);
|
|
373
|
-
|
|
374
|
-
const jobsFirstPage=
|
|
375
|
+
|
|
376
|
+
const jobsFirstPage=secondarySearchJobs.slice(0,pagination.pageSize);
|
|
375
377
|
console.log("jobs first page: ", jobsFirstPage);
|
|
376
378
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER).data = jobsFirstPage;
|
|
377
379
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationCurrentText).text = jobsFirstPage.length.toString();
|
|
378
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationTotalCountText).text =
|
|
380
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationTotalCountText).text = secondarySearchJobs.length.toString();
|
|
379
381
|
pagination.currentPage=1;
|
|
380
|
-
handlePaginationButtons(_$w);
|
|
382
|
+
handlePaginationButtons(_$w,true);
|
|
381
383
|
}
|
|
382
384
|
function bindSearchInput(_$w) {
|
|
383
385
|
const primarySearchDebounced = debounce(() => {
|