sr-npm 1.7.887 → 1.7.888
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 +2 -0
- package/backend/collectionConsts.js +2 -2
- package/backend/consts.js +6 -2
- package/backend/data.js +21 -4
- package/backend/index.js +1 -0
- package/backend/secretsData.js +3 -3
- package/package.json +1 -1
- package/pages/careersMultiBoxesPage.js +5 -14
- package/pages/careersPage.js +4 -0
- package/pages/homePage.js +8 -47
- package/pages/index.js +1 -0
- package/pages/masterPage.js +35 -0
- package/pages/pagesUtils.js +9 -3
- package/pages/positionPage.js +9 -14
- package/tests/multiSearchBoxCareers.spec.js +3 -4
|
@@ -36,6 +36,7 @@ const CATEGORY_CUSTOM_FIELD_ID_IN_CMS='5cd8c873c9e77c0008aa7d23';
|
|
|
36
36
|
const fieldTitlesInCMS={
|
|
37
37
|
"brand": "Brands",
|
|
38
38
|
category: "Category",
|
|
39
|
+
visibility: "Visibility",
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
const FiltersIds={
|
|
@@ -46,6 +47,7 @@ const FiltersIds={
|
|
|
46
47
|
"Employment Type": 'employmentType',
|
|
47
48
|
"Contract Type": 'contractType',
|
|
48
49
|
Brands: 'Brands',
|
|
50
|
+
Visibility: 'Visibility',
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
|
|
@@ -41,7 +41,7 @@ const CUSTOM_VALUES_COLLECTION_FIELDS = {
|
|
|
41
41
|
TITLE: 'title',
|
|
42
42
|
CUSTOM_FIELD: 'customField',
|
|
43
43
|
MULTI_REF_JOBS_CUSTOM_VALUES: 'multiRefJobsCustomValues',
|
|
44
|
-
|
|
44
|
+
TOTAL_JOBS: 'totalJobs',
|
|
45
45
|
JOB_IDS: 'jobIds',
|
|
46
46
|
}
|
|
47
47
|
const CUSTOM_FIELDS_COLLECTION_FIELDS = {
|
|
@@ -112,7 +112,7 @@ const COLLECTIONS_FIELDS = {
|
|
|
112
112
|
CUSTOM_VALUES: [
|
|
113
113
|
{key:'title', type: 'TEXT'},
|
|
114
114
|
{key:'customField', type: 'REFERENCE', typeMetadata: { reference: { referencedCollectionId: COLLECTIONS.CUSTOM_FIELDS } } },
|
|
115
|
-
{key:'
|
|
115
|
+
{key:'totalJobs', type: 'NUMBER'},
|
|
116
116
|
{key:'multiRefJobsCustomValues', type: 'MULTI_REFERENCE', typeMetadata: { multiReference: { referencedCollectionId: COLLECTIONS.JOBS,referencingFieldKey:CUSTOM_VALUES_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES,referencingDisplayName:CUSTOM_VALUES_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES } } },
|
|
117
117
|
{key:'jobIds', type: 'ARRAY'},
|
|
118
118
|
],
|
package/backend/consts.js
CHANGED
|
@@ -107,8 +107,11 @@ const supportTeamsPageIds={
|
|
|
107
107
|
"Commercial":"CommercialSales",// this field doesnt exists in the database
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
const LINKS={
|
|
111
|
+
myApplication:'https://www.smartrecruiters.com/app/employee-portal/68246e5512d84f4c00a19e62/job-applications',
|
|
112
|
+
myReferrals:'https://www.smartrecruiters.com/app/referrals/',
|
|
113
|
+
login:'https://www.smartrecruiters.com/web-sso/saml/${companyId}/login',
|
|
114
|
+
}
|
|
112
115
|
|
|
113
116
|
module.exports = {
|
|
114
117
|
TASKS_NAMES,
|
|
@@ -116,4 +119,5 @@ const supportTeamsPageIds={
|
|
|
116
119
|
TASKS,
|
|
117
120
|
QUERY_MAX_LIMIT,
|
|
118
121
|
supportTeamsPageIds,
|
|
122
|
+
LINKS,
|
|
119
123
|
};
|
package/backend/data.js
CHANGED
|
@@ -4,7 +4,7 @@ const { createCollectionIfMissing } = require('@hisense-staging/velo-npm/backend
|
|
|
4
4
|
const { COLLECTIONS, COLLECTIONS_FIELDS,JOBS_COLLECTION_FIELDS,TEMPLATE_TYPE,TOKEN_NAME,CUSTOM_VALUES_COLLECTION_FIELDS } = require('./collectionConsts');
|
|
5
5
|
const { chunkedBulkOperation, countJobsPerGivenField, fillCityLocationAndLocationAddress ,prepareToSaveArray,normalizeString} = require('./utils');
|
|
6
6
|
const { getAllPositions } = require('./queries');
|
|
7
|
-
const { retrieveSecretVal, getTokenFromCMS } = require('./secretsData');
|
|
7
|
+
const { retrieveSecretVal, getTokenFromCMS ,getApiKeys} = require('./secretsData');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -68,6 +68,16 @@ function getLocation(position,basicJob) {
|
|
|
68
68
|
locationToJobs[basicJob.cityText] ? locationToJobs[basicJob.cityText].push(position.id) : locationToJobs[basicJob.cityText]=[position.id]
|
|
69
69
|
|
|
70
70
|
}
|
|
71
|
+
function getVisibility(position,customFieldsValues) {
|
|
72
|
+
if (!customFieldsValues["Visibility"]) {
|
|
73
|
+
customFieldsValues["Visibility"] = {};
|
|
74
|
+
}
|
|
75
|
+
let visibility;
|
|
76
|
+
position.visibility.toLowerCase()==="public"? visibility="external" : visibility="internal";
|
|
77
|
+
customFieldsValues["Visibility"][visibility] = visibility;
|
|
78
|
+
customValuesToJobs[visibility] ? customValuesToJobs[visibility].push(position.id) : customValuesToJobs[visibility]=[position.id]
|
|
79
|
+
}
|
|
80
|
+
|
|
71
81
|
function getEmploymentType(position,customFieldsValues) {
|
|
72
82
|
if (!customFieldsValues["employmentType"]) {
|
|
73
83
|
customFieldsValues["employmentType"] = {};
|
|
@@ -99,6 +109,8 @@ async function saveJobsDataToCMS() {
|
|
|
99
109
|
const sourcePositions = await filterBasedOnBrand(positions);
|
|
100
110
|
const customFieldsLabels = {}
|
|
101
111
|
const customFieldsValues = {}
|
|
112
|
+
|
|
113
|
+
const {companyId,templateType} = await getApiKeys();
|
|
102
114
|
|
|
103
115
|
// bulk insert to jobs collection without descriptions first
|
|
104
116
|
const jobsData = sourcePositions.map(position => {
|
|
@@ -126,12 +138,16 @@ async function saveJobsDataToCMS() {
|
|
|
126
138
|
brand: getBrand(position.customField),
|
|
127
139
|
jobDescription: null, // Will be filled later
|
|
128
140
|
employmentType: position.typeOfEmployment.label,
|
|
129
|
-
releasedDate: position.releasedDate
|
|
141
|
+
releasedDate: position.releasedDate
|
|
130
142
|
};
|
|
131
143
|
|
|
132
144
|
getCustomFieldsAndValuesFromPosition(position,customFieldsLabels,customFieldsValues);
|
|
133
145
|
getEmploymentType(position,customFieldsValues);
|
|
134
146
|
getLocation(position,basicJob);
|
|
147
|
+
if(templateType===TEMPLATE_TYPE.INTERNAL){
|
|
148
|
+
getVisibility(position,customFieldsValues);
|
|
149
|
+
}
|
|
150
|
+
|
|
135
151
|
return basicJob;
|
|
136
152
|
});
|
|
137
153
|
if(siteconfig===undefined) {
|
|
@@ -183,8 +199,9 @@ async function insertJobsReference(valueId) {
|
|
|
183
199
|
}
|
|
184
200
|
|
|
185
201
|
async function populateCustomFieldsCollection(customFields) {
|
|
186
|
-
fieldstoinsert=[]
|
|
202
|
+
let fieldstoinsert=[]
|
|
187
203
|
customFields["employmentType"] = "Employment Type";
|
|
204
|
+
customFields["Visibility"] = "Visibility";
|
|
188
205
|
for(const ID of Object.keys(customFields)){
|
|
189
206
|
fieldstoinsert.push({
|
|
190
207
|
title: customFields[ID],
|
|
@@ -202,7 +219,7 @@ async function populateCustomValuesCollection(customFieldsValues) {
|
|
|
202
219
|
_id: valueId,
|
|
203
220
|
title: valuesMap[valueId],
|
|
204
221
|
customField: fieldId,
|
|
205
|
-
|
|
222
|
+
totalJobs:customValuesToJobs[valueId].length,
|
|
206
223
|
jobIds:customValuesToJobs[valueId],
|
|
207
224
|
})
|
|
208
225
|
}
|
package/backend/index.js
CHANGED
package/backend/secretsData.js
CHANGED
|
@@ -4,7 +4,7 @@ const { items: wixData } = require('@wix/data');
|
|
|
4
4
|
const { COLLECTIONS,TOKEN_NAME } = require('./collectionConsts');
|
|
5
5
|
|
|
6
6
|
const getSecretValue = auth.elevate(secrets.getSecretValue);
|
|
7
|
-
|
|
7
|
+
const elevatedQuery = auth.elevate(wixData.query);
|
|
8
8
|
|
|
9
9
|
async function retrieveSecretVal(tokenName)
|
|
10
10
|
{
|
|
@@ -20,7 +20,7 @@ const getSecretValue = auth.elevate(secrets.getSecretValue);
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
async function getTokenFromCMS(tokenName) {
|
|
23
|
-
const result = await
|
|
23
|
+
const result = await elevatedQuery(COLLECTIONS.SECRET_MANAGER_MIRROR).eq('tokenName',tokenName).find();
|
|
24
24
|
if (result.items.length > 0) {
|
|
25
25
|
return result.items[0].value;
|
|
26
26
|
} else {
|
|
@@ -28,7 +28,7 @@ const getSecretValue = auth.elevate(secrets.getSecretValue);
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
async function getTemplateTypeFromCMS() {
|
|
31
|
-
const result = await
|
|
31
|
+
const result = await elevatedQuery(COLLECTIONS.TEMPLATE_TYPE).limit(1).find();
|
|
32
32
|
if (result.items.length > 0) {
|
|
33
33
|
return result.items[0].templateType;
|
|
34
34
|
} else {
|
package/package.json
CHANGED
|
@@ -21,7 +21,6 @@ const pagination = {
|
|
|
21
21
|
currentPage: 1,
|
|
22
22
|
};
|
|
23
23
|
async function careersMultiBoxesPageOnReady(_$w,urlParams) {
|
|
24
|
-
console.log("careersMultiBoxesPageOnReady urlParams: ", urlParams);
|
|
25
24
|
await loadData(_$w);
|
|
26
25
|
|
|
27
26
|
await Promise.all([
|
|
@@ -40,7 +39,6 @@ async function careersMultiBoxesPageOnReady(_$w,urlParams) {
|
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
async function clearAll(_$w) {
|
|
43
|
-
console.log("clear all button clicked");
|
|
44
42
|
if(selectedByField.size>0 || _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SECONDARY_SEARCH_INPUT).value || _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value) {
|
|
45
43
|
for(const field of allfields) {
|
|
46
44
|
_$w(`#${FiltersIds[field.title]}CheckBox`).selectedIndices = [];
|
|
@@ -58,10 +56,12 @@ async function handleUrlParams(_$w,urlParams) {
|
|
|
58
56
|
try {
|
|
59
57
|
let applyFiltering=false;
|
|
60
58
|
let keyword=false
|
|
61
|
-
console.log("handleUrlParams urlParams: ", urlParams);
|
|
62
59
|
if(urlParams.brand) {
|
|
63
60
|
applyFiltering=await handleParams(_$w,"brand",urlParams.brand)
|
|
64
61
|
}
|
|
62
|
+
if(urlParams.visibility) {
|
|
63
|
+
applyFiltering=await handleParams(_$w,"visibility",urlParams.visibility)
|
|
64
|
+
}
|
|
65
65
|
if(urlParams.category) {
|
|
66
66
|
applyFiltering=await handleParams(_$w,"category",urlParams.category)
|
|
67
67
|
}
|
|
@@ -71,7 +71,6 @@ async function handleUrlParams(_$w,urlParams) {
|
|
|
71
71
|
keyword=true;
|
|
72
72
|
if(applyFiltering)
|
|
73
73
|
{
|
|
74
|
-
console.log("delete me")
|
|
75
74
|
currentJobs=_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOB_RESULTS_REPEATER).data;
|
|
76
75
|
}
|
|
77
76
|
|
|
@@ -105,12 +104,9 @@ async function handleUrlParams(_$w,urlParams) {
|
|
|
105
104
|
|
|
106
105
|
async function handleParams(_$w,param,value) {
|
|
107
106
|
let applyFiltering=false;
|
|
108
|
-
console.log("handleParams param: ", param, " value: ", value);
|
|
109
107
|
const decodedValue = decodeURIComponent(value);
|
|
110
|
-
console.log("decodedValue: ", decodedValue);
|
|
111
108
|
const field=getFieldByTitle(fieldTitlesInCMS[param],allfields);
|
|
112
109
|
const options=optionsByFieldId.get(field._id);
|
|
113
|
-
console.log("all options availbe for this field: ", field.title, " are ", options);
|
|
114
110
|
const option=getCorrectOption(decodedValue,options);
|
|
115
111
|
if(option) {
|
|
116
112
|
const optionIndex=getOptionIndexFromCheckBox(_$w(`#${FiltersIds[field.title]}CheckBox`).options,option.value);
|
|
@@ -238,7 +234,6 @@ async function loadJobsRepeater(_$w) {
|
|
|
238
234
|
// 2) Load all values once and group them by referenced field
|
|
239
235
|
let valuesByFieldId = groupValuesByField(allvaluesobjects, CUSTOM_VALUES_COLLECTION_FIELDS.CUSTOM_FIELD);
|
|
240
236
|
valuesByFieldId.set("Location",cities)
|
|
241
|
-
|
|
242
237
|
// Build CheckboxGroup options for this field
|
|
243
238
|
|
|
244
239
|
const counter={}
|
|
@@ -260,14 +255,13 @@ async function loadJobsRepeater(_$w) {
|
|
|
260
255
|
|
|
261
256
|
optionsByFieldId.set(key, originalOptions);
|
|
262
257
|
for (const val of allvaluesobjects) {
|
|
263
|
-
counter[val.title]=val.
|
|
258
|
+
counter[val.title]=val.totalJobs
|
|
264
259
|
}
|
|
265
260
|
|
|
266
261
|
countsByFieldId.set(key, new Map(originalOptions.map(o => [o.value, counter[o.label]])));
|
|
267
262
|
updateOptionsUI(_$w,field.title, field._id, ''); // no search query
|
|
268
263
|
_$w(`#${FiltersIds[field.title]}CheckBox`).selectedIndices = []; // start empty
|
|
269
264
|
_$w(`#${FiltersIds[field.title]}CheckBox`).onChange(async (ev) => {
|
|
270
|
-
console.log(`#${FiltersIds[field.title]}CheckBox.selectedIndices: `, _$w(`#${FiltersIds[field.title]}CheckBox`).selectedIndices);
|
|
271
265
|
dontUpdateThisCheckBox=field._id;
|
|
272
266
|
const selected = ev.target.value; // array of selected value IDs
|
|
273
267
|
if (selected && selected.length) {
|
|
@@ -278,14 +272,11 @@ async function loadJobsRepeater(_$w) {
|
|
|
278
272
|
await updateJobsAndNumbersAndFilters(_$w);
|
|
279
273
|
|
|
280
274
|
});
|
|
281
|
-
|
|
282
275
|
const runFilter = debounce(() => {
|
|
283
276
|
const query = (_$w(`#${FiltersIds[field.title]}input`).value || '').toLowerCase().trim();
|
|
284
277
|
updateOptionsUI(_$w, field.title, field._id, query);
|
|
285
278
|
}, 150);
|
|
286
|
-
|
|
287
279
|
_$w(`#${FiltersIds[field.title]}input`).onInput(runFilter);
|
|
288
|
-
|
|
289
280
|
|
|
290
281
|
}
|
|
291
282
|
await refreshFacetCounts(_$w);
|
|
@@ -332,7 +323,7 @@ async function loadJobsRepeater(_$w) {
|
|
|
332
323
|
const filtered = searchQuery
|
|
333
324
|
? withCounts.filter(o => (o.label || '').toLowerCase().includes(searchQuery))
|
|
334
325
|
: withCounts;
|
|
335
|
-
|
|
326
|
+
|
|
336
327
|
// Preserve currently selected values that are still visible
|
|
337
328
|
let prevSelected=[]
|
|
338
329
|
clearAll? prevSelected=[]:prevSelected= _$w(`#${FiltersIds[fieldTitle]}CheckBox`).value;
|
package/pages/careersPage.js
CHANGED
|
@@ -110,6 +110,8 @@ async function handleUrlParams(_$w) {
|
|
|
110
110
|
if (queryBrandVar && _$w('#dropdownBrand').isVisible) { //if it is not visible, ignore it
|
|
111
111
|
await handleBrandParam(_$w,queryBrandVar);
|
|
112
112
|
}
|
|
113
|
+
|
|
114
|
+
|
|
113
115
|
if (queryPageVar) {
|
|
114
116
|
await handlePageParam(_$w);
|
|
115
117
|
}
|
|
@@ -122,6 +124,8 @@ async function handleUrlParams(_$w) {
|
|
|
122
124
|
if (queryJobTypeVar) {
|
|
123
125
|
await handleJobTypeParam(_$w,queryJobTypeVar);
|
|
124
126
|
}
|
|
127
|
+
|
|
128
|
+
|
|
125
129
|
await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
|
|
126
130
|
}
|
|
127
131
|
|
package/pages/homePage.js
CHANGED
|
@@ -10,7 +10,6 @@ const { COLLECTIONS } = require('../backend/collectionConsts');
|
|
|
10
10
|
const { bindPrimarySearch,getAllRecords,loadPrimarySearchRepeater } = require('./pagesUtils');
|
|
11
11
|
let thisObjectVar;
|
|
12
12
|
let searchByCityFlag=false;
|
|
13
|
-
let loadedCategories=false;
|
|
14
13
|
async function homePageOnReady(_$w,thisObject=null) {
|
|
15
14
|
|
|
16
15
|
const queryResult = await wixData.query(COLLECTIONS.SITE_CONFIGS).find();
|
|
@@ -20,10 +19,7 @@ async function homePageOnReady(_$w,thisObject=null) {
|
|
|
20
19
|
const allvaluesobjects=await getAllRecords(COLLECTIONS.CUSTOM_VALUES);
|
|
21
20
|
await Promise.all([
|
|
22
21
|
bindPrimarySearch(_$w,allvaluesobjects,allJobs),
|
|
23
|
-
loadPrimarySearchRepeater(_$w)
|
|
24
|
-
bindTeamRepeater(_$w),
|
|
25
|
-
bindViewAllButton(_$w),
|
|
26
|
-
|
|
22
|
+
loadPrimarySearchRepeater(_$w)
|
|
27
23
|
]);
|
|
28
24
|
}
|
|
29
25
|
else{
|
|
@@ -36,9 +32,13 @@ async function homePageOnReady(_$w,thisObject=null) {
|
|
|
36
32
|
}
|
|
37
33
|
|
|
38
34
|
function bind(_$w) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
_$w('#teamRepeater').onItemReady(($item, itemData) => {
|
|
36
|
+
$item('#teamButton').label = `View ${itemData.count} Open Positions`;
|
|
37
|
+
$item('#teamButton').onClick(()=>{
|
|
38
|
+
const department = encodeURIComponent(itemData.title);
|
|
39
|
+
location.to(`/positions?department=${department}`);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
42
|
|
|
43
43
|
_$w('#citiesDataset').onReady(async () => {
|
|
44
44
|
const numOfItems = await _$w('#citiesDataset').getTotalCount();
|
|
@@ -64,45 +64,6 @@ async function homePageOnReady(_$w,thisObject=null) {
|
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
function bindTeamRepeater(_$w) {
|
|
68
|
-
_$w('#teamRepeater').onItemReady(($item, itemData) => {
|
|
69
|
-
$item('#teamButton').label = `View ${itemData.count} Open Positions`;
|
|
70
|
-
const department = encodeURIComponent(itemData.title);
|
|
71
|
-
if (itemData.customField) {
|
|
72
|
-
[$item('#teamButton'), $item('#teamButton2')].forEach(btn => {
|
|
73
|
-
btn.onClick(() => {
|
|
74
|
-
location.to(`/search?category=${department}`);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
else{
|
|
80
|
-
$item('#teamButton').onClick(()=>{
|
|
81
|
-
location.to(`/positions?department=${department}`);
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function bindViewAllButton(_$w) {
|
|
88
|
-
|
|
89
|
-
_$w('#viewAllCategoriesButton').onClick(()=>{
|
|
90
|
-
if(!loadedCategories) {
|
|
91
|
-
loadedCategories=true;
|
|
92
|
-
_$w('#viewAllCategoriesButton').label = "View Less";
|
|
93
|
-
_$w("#categoriesDataset").loadMore();
|
|
94
|
-
}
|
|
95
|
-
else{
|
|
96
|
-
loadedCategories=false;
|
|
97
|
-
_$w('#viewAllCategoriesButton').label = "View All";
|
|
98
|
-
_$w("#categoriesDataset").loadPage(1);
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
67
|
function init(_$w) {
|
|
107
68
|
const debouncedInput = debounce(()=>handleSearchInput(_$w), 400,thisObjectVar);
|
|
108
69
|
|
package/pages/index.js
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const{isElementExistOnPage} = require('psdev-utils');
|
|
2
|
+
const { location } = require("@wix/site-location");
|
|
3
|
+
const { LINKS } = require('../backend/consts');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
let companyIdGlobal;
|
|
7
|
+
async function masterPageOnReady(_$w,getApiKeys) {
|
|
8
|
+
const {companyId,templateType} = await getApiKeys();
|
|
9
|
+
companyIdGlobal=companyId;
|
|
10
|
+
bindButton(_$w,"myApplication");
|
|
11
|
+
bindButton(_$w,"myReferrals");
|
|
12
|
+
bindButton(_$w,"login");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function bindButton(_$w,buttonName) {
|
|
16
|
+
if(isElementExistOnPage(_$w(`#${buttonName}Button`))){
|
|
17
|
+
if(buttonName==="login"){
|
|
18
|
+
|
|
19
|
+
_$w(`#${buttonName}Button`).onClick(()=>{
|
|
20
|
+
location.to(LINKS[buttonName].replace("${companyId}",companyIdGlobal));
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
else{
|
|
24
|
+
_$w(`#${buttonName}Button`).onClick(()=>{
|
|
25
|
+
location.to(LINKS[buttonName]);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else{
|
|
30
|
+
console.log(`${buttonName} button not found`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
module.exports = {
|
|
34
|
+
masterPageOnReady,
|
|
35
|
+
};
|
package/pages/pagesUtils.js
CHANGED
|
@@ -141,7 +141,7 @@ async function loadCategoriesListPrimarySearch(_$w,allvaluesobjects) {
|
|
|
141
141
|
let categoryValues=[]
|
|
142
142
|
for(const value of allvaluesobjects) {
|
|
143
143
|
if(value.customField===CATEGORY_CUSTOM_FIELD_ID_IN_CMS) {
|
|
144
|
-
categoryValues.push({title:value.title+` (${value.
|
|
144
|
+
categoryValues.push({title:value.title+` (${value.totalJobs})` ,_id:value._id});
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.CATEGORY_RESULTS_REPEATER).data = categoryValues;
|
|
@@ -152,15 +152,21 @@ async function primarySearch(_$w,query,alljobs) {
|
|
|
152
152
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState("categoryResults");
|
|
153
153
|
return false;
|
|
154
154
|
}
|
|
155
|
-
|
|
156
155
|
let filteredJobs=alljobs.filter(job=>job.title.toLowerCase().includes(query));
|
|
157
156
|
if(filteredJobs.length>0) {
|
|
158
|
-
//currentJobs=filteredJobs;
|
|
159
157
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState("jobResults");
|
|
160
158
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOB_RESULTS_REPEATER).data = filteredJobs
|
|
161
159
|
return true;
|
|
162
160
|
}
|
|
163
161
|
else {
|
|
162
|
+
console.log("searching by location")
|
|
163
|
+
//search by location
|
|
164
|
+
filteredJobs=alljobs.filter(job=>job.location.fullLocation.toLowerCase().includes(query));
|
|
165
|
+
if(filteredJobs.length>0) {
|
|
166
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState("jobResults");
|
|
167
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOB_RESULTS_REPEATER).data = filteredJobs
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
164
170
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState("noResults");
|
|
165
171
|
return false;
|
|
166
172
|
}
|
package/pages/positionPage.js
CHANGED
|
@@ -37,9 +37,10 @@ async function getCategoryValueId(customValues) {
|
|
|
37
37
|
const item = await _$w('#datasetJobsItem').getCurrentItem();
|
|
38
38
|
const multiRefField=await getPositionWithMultiRefField(item._id);
|
|
39
39
|
const categoryValueId=await getCategoryValueId(multiRefField);
|
|
40
|
+
|
|
40
41
|
handleReferFriendButton(_$w,item);
|
|
42
|
+
|
|
41
43
|
handleApplyButton(_$w,item);
|
|
42
|
-
|
|
43
44
|
|
|
44
45
|
_$w('#companyDescriptionText').text = htmlToText(item.jobDescription.companyDescription.text);
|
|
45
46
|
_$w('#responsibilitiesText').text = htmlToText(item.jobDescription.jobDescription.text);
|
|
@@ -51,12 +52,12 @@ async function getCategoryValueId(customValues) {
|
|
|
51
52
|
}
|
|
52
53
|
if(_$w('#relatedJobsRepNoDepartment')) // when there is no department, we filter based on category
|
|
53
54
|
{
|
|
54
|
-
const relatedJobs=await getRelatedJobs(categoryValueId,item._id
|
|
55
|
+
const relatedJobs=await getRelatedJobs(categoryValueId,item._id);
|
|
55
56
|
_$w('#relatedJobsRepNoDepartment').onItemReady(($item, itemData) => {
|
|
56
57
|
$item('#relatedJobTitle').text = itemData.title;
|
|
57
58
|
$item('#relatedJobLocation').text = itemData.location.fullLocation;
|
|
58
59
|
});
|
|
59
|
-
_$w('#relatedJobsRepNoDepartment').data = relatedJobs
|
|
60
|
+
_$w('#relatedJobsRepNoDepartment').data = relatedJobs
|
|
60
61
|
|
|
61
62
|
|
|
62
63
|
}
|
|
@@ -82,25 +83,19 @@ async function getCategoryValueId(customValues) {
|
|
|
82
83
|
|
|
83
84
|
function handleReferFriendButton(_$w,item) {
|
|
84
85
|
if(!item.referFriendLink && isElementExistOnPage(_$w('#referFriendButton'))){
|
|
86
|
+
console.log("hiding referFriendButton");
|
|
85
87
|
_$w('#referFriendButton').hide();
|
|
86
88
|
}
|
|
87
89
|
}
|
|
88
90
|
|
|
89
91
|
function handleApplyButton(_$w,item) {
|
|
90
|
-
try{
|
|
91
92
|
_$w('#applyButton').target="_blank";//so it can open in new tab
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
catch(error){
|
|
96
|
-
console.warn("error in handleApplyButton: , using applyLink directly", error);
|
|
97
|
-
_$w('#applyButton').target="_blank";
|
|
98
|
-
_$w('#applyButton').link=item.applyLink;
|
|
99
|
-
}
|
|
93
|
+
const url=appendQueryParams(item.applyLink,query);
|
|
94
|
+
_$w('#applyButton').link=url; //so it can be clicked
|
|
100
95
|
}
|
|
101
96
|
|
|
102
|
-
async function getRelatedJobs(categoryValueId,itemId
|
|
103
|
-
const relatedJobs=await wixData.query(COLLECTIONS.JOBS).include(JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES).hasSome(JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES,[categoryValueId]).ne("_id",itemId).
|
|
97
|
+
async function getRelatedJobs(categoryValueId,itemId) {
|
|
98
|
+
const relatedJobs=await wixData.query(COLLECTIONS.JOBS).include(JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES).hasSome(JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES,[categoryValueId]).ne("_id",itemId).find();
|
|
104
99
|
return relatedJobs.items;
|
|
105
100
|
}
|
|
106
101
|
|
|
@@ -158,16 +158,15 @@ describe('primarySearch function tests', () => {
|
|
|
158
158
|
|
|
159
159
|
await primarySearch(mockW, 'unicorn hunter',mockJobs);
|
|
160
160
|
|
|
161
|
-
|
|
162
161
|
expect(mockprimarySearchMultiBox.changeState).toHaveBeenCalledWith('noResults');
|
|
163
162
|
expect(mockprimarySearcJobResult.data).toBeNull();
|
|
164
163
|
});
|
|
165
164
|
|
|
166
165
|
it('should fill category repeater when clicking on empty primary search input', async () => {
|
|
167
166
|
const mockCategoryValues = [
|
|
168
|
-
{ _id: 'cat1', title: 'Engineering', customField: CATEGORY_CUSTOM_FIELD_ID_IN_CMS,
|
|
169
|
-
{ _id: 'cat2', title: 'Marketing', customField: CATEGORY_CUSTOM_FIELD_ID_IN_CMS,
|
|
170
|
-
{ _id: 'cat3', title: 'Sales', customField: CATEGORY_CUSTOM_FIELD_ID_IN_CMS,
|
|
167
|
+
{ _id: 'cat1', title: 'Engineering', customField: CATEGORY_CUSTOM_FIELD_ID_IN_CMS, totalJobs: 5 },
|
|
168
|
+
{ _id: 'cat2', title: 'Marketing', customField: CATEGORY_CUSTOM_FIELD_ID_IN_CMS, totalJobs: 3 },
|
|
169
|
+
{ _id: 'cat3', title: 'Sales', customField: CATEGORY_CUSTOM_FIELD_ID_IN_CMS, totalJobs: 7 }
|
|
171
170
|
];
|
|
172
171
|
|
|
173
172
|
careersMultiBoxesPage.__set__('allvaluesobjects', mockCategoryValues);
|