sr-npm 1.7.651 → 1.7.653
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 +35 -13
package/package.json
CHANGED
|
@@ -91,7 +91,10 @@ async function loadJobs(_$w) {
|
|
|
91
91
|
console.log("cities: ",cities)
|
|
92
92
|
// 2) Load all values once and group them by referenced field
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
let valuesByFieldId = groupValuesByField(allvaluesobjects, CUSTOM_VALUES_COLLECTION_FIELDS.CUSTOM_FIELD);
|
|
95
|
+
console.log("valuesByFieldId: ",valuesByFieldId)
|
|
96
|
+
valuesByFieldId.set("Location",cities)
|
|
97
|
+
console.log("valuesByFieldId after addubg cities: ",valuesByFieldId)
|
|
95
98
|
valuesByFieldIdGlobal = valuesByFieldId; // store globally
|
|
96
99
|
|
|
97
100
|
|
|
@@ -105,25 +108,42 @@ async function loadJobs(_$w) {
|
|
|
105
108
|
// Set the filter label (category name)
|
|
106
109
|
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_LABEL).placeholder = itemData.title
|
|
107
110
|
|
|
108
|
-
if(fieldId==="Location") {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
111
|
+
// if(fieldId==="Location") {
|
|
112
|
+
// $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER_ITEM_CHECKBOX).options = cities.map(city=>({
|
|
113
|
+
// label: city.city,
|
|
114
|
+
// value: city._id
|
|
115
|
+
// }));
|
|
116
|
+
// }
|
|
114
117
|
|
|
115
118
|
// Build CheckboxGroup options for this field
|
|
116
119
|
const fieldValues = valuesByFieldId.get(fieldId) || [];
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
console.log("fieldValues: ",fieldValues)
|
|
121
|
+
let originalOptions=[];
|
|
122
|
+
if(fieldId==="Location") {
|
|
123
|
+
originalOptions=fieldValues.map(city=>({
|
|
124
|
+
label: city.city,
|
|
125
|
+
value: city._id
|
|
126
|
+
}));
|
|
127
|
+
}
|
|
128
|
+
else{
|
|
129
|
+
originalOptions=fieldValues
|
|
130
|
+
}
|
|
131
|
+
console.log("originalOptions: ",originalOptions)
|
|
132
|
+
// else{
|
|
133
|
+
// originalOptions = fieldValues.map(v => ({
|
|
134
|
+
// label: v.title ,
|
|
135
|
+
// value: v._id
|
|
136
|
+
// }));
|
|
137
|
+
// }
|
|
121
138
|
optionsByFieldId.set(fieldId, originalOptions);
|
|
122
139
|
const counter={}
|
|
123
140
|
|
|
124
141
|
for (const val of allvaluesobjects) {
|
|
125
142
|
counter[val.title]=val.totalJobs
|
|
126
143
|
}
|
|
144
|
+
for(const city of cities) {
|
|
145
|
+
counter[city.city]=city.count
|
|
146
|
+
}
|
|
127
147
|
|
|
128
148
|
countsByFieldId.set(fieldId, new Map(originalOptions.map(o => [o.value, counter[o.label]])));
|
|
129
149
|
|
|
@@ -284,9 +304,11 @@ async function refreshFacetCounts(_$w) {
|
|
|
284
304
|
const map = new Map();
|
|
285
305
|
for (const v of values) {
|
|
286
306
|
const ref = v[refKey]; // should be the _id of the CustomFields item
|
|
287
|
-
if (!ref) continue;
|
|
288
307
|
if (!map.has(ref)) map.set(ref, []);
|
|
289
|
-
map.get(ref).push(
|
|
308
|
+
map.get(ref).push({
|
|
309
|
+
label: v.title ,
|
|
310
|
+
value: v._id
|
|
311
|
+
});
|
|
290
312
|
}
|
|
291
313
|
return map;
|
|
292
314
|
}
|