muba-posting 9.0.17 → 9.0.19
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/Publish5.js +124 -6
- package/package.json +1 -1
- package/shared/InputNumber.js +6 -4
package/Publish5.js
CHANGED
|
@@ -5,6 +5,8 @@ import commonStyles from './commonStyles';
|
|
|
5
5
|
import InputSelect from 'muba-input-select';
|
|
6
6
|
import AdFeatures from 'muba-ad-features';
|
|
7
7
|
import { Views } from './utils/Views';
|
|
8
|
+
import InputText from 'muba-input-text';
|
|
9
|
+
import InputNumber from './shared/InputNumber.js';
|
|
8
10
|
|
|
9
11
|
export default class Publish5 extends React.Component {
|
|
10
12
|
constructor(props) {
|
|
@@ -75,6 +77,12 @@ export default class Publish5 extends React.Component {
|
|
|
75
77
|
],
|
|
76
78
|
selectedItem: this.props.postingAd.landStatus
|
|
77
79
|
},
|
|
80
|
+
showTerraceSurface: this.props.postingAd.terrace,
|
|
81
|
+
showGardenSurface: this.props.postingAd.garden,
|
|
82
|
+
showParkingPlaces: this.props.postingAd.garage,
|
|
83
|
+
terraceSurface: this.props.postingAd.terraceSurface,
|
|
84
|
+
gardenSurface: this.props.postingAd.gardenSurface,
|
|
85
|
+
parkingPlaces: this.props.postingAd.parkingPlaces
|
|
78
86
|
}
|
|
79
87
|
}
|
|
80
88
|
|
|
@@ -82,6 +90,41 @@ export default class Publish5 extends React.Component {
|
|
|
82
90
|
this.refreshData();
|
|
83
91
|
}
|
|
84
92
|
|
|
93
|
+
onChangeFeature(value, name) {
|
|
94
|
+
this.props.postingAd[name] = value
|
|
95
|
+
if (name == 'terrace') {
|
|
96
|
+
this.setState({ showTerraceSurface: value }, () => {
|
|
97
|
+
this.onChangeTerraceSurface(null);
|
|
98
|
+
});
|
|
99
|
+
} else if (name == 'garden') {
|
|
100
|
+
this.setState({ showGardenSurface: value }, () => {
|
|
101
|
+
this.onChangeGardenSurface(null);
|
|
102
|
+
})
|
|
103
|
+
} else if (name == 'garage') {
|
|
104
|
+
this.setState({ showParkingPlaces: value }, () => {
|
|
105
|
+
this.onChangeParkingPlaces(null);
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
onChangeTerraceSurface(text) {
|
|
111
|
+
this.setState({ terraceSurface: text }, () => {
|
|
112
|
+
this.props.postingAd.terraceSurface = text;
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
onChangeGardenSurface(text) {
|
|
117
|
+
this.setState({ gardenSurface: text }, () => {
|
|
118
|
+
this.props.postingAd.gardenSurface = text;
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
onChangeParkingPlaces(text) {
|
|
123
|
+
this.setState({ parkingPlaces: text }, () => {
|
|
124
|
+
this.props.postingAd.parkingPlaces = text;
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
85
128
|
loadFeaturesOptions() {
|
|
86
129
|
const labels = {}
|
|
87
130
|
const options = {};
|
|
@@ -173,6 +216,18 @@ export default class Publish5 extends React.Component {
|
|
|
173
216
|
validate = this.inputSelectOrientation.onSubmitValidate() && validate;
|
|
174
217
|
}
|
|
175
218
|
|
|
219
|
+
if (this.state.showTerraceSurface) {
|
|
220
|
+
validate = this.inpuTerraceSurface.onSubmitValidate() && validate;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (this.state.showGardenSurface) {
|
|
224
|
+
validate = this.inputGardenSurface.onSubmitValidate() && validate;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (this.state.showParkingPlaces) {
|
|
228
|
+
validate = this.inputParkingPlaces.onSubmitValidate() && validate;
|
|
229
|
+
}
|
|
230
|
+
|
|
176
231
|
return validate;
|
|
177
232
|
}
|
|
178
233
|
|
|
@@ -310,13 +365,74 @@ export default class Publish5 extends React.Component {
|
|
|
310
365
|
|
|
311
366
|
<View style={[commonStyles.row, commonStyles.rowIcons]}>
|
|
312
367
|
{this.props.mainFeatures.map(feature =>
|
|
313
|
-
<IconFeature
|
|
314
|
-
key={feature.name}
|
|
368
|
+
<IconFeature key={feature.name}
|
|
315
369
|
name={feature.name}
|
|
316
370
|
iconText={feature.label}
|
|
371
|
+
postingAd={this.props.postingAd}
|
|
317
372
|
selected={this.props.postingAd[feature.name]}
|
|
318
373
|
disabled={!this.props.allowedToModify.features}
|
|
319
|
-
onPress={(value) => this.
|
|
374
|
+
onPress={(value) => this.onChangeFeature(value, feature.name)}
|
|
375
|
+
extraField={<View>
|
|
376
|
+
{feature.name == 'terrace' && this.state.showTerraceSurface &&
|
|
377
|
+
<View style={[commonStyles.row, { padding: 5 }]} >
|
|
378
|
+
<View style={commonStyles.col8}>
|
|
379
|
+
<InputText
|
|
380
|
+
value={this.state.terraceSurface}
|
|
381
|
+
style={commonStyles.area}
|
|
382
|
+
keyboardType='numeric'
|
|
383
|
+
type='number'
|
|
384
|
+
returnKeyType={"next"}
|
|
385
|
+
onlyNumbers={true}
|
|
386
|
+
required={true}
|
|
387
|
+
maxValue={999999}
|
|
388
|
+
onChangeText={(text) => this.onChangeTerraceSurface(text)}
|
|
389
|
+
scroll={(ref) => this.props.scroll(ref)}
|
|
390
|
+
ref={(element) => this.inpuTerraceSurface = element} />
|
|
391
|
+
</View>
|
|
392
|
+
<View style={commonStyles.col4}>
|
|
393
|
+
<View style={[commonStyles.unit]}>
|
|
394
|
+
<Text style={commonStyles.unitText}>{strings('setup.measureSurface')}</Text>
|
|
395
|
+
</View>
|
|
396
|
+
</View>
|
|
397
|
+
</View>
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
{feature.name == 'garden' && this.state.showGardenSurface &&
|
|
401
|
+
<View style={[commonStyles.row, { padding: 5 }]} >
|
|
402
|
+
<View style={commonStyles.col8}>
|
|
403
|
+
<InputText
|
|
404
|
+
value={this.state.gardenSurface}
|
|
405
|
+
style={commonStyles.area}
|
|
406
|
+
keyboardType='numeric'
|
|
407
|
+
type='number'
|
|
408
|
+
returnKeyType={"next"}
|
|
409
|
+
onlyNumbers={true}
|
|
410
|
+
required={true}
|
|
411
|
+
maxValue={999999}
|
|
412
|
+
onChangeText={(text) => this.onChangeGardenSurface(text)}
|
|
413
|
+
scroll={(ref) => this.props.scroll(ref)}
|
|
414
|
+
ref={(element) => this.inputGardenSurface = element} />
|
|
415
|
+
</View>
|
|
416
|
+
<View style={commonStyles.col4}>
|
|
417
|
+
<View style={[commonStyles.unit]}>
|
|
418
|
+
<Text style={commonStyles.unitText}>{strings('setup.measureSurface')}</Text>
|
|
419
|
+
</View>
|
|
420
|
+
</View>
|
|
421
|
+
</View>
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
{feature.name == 'garage' && this.state.showParkingPlaces &&
|
|
425
|
+
<InputNumber
|
|
426
|
+
value={this.props.postingAd.parkingPlaces || 1}
|
|
427
|
+
minValue={1}
|
|
428
|
+
maxValue={99}
|
|
429
|
+
required={true}
|
|
430
|
+
scroll={(ref) => this.props.scroll(ref)}
|
|
431
|
+
onChange={(value) => this.onChangeParkingPlaces(value)}
|
|
432
|
+
ref={(element) => this.inputParkingPlaces = element} />
|
|
433
|
+
}
|
|
434
|
+
</View>}
|
|
435
|
+
/>
|
|
320
436
|
)}
|
|
321
437
|
</View>
|
|
322
438
|
</View>
|
|
@@ -336,7 +452,7 @@ export default class Publish5 extends React.Component {
|
|
|
336
452
|
iconText={feature.label}
|
|
337
453
|
selected={this.props.postingAd[feature.name]}
|
|
338
454
|
disabled={!this.props.allowedToModify.features}
|
|
339
|
-
onPress={(value) => this.
|
|
455
|
+
onPress={(value) => this.onChangeFeature(value, feature.name)} />
|
|
340
456
|
)}
|
|
341
457
|
</View>
|
|
342
458
|
</View>
|
|
@@ -356,7 +472,7 @@ export default class Publish5 extends React.Component {
|
|
|
356
472
|
iconText={feature.label}
|
|
357
473
|
selected={this.props.postingAd[feature.name]}
|
|
358
474
|
disabled={!this.props.allowedToModify.features}
|
|
359
|
-
onPress={(value) => this.
|
|
475
|
+
onPress={(value) => this.onChangeFeature(value, feature.name)} />
|
|
360
476
|
)}
|
|
361
477
|
</View>
|
|
362
478
|
</View>
|
|
@@ -396,12 +512,14 @@ class IconFeature extends React.Component {
|
|
|
396
512
|
|
|
397
513
|
render() {
|
|
398
514
|
return (
|
|
399
|
-
<View style={[commonStyles.characLinkBox, commonStyles.col, commonStyles.
|
|
515
|
+
<View style={[commonStyles.characLinkBox, commonStyles.col, commonStyles.col4]}>
|
|
400
516
|
<TouchableOpacity activeOpacity={1} style={[commonStyles.characIcon, this.state.selected ? commonStyles.characBoxSelected : null, this.props.disabled ? commonStyles.disabled : null]} onPress={() => this.onPressIcon()}
|
|
401
517
|
disabled={this.props.disabled}>
|
|
402
518
|
<AdFeatures style={[commonStyles.characImage, this.state.selected ? commonStyles.characImageSelected : null]} name={this.props.name} />
|
|
403
519
|
</TouchableOpacity>
|
|
404
520
|
<Text style={[commonStyles.characIconText, this.state.selected ? commonStyles.characIconTextSelected : null]}>{this.props.iconText}</Text>
|
|
521
|
+
|
|
522
|
+
{this.props.extraField}
|
|
405
523
|
</View>
|
|
406
524
|
);
|
|
407
525
|
}
|
package/package.json
CHANGED
package/shared/InputNumber.js
CHANGED
|
@@ -59,10 +59,12 @@ export default class InputNumber extends React.Component {
|
|
|
59
59
|
<View style={[commonStyles.col, commonStyles.col6, commonStyles.inputNumberBox]} ref={this.inputNumberView}>
|
|
60
60
|
<View style={[commonStyles.col, commonStyles.col12, this.state.minValueError ? commonStyles.fieldError : null]}>
|
|
61
61
|
<View style={commonStyles.inputNumberLabelBox}>
|
|
62
|
-
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
{this.props.label &&
|
|
63
|
+
<View style={commonStyles.row}>
|
|
64
|
+
<Text style={commonStyles.inputNumberLabel}>{this.props.label}</Text>
|
|
65
|
+
{this.props.required ? <Text style={commonStyles.red}> *</Text> : <Text />}
|
|
66
|
+
</View>
|
|
67
|
+
}
|
|
66
68
|
{this.state.minValueError ? <Text style={[commonStyles.subNote, commonStyles.red]}> {strings('setup.requiredField')}</Text> : null}
|
|
67
69
|
</View>
|
|
68
70
|
<View style={commonStyles.row}>
|