sr-npm 1.7.860 → 1.7.861
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
|
@@ -21,7 +21,6 @@ const pagination = {
|
|
|
21
21
|
currentPage: 1,
|
|
22
22
|
};
|
|
23
23
|
async function careersMultiBoxesPageOnReady(_$w,urlParams) {
|
|
24
|
-
console.log("careersMultiBoxesPageOnReady urlParams: ", urlParams);
|
|
25
24
|
await loadData(_$w);
|
|
26
25
|
|
|
27
26
|
await Promise.all([
|
|
@@ -40,7 +39,6 @@ async function careersMultiBoxesPageOnReady(_$w,urlParams) {
|
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
async function clearAll(_$w) {
|
|
43
|
-
console.log("clear all button clicked");
|
|
44
42
|
if(selectedByField.size>0 || _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SECONDARY_SEARCH_INPUT).value || _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value) {
|
|
45
43
|
for(const field of allfields) {
|
|
46
44
|
_$w(`#${FiltersIds[field.title]}CheckBox`).selectedIndices = [];
|
|
@@ -58,7 +56,6 @@ async function handleUrlParams(_$w,urlParams) {
|
|
|
58
56
|
try {
|
|
59
57
|
let applyFiltering=false;
|
|
60
58
|
let keyword=false
|
|
61
|
-
console.log("handleUrlParams urlParams: ", urlParams);
|
|
62
59
|
if(urlParams.brand) {
|
|
63
60
|
applyFiltering=await handleParams(_$w,"brand",urlParams.brand)
|
|
64
61
|
}
|
|
@@ -74,7 +71,6 @@ async function handleUrlParams(_$w,urlParams) {
|
|
|
74
71
|
keyword=true;
|
|
75
72
|
if(applyFiltering)
|
|
76
73
|
{
|
|
77
|
-
console.log("delete me")
|
|
78
74
|
currentJobs=_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOB_RESULTS_REPEATER).data;
|
|
79
75
|
}
|
|
80
76
|
|
|
@@ -108,12 +104,9 @@ async function handleUrlParams(_$w,urlParams) {
|
|
|
108
104
|
|
|
109
105
|
async function handleParams(_$w,param,value) {
|
|
110
106
|
let applyFiltering=false;
|
|
111
|
-
console.log("handleParams param: ", param, " value: ", value);
|
|
112
107
|
const decodedValue = decodeURIComponent(value);
|
|
113
|
-
console.log("decodedValue: ", decodedValue);
|
|
114
108
|
const field=getFieldByTitle(fieldTitlesInCMS[param],allfields);
|
|
115
109
|
const options=optionsByFieldId.get(field._id);
|
|
116
|
-
console.log("all options availbe for this field: ", field.title, " are ", options);
|
|
117
110
|
const option=getCorrectOption(decodedValue,options);
|
|
118
111
|
if(option) {
|
|
119
112
|
const optionIndex=getOptionIndexFromCheckBox(_$w(`#${FiltersIds[field.title]}CheckBox`).options,option.value);
|
|
@@ -241,10 +234,6 @@ async function loadJobsRepeater(_$w) {
|
|
|
241
234
|
// 2) Load all values once and group them by referenced field
|
|
242
235
|
let valuesByFieldId = groupValuesByField(allvaluesobjects, CUSTOM_VALUES_COLLECTION_FIELDS.CUSTOM_FIELD);
|
|
243
236
|
valuesByFieldId.set("Location",cities)
|
|
244
|
-
console.log("valuesByFieldId: ", valuesByFieldId);
|
|
245
|
-
console.log("allvaluesobjects: ", allvaluesobjects);
|
|
246
|
-
console.log("allfields: ", allfields);
|
|
247
|
-
|
|
248
237
|
// Build CheckboxGroup options for this field
|
|
249
238
|
|
|
250
239
|
const counter={}
|
|
@@ -270,15 +259,9 @@ async function loadJobsRepeater(_$w) {
|
|
|
270
259
|
}
|
|
271
260
|
|
|
272
261
|
countsByFieldId.set(key, new Map(originalOptions.map(o => [o.value, counter[o.label]])));
|
|
273
|
-
console.log("i am here 0 , field: ", field);
|
|
274
|
-
console.log("countsByFieldId: ", countsByFieldId);
|
|
275
|
-
console.log("optionsByFieldId: ", optionsByFieldId);
|
|
276
262
|
updateOptionsUI(_$w,field.title, field._id, ''); // no search query
|
|
277
|
-
console.log("after updateoptionUI");
|
|
278
263
|
_$w(`#${FiltersIds[field.title]}CheckBox`).selectedIndices = []; // start empty
|
|
279
|
-
console.log("i am here 1 , field.title: ", field.title);
|
|
280
264
|
_$w(`#${FiltersIds[field.title]}CheckBox`).onChange(async (ev) => {
|
|
281
|
-
console.log(`#${FiltersIds[field.title]}CheckBox.selectedIndices: `, _$w(`#${FiltersIds[field.title]}CheckBox`).selectedIndices);
|
|
282
265
|
dontUpdateThisCheckBox=field._id;
|
|
283
266
|
const selected = ev.target.value; // array of selected value IDs
|
|
284
267
|
if (selected && selected.length) {
|
|
@@ -289,19 +272,14 @@ async function loadJobsRepeater(_$w) {
|
|
|
289
272
|
await updateJobsAndNumbersAndFilters(_$w);
|
|
290
273
|
|
|
291
274
|
});
|
|
292
|
-
console.log("i am here 2 , field.title: ", field.title);
|
|
293
275
|
const runFilter = debounce(() => {
|
|
294
276
|
const query = (_$w(`#${FiltersIds[field.title]}input`).value || '').toLowerCase().trim();
|
|
295
277
|
updateOptionsUI(_$w, field.title, field._id, query);
|
|
296
278
|
}, 150);
|
|
297
|
-
console.log("i am here 3 , field.title: ", field.title);
|
|
298
279
|
_$w(`#${FiltersIds[field.title]}input`).onInput(runFilter);
|
|
299
|
-
console.log("i am here 4 , field.title: ", field.title);
|
|
300
280
|
|
|
301
281
|
}
|
|
302
|
-
console.log("i am here 5 ");
|
|
303
282
|
await refreshFacetCounts(_$w);
|
|
304
|
-
console.log("i am here 6 ");
|
|
305
283
|
|
|
306
284
|
} catch (err) {
|
|
307
285
|
console.error('Failed to load filters:', err);
|
|
@@ -319,13 +297,7 @@ console.log("i am here 5 ");
|
|
|
319
297
|
|
|
320
298
|
function updateOptionsUI(_$w,fieldTitle, fieldId, searchQuery,clearAll=false) {
|
|
321
299
|
let base = optionsByFieldId.get(fieldId) || [];
|
|
322
|
-
console.log("fieldTitle :", fieldTitle);
|
|
323
|
-
console.log("fieldId :", fieldId);
|
|
324
|
-
console.log("base :", base);
|
|
325
300
|
const countsMap = countsByFieldId.get(fieldId) || new Map();
|
|
326
|
-
console.log("countsMap :", countsMap);
|
|
327
|
-
console.log("searchQuery :", searchQuery);
|
|
328
|
-
console.log("clearAll :", clearAll);
|
|
329
301
|
if(dontUpdateThisCheckBox===fieldId && !clearAll)
|
|
330
302
|
{
|
|
331
303
|
dontUpdateThisCheckBox=null;
|
|
@@ -347,21 +319,16 @@ console.log("i am here 5 ");
|
|
|
347
319
|
value: o.value
|
|
348
320
|
};
|
|
349
321
|
});
|
|
350
|
-
console.log("withCounts :", withCounts);
|
|
351
322
|
// Apply search
|
|
352
323
|
const filtered = searchQuery
|
|
353
324
|
? withCounts.filter(o => (o.label || '').toLowerCase().includes(searchQuery))
|
|
354
325
|
: withCounts;
|
|
355
|
-
console.log("filtered :", filtered);
|
|
356
326
|
|
|
357
327
|
// Preserve currently selected values that are still visible
|
|
358
328
|
let prevSelected=[]
|
|
359
|
-
console.log("FiltersIds[fieldTitle] :", FiltersIds[fieldTitle]);
|
|
360
329
|
clearAll? prevSelected=[]:prevSelected= _$w(`#${FiltersIds[fieldTitle]}CheckBox`).value;
|
|
361
330
|
const visibleSet = new Set(filtered.map(o => o.value));
|
|
362
|
-
console.log("visibleSet :", visibleSet);
|
|
363
331
|
const preserved = prevSelected.filter(v => visibleSet.has(v));
|
|
364
|
-
console.log("preserved :", preserved);
|
|
365
332
|
_$w(`#${FiltersIds[fieldTitle]}CheckBox`).options = filtered;
|
|
366
333
|
_$w(`#${FiltersIds[fieldTitle]}CheckBox`).value = preserved;
|
|
367
334
|
}
|
package/pages/pagesUtils.js
CHANGED
|
@@ -152,7 +152,7 @@ async function primarySearch(_$w,query,alljobs) {
|
|
|
152
152
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState("categoryResults");
|
|
153
153
|
return false;
|
|
154
154
|
}
|
|
155
|
-
|
|
155
|
+
console.log("all jobs: ", alljobs);
|
|
156
156
|
let filteredJobs=alljobs.filter(job=>job.title.toLowerCase().includes(query));
|
|
157
157
|
if(filteredJobs.length>0) {
|
|
158
158
|
//currentJobs=filteredJobs;
|
|
@@ -161,6 +161,7 @@ async function primarySearch(_$w,query,alljobs) {
|
|
|
161
161
|
return true;
|
|
162
162
|
}
|
|
163
163
|
else {
|
|
164
|
+
|
|
164
165
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState("noResults");
|
|
165
166
|
return false;
|
|
166
167
|
}
|