sr-npm 1.7.198 → 1.7.200

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.198",
3
+ "version": "1.7.200",
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 },
@@ -195,7 +191,7 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
195
191
  _$w(filter.elementId).value = '';
196
192
  filter.value = '';
197
193
  if (!skipUrlUpdate) {
198
- queryParams.remove(["keyWord", "department","page"]);
194
+ queryParams.remove(["keyWord", "department","page","location"]);
199
195
  }
200
196
  }
201
197
 
@@ -239,9 +235,10 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
239
235
  await _$w('#jobsDataset').refresh();
240
236
 
241
237
  const count = await updateCount(_$w);
242
-
238
+ updateMapMarkers(_$w,count);
243
239
  count ? _$w('#resultsMultiState').changeState('results') : _$w('#resultsMultiState').changeState('noResults');
244
240
 
241
+
245
242
  // Update reset button state
246
243
  const hasActiveFilters = filters.length > 0;
247
244
  hasActiveFilters? _$w('#resetFiltersButton').enable() : _$w('#resetFiltersButton').disable();
@@ -330,13 +327,35 @@ async function handleLocationParam(_$w,location) {
330
327
  await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
331
328
  }
332
329
  else{
333
- console.warn("department value not found in dropdown options");
334
- queryParams.remove(["department" ]);
330
+ console.warn("location value not found in dropdown options");
331
+ queryParams.remove(["location" ]);
335
332
 
336
333
  }
337
334
 
338
335
  }
339
336
 
337
+ async function updateMapMarkers(_$w,count){
338
+ if(count>0){
339
+ const numOfItems = await _$w('#jobsDataset').getTotalCount();
340
+ const items = await _$w('#jobsDataset').getItems(0, numOfItems);
341
+ const markers = items.items.map(item => {
342
+ const location = item.locationAddress.location;
343
+ return {
344
+ location: {
345
+ latitude: location.latitude,
346
+ longitude: location.longitude
347
+ },
348
+ address: item.locationAddress.formatted,
349
+ title: item.title,
350
+ };
351
+ });
352
+ //@ts-ignore
353
+ _$w('#googleMaps').setMarkers(markers);
354
+ }
355
+ else{
356
+ _$w('#googleMaps').setMarkers([]);
357
+ }
358
+ }
340
359
 
341
360
 
342
361
  module.exports = {