sr-npm 1.7.1236 → 1.7.1243

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.1236",
3
+ "version": "1.7.1243",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -30,6 +30,7 @@ const countsByFieldId = new Map(); // fieldId -> {valueId: count} map of counts
30
30
  let allfields=[] // all fields in the database
31
31
  let alljobs=[] // all jobs in the database
32
32
  let allvaluesobjects=[] // all values in the database
33
+ let cities=[] // all cities in the database
33
34
  let valueToJobs={} // valueId -> array of jobIds
34
35
  let currentJobs=[] // current jobs that are displayed in the jobs repeater
35
36
  let allsecondarySearchJobs=[] // secondary search results that are displayed in the jobs repeater
@@ -83,7 +84,6 @@ async function handleBackAndForth(_$w){
83
84
  }
84
85
 
85
86
  async function clearAll(_$w,urlOnChange=false) {
86
- if(selectedByField.size>0 || _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SECONDARY_SEARCH_INPUT).value || _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value) {
87
87
 
88
88
  for(const field of allfields) {
89
89
  _$w(`#${FiltersIds[field.title]}CheckBox`).selectedIndices = [];
@@ -95,7 +95,6 @@ async function clearAll(_$w,urlOnChange=false) {
95
95
  secondarySearchIsFilled=false;
96
96
  currentJobs=alljobs;
97
97
  keywordAllJobs=undefined;
98
-
99
98
  if(!urlOnChange) {
100
99
  console.log("inside clearAll removing url params");
101
100
  ActivateURLOnchange=false;
@@ -104,7 +103,6 @@ async function clearAll(_$w,urlOnChange=false) {
104
103
  await updateJobsAndNumbersAndFilters(_$w,true);
105
104
  }
106
105
 
107
- }
108
106
  }
109
107
 
110
108
  function handleFilterInMobile(_$w) {
@@ -366,7 +364,7 @@ async function loadJobsRepeater(_$w) {
366
364
  async function loadFilters(_$w) {
367
365
  try {
368
366
  // 1) Load all categories (fields)
369
- const cities = await getAllRecords(COLLECTIONS.CITIES);
367
+ cities = await getAllRecords(COLLECTIONS.CITIES);
370
368
  for(const city of cities) {
371
369
  valueToJobs[city._id] = city.jobIds;
372
370
  }
@@ -482,8 +480,13 @@ function getValueFromValueId(valueIds, value) {
482
480
  {
483
481
  const selectedFieldId=Array.from( selectedByField.keys() )[0]
484
482
  if(selectedFieldId===fieldId) {
483
+ if(selectedFieldId==="Location") {
484
+ countsMap = new Map(cities.map(city=>[city._id, city.count]));
485
+ }
486
+ else{
485
487
  const relevantFields=allvaluesobjects.filter(val=>val.customField===selectedFieldId)
486
488
  countsMap = new Map(relevantFields.map(val=>[val.valueId, val.count]));
489
+ }
487
490
  considerAllJobs=false;
488
491
  }
489
492
  }
@@ -593,11 +596,14 @@ function getValueFromValueId(valueIds, value) {
593
596
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationTotalCountText).text = secondarySearchIsFilled? Math.ceil(currentSecondarySearchJobs.length/pagination.pageSize).toString():Math.ceil(currentJobs.length/pagination.pageSize).toString();
594
597
  if(jobsFirstPage.length===0) {
595
598
  await _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_MULTI_STATE_BOX).changeState("noJobs");
599
+ _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationCurrentText).text = "0";
600
+ pagination.currentPage=0;
596
601
  }
597
602
  else{
598
603
  await _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_MULTI_STATE_BOX).changeState("searchResult");
604
+ pagination.currentPage=1;
599
605
  }
600
- pagination.currentPage=1;
606
+
601
607
  handlePaginationButtons(_$w);
602
608
  }
603
609
 
@@ -605,7 +611,7 @@ function handlePaginationButtons(_$w)
605
611
  {
606
612
  handlePageUrlParam();
607
613
 
608
- pagination.currentPage===1? _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PAGE_BUTTON_PREVIOUS).disable():_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PAGE_BUTTON_PREVIOUS).enable();
614
+ pagination.currentPage===1 || pagination.currentPage===0? _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PAGE_BUTTON_PREVIOUS).disable():_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PAGE_BUTTON_PREVIOUS).enable();
609
615
  if(secondarySearchIsFilled) {
610
616
  if(currentSecondarySearchJobs.length===0) {
611
617
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PAGE_BUTTON_NEXT).disable();
@@ -706,6 +712,8 @@ async function secondarySearch(_$w,query) {
706
712
 
707
713
  if(jobsFirstPage.length===0) {
708
714
  await _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_MULTI_STATE_BOX).changeState("noJobs");
715
+ _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationCurrentText).text = "0";
716
+ pagination.currentPage=0;
709
717
  }
710
718
  else{
711
719
  await _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_MULTI_STATE_BOX).changeState("searchResult");