sr-npm 1.7.676 → 1.7.678

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.676",
3
+ "version": "1.7.678",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -126,7 +126,6 @@ async function loadJobs(_$w) {
126
126
  let fields = await getAllRecords(COLLECTIONS.CUSTOM_FIELDS);
127
127
 
128
128
  fields.push({_id:"Location",title:"Location"});
129
- // _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER).data = fields;
130
129
  const cities=await getAllRecords(COLLECTIONS.CITIES);
131
130
  for(const city of cities) {
132
131
  valueToJobs[city._id]=city.jobIds;
@@ -145,30 +144,30 @@ async function loadJobs(_$w) {
145
144
  for(const [key, value] of valuesByFieldId) {
146
145
  for(const field of fields) {
147
146
  if(field._id===key) {
148
- let originalOptions=[];
149
- if(key==="Location") {
150
- originalOptions=value.map(city=>({
151
- label: city.city,
152
- value: city._id
153
- }));
154
- }
155
- else{
156
- originalOptions=value
157
- }
158
-
159
- optionsByFieldId.set(key, originalOptions);
160
-
147
+ let originalOptions=[];
148
+ if(key==="Location") {
149
+ originalOptions=value.map(city=>({
150
+ label: city.city,
151
+ value: city._id
152
+ }));
153
+ }
154
+ else{
155
+ originalOptions=value
156
+ }
161
157
 
162
- for (const val of allvaluesobjects) {
163
- counter[val.title]=val.totalJobs
164
- }
158
+ optionsByFieldId.set(key, originalOptions);
159
+ for (const val of allvaluesobjects) {
160
+ counter[val.title]=val.totalJobs
161
+ }
165
162
 
166
- countsByFieldId.set(key, new Map(originalOptions.map(o => [o.value, counter[o.label]])));
163
+ countsByFieldId.set(key, new Map(originalOptions.map(o => [o.value, counter[o.label]])));
167
164
  updateOptionsUI(_$w,field.title, field._id, ''); // no search query
165
+ _$w(`#${FiltersIds[field.title]}CheckBox`).selectedIndices = []; // start empty
168
166
  //_$w("#CategoryCheckBox").options = valuesByFieldId.get(elemenet);
169
167
  _$w(`#${FiltersIds[field.title]}CheckBox`).onChange(async (ev) => {
170
168
  dontUpdateThisCheckBox=field._id;
171
169
  const selected = ev.target.value; // array of selected value IDs
170
+ console.log("selected: ",selected)
172
171
  if (selected && selected.length) {
173
172
  selectedByField.set(field._id, selected);
174
173
  } else {
@@ -193,8 +192,8 @@ async function loadJobs(_$w) {
193
192
 
194
193
  await refreshFacetCounts(_$w);
195
194
  // _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER).forEachItem(($item, itemData) => {
196
- // const query = ($item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_LABEL).value || '').toLowerCase().trim();
197
- // updateOptionsUI($item, itemData._id, query);
195
+ // const query = ($item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_LABEL).value || '').toLowerCase().trim();
196
+ // updateOptionsUI($item, itemData._id, query);
198
197
 
199
198
 
200
199
 
@@ -336,15 +335,15 @@ async function loadJobs(_$w) {
336
335
 
337
336
  // Preserve currently selected values that are still visible
338
337
  // const prevSelected = $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER_ITEM_CHECKBOX).value || [];
339
- const prevSelected = _$w(MULTI_CHECK_BOX_IDS[fieldTitle]).value || [];
338
+ const prevSelected = _$w(`#${FiltersIds[fieldTitle]}CheckBox`).value || [];
340
339
  const visibleSet = new Set(filtered.map(o => o.value));
341
340
  const preserved = prevSelected.filter(v => visibleSet.has(v));
342
341
  console.log("preserved: ",preserved)
343
342
  console.log("filtered: ",filtered)
344
343
  console.log("fieldTitle: ",fieldTitle)
345
344
 
346
- _$w(MULTI_CHECK_BOX_IDS[fieldTitle]).options = filtered;
347
- _$w(MULTI_CHECK_BOX_IDS[fieldTitle]).value = preserved;
345
+ _$w(`#${FiltersIds[fieldTitle]}CheckBox`).options = filtered;
346
+ _$w(`#${FiltersIds[fieldTitle]}CheckBox`).value = preserved;
348
347
 
349
348
  }
350
349