sr-npm 1.7.281 → 1.7.283

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/pages/homePage.js +34 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.281",
3
+ "version": "1.7.283",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/pages/homePage.js CHANGED
@@ -6,6 +6,7 @@ const {
6
6
  const { filterBrokenMarkers } = require('../public/utils');
7
7
  const { location } = require('@wix/site-location');
8
8
  let thisObjectVar;
9
+ let searchByCityFlag=false;
9
10
  async function homePageOnReady(_$w,thisObject) {
10
11
  thisObjectVar=thisObject;
11
12
  await bind(_$w);
@@ -51,16 +52,11 @@ function init(_$w) {
51
52
 
52
53
  _$w('#searchInput').onInput(debouncedInput);
53
54
  _$w('#searchInput').maxLength = 40;
54
- _$w('#searchButton').onClick(()=>{
55
- const trimmedInput = _$w('#searchInput').value.trim();
56
- if (trimmedInput) {
57
- location.to(`/positions?keyWord=${trimmedInput}`);
58
- }
59
- });
55
+ _$w('#searchButton').onClick(()=>handleSearch(_$w('#searchInput').value));
60
56
 
61
57
  _$w('#searchInput').onKeyPress((event) => {
62
58
  if (event.key === 'Enter') {
63
- handleEnterPress(_$w('#searchInput').value);
59
+ handleSearch(_$w('#searchInput').value);
64
60
  }
65
61
  });
66
62
 
@@ -89,13 +85,15 @@ async function handleSearchInput(_$w) {
89
85
 
90
86
  searchInput = _$w('#searchInput').value;
91
87
  const trimmedInput = searchInput.trim();
88
+ const searchByTitle=[{field: 'title', searchTerm: trimmedInput}];
89
+ const searchByCity=[{field: 'cityText', searchTerm: trimmedInput}];
92
90
 
93
- const fieldsToSearch = [
94
- // { field: 'title', searchTerm: trimmedInput },
95
- { field: 'cityText', searchTerm: trimmedInput }
96
- ];
91
+ // const fieldsToSearch = [
92
+ // { field: 'title', searchTerm: trimmedInput },
93
+ // { field: 'cityText', searchTerm: trimmedInput }
94
+ // ];
97
95
 
98
- const filter = await getFilter(fieldsToSearch, 'or');
96
+ const filter = await getFilter(searchByTitle);
99
97
 
100
98
  await _$w('#jobsDataset').setFilter(filter);
101
99
  await _$w('#jobsDataset').refresh();
@@ -103,21 +101,41 @@ async function handleSearchInput(_$w) {
103
101
  count = _$w('#jobsDataset').getTotalCount();
104
102
 
105
103
  if (count > 0) {
104
+ searchByCityFlag=false;
106
105
  _$w('#resultsContainer').expand();
107
106
  _$w('#searchMultiStateBox').changeState('results');
108
- } else {
109
- _$w('#searchMultiStateBox').changeState('noResults');
107
+ } else {
108
+ filter=await getFilter(searchByCity);
109
+ await _$w('#jobsDataset').setFilter(filter);
110
+ await _$w('#jobsDataset').refresh();
111
+ count = _$w('#jobsDataset').getTotalCount();
112
+ if(count > 0)
113
+ {
114
+ searchByCityFlag=true;
115
+ _$w('#resultsContainer').expand();
116
+ _$w('#searchMultiStateBox').changeState('results');
117
+ }
118
+ else{
119
+ searchByCityFlag=false;
120
+ _$w('#searchMultiStateBox').changeState('noResults');
121
+ }
110
122
  }
111
123
  }
112
124
 
113
- function handleEnterPress(searchInput) {
125
+ function handleSearch(searchInput) {
114
126
  const trimmedInput = searchInput.trim();
115
127
 
116
128
  if (trimmedInput) {
117
- location.to(`/positions?keyWord=${trimmedInput}`);
129
+ if(searchByCity){
130
+ location.to(`/positions?location=${trimmedInput}`);
131
+ }
132
+ else{
133
+ location.to(`/positions?keyWord=${trimmedInput}`);
134
+ }
118
135
  }
119
136
  }
120
137
 
138
+
121
139
  module.exports = {
122
140
  homePageOnReady,
123
141
  };