sr-npm 1.7.924 → 1.7.926
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/consts.js +11 -15
- package/backend/data.js +11 -9
- package/package.json +1 -1
- package/pages/careersMultiBoxesPage.js +25 -31
- package/pages/pagesUtils.js +36 -19
- package/pages/positionPage.js +4 -2
- package/pages/supportTeamsPage.js +11 -9
- package/tests/multiSearchBoxCareers.spec.js +1 -1
|
@@ -22,7 +22,9 @@ const CAREERS_MULTI_BOXES_PAGE_CONSTS={
|
|
|
22
22
|
JOBS_MULTI_STATE_BOX:"#jobsMultiStateBox",
|
|
23
23
|
PRIMARY_SEARCH_INPUT: '#primarySearchInput',
|
|
24
24
|
JOB_RESULTS_REPEATER: '#jobResultsRepeater',
|
|
25
|
+
JOB_RESULTS_REPEATER_ITEM: '#jobResultsRepeaterItem',
|
|
25
26
|
CATEGORY_RESULTS_REPEATER: '#categoryResultsRepeater',
|
|
27
|
+
CATEGORY_RESULTS_REPEATER_ITEM: '#categoryResultsRepeaterItem',
|
|
26
28
|
PRIMARY_SEARCH_MULTI_BOX: '#primarySearchMultiBox',
|
|
27
29
|
PRIMARY_SEARCH_POSITION_BUTTON: '#primarySearchPositionButton',
|
|
28
30
|
PRIMARY_SEARCH_CATEGORY_BUTTON: '#primarySearchCategoryButton',
|
package/backend/consts.js
CHANGED
|
@@ -82,6 +82,7 @@ const TASK_TYPE = {
|
|
|
82
82
|
|
|
83
83
|
const supportTeamsPageIds={
|
|
84
84
|
RECENTLEY_ADDED_JOBS: "#recentleyAddedJobs",
|
|
85
|
+
RECENTLEY_ADDED_JOBS_ITEM: "#recentleyAddedJobsItem",
|
|
85
86
|
JOB_LOCATION: "#jobLocation",
|
|
86
87
|
JOB_TITLE: "#jobTitle",
|
|
87
88
|
SEE_ALL_JOBS_TEXT: "#seeAllJobsText",
|
|
@@ -90,27 +91,22 @@ const supportTeamsPageIds={
|
|
|
90
91
|
MOST_RECENT_JOBS_TITLE: "#mostRecentJobsTitle",
|
|
91
92
|
valueToValueIdMap: {
|
|
92
93
|
"Human Resouces":"PeopleSupport",
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
94
|
+
"Buying":"Merchandise",
|
|
95
|
+
"Tech":"InformationServices",
|
|
96
|
+
"Planning":"Merchandise",
|
|
96
97
|
"Digital":"ecommerceandDigital",// this field doesnt exists in the database
|
|
97
|
-
"Marketing
|
|
98
|
-
"Finance
|
|
98
|
+
"Marketing":"Marketing",
|
|
99
|
+
"Finance":"Finance",// this field doesnt exists in the database
|
|
99
100
|
"Services":"ServicesInstallation",
|
|
100
|
-
"
|
|
101
|
-
"
|
|
101
|
+
"Design":"Merchandise",
|
|
102
|
+
"Retail Operations":"Operations",// this field doesnt exists in the database
|
|
102
103
|
"Data":"InsightsandDataScience",// this field doesnt exists in the database
|
|
103
104
|
"Property":"Property",// this field doesnt exists in the database,
|
|
104
105
|
"Legal":"Legal",// this field doesnt exists in the database,
|
|
105
|
-
"Supply Chain
|
|
106
|
-
"Contact
|
|
106
|
+
"Supply Chain":"Logistics",
|
|
107
|
+
"Contact Centre":"CustomerEngagementCentres",// this field doesnt exists in the database
|
|
107
108
|
"Commercial":"CommercialSales",// this field doesnt exists in the database
|
|
108
|
-
}
|
|
109
|
-
excludeValues: new Set([
|
|
110
|
-
"Noel Leeming Commercial",
|
|
111
|
-
"Noel Leeming Services",
|
|
112
|
-
"Sustainability"
|
|
113
|
-
])
|
|
109
|
+
}
|
|
114
110
|
}
|
|
115
111
|
const LINKS={
|
|
116
112
|
myApplication:'https://www.smartrecruiters.com/app/employee-portal/68246e5512d84f4c00a19e62/job-applications',
|
package/backend/data.js
CHANGED
|
@@ -75,7 +75,7 @@ function getVisibility(position,customFieldsValues) {
|
|
|
75
75
|
let visibility;
|
|
76
76
|
position.visibility.toLowerCase()==="public"? visibility="external" : visibility="internal";
|
|
77
77
|
customFieldsValues["Visibility"][visibility] = visibility;
|
|
78
|
-
customValuesToJobs[visibility] ? customValuesToJobs[visibility].
|
|
78
|
+
customValuesToJobs[visibility] ? customValuesToJobs[visibility].add(position.id) : customValuesToJobs[visibility]=new Set([position.id])
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
function getEmploymentType(position,customFieldsValues) {
|
|
@@ -83,7 +83,7 @@ function getEmploymentType(position,customFieldsValues) {
|
|
|
83
83
|
customFieldsValues["employmentType"] = {};
|
|
84
84
|
}
|
|
85
85
|
customFieldsValues["employmentType"][position.typeOfEmployment.id] = position.typeOfEmployment.label;
|
|
86
|
-
customValuesToJobs[position.typeOfEmployment.id] ? customValuesToJobs[position.typeOfEmployment.id].
|
|
86
|
+
customValuesToJobs[position.typeOfEmployment.id] ? customValuesToJobs[position.typeOfEmployment.id].add(position.id) : customValuesToJobs[position.typeOfEmployment.id]=new Set([position.id])
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
function getCustomFieldsAndValuesFromPosition(position,customFieldsLabels,customFieldsValues) {
|
|
@@ -101,7 +101,7 @@ function getCustomFieldsAndValuesFromPosition(position,customFieldsLabels,custom
|
|
|
101
101
|
}
|
|
102
102
|
customFieldsValues[fieldId][valueId] = valueLabel;
|
|
103
103
|
|
|
104
|
-
customValuesToJobs[valueId] ? customValuesToJobs[valueId].
|
|
104
|
+
customValuesToJobs[valueId] ? customValuesToJobs[valueId].add(position.id) : customValuesToJobs[valueId]=new Set([position.id])
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
async function saveJobsDataToCMS() {
|
|
@@ -153,7 +153,7 @@ async function saveJobsDataToCMS() {
|
|
|
153
153
|
await getSiteConfig();
|
|
154
154
|
}
|
|
155
155
|
if (siteconfig.customFields==="true") {
|
|
156
|
-
await populateCustomFieldsCollection(customFieldsLabels);
|
|
156
|
+
await populateCustomFieldsCollection(customFieldsLabels,templateType);
|
|
157
157
|
await populateCustomValuesCollection(customFieldsValues);
|
|
158
158
|
}
|
|
159
159
|
// Sort jobs by title (ascending, case-insensitive, numeric-aware)
|
|
@@ -194,13 +194,15 @@ async function saveJobsDataToCMS() {
|
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
async function insertJobsReference(valueId) {
|
|
197
|
-
await wixData.insertReference(COLLECTIONS.CUSTOM_VALUES, CUSTOM_VALUES_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES,valueId, customValuesToJobs[valueId]);
|
|
197
|
+
await wixData.insertReference(COLLECTIONS.CUSTOM_VALUES, CUSTOM_VALUES_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES,valueId, Array.from(customValuesToJobs[valueId]));
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
async function populateCustomFieldsCollection(customFields) {
|
|
200
|
+
async function populateCustomFieldsCollection(customFields,templateType) {
|
|
201
201
|
let fieldstoinsert=[]
|
|
202
202
|
customFields["employmentType"] = "Employment Type";
|
|
203
|
-
|
|
203
|
+
if(templateType===TEMPLATE_TYPE.INTERNAL){
|
|
204
|
+
customFields["Visibility"] = "Visibility";
|
|
205
|
+
}
|
|
204
206
|
for(const ID of Object.keys(customFields)){
|
|
205
207
|
fieldstoinsert.push({
|
|
206
208
|
title: customFields[ID],
|
|
@@ -218,8 +220,8 @@ async function populateCustomValuesCollection(customFieldsValues) {
|
|
|
218
220
|
_id: valueId,
|
|
219
221
|
title: valuesMap[valueId],
|
|
220
222
|
customField: fieldId,
|
|
221
|
-
count:customValuesToJobs[valueId].
|
|
222
|
-
jobIds:customValuesToJobs[valueId],
|
|
223
|
+
count:customValuesToJobs[valueId].size,
|
|
224
|
+
jobIds:Array.from(customValuesToJobs[valueId]),
|
|
223
225
|
})
|
|
224
226
|
}
|
|
225
227
|
|
package/package.json
CHANGED
|
@@ -16,6 +16,7 @@ let currentJobs=[] // current jobs that are displayed in the jobs repeater
|
|
|
16
16
|
let allsecondarySearchJobs=[] // secondary search results that are displayed in the jobs repeater
|
|
17
17
|
let currentSecondarySearchJobs=[] // current secondary search results that are displayed in the jobs repeater
|
|
18
18
|
let secondarySearchIsFilled=false // whether the secondary search is filled with results
|
|
19
|
+
let keywordAllJobs; // all jobs that are displayed in the jobs repeater when the keyword is filled
|
|
19
20
|
const pagination = {
|
|
20
21
|
pageSize: 10,
|
|
21
22
|
currentPage: 1,
|
|
@@ -47,6 +48,8 @@ async function clearAll(_$w) {
|
|
|
47
48
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SECONDARY_SEARCH_INPUT).value='';
|
|
48
49
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value='';
|
|
49
50
|
secondarySearchIsFilled=false;
|
|
51
|
+
currentJobs=alljobs;
|
|
52
|
+
keywordAllJobs=undefined;
|
|
50
53
|
await updateJobsAndNumbersAndFilters(_$w,true);
|
|
51
54
|
}
|
|
52
55
|
}
|
|
@@ -55,7 +58,13 @@ async function clearAll(_$w) {
|
|
|
55
58
|
async function handleUrlParams(_$w,urlParams) {
|
|
56
59
|
try {
|
|
57
60
|
let applyFiltering=false;
|
|
58
|
-
|
|
61
|
+
|
|
62
|
+
if(urlParams.keyword) {
|
|
63
|
+
applyFiltering=await primarySearch(_$w, decodeURIComponent(urlParams.keyword), alljobs);
|
|
64
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value=decodeURIComponent(urlParams.keyword);
|
|
65
|
+
currentJobs=_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOB_RESULTS_REPEATER).data;
|
|
66
|
+
keywordAllJobs=_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOB_RESULTS_REPEATER).data;
|
|
67
|
+
}
|
|
59
68
|
if(urlParams.brand) {
|
|
60
69
|
applyFiltering=await handleParams(_$w,"brand",urlParams.brand)
|
|
61
70
|
}
|
|
@@ -65,18 +74,9 @@ async function handleUrlParams(_$w,urlParams) {
|
|
|
65
74
|
if(urlParams.category) {
|
|
66
75
|
applyFiltering=await handleParams(_$w,"category",urlParams.category)
|
|
67
76
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
_$w
|
|
71
|
-
keyword=true;
|
|
72
|
-
if(applyFiltering)
|
|
73
|
-
{
|
|
74
|
-
currentJobs=_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOB_RESULTS_REPEATER).data;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
if(applyFiltering) {
|
|
79
|
-
await updateJobsAndNumbersAndFilters(_$w,false,keyword);
|
|
77
|
+
|
|
78
|
+
if(applyFiltering || keywordAllJobs) {
|
|
79
|
+
await updateJobsAndNumbersAndFilters(_$w);
|
|
80
80
|
}
|
|
81
81
|
if(urlParams.page) {
|
|
82
82
|
if(Number.isNaN(Number(urlParams.page)) || Number(urlParams.page)<=1 || Number(urlParams.page)>Math.ceil(currentJobs.length/pagination.pageSize)) {
|
|
@@ -288,8 +288,8 @@ async function loadJobsRepeater(_$w) {
|
|
|
288
288
|
|
|
289
289
|
|
|
290
290
|
|
|
291
|
-
async function updateJobsAndNumbersAndFilters(_$w,clearAll=false
|
|
292
|
-
await applyJobFilters(_$w
|
|
291
|
+
async function updateJobsAndNumbersAndFilters(_$w,clearAll=false) {
|
|
292
|
+
await applyJobFilters(_$w); // re-query jobs
|
|
293
293
|
await refreshFacetCounts(_$w,clearAll); // recompute and update counts in all lists
|
|
294
294
|
await updateSelectedValuesRepeater(_$w);
|
|
295
295
|
updateTotalJobsCountText(_$w);
|
|
@@ -297,15 +297,7 @@ async function loadJobsRepeater(_$w) {
|
|
|
297
297
|
|
|
298
298
|
function updateOptionsUI(_$w,fieldTitle, fieldId, searchQuery,clearAll=false) {
|
|
299
299
|
let base = optionsByFieldId.get(fieldId) || [];
|
|
300
|
-
console.log("base: ",base)
|
|
301
|
-
console.log("optionsByFieldId : ",optionsByFieldId)
|
|
302
|
-
console.log("countsByFieldId : ",countsByFieldId)
|
|
303
300
|
const countsMap = countsByFieldId.get(fieldId) || new Map();
|
|
304
|
-
console.log("countsMap: ",countsMap)
|
|
305
|
-
console.log("fieldTitle: ",fieldTitle)
|
|
306
|
-
console.log("fieldId: ",fieldId)
|
|
307
|
-
console.log("searchQuery: ",searchQuery)
|
|
308
|
-
console.log("clearAll: ",clearAll)
|
|
309
301
|
|
|
310
302
|
if(dontUpdateThisCheckBox===fieldId && !clearAll)
|
|
311
303
|
{
|
|
@@ -320,7 +312,6 @@ async function loadJobsRepeater(_$w) {
|
|
|
320
312
|
filteredbase.push(element)
|
|
321
313
|
}
|
|
322
314
|
}
|
|
323
|
-
console.log("filteredbase: ",filteredbase)
|
|
324
315
|
// Build display options with counts
|
|
325
316
|
const withCounts = filteredbase.map(o => {
|
|
326
317
|
const count = countsMap.get(o.value)
|
|
@@ -330,7 +321,6 @@ async function loadJobsRepeater(_$w) {
|
|
|
330
321
|
};
|
|
331
322
|
});
|
|
332
323
|
// Apply search
|
|
333
|
-
console.log("withCounts: ",withCounts)
|
|
334
324
|
const filtered = searchQuery
|
|
335
325
|
? withCounts.filter(o => (o.label || '').toLowerCase().includes(searchQuery))
|
|
336
326
|
: withCounts;
|
|
@@ -339,19 +329,23 @@ async function loadJobsRepeater(_$w) {
|
|
|
339
329
|
let prevSelected=[]
|
|
340
330
|
clearAll? prevSelected=[]:prevSelected= _$w(`#${FiltersIds[fieldTitle]}CheckBox`).value;
|
|
341
331
|
const visibleSet = new Set(filtered.map(o => o.value));
|
|
342
|
-
console.log("visibleSet: ",visibleSet)
|
|
343
332
|
const preserved = prevSelected.filter(v => visibleSet.has(v));
|
|
344
|
-
|
|
333
|
+
if(filtered.length===0) {
|
|
334
|
+
_$w(`#${FiltersIds[fieldTitle]}MultiBox`).changeState(`${FiltersIds[fieldTitle]}NoResults`);
|
|
335
|
+
}
|
|
336
|
+
else{
|
|
337
|
+
_$w(`#${FiltersIds[fieldTitle]}MultiBox`).changeState(`${FiltersIds[fieldTitle]}Results`);
|
|
345
338
|
_$w(`#${FiltersIds[fieldTitle]}CheckBox`).options = filtered;
|
|
346
339
|
_$w(`#${FiltersIds[fieldTitle]}CheckBox`).value = preserved;
|
|
340
|
+
}
|
|
347
341
|
}
|
|
348
342
|
|
|
349
|
-
async function applyJobFilters(_$w
|
|
343
|
+
async function applyJobFilters(_$w) {
|
|
350
344
|
let tempFilteredJobs=[];
|
|
351
345
|
let finalFilteredJobs=[];
|
|
352
346
|
secondarySearchIsFilled? finalFilteredJobs=allsecondarySearchJobs:finalFilteredJobs=alljobs;
|
|
353
|
-
if(
|
|
354
|
-
finalFilteredJobs=
|
|
347
|
+
if(keywordAllJobs) {
|
|
348
|
+
finalFilteredJobs=keywordAllJobs
|
|
355
349
|
}
|
|
356
350
|
let addedJobsIds=new Set();
|
|
357
351
|
// AND across categories, OR within each category
|
|
@@ -441,6 +435,7 @@ async function refreshFacetCounts(_$w,clearAll=false) {
|
|
|
441
435
|
function countJobsPerField(jobs) {
|
|
442
436
|
const fieldIds = Array.from(optionsByFieldId.keys());
|
|
443
437
|
const currentJobsIds=jobs.map(job=>job._id);
|
|
438
|
+
|
|
444
439
|
for (const fieldId of fieldIds) {
|
|
445
440
|
let currentoptions=optionsByFieldId.get(fieldId)
|
|
446
441
|
let counter=new Map();
|
|
@@ -503,7 +498,6 @@ async function secondarySearch(_$w,query) {
|
|
|
503
498
|
try {
|
|
504
499
|
await bindPrimarySearch(_$w,allvaluesobjects,alljobs);
|
|
505
500
|
|
|
506
|
-
|
|
507
501
|
const secondarySearchDebounced = debounce(async () => {
|
|
508
502
|
const query = (_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SECONDARY_SEARCH_INPUT).value || '').toLowerCase().trim();
|
|
509
503
|
await secondarySearch(_$w, query);
|
package/pages/pagesUtils.js
CHANGED
|
@@ -63,21 +63,30 @@ function groupValuesByField(values, refKey) {
|
|
|
63
63
|
async function loadPrimarySearchRepeater(_$w) {
|
|
64
64
|
try {
|
|
65
65
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOB_RESULTS_REPEATER).onItemReady(async ($item, itemData) => {
|
|
66
|
-
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_POSITION_BUTTON).label = itemData.title || '';
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_POSITION_BUTTON).label = itemData.title || '';
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOB_RESULTS_REPEATER_ITEM).onClick((event) => {
|
|
70
|
+
const data = _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOB_RESULTS_REPEATER_ITEM).data;
|
|
71
|
+
const clickedItemData = data.find(
|
|
72
|
+
(item) => item._id === event.context.itemId,
|
|
73
|
+
);
|
|
74
|
+
location.to(clickedItemData["link-jobs-title"]);
|
|
71
75
|
});
|
|
72
|
-
|
|
73
76
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.CATEGORY_RESULTS_REPEATER).onItemReady(async ($item, itemData) => {
|
|
74
77
|
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_CATEGORY_BUTTON).label = itemData.title || '';
|
|
75
|
-
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_CATEGORY_BUTTON).onClick(async () => {
|
|
76
|
-
const baseUrl = await location.baseUrl();
|
|
77
|
-
const encodedCategory=encodeURIComponent(itemData._id);
|
|
78
|
-
location.to(`${baseUrl}/search?category=${encodedCategory}`);
|
|
79
|
-
});
|
|
80
78
|
});
|
|
79
|
+
|
|
80
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.CATEGORY_RESULTS_REPEATER_ITEM).onClick(async (event) => {
|
|
81
|
+
const data = _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.CATEGORY_RESULTS_REPEATER).data;
|
|
82
|
+
const clickedItemData = data.find(
|
|
83
|
+
(item) => item._id === event.context.itemId,
|
|
84
|
+
);
|
|
85
|
+
const baseUrl = await location.baseUrl();
|
|
86
|
+
const encodedCategory=encodeURIComponent(clickedItemData._id);
|
|
87
|
+
location.to(`${baseUrl}/search?category=${encodedCategory}`);
|
|
88
|
+
});
|
|
89
|
+
|
|
81
90
|
} catch (error) {
|
|
82
91
|
console.error('Failed to load primary search repeater:', error);
|
|
83
92
|
}
|
|
@@ -110,8 +119,12 @@ _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).onMouseOut(async () => {
|
|
|
110
119
|
|
|
111
120
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).onKeyPress(async (event) => {
|
|
112
121
|
if( event.key==='Enter') {
|
|
122
|
+
console.log("primary search input key pressed");
|
|
123
|
+
console.log("_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value: ",_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value);
|
|
113
124
|
if(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value.trim()==='') {
|
|
114
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).collapse();
|
|
125
|
+
// _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).collapse();
|
|
126
|
+
const baseUrl = await location.baseUrl();
|
|
127
|
+
location.to(`${baseUrl}/search`);
|
|
115
128
|
|
|
116
129
|
}
|
|
117
130
|
else {
|
|
@@ -123,8 +136,11 @@ _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).onKeyPress(async (even
|
|
|
123
136
|
});
|
|
124
137
|
|
|
125
138
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_BUTTON).onClick(async () => {
|
|
139
|
+
console.log("primary search button clicked");
|
|
140
|
+
console.log("_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value: ",_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value);
|
|
126
141
|
if(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value.trim()==='') {
|
|
127
|
-
|
|
142
|
+
const baseUrl = await location.baseUrl();
|
|
143
|
+
location.to(`${baseUrl}/search`);
|
|
128
144
|
}
|
|
129
145
|
else {
|
|
130
146
|
let encodedKeyWord=encodeURIComponent(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value);
|
|
@@ -155,25 +171,26 @@ async function primarySearch(_$w,query,alljobs) {
|
|
|
155
171
|
let filteredJobs=alljobs.filter(job=>job.title.toLowerCase().includes(query));
|
|
156
172
|
if(filteredJobs.length>0) {
|
|
157
173
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState("jobResults");
|
|
158
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOB_RESULTS_REPEATER).data = filteredJobs
|
|
159
|
-
return true;
|
|
160
174
|
}
|
|
161
175
|
else {
|
|
162
176
|
console.log("searching by location")
|
|
163
|
-
//search by location
|
|
164
177
|
filteredJobs=alljobs.filter(job=>job.location.fullLocation.toLowerCase().includes(query));
|
|
165
178
|
if(filteredJobs.length>0) {
|
|
166
179
|
_$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
180
|
}
|
|
181
|
+
else{
|
|
170
182
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState("noResults");
|
|
171
|
-
|
|
183
|
+
}
|
|
172
184
|
}
|
|
185
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOB_RESULTS_REPEATER).data = filteredJobs
|
|
186
|
+
return filteredJobs.length>0;
|
|
187
|
+
|
|
173
188
|
}
|
|
174
189
|
|
|
175
190
|
async function getValueFromValueId(valueId) {
|
|
176
191
|
const result=await getAllRecords(COLLECTIONS.CUSTOM_VALUES);
|
|
192
|
+
console.log("result: ",result);
|
|
193
|
+
console.log("valueId: ",valueId);
|
|
177
194
|
return result.find(value=>value._id===valueId);
|
|
178
195
|
|
|
179
196
|
}
|
package/pages/positionPage.js
CHANGED
|
@@ -51,7 +51,7 @@ async function getCategoryValueId(customValues) {
|
|
|
51
51
|
}
|
|
52
52
|
if(_$w('#relatedJobsRepNoDepartment')) // when there is no department, we filter based on category
|
|
53
53
|
{
|
|
54
|
-
const relatedJobs=await getRelatedJobs(categoryValueId,item._id,5);
|
|
54
|
+
const relatedJobs = await getRelatedJobs({ categoryValueId, itemId: item._id ,limit:5});
|
|
55
55
|
_$w('#relatedJobsRepNoDepartment').onItemReady(($item, itemData) => {
|
|
56
56
|
$item('#relatedJobTitle').text = itemData.title;
|
|
57
57
|
$item('#relatedJobLocation').text = itemData.location.fullLocation;
|
|
@@ -99,7 +99,9 @@ async function getCategoryValueId(customValues) {
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
async function getRelatedJobs(categoryValueId,itemId,limit=1000) {
|
|
102
|
+
async function getRelatedJobs({ categoryValueId, itemId, limit = 1000 }) {
|
|
103
|
+
|
|
104
|
+
|
|
103
105
|
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).limit(limit).find();
|
|
104
106
|
return relatedJobs.items;
|
|
105
107
|
}
|
|
@@ -14,14 +14,11 @@ async function supportTeasmPageOnReady(_$w) {
|
|
|
14
14
|
async function handleRecentJobsSection(_$w) {
|
|
15
15
|
|
|
16
16
|
const currentItem= _$w(supportTeamsPageIds.TEAM_SUPPORT_DYNAMIC_DATASET).getCurrentItem();
|
|
17
|
-
console.log("currentItem
|
|
18
|
-
if(supportTeamsPageIds.excludeValues.has(currentItem.title_fld)) {
|
|
19
|
-
console.log("Value is excluded , collapsing recently Jobs Section ");
|
|
20
|
-
await collapseSection(_$w);
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
17
|
+
console.log("currentItem: ",currentItem);
|
|
23
18
|
const valueId=supportTeamsPageIds.valueToValueIdMap[currentItem.title_fld]
|
|
19
|
+
console.log("valueId: ",valueId);
|
|
24
20
|
const Value=await getValueFromValueId(valueId);
|
|
21
|
+
console.log("Value: ",Value);
|
|
25
22
|
const latestsJobs=await getLatestJobsByValue(Value);
|
|
26
23
|
|
|
27
24
|
if(latestsJobs.length === 0) {
|
|
@@ -32,12 +29,17 @@ async function handleRecentJobsSection(_$w) {
|
|
|
32
29
|
_$w(supportTeamsPageIds.RECENTLEY_ADDED_JOBS).onItemReady(($item, itemData) => {
|
|
33
30
|
$item(supportTeamsPageIds.JOB_TITLE).text = itemData.title;
|
|
34
31
|
$item(supportTeamsPageIds.JOB_LOCATION).text = itemData.location.fullLocation;
|
|
35
|
-
|
|
36
|
-
location.to(itemData["link-jobs-title"]);
|
|
37
|
-
})
|
|
32
|
+
|
|
38
33
|
});
|
|
39
34
|
|
|
40
35
|
_$w(supportTeamsPageIds.RECENTLEY_ADDED_JOBS).data = latestsJobs;
|
|
36
|
+
_$w(supportTeamsPageIds.RECENTLEY_ADDED_JOBS_ITEM).onClick((event) => {
|
|
37
|
+
const data = _$w(supportTeamsPageIds.RECENTLEY_ADDED_JOBS).data;
|
|
38
|
+
const clickedItemData = data.find(
|
|
39
|
+
(item) => item._id === event.context.itemId,
|
|
40
|
+
);
|
|
41
|
+
location.to(clickedItemData["link-jobs-title"]);
|
|
42
|
+
});
|
|
41
43
|
|
|
42
44
|
_$w(supportTeamsPageIds.SEE_ALL_JOBS_TEXT).onClick( () => {
|
|
43
45
|
location.to(`/search?category=${Value.title}`);
|
|
@@ -160,7 +160,7 @@ describe('primarySearch function tests', () => {
|
|
|
160
160
|
|
|
161
161
|
|
|
162
162
|
expect(mockprimarySearchMultiBox.changeState).toHaveBeenCalledWith('noResults');
|
|
163
|
-
expect(mockprimarySearcJobResult.data).
|
|
163
|
+
expect(mockprimarySearcJobResult.data.length).toBe(0);
|
|
164
164
|
});
|
|
165
165
|
|
|
166
166
|
it('should fill category repeater when clicking on empty primary search input', async () => {
|