muba-posting 9.0.2 → 9.0.4
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 +46 -22
- package/package.json +1 -1
- package/shared/InputNumber.js +17 -13
package/Publish2b.js
CHANGED
|
@@ -53,18 +53,41 @@ export default class Publish2b extends React.Component {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
loadData = async () => {
|
|
56
|
-
const region = this.props.postingAd
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
56
|
+
const { region, city, district, town } = this.props.postingAd;
|
|
57
|
+
|
|
58
|
+
this.setState({
|
|
59
|
+
regionOptions: {
|
|
60
|
+
elements: [this.state.regionOptions.elements[0], ...this.state.locationsList.map(({ subList, ...rest }) => ({ ...rest }))],
|
|
61
|
+
selectedItem: region
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
if (city != null) {
|
|
66
|
+
this.setState({
|
|
67
|
+
cityOptions: {
|
|
68
|
+
elements: [this.state.cityOptions.elements[0], ...this.state.locationsList.filter(r => r.value === region)[0].subList.map(({ subList, ...rest }) => ({ ...rest }))],
|
|
69
|
+
selectedItem: city
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (district != null) {
|
|
75
|
+
this.setState({
|
|
76
|
+
districtOptions: {
|
|
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 }))],
|
|
78
|
+
selectedItem: district
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (town != null) {
|
|
84
|
+
this.setState({
|
|
85
|
+
townOptions: {
|
|
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],
|
|
87
|
+
selectedItem: town
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
68
91
|
}
|
|
69
92
|
|
|
70
93
|
async loadRegions() {
|
|
@@ -79,7 +102,7 @@ export default class Publish2b extends React.Component {
|
|
|
79
102
|
}
|
|
80
103
|
|
|
81
104
|
async loadCities(value) {
|
|
82
|
-
|
|
105
|
+
this.setState({ regionOptions: { ...this.state.regionOptions, selectedItem: value } });
|
|
83
106
|
this.props.postingAd.region = value;
|
|
84
107
|
|
|
85
108
|
if (value != null) {
|
|
@@ -89,7 +112,7 @@ export default class Publish2b extends React.Component {
|
|
|
89
112
|
selectedItem: null
|
|
90
113
|
}
|
|
91
114
|
|
|
92
|
-
|
|
115
|
+
this.setState({
|
|
93
116
|
cityOptions: cityOptions,
|
|
94
117
|
districtOptions: { elements: [this.state.districtOptions.elements[0]], selectedItem: null },
|
|
95
118
|
townOptions: { elements: [this.state.townOptions.elements[0]], selectedItem: null }
|
|
@@ -102,7 +125,7 @@ export default class Publish2b extends React.Component {
|
|
|
102
125
|
}
|
|
103
126
|
|
|
104
127
|
async loadDistricts(value) {
|
|
105
|
-
|
|
128
|
+
this.setState({ cityOptions: { ...this.state.cityOptions, selectedItem: value } });
|
|
106
129
|
this.props.postingAd.city = value;
|
|
107
130
|
|
|
108
131
|
if (value != null) {
|
|
@@ -116,7 +139,7 @@ export default class Publish2b extends React.Component {
|
|
|
116
139
|
districtOptions.selectedItem = city.subList[0].value;
|
|
117
140
|
}
|
|
118
141
|
|
|
119
|
-
|
|
142
|
+
this.setState({ districtOptions: districtOptions });
|
|
120
143
|
this.props.postingAd.district = null;
|
|
121
144
|
this.props.postingAd.town = null;
|
|
122
145
|
|
|
@@ -124,13 +147,13 @@ export default class Publish2b extends React.Component {
|
|
|
124
147
|
this.inputSelectDistrict?.onSubmitValidate();
|
|
125
148
|
await this.loadTowns(districtOptions.selectedItem);
|
|
126
149
|
} else {
|
|
127
|
-
|
|
150
|
+
this.setState({ townOptions: { elements: [this.state.townOptions.elements[0]], selectedItem: null } });
|
|
128
151
|
}
|
|
129
152
|
}
|
|
130
153
|
}
|
|
131
154
|
|
|
132
155
|
async loadTowns(value) {
|
|
133
|
-
|
|
156
|
+
this.setState({ districtOptions: { ...this.state.districtOptions, selectedItem: value } })
|
|
134
157
|
this.props.postingAd.district = value;
|
|
135
158
|
|
|
136
159
|
if (value != null) {
|
|
@@ -145,7 +168,7 @@ export default class Publish2b extends React.Component {
|
|
|
145
168
|
this.props.postingAd.town = townOptions.selectedItem;
|
|
146
169
|
}
|
|
147
170
|
|
|
148
|
-
|
|
171
|
+
this.setState({ townOptions: townOptions });
|
|
149
172
|
|
|
150
173
|
if (district.subList.length == 1) {
|
|
151
174
|
this.inputSelectTown?.onSubmitValidate();
|
|
@@ -173,10 +196,10 @@ export default class Publish2b extends React.Component {
|
|
|
173
196
|
errorCity: !responseCheckZone.correctCity
|
|
174
197
|
})
|
|
175
198
|
|
|
176
|
-
if (!responseCheckZone.correctCity){
|
|
199
|
+
if (!responseCheckZone.correctCity) {
|
|
177
200
|
this.popupNoZone.show();
|
|
178
201
|
} else {
|
|
179
|
-
this.props.goToPage(Views.PAYMENT_ONLINE, false, {onlyShowCreateBusiness: true});
|
|
202
|
+
this.props.goToPage(Views.PAYMENT_ONLINE, false, { onlyShowCreateBusiness: true });
|
|
180
203
|
}
|
|
181
204
|
}
|
|
182
205
|
}
|
|
@@ -219,7 +242,8 @@ export default class Publish2b extends React.Component {
|
|
|
219
242
|
<InputText value={this.state.address}
|
|
220
243
|
label={strings('setup.adress')}
|
|
221
244
|
labelStyle={commonStyles.progressbarField}
|
|
222
|
-
required={
|
|
245
|
+
required={true}
|
|
246
|
+
scroll={(ref) => this.props.scroll(ref)}
|
|
223
247
|
onChangeText={(text) => this.onChangeAddress(text)}
|
|
224
248
|
textContainerStyle={commonStyles.inputContainer}
|
|
225
249
|
disabled={!this.props.allowedToModify.address || this.props.postingAd.promotionId != null}
|
package/package.json
CHANGED
package/shared/InputNumber.js
CHANGED
|
@@ -17,23 +17,27 @@ export default class InputNumber extends React.Component {
|
|
|
17
17
|
|
|
18
18
|
async subtract(value) {
|
|
19
19
|
if ((this.props.minValue == null || this.props.minValue <= value - 1) && value - 1 >= 0) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this.props.onChange
|
|
25
|
-
|
|
20
|
+
this.setState({
|
|
21
|
+
numberValue: value - 1,
|
|
22
|
+
minValueError: false
|
|
23
|
+
}, () => {
|
|
24
|
+
if (this.props.onChange) {
|
|
25
|
+
this.props.onChange(this.state.numberValue);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
async add(value) {
|
|
30
32
|
if (this.props.maxValue == null || this.props.maxValue >= value + 1) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
this.props.onChange
|
|
36
|
-
|
|
33
|
+
this.setState({
|
|
34
|
+
numberValue: value + 1,
|
|
35
|
+
minValueError: false
|
|
36
|
+
}, () => {
|
|
37
|
+
if (this.props.onChange) {
|
|
38
|
+
this.props.onChange(this.state.numberValue);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
37
41
|
}
|
|
38
42
|
}
|
|
39
43
|
|
|
@@ -53,7 +57,7 @@ export default class InputNumber extends React.Component {
|
|
|
53
57
|
render() {
|
|
54
58
|
return (
|
|
55
59
|
<View style={[commonStyles.col, commonStyles.col6, commonStyles.inputNumberBox]} ref={this.inputNumberView}>
|
|
56
|
-
<View style={[commonStyles.col, commonStyles.col12, this.state.minValueError ? commonStyles.fieldError : null]}
|
|
60
|
+
<View style={[commonStyles.col, commonStyles.col12, this.state.minValueError ? commonStyles.fieldError : null]}>
|
|
57
61
|
<View style={commonStyles.inputNumberLabelBox}>
|
|
58
62
|
<View style={commonStyles.row}>
|
|
59
63
|
<Text style={commonStyles.inputNumberLabel}>{this.props.label}</Text>
|