sr-npm 1.2.9 → 1.2.11
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/backend/consts.js +15 -9
- package/package.json +1 -1
- package/pages/careersMultiBoxesPage.js +5 -6
- package/pages/careersPage.js +120 -167
- package/pages/pagesUtils.js +42 -39
- package/public/selectors.js +0 -53
package/backend/consts.js
CHANGED
|
@@ -72,6 +72,9 @@ const TASKS = {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
75
78
|
const TASK_TYPE = {
|
|
76
79
|
SCHEDULED: 'scheduled',
|
|
77
80
|
EVENT: 'event',
|
|
@@ -89,6 +92,10 @@ const supportTeamsPageIds={
|
|
|
89
92
|
VIDEO_TITLE: "#videoTitle",
|
|
90
93
|
VIDEO_PLAYER: "#videoPlayer",
|
|
91
94
|
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
92
99
|
RECENTLEY_ADDED_JOBS_ITEM: "#recentleyAddedJobsItem",
|
|
93
100
|
JOB_LOCATION: "#jobLocation",
|
|
94
101
|
JOB_TITLE: "#jobTitle",
|
|
@@ -130,13 +137,12 @@ const supportTeamsPageSections={
|
|
|
130
137
|
VIDEO: "video",
|
|
131
138
|
}
|
|
132
139
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
supportTeamsPageSections,
|
|
140
|
+
module.exports = {
|
|
141
|
+
TASKS_NAMES,
|
|
142
|
+
TASK_TYPE,
|
|
143
|
+
TASKS,
|
|
144
|
+
QUERY_MAX_LIMIT,
|
|
145
|
+
supportTeamsPageIds,
|
|
146
|
+
LINKS,
|
|
147
|
+
supportTeamsPageSections,
|
|
142
148
|
};
|
package/package.json
CHANGED
|
@@ -499,13 +499,12 @@ async function secondarySearch(_$w,query) {
|
|
|
499
499
|
}
|
|
500
500
|
function bindSearchInput(_$w) {
|
|
501
501
|
try {
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
const secondarySearchDebounced = debounce(async () => {
|
|
505
|
-
const query = (_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SECONDARY_SEARCH_INPUT).value || '').toLowerCase().trim();
|
|
506
|
-
await secondarySearch(_$w, query);
|
|
507
|
-
}, 150);
|
|
502
|
+
bindPrimarySearch(_$w,allvaluesobjects,alljobs);
|
|
508
503
|
|
|
504
|
+
const secondarySearchDebounced = debounce(async () => {
|
|
505
|
+
const query = (_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SECONDARY_SEARCH_INPUT).value || '').toLowerCase().trim();
|
|
506
|
+
await secondarySearch(_$w, query);
|
|
507
|
+
}, 150);
|
|
509
508
|
|
|
510
509
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SECONDARY_SEARCH_INPUT).onInput(secondarySearchDebounced);
|
|
511
510
|
|
package/pages/careersPage.js
CHANGED
|
@@ -5,10 +5,12 @@ const { query,queryParams,onChange} = require("wix-location-frontend");
|
|
|
5
5
|
const { location } = require("@wix/site-location");
|
|
6
6
|
const { COLLECTIONS } = require('../backend/collectionConsts');
|
|
7
7
|
const { careersMultiBoxesPageOnReady } = require('./careersMultiBoxesPage');
|
|
8
|
-
|
|
9
|
-
const {
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
debounce,
|
|
11
|
+
getFilter,
|
|
12
|
+
} = require('../public/filterUtils');
|
|
10
13
|
const { filterBrokenMarkers } = require('../public/utils');
|
|
11
|
-
|
|
12
14
|
let currentLoadedItems =100;
|
|
13
15
|
const itemsPerPage = 100;
|
|
14
16
|
let allJobs=[]
|
|
@@ -25,88 +27,41 @@ const { CAREERS_PAGE_SELECTORS, FILTER_FIELDS } = require('../public/selectors')
|
|
|
25
27
|
let siteconfig;
|
|
26
28
|
|
|
27
29
|
async function careersPageOnReady(_$w,thisObject=null,queryParams=null) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (await window.formFactor() === "Mobile") {
|
|
34
|
-
handleFilterInMobile(_$w);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if(siteconfig.customFields==="true") {
|
|
38
|
-
await careersMultiBoxesPageOnReady(_$w,queryParams);
|
|
39
|
-
}
|
|
40
|
-
else{
|
|
41
|
-
console.log("queryParams: ", queryParams);
|
|
42
|
-
const { page, keyWord, department, location,jobType,brand } = queryParams;
|
|
43
|
-
queryPageVar=page;
|
|
44
|
-
queryKeyWordVar=keyWord;
|
|
45
|
-
queryDepartmentVar=department;
|
|
46
|
-
queryLocationVar=location;
|
|
47
|
-
queryJobTypeVar=jobType;
|
|
48
|
-
queryBrandVar=brand;
|
|
49
|
-
thisObjectVar=thisObject;
|
|
50
|
-
allJobs = await getAllPositions();
|
|
51
|
-
|
|
52
|
-
activateAutoLoad(_$w);
|
|
53
|
-
await bind(_$w);
|
|
54
|
-
init(_$w);
|
|
55
|
-
await handleBrandDropdown(_$w);
|
|
56
|
-
await handleUrlParams(_$w);
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
30
|
+
if(siteconfig===undefined) {
|
|
31
|
+
const queryResult = await wixData.query(COLLECTIONS.SITE_CONFIGS).find();
|
|
32
|
+
siteconfig = queryResult.items[0];
|
|
61
33
|
}
|
|
62
34
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
const exitFilterBox = () => {
|
|
86
|
-
_$w(CAREERS_PAGE_SELECTORS.FILTER_BOX).collapse();
|
|
87
|
-
searchResultsSelectors.forEach(selector => {
|
|
88
|
-
_$w(selector).expand();
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
_$w(CAREERS_PAGE_SELECTORS.EXIT_BUTTON).onClick(()=>{
|
|
93
|
-
exitFilterBox();
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
_$w(CAREERS_PAGE_SELECTORS.REFINE_SEARCH_BUTTON).onClick(()=>{
|
|
97
|
-
exitFilterBox();
|
|
98
|
-
});
|
|
99
|
-
|
|
35
|
+
if(siteconfig.customFields==="true") {
|
|
36
|
+
await careersMultiBoxesPageOnReady(_$w,queryParams);
|
|
37
|
+
}
|
|
38
|
+
else{
|
|
39
|
+
console.log("queryParams: ", queryParams);
|
|
40
|
+
const { page, keyWord, department, location,jobType,brand } = queryParams;
|
|
41
|
+
queryPageVar=page;
|
|
42
|
+
queryKeyWordVar=keyWord;
|
|
43
|
+
queryDepartmentVar=department;
|
|
44
|
+
queryLocationVar=location;
|
|
45
|
+
queryJobTypeVar=jobType;
|
|
46
|
+
queryBrandVar=brand;
|
|
47
|
+
thisObjectVar=thisObject;
|
|
48
|
+
allJobs=await getAllPositions();
|
|
49
|
+
await activateAutoLoad(_$w);
|
|
50
|
+
await bind(_$w);
|
|
51
|
+
await init(_$w);
|
|
52
|
+
await handleBrandDropdown(_$w);
|
|
53
|
+
await handleUrlParams(_$w);
|
|
100
54
|
|
|
101
55
|
}
|
|
56
|
+
}
|
|
102
57
|
|
|
103
58
|
|
|
104
59
|
function activateAutoLoad(_$w)
|
|
105
60
|
{
|
|
106
|
-
_$w(
|
|
61
|
+
_$w("#jobsDataset").onReady(() => {
|
|
107
62
|
updateCount(_$w);
|
|
108
|
-
_$w(
|
|
109
|
-
if (currentLoadedItems<_$w(
|
|
63
|
+
_$w("#section2").onViewportEnter(() => {
|
|
64
|
+
if (currentLoadedItems<_$w("#jobsDataset").getTotalCount()) {
|
|
110
65
|
loadMoreJobs(_$w);
|
|
111
66
|
}
|
|
112
67
|
else {
|
|
@@ -126,12 +81,10 @@ async function loadMoreJobs(_$w) {
|
|
|
126
81
|
pageParamSet = Number(pageParamSet) + 1;
|
|
127
82
|
}
|
|
128
83
|
if (shouldLoad) {
|
|
129
|
-
_$w(
|
|
84
|
+
_$w("#jobsDataset").loadMore();
|
|
130
85
|
console.log("loading more jobs");
|
|
131
|
-
|
|
132
86
|
currentLoadedItems = currentLoadedItems + itemsPerPage;
|
|
133
|
-
const data = _$w(
|
|
134
|
-
|
|
87
|
+
const data = _$w("#positionsRepeater").data;
|
|
135
88
|
console.log("data length is : ", data.length);
|
|
136
89
|
setPageParamInUrl();
|
|
137
90
|
}
|
|
@@ -154,26 +107,26 @@ async function handleUrlParams(_$w) {
|
|
|
154
107
|
if (queryKeyWordVar) {
|
|
155
108
|
await handleKeyWordParam(_$w,queryKeyWordVar);
|
|
156
109
|
}
|
|
157
|
-
if (queryBrandVar && _$w(
|
|
110
|
+
if (queryBrandVar && _$w('#dropdownBrand').isVisible) { //if it is not visible, ignore it
|
|
158
111
|
await handleBrandParam(_$w,queryBrandVar);
|
|
159
112
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
113
|
+
if (queryPageVar) {
|
|
114
|
+
await handlePageParam(_$w);
|
|
115
|
+
}
|
|
116
|
+
if (queryDepartmentVar) {
|
|
117
|
+
await handleDepartmentParam(_$w,queryDepartmentVar);
|
|
118
|
+
}
|
|
119
|
+
if (queryLocationVar) {
|
|
120
|
+
await handleLocationParam(_$w,queryLocationVar);
|
|
121
|
+
}
|
|
122
|
+
if (queryJobTypeVar) {
|
|
123
|
+
await handleJobTypeParam(_$w,queryJobTypeVar);
|
|
124
|
+
}
|
|
172
125
|
await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
|
|
173
126
|
}
|
|
174
127
|
|
|
175
128
|
async function handleKeyWordParam(_$w,keyWord) {
|
|
176
|
-
_$w(
|
|
129
|
+
_$w('#searchInput').value = keyWord;
|
|
177
130
|
// Use applyFilters to maintain consistency instead of directly setting filter
|
|
178
131
|
}
|
|
179
132
|
|
|
@@ -193,18 +146,18 @@ async function handlePageParam(_$w) {
|
|
|
193
146
|
//scrolls a bit to load the dataset data
|
|
194
147
|
await window.scrollTo(0, 200,{scrollAnimation:false});
|
|
195
148
|
for (let i = 2; i <= queryPageVar; i++) {
|
|
196
|
-
await _$w(
|
|
149
|
+
await _$w("#jobsDataset").loadMore();
|
|
197
150
|
currentLoadedItems=currentLoadedItems+itemsPerPage
|
|
198
151
|
}
|
|
199
152
|
// the timeout is to wait for the repeater to render, then scroll to the last item.
|
|
200
153
|
setTimeout(() => {
|
|
201
|
-
const data = _$w(
|
|
154
|
+
const data = _$w("#positionsRepeater").data;
|
|
202
155
|
if (data && data.length > 0) {
|
|
203
156
|
//the dataset each time it loads 100 items
|
|
204
157
|
const lastIndex = data.length - itemsPerPage;
|
|
205
|
-
_$w(
|
|
158
|
+
_$w("#positionsRepeater").forEachItem(async ($item, itemData, index) => {
|
|
206
159
|
if (index === lastIndex) {
|
|
207
|
-
await $item(
|
|
160
|
+
await $item("#positionItem").scrollTo();
|
|
208
161
|
console.log("finishied scrolling inside handlePageParam")
|
|
209
162
|
}
|
|
210
163
|
});
|
|
@@ -215,40 +168,40 @@ async function handlePageParam(_$w) {
|
|
|
215
168
|
}
|
|
216
169
|
|
|
217
170
|
async function bind(_$w) {
|
|
218
|
-
await _$w(
|
|
171
|
+
await _$w('#jobsDataset').onReady(async () => {
|
|
219
172
|
await updateCount(_$w);
|
|
220
173
|
await updateMapMarkers(_$w);
|
|
221
174
|
|
|
222
175
|
});
|
|
223
176
|
|
|
224
177
|
if (await window.formFactor() === "Mobile") {
|
|
225
|
-
_$w(
|
|
178
|
+
_$w('#dropdownsContainer').collapse();
|
|
226
179
|
}
|
|
227
180
|
|
|
228
181
|
}
|
|
229
182
|
|
|
230
183
|
function init(_$w) {
|
|
231
184
|
const debouncedSearch = debounce(()=>applyFilters(_$w), 400,thisObjectVar);
|
|
232
|
-
_$w(
|
|
233
|
-
_$w(
|
|
234
|
-
if(searchInputBlurredFirstTime && _$w(
|
|
185
|
+
_$w('#searchInput').onInput(debouncedSearch);
|
|
186
|
+
_$w('#searchInput').onBlur(()=>{
|
|
187
|
+
if(searchInputBlurredFirstTime && _$w('#searchInput').value.trim() !== '')
|
|
235
188
|
{
|
|
236
|
-
_$w(
|
|
189
|
+
_$w('#searchInput').focus();
|
|
237
190
|
searchInputBlurredFirstTime=false;
|
|
238
191
|
}
|
|
239
192
|
});
|
|
240
|
-
_$w(
|
|
193
|
+
_$w('#dropdownDepartment, #dropdownLocation, #dropdownJobType, #dropdownBrand').onChange(()=>{
|
|
241
194
|
console.log("dropdown onChange is triggered");
|
|
242
195
|
applyFilters(_$w);
|
|
243
196
|
});
|
|
244
|
-
_$w(
|
|
197
|
+
_$w('#resetFiltersButton, #clearSearch').onClick(()=>resetFilters(_$w));
|
|
245
198
|
|
|
246
|
-
_$w(
|
|
247
|
-
_$w(
|
|
199
|
+
_$w('#openFiltersButton').onClick(()=>{
|
|
200
|
+
_$w('#dropdownsContainer, #closeFiltersButton').expand();
|
|
248
201
|
});
|
|
249
202
|
|
|
250
|
-
_$w(
|
|
251
|
-
_$w(
|
|
203
|
+
_$w('#closeFiltersButton').onClick(()=>{
|
|
204
|
+
_$w('#dropdownsContainer, #closeFiltersButton').collapse();
|
|
252
205
|
});
|
|
253
206
|
|
|
254
207
|
//URL onChange
|
|
@@ -267,7 +220,7 @@ async function handleBackAndForth(_$w){
|
|
|
267
220
|
else{
|
|
268
221
|
queryDepartmentVar=undefined;
|
|
269
222
|
deletedParam=true;
|
|
270
|
-
_$w(
|
|
223
|
+
_$w('#dropdownDepartment').value = '';
|
|
271
224
|
}
|
|
272
225
|
if(newQueryParams.location){
|
|
273
226
|
queryLocationVar=newQueryParams.location;
|
|
@@ -275,7 +228,7 @@ async function handleBackAndForth(_$w){
|
|
|
275
228
|
else{
|
|
276
229
|
queryLocationVar=undefined;
|
|
277
230
|
deletedParam=true
|
|
278
|
-
_$w(
|
|
231
|
+
_$w('#dropdownLocation').value = '';
|
|
279
232
|
}
|
|
280
233
|
if(newQueryParams.keyWord){
|
|
281
234
|
queryKeyWordVar=newQueryParams.keyWord;
|
|
@@ -283,7 +236,7 @@ async function handleBackAndForth(_$w){
|
|
|
283
236
|
else{
|
|
284
237
|
queryKeyWordVar=undefined;
|
|
285
238
|
deletedParam=true;
|
|
286
|
-
_$w(
|
|
239
|
+
_$w('#searchInput').value = '';
|
|
287
240
|
}
|
|
288
241
|
if(newQueryParams.jobType){
|
|
289
242
|
queryJobTypeVar=newQueryParams.jobType;
|
|
@@ -291,16 +244,16 @@ async function handleBackAndForth(_$w){
|
|
|
291
244
|
else{
|
|
292
245
|
queryJobTypeVar=undefined;
|
|
293
246
|
deletedParam=true;
|
|
294
|
-
_$w(
|
|
247
|
+
_$w('#dropdownJobType').value = '';
|
|
295
248
|
}
|
|
296
|
-
if(_$w(
|
|
249
|
+
if(_$w('#dropdownBrand').isVisible){
|
|
297
250
|
if(newQueryParams.brand){
|
|
298
251
|
queryBrandVar=newQueryParams.brand;
|
|
299
252
|
}
|
|
300
253
|
else{
|
|
301
254
|
queryBrandVar=undefined;
|
|
302
255
|
deletedParam=true;
|
|
303
|
-
_$w(
|
|
256
|
+
_$w('#dropdownBrand').value = '';
|
|
304
257
|
}
|
|
305
258
|
}
|
|
306
259
|
await handleUrlParams(_$w);
|
|
@@ -310,11 +263,11 @@ async function handleBackAndForth(_$w){
|
|
|
310
263
|
async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
311
264
|
console.log("applying filters");
|
|
312
265
|
const dropdownFiltersMapping = [
|
|
313
|
-
|
|
314
|
-
{ elementId:
|
|
315
|
-
{ elementId:
|
|
316
|
-
{ elementId:
|
|
317
|
-
{ elementId:
|
|
266
|
+
{ elementId: '#dropdownDepartment', field: 'department', value: _$w('#dropdownDepartment').value },
|
|
267
|
+
{ elementId: '#dropdownLocation', field: 'cityText', value: _$w('#dropdownLocation').value },
|
|
268
|
+
{ elementId: '#dropdownJobType', field: 'remote', value: _$w('#dropdownJobType').value},
|
|
269
|
+
{ elementId: '#dropdownBrand', field: 'brand', value: _$w('#dropdownBrand').value},
|
|
270
|
+
{ elementId: '#searchInput', field: 'title', value: _$w('#searchInput').value }
|
|
318
271
|
];
|
|
319
272
|
console.log("dropdownFiltersMapping: ", dropdownFiltersMapping);
|
|
320
273
|
|
|
@@ -333,16 +286,16 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
333
286
|
// build filters
|
|
334
287
|
if (filter.value && filter.value.trim() !== '') {
|
|
335
288
|
if (!skipUrlUpdate) {
|
|
336
|
-
if(filter.field ===
|
|
289
|
+
if(filter.field === 'title'){
|
|
337
290
|
queryParams.add({ keyWord: filter.value });
|
|
338
291
|
}
|
|
339
|
-
if(filter.field ===
|
|
292
|
+
if(filter.field === 'department'){
|
|
340
293
|
queryParams.add({ department: encodeURIComponent(filter.value) });
|
|
341
294
|
}
|
|
342
|
-
if(filter.field ===
|
|
295
|
+
if(filter.field === 'cityText'){
|
|
343
296
|
queryParams.add({ location: encodeURIComponent(filter.value) });
|
|
344
297
|
}
|
|
345
|
-
if(filter.field ===
|
|
298
|
+
if(filter.field === 'remote'){
|
|
346
299
|
if(filter.value === 'true'){
|
|
347
300
|
queryParams.add({ jobType: encodeURIComponent("remote") });
|
|
348
301
|
}
|
|
@@ -350,11 +303,11 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
350
303
|
queryParams.add({ jobType: encodeURIComponent("onsite") });
|
|
351
304
|
}
|
|
352
305
|
}
|
|
353
|
-
if(filter.field ===
|
|
306
|
+
if(filter.field === 'brand'){
|
|
354
307
|
queryParams.add({ brand: encodeURIComponent(filter.value) });
|
|
355
308
|
}
|
|
356
309
|
}
|
|
357
|
-
if(filter.field ===
|
|
310
|
+
if(filter.field === 'remote') {
|
|
358
311
|
value = filter.value === 'true';
|
|
359
312
|
} else {
|
|
360
313
|
value = filter.value;
|
|
@@ -363,22 +316,22 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
363
316
|
}
|
|
364
317
|
else{
|
|
365
318
|
if (!skipUrlUpdate) {
|
|
366
|
-
if(filter.field ===
|
|
319
|
+
if(filter.field === 'title'){
|
|
367
320
|
queryParams.remove(["keyWord" ]);
|
|
368
321
|
}
|
|
369
|
-
if(filter.field ===
|
|
322
|
+
if(filter.field === 'department'){
|
|
370
323
|
console.log("removing department from url")
|
|
371
324
|
queryParams.remove(["department" ]);
|
|
372
325
|
}
|
|
373
|
-
if(filter.field ===
|
|
326
|
+
if(filter.field === 'cityText'){
|
|
374
327
|
console.log("removing location from url")
|
|
375
328
|
queryParams.remove(["location" ]);
|
|
376
329
|
}
|
|
377
|
-
if(filter.field ===
|
|
330
|
+
if(filter.field === 'remote'){
|
|
378
331
|
console.log("removing jobType from url")
|
|
379
332
|
queryParams.remove(["jobType" ]);
|
|
380
333
|
}
|
|
381
|
-
if(filter.field ===
|
|
334
|
+
if(filter.field === 'brand'){
|
|
382
335
|
console.log("removing brand from url")
|
|
383
336
|
queryParams.remove(["brand" ]);
|
|
384
337
|
}
|
|
@@ -387,32 +340,32 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
387
340
|
});
|
|
388
341
|
|
|
389
342
|
const filter = await getFilter(filters, 'and');
|
|
390
|
-
await _$w(
|
|
391
|
-
await _$w(
|
|
343
|
+
await _$w('#jobsDataset').setFilter(filter);
|
|
344
|
+
await _$w('#jobsDataset').refresh();
|
|
392
345
|
|
|
393
346
|
const count = await updateCount(_$w);
|
|
394
347
|
console.log("updating map markers");
|
|
395
348
|
await updateMapMarkers(_$w);
|
|
396
349
|
console.log("updating map markers completed");
|
|
397
|
-
count ? _$w(
|
|
350
|
+
count ? _$w('#resultsMultiState').changeState('results') : _$w('#resultsMultiState').changeState('noResults');
|
|
398
351
|
|
|
399
352
|
|
|
400
353
|
// Update reset button state
|
|
401
354
|
const hasActiveFilters = filters.length > 0;
|
|
402
|
-
hasActiveFilters? _$w(
|
|
355
|
+
hasActiveFilters? _$w('#resetFiltersButton').enable() : _$w('#resetFiltersButton').disable();
|
|
403
356
|
|
|
404
357
|
|
|
405
358
|
}
|
|
406
359
|
|
|
407
360
|
async function resetFilters(_$w) {
|
|
408
|
-
_$w(
|
|
361
|
+
_$w('#searchInput, #dropdownDepartment, #dropdownLocation, #dropdownJobType, #dropdownBrand').value = '';
|
|
409
362
|
|
|
410
|
-
await _$w(
|
|
411
|
-
await _$w(
|
|
363
|
+
await _$w('#jobsDataset').setFilter(wixData.filter());
|
|
364
|
+
await _$w('#jobsDataset').refresh();
|
|
412
365
|
|
|
413
|
-
_$w(
|
|
366
|
+
_$w('#resultsMultiState').changeState('results');
|
|
414
367
|
|
|
415
|
-
_$w(
|
|
368
|
+
_$w('#resetFiltersButton').disable();
|
|
416
369
|
|
|
417
370
|
queryParams.remove(["keyWord", "department","page","location","jobType","brand"]);
|
|
418
371
|
|
|
@@ -424,7 +377,7 @@ async function resetFilters(_$w) {
|
|
|
424
377
|
}
|
|
425
378
|
|
|
426
379
|
async function updateCount(_$w) {
|
|
427
|
-
const count = await _$w(
|
|
380
|
+
const count = await _$w('#jobsDataset').getTotalCount();
|
|
428
381
|
_$w('#numOfPositionText').text = `Showing ${count} Open Positions`;
|
|
429
382
|
|
|
430
383
|
return count;
|
|
@@ -435,19 +388,19 @@ async function handleDepartmentParam(_$w,department) {
|
|
|
435
388
|
|
|
436
389
|
|
|
437
390
|
|
|
438
|
-
let dropdownOptions = _$w(
|
|
391
|
+
let dropdownOptions = _$w('#dropdownDepartment').options;
|
|
439
392
|
console.log("dropdown options:", dropdownOptions);
|
|
440
393
|
const optionsFromCMS=await wixData.query("AmountOfJobsPerDepartment").find();
|
|
441
394
|
//+1 because of the "All" option
|
|
442
395
|
|
|
443
396
|
if(dropdownOptions.length!==optionsFromCMS.items.length+1){
|
|
444
|
-
fixDropdownOptions(
|
|
397
|
+
fixDropdownOptions('#dropdownDepartment',optionsFromCMS, _$w);
|
|
445
398
|
}
|
|
446
399
|
|
|
447
|
-
if (_$w(
|
|
400
|
+
if (_$w('#dropdownDepartment').options.find(option => option.value === departmentValue))
|
|
448
401
|
{
|
|
449
402
|
console.log("department value found in dropdown options ",departmentValue);
|
|
450
|
-
_$w(
|
|
403
|
+
_$w('#dropdownDepartment').value = departmentValue;
|
|
451
404
|
}
|
|
452
405
|
else{
|
|
453
406
|
console.warn("department value not found in dropdown options");
|
|
@@ -476,18 +429,18 @@ function fixDropdownOptions(dropdown,optionsFromCMS, _$w){
|
|
|
476
429
|
|
|
477
430
|
async function handleLocationParam(_$w,location) {
|
|
478
431
|
const locationValue = decodeURIComponent(location);
|
|
479
|
-
let dropdownOptions = _$w(
|
|
432
|
+
let dropdownOptions = _$w('#dropdownLocation').options;
|
|
480
433
|
console.log("location dropdown options:", dropdownOptions);
|
|
481
434
|
const optionsFromCMS=await wixData.query("cities").find();
|
|
482
435
|
//+1 because of the "All" option
|
|
483
436
|
if(dropdownOptions.length!==optionsFromCMS.items.length+1){
|
|
484
|
-
fixDropdownOptions(
|
|
437
|
+
fixDropdownOptions('#dropdownLocation',optionsFromCMS, _$w);
|
|
485
438
|
}
|
|
486
439
|
|
|
487
|
-
const option=_$w(
|
|
440
|
+
const option=_$w('#dropdownLocation').options.find(option => option.value.toLowerCase() === locationValue.toLowerCase())
|
|
488
441
|
|
|
489
442
|
if(option){
|
|
490
|
-
_$w(
|
|
443
|
+
_$w('#dropdownLocation').value = option.value;
|
|
491
444
|
}
|
|
492
445
|
else{
|
|
493
446
|
console.warn("location value not found in dropdown options");
|
|
@@ -498,15 +451,15 @@ async function handleLocationParam(_$w,location) {
|
|
|
498
451
|
|
|
499
452
|
async function handleBrandParam(_$w,brand){
|
|
500
453
|
const brandValue = decodeURIComponent(brand);
|
|
501
|
-
let dropdownOptions = _$w(
|
|
454
|
+
let dropdownOptions = _$w('#dropdownBrand').options;
|
|
502
455
|
console.log("brand dropdown options:", dropdownOptions);
|
|
503
456
|
const optionsFromCMS=await wixData.query(COLLECTIONS.BRANDS).find();
|
|
504
457
|
if(dropdownOptions.length!==optionsFromCMS.items.length+1){
|
|
505
|
-
fixDropdownOptions(
|
|
458
|
+
fixDropdownOptions('#dropdownBrand',optionsFromCMS, _$w);
|
|
506
459
|
}
|
|
507
|
-
const option=_$w(
|
|
460
|
+
const option=_$w('#dropdownBrand').options.find(option => option.value.toLowerCase() === brandValue.toLowerCase())
|
|
508
461
|
if(option){
|
|
509
|
-
_$w(
|
|
462
|
+
_$w('#dropdownBrand').value = option.value;
|
|
510
463
|
}
|
|
511
464
|
else{
|
|
512
465
|
console.warn("brand value not found in dropdown options");
|
|
@@ -516,7 +469,7 @@ async function handleBrandParam(_$w,brand){
|
|
|
516
469
|
|
|
517
470
|
async function handleJobTypeParam(_$w,jobType) {
|
|
518
471
|
const jobTypeValue = decodeURIComponent(jobType);
|
|
519
|
-
let dropdownOptions = _$w(
|
|
472
|
+
let dropdownOptions = _$w('#dropdownJobType').options;
|
|
520
473
|
console.log("jobType dropdown options:", dropdownOptions);
|
|
521
474
|
let option;
|
|
522
475
|
if(jobTypeValue.toLowerCase()==="remote"){
|
|
@@ -526,7 +479,7 @@ async function handleJobTypeParam(_$w,jobType) {
|
|
|
526
479
|
option="false";
|
|
527
480
|
}
|
|
528
481
|
if(option){
|
|
529
|
-
_$w(
|
|
482
|
+
_$w('#dropdownJobType').value = option;
|
|
530
483
|
}
|
|
531
484
|
else{
|
|
532
485
|
console.warn("jobType value not found in dropdown options");
|
|
@@ -535,8 +488,8 @@ async function handleJobTypeParam(_$w,jobType) {
|
|
|
535
488
|
}
|
|
536
489
|
|
|
537
490
|
async function updateMapMarkers(_$w){
|
|
538
|
-
const numOfItems = await _$w(
|
|
539
|
-
const items = await _$w(
|
|
491
|
+
const numOfItems = await _$w('#jobsDataset').getTotalCount();
|
|
492
|
+
const items = await _$w('#jobsDataset').getItems(0, numOfItems);
|
|
540
493
|
const markers = filterBrokenMarkers(items.items).map(item => {
|
|
541
494
|
const location = item.locationAddress.location;
|
|
542
495
|
return {
|
|
@@ -549,21 +502,21 @@ async function updateMapMarkers(_$w){
|
|
|
549
502
|
};
|
|
550
503
|
});
|
|
551
504
|
//@ts-ignore
|
|
552
|
-
_$w(
|
|
505
|
+
_$w('#googleMaps').setMarkers(markers);
|
|
553
506
|
|
|
554
507
|
}
|
|
555
508
|
|
|
556
509
|
async function handleBrandDropdown(_$w){
|
|
557
510
|
if(siteconfig.disableMultiBrand==="false"){
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
else{
|
|
565
|
-
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).hide();
|
|
511
|
+
const brands=await wixData.query(COLLECTIONS.BRANDS).find();
|
|
512
|
+
if(brands.items.length>1){
|
|
513
|
+
console.log("showing brand dropdown");
|
|
514
|
+
_$w('#dropdownBrand').show();
|
|
566
515
|
}
|
|
516
|
+
}
|
|
517
|
+
else{
|
|
518
|
+
_$w('#dropdownBrand').hide();
|
|
519
|
+
}
|
|
567
520
|
}
|
|
568
521
|
module.exports = {
|
|
569
522
|
careersPageOnReady,
|
package/pages/pagesUtils.js
CHANGED
|
@@ -88,6 +88,7 @@ function loadPrimarySearchRepeater(_$w) {
|
|
|
88
88
|
);
|
|
89
89
|
location.to(clickedItemData["link-jobs-title"]);
|
|
90
90
|
});
|
|
91
|
+
|
|
91
92
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.CATEGORY_RESULTS_REPEATER).onItemReady(async ($item, itemData) => {
|
|
92
93
|
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_CATEGORY_BUTTON).label = itemData.title || '';
|
|
93
94
|
});
|
|
@@ -104,62 +105,63 @@ function loadPrimarySearchRepeater(_$w) {
|
|
|
104
105
|
|
|
105
106
|
}
|
|
106
107
|
|
|
107
|
-
|
|
108
|
+
function bindPrimarySearch(_$w,allvaluesobjects,alljobs) {
|
|
108
109
|
|
|
109
110
|
const primarySearchDebounced = debounce(async () => {
|
|
110
111
|
const query = (_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value || '').toLowerCase().trim();
|
|
111
112
|
await primarySearch(_$w, query, alljobs);
|
|
112
|
-
},
|
|
113
|
+
}, 400);
|
|
113
114
|
|
|
114
115
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).onInput(async () => {
|
|
115
|
-
|
|
116
|
+
primarySearchDebounced();
|
|
116
117
|
});
|
|
117
118
|
|
|
118
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).onClick(async () => {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
119
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).onClick(async () => {
|
|
120
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).expand();
|
|
121
|
+
if(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value.trim()!=='') {
|
|
122
|
+
query = _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value.trim();
|
|
123
|
+
await primarySearch(_$w, query, alljobs);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
await loadCategoriesListPrimarySearch(_$w,allvaluesobjects);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).onMouseOut(async () => {
|
|
131
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).collapse();
|
|
132
|
+
});
|
|
127
133
|
|
|
128
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.
|
|
129
|
-
|
|
130
|
-
|
|
134
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).onKeyPress(async (event) => {
|
|
135
|
+
if( event.key==='Enter') {
|
|
136
|
+
console.log("primary search input key pressed");
|
|
137
|
+
console.log("_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value: ",_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value);
|
|
138
|
+
if(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value.trim()==='') {
|
|
139
|
+
// _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).collapse();
|
|
140
|
+
const baseUrl = await location.baseUrl();
|
|
141
|
+
location.to(`${baseUrl}/search`);
|
|
142
|
+
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
let encodedKeyWord=encodeURIComponent(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value);
|
|
146
|
+
const baseUrl = await location.baseUrl();
|
|
147
|
+
location.to(`${baseUrl}/search?keyword=${encodedKeyWord}`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
});
|
|
131
151
|
|
|
132
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.
|
|
133
|
-
|
|
134
|
-
console.log("primary search input key pressed");
|
|
152
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_BUTTON).onClick(async () => {
|
|
153
|
+
console.log("primary search button clicked");
|
|
135
154
|
console.log("_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value: ",_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value);
|
|
136
155
|
if(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value.trim()==='') {
|
|
137
|
-
// _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).collapse();
|
|
138
156
|
const baseUrl = await location.baseUrl();
|
|
139
157
|
location.to(`${baseUrl}/search`);
|
|
140
|
-
|
|
141
|
-
}
|
|
158
|
+
}
|
|
142
159
|
else {
|
|
143
160
|
let encodedKeyWord=encodeURIComponent(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value);
|
|
144
161
|
const baseUrl = await location.baseUrl();
|
|
145
|
-
|
|
162
|
+
location.to(`${baseUrl}/search?keyword=${encodedKeyWord}`);
|
|
146
163
|
}
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_BUTTON).onClick(async () => {
|
|
151
|
-
console.log("primary search button clicked");
|
|
152
|
-
console.log("_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value: ",_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value);
|
|
153
|
-
if(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value.trim()==='') {
|
|
154
|
-
const baseUrl = await location.baseUrl();
|
|
155
|
-
location.to(`${baseUrl}/search`);
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
let encodedKeyWord=encodeURIComponent(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value);
|
|
159
|
-
const baseUrl = await location.baseUrl();
|
|
160
|
-
location.to(`${baseUrl}/search?keyword=${encodedKeyWord}`);
|
|
161
|
-
}
|
|
162
|
-
});
|
|
164
|
+
});
|
|
163
165
|
|
|
164
166
|
|
|
165
167
|
}
|
|
@@ -195,7 +197,8 @@ async function primarySearch(_$w,query,alljobs) {
|
|
|
195
197
|
}
|
|
196
198
|
}
|
|
197
199
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOB_RESULTS_REPEATER).data = filteredJobs
|
|
198
|
-
|
|
200
|
+
|
|
201
|
+
return filteredJobs.length>0;
|
|
199
202
|
|
|
200
203
|
}
|
|
201
204
|
|
package/public/selectors.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
const CAREERS_PAGE_SELECTORS = {
|
|
2
|
-
FILTER_ICON: '#filterIcon',
|
|
3
|
-
FILTER_BOX: '#filterBox',
|
|
4
|
-
RESULT_BOX: '#resultBox',
|
|
5
|
-
PAGINATION_BTN: '#paginationBtn',
|
|
6
|
-
HEAD_BTNS: '#headBtns',
|
|
7
|
-
SELECTED_VALUES_REPEATER: '#selectedValuesReapter',
|
|
8
|
-
BUTTOM_TXT: '#buttomTxt',
|
|
9
|
-
SECTION_24: '#section24',
|
|
10
|
-
SECTION_3: '#section3',
|
|
11
|
-
LINE_3: '#line3',
|
|
12
|
-
EXIT_BUTTON: '#exitBtn',
|
|
13
|
-
REFINE_SEARCH_BUTTON: '#refineSearchBtn',
|
|
14
|
-
|
|
15
|
-
POSITIONS_REPEATER: '#positionsRepeater',
|
|
16
|
-
POSITION_ITEM: '#positionItem',
|
|
17
|
-
SEARCH_INPUT: '#searchInput',
|
|
18
|
-
CLEAR_SEARCH: '#clearSearch',
|
|
19
|
-
|
|
20
|
-
DROPDOWN_BRAND: '#dropdownBrand',
|
|
21
|
-
DROPDOWN_CONTAINER: '#dropdownsContainer',
|
|
22
|
-
DROPDOWN_DEPARTMENT: '#dropdownDepartment',
|
|
23
|
-
DROPDOWN_LOCATION: '#dropdownLocation',
|
|
24
|
-
DROPDOWN_JOB_TYPE: '#dropdownJobType',
|
|
25
|
-
|
|
26
|
-
OPEN_FILTERS_BUTTON: '#openFiltersButton',
|
|
27
|
-
CLOSE_FILTERS_BUTTON: '#closeFiltersButton',
|
|
28
|
-
RESET_FILTERS_BUTTON: '#resetFiltersButton',
|
|
29
|
-
RESET_FILTERS_BUTTON: '#resetFiltersButton',
|
|
30
|
-
|
|
31
|
-
RESULTS_MULTI_STATE: '#resultsMultiState',
|
|
32
|
-
BRANDS_DATASET: '#brandsDataset',
|
|
33
|
-
DEPARTMENTS_DATASET: '#departmentsDataset',
|
|
34
|
-
LOCATIONS_DATASET: '#locationsDataset',
|
|
35
|
-
JOB_TYPES_DATASET: '#jobTypesDataset',
|
|
36
|
-
JOBS_DATASET: '#jobsDataset',
|
|
37
|
-
|
|
38
|
-
GOOGLE_MAPS: '#googleMaps',
|
|
39
|
-
FOOTER: '#footer',
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const FILTER_FIELDS = {
|
|
43
|
-
DEPARTMENT: 'department',
|
|
44
|
-
LOCATION: 'cityText',
|
|
45
|
-
JOB_TYPE: 'remote',
|
|
46
|
-
BRAND: 'brand',
|
|
47
|
-
SEARCH: 'title',
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
module.exports = {
|
|
51
|
-
CAREERS_PAGE_SELECTORS,
|
|
52
|
-
FILTER_FIELDS,
|
|
53
|
-
}
|