sr-npm 1.7.668 → 1.7.669
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 +1 -1
- package/pages/careersMultiBoxesPage.js +64 -58
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@ async function careersMultiBoxesPageOnReady(_$w) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
await loadJobs(_$w);
|
|
28
|
-
|
|
28
|
+
await loadFilters(_$w);
|
|
29
29
|
//selected values repeater on item ready
|
|
30
30
|
//await loadSelectedValuesRepeater(_$w);
|
|
31
31
|
// _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SELECTED_VALUES_REPEATER).onItemReady(($item, itemData) => {
|
|
@@ -124,8 +124,10 @@ async function loadJobs(_$w) {
|
|
|
124
124
|
try {
|
|
125
125
|
// 1) Load all categories (fields)
|
|
126
126
|
let fields = await getAllRecords(COLLECTIONS.CUSTOM_FIELDS);
|
|
127
|
+
|
|
127
128
|
fields.push({_id:"Location",title:"Location"});
|
|
128
|
-
|
|
129
|
+
console.log("fields: ",fields)
|
|
130
|
+
// _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER).data = fields;
|
|
129
131
|
const cities=await getAllRecords(COLLECTIONS.CITIES);
|
|
130
132
|
for(const city of cities) {
|
|
131
133
|
valueToJobs[city._id]=city.jobIds;
|
|
@@ -135,77 +137,81 @@ async function loadJobs(_$w) {
|
|
|
135
137
|
let valuesByFieldId = groupValuesByField(allvaluesobjects, CUSTOM_VALUES_COLLECTION_FIELDS.CUSTOM_FIELD);
|
|
136
138
|
valuesByFieldId.set("Location",cities)
|
|
137
139
|
valuesByFieldIdGlobal = valuesByFieldId; // store globally
|
|
140
|
+
console.log("valuesByFieldId: ",valuesByFieldId)
|
|
141
|
+
//_$w("#CategoryCheckBox").options = fields;
|
|
142
|
+
|
|
143
|
+
|
|
138
144
|
|
|
139
145
|
|
|
140
146
|
// 3) Bind each filter repeater item
|
|
141
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER).onItemReady(async ($item, itemData) => {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
147
|
+
// _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER).onItemReady(async ($item, itemData) => {
|
|
148
|
+
// // $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_LABEL).onClick(()=>{
|
|
149
|
+
// // $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_CHECKBOX_CONTAINER).collapsed ? $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_CHECKBOX_CONTAINER).expand() : $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_CHECKBOX_CONTAINER).collapse()
|
|
150
|
+
// // })
|
|
151
|
+
// const fieldId = itemData._id;
|
|
146
152
|
|
|
147
|
-
|
|
148
|
-
|
|
153
|
+
// // Set the filter label (category name)
|
|
154
|
+
// $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_LABEL).placeholder = itemData.title
|
|
149
155
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
156
|
+
// // Build CheckboxGroup options for this field
|
|
157
|
+
// const fieldValues = valuesByFieldId.get(fieldId) || [];
|
|
158
|
+
// let originalOptions=[];
|
|
159
|
+
// if(fieldId==="Location") {
|
|
160
|
+
// originalOptions=fieldValues.map(city=>({
|
|
161
|
+
// label: city.city,
|
|
162
|
+
// value: city._id
|
|
163
|
+
// }));
|
|
164
|
+
// }
|
|
165
|
+
// else{
|
|
166
|
+
// originalOptions=fieldValues
|
|
167
|
+
// }
|
|
162
168
|
|
|
163
|
-
|
|
164
|
-
|
|
169
|
+
// optionsByFieldId.set(fieldId, originalOptions);
|
|
170
|
+
// const counter={}
|
|
165
171
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
+
// for (const val of allvaluesobjects) {
|
|
173
|
+
// counter[val.title]=val.totalJobs
|
|
174
|
+
// }
|
|
175
|
+
// for(const city of cities) {
|
|
176
|
+
// counter[city.city]=city.count
|
|
177
|
+
// }
|
|
172
178
|
|
|
173
|
-
|
|
179
|
+
// countsByFieldId.set(fieldId, new Map(originalOptions.map(o => [o.value, counter[o.label]])));
|
|
174
180
|
|
|
175
|
-
|
|
176
|
-
|
|
181
|
+
// // Initialize UI
|
|
182
|
+
// updateOptionsUI($item, fieldId, ''); // no search query
|
|
177
183
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
});
|
|
184
|
+
// $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER_ITEM_CHECKBOX).selectedIndices = []; // start empty
|
|
185
|
+
// $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER_ITEM_CHECKBOX).onChange(async (ev) => {
|
|
186
|
+
// dontUpdateThisCheckBox=fieldId;
|
|
187
|
+
// const selected = ev.target.value; // array of selected value IDs
|
|
188
|
+
// if (selected && selected.length) {
|
|
189
|
+
// selectedByField.set(fieldId, selected);
|
|
190
|
+
// } else {
|
|
191
|
+
// selectedByField.delete(fieldId);
|
|
192
|
+
// }
|
|
193
|
+
// await applyJobFilters(_$w,fieldId); // re-query jobs
|
|
194
|
+
// await refreshFacetCounts(_$w); // recompute and update counts in all lists
|
|
195
|
+
// await updateSelectedValuesRepeater(_$w);
|
|
196
|
+
// updateTotalJobsCountText(_$w);
|
|
197
|
+
// });
|
|
192
198
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
199
|
+
// // Input typing -> only filter this list’s visible options (no Jobs query)
|
|
200
|
+
// const runFilter = debounce(() => {
|
|
201
|
+
// const query = ($item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_LABEL).value || '').toLowerCase().trim();
|
|
202
|
+
// updateOptionsUI($item, fieldId, query);
|
|
203
|
+
// }, 150);
|
|
204
|
+
// $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_LABEL).onInput(runFilter);
|
|
205
|
+
// });
|
|
200
206
|
|
|
201
|
-
await refreshFacetCounts(_$w);
|
|
207
|
+
//await refreshFacetCounts(_$w);
|
|
202
208
|
// After counts are ready, re-render all items to show numbers
|
|
203
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER).forEachItem(($item, itemData) => {
|
|
204
|
-
|
|
205
|
-
|
|
209
|
+
// _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER).forEachItem(($item, itemData) => {
|
|
210
|
+
// const query = ($item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_LABEL).value || '').toLowerCase().trim();
|
|
211
|
+
// updateOptionsUI($item, itemData._id, query);
|
|
206
212
|
|
|
207
213
|
|
|
208
|
-
});
|
|
214
|
+
// });
|
|
209
215
|
} catch (err) {
|
|
210
216
|
console.error('Failed to load filters:', err);
|
|
211
217
|
}
|