muba-posting 4.1.11 → 4.1.12
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/Publish2b.js +73 -78
- package/package.json +1 -1
package/Publish2b.js
CHANGED
|
@@ -66,26 +66,12 @@ export default class Publish2b extends React.Component {
|
|
|
66
66
|
const town = this.props.postingAd.town;
|
|
67
67
|
|
|
68
68
|
await this.loadRegions();
|
|
69
|
+
await this.loadCities(region, false);
|
|
70
|
+
await this.loadDistricts(city, false);
|
|
71
|
+
await this.loadTowns(district, false);
|
|
69
72
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
await this.loadCities(region, false);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (city !== null) {
|
|
76
|
-
await this.setState({ cityOptions: { ...this.state.cityOptions, selectedItem: city } })
|
|
77
|
-
await this.loadDistricts(city, false);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (district !== null) {
|
|
81
|
-
await this.setState({ districtOptions: { ...this.state.districtOptions, selectedItem: district } })
|
|
82
|
-
await this.loadTowns(district, false);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (town !== null) {
|
|
86
|
-
await this.setState({ townOptions: { ...this.state.townOptions, selectedItem: town } })
|
|
87
|
-
this.props.postingAd.town = town
|
|
88
|
-
}
|
|
73
|
+
await this.setState({ townOptions: { ...this.state.townOptions, selectedItem: town } })
|
|
74
|
+
this.props.postingAd.town = town
|
|
89
75
|
|
|
90
76
|
this.props.hideLoading();
|
|
91
77
|
}
|
|
@@ -114,31 +100,34 @@ export default class Publish2b extends React.Component {
|
|
|
114
100
|
this.props.showLoading();
|
|
115
101
|
}
|
|
116
102
|
|
|
103
|
+
await this.setState({ regionOptions: { ...this.state.regionOptions, selectedItem: value } });
|
|
117
104
|
this.props.postingAd.region = value;
|
|
118
105
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
106
|
+
if (value !== null) {
|
|
107
|
+
const responseJson = await this.props.request(this.props.context, GET_CITIES_FROM_REGION, {
|
|
108
|
+
regionId: this.props.postingAd.region
|
|
109
|
+
});
|
|
122
110
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
111
|
+
if (responseJson.httpStatus === 200) {
|
|
112
|
+
var cityOptions = {
|
|
113
|
+
elements: [this.state.cityOptions.elements[0]],
|
|
114
|
+
selectedItem: null
|
|
115
|
+
};
|
|
128
116
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
117
|
+
responseJson.list.map((item) => {
|
|
118
|
+
cityOptions.elements.push(item);
|
|
119
|
+
});
|
|
132
120
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
121
|
+
await this.setState({
|
|
122
|
+
cityOptions: cityOptions,
|
|
123
|
+
districtOptions: { elements: [this.state.districtOptions.elements[0]], selectedItem: null },
|
|
124
|
+
townOptions: { elements: [this.state.townOptions.elements[0]], selectedItem: null }
|
|
125
|
+
});
|
|
138
126
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
127
|
+
this.props.postingAd.city = null;
|
|
128
|
+
this.props.postingAd.district = null;
|
|
129
|
+
this.props.postingAd.town = null;
|
|
130
|
+
}
|
|
142
131
|
}
|
|
143
132
|
|
|
144
133
|
if (showLoading) {
|
|
@@ -151,35 +140,38 @@ export default class Publish2b extends React.Component {
|
|
|
151
140
|
this.props.showLoading();
|
|
152
141
|
}
|
|
153
142
|
|
|
143
|
+
await this.setState({ cityOptions: { ...this.state.cityOptions, selectedItem: value } });
|
|
154
144
|
this.props.postingAd.city = value;
|
|
155
145
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
146
|
+
if (value != null) {
|
|
147
|
+
const responseJson = await this.props.request(this.props.context, GET_DISTRICTS_FROM_CITY, {
|
|
148
|
+
cityId: this.props.postingAd.city
|
|
149
|
+
});
|
|
159
150
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
151
|
+
if (responseJson.httpStatus === 200) {
|
|
152
|
+
let districtOptions = {
|
|
153
|
+
elements: [this.state.districtOptions.elements[0]],
|
|
154
|
+
selectedItem: null
|
|
155
|
+
};
|
|
165
156
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
157
|
+
responseJson.list.map((item) => {
|
|
158
|
+
districtOptions.elements.push(item);
|
|
159
|
+
});
|
|
169
160
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
161
|
+
if (responseJson.list.length == 1) {
|
|
162
|
+
districtOptions.selectedItem = responseJson.list[0].value;
|
|
163
|
+
}
|
|
173
164
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
165
|
+
await this.setState({ districtOptions: districtOptions });
|
|
166
|
+
this.props.postingAd.district = null;
|
|
167
|
+
this.props.postingAd.town = null;
|
|
177
168
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
169
|
+
if (responseJson.list.length == 1) {
|
|
170
|
+
this.inputSelectDistrict?.onSubmitValidate();
|
|
171
|
+
await this.loadTowns(districtOptions.selectedItem);
|
|
172
|
+
} else {
|
|
173
|
+
await this.setState({ townOptions: { elements: [this.state.townOptions.elements[0]], selectedItem: null } });
|
|
174
|
+
}
|
|
183
175
|
}
|
|
184
176
|
}
|
|
185
177
|
|
|
@@ -193,31 +185,34 @@ export default class Publish2b extends React.Component {
|
|
|
193
185
|
this.props.showLoading();
|
|
194
186
|
}
|
|
195
187
|
|
|
188
|
+
await this.setState({ districtOptions: { ...this.state.districtOptions, selectedItem: value } })
|
|
196
189
|
this.props.postingAd.district = value;
|
|
197
190
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
191
|
+
if (value != null) {
|
|
192
|
+
const responseJson = await this.props.request(this.props.context, GET_TOWNS_FROM_DISTRICT, {
|
|
193
|
+
districtId: this.props.postingAd.district
|
|
194
|
+
});
|
|
201
195
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
196
|
+
if (responseJson.httpStatus === 200) {
|
|
197
|
+
var townOptions = {
|
|
198
|
+
elements: [this.state.townOptions.elements[0]],
|
|
199
|
+
selectedItem: null
|
|
200
|
+
};
|
|
207
201
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
202
|
+
responseJson.list.map((item) => {
|
|
203
|
+
townOptions.elements.push(item);
|
|
204
|
+
});
|
|
211
205
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
206
|
+
if (responseJson.list.length == 1) {
|
|
207
|
+
townOptions.selectedItem = responseJson.list[0].value;
|
|
208
|
+
this.props.postingAd.town = townOptions.selectedItem;
|
|
209
|
+
}
|
|
216
210
|
|
|
217
|
-
|
|
211
|
+
await this.setState({ townOptions: townOptions });
|
|
218
212
|
|
|
219
|
-
|
|
220
|
-
|
|
213
|
+
if (responseJson.list.length == 1) {
|
|
214
|
+
this.inputSelectTown?.onSubmitValidate();
|
|
215
|
+
}
|
|
221
216
|
}
|
|
222
217
|
}
|
|
223
218
|
|