sr-npm 1.7.191 → 1.7.193
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 +38 -5
- package/pages/homePage.js +1 -21
package/package.json
CHANGED
package/pages/careersPage.js
CHANGED
|
@@ -16,11 +16,12 @@ const {
|
|
|
16
16
|
let queryPageVar;
|
|
17
17
|
let queryKeyWordVar;
|
|
18
18
|
let queryDepartmentVar;
|
|
19
|
-
|
|
20
|
-
async function careersPageOnReady(_$w,thisObject,querypage,querykeyWord,querydepartment) {
|
|
19
|
+
let queryLocationVar;
|
|
20
|
+
async function careersPageOnReady(_$w,thisObject,querypage,querykeyWord,querydepartment,querylocation) {
|
|
21
21
|
queryPageVar=querypage;
|
|
22
22
|
queryKeyWordVar=querykeyWord;
|
|
23
23
|
queryDepartmentVar=querydepartment;
|
|
24
|
+
queryLocationVar=querylocation;
|
|
24
25
|
thisObjectVar=thisObject;
|
|
25
26
|
allJobs=await getAllPositions();
|
|
26
27
|
await handleUrlParams(_$w);
|
|
@@ -90,6 +91,9 @@ async function handleUrlParams(_$w) {
|
|
|
90
91
|
if (queryDepartmentVar) {
|
|
91
92
|
await handleDepartmentParam(_$w,queryDepartmentVar);
|
|
92
93
|
}
|
|
94
|
+
if (queryLocationVar) {
|
|
95
|
+
await handleLocationParam(_$w,queryLocationVar);
|
|
96
|
+
}
|
|
93
97
|
}
|
|
94
98
|
|
|
95
99
|
async function handleKeyWordParam(_$w,keyWord) {
|
|
@@ -200,6 +204,9 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
200
204
|
if(filter.field === 'department'){
|
|
201
205
|
queryParams.add({ department: encodeURIComponent(filter.value) });
|
|
202
206
|
}
|
|
207
|
+
if(filter.field === 'cityText'){
|
|
208
|
+
queryParams.add({ location: encodeURIComponent(filter.value) });
|
|
209
|
+
}
|
|
203
210
|
}
|
|
204
211
|
if(filter.field === 'remote') {
|
|
205
212
|
value = filter.value === 'true';
|
|
@@ -216,6 +223,9 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
216
223
|
if(filter.field === 'department'){
|
|
217
224
|
queryParams.remove(["department" ]);
|
|
218
225
|
}
|
|
226
|
+
if(filter.field === 'cityText'){
|
|
227
|
+
queryParams.remove(["location" ]);
|
|
228
|
+
}
|
|
219
229
|
}
|
|
220
230
|
}
|
|
221
231
|
});
|
|
@@ -266,7 +276,7 @@ async function handleDepartmentParam(_$w,department) {
|
|
|
266
276
|
//+1 because of the "All" option
|
|
267
277
|
|
|
268
278
|
if(dropdownOptions.length!==optionsFromCMS.items.length+1){
|
|
269
|
-
fixDropdownOptions(optionsFromCMS, _$w);
|
|
279
|
+
fixDropdownOptions('#dropdownDepartment',optionsFromCMS, _$w);
|
|
270
280
|
}
|
|
271
281
|
|
|
272
282
|
if (_$w('#dropdownDepartment').options.find(option => option.value === departmentValue))
|
|
@@ -284,7 +294,7 @@ async function handleDepartmentParam(_$w,department) {
|
|
|
284
294
|
|
|
285
295
|
}
|
|
286
296
|
|
|
287
|
-
function fixDropdownOptions(optionsFromCMS, _$w){
|
|
297
|
+
function fixDropdownOptions(dropdown,optionsFromCMS, _$w){
|
|
288
298
|
let dropdownOptions = [];
|
|
289
299
|
dropdownOptions=[{
|
|
290
300
|
label: "All",
|
|
@@ -294,11 +304,34 @@ function fixDropdownOptions(optionsFromCMS, _$w){
|
|
|
294
304
|
label: item.title,
|
|
295
305
|
value: item.title
|
|
296
306
|
})));
|
|
297
|
-
_$w(
|
|
307
|
+
_$w(dropdown).options=dropdownOptions;
|
|
298
308
|
console.warn("something is wrong with the dropdown options, fixing it");
|
|
299
309
|
|
|
300
310
|
}
|
|
301
311
|
|
|
312
|
+
async function handleLocationParam(_$w,location) {
|
|
313
|
+
let dropdownOptions = _$w('#dropdownLocation').options;
|
|
314
|
+
console.log("location dropdown options:", dropdownOptions);
|
|
315
|
+
const optionsFromCMS=await wixData.query("Cities").find();
|
|
316
|
+
//+1 because of the "All" option
|
|
317
|
+
|
|
318
|
+
if(dropdownOptions.length!==optionsFromCMS.items.length+1){
|
|
319
|
+
fixDropdownOptions('#dropdownLocation',optionsFromCMS, _$w);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (_$w('#dropdownLocation').options.find(option => option.value === locationValue))
|
|
323
|
+
{
|
|
324
|
+
_$w('#dropdownLocation').value = locationValue;
|
|
325
|
+
await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
|
|
326
|
+
}
|
|
327
|
+
else{
|
|
328
|
+
console.warn("department value not found in dropdown options");
|
|
329
|
+
queryParams.remove(["department" ]);
|
|
330
|
+
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
}
|
|
334
|
+
|
|
302
335
|
|
|
303
336
|
|
|
304
337
|
module.exports = {
|
package/pages/homePage.js
CHANGED
|
@@ -25,11 +25,10 @@ async function homePageOnReady(_$w,thisObject) {
|
|
|
25
25
|
const numOfItems = await _$w('#citiesDataset').getTotalCount();
|
|
26
26
|
const items = await _$w('#citiesDataset').getItems(0, numOfItems);
|
|
27
27
|
let baseUrl = await location.baseUrl();
|
|
28
|
-
const linkUrl = `${baseUrl}/positions`;
|
|
29
28
|
const markers = items.items.map(item => {
|
|
30
29
|
const location = item.locationAddress.location;
|
|
31
30
|
const cityName = encodeURIComponent(item.title); // Use the city name from the item
|
|
32
|
-
const cityLinkUrl = `${
|
|
31
|
+
const cityLinkUrl = `${baseUrl}/positions?location=${cityName}`; // Add city as search parameter
|
|
33
32
|
return {
|
|
34
33
|
location: {
|
|
35
34
|
latitude: location.latitude,
|
|
@@ -43,25 +42,6 @@ async function homePageOnReady(_$w,thisObject) {
|
|
|
43
42
|
//@ts-ignore
|
|
44
43
|
_$w('#googleMaps').setMarkers(markers);
|
|
45
44
|
});
|
|
46
|
-
_$w('#googleMaps').onMarkerClicked((event) => {
|
|
47
|
-
console.log("event: ", event);
|
|
48
|
-
|
|
49
|
-
// Get all markers from the map
|
|
50
|
-
const allMarkers = _$w('#googleMaps').markers;
|
|
51
|
-
console.log("allMarkers: ", allMarkers);
|
|
52
|
-
const getMarker = _$w('#googleMaps').getMarkers();
|
|
53
|
-
console.log("getMarker: ", getMarker);
|
|
54
|
-
|
|
55
|
-
// Find the clicked marker by matching coordinates
|
|
56
|
-
const clickedMarker = allMarkers.find(marker =>
|
|
57
|
-
marker.location.latitude === event.location.latitude &&
|
|
58
|
-
marker.location.longitude === event.location.longitude
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
if (clickedMarker && clickedMarker.linkUrl) {
|
|
62
|
-
location.to(clickedMarker.linkUrl);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
45
|
}
|
|
66
46
|
|
|
67
47
|
function init(_$w) {
|