sr-npm 1.7.666 → 1.7.668

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.
@@ -3,6 +3,8 @@ const CAREERS_MULTI_BOXES_PAGE_CONSTS={
3
3
  JOBS_REPEATER: '#jobsReapter',
4
4
  JOBS_REPEATER_ITEM_TITLE: '#jobTitle',
5
5
  JOBS_REPEATER_ITEM_LOCATION: '#locationLabel',
6
+ JOBS_REPEATER_ITEM_EMPLOYMENT_TYPE: '#employmentTypeLabel',
7
+ TotalJobsCountText: '#totalJobsCountText',
6
8
  FILTER_LABEL: '#FilterTextInput',
7
9
  FILTER_CHECKBOX_CONTAINER: '#FilterCheckBoxContainer',
8
10
  FILTER_REPEATER_ITEM_CHECKBOX: '#filterCheckBox',
@@ -28,6 +28,7 @@ const JOBS_COLLECTION_FIELDS = {
28
28
  BRAND: 'brand',
29
29
  BRAND_REF: 'brandRef',
30
30
  MULTI_REF_JOBS_CUSTOM_VALUES: 'multiRefJobsCustomValues',
31
+ EMPLOYMENT_TYPE: 'employmentType',
31
32
  }
32
33
  const AMOUNT_OF_JOBS_PER_DEPARTMENT_COLLECTION_FIELDS = {
33
34
  TITLE: 'title',
@@ -87,7 +88,8 @@ const COLLECTIONS_FIELDS = {
87
88
  {key:'departmentref', type: 'REFERENCE', typeMetadata: { reference: { referencedCollectionId: COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT } } },
88
89
  {key:'city', type: 'REFERENCE', typeMetadata: { reference: { referencedCollectionId: COLLECTIONS.CITIES } } },
89
90
  {key:'brandRef', type: 'REFERENCE', typeMetadata: { reference: { referencedCollectionId: COLLECTIONS.BRANDS } } },
90
- { key: 'image', type: 'IMAGE' },
91
+ {key: 'image', type: 'IMAGE' },
92
+ {key:'employmentType', type: 'TEXT'},
91
93
  ],
92
94
  TEMPLATE_TYPE: [
93
95
  {key:'templateType', type: 'TEXT'},
package/backend/data.js CHANGED
@@ -7,7 +7,7 @@ const { getAllPositions } = require('./queries');
7
7
  const { retrieveSecretVal, getTokenFromCMS } = require('./secretsData');
8
8
 
9
9
 
10
- //let jobToCustomValues = {}
10
+
11
11
  let customValuesToJobs = {}
12
12
  let locationToJobs = {}
13
13
  let siteconfig;
@@ -73,7 +73,6 @@ function getEmploymentType(position,customFieldsValues) {
73
73
  customFieldsValues["employmentType"] = {};
74
74
  }
75
75
  customFieldsValues["employmentType"][position.typeOfEmployment.id] = position.typeOfEmployment.label;
76
- //jobToCustomValues[position.id] ? jobToCustomValues[position.id].push(position.typeOfEmployment.id) : jobToCustomValues[position.id]=[position.typeOfEmployment.id]
77
76
  customValuesToJobs[position.typeOfEmployment.id] ? customValuesToJobs[position.typeOfEmployment.id].push(position.id) : customValuesToJobs[position.typeOfEmployment.id]=[position.id]
78
77
  }
79
78
 
@@ -92,7 +91,6 @@ function getCustomFieldsAndValuesFromPosition(position,customFieldsLabels,custom
92
91
  }
93
92
  customFieldsValues[fieldId][valueId] = valueLabel;
94
93
 
95
- //jobToCustomValues[position.id] ? jobToCustomValues[position.id].push(valueId) : jobToCustomValues[position.id]=[valueId]
96
94
  customValuesToJobs[valueId] ? customValuesToJobs[valueId].push(position.id) : customValuesToJobs[valueId]=[position.id]
97
95
  }
98
96
  }
@@ -127,6 +125,7 @@ async function saveJobsDataToCMS() {
127
125
  language: position.language?.label || '',
128
126
  brand: getBrand(position.customField),
129
127
  jobDescription: null, // Will be filled later
128
+ employmentType: position.typeOfEmployment.label
130
129
  };
131
130
 
132
131
  getCustomFieldsAndValuesFromPosition(position,customFieldsLabels,customFieldsValues);
@@ -218,6 +217,8 @@ async function saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS() {
218
217
  if (siteconfig.customFields==="true") {
219
218
  let customValues=await getAllCustomValues();
220
219
  console.log("inserting jobs references to custom values collection");
220
+ console.log("customValues: ",customValues)
221
+ console.log("customValues.items: ",customValues.items)
221
222
  for (const value of customValues.items) {
222
223
  await insertJobsReference(value._id);
223
224
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.666",
3
+ "version": "1.7.668",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -25,9 +25,49 @@ async function careersMultiBoxesPageOnReady(_$w) {
25
25
  }
26
26
 
27
27
  await loadJobs(_$w);
28
- await loadFilters(_$w);
28
+ // await loadFilters(_$w);
29
29
  //selected values repeater on item ready
30
- _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SELECTED_VALUES_REPEATER).onItemReady(($item, itemData) => {
30
+ //await loadSelectedValuesRepeater(_$w);
31
+ // _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SELECTED_VALUES_REPEATER).onItemReady(($item, itemData) => {
32
+ // $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.SELECTED_VALUES_REPEATER_ITEM_LABEL).text = itemData.label || '';
33
+
34
+ // // Deselect this value from both the selected map and the multibox
35
+ // $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.DESELECT_BUTTON_ID).onClick(async () => {
36
+
37
+ // const fieldId = itemData.fieldId;
38
+ // const valueId = itemData.valueId;
39
+ // dontUpdateThisCheckBox=fieldId;
40
+ // if (!fieldId || !valueId) return;
41
+
42
+ // const existing = selectedByField.get(fieldId) || [];
43
+ // const updated = existing.filter(v => v !== valueId);
44
+ // if (updated.length) {
45
+ // selectedByField.set(fieldId, updated);
46
+ // } else {
47
+ // selectedByField.delete(fieldId);
48
+ // }
49
+
50
+ // // Update the checkbox group UI inside the corresponding filter item
51
+ // _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER).forEachItem(($filterItem, filterItemData) => {
52
+ // if (filterItemData._id === fieldId) {
53
+ // const currentVals = $filterItem(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER_ITEM_CHECKBOX).value || [];
54
+ // const nextVals = currentVals.filter(v => v !== valueId);
55
+ // $filterItem(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER_ITEM_CHECKBOX).value = nextVals;
56
+ // }
57
+ // });
58
+
59
+ // await applyJobFilters(_$w,fieldId);
60
+ // await refreshFacetCounts(_$w);
61
+ // await updateSelectedValuesRepeater(_$w);
62
+ // updateTotalJobsCountText(_$w);
63
+ // });
64
+ // });
65
+ // await updateSelectedValuesRepeater(_$w);
66
+
67
+ }
68
+
69
+ async function loadSelectedValuesRepeater(_$w) {
70
+ _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SELECTED_VALUES_REPEATER).onItemReady(($item, itemData) => {
31
71
  $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.SELECTED_VALUES_REPEATER_ITEM_LABEL).text = itemData.label || '';
32
72
 
33
73
  // Deselect this value from both the selected map and the multibox
@@ -62,20 +102,21 @@ async function careersMultiBoxesPageOnReady(_$w) {
62
102
  });
63
103
  });
64
104
  await updateSelectedValuesRepeater(_$w);
65
-
66
105
  }
67
106
 
68
107
  async function loadJobs(_$w) {
69
108
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER).onItemReady(($item, itemData) => {
70
109
  $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER_ITEM_TITLE).text = itemData.title || '';
71
110
  $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER_ITEM_LOCATION).text=itemData.location.fullLocation
111
+ $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER_ITEM_EMPLOYMENT_TYPE).text=itemData.employmentType
72
112
  });
113
+ console.log("alljobs: ",alljobs)
73
114
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER).data = alljobs;
74
115
  updateTotalJobsCountText(_$w);
75
116
  }
76
117
 
77
118
  function updateTotalJobsCountText(_$w) {
78
- _$w('#totalJobsCountText').text = `${currentJobs.length} Jobs`;
119
+ _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.TotalJobsCountText).text = `${currentJobs.length} Jobs`;
79
120
 
80
121
  }
81
122
 
@@ -237,19 +278,8 @@ async function loadJobs(_$w) {
237
278
  let tempFilteredJobs=[];
238
279
  let finalFilteredJobs=alljobs;
239
280
  let addedJobsIds=[]
240
- // if(filterByField!="Location") {
241
- // filterByField=JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES;
242
- // }
243
- // else{
244
- // filterByField=JOBS_COLLECTION_FIELDS.CITY_TEXT;
245
- // }
246
- console.log("filterByField: ",filterByField)
247
-
248
- console.log("selectedByField: ",selectedByField)
249
281
  // AND across categories, OR within each category
250
282
  for (const [key, values] of selectedByField.entries()) {
251
- console.log("key: ",key)
252
- console.log("values: ",values)
253
283
  for(job of finalFilteredJobs) {
254
284
  if(key==="Location"){
255
285
  //if it is location then we check if selecred values (which is an array) have job city text