sr-npm 1.7.683 → 1.7.685
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 +23 -27
package/package.json
CHANGED
|
@@ -31,7 +31,7 @@ async function careersMultiBoxesPageOnReady(_$w) {
|
|
|
31
31
|
await loadJobs(_$w);
|
|
32
32
|
await loadFilters(_$w);
|
|
33
33
|
//selected values repeater on item ready
|
|
34
|
-
|
|
34
|
+
await loadSelectedValuesRepeater(_$w);
|
|
35
35
|
// _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SELECTED_VALUES_REPEATER).onItemReady(($item, itemData) => {
|
|
36
36
|
// $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.SELECTED_VALUES_REPEATER_ITEM_LABEL).text = itemData.label || '';
|
|
37
37
|
|
|
@@ -89,15 +89,28 @@ async function loadSelectedValuesRepeater(_$w) {
|
|
|
89
89
|
} else {
|
|
90
90
|
selectedByField.delete(fieldId);
|
|
91
91
|
}
|
|
92
|
+
console.log("deselecting value for this field: ",fieldId)
|
|
93
|
+
|
|
94
|
+
for(const field of allfields) {
|
|
95
|
+
if(field._id===fieldId) {
|
|
96
|
+
console.log("field: ",field)
|
|
97
|
+
console.log("fieldId: ",fieldId)
|
|
98
|
+
console.log("valueId: ",valueId)
|
|
99
|
+
const currentVals = _$w(`#${FiltersIds[field.title]}CheckBox`).value || [];
|
|
100
|
+
const nextVals = currentVals.filter(v => v !== valueId);
|
|
101
|
+
_$w(`#${FiltersIds[field.title]}CheckBox`).value = nextVals;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
92
105
|
|
|
93
106
|
// Update the checkbox group UI inside the corresponding filter item
|
|
94
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER).forEachItem(($filterItem, filterItemData) => {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
});
|
|
107
|
+
// _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER).forEachItem(($filterItem, filterItemData) => {
|
|
108
|
+
// if (filterItemData._id === fieldId) {
|
|
109
|
+
// const currentVals = $filterItem(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER_ITEM_CHECKBOX).value || [];
|
|
110
|
+
// const nextVals = currentVals.filter(v => v !== valueId);
|
|
111
|
+
// $filterItem(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER_ITEM_CHECKBOX).value = nextVals;
|
|
112
|
+
// }
|
|
113
|
+
// });
|
|
101
114
|
|
|
102
115
|
await applyJobFilters(_$w,fieldId);
|
|
103
116
|
await refreshFacetCounts(_$w);
|
|
@@ -129,7 +142,6 @@ async function loadJobs(_$w) {
|
|
|
129
142
|
// let fields = await getAllRecords(COLLECTIONS.CUSTOM_FIELDS);
|
|
130
143
|
|
|
131
144
|
// fields.push({_id:"Location",title:"Location"});
|
|
132
|
-
console.log("allfields: ",allfields)
|
|
133
145
|
const cities=await getAllRecords(COLLECTIONS.CITIES);
|
|
134
146
|
for(const city of cities) {
|
|
135
147
|
valueToJobs[city._id]=city.jobIds;
|
|
@@ -145,8 +157,6 @@ async function loadJobs(_$w) {
|
|
|
145
157
|
for(const city of cities) {
|
|
146
158
|
counter[city.city]=city.count
|
|
147
159
|
}
|
|
148
|
-
console.log("valuesByFieldId: ",valuesByFieldId)
|
|
149
|
-
console.log("fields: ",allfields)
|
|
150
160
|
for(const [key, value] of valuesByFieldId) {
|
|
151
161
|
for(const field of allfields) {
|
|
152
162
|
if(field._id===key) {
|
|
@@ -171,21 +181,16 @@ async function loadJobs(_$w) {
|
|
|
171
181
|
_$w(`#${FiltersIds[field.title]}CheckBox`).selectedIndices = []; // start empty
|
|
172
182
|
//_$w("#CategoryCheckBox").options = valuesByFieldId.get(elemenet);
|
|
173
183
|
_$w(`#${FiltersIds[field.title]}CheckBox`).onChange(async (ev) => {
|
|
174
|
-
console.log("valuesByFieldId: ",valuesByFieldId)
|
|
175
|
-
console.log("fields: ",allfields)
|
|
176
184
|
dontUpdateThisCheckBox=field._id;
|
|
177
|
-
console.log("dontUpdateThisCheckBox ",dontUpdateThisCheckBox)
|
|
178
185
|
const selected = ev.target.value; // array of selected value IDs
|
|
179
|
-
console.log("selected: ",selected)
|
|
180
186
|
if (selected && selected.length) {
|
|
181
187
|
selectedByField.set(field._id, selected);
|
|
182
188
|
} else {
|
|
183
189
|
selectedByField.delete(field._id);
|
|
184
190
|
}
|
|
185
|
-
console.log("selectedByField: ",selectedByField)
|
|
186
191
|
await applyJobFilters(_$w,field._id); // re-query jobs
|
|
187
192
|
await refreshFacetCounts(_$w,field.title); // recompute and update counts in all lists
|
|
188
|
-
|
|
193
|
+
await updateSelectedValuesRepeater(_$w);
|
|
189
194
|
updateTotalJobsCountText(_$w);
|
|
190
195
|
});
|
|
191
196
|
|
|
@@ -314,15 +319,10 @@ async function loadJobs(_$w) {
|
|
|
314
319
|
};
|
|
315
320
|
|
|
316
321
|
function updateOptionsUI(_$w,fieldTitle, fieldId, searchQuery) {
|
|
317
|
-
console.log("fieldTitle now inisde updateOptionsUI: ",fieldTitle)
|
|
318
322
|
let base = optionsByFieldId.get(fieldId) || [];
|
|
319
|
-
console.log("base: ",base)
|
|
320
323
|
const countsMap = countsByFieldId.get(fieldId) || new Map();
|
|
321
|
-
console.log("before if statement dontUpdateThisCheckBox: ",dontUpdateThisCheckBox)
|
|
322
|
-
console.log("fieldId: ",fieldId)
|
|
323
324
|
if(dontUpdateThisCheckBox===fieldId)
|
|
324
325
|
{
|
|
325
|
-
console.log("dontUpdateThisCheckBox is not null so returning")
|
|
326
326
|
dontUpdateThisCheckBox=null;
|
|
327
327
|
return;
|
|
328
328
|
}
|
|
@@ -352,9 +352,6 @@ async function loadJobs(_$w) {
|
|
|
352
352
|
const prevSelected = _$w(`#${FiltersIds[fieldTitle]}CheckBox`).value || [];
|
|
353
353
|
const visibleSet = new Set(filtered.map(o => o.value));
|
|
354
354
|
const preserved = prevSelected.filter(v => visibleSet.has(v));
|
|
355
|
-
console.log("preserved: ",preserved)
|
|
356
|
-
console.log("filtered: ",filtered)
|
|
357
|
-
console.log("fieldTitle: ",fieldTitle)
|
|
358
355
|
|
|
359
356
|
_$w(`#${FiltersIds[fieldTitle]}CheckBox`).options = filtered;
|
|
360
357
|
_$w(`#${FiltersIds[fieldTitle]}CheckBox`).value = preserved;
|
|
@@ -399,7 +396,6 @@ async function loadJobs(_$w) {
|
|
|
399
396
|
|
|
400
397
|
|
|
401
398
|
async function refreshFacetCounts(_$w,fieldTitle) {
|
|
402
|
-
console.log("refreshFacetCounts now inisde refreshFacetCounts: ",fieldTitle)
|
|
403
399
|
const fieldIds = Array.from(optionsByFieldId.keys());
|
|
404
400
|
const currentJobsIds=currentJobs.map(job=>job._id);
|
|
405
401
|
for (const fieldId of fieldIds) {
|
|
@@ -421,7 +417,7 @@ async function refreshFacetCounts(_$w,fieldTitle) {
|
|
|
421
417
|
// });
|
|
422
418
|
for(const field of allfields) {
|
|
423
419
|
const query = (_$w(`#${FiltersIds[field.title]}input`).value || '').toLowerCase().trim();
|
|
424
|
-
updateOptionsUI(_$w,
|
|
420
|
+
updateOptionsUI(_$w,field.title, field._id, query); // no search query
|
|
425
421
|
}
|
|
426
422
|
}
|
|
427
423
|
|