sr-npm 1.7.673 → 1.7.674
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
|
@@ -138,11 +138,33 @@ async function loadJobs(_$w) {
|
|
|
138
138
|
valuesByFieldId.set("Location",cities)
|
|
139
139
|
valuesByFieldIdGlobal = valuesByFieldId; // store globally
|
|
140
140
|
console.log("valuesByFieldId: @$##@$@##$ ",valuesByFieldId)
|
|
141
|
+
|
|
142
|
+
// Build CheckboxGroup options for this field
|
|
143
|
+
|
|
141
144
|
|
|
142
145
|
for(const [key, value] of valuesByFieldId) {
|
|
143
146
|
console.log("elemenet: ",key)
|
|
144
147
|
for(const field of fields) {
|
|
145
148
|
if(field._id===key && field.title==="Category") {
|
|
149
|
+
let originalOptions=[];
|
|
150
|
+
if(key==="Location") {
|
|
151
|
+
originalOptions=value.map(city=>({
|
|
152
|
+
label: city.city,
|
|
153
|
+
value: city._id
|
|
154
|
+
}));
|
|
155
|
+
}
|
|
156
|
+
else{
|
|
157
|
+
originalOptions=value
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
optionsByFieldId.set(key, originalOptions);
|
|
161
|
+
const counter={}
|
|
162
|
+
|
|
163
|
+
for (const val of allvaluesobjects) {
|
|
164
|
+
counter[val.title]=val.totalJobs
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
countsByFieldId.set(key, new Map(originalOptions.map(o => [o.value, counter[o.label]])));
|
|
146
168
|
updateOptionsUI(_$w,field.title, field._id, ''); // no search query
|
|
147
169
|
console.log("field: ",field)
|
|
148
170
|
console.log("elemenet: ",key)
|
|
@@ -154,7 +176,7 @@ async function loadJobs(_$w) {
|
|
|
154
176
|
if (selected && selected.length) {
|
|
155
177
|
selectedByField.set(field._id, selected);
|
|
156
178
|
} else {
|
|
157
|
-
selectedByField.delete(field._id);
|
|
179
|
+
selectedByField.delete(field._id);
|
|
158
180
|
}
|
|
159
181
|
await applyJobFilters(_$w,field._id); // re-query jobs
|
|
160
182
|
await refreshFacetCounts(_$w,field.title); // recompute and update counts in all lists
|
|
@@ -259,6 +281,9 @@ async function loadJobs(_$w) {
|
|
|
259
281
|
|
|
260
282
|
|
|
261
283
|
// });
|
|
284
|
+
for(const city of cities) {
|
|
285
|
+
counter[city.city]=city.count
|
|
286
|
+
}
|
|
262
287
|
} catch (err) {
|
|
263
288
|
console.error('Failed to load filters:', err);
|
|
264
289
|
}
|
|
@@ -290,6 +315,7 @@ async function loadJobs(_$w) {
|
|
|
290
315
|
|
|
291
316
|
function updateOptionsUI(_$w,fieldTitle, fieldId, searchQuery) {
|
|
292
317
|
let base = optionsByFieldId.get(fieldId) || [];
|
|
318
|
+
console.log("base: ",base)
|
|
293
319
|
const countsMap = countsByFieldId.get(fieldId) || new Map();
|
|
294
320
|
if(dontUpdateThisCheckBox===fieldId)
|
|
295
321
|
{
|