sr-npm 1.7.635 → 1.7.637

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.635",
3
+ "version": "1.7.637",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -31,8 +31,10 @@ async function careersMultiBoxesPageOnReady(_$w) {
31
31
 
32
32
  // Deselect this value from both the selected map and the multibox
33
33
  $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.DESELECT_BUTTON_ID).onClick(async () => {
34
+
34
35
  const fieldId = itemData.fieldId;
35
36
  const valueId = itemData.valueId;
37
+ dontUpdateThisCheckBox=fieldId;
36
38
  if (!fieldId || !valueId) return;
37
39
 
38
40
  const existing = selectedByField.get(fieldId) || [];
@@ -80,8 +82,10 @@ async function loadJobs(_$w) {
80
82
  try {
81
83
  // 1) Load all categories (fields)
82
84
  const fields = await getAllRecords(COLLECTIONS.CUSTOM_FIELDS);
85
+ console.log("fields: ",fields)
83
86
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER).data = fields;
84
-
87
+ const cities=await getAllRecords(COLLECTIONS.CITIES);
88
+ console.log("cities: ",cities)
85
89
  // 2) Load all values once and group them by referenced field
86
90
 
87
91
  const valuesByFieldId = groupValuesByField(allvaluesobjects, CUSTOM_VALUES_COLLECTION_FIELDS.CUSTOM_FIELD);
@@ -179,26 +183,19 @@ async function loadJobs(_$w) {
179
183
  function updateOptionsUI($item, fieldId, searchQuery) {
180
184
  let base = optionsByFieldId.get(fieldId) || [];
181
185
  const countsMap = countsByFieldId.get(fieldId) || new Map();
182
- console.log("base before filtering: ",base)
183
- console.log("countsMap: ",countsMap)
184
186
  if(dontUpdateThisCheckBox===fieldId)
185
187
  {
186
188
  dontUpdateThisCheckBox=null;
187
189
  return;
188
190
  }
189
191
  let filteredbase=[]
190
-
191
-
192
-
193
192
  for (const element of base)
194
193
  {
195
- console.log("element: ",element)
196
194
  if(countsMap.get(element.value))
197
195
  {
198
196
  filteredbase.push(element)
199
197
  }
200
198
  }
201
- console.log("base after filtering: ",filteredbase)
202
199
  // Build display options with counts
203
200
  const withCounts = filteredbase.map(o => {
204
201
  const count = countsMap.get(o.value)
@@ -207,7 +204,6 @@ async function loadJobs(_$w) {
207
204
  value: o.value
208
205
  };
209
206
  });
210
- console.log("withCounts: ",withCounts)
211
207
  // Apply search
212
208
  const filtered = searchQuery
213
209
  ? withCounts.filter(o => (o.label || '').toLowerCase().includes(searchQuery))
@@ -217,8 +213,6 @@ async function loadJobs(_$w) {
217
213
  const prevSelected = $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER_ITEM_CHECKBOX).value || [];
218
214
  const visibleSet = new Set(filtered.map(o => o.value));
219
215
  const preserved = prevSelected.filter(v => visibleSet.has(v));
220
- console.log("preserved: ",preserved)
221
- console.log("filtered: ",filtered)
222
216
 
223
217
  $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER_ITEM_CHECKBOX).options = filtered;
224
218
  $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER_ITEM_CHECKBOX).value = preserved;
@@ -288,21 +282,6 @@ async function refreshFacetCounts(_$w) {
288
282
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SELECTED_VALUES_REPEATER).data = selectedItems;
289
283
  }
290
284
 
291
- // function updateSelectedValuesRepeater(_$w) {
292
- // const selectedItems = [];
293
- // for (const [fieldId, valueIds] of selectedByField.entries()) {
294
- // const opts = optionsByFieldId.get(fieldId) || [];
295
- // const byId = new Map(opts.map(o => [o.value, o.label]));
296
- // for (const id of valueIds) {
297
- // const label = byId.get(id);
298
- // if (label) {
299
- // selectedItems.push({ _id: `${fieldId}:${id}`, label, fieldId, valueId: id });
300
- // }
301
- // }
302
- // }
303
- // _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SELECTED_VALUES_REPEATER).data = selectedItems;
304
- // }
305
-
306
285
  async function updateCurrentJobs(res) {
307
286
  let newcurrentJobs = [];
308
287
  newcurrentJobs.push(...res.items.map(job=>job._id));