sr-npm 1.7.354 → 1.7.356
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/careersPage.js +111 -29
package/package.json
CHANGED
package/pages/careersPage.js
CHANGED
|
@@ -14,13 +14,22 @@ const {
|
|
|
14
14
|
let allJobs=[]
|
|
15
15
|
const RESET_ALL = 'RESET_ALL';
|
|
16
16
|
let pageParamSet=0;
|
|
17
|
-
let myQueryParams;
|
|
18
17
|
let thisObjectVar;
|
|
19
|
-
|
|
18
|
+
let queryPageVar;
|
|
19
|
+
let queryKeyWordVar;
|
|
20
|
+
let queryDepartmentVar;
|
|
21
|
+
let queryLocationVar;
|
|
22
|
+
let queryJobTypeVar;
|
|
20
23
|
let searchInputBlurredFirstTime=true;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
let deletedParam=false;
|
|
25
|
+
async function careersPageOnReady(_$w,thisObject,queryParams) {
|
|
26
|
+
console.log("queryParams: ", queryParams);
|
|
27
|
+
const { page, keyWord, department, location,jobType } = queryParams;
|
|
28
|
+
queryPageVar=page;
|
|
29
|
+
queryKeyWordVar=keyWord;
|
|
30
|
+
queryDepartmentVar=department;
|
|
31
|
+
queryLocationVar=location;
|
|
32
|
+
queryJobTypeVar=jobType;
|
|
24
33
|
thisObjectVar=thisObject;
|
|
25
34
|
allJobs=await getAllPositions();
|
|
26
35
|
await activateAutoLoad(_$w);
|
|
@@ -79,20 +88,24 @@ async function setPageParamInUrl() {
|
|
|
79
88
|
|
|
80
89
|
}
|
|
81
90
|
async function handleUrlParams(_$w) {
|
|
82
|
-
|
|
83
|
-
|
|
91
|
+
console.log("queryKeyWordVar: ", queryKeyWordVar);
|
|
92
|
+
console.log("queryPageVar: ", queryPageVar);
|
|
93
|
+
console.log("queryDepartmentVar: ", queryDepartmentVar);
|
|
94
|
+
console.log("queryLocationVar: ", queryLocationVar);
|
|
95
|
+
if (queryKeyWordVar) {
|
|
96
|
+
await handleKeyWordParam(_$w,queryKeyWordVar);
|
|
84
97
|
}
|
|
85
|
-
if (
|
|
98
|
+
if (queryPageVar) {
|
|
86
99
|
await handlePageParam(_$w);
|
|
87
100
|
}
|
|
88
|
-
if (
|
|
89
|
-
await handleDepartmentParam(_$w,
|
|
101
|
+
if (queryDepartmentVar) {
|
|
102
|
+
await handleDepartmentParam(_$w,queryDepartmentVar);
|
|
90
103
|
}
|
|
91
|
-
if (
|
|
92
|
-
await handleLocationParam(_$w,
|
|
104
|
+
if (queryLocationVar) {
|
|
105
|
+
await handleLocationParam(_$w,queryLocationVar);
|
|
93
106
|
}
|
|
94
|
-
if (
|
|
95
|
-
await handleJobTypeParam(_$w,
|
|
107
|
+
if (queryJobTypeVar) {
|
|
108
|
+
await handleJobTypeParam(_$w,queryJobTypeVar);
|
|
96
109
|
}
|
|
97
110
|
await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
|
|
98
111
|
}
|
|
@@ -100,25 +113,25 @@ async function handleUrlParams(_$w) {
|
|
|
100
113
|
async function handleKeyWordParam(_$w,keyWord) {
|
|
101
114
|
_$w('#searchInput').value = keyWord;
|
|
102
115
|
// Use applyFilters to maintain consistency instead of directly setting filter
|
|
103
|
-
|
|
116
|
+
// await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
|
|
104
117
|
}
|
|
105
118
|
|
|
106
119
|
async function handlePageParam(_$w) {
|
|
107
120
|
|
|
108
|
-
if(allJobs.length/itemsPerPage<
|
|
121
|
+
if(allJobs.length/itemsPerPage<queryPageVar){
|
|
109
122
|
console.log(`max page is: ${allJobs.length/itemsPerPage}`)
|
|
110
123
|
queryParams.add({ page: allJobs.length/itemsPerPage })
|
|
111
124
|
}
|
|
112
|
-
if(
|
|
125
|
+
if(queryPageVar<=1){
|
|
113
126
|
console.log("min page is : 2")
|
|
114
127
|
pageParamSet=2;
|
|
115
128
|
queryParams.add({ page: 2 })
|
|
116
129
|
}
|
|
117
|
-
if (
|
|
118
|
-
pageParamSet=
|
|
130
|
+
if (queryPageVar) {
|
|
131
|
+
pageParamSet=queryPageVar;
|
|
119
132
|
//scrolls a bit to load the dataset data
|
|
120
133
|
await window.scrollTo(0, 200,{scrollAnimation:false});
|
|
121
|
-
for (let i = 2; i <=
|
|
134
|
+
for (let i = 2; i <= queryPageVar; i++) {
|
|
122
135
|
await _$w("#jobsDataset").loadMore();
|
|
123
136
|
currentLoadedItems=currentLoadedItems+itemsPerPage
|
|
124
137
|
}
|
|
@@ -163,7 +176,10 @@ function init(_$w) {
|
|
|
163
176
|
searchInputBlurredFirstTime=false;
|
|
164
177
|
}
|
|
165
178
|
});
|
|
166
|
-
_$w('#dropdownDepartment, #dropdownLocation, #dropdownJobType').onChange(
|
|
179
|
+
_$w('#dropdownDepartment, #dropdownLocation, #dropdownJobType').onChange(()=>{
|
|
180
|
+
console.log("onChange triggering on dropdown@@@@@@");
|
|
181
|
+
applyFilters(_$w);
|
|
182
|
+
});
|
|
167
183
|
_$w('#resetFiltersButton, #clearSearch').onClick(()=>resetFilters(_$w));
|
|
168
184
|
|
|
169
185
|
_$w('#openFiltersButton').onClick(()=>{
|
|
@@ -177,6 +193,59 @@ function init(_$w) {
|
|
|
177
193
|
//URL onChange
|
|
178
194
|
onChange(async ()=>{
|
|
179
195
|
await handleBackAndForth(_$w);
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
//try onready first
|
|
203
|
+
//try location to
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
// handleBackAndForth(_$w);
|
|
210
|
+
// const newQueryParams=await location.query();
|
|
211
|
+
// console.log("location.query(): ", newQueryParams);
|
|
212
|
+
// if(newQueryParams.keyWord){
|
|
213
|
+
// console.log("setting querykeyparam")
|
|
214
|
+
// queryKeyWordVar=newQueryParams.keyWord;
|
|
215
|
+
// }
|
|
216
|
+
// else
|
|
217
|
+
// {
|
|
218
|
+
// queryKeyWordVar=undefined;
|
|
219
|
+
// _$w('#searchInput').value = '';
|
|
220
|
+
// deletedParam=true;
|
|
221
|
+
// }
|
|
222
|
+
// if(newQueryParams.department){
|
|
223
|
+
// console.log("setting queryDepartmentVar")
|
|
224
|
+
// queryDepartmentVar=newQueryParams.department;
|
|
225
|
+
// }
|
|
226
|
+
// else
|
|
227
|
+
// {
|
|
228
|
+
// queryDepartmentVar=undefined;
|
|
229
|
+
// _$w('#dropdownDepartment').value = '';
|
|
230
|
+
// deletedParam=true;
|
|
231
|
+
// }
|
|
232
|
+
// if(newQueryParams.location){
|
|
233
|
+
// console.log("setting queryLocationVar")
|
|
234
|
+
// queryLocationVar=newQueryParams.location;
|
|
235
|
+
// }
|
|
236
|
+
// else
|
|
237
|
+
// {
|
|
238
|
+
// queryLocationVar=undefined;
|
|
239
|
+
// _$w('#dropdownLocation').value = '';
|
|
240
|
+
// deletedParam=true;
|
|
241
|
+
// }
|
|
242
|
+
|
|
243
|
+
// await handleUrlParams(_$w);
|
|
244
|
+
// if(deletedParam)
|
|
245
|
+
// {
|
|
246
|
+
// await applyFilters(_$w,true);
|
|
247
|
+
// deletedParam=false;
|
|
248
|
+
// }
|
|
180
249
|
});
|
|
181
250
|
|
|
182
251
|
|
|
@@ -189,38 +258,41 @@ async function handleBackAndForth(_$w){
|
|
|
189
258
|
const newQueryParams=await location.query();
|
|
190
259
|
console.log("newQueryParams: ", newQueryParams);
|
|
191
260
|
if(newQueryParams.department){
|
|
192
|
-
|
|
261
|
+
queryDepartmentVar=newQueryParams.department;
|
|
193
262
|
}
|
|
194
263
|
else{
|
|
195
|
-
|
|
264
|
+
queryDepartmentVar=undefined;
|
|
196
265
|
deletedParam=true;
|
|
197
266
|
_$w('#dropdownDepartment').value = '';
|
|
198
267
|
}
|
|
199
268
|
if(newQueryParams.location){
|
|
200
|
-
|
|
269
|
+
queryLocationVar=newQueryParams.location;
|
|
201
270
|
}
|
|
202
271
|
else{
|
|
203
|
-
|
|
272
|
+
queryLocationVar=undefined;
|
|
204
273
|
deletedParam=true
|
|
205
274
|
_$w('#dropdownLocation').value = '';
|
|
206
275
|
}
|
|
207
276
|
if(newQueryParams.keyWord){
|
|
208
|
-
|
|
277
|
+
queryKeyWordVar=newQueryParams.keyWord;
|
|
209
278
|
}
|
|
210
279
|
else{
|
|
211
|
-
|
|
280
|
+
queryKeyWordVar=undefined;
|
|
212
281
|
deletedParam=true;
|
|
213
282
|
_$w('#searchInput').value = '';
|
|
214
283
|
}
|
|
215
284
|
if(newQueryParams.jobType){
|
|
216
|
-
|
|
285
|
+
queryJobTypeVar=newQueryParams.jobType;
|
|
217
286
|
}
|
|
218
287
|
else{
|
|
219
|
-
|
|
288
|
+
queryJobTypeVar=undefined;
|
|
220
289
|
deletedParam=true;
|
|
221
290
|
_$w('#dropdownJobType').value = '';
|
|
222
291
|
}
|
|
223
292
|
await handleUrlParams(_$w);
|
|
293
|
+
// if(deletedParam){
|
|
294
|
+
// await applyFilters(_$w,true);
|
|
295
|
+
// }
|
|
224
296
|
|
|
225
297
|
}
|
|
226
298
|
|
|
@@ -251,12 +323,15 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
251
323
|
if (!skipUrlUpdate) {
|
|
252
324
|
if(filter.field === 'title'){
|
|
253
325
|
queryParams.add({ keyWord: filter.value });
|
|
326
|
+
// queryKeyWordVar=filter.value;
|
|
254
327
|
}
|
|
255
328
|
if(filter.field === 'department'){
|
|
256
329
|
queryParams.add({ department: encodeURIComponent(filter.value) });
|
|
330
|
+
//queryDepartmentVar=filter.value;
|
|
257
331
|
}
|
|
258
332
|
if(filter.field === 'cityText'){
|
|
259
333
|
queryParams.add({ location: encodeURIComponent(filter.value) });
|
|
334
|
+
//queryLocationVar=filter.value;
|
|
260
335
|
}
|
|
261
336
|
if(filter.field === 'remote'){
|
|
262
337
|
if(filter.value === 'true'){
|
|
@@ -265,6 +340,7 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
265
340
|
else{
|
|
266
341
|
queryParams.add({ jobType: encodeURIComponent("onsite") });
|
|
267
342
|
}
|
|
343
|
+
//queryJobTypeVar=filter.value;
|
|
268
344
|
}
|
|
269
345
|
}
|
|
270
346
|
if(filter.field === 'remote') {
|
|
@@ -278,18 +354,22 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
278
354
|
if (!skipUrlUpdate) {
|
|
279
355
|
if(filter.field === 'title'){
|
|
280
356
|
queryParams.remove(["keyWord" ]);
|
|
357
|
+
// queryKeyWordVar=undefined;
|
|
281
358
|
}
|
|
282
359
|
if(filter.field === 'department'){
|
|
283
360
|
console.log("removing department from url")
|
|
284
361
|
queryParams.remove(["department" ]);
|
|
362
|
+
// queryDepartmentVar=undefined;
|
|
285
363
|
}
|
|
286
364
|
if(filter.field === 'cityText'){
|
|
287
365
|
console.log("removing location from url")
|
|
288
366
|
queryParams.remove(["location" ]);
|
|
367
|
+
// queryLocationVar=undefined;
|
|
289
368
|
}
|
|
290
369
|
if(filter.field === 'remote'){
|
|
291
370
|
console.log("removing jobType from url")
|
|
292
371
|
queryParams.remove(["jobType" ]);
|
|
372
|
+
// queryJobTypeVar=undefined;
|
|
293
373
|
}
|
|
294
374
|
}
|
|
295
375
|
}
|
|
@@ -357,6 +437,7 @@ async function handleDepartmentParam(_$w,department) {
|
|
|
357
437
|
{
|
|
358
438
|
console.log("department value found in dropdown options ",departmentValue);
|
|
359
439
|
_$w('#dropdownDepartment').value = departmentValue;
|
|
440
|
+
// await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
|
|
360
441
|
}
|
|
361
442
|
else{
|
|
362
443
|
console.warn("department value not found in dropdown options");
|
|
@@ -397,6 +478,7 @@ async function handleLocationParam(_$w,location) {
|
|
|
397
478
|
|
|
398
479
|
if(option){
|
|
399
480
|
_$w('#dropdownLocation').value = option.value;
|
|
481
|
+
// await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
|
|
400
482
|
}
|
|
401
483
|
else{
|
|
402
484
|
console.warn("location value not found in dropdown options");
|