sr-npm 1.7.199 → 1.7.201

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.199",
3
+ "version": "1.7.201",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -92,8 +92,6 @@ async function handleUrlParams(_$w) {
92
92
  await handleDepartmentParam(_$w,queryDepartmentVar);
93
93
  }
94
94
  if (queryLocationVar) {
95
-
96
- console.log("queryLocationVar:@!#$#@%^%$&%&^%&^% ", queryLocationVar);
97
95
  await handleLocationParam(_$w,queryLocationVar);
98
96
  }
99
97
  }
@@ -175,8 +173,6 @@ function init(_$w) {
175
173
  }
176
174
 
177
175
  async function applyFilters(_$w, skipUrlUpdate = false) {
178
- console.log("applyFilters");
179
- console.log("dropdownLocation value: ", _$w('#dropdownLocation').value);
180
176
  const dropdownFiltersMapping = [
181
177
  { elementId: '#dropdownDepartment', field: 'department', value: _$w('#dropdownDepartment').value },
182
178
  { elementId: '#dropdownLocation', field: 'cityText', value: _$w('#dropdownLocation').value },
@@ -239,9 +235,12 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
239
235
  await _$w('#jobsDataset').refresh();
240
236
 
241
237
  const count = await updateCount(_$w);
242
-
238
+ console.log("updating map markers");
239
+ await updateMapMarkers(_$w,count);
240
+ console.log("updating map markers completed");
243
241
  count ? _$w('#resultsMultiState').changeState('results') : _$w('#resultsMultiState').changeState('noResults');
244
242
 
243
+
245
244
  // Update reset button state
246
245
  const hasActiveFilters = filters.length > 0;
247
246
  hasActiveFilters? _$w('#resetFiltersButton').enable() : _$w('#resetFiltersButton').disable();
@@ -337,6 +336,28 @@ async function handleLocationParam(_$w,location) {
337
336
 
338
337
  }
339
338
 
339
+ async function updateMapMarkers(_$w,count){
340
+ if(count>0){
341
+ const numOfItems = await _$w('#jobsDataset').getTotalCount();
342
+ const items = await _$w('#jobsDataset').getItems(0, numOfItems);
343
+ const markers = items.items.map(item => {
344
+ const location = item.locationAddress.location;
345
+ return {
346
+ location: {
347
+ latitude: location.latitude,
348
+ longitude: location.longitude
349
+ },
350
+ address: item.locationAddress.formatted,
351
+ title: item.title,
352
+ };
353
+ });
354
+ //@ts-ignore
355
+ _$w('#googleMaps').setMarkers(markers);
356
+ }
357
+ else{
358
+ _$w('#googleMaps').setMarkers([]);
359
+ }
360
+ }
340
361
 
341
362
 
342
363
  module.exports = {