sr-npm 1.7.671 → 1.7.673
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 +36 -19
package/package.json
CHANGED
|
@@ -137,18 +137,18 @@ async function loadJobs(_$w) {
|
|
|
137
137
|
let valuesByFieldId = groupValuesByField(allvaluesobjects, CUSTOM_VALUES_COLLECTION_FIELDS.CUSTOM_FIELD);
|
|
138
138
|
valuesByFieldId.set("Location",cities)
|
|
139
139
|
valuesByFieldIdGlobal = valuesByFieldId; // store globally
|
|
140
|
-
console.log("valuesByFieldId: ",valuesByFieldId)
|
|
140
|
+
console.log("valuesByFieldId: @$##@$@##$ ",valuesByFieldId)
|
|
141
141
|
|
|
142
|
-
for(const
|
|
143
|
-
console.log("elemenet: ",
|
|
142
|
+
for(const [key, value] of valuesByFieldId) {
|
|
143
|
+
console.log("elemenet: ",key)
|
|
144
144
|
for(const field of fields) {
|
|
145
|
-
if(field._id===
|
|
145
|
+
if(field._id===key && field.title==="Category") {
|
|
146
146
|
updateOptionsUI(_$w,field.title, field._id, ''); // no search query
|
|
147
147
|
console.log("field: ",field)
|
|
148
|
-
console.log("elemenet: ",
|
|
149
|
-
console.log("valuesByFieldId.get(elemenet): ",valuesByFieldId.get(
|
|
148
|
+
console.log("elemenet: ",key)
|
|
149
|
+
console.log("valuesByFieldId.get(elemenet): ",valuesByFieldId.get(key))
|
|
150
150
|
//_$w("#CategoryCheckBox").options = valuesByFieldId.get(elemenet);
|
|
151
|
-
_$w(
|
|
151
|
+
_$w(`#${field.title}CheckBox`).onChange(async (ev) => {
|
|
152
152
|
dontUpdateThisCheckBox=field._id;
|
|
153
153
|
const selected = ev.target.value; // array of selected value IDs
|
|
154
154
|
if (selected && selected.length) {
|
|
@@ -157,15 +157,16 @@ async function loadJobs(_$w) {
|
|
|
157
157
|
selectedByField.delete(field._id);
|
|
158
158
|
}
|
|
159
159
|
await applyJobFilters(_$w,field._id); // re-query jobs
|
|
160
|
-
|
|
160
|
+
await refreshFacetCounts(_$w,field.title); // recompute and update counts in all lists
|
|
161
161
|
// await updateSelectedValuesRepeater(_$w);
|
|
162
162
|
updateTotalJobsCountText(_$w);
|
|
163
163
|
});
|
|
164
|
-
|
|
165
|
-
const
|
|
164
|
+
|
|
165
|
+
const runFilter = debounce(() => {
|
|
166
|
+
const query = (_$w(`#${field.title}input`).value || '').toLowerCase().trim();
|
|
166
167
|
updateOptionsUI(_$w, field.title, field._id, query);
|
|
167
168
|
}, 150);
|
|
168
|
-
|
|
169
|
+
_$w(`#${field.title}input`).onInput(runFilter);
|
|
169
170
|
found=true;
|
|
170
171
|
break;
|
|
171
172
|
}
|
|
@@ -175,6 +176,15 @@ async function loadJobs(_$w) {
|
|
|
175
176
|
}
|
|
176
177
|
}
|
|
177
178
|
|
|
179
|
+
await refreshFacetCounts(_$w);
|
|
180
|
+
// _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER).forEachItem(($item, itemData) => {
|
|
181
|
+
// const query = ($item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_LABEL).value || '').toLowerCase().trim();
|
|
182
|
+
// updateOptionsUI($item, itemData._id, query);
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
178
188
|
//
|
|
179
189
|
|
|
180
190
|
|
|
@@ -309,12 +319,15 @@ async function loadJobs(_$w) {
|
|
|
309
319
|
|
|
310
320
|
// Preserve currently selected values that are still visible
|
|
311
321
|
// const prevSelected = $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER_ITEM_CHECKBOX).value || [];
|
|
312
|
-
const prevSelected = _$w(
|
|
322
|
+
const prevSelected = _$w(`#${fieldTitle}CheckBox`).value || [];
|
|
313
323
|
const visibleSet = new Set(filtered.map(o => o.value));
|
|
314
324
|
const preserved = prevSelected.filter(v => visibleSet.has(v));
|
|
325
|
+
console.log("preserved: ",preserved)
|
|
326
|
+
console.log("filtered: ",filtered)
|
|
327
|
+
console.log("fieldTitle: ",fieldTitle)
|
|
315
328
|
|
|
316
|
-
_$w(
|
|
317
|
-
_$w(
|
|
329
|
+
_$w(`#${fieldTitle}CheckBox`).options = filtered;
|
|
330
|
+
_$w(`#${fieldTitle}CheckBox`).value = preserved;
|
|
318
331
|
|
|
319
332
|
}
|
|
320
333
|
|
|
@@ -355,7 +368,7 @@ async function loadJobs(_$w) {
|
|
|
355
368
|
}
|
|
356
369
|
|
|
357
370
|
|
|
358
|
-
async function refreshFacetCounts(_$w) {
|
|
371
|
+
async function refreshFacetCounts(_$w,fieldTitle) {
|
|
359
372
|
const fieldIds = Array.from(optionsByFieldId.keys());
|
|
360
373
|
const currentJobsIds=currentJobs.map(job=>job._id);
|
|
361
374
|
for (const fieldId of fieldIds) {
|
|
@@ -371,10 +384,14 @@ async function refreshFacetCounts(_$w) {
|
|
|
371
384
|
countsByFieldId.set(fieldId, counter);
|
|
372
385
|
}
|
|
373
386
|
// // After counts are ready, update all items currently rendered
|
|
374
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER).forEachItem(($item, itemData) => {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
});
|
|
387
|
+
// _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER).forEachItem(($item, itemData) => {
|
|
388
|
+
// const query = ($item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_LABEL).value || '').toLowerCase().trim();
|
|
389
|
+
// updateOptionsUI($item, itemData._id, query);
|
|
390
|
+
// });
|
|
391
|
+
for(const fieldId of fieldIds) {
|
|
392
|
+
const query = (_$w(`#${fieldTitle}input`).value || '').toLowerCase().trim();
|
|
393
|
+
updateOptionsUI(_$w,fieldTitle, fieldId, query); // no search query
|
|
394
|
+
}
|
|
378
395
|
}
|
|
379
396
|
|
|
380
397
|
function groupValuesByField(values, refKey) {
|