sr-npm 1.7.230 → 1.7.231
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 +1 -1
- package/pages/careersPage.js +18 -24
package/package.json
CHANGED
package/pages/careersPage.js
CHANGED
|
@@ -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,14 @@ 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
|
+
_$w('#searchInput').focus();
|
|
246
|
+
}
|
|
247
|
+
|
|
240
248
|
const count = await updateCount(_$w);
|
|
241
249
|
console.log("updating map markers");
|
|
242
|
-
await updateMapMarkers(_$w);
|
|
250
|
+
await updateMapMarkers(_$w,count);
|
|
243
251
|
console.log("updating map markers completed");
|
|
244
252
|
count ? _$w('#resultsMultiState').changeState('results') : _$w('#resultsMultiState').changeState('noResults');
|
|
245
253
|
|
|
@@ -259,13 +267,9 @@ async function resetFilters(_$w) {
|
|
|
259
267
|
|
|
260
268
|
_$w('#resetFiltersButton').disable();
|
|
261
269
|
|
|
262
|
-
queryParams.remove(["keyWord", "department","page"
|
|
263
|
-
|
|
270
|
+
queryParams.remove(["keyWord", "department","page"]);
|
|
264
271
|
|
|
265
272
|
await updateCount(_$w);
|
|
266
|
-
console.log("reseting map markers");
|
|
267
|
-
await updateMapMarkers(_$w);
|
|
268
|
-
console.log("reseting map markers completed");
|
|
269
273
|
}
|
|
270
274
|
|
|
271
275
|
async function updateCount(_$w) {
|
|
@@ -343,13 +347,14 @@ async function handleLocationParam(_$w,location) {
|
|
|
343
347
|
|
|
344
348
|
}
|
|
345
349
|
|
|
346
|
-
async function updateMapMarkers(_$w){
|
|
350
|
+
async function updateMapMarkers(_$w,count){
|
|
351
|
+
if(count>0){
|
|
347
352
|
const numOfItems = await _$w('#jobsDataset').getTotalCount();
|
|
348
|
-
// if(numOfItems>0){
|
|
349
353
|
const items = await _$w('#jobsDataset').getItems(0, numOfItems);
|
|
350
354
|
const markers = items.items.map(item => {
|
|
351
355
|
const location = item.locationAddress.location;
|
|
352
356
|
return {
|
|
357
|
+
|
|
353
358
|
location: {
|
|
354
359
|
latitude: location.latitude,
|
|
355
360
|
longitude: location.longitude
|
|
@@ -358,23 +363,12 @@ async function updateMapMarkers(_$w){
|
|
|
358
363
|
title: item.title,
|
|
359
364
|
};
|
|
360
365
|
});
|
|
361
|
-
console.log("markers: ", markers);
|
|
362
|
-
console.log("type of markers: ", typeof markers);
|
|
363
366
|
//@ts-ignore
|
|
364
367
|
_$w('#googleMaps').setMarkers(markers);
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
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
|
-
// }
|
|
368
|
+
}
|
|
369
|
+
else{
|
|
370
|
+
_$w('#googleMaps').setMarkers([]);
|
|
371
|
+
}
|
|
378
372
|
}
|
|
379
373
|
|
|
380
374
|
|