sr-npm 1.2.22 → 1.2.24
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/collectionConsts.js +11 -1
- package/backend/data.js +69 -59
- package/backend/fetchPositionsFromSRAPI.js +34 -1
- package/backend/queries.js +1 -1
- package/package.json +1 -1
- package/pages/careersMultiBoxesPage.js +20 -22
- package/pages/homePage.js +19 -13
- package/pages/pagesUtils.js +59 -50
- package/pages/positionPage.js +7 -12
- package/pages/supportTeamsPage.js +6 -6
|
@@ -11,6 +11,7 @@ const COLLECTIONS = {
|
|
|
11
11
|
SUPPORT_TEAMS: 'SupportTeams',
|
|
12
12
|
|
|
13
13
|
}
|
|
14
|
+
|
|
14
15
|
const JOBS_COLLECTION_FIELDS = {
|
|
15
16
|
LOCATION: 'location',
|
|
16
17
|
TITLE: 'title',
|
|
@@ -34,25 +35,31 @@ const JOBS_COLLECTION_FIELDS = {
|
|
|
34
35
|
RELEASED_DATE: 'releasedDate',
|
|
35
36
|
REF_ID: 'refId',
|
|
36
37
|
}
|
|
38
|
+
|
|
37
39
|
const AMOUNT_OF_JOBS_PER_DEPARTMENT_COLLECTION_FIELDS = {
|
|
38
40
|
TITLE: 'title',
|
|
39
41
|
COUNT: 'count',
|
|
40
42
|
IMAGE: 'image',
|
|
41
43
|
}
|
|
44
|
+
|
|
42
45
|
const CUSTOM_VALUES_COLLECTION_FIELDS = {
|
|
46
|
+
VALUE_ID: 'valueId',
|
|
43
47
|
TITLE: 'title',
|
|
44
48
|
CUSTOM_FIELD: 'customField',
|
|
45
49
|
MULTI_REF_JOBS_CUSTOM_VALUES: 'multiRefJobsCustomValues',
|
|
46
50
|
count: 'count',
|
|
47
51
|
JOB_IDS: 'jobIds',
|
|
48
52
|
}
|
|
53
|
+
|
|
49
54
|
const CUSTOM_FIELDS_COLLECTION_FIELDS = {
|
|
50
55
|
TITLE: 'title',
|
|
51
56
|
}
|
|
57
|
+
|
|
52
58
|
const BRANDS_COLLECTION_FIELDS = {
|
|
53
59
|
TITLE: 'title',
|
|
54
60
|
COUNT: 'count',
|
|
55
61
|
}
|
|
62
|
+
|
|
56
63
|
const CITIES_COLLECTION_FIELDS = {
|
|
57
64
|
TITLE: 'title',
|
|
58
65
|
CITY: 'city',
|
|
@@ -61,6 +68,7 @@ const CITIES_COLLECTION_FIELDS = {
|
|
|
61
68
|
COUNTRY: 'country',
|
|
62
69
|
JOB_IDS: 'jobIds',
|
|
63
70
|
}
|
|
71
|
+
|
|
64
72
|
const COLLECTIONS_FIELDS = {
|
|
65
73
|
AMOUNT_OF_JOBS_PER_DEPARTMENT: [
|
|
66
74
|
{key:'title', type: 'TEXT'},
|
|
@@ -85,7 +93,7 @@ const COLLECTIONS_FIELDS = {
|
|
|
85
93
|
{key:'language', type: 'TEXT'},
|
|
86
94
|
{key:'remote', type: 'BOOLEAN'},
|
|
87
95
|
{key:'jobDescription', type: 'OBJECT'},
|
|
88
|
-
{key:'multiRefJobsCustomValues', type: 'MULTI_REFERENCE', typeMetadata: { multiReference: { referencedCollectionId: COLLECTIONS.CUSTOM_VALUES,referencingFieldKey:JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES,referencingDisplayName:JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES } } },
|
|
96
|
+
{key:'multiRefJobsCustomValues', type: 'MULTI_REFERENCE', typeMetadata: { multiReference: { referencedCollectionId: COLLECTIONS.CUSTOM_VALUES, referencingFieldKey:JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES,referencingDisplayName:JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES } } },
|
|
89
97
|
{key:'cityText', type: 'TEXT'},
|
|
90
98
|
{key:'applyLink', type: 'URL'},
|
|
91
99
|
{key:'referFriendLink', type: 'URL'},
|
|
@@ -114,6 +122,7 @@ const COLLECTIONS_FIELDS = {
|
|
|
114
122
|
{ key: 'count', type: 'NUMBER' },
|
|
115
123
|
],
|
|
116
124
|
CUSTOM_VALUES: [
|
|
125
|
+
{key:'valueId', type: 'TEXT'},
|
|
117
126
|
{key:'title', type: 'TEXT'},
|
|
118
127
|
{key:'customField', type: 'REFERENCE', typeMetadata: { reference: { referencedCollectionId: COLLECTIONS.CUSTOM_FIELDS } } },
|
|
119
128
|
{key:'count', type: 'NUMBER'},
|
|
@@ -135,6 +144,7 @@ const COLLECTIONS_FIELDS = {
|
|
|
135
144
|
COMPANY_ID: 'companyId',
|
|
136
145
|
SMART_TOKEN: 'x-smarttoken',
|
|
137
146
|
DESIRED_BRAND: 'desiredBrand',
|
|
147
|
+
RICH_CONTENT_CONVERTER_TOKEN: 'richContentConverterToken',
|
|
138
148
|
}
|
|
139
149
|
|
|
140
150
|
|
package/backend/data.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const { items: wixData } = require('@wix/data');
|
|
2
|
-
const { fetchPositionsFromSRAPI, fetchJobDescription } = require('./fetchPositionsFromSRAPI');
|
|
2
|
+
const { fetchPositionsFromSRAPI, fetchJobDescription, htmlRichContentConverter } = require('./fetchPositionsFromSRAPI');
|
|
3
3
|
const { createCollectionIfMissing } = require('@hisense-staging/velo-npm/backend');
|
|
4
4
|
|
|
5
5
|
const { getAllPositions } = require('./queries');
|
|
@@ -40,7 +40,6 @@ function validatePosition(position) {
|
|
|
40
40
|
if (!position.location || !position.location.city || typeof position.location.remote !== 'boolean') {
|
|
41
41
|
throw new Error('Position location is required and must have a city and remote');
|
|
42
42
|
}
|
|
43
|
-
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
async function filterBasedOnBrand(positions) {
|
|
@@ -93,78 +92,83 @@ function getEmploymentType(position,customFieldsValues) {
|
|
|
93
92
|
customValuesToJobs[position.typeOfEmployment.id] ? customValuesToJobs[position.typeOfEmployment.id].add(position.id) : customValuesToJobs[position.typeOfEmployment.id]=new Set([position.id])
|
|
94
93
|
}
|
|
95
94
|
|
|
96
|
-
function getCustomFieldsAndValuesFromPosition(position,customFieldsLabels,customFieldsValues) {
|
|
95
|
+
function getCustomFieldsAndValuesFromPosition(position, customFieldsLabels, customFieldsValues) {
|
|
97
96
|
const customFieldsArray = Array.isArray(position?.customField) ? position.customField : [];
|
|
97
|
+
|
|
98
98
|
for (const field of customFieldsArray) {
|
|
99
99
|
if(EXCLUDED_CUSTOM_FIELDS.has(field.fieldLabel)) continue; //country and department are not custom fields, they are already in the job object
|
|
100
|
-
|
|
100
|
+
|
|
101
|
+
const fieldId = normalizeString(field.fieldId)
|
|
101
102
|
const fieldLabel = field.fieldLabel;
|
|
102
|
-
const valueId=normalizeString(field.valueId)
|
|
103
|
+
const valueId = normalizeString(field.valueId)
|
|
103
104
|
const valueLabel = field.valueLabel
|
|
104
105
|
customFieldsLabels[fieldId] = fieldLabel
|
|
106
|
+
|
|
105
107
|
// Build nested dictionary: fieldId -> { valueId: valueLabel }
|
|
106
108
|
if (!customFieldsValues[fieldId]) {
|
|
107
109
|
customFieldsValues[fieldId] = {};
|
|
108
110
|
}
|
|
109
111
|
|
|
110
112
|
customFieldsValues[fieldId][valueId] = valueLabel;
|
|
111
|
-
customValuesToJobs[valueId] ? customValuesToJobs[valueId].add(position.id) : customValuesToJobs[valueId]=new Set([position.id])
|
|
113
|
+
customValuesToJobs[valueId] ? customValuesToJobs[valueId].add(position.id) : customValuesToJobs[valueId] = new Set([position.id])
|
|
112
114
|
}
|
|
113
115
|
}
|
|
116
|
+
|
|
114
117
|
async function saveJobsDataToCMS() {
|
|
115
118
|
const positions = await fetchPositionsFromSRAPI();
|
|
116
119
|
const sourcePositions = await filterBasedOnBrand(positions);
|
|
117
120
|
const customFieldsLabels = {}
|
|
118
121
|
const customFieldsValues = {}
|
|
119
122
|
|
|
120
|
-
const {
|
|
123
|
+
const { templateType } = await getApiKeys();
|
|
121
124
|
if(siteconfig===undefined) {
|
|
122
125
|
await getSiteConfig();
|
|
123
126
|
}
|
|
124
127
|
// bulk insert to jobs collection without descriptions first
|
|
125
128
|
const jobsData = sourcePositions.map(position => {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
129
|
+
const basicJob = {
|
|
130
|
+
_id: position.id,
|
|
131
|
+
title: position.name || '',
|
|
132
|
+
slug: generateSlug(position.name || ''),
|
|
133
|
+
department: position.department?.label || 'Other',
|
|
134
|
+
cityText: normalizeString(position.location?.city),
|
|
135
|
+
location: position.location && Object.keys(position.location).length > 0
|
|
136
|
+
? position.location
|
|
137
|
+
: {
|
|
138
|
+
countryCode: "",
|
|
139
|
+
country: "",
|
|
140
|
+
city: "",
|
|
141
|
+
postalCode: "",
|
|
142
|
+
address: "",
|
|
143
|
+
manual: false,
|
|
144
|
+
remote: false,
|
|
145
|
+
regionCode: ""
|
|
146
|
+
},
|
|
147
|
+
country: position.location?.country || '',
|
|
148
|
+
remote: position.location?.remote || false,
|
|
149
|
+
language: position.language?.label || '',
|
|
150
|
+
brand: siteconfig.disableMultiBrand==="false" ? getBrand(position.customField) : '',
|
|
151
|
+
jobDescription: null, // Will be filled later
|
|
152
|
+
employmentType: position.typeOfEmployment.label,
|
|
153
|
+
releasedDate: position.releasedDate,
|
|
154
|
+
refId: position.refNumber
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
getCustomFieldsAndValuesFromPosition(position, customFieldsLabels, customFieldsValues);
|
|
158
|
+
getEmploymentType(position, customFieldsValues);
|
|
159
|
+
getLocation(position,basicJob);
|
|
160
|
+
|
|
161
|
+
if(templateType === TEMPLATE_TYPE.INTERNAL){
|
|
162
|
+
getVisibility(position,customFieldsValues);
|
|
163
|
+
}
|
|
164
|
+
return basicJob;
|
|
162
165
|
});
|
|
163
166
|
|
|
164
167
|
if (siteconfig.customFields==="true") {
|
|
165
|
-
|
|
166
|
-
|
|
168
|
+
await populateCustomFieldsCollection(customFieldsLabels,templateType);
|
|
169
|
+
await populateCustomValuesCollection(customFieldsValues);
|
|
167
170
|
}
|
|
171
|
+
|
|
168
172
|
// Sort jobs by title (ascending, case-insensitive, numeric-aware)
|
|
169
173
|
jobsData.sort((a, b) => {
|
|
170
174
|
const titleA = a.title || '';
|
|
@@ -202,8 +206,8 @@ async function saveJobsDataToCMS() {
|
|
|
202
206
|
console.log(`✓ All chunks processed. Total jobs saved: ${totalSaved}/${jobsData.length}`);
|
|
203
207
|
}
|
|
204
208
|
|
|
205
|
-
async function insertJobsReference(valueId) {
|
|
206
|
-
await wixData.insertReference(COLLECTIONS.CUSTOM_VALUES, CUSTOM_VALUES_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES,
|
|
209
|
+
async function insertJobsReference(id, valueId) {
|
|
210
|
+
await wixData.insertReference(COLLECTIONS.CUSTOM_VALUES, CUSTOM_VALUES_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES, id, Array.from(customValuesToJobs[valueId]));
|
|
207
211
|
}
|
|
208
212
|
|
|
209
213
|
async function populateCustomFieldsCollection(customFields,templateType) {
|
|
@@ -222,33 +226,38 @@ async function populateCustomFieldsCollection(customFields,templateType) {
|
|
|
222
226
|
}
|
|
223
227
|
async function populateCustomValuesCollection(customFieldsValues) {
|
|
224
228
|
let valuesToinsert=[]
|
|
229
|
+
|
|
225
230
|
for (const fieldId of Object.keys(customFieldsValues)) {
|
|
226
231
|
const valuesMap = customFieldsValues[fieldId] || {};
|
|
232
|
+
|
|
227
233
|
for (const valueId of Object.keys(valuesMap)) {
|
|
228
234
|
valuesToinsert.push({
|
|
229
|
-
|
|
235
|
+
valueId,
|
|
230
236
|
title: valuesMap[valueId],
|
|
231
237
|
customField: fieldId,
|
|
232
|
-
count:customValuesToJobs[valueId].size,
|
|
233
|
-
jobIds:Array.from(customValuesToJobs[valueId]),
|
|
238
|
+
count: customValuesToJobs[valueId].size,
|
|
239
|
+
jobIds: Array.from(customValuesToJobs[valueId]),
|
|
234
240
|
})
|
|
235
241
|
}
|
|
236
|
-
|
|
237
242
|
}
|
|
238
243
|
await wixData.bulkSave(COLLECTIONS.CUSTOM_VALUES, valuesToinsert);
|
|
239
244
|
}
|
|
245
|
+
|
|
240
246
|
async function saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS() {
|
|
241
247
|
console.log('🚀 Starting job descriptions update process for ALL jobs');
|
|
242
248
|
|
|
243
249
|
try {
|
|
244
250
|
let jobsWithNoDescriptions = await getJobsWithNoDescriptions();
|
|
251
|
+
|
|
245
252
|
if (siteconfig.customFields==="true") {
|
|
246
|
-
let customValues=await getAllCustomValues();
|
|
253
|
+
let customValues = await getAllCustomValues();
|
|
254
|
+
|
|
247
255
|
console.log("inserting jobs references to custom values collection");
|
|
248
256
|
console.log("customValues: ",customValues)
|
|
249
257
|
console.log("customValues.items: ",customValues.items)
|
|
258
|
+
|
|
250
259
|
for (const value of customValues.items) {
|
|
251
|
-
await insertJobsReference(value._id);
|
|
260
|
+
await insertJobsReference(value._id, value.valueId);
|
|
252
261
|
}
|
|
253
262
|
console.log("inserted jobs references to custom values collection successfully");
|
|
254
263
|
}
|
|
@@ -269,7 +278,7 @@ async function saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS() {
|
|
|
269
278
|
|
|
270
279
|
const API_CHUNK_SIZE = 80;
|
|
271
280
|
const pageChunks = Math.ceil(jobsWithNoDescriptions.items.length / API_CHUNK_SIZE);
|
|
272
|
-
|
|
281
|
+
const richContentConverterToken = await getTokenFromCMS(TOKEN_NAME.RICH_CONTENT_CONVERTER_TOKEN);
|
|
273
282
|
await chunkedBulkOperation({
|
|
274
283
|
items: jobsWithNoDescriptions.items,
|
|
275
284
|
chunkSize: API_CHUNK_SIZE,
|
|
@@ -278,14 +287,13 @@ async function saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS() {
|
|
|
278
287
|
const chunkPromises = chunk.map(async job => {
|
|
279
288
|
try {
|
|
280
289
|
const jobDetails = await fetchJobDescription(job._id);
|
|
290
|
+
const richContentDescription=await htmlRichContentConverter(jobDetails.jobAd.sections,richContentConverterToken);
|
|
281
291
|
const jobLocation = fetchJobLocation(jobDetails);
|
|
282
292
|
const {applyLink , referFriendLink} = fetchApplyAndReferFriendLink(jobDetails);
|
|
283
|
-
|
|
284
|
-
|
|
285
293
|
const updatedJob = {
|
|
286
294
|
...job,
|
|
287
295
|
locationAddress: jobLocation,
|
|
288
|
-
jobDescription:
|
|
296
|
+
jobDescription: richContentDescription,
|
|
289
297
|
applyLink: applyLink,
|
|
290
298
|
referFriendLink: referFriendLink,
|
|
291
299
|
};
|
|
@@ -361,10 +369,12 @@ async function aggregateJobsByFieldToCMS({ field, collection }) {
|
|
|
361
369
|
return { success: false, error: err.message };
|
|
362
370
|
}
|
|
363
371
|
}
|
|
372
|
+
|
|
364
373
|
async function getAllCustomValues() {
|
|
365
374
|
let customValuesQuery = await wixData.query(COLLECTIONS.CUSTOM_VALUES).limit(1000).find();
|
|
366
375
|
return customValuesQuery;
|
|
367
376
|
}
|
|
377
|
+
|
|
368
378
|
async function getJobsWithNoDescriptions() {
|
|
369
379
|
let jobswithoutdescriptionsQuery = await wixData
|
|
370
380
|
.query(COLLECTIONS.JOBS)
|
|
@@ -523,7 +533,7 @@ async function clearCollections() {
|
|
|
523
533
|
}
|
|
524
534
|
|
|
525
535
|
async function markTemplateAsExternal() {
|
|
526
|
-
await createCollectionIfMissing(COLLECTIONS.TEMPLATE_TYPE, COLLECTIONS_FIELDS.TEMPLATE_TYPE,null,'singleItem');
|
|
536
|
+
await createCollectionIfMissing(COLLECTIONS.TEMPLATE_TYPE, COLLECTIONS_FIELDS.TEMPLATE_TYPE, null, 'singleItem');
|
|
527
537
|
const tempalte = await wixData.save(COLLECTIONS.TEMPLATE_TYPE, {
|
|
528
538
|
templateType: TEMPLATE_TYPE.EXTERNAL
|
|
529
539
|
});
|
|
@@ -531,7 +541,7 @@ async function markTemplateAsExternal() {
|
|
|
531
541
|
}
|
|
532
542
|
|
|
533
543
|
async function markTemplateAsInternal() {
|
|
534
|
-
await createCollectionIfMissing(COLLECTIONS.TEMPLATE_TYPE, COLLECTIONS_FIELDS.TEMPLATE_TYPE,null,'singleItem');
|
|
544
|
+
await createCollectionIfMissing(COLLECTIONS.TEMPLATE_TYPE, COLLECTIONS_FIELDS.TEMPLATE_TYPE, null, 'singleItem');
|
|
535
545
|
const tempalte = await wixData.save(COLLECTIONS.TEMPLATE_TYPE, {
|
|
536
546
|
templateType: TEMPLATE_TYPE.INTERNAL
|
|
537
547
|
});
|
|
@@ -114,11 +114,44 @@ async function fetchJobDescription(jobId,testObject=undefined) {
|
|
|
114
114
|
return await makeSmartRecruitersRequest(`/v1/companies/${companyId}/postings/${jobId}`,templateType);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
async function htmlRichContentConverter(sections,richContentConverterToken) {
|
|
118
|
+
const richContentObject = {}
|
|
119
|
+
for (const [sectionTitle, sectionData] of Object.entries(sections)) {
|
|
120
|
+
if (sectionData.text) {
|
|
121
|
+
const raw = JSON.stringify({
|
|
122
|
+
content: sectionData.text,
|
|
123
|
+
});
|
|
124
|
+
const requestOptions = {
|
|
125
|
+
method: 'post',
|
|
126
|
+
headers: {
|
|
127
|
+
'Content-Type': 'application/json',
|
|
128
|
+
Cookie: 'XSRF-TOKEN=1753949844|p--a7HsuVjR4',
|
|
129
|
+
Authorization: 'Bearer '+richContentConverterToken,
|
|
130
|
+
},
|
|
131
|
+
body: raw,
|
|
132
|
+
};
|
|
133
|
+
const response = await fetch(
|
|
134
|
+
'https://www.wixapis.com/data-sync/v1/abmp-content-converter',
|
|
135
|
+
requestOptions
|
|
136
|
+
);
|
|
137
|
+
if (response.ok) {
|
|
138
|
+
const data = await response.json();
|
|
139
|
+
richContentObject[sectionTitle] = data.richContent.richContent;
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
throw new Error("Error converting html to rich content response: "+response);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return richContentObject;
|
|
147
|
+
}
|
|
148
|
+
|
|
117
149
|
|
|
118
150
|
|
|
119
151
|
|
|
120
152
|
module.exports = {
|
|
121
153
|
fetchPositionsFromSRAPI,
|
|
122
154
|
fetchJobDescription,
|
|
123
|
-
makeSmartRecruitersRequest
|
|
155
|
+
makeSmartRecruitersRequest,
|
|
156
|
+
htmlRichContentConverter
|
|
124
157
|
};
|
package/backend/queries.js
CHANGED
|
@@ -21,7 +21,7 @@ async function getPositionsByField(field, value) {
|
|
|
21
21
|
async function getPositionWithMultiRefField(jobId)
|
|
22
22
|
{
|
|
23
23
|
return wixData
|
|
24
|
-
.queryReferenced(COLLECTIONS.JOBS,jobId,JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES)
|
|
24
|
+
.queryReferenced(COLLECTIONS.JOBS, jobId,JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES)
|
|
25
25
|
.then(result => result.items);
|
|
26
26
|
}
|
|
27
27
|
|
package/package.json
CHANGED
|
@@ -264,14 +264,14 @@ async function loadData() {
|
|
|
264
264
|
currentJobs=alljobs;
|
|
265
265
|
}
|
|
266
266
|
if(Object.keys(valueToJobs).length === 0){
|
|
267
|
-
allvaluesobjects=await getAllRecords(COLLECTIONS.CUSTOM_VALUES);
|
|
267
|
+
allvaluesobjects = await getAllRecords(COLLECTIONS.CUSTOM_VALUES);
|
|
268
268
|
for (const value of allvaluesobjects) {
|
|
269
|
-
valueToJobs[value.
|
|
269
|
+
valueToJobs[value.valueId]= value.jobIds;
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
272
|
if(allfields.length===0) {
|
|
273
|
-
allfields=await getAllRecords(COLLECTIONS.CUSTOM_FIELDS);
|
|
274
|
-
allfields.push({_id:"Location",title:"Location"});
|
|
273
|
+
allfields = await getAllRecords(COLLECTIONS.CUSTOM_FIELDS);
|
|
274
|
+
allfields.push({ _id:"Location", title:"Location" });
|
|
275
275
|
}
|
|
276
276
|
} catch (error) {
|
|
277
277
|
console.error('Failed to load data:', error);
|
|
@@ -282,7 +282,7 @@ async function loadJobsRepeater(_$w) {
|
|
|
282
282
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER).onItemReady(($item, itemData) => {
|
|
283
283
|
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER_ITEM_TITLE).text = itemData.title;
|
|
284
284
|
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER_ITEM_TITLE).onClick(() => {
|
|
285
|
-
location.to(itemData["link-jobs-title"]);
|
|
285
|
+
location.to(itemData["link-jobs-title"] || itemData["link-jobs-refId-slug"]);
|
|
286
286
|
});
|
|
287
287
|
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER_ITEM_LOCATION).text=itemData.location.fullLocation
|
|
288
288
|
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER_ITEM_EMPLOYMENT_TYPE).text=itemData.employmentType
|
|
@@ -315,23 +315,23 @@ async function loadJobsRepeater(_$w) {
|
|
|
315
315
|
// 2) Load all values once and group them by referenced field
|
|
316
316
|
let valuesByFieldId = groupValuesByField(allvaluesobjects, CUSTOM_VALUES_COLLECTION_FIELDS.CUSTOM_FIELD);
|
|
317
317
|
valuesByFieldId.set("Location",cities)
|
|
318
|
-
|
|
319
|
-
|
|
318
|
+
|
|
319
|
+
// Build CheckboxGroup options for this field
|
|
320
320
|
const counter={}
|
|
321
321
|
for(const city of cities) {
|
|
322
322
|
counter[city.city]=city.count
|
|
323
323
|
}
|
|
324
324
|
for(const [key, value] of valuesByFieldId) {
|
|
325
|
-
const field=getFieldById(key,allfields);
|
|
325
|
+
const field = getFieldById(key,allfields);
|
|
326
326
|
let originalOptions=[];
|
|
327
|
-
if(key==="Location") {
|
|
328
|
-
originalOptions=value.map(city=>({
|
|
327
|
+
if(key === "Location") {
|
|
328
|
+
originalOptions = value.map(city=>({
|
|
329
329
|
label: city.city,
|
|
330
|
-
value: city.
|
|
330
|
+
value: city.valueId
|
|
331
331
|
}));
|
|
332
332
|
}
|
|
333
333
|
else{
|
|
334
|
-
originalOptions=value
|
|
334
|
+
originalOptions = value
|
|
335
335
|
}
|
|
336
336
|
optionsByFieldId.set(key, originalOptions);
|
|
337
337
|
for (const val of allvaluesobjects) {
|
|
@@ -350,7 +350,7 @@ async function loadJobsRepeater(_$w) {
|
|
|
350
350
|
selectedByField.set(field._id, selected);
|
|
351
351
|
if(fieldTitle==="brand" || fieldTitle==="storename") {
|
|
352
352
|
//in this case we need the label not valueid
|
|
353
|
-
const valueLabels=getValueFromValueId(selected,value);
|
|
353
|
+
const valueLabels = getValueFromValueId(selected, value);
|
|
354
354
|
queryParams.add({ [fieldTitle] : valueLabels.map(val=>encodeURIComponent(val)).join(',') });
|
|
355
355
|
}
|
|
356
356
|
else{
|
|
@@ -363,8 +363,8 @@ async function loadJobsRepeater(_$w) {
|
|
|
363
363
|
}
|
|
364
364
|
|
|
365
365
|
await updateJobsAndNumbersAndFilters(_$w);
|
|
366
|
-
|
|
367
366
|
});
|
|
367
|
+
|
|
368
368
|
const runFilter = debounce(() => {
|
|
369
369
|
const query = (_$w(`#${FiltersIds[field.title]}input`).value || '').toLowerCase().trim();
|
|
370
370
|
updateOptionsUI(_$w, field.title, field._id, query);
|
|
@@ -379,11 +379,11 @@ async function loadJobsRepeater(_$w) {
|
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
381
|
|
|
382
|
-
function getValueFromValueId(valueIds,value) {
|
|
383
|
-
let valueLabels=[];
|
|
382
|
+
function getValueFromValueId(valueIds, value) {
|
|
383
|
+
let valueLabels = [];
|
|
384
384
|
let currentVal
|
|
385
|
-
for(const valueId of valueIds) {
|
|
386
|
-
currentVal=value.find(val=>val.value===valueId);
|
|
385
|
+
for (const valueId of valueIds) {
|
|
386
|
+
currentVal = value.find(val => val.value === valueId);
|
|
387
387
|
if(currentVal) {
|
|
388
388
|
valueLabels.push(currentVal.label);
|
|
389
389
|
}
|
|
@@ -556,8 +556,7 @@ async function refreshFacetCounts(_$w,clearAll=false) {
|
|
|
556
556
|
}
|
|
557
557
|
}
|
|
558
558
|
|
|
559
|
-
|
|
560
|
-
function updateSelectedValuesRepeater(_$w) {
|
|
559
|
+
function updateSelectedValuesRepeater(_$w) {
|
|
561
560
|
const selectedItems = [];
|
|
562
561
|
for (const [fieldId, valueIds] of selectedByField.entries()) {
|
|
563
562
|
const opts = optionsByFieldId.get(fieldId) || [];
|
|
@@ -568,7 +567,7 @@ async function refreshFacetCounts(_$w,clearAll=false) {
|
|
|
568
567
|
}
|
|
569
568
|
}
|
|
570
569
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SELECTED_VALUES_REPEATER).data = selectedItems;
|
|
571
|
-
|
|
570
|
+
}
|
|
572
571
|
|
|
573
572
|
|
|
574
573
|
|
|
@@ -595,7 +594,6 @@ async function secondarySearch(_$w,query) {
|
|
|
595
594
|
}
|
|
596
595
|
secondarySearchIsFilled=true
|
|
597
596
|
}
|
|
598
|
-
|
|
599
597
|
handlePaginationButtons(_$w);
|
|
600
598
|
updateTotalJobsCountText(_$w);
|
|
601
599
|
await refreshFacetCounts(_$w);
|
package/pages/homePage.js
CHANGED
|
@@ -8,31 +8,37 @@ const { location } = require('@wix/site-location');
|
|
|
8
8
|
const {wixData} = require('wix-data');
|
|
9
9
|
const { COLLECTIONS } = require('../backend/collectionConsts');
|
|
10
10
|
const { bindPrimarySearch,getAllRecords,loadPrimarySearchRepeater } = require('./pagesUtils');
|
|
11
|
+
|
|
12
|
+
|
|
11
13
|
let thisObjectVar;
|
|
12
14
|
let searchByCityFlag=false;
|
|
13
15
|
let loadedCategories=false;
|
|
14
|
-
async function homePageOnReady(_$w,thisObject=null) {
|
|
15
16
|
|
|
17
|
+
async function homePageOnReady(_$w,thisObject=null) {
|
|
16
18
|
const queryResult = await wixData.query(COLLECTIONS.SITE_CONFIGS).find();
|
|
17
19
|
const siteconfig = queryResult.items[0];
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
20
|
+
|
|
21
|
+
if(siteconfig.twg) {
|
|
22
|
+
const allJobs = await getAllRecords(COLLECTIONS.JOBS);
|
|
23
|
+
const allvaluesobjects = await getAllRecords(COLLECTIONS.CUSTOM_VALUES);
|
|
24
|
+
|
|
25
|
+
bindPrimarySearch(_$w, allvaluesobjects, allJobs);
|
|
22
26
|
loadPrimarySearchRepeater(_$w)
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
console.log("siteconfig.twg: ",siteconfig.twg);
|
|
28
|
+
|
|
29
|
+
if(siteconfig.twg === "external") {
|
|
30
|
+
bindTeamRepeater(_$w)
|
|
31
|
+
bindViewAllButton(_$w)
|
|
32
|
+
}
|
|
25
33
|
}
|
|
26
34
|
else{
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
await init(_$w);
|
|
35
|
+
thisObjectVar=thisObject;
|
|
36
|
+
bind(_$w);
|
|
37
|
+
init(_$w);
|
|
31
38
|
}
|
|
32
|
-
|
|
33
39
|
}
|
|
34
40
|
|
|
35
|
-
|
|
41
|
+
function bind(_$w) {
|
|
36
42
|
|
|
37
43
|
bindTeamRepeater(_$w);
|
|
38
44
|
|
package/pages/pagesUtils.js
CHANGED
|
@@ -93,9 +93,17 @@ function loadPrimarySearchRepeater(_$w) {
|
|
|
93
93
|
(item) => item._id === event.context.itemId,
|
|
94
94
|
|
|
95
95
|
);
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
// 'link-jobs-title' or 'link-copy-of-jobs-title'
|
|
97
|
+
const linkKey = Object.keys(clickedItemData).find(
|
|
98
|
+
key => key.startsWith('link') && key.includes('jobs') && key.includes('title')
|
|
99
|
+
);
|
|
100
|
+
if (linkKey && clickedItemData[linkKey] ) {
|
|
101
|
+
if(clickedItemData[linkKey].includes("copy-of-jobs")) {
|
|
102
|
+
clickedItemData[linkKey]=clickedItemData[linkKey].replace("copy-of-jobs","jobs")
|
|
103
|
+
}
|
|
104
|
+
location.to(clickedItemData[linkKey]);
|
|
105
|
+
}
|
|
106
|
+
|
|
99
107
|
});
|
|
100
108
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.CATEGORY_RESULTS_REPEATER).onItemReady(async ($item, itemData) => {
|
|
101
109
|
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_CATEGORY_BUTTON).label = itemData.title || '';
|
|
@@ -113,7 +121,7 @@ function loadPrimarySearchRepeater(_$w) {
|
|
|
113
121
|
|
|
114
122
|
}
|
|
115
123
|
|
|
116
|
-
function bindPrimarySearch(_$w,allvaluesobjects,alljobs) {
|
|
124
|
+
function bindPrimarySearch(_$w, allvaluesobjects, alljobs) {
|
|
117
125
|
|
|
118
126
|
const primarySearchDebounced = debounce(async () => {
|
|
119
127
|
const query = (_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value || '').toLowerCase().trim();
|
|
@@ -124,61 +132,62 @@ function loadPrimarySearchRepeater(_$w) {
|
|
|
124
132
|
await primarySearchDebounced();
|
|
125
133
|
});
|
|
126
134
|
|
|
127
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).onClick(async () => {
|
|
128
|
-
|
|
129
|
-
if(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value.trim()!=='') {
|
|
130
|
-
await primarySearch(_$w, _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value.trim(), alljobs);
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
await loadCategoriesListPrimarySearch(_$w,allvaluesobjects);
|
|
134
|
-
}
|
|
135
|
-
});
|
|
135
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).onClick(async () => {
|
|
136
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).expand();
|
|
136
137
|
|
|
137
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.
|
|
138
|
-
|
|
139
|
-
}
|
|
138
|
+
if(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value.trim()!=='') {
|
|
139
|
+
await primarySearch(_$w, _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value.trim(), alljobs);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
await loadCategoriesListPrimarySearch(_$w, allvaluesobjects);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).onMouseOut(async () => {
|
|
147
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).collapse();
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).onKeyPress(async (event) => {
|
|
151
|
+
if( event.key==='Enter') {
|
|
152
|
+
console.log("primary search input key pressed");
|
|
153
|
+
console.log("_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value: ",_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value);
|
|
154
|
+
|
|
155
|
+
if(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value.trim()==='') {
|
|
156
|
+
// _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).collapse();
|
|
157
|
+
const baseUrl = await location.baseUrl();
|
|
158
|
+
location.to(`${baseUrl}/search`);
|
|
159
|
+
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
let encodedKeyWord=encodeURIComponent(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value);
|
|
163
|
+
const baseUrl = await location.baseUrl();
|
|
164
|
+
location.to(`${baseUrl}/search?keyword=${encodedKeyWord}`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
});
|
|
140
168
|
|
|
141
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.
|
|
142
|
-
|
|
143
|
-
console.log("primary search input key pressed");
|
|
169
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_BUTTON).onClick(async () => {
|
|
170
|
+
console.log("primary search button clicked");
|
|
144
171
|
console.log("_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value: ",_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value);
|
|
172
|
+
|
|
145
173
|
if(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value.trim()==='') {
|
|
146
|
-
// _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).collapse();
|
|
147
174
|
const baseUrl = await location.baseUrl();
|
|
148
175
|
location.to(`${baseUrl}/search`);
|
|
149
|
-
|
|
150
|
-
}
|
|
176
|
+
}
|
|
151
177
|
else {
|
|
152
178
|
let encodedKeyWord=encodeURIComponent(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value);
|
|
153
179
|
const baseUrl = await location.baseUrl();
|
|
154
|
-
|
|
180
|
+
location.to(`${baseUrl}/search?keyword=${encodedKeyWord}`);
|
|
155
181
|
}
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_BUTTON).onClick(async () => {
|
|
160
|
-
console.log("primary search button clicked");
|
|
161
|
-
console.log("_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value: ",_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value);
|
|
162
|
-
if(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value.trim()==='') {
|
|
163
|
-
const baseUrl = await location.baseUrl();
|
|
164
|
-
location.to(`${baseUrl}/search`);
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
let encodedKeyWord=encodeURIComponent(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value);
|
|
168
|
-
const baseUrl = await location.baseUrl();
|
|
169
|
-
location.to(`${baseUrl}/search?keyword=${encodedKeyWord}`);
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
|
|
182
|
+
});
|
|
174
183
|
}
|
|
175
184
|
|
|
176
|
-
async function loadCategoriesListPrimarySearch(_$w,allvaluesobjects) {
|
|
185
|
+
async function loadCategoriesListPrimarySearch(_$w, allvaluesobjects) {
|
|
177
186
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState("categoryResults");
|
|
178
187
|
let categoryValues=[]
|
|
179
188
|
for(const value of allvaluesobjects) {
|
|
180
189
|
if(value.customField===CATEGORY_CUSTOM_FIELD_ID_IN_CMS) {
|
|
181
|
-
categoryValues.push({title:value.title+` (${value.count})` ,_id:value.
|
|
190
|
+
categoryValues.push({title: value.title+` (${value.count})` , _id: value.valueId});
|
|
182
191
|
}
|
|
183
192
|
}
|
|
184
193
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.CATEGORY_RESULTS_REPEATER).data = categoryValues;
|
|
@@ -208,13 +217,13 @@ async function primarySearch(_$w,query,alljobs) {
|
|
|
208
217
|
|
|
209
218
|
}
|
|
210
219
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
220
|
+
async function getValueFromValueId(valueId) {
|
|
221
|
+
const result = await getAllRecords(COLLECTIONS.CUSTOM_VALUES);
|
|
222
|
+
console.log("result: ",result);
|
|
223
|
+
console.log("valueId: ",valueId);
|
|
224
|
+
|
|
225
|
+
return result.find(value => value.valueId === valueId);
|
|
226
|
+
}
|
|
218
227
|
|
|
219
228
|
async function getLatestJobsByValue(Value) {
|
|
220
229
|
const jobs=Value.multiRefJobsCustomValues;
|
package/pages/positionPage.js
CHANGED
|
@@ -5,7 +5,6 @@ const { items: wixData } = require('@wix/data');
|
|
|
5
5
|
const { location } = require("@wix/site-location");
|
|
6
6
|
const{isElementExistOnPage} = require('psdev-utils');
|
|
7
7
|
const {
|
|
8
|
-
htmlToText,
|
|
9
8
|
appendQueryParams
|
|
10
9
|
} = require('../public/utils');
|
|
11
10
|
|
|
@@ -13,7 +12,7 @@ const {
|
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
async function positionPageOnReady(_$w) {
|
|
16
|
-
|
|
15
|
+
console.log("positionPageOnReady called");
|
|
17
16
|
await bind(_$w);
|
|
18
17
|
|
|
19
18
|
|
|
@@ -32,6 +31,7 @@ async function getCategoryValue(customValues) {
|
|
|
32
31
|
|
|
33
32
|
|
|
34
33
|
async function bind(_$w) {
|
|
34
|
+
console.log("bind called");
|
|
35
35
|
_$w('#datasetJobsItem').onReady(async () => {
|
|
36
36
|
|
|
37
37
|
const item = await _$w('#datasetJobsItem').getCurrentItem();
|
|
@@ -39,17 +39,14 @@ async function getCategoryValue(customValues) {
|
|
|
39
39
|
|
|
40
40
|
handleReferFriendButton(_$w,item);
|
|
41
41
|
handleApplyButton(_$w,item);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
42
|
|
|
46
|
-
_$w('#companyDescriptionText').
|
|
47
|
-
_$w('#responsibilitiesText').
|
|
48
|
-
_$w('#qualificationsText').
|
|
43
|
+
_$w('#companyDescriptionText').content = item.jobDescription.companyDescription;
|
|
44
|
+
_$w('#responsibilitiesText').content = item.jobDescription.jobDescription;
|
|
45
|
+
_$w('#qualificationsText').content = item.jobDescription.qualifications;
|
|
49
46
|
_$w('#relatedJobsTitleText').text = `More ${item.department} Positions`;
|
|
50
47
|
if(isElementExistOnPage(_$w('#additionalInfoText')))
|
|
51
48
|
{
|
|
52
|
-
_$w('#additionalInfoText').
|
|
49
|
+
_$w('#additionalInfoText').content = item.jobDescription.additionalInformation;
|
|
53
50
|
}
|
|
54
51
|
if(isElementExistOnPage(_$w('#relatedJobsRepNoDepartment'))) // when there is no department, we filter based on category
|
|
55
52
|
{
|
|
@@ -61,7 +58,7 @@ async function getCategoryValue(customValues) {
|
|
|
61
58
|
_$w('#jobCategory').text = categoryValue.title;
|
|
62
59
|
}
|
|
63
60
|
|
|
64
|
-
const relatedJobs = await getRelatedJobs({ categoryValueId:categoryValue._id, itemId: item._id ,limit:5});
|
|
61
|
+
const relatedJobs = await getRelatedJobs({ categoryValueId: categoryValue._id, itemId: item._id ,limit:5});
|
|
65
62
|
_$w('#relatedJobsRepNoDepartment').onItemReady(($item, itemData) => {
|
|
66
63
|
$item('#relatedJobTitle').text = itemData.title;
|
|
67
64
|
$item('#relatedJobLocation').text = itemData.location.fullLocation;
|
|
@@ -127,8 +124,6 @@ async function getCategoryValue(customValues) {
|
|
|
127
124
|
}
|
|
128
125
|
|
|
129
126
|
async function getRelatedJobs({ categoryValueId, itemId, limit = 1000 }) {
|
|
130
|
-
|
|
131
|
-
|
|
132
127
|
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();
|
|
133
128
|
return relatedJobs.items;
|
|
134
129
|
}
|
|
@@ -32,16 +32,16 @@ async function handlePeopleSection(_$w) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
async function handleRecentJobsSection(_$w) {
|
|
35
|
-
|
|
36
|
-
|
|
37
35
|
if(supportTeamsPageIds.excludeValues.has(currentItem.title_fld)) {
|
|
38
36
|
console.log("Value is excluded , collapsing recently Jobs Section ");
|
|
39
|
-
await collapseSection(_$w,supportTeamsPageSections.RECENT_JOBS);
|
|
37
|
+
await collapseSection(_$w, supportTeamsPageSections.RECENT_JOBS);
|
|
40
38
|
return;
|
|
41
39
|
}
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
40
|
+
|
|
41
|
+
const valueId = supportTeamsPageIds.valueToValueIdMap[currentItem.title_fld]
|
|
42
|
+
const Value = await getValueFromValueId(valueId);
|
|
43
|
+
|
|
44
|
+
if( Value === undefined ) {
|
|
45
45
|
console.log("Value is undefined , collapsing recently Jobs Section ");
|
|
46
46
|
await collapseSection(_$w,supportTeamsPageSections.RECENT_JOBS);
|
|
47
47
|
return;
|