sr-npm 1.2.54 → 1.2.55
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/careersMultiBoxesPageIds.js +4 -1
- package/package.json +2 -2
- package/pages/careersMultiBoxesPage.js +11 -13
- package/pages/careersPage.js +14 -12
- package/pages/homePage.js +15 -13
- package/pages/pagesUtils.js +0 -2
- package/public/index.js +1 -0
- package/public/{primarySearchUtil.js → primarySearchUtils.js} +72 -71
- package/public/selectors.js +2 -14
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const CAREERS_MULTI_BOXES_PAGE_CONSTS={
|
|
2
|
+
JOBS_DATASET: '#jobsDataset',
|
|
2
3
|
FILTER_REPEATER: '#filterReapter',
|
|
3
4
|
JOBS_REPEATER: '#jobsReapter',
|
|
4
5
|
JOBS_REPEATER_ITEM_TITLE: '#jobTitle',
|
|
@@ -28,6 +29,8 @@ const CAREERS_MULTI_BOXES_PAGE_CONSTS={
|
|
|
28
29
|
PRIMARY_SEARCH_MULTI_BOX: '#primarySearchMultiBox',
|
|
29
30
|
PRIMARY_SEARCH_POSITION_BUTTON: '#primarySearchPositionButton',
|
|
30
31
|
PRIMARY_SEARCH_CATEGORY_BUTTON: '#primarySearchCategoryButton',
|
|
32
|
+
RESULTS_CONTAINER: '#resultsContainer',
|
|
33
|
+
PRIMARY_SEARCH_BUTTON: '#primarySearchButton',
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
const TWG_JOBS_COLLECTION_FIELDS={
|
|
@@ -35,7 +38,7 @@ const TWG_JOBS_COLLECTION_FIELDS={
|
|
|
35
38
|
LINK_JOBS_REF_ID_SLUG: 'link-jobs-refId-slug',
|
|
36
39
|
}
|
|
37
40
|
|
|
38
|
-
const CATEGORY_CUSTOM_FIELD_ID_IN_CMS
|
|
41
|
+
const CATEGORY_CUSTOM_FIELD_ID_IN_CMS='5cd8c873c9e77c0008aa7d23';
|
|
39
42
|
|
|
40
43
|
// used for filters - don't add anything else here
|
|
41
44
|
const fieldTitlesInCMS={
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sr-npm",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.55",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@eslint/js": "^9.39.0",
|
|
33
33
|
"eslint": "^9.38.0",
|
|
34
34
|
"globals": "^16.4.0",
|
|
35
|
-
"prettier": "^3.
|
|
35
|
+
"prettier": "^3.6.2",
|
|
36
36
|
"rewire": "^9.0.1"
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
const { COLLECTIONS,CUSTOM_VALUES_COLLECTION_FIELDS,JOBS_COLLECTION_FIELDS } = require('../backend/collectionConsts');
|
|
2
|
+
const { CAREERS_PAGE_SELECTORS } = require('../public/selectors');
|
|
3
|
+
|
|
1
4
|
const { window } = require('@wix/site-window');
|
|
2
5
|
const { queryParams,onChange} = require('wix-location-frontend');
|
|
3
6
|
const { location } = require("@wix/site-location");
|
|
4
|
-
|
|
5
|
-
const { COLLECTIONS,CUSTOM_VALUES_COLLECTION_FIELDS,JOBS_COLLECTION_FIELDS } = require('../backend/collectionConsts');
|
|
6
|
-
const { CAREERS_PAGE_SELECTORS, GLOBAL_SECTIONS_SELECTORS } = require('../public/selectors');
|
|
7
7
|
const {
|
|
8
8
|
CAREERS_MULTI_BOXES_PAGE_CONSTS,
|
|
9
9
|
FiltersIds,
|
|
@@ -19,8 +19,8 @@ const { groupValuesByField,
|
|
|
19
19
|
getCorrectOption,
|
|
20
20
|
getOptionIndexFromCheckBox,
|
|
21
21
|
getAllDatasetItems
|
|
22
|
-
} = require('./pagesUtils');
|
|
23
|
-
const { loadPrimarySearchRepeater, bindPrimarySearch,
|
|
22
|
+
} = require('./pagesUtils');
|
|
23
|
+
const { loadPrimarySearchRepeater, bindPrimarySearch, primarySearch } = require('../public/primarySearchUtil');
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
let dontUpdateThisCheckBox;
|
|
@@ -147,10 +147,10 @@ async function handleUrlParams(_$w,urlParams,handleBackAndForth=false) {
|
|
|
147
147
|
let currentApplyFilterFlag=false;
|
|
148
148
|
//apply this first to determine all jobs
|
|
149
149
|
if(urlParams.keyword) {
|
|
150
|
-
applyFiltering = await
|
|
150
|
+
applyFiltering = await primarySearch(_$w, decodeURIComponent(urlParams.keyword));
|
|
151
151
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value = decodeURIComponent(urlParams.keyword);
|
|
152
152
|
|
|
153
|
-
const items = await getAllDatasetItems(_$w,
|
|
153
|
+
const items = await getAllDatasetItems(_$w, CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_DATASET);
|
|
154
154
|
|
|
155
155
|
currentJobs = items;
|
|
156
156
|
keywordAllJobs = items;
|
|
@@ -432,7 +432,7 @@ function getValueFromValueId(valueIds, value) {
|
|
|
432
432
|
async function updateJobsAndNumbersAndFilters(_$w,clearAll=false) {
|
|
433
433
|
await applyJobFilters(_$w,clearAll); // re-query jobs
|
|
434
434
|
await refreshFacetCounts(_$w,clearAll); // recompute and update counts in all lists
|
|
435
|
-
updateSelectedValuesRepeater(_$w);
|
|
435
|
+
await updateSelectedValuesRepeater(_$w);
|
|
436
436
|
updateTotalJobsCountText(_$w);
|
|
437
437
|
}
|
|
438
438
|
|
|
@@ -475,8 +475,8 @@ function getValueFromValueId(valueIds, value) {
|
|
|
475
475
|
}
|
|
476
476
|
else{
|
|
477
477
|
_$w(`#${FiltersIds[fieldTitle]}MultiBox`).changeState(`${FiltersIds[fieldTitle]}Results`);
|
|
478
|
-
|
|
479
|
-
|
|
478
|
+
_$w(`#${FiltersIds[fieldTitle]}CheckBox`).options = filtered;
|
|
479
|
+
_$w(`#${FiltersIds[fieldTitle]}CheckBox`).value = preserved;
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
482
|
|
|
@@ -524,7 +524,6 @@ function getValueFromValueId(valueIds, value) {
|
|
|
524
524
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER).data = jobsFirstPage;
|
|
525
525
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationCurrentText).text = "1";
|
|
526
526
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.paginationTotalCountText).text = secondarySearchIsFilled? Math.ceil(currentSecondarySearchJobs.length/pagination.pageSize).toString():Math.ceil(currentJobs.length/pagination.pageSize).toString();
|
|
527
|
-
|
|
528
527
|
if(jobsFirstPage.length===0) {
|
|
529
528
|
await _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_MULTI_STATE_BOX).changeState("noJobs");
|
|
530
529
|
}
|
|
@@ -640,8 +639,7 @@ async function secondarySearch(_$w,query) {
|
|
|
640
639
|
await refreshFacetCounts(_$w);
|
|
641
640
|
return allsecondarySearchJobs;
|
|
642
641
|
}
|
|
643
|
-
|
|
644
|
-
function bindSearchInput(_$w) {
|
|
642
|
+
function bindSearchInput(_$w) {
|
|
645
643
|
try {
|
|
646
644
|
bindPrimarySearch(_$w, allvaluesobjects);
|
|
647
645
|
|
package/pages/careersPage.js
CHANGED
|
@@ -6,7 +6,7 @@ const { location } = require("@wix/site-location");
|
|
|
6
6
|
const { COLLECTIONS } = require('../backend/collectionConsts');
|
|
7
7
|
const { careersMultiBoxesPageOnReady } = require('./careersMultiBoxesPage');
|
|
8
8
|
const { debounce, getFilter} = require('../public/filterUtils');
|
|
9
|
-
const { CAREERS_PAGE_SELECTORS, FILTER_FIELDS
|
|
9
|
+
const { CAREERS_PAGE_SELECTORS, FILTER_FIELDS } = require('../public/selectors');
|
|
10
10
|
const { filterBrokenMarkers } = require('../public/utils');
|
|
11
11
|
|
|
12
12
|
let currentLoadedItems =100;
|
|
@@ -52,14 +52,16 @@ async function careersPageOnReady(_$w,thisObject=null,queryParams=null) {
|
|
|
52
52
|
await handleUrlParams(_$w);
|
|
53
53
|
|
|
54
54
|
}
|
|
55
|
+
|
|
56
|
+
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
function activateAutoLoad(_$w)
|
|
58
60
|
{
|
|
59
|
-
_$w(
|
|
61
|
+
_$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).onReady(() => {
|
|
60
62
|
updateCount(_$w);
|
|
61
63
|
_$w(CAREERS_PAGE_SELECTORS.FOOTER).onViewportEnter(() => {
|
|
62
|
-
if (currentLoadedItems<_$w(
|
|
64
|
+
if (currentLoadedItems<_$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).getTotalCount()) {
|
|
63
65
|
loadMoreJobs(_$w);
|
|
64
66
|
}
|
|
65
67
|
else {
|
|
@@ -79,7 +81,7 @@ async function loadMoreJobs(_$w) {
|
|
|
79
81
|
pageParamSet = Number(pageParamSet) + 1;
|
|
80
82
|
}
|
|
81
83
|
if (shouldLoad) {
|
|
82
|
-
_$w(
|
|
84
|
+
_$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).loadMore();
|
|
83
85
|
console.log("loading more jobs");
|
|
84
86
|
|
|
85
87
|
currentLoadedItems = currentLoadedItems + itemsPerPage;
|
|
@@ -168,7 +170,7 @@ async function handlePageParam(_$w) {
|
|
|
168
170
|
}
|
|
169
171
|
|
|
170
172
|
async function bind(_$w) {
|
|
171
|
-
await _$w(
|
|
173
|
+
await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).onReady(async () => {
|
|
172
174
|
await updateCount(_$w);
|
|
173
175
|
await updateMapMarkers(_$w);
|
|
174
176
|
|
|
@@ -335,8 +337,8 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
335
337
|
});
|
|
336
338
|
|
|
337
339
|
const filter = await getFilter(filters, 'and');
|
|
338
|
-
await _$w(
|
|
339
|
-
await _$w(
|
|
340
|
+
await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).setFilter(filter);
|
|
341
|
+
await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).refresh();
|
|
340
342
|
|
|
341
343
|
const count = await updateCount(_$w);
|
|
342
344
|
console.log("updating map markers");
|
|
@@ -355,8 +357,8 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
355
357
|
async function resetFilters(_$w) {
|
|
356
358
|
_$w(CAREERS_PAGE_SELECTORS.SEARCH_INPUT, CAREERS_PAGE_SELECTORS.DROPDOWN_DEPARTMENT, CAREERS_PAGE_SELECTORS.DROPDOWN_LOCATION, CAREERS_PAGE_SELECTORS.DROPDOWN_JOB_TYPE, CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).value = '';
|
|
357
359
|
|
|
358
|
-
await _$w(
|
|
359
|
-
await _$w(
|
|
360
|
+
await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).setFilter(wixData.filter());
|
|
361
|
+
await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).refresh();
|
|
360
362
|
|
|
361
363
|
_$w(CAREERS_PAGE_SELECTORS.RESULTS_MULTI_STATE).changeState('results');
|
|
362
364
|
|
|
@@ -372,7 +374,7 @@ async function resetFilters(_$w) {
|
|
|
372
374
|
}
|
|
373
375
|
|
|
374
376
|
async function updateCount(_$w) {
|
|
375
|
-
const count = await _$w(
|
|
377
|
+
const count = await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).getTotalCount();
|
|
376
378
|
_$w('#numOfPositionText').text = `Showing ${count} Open Positions`;
|
|
377
379
|
|
|
378
380
|
return count;
|
|
@@ -483,8 +485,8 @@ async function handleJobTypeParam(_$w,jobType) {
|
|
|
483
485
|
}
|
|
484
486
|
|
|
485
487
|
async function updateMapMarkers(_$w){
|
|
486
|
-
const numOfItems = await _$w(
|
|
487
|
-
const items = await _$w(
|
|
488
|
+
const numOfItems = await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).getTotalCount();
|
|
489
|
+
const items = await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).getItems(0, numOfItems);
|
|
488
490
|
const markers = filterBrokenMarkers(items.items).map(item => {
|
|
489
491
|
const location = item.locationAddress.location;
|
|
490
492
|
return {
|
package/pages/homePage.js
CHANGED
|
@@ -4,7 +4,6 @@ const { filterBrokenMarkers } = require('../public/utils');
|
|
|
4
4
|
const { location } = require('@wix/site-location');
|
|
5
5
|
const {wixData} = require('wix-data');
|
|
6
6
|
const { COLLECTIONS } = require('../backend/collectionConsts');
|
|
7
|
-
const { GLOBAL_SECTIONS_SELECTORS } = require('../public/selectors');
|
|
8
7
|
const { getAllRecords } = require('./pagesUtils');
|
|
9
8
|
const { bindPrimarySearch, loadPrimarySearchRepeater } = require('../public/primarySearchUtil');
|
|
10
9
|
|
|
@@ -116,6 +115,9 @@ function bindViewAllButton(_$w) {
|
|
|
116
115
|
});
|
|
117
116
|
}
|
|
118
117
|
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
119
121
|
function init(_$w) {
|
|
120
122
|
const debouncedInput = debounce(() => handleSearchInput(_$w), 400, thisObjectVar);
|
|
121
123
|
|
|
@@ -130,15 +132,15 @@ function init(_$w) {
|
|
|
130
132
|
});
|
|
131
133
|
|
|
132
134
|
_$w('#searchInput').onFocus(() => {
|
|
133
|
-
if (_$w(
|
|
134
|
-
_$w(
|
|
135
|
+
if (_$w(`#resultsContainer`).collapsed) {
|
|
136
|
+
_$w(`#resultsContainer`).expand();
|
|
135
137
|
}
|
|
136
138
|
});
|
|
137
139
|
|
|
138
140
|
_$w('#searchInput').onBlur(() => {
|
|
139
141
|
setTimeout(() => {
|
|
140
|
-
if (!_$w(
|
|
141
|
-
_$w(
|
|
142
|
+
if (!_$w(`#resultsContainer`).collapsed) {
|
|
143
|
+
_$w(`#resultsContainer`).collapse();
|
|
142
144
|
}
|
|
143
145
|
}, 250);
|
|
144
146
|
});
|
|
@@ -160,24 +162,24 @@ async function handleSearchInput(_$w) {
|
|
|
160
162
|
|
|
161
163
|
let filter = await getFilter(searchByTitle);
|
|
162
164
|
|
|
163
|
-
await _$w(
|
|
164
|
-
await _$w(
|
|
165
|
+
await _$w('#jobsDataset').setFilter(filter);
|
|
166
|
+
await _$w('#jobsDataset').refresh();
|
|
165
167
|
|
|
166
|
-
count = _$w(
|
|
168
|
+
count = _$w('#jobsDataset').getTotalCount();
|
|
167
169
|
|
|
168
170
|
if (count > 0) {
|
|
169
171
|
searchByCityFlag = false;
|
|
170
|
-
_$w(
|
|
172
|
+
_$w('#resultsContainer').expand();
|
|
171
173
|
_$w('#searchMultiStateBox').changeState('results');
|
|
172
174
|
} else {
|
|
173
175
|
filter = await getFilter(searchByCity);
|
|
174
|
-
await _$w(
|
|
175
|
-
await _$w(
|
|
176
|
-
count = _$w(
|
|
176
|
+
await _$w('#jobsDataset').setFilter(filter);
|
|
177
|
+
await _$w('#jobsDataset').refresh();
|
|
178
|
+
count = _$w('#jobsDataset').getTotalCount();
|
|
177
179
|
if( count > 0 )
|
|
178
180
|
{
|
|
179
181
|
searchByCityFlag = true;
|
|
180
|
-
_$w(
|
|
182
|
+
_$w('#resultsContainer').expand();
|
|
181
183
|
_$w('#searchMultiStateBox').changeState('results');
|
|
182
184
|
}
|
|
183
185
|
else{
|
package/pages/pagesUtils.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
const { items: wixData } = require('@wix/data');
|
|
2
2
|
const { JOBS_COLLECTION_FIELDS,COLLECTIONS } = require('../backend/collectionConsts');
|
|
3
|
-
const { CAREERS_MULTI_BOXES_PAGE_CONSTS, CATEGORY_CUSTOM_FIELD_ID_IN_CMS } = require('../backend/careersMultiBoxesPageIds');
|
|
4
|
-
const { GLOBAL_SECTIONS_SELECTORS} = require('../public/selectors');
|
|
5
3
|
const { normalizeString } = require('../backend/utils');
|
|
6
4
|
|
|
7
5
|
function groupValuesByField(values, refKey) {
|
package/public/index.js
CHANGED
|
@@ -1,23 +1,28 @@
|
|
|
1
|
+
const { CAREERS_MULTI_BOXES_PAGE_CONSTS, CATEGORY_CUSTOM_FIELD_ID_IN_CMS, TWG_JOBS_COLLECTION_FIELDS } = require('../backend/careersMultiBoxesPageIds');
|
|
1
2
|
const { location } = require("@wix/site-location");
|
|
2
|
-
const { CAREERS_MULTI_BOXES_PAGE_CONSTS, TWG_JOBS_COLLECTION_FIELDS, CATEGORY_CUSTOM_FIELD_ID_IN_CMS } = require('../backend/careersMultiBoxesPageIds');
|
|
3
|
-
const { GLOBAL_SECTIONS_SELECTORS} = require('../public/selectors');
|
|
4
3
|
const { getFilter } = require('../public/filterUtils');
|
|
5
|
-
const { debounce } = require('
|
|
4
|
+
const { debounce } = require('./utils');
|
|
6
5
|
|
|
7
6
|
function loadPrimarySearchRepeater(_$w) {
|
|
8
|
-
|
|
7
|
+
|
|
9
8
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOB_RESULTS_REPEATER_ITEM).onClick((event) => {
|
|
9
|
+
// const data = _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOB_RESULTS_REPEATER).data;
|
|
10
|
+
// const clickedItemData = data.find(
|
|
11
|
+
// (item) => item._id === event.context.itemId,
|
|
12
|
+
// );
|
|
13
|
+
|
|
10
14
|
const $item = _$w.at(event.context);
|
|
11
|
-
const clickedItemData = $item(
|
|
15
|
+
const clickedItemData = $item("#jobsDataset").getCurrentItem();
|
|
16
|
+
|
|
12
17
|
|
|
13
18
|
if(!clickedItemData[TWG_JOBS_COLLECTION_FIELDS.LINK_JOBS_TITLE] && !clickedItemData[TWG_JOBS_COLLECTION_FIELDS.LINK_JOBS_REF_ID_SLUG]) {
|
|
14
19
|
console.error("clickedItemData does not have link-jobs-title or link-jobs-refId-slug");
|
|
15
20
|
return;
|
|
16
21
|
}
|
|
17
22
|
|
|
18
|
-
location.to(clickedItemData[TWG_JOBS_COLLECTION_FIELDS.LINK_JOBS_TITLE]
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
location.to( clickedItemData[TWG_JOBS_COLLECTION_FIELDS.LINK_JOBS_TITLE]|| clickedItemData[TWG_JOBS_COLLECTION_FIELDS.LINK_JOBS_REF_ID_SLUG]);
|
|
24
|
+
});
|
|
25
|
+
|
|
21
26
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.CATEGORY_RESULTS_REPEATER).onItemReady(async ($item, itemData) => {
|
|
22
27
|
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_CATEGORY_BUTTON).label = itemData.title || '';
|
|
23
28
|
});
|
|
@@ -34,46 +39,42 @@ function loadPrimarySearchRepeater(_$w) {
|
|
|
34
39
|
|
|
35
40
|
}
|
|
36
41
|
|
|
37
|
-
function
|
|
38
|
-
return _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value?.toLowerCase().trim() || '';
|
|
39
|
-
}
|
|
42
|
+
function bindPrimarySearch(_$w, allvaluesobjects) {
|
|
40
43
|
|
|
41
|
-
async function bindPrimarySearch(_$w, allvaluesobjects) {
|
|
42
|
-
// wait for the jobs dataset to be ready
|
|
43
|
-
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).onReadyAsync();
|
|
44
|
-
|
|
45
44
|
const handleSearchInput = async () => {
|
|
46
|
-
const query =
|
|
47
|
-
await
|
|
45
|
+
const query = _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value?.toLowerCase().trim() || '';
|
|
46
|
+
await primarySearch(_$w, query);
|
|
48
47
|
}
|
|
49
48
|
|
|
49
|
+
const primarySearchDebounced = debounce(() => handleSearchInput(), 400);
|
|
50
|
+
|
|
50
51
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).onInput(async () => {
|
|
51
|
-
|
|
52
|
+
await primarySearchDebounced();
|
|
52
53
|
});
|
|
53
|
-
|
|
54
|
+
|
|
54
55
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).onClick(async () => {
|
|
55
|
-
_$w(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
await
|
|
56
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).expand();
|
|
57
|
+
|
|
58
|
+
if(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value.trim()!=='') {
|
|
59
|
+
const query = _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value?.toLowerCase().trim() || '';
|
|
60
|
+
await primarySearch(_$w, query);
|
|
60
61
|
}
|
|
61
62
|
else {
|
|
62
63
|
await loadCategoriesListPrimarySearch(_$w,allvaluesobjects);
|
|
63
64
|
}
|
|
64
65
|
});
|
|
65
|
-
|
|
66
|
-
_$w(
|
|
67
|
-
_$w(
|
|
66
|
+
|
|
67
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).onMouseOut(async () => {
|
|
68
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).collapse();
|
|
68
69
|
});
|
|
69
|
-
|
|
70
|
+
|
|
70
71
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).onKeyPress(async (event) => {
|
|
71
72
|
if( event.key === 'Enter') {
|
|
72
73
|
if(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value.trim()==='') {
|
|
73
|
-
// _$w(
|
|
74
|
+
// _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).collapse();
|
|
74
75
|
const baseUrl = await location.baseUrl();
|
|
75
76
|
location.to(`${baseUrl}/search`);
|
|
76
|
-
|
|
77
|
+
|
|
77
78
|
}
|
|
78
79
|
else {
|
|
79
80
|
let encodedKeyWord=encodeURIComponent(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value);
|
|
@@ -82,8 +83,8 @@ async function bindPrimarySearch(_$w, allvaluesobjects) {
|
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
});
|
|
85
|
-
|
|
86
|
-
_$w(
|
|
86
|
+
|
|
87
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_BUTTON).onClick(async () => {
|
|
87
88
|
if(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value.trim()==='') {
|
|
88
89
|
const baseUrl = await location.baseUrl();
|
|
89
90
|
location.to(`${baseUrl}/search`);
|
|
@@ -96,58 +97,58 @@ async function bindPrimarySearch(_$w, allvaluesobjects) {
|
|
|
96
97
|
});
|
|
97
98
|
}
|
|
98
99
|
|
|
99
|
-
async function
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
async function loadCategoriesListPrimarySearch(_$w, allvaluesobjects) {
|
|
101
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState("categoryResults");
|
|
102
|
+
|
|
103
|
+
let categoryValues=[]
|
|
104
|
+
for(const value of allvaluesobjects) {
|
|
105
|
+
if(value.customField === CATEGORY_CUSTOM_FIELD_ID_IN_CMS) {
|
|
106
|
+
categoryValues.push({title: value.title+` (${value.count})` , _id: value.valueId});
|
|
107
|
+
}
|
|
103
108
|
}
|
|
109
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.CATEGORY_RESULTS_REPEATER).data = categoryValues;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
async function primarySearch(_$w, query) {
|
|
113
|
+
if(query === undefined || query === '') {
|
|
114
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState("categoryResults");
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const searchByTitle = [{field: 'title', searchTerm: query}];
|
|
119
|
+
const searchByCity = [{field: 'location.fullLocation', searchTerm: query}];
|
|
104
120
|
|
|
105
|
-
|
|
106
|
-
const searchByCity = [{field: 'location.fullLocation', searchTerm: query}];
|
|
121
|
+
let filter = await getFilter(searchByTitle);
|
|
107
122
|
|
|
108
|
-
|
|
123
|
+
await _$w('#jobsDataset').setFilter(filter);
|
|
124
|
+
await _$w('#jobsDataset').refresh();
|
|
109
125
|
|
|
110
|
-
|
|
111
|
-
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).refresh();
|
|
126
|
+
let count = _$w('#jobsDataset').getTotalCount();
|
|
112
127
|
|
|
113
|
-
|
|
128
|
+
if( count > 0 ) {
|
|
129
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).expand();
|
|
130
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState("jobResults");
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
filter = await getFilter(searchByCity);
|
|
134
|
+
await _$w('#jobsDataset').setFilter(filter);
|
|
135
|
+
await _$w('#jobsDataset').refresh();
|
|
114
136
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
137
|
+
count = _$w('#jobsDataset').getTotalCount();
|
|
138
|
+
if (count > 0) {
|
|
139
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).expand();
|
|
140
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState("jobResults");
|
|
118
141
|
}
|
|
119
|
-
else
|
|
120
|
-
|
|
121
|
-
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).setFilter(filter);
|
|
122
|
-
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).refresh();
|
|
123
|
-
|
|
124
|
-
count = _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).getTotalCount();
|
|
125
|
-
if (count > 0) {
|
|
126
|
-
_$w(GLOBAL_SECTIONS_SELECTORS.RESULTS_CONTAINER).expand();
|
|
127
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState(GLOBAL_SECTIONS_SELECTORS.JOB_RESULTS);
|
|
128
|
-
}
|
|
129
|
-
else{
|
|
130
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState(GLOBAL_SECTIONS_SELECTORS.NO_RESULTS);
|
|
131
|
-
}
|
|
142
|
+
else{
|
|
143
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState("noResults");
|
|
132
144
|
}
|
|
133
|
-
|
|
134
|
-
return count > 0;
|
|
135
145
|
}
|
|
136
146
|
|
|
137
|
-
|
|
138
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState(GLOBAL_SECTIONS_SELECTORS.CATEGORY_RESULTS);
|
|
139
|
-
|
|
140
|
-
let categoryValues=[]
|
|
141
|
-
for(const value of allvaluesobjects) {
|
|
142
|
-
if(value.customField === CATEGORY_CUSTOM_FIELD_ID_IN_CMS) {
|
|
143
|
-
categoryValues.push({title: value.title+` (${value.count})` , _id: value.valueId});
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.CATEGORY_RESULTS_REPEATER).data = categoryValues;
|
|
147
|
+
return count > 0;
|
|
147
148
|
}
|
|
148
149
|
|
|
149
150
|
module.exports = {
|
|
150
151
|
loadPrimarySearchRepeater,
|
|
151
152
|
bindPrimarySearch,
|
|
152
|
-
|
|
153
|
+
primarySearch,
|
|
153
154
|
}
|
package/public/selectors.js
CHANGED
|
@@ -26,30 +26,19 @@ const CAREERS_PAGE_SELECTORS = {
|
|
|
26
26
|
OPEN_FILTERS_BUTTON: '#openFiltersButton',
|
|
27
27
|
CLOSE_FILTERS_BUTTON: '#closeFiltersButton',
|
|
28
28
|
RESET_FILTERS_BUTTON: '#resetFiltersButton',
|
|
29
|
+
RESET_FILTERS_BUTTON: '#resetFiltersButton',
|
|
29
30
|
|
|
30
31
|
RESULTS_MULTI_STATE: '#resultsMultiState',
|
|
31
32
|
BRANDS_DATASET: '#brandsDataset',
|
|
32
33
|
DEPARTMENTS_DATASET: '#departmentsDataset',
|
|
33
34
|
LOCATIONS_DATASET: '#locationsDataset',
|
|
34
35
|
JOB_TYPES_DATASET: '#jobTypesDataset',
|
|
36
|
+
JOBS_DATASET: '#jobsDataset',
|
|
35
37
|
|
|
36
38
|
GOOGLE_MAPS: '#googleMaps',
|
|
37
39
|
FOOTER: '#footer',
|
|
38
40
|
}
|
|
39
41
|
|
|
40
|
-
const GLOBAL_SECTIONS_SELECTORS = {
|
|
41
|
-
// primary search selectors
|
|
42
|
-
RESULTS_CONTAINER: '#resultsContainer',
|
|
43
|
-
PRIMARY_SEARCH_BUTTON: '#primarySearchButton',
|
|
44
|
-
JOBS_DATASET: '#jobsDataset',
|
|
45
|
-
|
|
46
|
-
// multiStateBox states
|
|
47
|
-
CATEGORY_RESULTS: 'categoryResults',
|
|
48
|
-
JOB_RESULTS: 'jobResults',
|
|
49
|
-
NO_RESULTS: 'noResults',
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
42
|
const FILTER_FIELDS = {
|
|
54
43
|
DEPARTMENT: 'department',
|
|
55
44
|
LOCATION: 'cityText',
|
|
@@ -61,5 +50,4 @@ const FILTER_FIELDS = {
|
|
|
61
50
|
module.exports = {
|
|
62
51
|
CAREERS_PAGE_SELECTORS,
|
|
63
52
|
FILTER_FIELDS,
|
|
64
|
-
GLOBAL_SECTIONS_SELECTORS,
|
|
65
53
|
}
|