sr-npm 1.7.718 → 1.7.719

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.718",
3
+ "version": "1.7.719",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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 currentJobsBeforeSecondarySearch=[]
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,
@@ -307,10 +307,15 @@ async function loadJobsRepeater(_$w) {
307
307
  handlePaginationButtons(_$w);
308
308
  }
309
309
 
310
- function handlePaginationButtons(_$w)
310
+ function handlePaginationButtons(_$w,secondarySearch=false)
311
311
  {
312
312
  pagination.currentPage===1? _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PAGE_BUTTON_PREVIOUS).disable():_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PAGE_BUTTON_PREVIOUS).enable();
313
+ if(secondarySearch) {
314
+ 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();
315
+ }
316
+ else {
313
317
  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();
318
+ }
314
319
  }
315
320
  async function refreshFacetCounts(_$w,clearAll=false) {
316
321
  const fieldIds = Array.from(optionsByFieldId.keys());
@@ -356,28 +361,22 @@ function primarySearch(_$w,query) {
356
361
  }
357
362
  function secondarySearch(_$w,query) {
358
363
  console.log("secondary search query: ", query);
359
- if(query.length===0) {
360
- if(currentJobsBeforeSecondarySearch.length>0) {
361
-
362
- currentJobs=currentJobsBeforeSecondarySearch
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));
364
+ if(query.length===0) {
365
+ secondarySearchJobs=currentJobs;
366
+ }
367
+ else {
368
+ secondarySearchJobs=currentJobs.filter(job=>job.title.toLowerCase().includes(query));
369
+ }
371
370
  console.log("current jobs length: ", currentJobs.length);
372
371
  console.log("current jobs: ", currentJobs);
373
- }
374
- const jobsFirstPage=currentJobs.slice(0,pagination.pageSize);
372
+
373
+ const jobsFirstPage=secondarySearchJobs.slice(0,pagination.pageSize);
375
374
  console.log("jobs first page: ", jobsFirstPage);
376
375
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER).data = jobsFirstPage;
377
376
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationCurrentText).text = jobsFirstPage.length.toString();
378
- _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationTotalCountText).text = currentJobs.length.toString();
377
+ _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationTotalCountText).text = secondarySearchJobs.length.toString();
379
378
  pagination.currentPage=1;
380
- handlePaginationButtons(_$w);
379
+ handlePaginationButtons(_$w,true);
381
380
  }
382
381
  function bindSearchInput(_$w) {
383
382
  const primarySearchDebounced = debounce(() => {