sr-npm 1.7.684 → 1.7.686
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.
|
@@ -11,6 +11,7 @@ const CAREERS_MULTI_BOXES_PAGE_CONSTS={
|
|
|
11
11
|
SELECTED_VALUES_REPEATER: '#selectedValuesReapter',
|
|
12
12
|
SELECTED_VALUES_REPEATER_ITEM_LABEL: '#selectedValueLabel',
|
|
13
13
|
DESELECT_BUTTON_ID: '#deselectFilterValueButton',
|
|
14
|
+
CLEAR_ALL_BUTTON_ID: '#clearAllButton',
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
const FiltersIds={
|
package/package.json
CHANGED
|
@@ -31,7 +31,14 @@ 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
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.CLEAR_ALL_BUTTON_ID).onClick(async () => {
|
|
36
|
+
selectedByField.clear();
|
|
37
|
+
await applyJobFilters(_$w);
|
|
38
|
+
await refreshFacetCounts(_$w);
|
|
39
|
+
await updateSelectedValuesRepeater(_$w);
|
|
40
|
+
updateTotalJobsCountText(_$w);
|
|
41
|
+
});
|
|
35
42
|
// _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SELECTED_VALUES_REPEATER).onItemReady(($item, itemData) => {
|
|
36
43
|
// $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.SELECTED_VALUES_REPEATER_ITEM_LABEL).text = itemData.label || '';
|
|
37
44
|
|
|
@@ -89,15 +96,28 @@ async function loadSelectedValuesRepeater(_$w) {
|
|
|
89
96
|
} else {
|
|
90
97
|
selectedByField.delete(fieldId);
|
|
91
98
|
}
|
|
99
|
+
console.log("deselecting value for this field: ",fieldId)
|
|
100
|
+
|
|
101
|
+
for(const field of allfields) {
|
|
102
|
+
if(field._id===fieldId) {
|
|
103
|
+
console.log("field: ",field)
|
|
104
|
+
console.log("fieldId: ",fieldId)
|
|
105
|
+
console.log("valueId: ",valueId)
|
|
106
|
+
const currentVals = _$w(`#${FiltersIds[field.title]}CheckBox`).value || [];
|
|
107
|
+
const nextVals = currentVals.filter(v => v !== valueId);
|
|
108
|
+
_$w(`#${FiltersIds[field.title]}CheckBox`).value = nextVals;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
92
112
|
|
|
93
113
|
// 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
|
-
});
|
|
114
|
+
// _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER).forEachItem(($filterItem, filterItemData) => {
|
|
115
|
+
// if (filterItemData._id === fieldId) {
|
|
116
|
+
// const currentVals = $filterItem(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER_ITEM_CHECKBOX).value || [];
|
|
117
|
+
// const nextVals = currentVals.filter(v => v !== valueId);
|
|
118
|
+
// $filterItem(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER_ITEM_CHECKBOX).value = nextVals;
|
|
119
|
+
// }
|
|
120
|
+
// });
|
|
101
121
|
|
|
102
122
|
await applyJobFilters(_$w,fieldId);
|
|
103
123
|
await refreshFacetCounts(_$w);
|
|
@@ -129,7 +149,6 @@ async function loadJobs(_$w) {
|
|
|
129
149
|
// let fields = await getAllRecords(COLLECTIONS.CUSTOM_FIELDS);
|
|
130
150
|
|
|
131
151
|
// fields.push({_id:"Location",title:"Location"});
|
|
132
|
-
console.log("allfields: ",allfields)
|
|
133
152
|
const cities=await getAllRecords(COLLECTIONS.CITIES);
|
|
134
153
|
for(const city of cities) {
|
|
135
154
|
valueToJobs[city._id]=city.jobIds;
|
|
@@ -145,8 +164,6 @@ async function loadJobs(_$w) {
|
|
|
145
164
|
for(const city of cities) {
|
|
146
165
|
counter[city.city]=city.count
|
|
147
166
|
}
|
|
148
|
-
console.log("valuesByFieldId: ",valuesByFieldId)
|
|
149
|
-
console.log("fields: ",allfields)
|
|
150
167
|
for(const [key, value] of valuesByFieldId) {
|
|
151
168
|
for(const field of allfields) {
|
|
152
169
|
if(field._id===key) {
|
|
@@ -171,21 +188,16 @@ async function loadJobs(_$w) {
|
|
|
171
188
|
_$w(`#${FiltersIds[field.title]}CheckBox`).selectedIndices = []; // start empty
|
|
172
189
|
//_$w("#CategoryCheckBox").options = valuesByFieldId.get(elemenet);
|
|
173
190
|
_$w(`#${FiltersIds[field.title]}CheckBox`).onChange(async (ev) => {
|
|
174
|
-
console.log("valuesByFieldId: ",valuesByFieldId)
|
|
175
|
-
console.log("fields: ",allfields)
|
|
176
191
|
dontUpdateThisCheckBox=field._id;
|
|
177
|
-
console.log("dontUpdateThisCheckBox ",dontUpdateThisCheckBox)
|
|
178
192
|
const selected = ev.target.value; // array of selected value IDs
|
|
179
|
-
console.log("selected: ",selected)
|
|
180
193
|
if (selected && selected.length) {
|
|
181
194
|
selectedByField.set(field._id, selected);
|
|
182
195
|
} else {
|
|
183
196
|
selectedByField.delete(field._id);
|
|
184
197
|
}
|
|
185
|
-
console.log("selectedByField: ",selectedByField)
|
|
186
198
|
await applyJobFilters(_$w,field._id); // re-query jobs
|
|
187
199
|
await refreshFacetCounts(_$w,field.title); // recompute and update counts in all lists
|
|
188
|
-
|
|
200
|
+
await updateSelectedValuesRepeater(_$w);
|
|
189
201
|
updateTotalJobsCountText(_$w);
|
|
190
202
|
});
|
|
191
203
|
|
|
@@ -314,15 +326,10 @@ async function loadJobs(_$w) {
|
|
|
314
326
|
};
|
|
315
327
|
|
|
316
328
|
function updateOptionsUI(_$w,fieldTitle, fieldId, searchQuery) {
|
|
317
|
-
console.log("fieldTitle now inisde updateOptionsUI: ",fieldTitle)
|
|
318
329
|
let base = optionsByFieldId.get(fieldId) || [];
|
|
319
|
-
console.log("base: ",base)
|
|
320
330
|
const countsMap = countsByFieldId.get(fieldId) || new Map();
|
|
321
|
-
console.log("before if statement dontUpdateThisCheckBox: ",dontUpdateThisCheckBox)
|
|
322
|
-
console.log("fieldId: ",fieldId)
|
|
323
331
|
if(dontUpdateThisCheckBox===fieldId)
|
|
324
332
|
{
|
|
325
|
-
console.log("dontUpdateThisCheckBox is not null so returning")
|
|
326
333
|
dontUpdateThisCheckBox=null;
|
|
327
334
|
return;
|
|
328
335
|
}
|
|
@@ -352,9 +359,6 @@ async function loadJobs(_$w) {
|
|
|
352
359
|
const prevSelected = _$w(`#${FiltersIds[fieldTitle]}CheckBox`).value || [];
|
|
353
360
|
const visibleSet = new Set(filtered.map(o => o.value));
|
|
354
361
|
const preserved = prevSelected.filter(v => visibleSet.has(v));
|
|
355
|
-
console.log("preserved: ",preserved)
|
|
356
|
-
console.log("filtered: ",filtered)
|
|
357
|
-
console.log("fieldTitle: ",fieldTitle)
|
|
358
362
|
|
|
359
363
|
_$w(`#${FiltersIds[fieldTitle]}CheckBox`).options = filtered;
|
|
360
364
|
_$w(`#${FiltersIds[fieldTitle]}CheckBox`).value = preserved;
|
|
@@ -399,7 +403,6 @@ async function loadJobs(_$w) {
|
|
|
399
403
|
|
|
400
404
|
|
|
401
405
|
async function refreshFacetCounts(_$w,fieldTitle) {
|
|
402
|
-
console.log("refreshFacetCounts now inisde refreshFacetCounts: ",fieldTitle)
|
|
403
406
|
const fieldIds = Array.from(optionsByFieldId.keys());
|
|
404
407
|
const currentJobsIds=currentJobs.map(job=>job._id);
|
|
405
408
|
for (const fieldId of fieldIds) {
|