muba-posting 9.0.16 → 9.0.18

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 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.props.postingAd[feature.name] = value} />
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}
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.props.postingAd[feature.name] = value} />
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.props.postingAd[feature.name] = value} />
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.col3]}>
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/Publish6.js CHANGED
@@ -15,6 +15,7 @@ const FontAwesomeIcon = createIconSetFromFontello(fontelloConfig);
15
15
 
16
16
  const GENERATE_TITLE_DESCRIPTION = { method: 'GET', url: '/controller/posting/generate-title-description' };
17
17
  const PHONE_REGISTERED = { method: 'GET', url: '/controller/posting/phone-registered' };
18
+ const CHECK_VIRTUAL_VISIT = { method: 'GET', url: '/controller/posting/check-virtual-visit' };
18
19
  const PHONE_SEPARATOR = '###';
19
20
 
20
21
  let submitClicked;
@@ -30,10 +31,12 @@ export default class Publish6 extends React.Component {
30
31
  this.state = {
31
32
  hideSave: false,
32
33
  requiredPhoneError: false,
34
+ virtualVisitError: false,
33
35
  titleDescriptionLoaded: false,
34
36
  languages: this.props.postingAd.languages,
35
37
  picturesUploaded: 0,
36
38
  reference: this.props.postingAd.reference,
39
+ virtualVisit: this.props.postingAd.virtualVisit,
37
40
  showResetPassword: false,
38
41
  showLogin: false,
39
42
  accessUsers: {
@@ -171,10 +174,16 @@ export default class Publish6 extends React.Component {
171
174
 
172
175
  this.languageItem.forEach(element => validate = element.validateLanguageItem() && validate);
173
176
  }
177
+ this.setState({
178
+ requiredPhoneError: !validate,
179
+ loading: false
180
+ });
174
181
 
175
- this.setState({ loading: false });
176
-
177
- this.setState({ requiredPhoneError: !validate });
182
+ if (this.state.virtualVisit != null && this.state.virtualVisit !== '') {
183
+ const virtualVisitResponse = await this.props.request(this.props.context, CHECK_VIRTUAL_VISIT, { virtualVisitUrl: this.state.virtualVisit });
184
+ validate = virtualVisitResponse.valid && validate;
185
+ this.setState({ virtualVisitError: !virtualVisitResponse.valid });
186
+ }
178
187
 
179
188
  if (this.reference) {
180
189
  validate = this.reference.onSubmitValidate() && validate;
@@ -196,6 +205,11 @@ export default class Publish6 extends React.Component {
196
205
  this.setState({ reference: text });
197
206
  }
198
207
 
208
+ onChangeVirtualVisit(text) {
209
+ this.props.postingAd.virtualVisit = text;
210
+ this.setState({ virtualVisit: text });
211
+ }
212
+
199
213
  login() {
200
214
  this.popupPhoneRegistered.hide();
201
215
  navigate(this.props.context, Views.LOGIN, { RedirectTo: 'back', disableRegister: true, loadLeadData: false, lu: this.state.lu })
@@ -236,6 +250,26 @@ export default class Publish6 extends React.Component {
236
250
  returnKeyType={"next"}
237
251
  maxLength={50}
238
252
  disabled={!this.props.allowedToModify.clientRef}
253
+ onSubmitEditing={(event) => { this.virtualVisit.current.focus(); }} />
254
+ </View>
255
+ :
256
+ null
257
+ }
258
+
259
+ {this.props.businessId ?
260
+ <View style={this.state.virtualVisitError ? [commonStyles.progressbarFieldContainer, commonStyles.fieldError] : commonStyles.progressbarFieldContainer}>
261
+ <View style={commonStyles.row}>
262
+ <Text style={commonStyles.progressbarField}>{strings('setup.virtualVisit')}</Text>
263
+ <Text style={commonStyles.subNote}> {strings('setup.virtualVisitHttps')}</Text>
264
+ </View>
265
+ <InputText value={this.state.virtualVisit} ref={(element) => this.virtualVisit = element}
266
+ placeholder={strings('setup.virtualVisit')}
267
+ required={false} onChangeText={(text) => this.onChangeVirtualVisit(text)}
268
+ style={commonStyles.input}
269
+ textContainerStyle={{ marginTop: 10 }}
270
+ returnKeyType={"next"}
271
+ maxLength={512}
272
+ disabled={!this.props.allowedToModify.virtualVisit}
239
273
  onSubmitEditing={(event) => { this.phoneGroupRef.current.focus(); }} />
240
274
  </View>
241
275
  :
package/locales/ar.json CHANGED
@@ -46,6 +46,8 @@
46
46
  "phone": "الهواتف",
47
47
  "reference": "المرجع",
48
48
  "uniqueReference": "استخدم مرجعًا وحيدا للإعلان",
49
+ "virtualVisit": "زيارة افتراضية",
50
+ "virtualVisitHttps": "(//:https)",
49
51
  "maxPhones": "الحد الأقصى 3 هواتف",
50
52
  "existingPhone": "تم تخصيص هذا الرقم الهاتفي لمستخدم آخر‎",
51
53
  "legalNote": "من خلال خلق هذا الإعلان ، فإنك توافق على شروط الاستخدام و سياسة الخصوصية الخاصة بشركة مبوب. نحن نحتفظ بالحق في حذف و / أو تعديل الإعلانات غير اللائقة.",
package/locales/en.json CHANGED
@@ -46,6 +46,8 @@
46
46
  "phone": "Phones",
47
47
  "reference": "Reference",
48
48
  "uniqueReference": "Use a unique reference for the ad",
49
+ "virtualVisit": "Virtual tour",
50
+ "virtualVisitHttps": "(https://)",
49
51
  "maxPhones": "Maximum 3 phones",
50
52
  "existingPhone": "This phone number is already used by another user",
51
53
  "legalNote": "By creating this ad, you agree to Mubawab's Terms of Use and Privacy Policy. We reserve the right to delete and / or modify inappropriate ads.",
package/locales/es.json CHANGED
@@ -46,6 +46,8 @@
46
46
  "phone": "Teléfonos",
47
47
  "reference": "Referencia",
48
48
  "uniqueReference": "Utiliza una referencia única por anuncio",
49
+ "virtualVisit": "Tour virtual",
50
+ "virtualVisitHttps": "(https://)",
49
51
  "maxPhones": "Máximo 3 teléfonos",
50
52
  "existingPhone": "Este teléfono ya lo ha utilizado otro usuario",
51
53
  "legalNote": "Al crear este anuncio, aceptas los Términos de uso y la Política de privacidad de Mubawab. Nos reservamos el derecho de eliminar y/o modificar anuncios inapropiados.",
package/locales/fr.json CHANGED
@@ -46,6 +46,8 @@
46
46
  "phone": "Téléphones",
47
47
  "reference": "Référence",
48
48
  "uniqueReference": "Utiliser une référence unique pour l'annonce",
49
+ "virtualVisit": "Visite virtuelle",
50
+ "virtualVisitHttps": "(https://)",
49
51
  "maxPhones": "Maximum 3 téléphones",
50
52
  "existingPhone": "Ce numéro de téléphone est déjà attribué à un autre utilisateur",
51
53
  "legalNote": "En créant cette annonce, vous acceptez les conditions d'utilisation et la politique de confidentialité de Mubawab. Nous nous réservons le droit de supprimer et/ou de modifier des annonces inappropriées.",
package/locales/it.json CHANGED
@@ -46,6 +46,8 @@
46
46
  "phone": "Numero/i di telefono",
47
47
  "reference": "Riferimento",
48
48
  "uniqueReference": "Usa un unico riferimento per l'annuncio",
49
+ "virtualVisit": "Tour virtuale",
50
+ "virtualVisitHttps": "(https://)",
49
51
  "maxPhones": "Massimo 3 telefoni",
50
52
  "existingPhone": "Il numero di telefono è già usato da un altro utente",
51
53
  "legalNote": "Creando questo annuncio accetti i termini di utilizzo e la politica sulla privacy di Mubawab. Ci riserviamo il diritto di eliminare e/o modificare annunci inappropriati.",
package/locales/nl.json CHANGED
@@ -46,6 +46,8 @@
46
46
  "phone": "Telefoonnummer(s)",
47
47
  "reference": "Referentie",
48
48
  "uniqueReference": "Gebruik een uniek referentienummer voor de advertentie",
49
+ "virtualVisit": "Virtuele tour",
50
+ "virtualVisitHttps": "(https://)",
49
51
  "maxPhones": "Maximaal 3 telefoons",
50
52
  "existingPhone": "Dit telefoonnummer wordt al gebruikt door een andere gebruiker",
51
53
  "legalNote": "Door deze advertentie te maken, gaat u akkoord met de Gebruiksvoorwaarden en het Privacybeleid van Mubawab. We behouden ons het recht voor om ongepaste advertenties te verwijderen en/of te wijzigen.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muba-posting",
3
- "version": "9.0.16",
3
+ "version": "9.0.18",
4
4
  "description": "Posting",
5
5
  "main": "Posting.js",
6
6
  "scripts": {