sr-npm 1.7.717 → 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.717",
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,22 +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
- currentJobs=currentJobsBeforeSecondarySearch
362
- }
363
- }
364
- else
365
- {
366
- currentJobsBeforeSecondarySearch=currentJobs;
367
- currentJobs=currentJobs.filter(job=>job.title.toLowerCase().includes(query));
368
- }
369
- const jobsFirstPage=currentJobs.slice(0,pagination.pageSize);
364
+ if(query.length===0) {
365
+ secondarySearchJobs=currentJobs;
366
+ }
367
+ else {
368
+ secondarySearchJobs=currentJobs.filter(job=>job.title.toLowerCase().includes(query));
369
+ }
370
+ console.log("current jobs length: ", currentJobs.length);
371
+ console.log("current jobs: ", currentJobs);
372
+
373
+ const jobsFirstPage=secondarySearchJobs.slice(0,pagination.pageSize);
374
+ console.log("jobs first page: ", jobsFirstPage);
370
375
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER).data = jobsFirstPage;
371
376
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationCurrentText).text = jobsFirstPage.length.toString();
372
- _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationTotalCountText).text = currentJobs.length.toString();
377
+ _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationTotalCountText).text = secondarySearchJobs.length.toString();
373
378
  pagination.currentPage=1;
374
- handlePaginationButtons(_$w);
379
+ handlePaginationButtons(_$w,true);
375
380
  }
376
381
  function bindSearchInput(_$w) {
377
382
  const primarySearchDebounced = debounce(() => {