sr-npm 1.7.230 → 1.7.232

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.230",
3
+ "version": "1.7.232",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -17,6 +17,7 @@ const {
17
17
  let queryKeyWordVar;
18
18
  let queryDepartmentVar;
19
19
  let queryLocationVar;
20
+ let searchInputFocused = false;
20
21
  async function careersPageOnReady(_$w,thisObject,queryParams) {
21
22
  console.log("queryParams: ", queryParams);
22
23
  const { page, keyWord, department, location } = queryParams;
@@ -144,7 +145,6 @@ async function handlePageParam(_$w) {
144
145
  async function bind(_$w) {
145
146
  await _$w('#jobsDataset').onReady(async () => {
146
147
  await updateCount(_$w);
147
- await updateMapMarkers(_$w);
148
148
 
149
149
  });
150
150
 
@@ -163,6 +163,8 @@ function init(_$w) {
163
163
  const debouncedSearch = debounce(()=>applyFilters(_$w), 400,thisObjectVar);
164
164
 
165
165
  _$w('#searchInput').onInput(debouncedSearch);
166
+ _$w('#searchInput').onFocus(() => { searchInputFocused = true; });
167
+ _$w('#searchInput').onBlur(() => { searchInputFocused = false; });
166
168
  _$w('#dropdownDepartment, #dropdownLocation, #dropdownJobType').onChange(()=>applyFilters(_$w));
167
169
  _$w('#resetFiltersButton, #clearSearch').onClick(()=>resetFilters(_$w));
168
170
 
@@ -176,6 +178,7 @@ function init(_$w) {
176
178
  }
177
179
 
178
180
  async function applyFilters(_$w, skipUrlUpdate = false) {
181
+
179
182
  const dropdownFiltersMapping = [
180
183
  { elementId: '#dropdownDepartment', field: 'department', value: _$w('#dropdownDepartment').value },
181
184
  { elementId: '#dropdownLocation', field: 'cityText', value: _$w('#dropdownLocation').value },
@@ -237,9 +240,16 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
237
240
  await _$w('#jobsDataset').setFilter(filter);
238
241
  await _$w('#jobsDataset').refresh();
239
242
 
243
+
244
+ if (searchInputFocused) {
245
+ console.log("focusing search input");
246
+ _$w('#searchInput').focus();
247
+
248
+ }
249
+
240
250
  const count = await updateCount(_$w);
241
251
  console.log("updating map markers");
242
- await updateMapMarkers(_$w);
252
+ await updateMapMarkers(_$w,count);
243
253
  console.log("updating map markers completed");
244
254
  count ? _$w('#resultsMultiState').changeState('results') : _$w('#resultsMultiState').changeState('noResults');
245
255
 
@@ -259,13 +269,9 @@ async function resetFilters(_$w) {
259
269
 
260
270
  _$w('#resetFiltersButton').disable();
261
271
 
262
- queryParams.remove(["keyWord", "department","page","location"]);
263
-
272
+ queryParams.remove(["keyWord", "department","page"]);
264
273
 
265
274
  await updateCount(_$w);
266
- console.log("reseting map markers");
267
- await updateMapMarkers(_$w);
268
- console.log("reseting map markers completed");
269
275
  }
270
276
 
271
277
  async function updateCount(_$w) {
@@ -343,13 +349,14 @@ async function handleLocationParam(_$w,location) {
343
349
 
344
350
  }
345
351
 
346
- async function updateMapMarkers(_$w){
352
+ async function updateMapMarkers(_$w,count){
353
+ if(count>0){
347
354
  const numOfItems = await _$w('#jobsDataset').getTotalCount();
348
- // if(numOfItems>0){
349
355
  const items = await _$w('#jobsDataset').getItems(0, numOfItems);
350
356
  const markers = items.items.map(item => {
351
357
  const location = item.locationAddress.location;
352
358
  return {
359
+
353
360
  location: {
354
361
  latitude: location.latitude,
355
362
  longitude: location.longitude
@@ -358,23 +365,12 @@ async function updateMapMarkers(_$w){
358
365
  title: item.title,
359
366
  };
360
367
  });
361
- console.log("markers: ", markers);
362
- console.log("type of markers: ", typeof markers);
363
368
  //@ts-ignore
364
369
  _$w('#googleMaps').setMarkers(markers);
365
- let getmarkers2=await _$w('#googleMaps').markers;
366
- console.log("getmarkers2: ", getmarkers2);
367
- //}
368
- // else{
369
- // console.log("no positions found");
370
- // _$w('#googleMaps').setMarkers([{
371
- // location: {
372
- // latitude: 0,
373
- // longitude: 0
374
- // },
375
- // address: "No positions found",
376
- // }]);
377
- // }
370
+ }
371
+ else{
372
+ _$w('#googleMaps').setMarkers([]);
373
+ }
378
374
  }
379
375
 
380
376