sr-npm 1.7.669 → 1.7.670

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.669",
3
+ "version": "1.7.670",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -133,12 +133,48 @@ async function loadJobs(_$w) {
133
133
  valueToJobs[city._id]=city.jobIds;
134
134
  }
135
135
  // 2) Load all values once and group them by referenced field
136
-
136
+ let found=false;
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
140
  console.log("valuesByFieldId: ",valuesByFieldId)
141
- //_$w("#CategoryCheckBox").options = fields;
141
+
142
+ for(const elemenet of Object.keys(valuesByFieldId)) {
143
+ for(const field of fields) {
144
+ if(field._id===elemenet && field.title==="Category") {
145
+ updateOptionsUI(_$w,field.title, field._id, ''); // no search query
146
+ console.log("field: ",field)
147
+ console.log("elemenet: ",elemenet)
148
+ console.log("valuesByFieldId.get(elemenet): ",valuesByFieldId.get(elemenet))
149
+ //_$w("#CategoryCheckBox").options = valuesByFieldId.get(elemenet);
150
+ _$w(`${field.title}CheckBox`).onChange(async (ev) => {
151
+ dontUpdateThisCheckBox=field._id;
152
+ const selected = ev.target.value; // array of selected value IDs
153
+ if (selected && selected.length) {
154
+ selectedByField.set(field._id, selected);
155
+ } else {
156
+ selectedByField.delete(field._id);
157
+ }
158
+ await applyJobFilters(_$w,field._id); // re-query jobs
159
+ // await refreshFacetCounts(_$w); // recompute and update counts in all lists
160
+ // await updateSelectedValuesRepeater(_$w);
161
+ updateTotalJobsCountText(_$w);
162
+ });
163
+ const runFilter = debounce(() => {
164
+ const query = (_$w(`${field.title}input`).value || '').toLowerCase().trim();
165
+ updateOptionsUI(_$w, field.title, field._id, query);
166
+ }, 150);
167
+ _$w(`${field.title}input`).onInput(runFilter);
168
+ found=true;
169
+ break;
170
+ }
171
+ }
172
+ if(found) {
173
+ break;
174
+ }
175
+ }
176
+
177
+ //
142
178
 
143
179
 
144
180
 
@@ -241,7 +277,7 @@ async function loadJobs(_$w) {
241
277
  };
242
278
  };
243
279
 
244
- function updateOptionsUI($item, fieldId, searchQuery) {
280
+ function updateOptionsUI(_$w,fieldTitle, fieldId, searchQuery) {
245
281
  let base = optionsByFieldId.get(fieldId) || [];
246
282
  const countsMap = countsByFieldId.get(fieldId) || new Map();
247
283
  if(dontUpdateThisCheckBox===fieldId)
@@ -271,12 +307,13 @@ async function loadJobs(_$w) {
271
307
  : withCounts;
272
308
 
273
309
  // Preserve currently selected values that are still visible
274
- const prevSelected = $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER_ITEM_CHECKBOX).value || [];
310
+ // const prevSelected = $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER_ITEM_CHECKBOX).value || [];
311
+ const prevSelected = _$w(`${fieldTitle}CheckBox`).value || [];
275
312
  const visibleSet = new Set(filtered.map(o => o.value));
276
313
  const preserved = prevSelected.filter(v => visibleSet.has(v));
277
314
 
278
- $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER_ITEM_CHECKBOX).options = filtered;
279
- $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER_ITEM_CHECKBOX).value = preserved;
315
+ _$w(`${fieldTitle}CheckBox`).options = filtered;
316
+ _$w(`${fieldTitle}CheckBox`).value = preserved;
280
317
 
281
318
  }
282
319