muba-posting 9.0.4 → 9.0.5
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 +22 -21
- package/package.json +1 -1
package/Publish2b.js
CHANGED
|
@@ -62,7 +62,7 @@ export default class Publish2b extends React.Component {
|
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
64
|
|
|
65
|
-
if (
|
|
65
|
+
if (region != null) {
|
|
66
66
|
this.setState({
|
|
67
67
|
cityOptions: {
|
|
68
68
|
elements: [this.state.cityOptions.elements[0], ...this.state.locationsList.filter(r => r.value === region)[0].subList.map(({ subList, ...rest }) => ({ ...rest }))],
|
|
@@ -71,7 +71,7 @@ export default class Publish2b extends React.Component {
|
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
if (
|
|
74
|
+
if (city != null) {
|
|
75
75
|
this.setState({
|
|
76
76
|
districtOptions: {
|
|
77
77
|
elements: [this.state.districtOptions.elements[0], ...this.state.locationsList.filter(r => r.value === region)[0].subList.filter(c => c.value === city)[0].subList.map(({ subList, ...rest }) => ({ ...rest }))],
|
|
@@ -80,7 +80,7 @@ export default class Publish2b extends React.Component {
|
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
if (
|
|
83
|
+
if (district != null) {
|
|
84
84
|
this.setState({
|
|
85
85
|
townOptions: {
|
|
86
86
|
elements: [this.state.townOptions.elements[0], ...this.state.locationsList.filter(r => r.value === region)[0].subList.filter(c => c.value === city)[0].subList.filter(d => d.value === district)[0].subList],
|
|
@@ -90,7 +90,7 @@ export default class Publish2b extends React.Component {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
loadRegions() {
|
|
94
94
|
if (this.state.regionOptions.elements.length <= 1) {
|
|
95
95
|
const regionOptions = {
|
|
96
96
|
elements: [this.state.regionOptions.elements[0], ...this.state.locationsList.map(({ subList, ...rest }) => ({ ...rest }))],
|
|
@@ -101,7 +101,7 @@ export default class Publish2b extends React.Component {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
loadCities(value) {
|
|
105
105
|
this.setState({ regionOptions: { ...this.state.regionOptions, selectedItem: value } });
|
|
106
106
|
this.props.postingAd.region = value;
|
|
107
107
|
|
|
@@ -124,7 +124,7 @@ export default class Publish2b extends React.Component {
|
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
|
|
127
|
+
loadDistricts(value) {
|
|
128
128
|
this.setState({ cityOptions: { ...this.state.cityOptions, selectedItem: value } });
|
|
129
129
|
this.props.postingAd.city = value;
|
|
130
130
|
|
|
@@ -139,20 +139,21 @@ export default class Publish2b extends React.Component {
|
|
|
139
139
|
districtOptions.selectedItem = city.subList[0].value;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
this.setState({ districtOptions: districtOptions })
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
this.setState({ districtOptions: districtOptions }, async () => {
|
|
143
|
+
this.props.postingAd.district = null;
|
|
144
|
+
this.props.postingAd.town = null;
|
|
145
145
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
146
|
+
if (city.subList.length == 1) {
|
|
147
|
+
this.inputSelectDistrict?.onSubmitValidate();
|
|
148
|
+
this.loadTowns(districtOptions.selectedItem);
|
|
149
|
+
} else {
|
|
150
|
+
this.setState({ townOptions: { elements: [this.state.townOptions.elements[0]], selectedItem: null } });
|
|
151
|
+
}
|
|
152
|
+
});
|
|
152
153
|
}
|
|
153
154
|
}
|
|
154
155
|
|
|
155
|
-
|
|
156
|
+
loadTowns(value) {
|
|
156
157
|
this.setState({ districtOptions: { ...this.state.districtOptions, selectedItem: value } })
|
|
157
158
|
this.props.postingAd.district = value;
|
|
158
159
|
|
|
@@ -168,11 +169,11 @@ export default class Publish2b extends React.Component {
|
|
|
168
169
|
this.props.postingAd.town = townOptions.selectedItem;
|
|
169
170
|
}
|
|
170
171
|
|
|
171
|
-
this.setState({ townOptions: townOptions })
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
172
|
+
this.setState({ townOptions: townOptions }, () => {
|
|
173
|
+
if (district.subList.length == 1) {
|
|
174
|
+
this.inputSelectTown?.onSubmitValidate();
|
|
175
|
+
}
|
|
176
|
+
});
|
|
176
177
|
}
|
|
177
178
|
}
|
|
178
179
|
|