sr-npm 1.7.695 → 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 +1 -1
- package/pages/careersMultiBoxesPage.js +6 -20
- package/pages/index.js +1 -0
- package/pages/pagesUtils.js +16 -0
package/package.json
CHANGED
|
@@ -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,23 +33,17 @@ 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
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
40
|
handlePaginationButtons(_$w);
|
|
44
41
|
});
|
|
45
42
|
|
|
46
43
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PAGE_BUTTON_PREVIOUS).onClick(async () => {
|
|
47
|
-
console.log("previous page button clicked");
|
|
48
|
-
console.log("current page: ", pagination.currentPage);
|
|
49
44
|
let previousPageJobs=currentJobs.slice(pagination.pageSize*(pagination.currentPage-1),pagination.pageSize*pagination.currentPage);
|
|
50
45
|
pagination.currentPage--;
|
|
51
46
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationCurrentText).text = (pagination.pageSize*pagination.currentPage).toString();
|
|
52
|
-
console.log("previous page ", pagination.currentPage);
|
|
53
47
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER).data = previousPageJobs;
|
|
54
48
|
handlePaginationButtons(_$w);
|
|
55
49
|
});
|
|
@@ -117,13 +111,14 @@ async function loadJobsRepeater(_$w) {
|
|
|
117
111
|
|
|
118
112
|
const jobsFirstPage=alljobs.slice(0,pagination.pageSize);
|
|
119
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();
|
|
120
116
|
updateTotalJobsCountText(_$w);
|
|
121
117
|
handlePaginationButtons(_$w);
|
|
122
118
|
}
|
|
123
119
|
|
|
124
120
|
function updateTotalJobsCountText(_$w) {
|
|
125
121
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.TotalJobsCountText).text = `${currentJobs.length} Jobs`;
|
|
126
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationTotalCountText).text = currentJobs.length.toString();
|
|
127
122
|
}
|
|
128
123
|
|
|
129
124
|
async function loadFilters(_$w) {
|
|
@@ -293,6 +288,8 @@ async function loadJobsRepeater(_$w) {
|
|
|
293
288
|
currentJobs=finalFilteredJobs;
|
|
294
289
|
const jobsFirstPage=currentJobs.slice(0,pagination.pageSize);
|
|
295
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();
|
|
296
293
|
pagination.currentPage=1;
|
|
297
294
|
handlePaginationButtons(_$w);
|
|
298
295
|
}
|
|
@@ -325,18 +322,7 @@ async function refreshFacetCounts(_$w,clearAll=false) {
|
|
|
325
322
|
}
|
|
326
323
|
}
|
|
327
324
|
|
|
328
|
-
|
|
329
|
-
const map = new Map();
|
|
330
|
-
for (const v of values) {
|
|
331
|
-
const ref = v[refKey]; // should be the _id of the CustomFields item
|
|
332
|
-
if (!map.has(ref)) map.set(ref, []);
|
|
333
|
-
map.get(ref).push({
|
|
334
|
-
label: v.title ,
|
|
335
|
-
value: v._id
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
return map;
|
|
339
|
-
}
|
|
325
|
+
|
|
340
326
|
|
|
341
327
|
function updateSelectedValuesRepeater(_$w) {
|
|
342
328
|
const selectedItems = [];
|
package/pages/index.js
CHANGED
|
@@ -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
|
+
}
|