sr-npm 1.7.353 → 1.7.354

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/pages/careersPage.js +29 -103
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.353",
3
+ "version": "1.7.354",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -14,22 +14,13 @@ const {
14
14
  let allJobs=[]
15
15
  const RESET_ALL = 'RESET_ALL';
16
16
  let pageParamSet=0;
17
+ let myQueryParams;
17
18
  let thisObjectVar;
18
- let queryPageVar;
19
- let queryKeyWordVar;
20
- let queryDepartmentVar;
21
- let queryLocationVar;
22
- let queryJobTypeVar;
19
+
23
20
  let searchInputBlurredFirstTime=true;
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;
21
+ async function careersPageOnReady(_$w,thisObject,myQueryParams) {
22
+
23
+ myQueryParams=myQueryParams;
33
24
  thisObjectVar=thisObject;
34
25
  allJobs=await getAllPositions();
35
26
  await activateAutoLoad(_$w);
@@ -88,24 +79,20 @@ async function setPageParamInUrl() {
88
79
 
89
80
  }
90
81
  async function handleUrlParams(_$w) {
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);
82
+ if (myQueryParams.keyWord) {
83
+ await handleKeyWordParam(_$w,myQueryParams.keyWord);
97
84
  }
98
- if (queryPageVar) {
85
+ if (myQueryParams.page) {
99
86
  await handlePageParam(_$w);
100
87
  }
101
- if (queryDepartmentVar) {
102
- await handleDepartmentParam(_$w,queryDepartmentVar);
88
+ if (myQueryParams.department) {
89
+ await handleDepartmentParam(_$w,myQueryParams.department);
103
90
  }
104
- if (queryLocationVar) {
105
- await handleLocationParam(_$w,queryLocationVar);
91
+ if (myQueryParams.location) {
92
+ await handleLocationParam(_$w,myQueryParams.location);
106
93
  }
107
- if (queryJobTypeVar) {
108
- await handleJobTypeParam(_$w,queryJobTypeVar);
94
+ if (myQueryParams.jobType) {
95
+ await handleJobTypeParam(_$w,myQueryParams.jobType);
109
96
  }
110
97
  await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
111
98
  }
@@ -113,25 +100,25 @@ async function handleUrlParams(_$w) {
113
100
  async function handleKeyWordParam(_$w,keyWord) {
114
101
  _$w('#searchInput').value = keyWord;
115
102
  // Use applyFilters to maintain consistency instead of directly setting filter
116
- // await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
103
+
117
104
  }
118
105
 
119
106
  async function handlePageParam(_$w) {
120
107
 
121
- if(allJobs.length/itemsPerPage<queryPageVar){
108
+ if(allJobs.length/itemsPerPage<myQueryParams.page){
122
109
  console.log(`max page is: ${allJobs.length/itemsPerPage}`)
123
110
  queryParams.add({ page: allJobs.length/itemsPerPage })
124
111
  }
125
- if(queryPageVar<=1){
112
+ if(myQueryParams.page<=1){
126
113
  console.log("min page is : 2")
127
114
  pageParamSet=2;
128
115
  queryParams.add({ page: 2 })
129
116
  }
130
- if (queryPageVar) {
131
- pageParamSet=queryPageVar;
117
+ if (myQueryParams.page) {
118
+ pageParamSet=myQueryParams.page;
132
119
  //scrolls a bit to load the dataset data
133
120
  await window.scrollTo(0, 200,{scrollAnimation:false});
134
- for (let i = 2; i <= queryPageVar; i++) {
121
+ for (let i = 2; i <= myQueryParams.page; i++) {
135
122
  await _$w("#jobsDataset").loadMore();
136
123
  currentLoadedItems=currentLoadedItems+itemsPerPage
137
124
  }
@@ -176,10 +163,7 @@ function init(_$w) {
176
163
  searchInputBlurredFirstTime=false;
177
164
  }
178
165
  });
179
- _$w('#dropdownDepartment, #dropdownLocation, #dropdownJobType').onChange(()=>{
180
- console.log("onChange triggering on dropdown@@@@@@");
181
- applyFilters(_$w);
182
- });
166
+ _$w('#dropdownDepartment, #dropdownLocation, #dropdownJobType').onChange(applyFilters(_$w));
183
167
  _$w('#resetFiltersButton, #clearSearch').onClick(()=>resetFilters(_$w));
184
168
 
185
169
  _$w('#openFiltersButton').onClick(()=>{
@@ -193,59 +177,6 @@ function init(_$w) {
193
177
  //URL onChange
194
178
  onChange(async ()=>{
195
179
  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
- // }
249
180
  });
250
181
 
251
182
 
@@ -258,41 +189,38 @@ async function handleBackAndForth(_$w){
258
189
  const newQueryParams=await location.query();
259
190
  console.log("newQueryParams: ", newQueryParams);
260
191
  if(newQueryParams.department){
261
- queryDepartmentVar=newQueryParams.department;
192
+ myQueryParams.department=newQueryParams.department;
262
193
  }
263
194
  else{
264
- queryDepartmentVar=undefined;
195
+ myQueryParams.department=undefined;
265
196
  deletedParam=true;
266
197
  _$w('#dropdownDepartment').value = '';
267
198
  }
268
199
  if(newQueryParams.location){
269
- queryLocationVar=newQueryParams.location;
200
+ myQueryParams.location=newQueryParams.location;
270
201
  }
271
202
  else{
272
- queryLocationVar=undefined;
203
+ myQueryParams.location=undefined;
273
204
  deletedParam=true
274
205
  _$w('#dropdownLocation').value = '';
275
206
  }
276
207
  if(newQueryParams.keyWord){
277
- queryKeyWordVar=newQueryParams.keyWord;
208
+ myQueryParams.keyWord=newQueryParams.keyWord;
278
209
  }
279
210
  else{
280
- queryKeyWordVar=undefined;
211
+ myQueryParams.keyWord=undefined;
281
212
  deletedParam=true;
282
213
  _$w('#searchInput').value = '';
283
214
  }
284
215
  if(newQueryParams.jobType){
285
- queryJobTypeVar=newQueryParams.jobType;
216
+ myQueryParams.jobType=newQueryParams.jobType;
286
217
  }
287
218
  else{
288
- queryJobTypeVar=undefined;
219
+ myQueryParams.jobType=undefined;
289
220
  deletedParam=true;
290
221
  _$w('#dropdownJobType').value = '';
291
222
  }
292
223
  await handleUrlParams(_$w);
293
- // if(deletedParam){
294
- // await applyFilters(_$w,true);
295
- // }
296
224
 
297
225
  }
298
226
 
@@ -429,7 +357,6 @@ async function handleDepartmentParam(_$w,department) {
429
357
  {
430
358
  console.log("department value found in dropdown options ",departmentValue);
431
359
  _$w('#dropdownDepartment').value = departmentValue;
432
- // await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
433
360
  }
434
361
  else{
435
362
  console.warn("department value not found in dropdown options");
@@ -470,7 +397,6 @@ async function handleLocationParam(_$w,location) {
470
397
 
471
398
  if(option){
472
399
  _$w('#dropdownLocation').value = option.value;
473
- // await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
474
400
  }
475
401
  else{
476
402
  console.warn("location value not found in dropdown options");