sr-npm 1.7.347 → 1.7.349

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.347",
3
+ "version": "1.7.349",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -32,7 +32,7 @@ thisObjectVar=thisObject;
32
32
  allJobs=await getAllPositions();
33
33
  await activateAutoLoad(_$w);
34
34
  await bind(_$w);
35
- await init(_$w,thisObject,queryParams);
35
+ await init(_$w);
36
36
  await handleUrlParams(_$w);
37
37
 
38
38
  }
@@ -102,12 +102,14 @@ async function handleUrlParams(_$w) {
102
102
  if (queryLocationVar) {
103
103
  await handleLocationParam(_$w,queryLocationVar);
104
104
  }
105
+
106
+ await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
105
107
  }
106
108
 
107
109
  async function handleKeyWordParam(_$w,keyWord) {
108
110
  _$w('#searchInput').value = keyWord;
109
111
  // Use applyFilters to maintain consistency instead of directly setting filter
110
- await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
112
+ // await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
111
113
  }
112
114
 
113
115
  async function handlePageParam(_$w) {
@@ -160,7 +162,7 @@ async function bind(_$w) {
160
162
 
161
163
  }
162
164
 
163
- function init(_$w,thisObject,queryParams) {
165
+ function init(_$w) {
164
166
  const debouncedSearch = debounce(()=>applyFilters(_$w), 400,thisObjectVar);
165
167
  _$w('#searchInput').onInput(debouncedSearch);
166
168
  _$w('#searchInput').onBlur(()=>{
@@ -170,7 +172,10 @@ function init(_$w,thisObject,queryParams) {
170
172
  searchInputBlurredFirstTime=false;
171
173
  }
172
174
  });
173
- _$w('#dropdownDepartment, #dropdownLocation, #dropdownJobType').onChange(()=>applyFilters(_$w));
175
+ _$w('#dropdownDepartment, #dropdownLocation, #dropdownJobType').onChange(()=>{
176
+ console.log("onChange triggering on dropdown@@@@@@");
177
+ applyFilters(_$w);
178
+ });
174
179
  _$w('#resetFiltersButton, #clearSearch').onClick(()=>resetFilters(_$w));
175
180
 
176
181
  _$w('#openFiltersButton').onClick(()=>{
@@ -183,10 +188,31 @@ function init(_$w,thisObject,queryParams) {
183
188
 
184
189
  //URL onChange
185
190
  onChange(async ()=>{
191
+ let deletedParam=false
186
192
  const newQueryParams=await location.query();
187
193
  console.log("onChange triggering on ready");
188
194
  console.log("newQueryParams: ", newQueryParams);
189
- location.to(`/positions?KeyWord=123}`);
195
+ if(newQueryParams.department){
196
+ queryDepartmentVar=newQueryParams.department;
197
+ }
198
+ else{
199
+ queryDepartmentVar=undefined;
200
+ deletedParam=true;
201
+ _$w('#dropdownDepartment').value = '';
202
+ }
203
+ if(newQueryParams.location){
204
+ queryLocationVar=newQueryParams.location;
205
+ }
206
+ else{
207
+ queryLocationVar=undefined;
208
+ deletedParam=true
209
+ _$w('#dropdownLocation').value = '';
210
+ }
211
+ await handleUrlParams(_$w);
212
+ // if(deletedParam){
213
+ // await applyFilters(_$w,true);
214
+ // }
215
+
190
216
 
191
217
 
192
218
 
@@ -379,7 +405,7 @@ async function handleDepartmentParam(_$w,department) {
379
405
  {
380
406
  console.log("department value found in dropdown options ",departmentValue);
381
407
  _$w('#dropdownDepartment').value = departmentValue;
382
- await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
408
+ // await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
383
409
  }
384
410
  else{
385
411
  console.warn("department value not found in dropdown options");
@@ -420,7 +446,7 @@ async function handleLocationParam(_$w,location) {
420
446
 
421
447
  if(option){
422
448
  _$w('#dropdownLocation').value = option.value;
423
- await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
449
+ // await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
424
450
  }
425
451
  else{
426
452
  console.warn("location value not found in dropdown options");