muba-posting 8.0.4 → 8.0.6

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 (74) hide show
  1. package/EditHead.js +7 -8
  2. package/Posting.js +27 -0
  3. package/Publish3.js +200 -0
  4. package/Publish5.js +147 -330
  5. package/Publish6.js +1 -1
  6. package/commonStyles.js +54 -39
  7. package/fonts/AdFeatures.json +26629 -0
  8. package/fonts/Font-Awesome-ad.ttf +0 -0
  9. package/fonts/selection-ad.json +1 -0
  10. package/locales/ar.json +6 -1
  11. package/locales/en.json +6 -1
  12. package/locales/es.json +6 -1
  13. package/locales/fr.json +6 -1
  14. package/locales/it.json +6 -1
  15. package/locales/nl.json +6 -1
  16. package/package.json +1 -1
  17. package/assets/images/air-hover.png +0 -0
  18. package/assets/images/air.png +0 -0
  19. package/assets/images/animals-hover.png +0 -0
  20. package/assets/images/animals.png +0 -0
  21. package/assets/images/concierge-hover.png +0 -0
  22. package/assets/images/concierge.png +0 -0
  23. package/assets/images/diningroom-hover.png +0 -0
  24. package/assets/images/diningroom.png +0 -0
  25. package/assets/images/door-hover.png +0 -0
  26. package/assets/images/door.png +0 -0
  27. package/assets/images/elevator-hover.png +0 -0
  28. package/assets/images/elevator.png +0 -0
  29. package/assets/images/exteriorFacade-hover.png +0 -0
  30. package/assets/images/exteriorFacade.png +0 -0
  31. package/assets/images/fire-hover.png +0 -0
  32. package/assets/images/fire.png +0 -0
  33. package/assets/images/fridge-hover.png +0 -0
  34. package/assets/images/fridge.png +0 -0
  35. package/assets/images/furnish-hover.png +0 -0
  36. package/assets/images/furnish.png +0 -0
  37. package/assets/images/garage-hover.png +0 -0
  38. package/assets/images/garage.png +0 -0
  39. package/assets/images/garden-hover.png +0 -0
  40. package/assets/images/garden.png +0 -0
  41. package/assets/images/glazing-hover.png +0 -0
  42. package/assets/images/glazing.png +0 -0
  43. package/assets/images/heating-hover.png +0 -0
  44. package/assets/images/heating.png +0 -0
  45. package/assets/images/internet-hover.png +0 -0
  46. package/assets/images/internet.png +0 -0
  47. package/assets/images/kitchen-hover.png +0 -0
  48. package/assets/images/kitchen.png +0 -0
  49. package/assets/images/microwave-hover.png +0 -0
  50. package/assets/images/microwave.png +0 -0
  51. package/assets/images/moroccan-hover.png +0 -0
  52. package/assets/images/moroccan.png +0 -0
  53. package/assets/images/orientation-hover.png +0 -0
  54. package/assets/images/orientation.png +0 -0
  55. package/assets/images/oven-hover.png +0 -0
  56. package/assets/images/oven.png +0 -0
  57. package/assets/images/pool-hover.png +0 -0
  58. package/assets/images/pool.png +0 -0
  59. package/assets/images/satellite-hover.png +0 -0
  60. package/assets/images/satellite.png +0 -0
  61. package/assets/images/sea-hover.png +0 -0
  62. package/assets/images/sea.png +0 -0
  63. package/assets/images/security-hover.png +0 -0
  64. package/assets/images/security.png +0 -0
  65. package/assets/images/storage-hover.png +0 -0
  66. package/assets/images/storage.png +0 -0
  67. package/assets/images/terrace-hover.png +0 -0
  68. package/assets/images/terrace.png +0 -0
  69. package/assets/images/tv-hover.png +0 -0
  70. package/assets/images/tv.png +0 -0
  71. package/assets/images/views-hover.png +0 -0
  72. package/assets/images/views.png +0 -0
  73. package/assets/images/washing-hover.png +0 -0
  74. package/assets/images/washing.png +0 -0
package/EditHead.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
- import { Text, View, ImageBackground } from 'react-native';
2
+ import { Text, View } from 'react-native';
3
+ import { Image } from 'expo-image';
3
4
  import commonStyles from './commonStyles';
4
5
 
5
6
  export default class EditHead extends React.Component {
@@ -44,17 +45,15 @@ export default class EditHead extends React.Component {
44
45
 
45
46
  render() {
46
47
  return (
47
- <ImageBackground style={{ width: '100%' }} source={{ uri: this.state.mainPictureUrl }} resizeMode='cover'>
48
+ <View style={commonStyles.flex1}>
49
+ <Image style={{ width: '100%', height: 100 }} source={this.state.mainPictureUrl} contentFit='cover' />
48
50
  <View style={commonStyles.editBar}>
49
- {this.props.postingAd.reference && this.props.postingAd.reference != '' ?
51
+ {this.props.postingAd.reference && this.props.postingAd.reference != '' &&
50
52
  <View style={commonStyles.editRef}>
51
53
  <Text style={[commonStyles.editRefText, commonStyles.textLeft]}>REF: {this.props.postingAd.reference}</Text>
52
54
  </View>
53
- :
54
- <View style={commonStyles.editRef}>
55
- <Text style={[commonStyles.editRefText]}></Text>
56
- </View>
57
55
  }
56
+
58
57
  <View style={commonStyles.editTitle}>
59
58
  <Text style={[commonStyles.editTitleText]}>
60
59
  {this.props.postingAd.languages.filter(item => this.props.postingAd.languageId === item.language) > 0
@@ -66,7 +65,7 @@ export default class EditHead extends React.Component {
66
65
  </Text>
67
66
  </View>
68
67
  </View>
69
- </ImageBackground>
68
+ </View>
70
69
  );
71
70
  }
72
71
  }
package/Posting.js CHANGED
@@ -36,6 +36,7 @@ const LOAD_PENDING_CREATED = { method: 'GET', url: '/controller/ads/pending-crea
36
36
  const PAYMENT_ONLINE_ACTIVE = { method: 'GET', url: '/controller/payments-online/{countryCode}/active' };
37
37
  const LOAD_LOCATIONS = { method: 'GET', url: '/controller/countries/{countryCode}/locations' };
38
38
  const ALLOWED_TO_MODIFY = { method: 'GET', url: '/controller/posting/allowed-to-modify' };
39
+ const GET_FEATURES_OPTIONS = { method: 'GET', url: '/controller/posting/features-options' };
39
40
  const UPLOADED_FILES_KEY = 'uploadedFiles';
40
41
 
41
42
  export default class Posting extends React.Component {
@@ -69,6 +70,10 @@ export default class Posting extends React.Component {
69
70
  showRatePopup: false,
70
71
  originalAd: null,
71
72
  allowedToModify: {},
73
+ features: [],
74
+ mainFeatures: [],
75
+ insideFeatures: [],
76
+ otherFeatures: [],
72
77
  postingAd: {
73
78
  transaction: null,
74
79
  adType: null,
@@ -166,6 +171,10 @@ export default class Posting extends React.Component {
166
171
  {
167
172
  name: 'PostingFontAwesome',
168
173
  source: require('./fonts/Font-Awesome.ttf')
174
+ },
175
+ {
176
+ name: 'PostingFontAwesomeAd',
177
+ source: require('./fonts/Font-Awesome-ad.ttf')
169
178
  }
170
179
  ]);
171
180
  this.setState({ fontLoaded: true });
@@ -302,6 +311,18 @@ export default class Posting extends React.Component {
302
311
  }
303
312
  }
304
313
 
314
+ async loadFeatures() {
315
+ if (this.state.postingAd.adType) {
316
+ const responseJson = await this.props.request(this.props.context, GET_FEATURES_OPTIONS, { adTypeId: this.state.postingAd.adType });
317
+ this.setState({
318
+ features: responseJson.features,
319
+ mainFeatures: responseJson.mainFeatures,
320
+ insideFeatures: responseJson.insideFeatures,
321
+ otherFeatures: responseJson.otherFeatures
322
+ });
323
+ }
324
+ }
325
+
305
326
  async loadAd() {
306
327
  const bddAd = await this.getAd(this.state.adId);
307
328
  delete bddAd.phones;
@@ -365,6 +386,7 @@ export default class Posting extends React.Component {
365
386
  this.setState({ currentScreen: 2 });
366
387
  break;
367
388
  case Views.PUBLISH_3:
389
+ this.loadFeatures();
368
390
  this.setState({ currentScreen: 3 });
369
391
  break;
370
392
  case Views.PUBLISH_4:
@@ -594,6 +616,7 @@ export default class Posting extends React.Component {
594
616
  showLoading={() => this._showLoading()}
595
617
  hideLoading={() => this._hideLoading()}
596
618
  allowedToModify={this.state.allowedToModify}
619
+ features={this.state.features}
597
620
  fullPosting={this.state.fullPosting} />
598
621
  :
599
622
  null
@@ -626,6 +649,10 @@ export default class Posting extends React.Component {
626
649
  showLoading={() => this._showLoading()}
627
650
  hideLoading={() => this._hideLoading()}
628
651
  allowedToModify={this.state.allowedToModify}
652
+ features={this.state.features}
653
+ mainFeatures={this.state.mainFeatures}
654
+ insideFeatures={this.state.insideFeatures}
655
+ otherFeatures={this.state.otherFeatures}
629
656
  fullPosting={this.state.fullPosting} />
630
657
  :
631
658
  null
package/Publish3.js CHANGED
@@ -3,6 +3,7 @@ import { Text, View, TouchableHighlight } from 'react-native';
3
3
  import { strings } from 'muba-i18n';
4
4
  import commonStyles from './commonStyles';
5
5
  import RadioButtonGroup from 'muba-radio-button-group';
6
+ import CheckBoxOption from 'muba-checkbox';
6
7
  import InputNumber from './shared/InputNumber.js';
7
8
  import InputSelect from 'muba-input-select';
8
9
  import InputText from 'muba-input-text';
@@ -26,6 +27,9 @@ export default class Publish3 extends React.Component {
26
27
 
27
28
  this.state = {
28
29
  area: this.props.postingAd.adTypeDetails.filter(function (detail) { return detail.value == "surface" }),
30
+ utilArea: this.props.postingAd.adTypeDetails.filter(function (detail) { return detail.value == "utilSurface" }),
31
+ outsideArea: this.props.postingAd.adTypeDetails.filter(function (detail) { return detail.value == "outsideSurface" }),
32
+ plotArea: this.props.postingAd.adTypeDetails.filter(function (detail) { return detail.value == "plotSurface" }),
29
33
  condition: this.props.postingAd.adTypeDetails.filter(function (detail) { return detail.value == "conservation" }),
30
34
  pieces: this.props.postingAd.adTypeDetails.filter(function (detail) { return detail.value == "pieces" }),
31
35
  rooms: this.props.postingAd.adTypeDetails.filter(function (detail) { return detail.value == "rooms" }),
@@ -56,9 +60,22 @@ export default class Publish3 extends React.Component {
56
60
  ],
57
61
  selectedItem: this.props.postingAd.pricePeriod
58
62
  },
63
+ landTypesLabel: '',
64
+ landTypesOptions: [],
65
+ constructibilityLabel: '',
66
+ constructibilityOptions: {
67
+ elements: [
68
+ { section: true, value: null, label: strings('setup.select') }
69
+ ],
70
+ selectedItem: this.props.postingAd.constructibility
71
+ },
59
72
  surface: this.props.postingAd.surface,
73
+ utilSurface: this.props.postingAd.utilSurface,
74
+ outsideSurface: this.props.postingAd.outsideSurface,
75
+ plotSurface: this.props.postingAd.plotSurface,
60
76
  price: this.props.postingAd.price,
61
77
  adType: this.props.postingAd.adType,
78
+ landTypes: this.props.postingAd.landTypes != null ? this.props.postingAd.landTypes : [],
62
79
  requiredErrorCondition: false,
63
80
  priceError: null
64
81
  };
@@ -77,15 +94,44 @@ export default class Publish3 extends React.Component {
77
94
  }
78
95
 
79
96
  this.setState({ priceOptions: priceOptions });
97
+ this.loadFeaturesOptions();
80
98
  this.refreshData();
81
99
  }
82
100
 
101
+ async loadFeaturesOptions() {
102
+ const labels = {}
103
+ const options = {};
104
+ this.props.features.forEach(feature => {
105
+ if (feature.name === 'landTypes') {
106
+ options[feature.name + 'Options'] = [];
107
+ feature.options.map((item) => {
108
+ options[feature.name + 'Options'].push(item);
109
+ });
110
+ } else if (this.state[feature.name + 'Options']) {
111
+ options[feature.name + 'Options'] = { ...this.state[feature.name + 'Options'], elements: [...this.state[feature.name + 'Options'].elements] };
112
+ options[feature.name + 'Options'].elements[0].label = feature.label;
113
+ feature.options.map((item) => {
114
+ options[feature.name + 'Options'].elements.push(item);
115
+ });
116
+ }
117
+ labels[feature.name + 'Label'] = feature.label;
118
+ });
119
+
120
+ this.setState({
121
+ ...labels,
122
+ ...options
123
+ });
124
+ }
125
+
83
126
  async refreshData() {
84
127
  if (this.state.adType != this.props.postingAd.adType) {
85
128
  const pricePeriod = this.props.postingAd.adTypeDetails.filter(function (detail) { return detail.value == "pricePeriod" });
86
129
 
87
130
  await this.setState({
88
131
  area: this.props.postingAd.adTypeDetails.filter(function (detail) { return detail.value == "surface" }),
132
+ utilArea: this.props.postingAd.adTypeDetails.filter(function (detail) { return detail.value == "utilSurface" }),
133
+ outsideArea: this.props.postingAd.adTypeDetails.filter(function (detail) { return detail.value == "outsideSurface" }),
134
+ plotArea: this.props.postingAd.adTypeDetails.filter(function (detail) { return detail.value == "plotSurface" }),
89
135
  condition: this.props.postingAd.adTypeDetails.filter(function (detail) { return detail.value == "conservation" }),
90
136
  pieces: this.props.postingAd.adTypeDetails.filter(function (detail) { return detail.value == "pieces" }),
91
137
  rooms: this.props.postingAd.adTypeDetails.filter(function (detail) { return detail.value == "rooms" }),
@@ -188,6 +234,20 @@ export default class Publish3 extends React.Component {
188
234
  return validate;
189
235
  }
190
236
 
237
+ changeLandType = async (newLandType) => {
238
+ let currentLandTypes = Array.from(this.state.landTypes);
239
+ if (currentLandTypes.includes(newLandType)) {
240
+ currentLandTypes = currentLandTypes.filter(landType => newLandType !== landType);
241
+ } else {
242
+ currentLandTypes.push(newLandType);
243
+ }
244
+
245
+ this.props.postingAd.landTypes = currentLandTypes;
246
+ this.setState({
247
+ landTypes: currentLandTypes
248
+ });
249
+ }
250
+
191
251
  onChangeCondition(value) {
192
252
  this.props.postingAd.condition = value;
193
253
  }
@@ -197,6 +257,21 @@ export default class Publish3 extends React.Component {
197
257
  this.setState({ surface: text });
198
258
  }
199
259
 
260
+ onChangeUtilArea(text) {
261
+ this.props.postingAd.utilSurface = text;
262
+ this.setState({ utilSurface: text });
263
+ }
264
+
265
+ onChangeOutsideArea(text) {
266
+ this.props.postingAd.outsideSurface = text;
267
+ this.setState({ outsideSurface: text });
268
+ }
269
+
270
+ onChangePlotArea(text) {
271
+ this.props.postingAd.plotSurface = text;
272
+ this.setState({ plotSurface: text });
273
+ }
274
+
200
275
  onChangePrice(text) {
201
276
  this.props.postingAd.price = text;
202
277
  this.setState({ price: text });
@@ -239,6 +314,96 @@ export default class Publish3 extends React.Component {
239
314
  null
240
315
  }
241
316
 
317
+ {this.state.utilArea.length > 0 ?
318
+ <View style={commonStyles.row} >
319
+ <View style={commonStyles.col8}>
320
+ <InputText value={this.state.utilSurface}
321
+ textContainerStyle={commonStyles.inputContainer}
322
+ style={commonStyles.area}
323
+ label={this.state.utilArea[0].label}
324
+ labelStyle={commonStyles.progressbarField}
325
+ keyboardType='numeric'
326
+ type='number'
327
+ returnKeyType={"next"}
328
+ onlyNumbers={true}
329
+ required={false}
330
+ maxValue={999999}
331
+ disabled={!this.props.allowedToModify.utilSurface}
332
+ onChangeText={(text) => this.onChangeUtilArea(text)}
333
+ onSubmitEditing={(event) => { this.inputTextPrice.focus(); }}
334
+ scroll={(ref) => this.props.scroll(ref)}
335
+ ref={(element) => this.inputTextUtilArea = element} />
336
+ </View>
337
+ <View style={commonStyles.col4}>
338
+ <View style={[commonStyles.unit]}>
339
+ <Text style={commonStyles.unitText}>{strings('setup.measureSurface')}</Text>
340
+ </View>
341
+ </View>
342
+ </View>
343
+ :
344
+ null
345
+ }
346
+
347
+ {this.state.outsideArea.length > 0 ?
348
+ <View style={commonStyles.row} >
349
+ <View style={commonStyles.col8}>
350
+ <InputText value={this.state.outsideSurface}
351
+ textContainerStyle={commonStyles.inputContainer}
352
+ style={commonStyles.area}
353
+ label={this.state.outsideArea[0].label}
354
+ labelStyle={commonStyles.progressbarField}
355
+ keyboardType='numeric'
356
+ type='number'
357
+ returnKeyType={"next"}
358
+ onlyNumbers={true}
359
+ required={false}
360
+ maxValue={999999}
361
+ disabled={!this.props.allowedToModify.outsideSurface}
362
+ onChangeText={(text) => this.onChangeOutsideArea(text)}
363
+ onSubmitEditing={(event) => { this.inputTextPrice.focus(); }}
364
+ scroll={(ref) => this.props.scroll(ref)}
365
+ ref={(element) => this.inputTextOutsideArea = element} />
366
+ </View>
367
+ <View style={commonStyles.col4}>
368
+ <View style={[commonStyles.unit]}>
369
+ <Text style={commonStyles.unitText}>{strings('setup.measureSurface')}</Text>
370
+ </View>
371
+ </View>
372
+ </View>
373
+ :
374
+ null
375
+ }
376
+
377
+ {this.state.plotArea.length > 0 ?
378
+ <View style={commonStyles.row} >
379
+ <View style={commonStyles.col8}>
380
+ <InputText value={this.state.plotSurface}
381
+ textContainerStyle={commonStyles.inputContainer}
382
+ style={commonStyles.area}
383
+ label={this.state.plotArea[0].label}
384
+ labelStyle={commonStyles.progressbarField}
385
+ keyboardType='numeric'
386
+ type='number'
387
+ returnKeyType={"next"}
388
+ onlyNumbers={true}
389
+ required={false}
390
+ maxValue={999999}
391
+ disabled={!this.props.allowedToModify.plotSurface}
392
+ onChangeText={(text) => this.onChangePlotArea(text)}
393
+ onSubmitEditing={(event) => { this.inputTextPrice.focus(); }}
394
+ scroll={(ref) => this.props.scroll(ref)}
395
+ ref={(element) => this.inputTextPlotArea = element} />
396
+ </View>
397
+ <View style={commonStyles.col4}>
398
+ <View style={[commonStyles.unit]}>
399
+ <Text style={commonStyles.unitText}>{strings('setup.measureSurface')}</Text>
400
+ </View>
401
+ </View>
402
+ </View>
403
+ :
404
+ null
405
+ }
406
+
242
407
  <View style={commonStyles.row} >
243
408
  <View style={this.state.pricePeriod.length > 0 ? [commonStyles.col, commonStyles.col4] : [commonStyles.col, commonStyles.col8]}>
244
409
  <InputText value={this.state.price}
@@ -299,6 +464,41 @@ export default class Publish3 extends React.Component {
299
464
  null
300
465
  }
301
466
 
467
+ {this.state.landTypesOptions.length > 0 ?
468
+ <View>
469
+ <View style={commonStyles.minDivider} />
470
+ <View style={[commonStyles.row, commonStyles.inputNumberLabelBox]}>
471
+ <Text style={commonStyles.inputNumberLabel}>{this.state.landTypesLabel}</Text>
472
+ {this.props.required ? <Text style={commonStyles.red}> *</Text> : null}
473
+ {this.state.requiredError ? <Text style={[commonStyles.subNote, commonStyles.red]}> {strings('setup.requiredField')}</Text> : null}
474
+ </View>
475
+ {this.state.landTypesOptions.map((landType, index) =>
476
+ <View key={index + '_0'}>
477
+ <CheckBoxOption
478
+ disabled={!this.props.allowedToModify.landTypes}
479
+ onChange={() => this.changeLandType(landType.value)}
480
+ checked={this.state.landTypes.includes(landType.value)}
481
+ label={landType.label} />
482
+ </View>
483
+ )}
484
+ </View>
485
+ : null}
486
+
487
+ {this.state.constructibilityOptions.elements.length > 1 ?
488
+ <InputSelect
489
+ options={this.state.constructibilityOptions}
490
+ placeholder={strings('setup.select')}
491
+ required={false}
492
+ scroll={(ref) => this.props.scroll(ref)}
493
+ label={this.state.constructibilityLabel}
494
+ labelStyle={commonStyles.progressbarField}
495
+ selectStyle={commonStyles.inputSelect}
496
+ disabled={!this.props.allowedToModify.constructibility}
497
+ onChange={(value) => this.props.postingAd.constructibility = value}
498
+ ref={(element) => this.inputSelectConstructibility = element} />
499
+ :
500
+ null}
501
+
302
502
  <View style={[commonStyles.progressbarFieldContainer, commonStyles.row, commonStyles.col12, { flexWrap: 'wrap' }]}>
303
503
  {this.state.pieces.length > 0 ?
304
504
  <InputNumber