sr-npm 1.7.694 → 1.7.696

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.694",
3
+ "version": "1.7.696",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,7 +1,7 @@
1
1
  const { COLLECTIONS,CUSTOM_VALUES_COLLECTION_FIELDS,JOBS_COLLECTION_FIELDS } = require('../backend/collectionConsts');
2
2
  const { items: wixData } = require('@wix/data');
3
3
  const {CAREERS_MULTI_BOXES_PAGE_CONSTS,FiltersIds} = require('../backend/careersMultiBoxesPageIds');
4
-
4
+ const { groupValuesByField } = require('./pagesUtils');
5
5
  let valuesByFieldIdGlobal = null;
6
6
  let dontUpdateThisCheckBox;
7
7
  const selectedByField = new Map(); // fieldId -> array of selected value IDs
@@ -33,27 +33,18 @@ async function careersMultiBoxesPageOnReady(_$w) {
33
33
 
34
34
  async function loadPaginationButtons(_$w) {
35
35
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PAGE_BUTTON_NEXT).onClick(async () => {
36
- console.log("next page button clicked");
37
- console.log("current page: ", pagination.currentPage);
38
36
  let nextPageJobs=currentJobs.slice(pagination.pageSize*pagination.currentPage,pagination.pageSize*(pagination.currentPage+1));
39
- _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationCurrentText).text = nextPageJobs.length+pagination.pageSize*pagination.currentPage;
37
+ _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationCurrentText).text = (nextPageJobs.length+pagination.pageSize*pagination.currentPage).toString();
40
38
  pagination.currentPage++;
41
- console.log("next page ", pagination.currentPage);
42
39
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER).data = nextPageJobs;
43
-
44
-
45
40
  handlePaginationButtons(_$w);
46
41
  });
47
42
 
48
43
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PAGE_BUTTON_PREVIOUS).onClick(async () => {
49
- console.log("previous page button clicked");
50
- console.log("current page: ", pagination.currentPage);
51
44
  let previousPageJobs=currentJobs.slice(pagination.pageSize*(pagination.currentPage-1),pagination.pageSize*pagination.currentPage);
52
45
  pagination.currentPage--;
53
- _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationCurrentText).text = pagination.pageSize*pagination.currentPage;
54
- console.log("previous page ", pagination.currentPage);
46
+ _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationCurrentText).text = (pagination.pageSize*pagination.currentPage).toString();
55
47
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER).data = previousPageJobs;
56
-
57
48
  handlePaginationButtons(_$w);
58
49
  });
59
50
  }
@@ -120,13 +111,14 @@ async function loadJobsRepeater(_$w) {
120
111
 
121
112
  const jobsFirstPage=alljobs.slice(0,pagination.pageSize);
122
113
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER).data = jobsFirstPage;
114
+ _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationCurrentText).text = jobsFirstPage.length.toString();
115
+ _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationTotalCountText).text = currentJobs.length.toString();
123
116
  updateTotalJobsCountText(_$w);
124
117
  handlePaginationButtons(_$w);
125
118
  }
126
119
 
127
120
  function updateTotalJobsCountText(_$w) {
128
121
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.TotalJobsCountText).text = `${currentJobs.length} Jobs`;
129
- _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationTotalCountText).text = currentJobs.length
130
122
  }
131
123
 
132
124
  async function loadFilters(_$w) {
@@ -296,6 +288,8 @@ async function loadJobsRepeater(_$w) {
296
288
  currentJobs=finalFilteredJobs;
297
289
  const jobsFirstPage=currentJobs.slice(0,pagination.pageSize);
298
290
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER).data = jobsFirstPage;
291
+ _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationCurrentText).text = jobsFirstPage.length.toString();
292
+ _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationTotalCountText).text = currentJobs.length.toString();
299
293
  pagination.currentPage=1;
300
294
  handlePaginationButtons(_$w);
301
295
  }
@@ -328,18 +322,7 @@ async function refreshFacetCounts(_$w,clearAll=false) {
328
322
  }
329
323
  }
330
324
 
331
- function groupValuesByField(values, refKey) {
332
- const map = new Map();
333
- for (const v of values) {
334
- const ref = v[refKey]; // should be the _id of the CustomFields item
335
- if (!map.has(ref)) map.set(ref, []);
336
- map.get(ref).push({
337
- label: v.title ,
338
- value: v._id
339
- });
340
- }
341
- return map;
342
- }
325
+
343
326
 
344
327
  function updateSelectedValuesRepeater(_$w) {
345
328
  const selectedItems = [];
package/pages/index.js CHANGED
@@ -3,5 +3,6 @@ module.exports = {
3
3
  ...require('./homePage'),
4
4
  ...require('./careersPage'),
5
5
  ...require('./careersMultiBoxesPage'),
6
+ ...require('./pagesUtils'),
6
7
  };
7
8
 
@@ -0,0 +1,16 @@
1
+ function groupValuesByField(values, refKey) {
2
+ const map = new Map();
3
+ for (const v of values) {
4
+ const ref = v[refKey]; // should be the _id of the CustomFields item
5
+ if (!map.has(ref)) map.set(ref, []);
6
+ map.get(ref).push({
7
+ label: v.title ,
8
+ value: v._id
9
+ });
10
+ }
11
+ return map;
12
+ }
13
+
14
+ module.exports = {
15
+ groupValuesByField,
16
+ }