sr-npm 1.2.47 → 1.2.49
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 +3 -5
- package/package.json +1 -1
- package/pages/careersMultiBoxesPage.js +7 -7
- package/pages/careersPage.js +12 -12
- package/pages/homePage.js +13 -15
- package/pages/pagesUtils.js +72 -69
- package/pages/positionPage.js +1 -1
- package/pages/supportTeamsPage.js +2 -2
- package/public/selectors.js +10 -2
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const CAREERS_MULTI_BOXES_PAGE_CONSTS={
|
|
2
|
-
JOBS_DATASET: '#jobsDataset',
|
|
3
2
|
FILTER_REPEATER: '#filterReapter',
|
|
4
3
|
JOBS_REPEATER: '#jobsReapter',
|
|
5
4
|
JOBS_REPEATER_ITEM_TITLE: '#jobTitle',
|
|
@@ -24,16 +23,15 @@ const CAREERS_MULTI_BOXES_PAGE_CONSTS={
|
|
|
24
23
|
PRIMARY_SEARCH_INPUT: '#primarySearchInput',
|
|
25
24
|
JOB_RESULTS_REPEATER: '#jobResultsRepeater',
|
|
26
25
|
JOB_RESULTS_REPEATER_ITEM: '#jobResultsRepeaterItem',
|
|
26
|
+
CATEGORY_RESULTS: '#categoryResults',
|
|
27
27
|
CATEGORY_RESULTS_REPEATER: '#categoryResultsRepeater',
|
|
28
28
|
CATEGORY_RESULTS_REPEATER_ITEM: '#categoryResultsRepeaterItem',
|
|
29
29
|
PRIMARY_SEARCH_MULTI_BOX: '#primarySearchMultiBox',
|
|
30
30
|
PRIMARY_SEARCH_POSITION_BUTTON: '#primarySearchPositionButton',
|
|
31
31
|
PRIMARY_SEARCH_CATEGORY_BUTTON: '#primarySearchCategoryButton',
|
|
32
|
-
RESULTS_CONTAINER: '#resultsContainer',
|
|
33
|
-
PRIMARY_SEARCH_BUTTON: '#primarySearchButton',
|
|
34
32
|
}
|
|
35
33
|
|
|
36
|
-
const
|
|
34
|
+
const TWG_JOBS_COLLECTION_FIELDS={
|
|
37
35
|
LINK_JOBS_TITLE: 'link-jobs-title',
|
|
38
36
|
LINK_JOBS_REF_ID_SLUG: 'link-jobs-refId-slug',
|
|
39
37
|
}
|
|
@@ -80,5 +78,5 @@ module.exports = {
|
|
|
80
78
|
fieldTitlesInCMS,
|
|
81
79
|
CATEGORY_CUSTOM_FIELD_ID_IN_CMS,
|
|
82
80
|
possibleUrlParams,
|
|
83
|
-
|
|
81
|
+
TWG_JOBS_COLLECTION_FIELDS,
|
|
84
82
|
}
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
const { COLLECTIONS,CUSTOM_VALUES_COLLECTION_FIELDS,JOBS_COLLECTION_FIELDS } = require('../backend/collectionConsts');
|
|
2
|
-
const { CAREERS_PAGE_SELECTORS } = require('../public/selectors');
|
|
3
|
-
|
|
4
1
|
const { window } = require('@wix/site-window');
|
|
5
2
|
const { queryParams,onChange} = require('wix-location-frontend');
|
|
6
3
|
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,
|
|
10
10
|
fieldTitlesInCMS,
|
|
11
11
|
possibleUrlParams,
|
|
12
|
-
|
|
12
|
+
TWG_JOBS_COLLECTION_FIELDS
|
|
13
13
|
} = require('../backend/careersMultiBoxesPageIds');
|
|
14
14
|
const { groupValuesByField,
|
|
15
15
|
debounce,
|
|
@@ -22,7 +22,7 @@ const { groupValuesByField,
|
|
|
22
22
|
bindPrimarySearch,
|
|
23
23
|
primarySearch,
|
|
24
24
|
getAllDatasetItems
|
|
25
|
-
|
|
25
|
+
} = require('./pagesUtils');
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
let dontUpdateThisCheckBox;
|
|
@@ -152,7 +152,7 @@ async function handleUrlParams(_$w,urlParams,handleBackAndForth=false) {
|
|
|
152
152
|
applyFiltering = await primarySearch(_$w, decodeURIComponent(urlParams.keyword));
|
|
153
153
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value = decodeURIComponent(urlParams.keyword);
|
|
154
154
|
|
|
155
|
-
const items = await getAllDatasetItems(_$w,
|
|
155
|
+
const items = await getAllDatasetItems(_$w, GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET);
|
|
156
156
|
|
|
157
157
|
currentJobs = items;
|
|
158
158
|
keywordAllJobs = items;
|
|
@@ -318,7 +318,7 @@ async function loadJobsRepeater(_$w) {
|
|
|
318
318
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER).onItemReady(($item, itemData) => {
|
|
319
319
|
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER_ITEM_TITLE).text = itemData.title;
|
|
320
320
|
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER_ITEM_TITLE).onClick(() => {
|
|
321
|
-
location.to(itemData[
|
|
321
|
+
location.to(itemData[TWG_JOBS_COLLECTION_FIELDS.LINK_JOBS_TITLE] || itemData[TWG_JOBS_COLLECTION_FIELDS.LINK_JOBS_REF_ID_SLUG]);
|
|
322
322
|
});
|
|
323
323
|
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER_ITEM_LOCATION).text=itemData.location.fullLocation
|
|
324
324
|
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER_ITEM_EMPLOYMENT_TYPE).text=itemData.employmentType
|
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 } = require('../public/selectors');
|
|
9
|
+
const { CAREERS_PAGE_SELECTORS, FILTER_FIELDS, GLOBAL_SECTIONS_SELECTORS } = require('../public/selectors');
|
|
10
10
|
const { filterBrokenMarkers } = require('../public/utils');
|
|
11
11
|
|
|
12
12
|
let currentLoadedItems =100;
|
|
@@ -58,10 +58,10 @@ async function careersPageOnReady(_$w,thisObject=null,queryParams=null) {
|
|
|
58
58
|
|
|
59
59
|
function activateAutoLoad(_$w)
|
|
60
60
|
{
|
|
61
|
-
_$w(
|
|
61
|
+
_$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).onReady(() => {
|
|
62
62
|
updateCount(_$w);
|
|
63
63
|
_$w(CAREERS_PAGE_SELECTORS.FOOTER).onViewportEnter(() => {
|
|
64
|
-
if (currentLoadedItems<_$w(
|
|
64
|
+
if (currentLoadedItems<_$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).getTotalCount()) {
|
|
65
65
|
loadMoreJobs(_$w);
|
|
66
66
|
}
|
|
67
67
|
else {
|
|
@@ -81,7 +81,7 @@ async function loadMoreJobs(_$w) {
|
|
|
81
81
|
pageParamSet = Number(pageParamSet) + 1;
|
|
82
82
|
}
|
|
83
83
|
if (shouldLoad) {
|
|
84
|
-
_$w(
|
|
84
|
+
_$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).loadMore();
|
|
85
85
|
console.log("loading more jobs");
|
|
86
86
|
|
|
87
87
|
currentLoadedItems = currentLoadedItems + itemsPerPage;
|
|
@@ -170,7 +170,7 @@ async function handlePageParam(_$w) {
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
async function bind(_$w) {
|
|
173
|
-
await _$w(
|
|
173
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).onReady(async () => {
|
|
174
174
|
await updateCount(_$w);
|
|
175
175
|
await updateMapMarkers(_$w);
|
|
176
176
|
|
|
@@ -337,8 +337,8 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
337
337
|
});
|
|
338
338
|
|
|
339
339
|
const filter = await getFilter(filters, 'and');
|
|
340
|
-
await _$w(
|
|
341
|
-
await _$w(
|
|
340
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).setFilter(filter);
|
|
341
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).refresh();
|
|
342
342
|
|
|
343
343
|
const count = await updateCount(_$w);
|
|
344
344
|
console.log("updating map markers");
|
|
@@ -357,8 +357,8 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
357
357
|
async function resetFilters(_$w) {
|
|
358
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 = '';
|
|
359
359
|
|
|
360
|
-
await _$w(
|
|
361
|
-
await _$w(
|
|
360
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).setFilter(wixData.filter());
|
|
361
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).refresh();
|
|
362
362
|
|
|
363
363
|
_$w(CAREERS_PAGE_SELECTORS.RESULTS_MULTI_STATE).changeState('results');
|
|
364
364
|
|
|
@@ -374,7 +374,7 @@ async function resetFilters(_$w) {
|
|
|
374
374
|
}
|
|
375
375
|
|
|
376
376
|
async function updateCount(_$w) {
|
|
377
|
-
const count = await _$w(
|
|
377
|
+
const count = await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).getTotalCount();
|
|
378
378
|
_$w('#numOfPositionText').text = `Showing ${count} Open Positions`;
|
|
379
379
|
|
|
380
380
|
return count;
|
|
@@ -485,8 +485,8 @@ async function handleJobTypeParam(_$w,jobType) {
|
|
|
485
485
|
}
|
|
486
486
|
|
|
487
487
|
async function updateMapMarkers(_$w){
|
|
488
|
-
const numOfItems = await _$w(
|
|
489
|
-
const items = await _$w(
|
|
488
|
+
const numOfItems = await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).getTotalCount();
|
|
489
|
+
const items = await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).getItems(0, numOfItems);
|
|
490
490
|
const markers = filterBrokenMarkers(items.items).map(item => {
|
|
491
491
|
const location = item.locationAddress.location;
|
|
492
492
|
return {
|
package/pages/homePage.js
CHANGED
|
@@ -4,6 +4,7 @@ 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');
|
|
7
8
|
const { bindPrimarySearch, getAllRecords, loadPrimarySearchRepeater } = require('./pagesUtils');
|
|
8
9
|
|
|
9
10
|
let thisObjectVar;
|
|
@@ -114,9 +115,6 @@ function bindViewAllButton(_$w) {
|
|
|
114
115
|
});
|
|
115
116
|
}
|
|
116
117
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
118
|
function init(_$w) {
|
|
121
119
|
const debouncedInput = debounce(() => handleSearchInput(_$w), 400, thisObjectVar);
|
|
122
120
|
|
|
@@ -131,15 +129,15 @@ function init(_$w) {
|
|
|
131
129
|
});
|
|
132
130
|
|
|
133
131
|
_$w('#searchInput').onFocus(() => {
|
|
134
|
-
if (_$w(
|
|
135
|
-
_$w(
|
|
132
|
+
if (_$w(GLOBAL_SECTIONS_SELECTORS.RESULTS_CONTAINER).collapsed) {
|
|
133
|
+
_$w(GLOBAL_SECTIONS_SELECTORS.RESULTS_CONTAINER).expand();
|
|
136
134
|
}
|
|
137
135
|
});
|
|
138
136
|
|
|
139
137
|
_$w('#searchInput').onBlur(() => {
|
|
140
138
|
setTimeout(() => {
|
|
141
|
-
if (!_$w(
|
|
142
|
-
_$w(
|
|
139
|
+
if (!_$w(GLOBAL_SECTIONS_SELECTORS.RESULTS_CONTAINER).collapsed) {
|
|
140
|
+
_$w(GLOBAL_SECTIONS_SELECTORS.RESULTS_CONTAINER).collapse();
|
|
143
141
|
}
|
|
144
142
|
}, 250);
|
|
145
143
|
});
|
|
@@ -161,24 +159,24 @@ async function handleSearchInput(_$w) {
|
|
|
161
159
|
|
|
162
160
|
let filter = await getFilter(searchByTitle);
|
|
163
161
|
|
|
164
|
-
await _$w(
|
|
165
|
-
await _$w(
|
|
162
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).setFilter(filter);
|
|
163
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).refresh();
|
|
166
164
|
|
|
167
|
-
count = _$w(
|
|
165
|
+
count = _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).getTotalCount();
|
|
168
166
|
|
|
169
167
|
if (count > 0) {
|
|
170
168
|
searchByCityFlag = false;
|
|
171
|
-
_$w(
|
|
169
|
+
_$w(GLOBAL_SECTIONS_SELECTORS.RESULTS_CONTAINER).expand();
|
|
172
170
|
_$w('#searchMultiStateBox').changeState('results');
|
|
173
171
|
} else {
|
|
174
172
|
filter = await getFilter(searchByCity);
|
|
175
|
-
await _$w(
|
|
176
|
-
await _$w(
|
|
177
|
-
count = _$w(
|
|
173
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).setFilter(filter);
|
|
174
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).refresh();
|
|
175
|
+
count = _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).getTotalCount();
|
|
178
176
|
if( count > 0 )
|
|
179
177
|
{
|
|
180
178
|
searchByCityFlag = true;
|
|
181
|
-
_$w(
|
|
179
|
+
_$w(GLOBAL_SECTIONS_SELECTORS.RESULTS_CONTAINER).expand();
|
|
182
180
|
_$w('#searchMultiStateBox').changeState('results');
|
|
183
181
|
}
|
|
184
182
|
else{
|
package/pages/pagesUtils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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,
|
|
3
|
+
const { CAREERS_MULTI_BOXES_PAGE_CONSTS, CATEGORY_CUSTOM_FIELD_ID_IN_CMS, TWG_JOBS_COLLECTION_FIELDS } = require('../backend/careersMultiBoxesPageIds');
|
|
4
|
+
const { GLOBAL_SECTIONS_SELECTORS} = require('../public/selectors');
|
|
4
5
|
const { location } = require("@wix/site-location");
|
|
5
6
|
const { normalizeString } = require('../backend/utils');
|
|
6
7
|
const { getFilter } = require('../public/filterUtils');
|
|
@@ -109,12 +110,12 @@ function loadPrimarySearchRepeater(_$w) {
|
|
|
109
110
|
(item) => item._id === event.context.itemId,
|
|
110
111
|
|
|
111
112
|
);
|
|
112
|
-
if(!clickedItemData[
|
|
113
|
+
if(!clickedItemData[TWG_JOBS_COLLECTION_FIELDS.LINK_JOBS_TITLE] && !clickedItemData[TWG_JOBS_COLLECTION_FIELDS.LINK_JOBS_REF_ID_SLUG]) {
|
|
113
114
|
console.error("clickedItemData does not have link-jobs-title or link-jobs-refId-slug");
|
|
114
115
|
return;
|
|
115
116
|
}
|
|
116
117
|
|
|
117
|
-
location.to(clickedItemData[
|
|
118
|
+
location.to( clickedItemData[TWG_JOBS_COLLECTION_FIELDS.LINK_JOBS_TITLE]|| clickedItemData[TWG_JOBS_COLLECTION_FIELDS.LINK_JOBS_REF_ID_SLUG]);
|
|
118
119
|
|
|
119
120
|
|
|
120
121
|
});
|
|
@@ -135,65 +136,67 @@ _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.CATEGORY_RESULTS_REPEATER_ITEM).onClick(asyn
|
|
|
135
136
|
}
|
|
136
137
|
|
|
137
138
|
function bindPrimarySearch(_$w, allvaluesobjects) {
|
|
139
|
+
// wait for the jobs dataset to be ready
|
|
140
|
+
_$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).onReadyAsync();
|
|
141
|
+
|
|
142
|
+
const handleSearchInput = async () => {
|
|
143
|
+
const query = _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value?.toLowerCase().trim() || '';
|
|
144
|
+
await primarySearch(_$w, query);
|
|
145
|
+
}
|
|
138
146
|
|
|
139
|
-
const
|
|
140
|
-
const query = _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value?.toLowerCase().trim() || '';
|
|
141
|
-
await primarySearch(_$w, query);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
const primarySearchDebounced = debounce(() => handleSearchInput(), 400);
|
|
147
|
+
const primarySearchDebounced = debounce(() => handleSearchInput(), 400);
|
|
145
148
|
|
|
146
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).onInput(async () => {
|
|
149
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).onInput(async () => {
|
|
147
150
|
await primarySearchDebounced();
|
|
148
|
-
});
|
|
151
|
+
});
|
|
149
152
|
|
|
150
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).onClick(async () => {
|
|
151
|
-
|
|
153
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).onClick(async () => {
|
|
154
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).expand();
|
|
152
155
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
});
|
|
156
|
+
if(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value.trim()!=='') {
|
|
157
|
+
const query = _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value?.toLowerCase().trim() || '';
|
|
158
|
+
await primarySearch(_$w, query);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
await loadCategoriesListPrimarySearch(_$w,allvaluesobjects);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
161
164
|
|
|
162
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).onMouseOut(async () => {
|
|
163
|
-
|
|
164
|
-
});
|
|
165
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).onMouseOut(async () => {
|
|
166
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).collapse();
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).onKeyPress(async (event) => {
|
|
170
|
+
if( event.key === 'Enter') {
|
|
171
|
+
if(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value.trim()==='') {
|
|
172
|
+
// _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).collapse();
|
|
173
|
+
const baseUrl = await location.baseUrl();
|
|
174
|
+
location.to(`${baseUrl}/search`);
|
|
175
|
+
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
let encodedKeyWord=encodeURIComponent(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value);
|
|
179
|
+
const baseUrl = await location.baseUrl();
|
|
180
|
+
location.to(`${baseUrl}/search?keyword=${encodedKeyWord}`);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
});
|
|
165
184
|
|
|
166
|
-
_$w(
|
|
167
|
-
if( event.key === 'Enter') {
|
|
185
|
+
_$w(GLOBAL_SECTIONS_SELECTORS.PRIMARY_SEARCH_BUTTON).onClick(async () => {
|
|
168
186
|
if(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value.trim()==='') {
|
|
169
|
-
// _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).collapse();
|
|
170
187
|
const baseUrl = await location.baseUrl();
|
|
171
188
|
location.to(`${baseUrl}/search`);
|
|
172
|
-
|
|
173
|
-
}
|
|
189
|
+
}
|
|
174
190
|
else {
|
|
175
191
|
let encodedKeyWord=encodeURIComponent(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value);
|
|
176
192
|
const baseUrl = await location.baseUrl();
|
|
177
193
|
location.to(`${baseUrl}/search?keyword=${encodedKeyWord}`);
|
|
178
194
|
}
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_BUTTON).onClick(async () => {
|
|
183
|
-
if(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value.trim()==='') {
|
|
184
|
-
const baseUrl = await location.baseUrl();
|
|
185
|
-
location.to(`${baseUrl}/search`);
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
let encodedKeyWord=encodeURIComponent(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value);
|
|
189
|
-
const baseUrl = await location.baseUrl();
|
|
190
|
-
location.to(`${baseUrl}/search?keyword=${encodedKeyWord}`);
|
|
191
|
-
}
|
|
192
|
-
});
|
|
195
|
+
});
|
|
193
196
|
}
|
|
194
197
|
|
|
195
198
|
async function loadCategoriesListPrimarySearch(_$w, allvaluesobjects) {
|
|
196
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState(
|
|
199
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState(CAREERS_MULTI_BOXES_PAGE_CONSTS.CATEGORY_RESULTS);
|
|
197
200
|
|
|
198
201
|
let categoryValues=[]
|
|
199
202
|
for(const value of allvaluesobjects) {
|
|
@@ -205,41 +208,41 @@ _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.CATEGORY_RESULTS_REPEATER).data = categoryVa
|
|
|
205
208
|
}
|
|
206
209
|
|
|
207
210
|
async function primarySearch(_$w, query) {
|
|
208
|
-
if(query === undefined || query === '') {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
const searchByTitle = [{field: 'title', searchTerm: query}];
|
|
214
|
-
const searchByCity = [{field: 'location.fullLocation', searchTerm: query}];
|
|
211
|
+
if(query === undefined || query === '') {
|
|
212
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState(CAREERS_MULTI_BOXES_PAGE_CONSTS.CATEGORY_RESULTS);
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
215
|
|
|
216
|
-
|
|
216
|
+
const searchByTitle = [{field: 'title', searchTerm: query}];
|
|
217
|
+
const searchByCity = [{field: 'location.fullLocation', searchTerm: query}];
|
|
217
218
|
|
|
218
|
-
await
|
|
219
|
-
await _$w('#jobsDataset').refresh();
|
|
219
|
+
let filter = await getFilter(searchByTitle);
|
|
220
220
|
|
|
221
|
-
|
|
221
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).setFilter(filter);
|
|
222
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).refresh();
|
|
222
223
|
|
|
223
|
-
|
|
224
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).expand();
|
|
225
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState("jobResults");
|
|
226
|
-
}
|
|
227
|
-
else {
|
|
228
|
-
filter = await getFilter(searchByCity);
|
|
229
|
-
await _$w('#jobsDataset').setFilter(filter);
|
|
230
|
-
await _$w('#jobsDataset').refresh();
|
|
224
|
+
let count = _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).getTotalCount();
|
|
231
225
|
|
|
232
|
-
count
|
|
233
|
-
if (count > 0) {
|
|
226
|
+
if( count > 0 ) {
|
|
234
227
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).expand();
|
|
235
228
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState("jobResults");
|
|
236
229
|
}
|
|
237
|
-
else{
|
|
238
|
-
|
|
230
|
+
else {
|
|
231
|
+
filter = await getFilter(searchByCity);
|
|
232
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).setFilter(filter);
|
|
233
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).refresh();
|
|
234
|
+
|
|
235
|
+
count = _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).getTotalCount();
|
|
236
|
+
if (count > 0) {
|
|
237
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).expand();
|
|
238
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState("jobResults");
|
|
239
|
+
}
|
|
240
|
+
else{
|
|
241
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState("noResults");
|
|
242
|
+
}
|
|
239
243
|
}
|
|
240
|
-
}
|
|
241
244
|
|
|
242
|
-
return count > 0;
|
|
245
|
+
return count > 0;
|
|
243
246
|
}
|
|
244
247
|
|
|
245
248
|
async function getValueFromValueId(valueId) {
|
package/pages/positionPage.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { query } = require("wix-location-frontend");
|
|
2
2
|
const { getPositionWithMultiRefField } = require('../backend/queries');
|
|
3
3
|
const { COLLECTIONS,JOBS_COLLECTION_FIELDS,CUSTOM_FIELDS_COLLECTION_FIELDS } = require('../backend/collectionConsts');
|
|
4
|
-
const {
|
|
4
|
+
const { TWG_JOBS_COLLECTION_FIELDS } = require('../backend/careersMultiBoxesPageIds');
|
|
5
5
|
const { items: wixData } = require('@wix/data');
|
|
6
6
|
const { location } = require("@wix/site-location");
|
|
7
7
|
const{isElementExistOnPage} = require('psdev-utils');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { getLatestJobsByValue, getValueFromValueId } = require('./pagesUtils');
|
|
2
2
|
const { location } = require("@wix/site-location");
|
|
3
3
|
const { supportTeamsPageIds,supportTeamsPageSections } = require('../backend/consts');
|
|
4
|
-
const {
|
|
4
|
+
const { TWG_JOBS_COLLECTION_FIELDS } = require('../backend/careersMultiBoxesPageIds');
|
|
5
5
|
const { getAllRecordsWithoutMultiRef } = require('./pagesUtils');
|
|
6
6
|
|
|
7
7
|
let currentItem;
|
|
@@ -61,7 +61,7 @@ async function handleRecentJobsSection(_$w) {
|
|
|
61
61
|
const clickedItemData = data.find(
|
|
62
62
|
(item) => item._id === event.context.itemId,
|
|
63
63
|
);
|
|
64
|
-
location.to(clickedItemData[
|
|
64
|
+
location.to(clickedItemData[TWG_JOBS_COLLECTION_FIELDS.LINK_JOBS_TITLE] || clickedItemData[TWG_JOBS_COLLECTION_FIELDS.LINK_JOBS_REF_ID_SLUG]);
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
_$w(supportTeamsPageIds.RECENT_JOBS_BUTTON).onClick( () => {
|
package/public/selectors.js
CHANGED
|
@@ -26,19 +26,26 @@ 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',
|
|
30
29
|
|
|
31
30
|
RESULTS_MULTI_STATE: '#resultsMultiState',
|
|
32
31
|
BRANDS_DATASET: '#brandsDataset',
|
|
33
32
|
DEPARTMENTS_DATASET: '#departmentsDataset',
|
|
34
33
|
LOCATIONS_DATASET: '#locationsDataset',
|
|
35
34
|
JOB_TYPES_DATASET: '#jobTypesDataset',
|
|
36
|
-
JOBS_DATASET: '#jobsDataset',
|
|
37
35
|
|
|
38
36
|
GOOGLE_MAPS: '#googleMaps',
|
|
39
37
|
FOOTER: '#footer',
|
|
40
38
|
}
|
|
41
39
|
|
|
40
|
+
const GLOBAL_SECTIONS_SELECTORS = {
|
|
41
|
+
RESULTS_CONTAINER: '#resultsContainer',
|
|
42
|
+
PRIMARY_SEARCH_BUTTON: '#primarySearchButton',
|
|
43
|
+
|
|
44
|
+
JOBS_DATASET: '#jobsDataset',
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
42
49
|
const FILTER_FIELDS = {
|
|
43
50
|
DEPARTMENT: 'department',
|
|
44
51
|
LOCATION: 'cityText',
|
|
@@ -50,4 +57,5 @@ const FILTER_FIELDS = {
|
|
|
50
57
|
module.exports = {
|
|
51
58
|
CAREERS_PAGE_SELECTORS,
|
|
52
59
|
FILTER_FIELDS,
|
|
60
|
+
GLOBAL_SECTIONS_SELECTORS,
|
|
53
61
|
}
|