@plusscommunities/pluss-maintenance-app 4.0.2 → 4.0.4-auth.0

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 (48) hide show
  1. package/package.json +6 -3
  2. package/src/components/MaintenanceList.js +4 -2
  3. package/src/screens/RequestDetail.js +6 -0
  4. package/dist/module/actions/JobActions.js +0 -20
  5. package/dist/module/actions/JobActions.js.map +0 -1
  6. package/dist/module/actions/index.js +0 -2
  7. package/dist/module/actions/index.js.map +0 -1
  8. package/dist/module/actions/types.js +0 -4
  9. package/dist/module/actions/types.js.map +0 -1
  10. package/dist/module/apis/generalActions.js +0 -189
  11. package/dist/module/apis/generalActions.js.map +0 -1
  12. package/dist/module/apis/index.js +0 -2
  13. package/dist/module/apis/index.js.map +0 -1
  14. package/dist/module/components/FilterPopupMenu.js +0 -235
  15. package/dist/module/components/FilterPopupMenu.js.map +0 -1
  16. package/dist/module/components/MaintenanceList.js +0 -330
  17. package/dist/module/components/MaintenanceList.js.map +0 -1
  18. package/dist/module/components/MaintenanceListItem.js +0 -322
  19. package/dist/module/components/MaintenanceListItem.js.map +0 -1
  20. package/dist/module/components/MaintenanceWidgetItem.js +0 -152
  21. package/dist/module/components/MaintenanceWidgetItem.js.map +0 -1
  22. package/dist/module/components/StatusSelectorPopup.js +0 -88
  23. package/dist/module/components/StatusSelectorPopup.js.map +0 -1
  24. package/dist/module/components/WidgetLarge.js +0 -9
  25. package/dist/module/components/WidgetLarge.js.map +0 -1
  26. package/dist/module/components/WidgetSmall.js +0 -168
  27. package/dist/module/components/WidgetSmall.js.map +0 -1
  28. package/dist/module/core.config.js +0 -17
  29. package/dist/module/core.config.js.map +0 -1
  30. package/dist/module/feature.config.js +0 -90
  31. package/dist/module/feature.config.js.map +0 -1
  32. package/dist/module/helper.js +0 -25
  33. package/dist/module/helper.js.map +0 -1
  34. package/dist/module/images/speechbubble.png +0 -0
  35. package/dist/module/index.js +0 -20
  36. package/dist/module/index.js.map +0 -1
  37. package/dist/module/reducers/JobsReducer.js +0 -64
  38. package/dist/module/reducers/JobsReducer.js.map +0 -1
  39. package/dist/module/screens/JobTypePicker.js +0 -130
  40. package/dist/module/screens/JobTypePicker.js.map +0 -1
  41. package/dist/module/screens/MaintenancePage.js +0 -88
  42. package/dist/module/screens/MaintenancePage.js.map +0 -1
  43. package/dist/module/screens/RequestDetail.js +0 -793
  44. package/dist/module/screens/RequestDetail.js.map +0 -1
  45. package/dist/module/screens/RequestNotes.js +0 -387
  46. package/dist/module/screens/RequestNotes.js.map +0 -1
  47. package/dist/module/screens/ServiceRequest.js +0 -751
  48. package/dist/module/screens/ServiceRequest.js.map +0 -1
@@ -1,751 +0,0 @@
1
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
- import React, { Component } from 'react';
5
- import { Dimensions, Platform, KeyboardAvoidingView, ScrollView, Text, TouchableOpacity, View, Switch, FlatList, ImageBackground, Keyboard } from 'react-native';
6
- import _ from 'lodash';
7
- import { Icon } from 'react-native-elements';
8
- import { connect } from 'react-redux';
9
- import { jobAdded } from '../actions';
10
- import { generalActions } from '../apis';
11
- import { Services } from '../feature.config';
12
- import { Components, Colours, Helper, Config } from '../core.config';
13
- const PHOTO_SIZE = (Dimensions.get('window').width - 64) / 3;
14
- class MaintenanceRequest extends Component {
15
- constructor(props) {
16
- super(props);
17
- _defineProperty(this, "onUploadStarted", (uploadUri, imageUri) => {
18
- const images = [...this.state.images];
19
- images.splice(images.length - 1, 0, {
20
- uploading: true,
21
- uploadProgress: '0%',
22
- uploadUri,
23
- imageUri,
24
- allowRetry: true
25
- });
26
- this.setState({
27
- images
28
- });
29
- });
30
- _defineProperty(this, "onUploadProgress", progress => {
31
- const images = [...this.state.images];
32
- images.map(img => {
33
- if (img.uploadUri === progress.uri) {
34
- img.uploadProgress = progress.percentage;
35
- img.uploading = true;
36
- img.allowRetry = true;
37
- }
38
- });
39
- this.setState({
40
- images
41
- });
42
- });
43
- _defineProperty(this, "onUploadSuccess", async (uri, uploadUri) => {
44
- const images = [...this.state.images];
45
- images.map(img => {
46
- if (img.uploadUri === uploadUri && img.uploading) {
47
- img.url = uri.replace('/general/', '/general1400/');
48
- img.thumbNailExists = false;
49
- img.thumbNailUrl = Helper.getThumb300(img.url);
50
- img.allowRetry = true;
51
- }
52
- });
53
- this.setState({
54
- images
55
- }, () => this.waitForThumbnails());
56
- });
57
- _defineProperty(this, "onUploadFailed", uploadUri => {
58
- const images = [...this.state.images];
59
- images.map(img => {
60
- if (img.uploadUri === uploadUri) {
61
- img.uploading = true; // Requried for retry
62
- img.uploadProgress = '';
63
- img.allowRetry = true;
64
- }
65
- });
66
- this.setState({
67
- images
68
- });
69
- });
70
- _defineProperty(this, "onLibrarySelected", uri => {
71
- const images = [...this.state.images];
72
- images.splice(images.length - 1, 0, {
73
- uploading: false,
74
- allowRetry: false,
75
- url: Helper.get1400(uri),
76
- thumbNailExists: true,
77
- thumbNailUrl: Helper.getThumb300(uri)
78
- });
79
- this.setState({
80
- images
81
- });
82
- });
83
- _defineProperty(this, "showUploadMenu", () => {
84
- Keyboard.dismiss();
85
- if (this.state.uploadingImage || this.state.submitting) {
86
- return;
87
- }
88
- this.imageUploader.showUploadMenu();
89
- });
90
- _defineProperty(this, "submit", async () => {
91
- this.setState({
92
- submitting: true
93
- });
94
- let description = this.state.description;
95
- if (this.state.isHome) {
96
- description = description + `. -- Times Available: ${this.state.times}`;
97
- }
98
- setTimeout(() => {
99
- this.scrollContainer.scrollTo({
100
- y: 0
101
- });
102
- }, 100);
103
- const images = _.filter(this.state.images, img => {
104
- return !img.uploading && !img.add;
105
- }).map(img => {
106
- return img.url;
107
- });
108
- generalActions.sendMaintenanceRequest(this.props.uid, this.state.userName, this.state.phone, this.state.roomNumber, this.state.title, description, null, this.state.type, images, Helper.getSite(this.props.site), this.state.isHome, this.state.times).then(res => {
109
- if (res.data.success) {
110
- this.refreshRequest(res.data.searchResult);
111
- if (this.props.onSubmissionSuccess) this.props.onSubmissionSuccess(res.data);
112
- this.setState({
113
- submitting: false,
114
- success: true,
115
- confirmationToShow: true
116
- });
117
- } else {
118
- this.setState({
119
- submitting: false
120
- });
121
- }
122
- }).catch(err => {
123
- console.log('maintenance submission fail.');
124
- console.log(err);
125
- this.setState({
126
- submitting: false
127
- });
128
- });
129
- });
130
- _defineProperty(this, "refreshRequest", async id => {
131
- try {
132
- const job = await generalActions.getJob(Helper.getSite(this.props.site), id);
133
- // console.log('refreshRequest', job?.data);
134
- this.props.jobAdded(job.data);
135
- } catch (error) {
136
- console.log('refreshRequest error', error);
137
- }
138
- });
139
- _defineProperty(this, "waitForThumbnails", () => {
140
- if (this.checkThumb) return;
141
- this.checkThumb = setInterval(async () => {
142
- const images = [];
143
- await Promise.all(this.state.images.map(image => {
144
- return new Promise(async resolve => {
145
- const newImage = {
146
- ...image
147
- };
148
- images.push(newImage);
149
- if (newImage.url && !newImage.thumbNailExists) {
150
- newImage.uploading = false;
151
- newImage.allowRetry = false;
152
- newImage.thumbNailExists = await Helper.imageExists(newImage.thumbNailUrl);
153
- resolve(newImage.thumbNailExists);
154
- }
155
- resolve(true);
156
- });
157
- }));
158
- const thumbnailsExist = images.every(image => !image.url || image.thumbNailExists);
159
- if (thumbnailsExist) {
160
- clearInterval(this.checkThumb);
161
- this.checkThumb = null;
162
- this.setState({
163
- images
164
- });
165
- }
166
- }, 2000);
167
- });
168
- _defineProperty(this, "removeImage", index => {
169
- const images = [...this.state.images];
170
- images.splice(index, 1);
171
- this.setState({
172
- images
173
- });
174
- });
175
- _defineProperty(this, "toggleFullscreenVideo", url => {
176
- if (typeof url !== 'string') url = '';
177
- this.setState({
178
- showFullscreenVideo: url.length > 0,
179
- currentVideoUrl: url
180
- });
181
- });
182
- this.state = {
183
- submitting: false,
184
- success: false,
185
- fail: false,
186
- error: null,
187
- showError: false,
188
- userName: '',
189
- roomNumber: '',
190
- phone: '',
191
- title: '',
192
- description: '',
193
- times: '',
194
- type: 'General',
195
- uploadingImage: false,
196
- images: [{
197
- add: true
198
- }],
199
- showFullscreenVideo: false,
200
- currentVideoUrl: '',
201
- isHome: false,
202
- types: [],
203
- confirmationToShow: false
204
- };
205
- this.checkThumb = null;
206
- }
207
- componentDidMount() {
208
- if (this.props.userType !== 'KIOSK') {
209
- this.setState({
210
- userName: this.props.displayName,
211
- roomNumber: this.props.unit,
212
- phone: !_.isEmpty(this.props.phoneNumber) ? this.props.phoneNumber : ''
213
- });
214
- }
215
- this.getJobTypes();
216
- }
217
- componentWillUnmount() {
218
- clearInterval(this.checkThumb);
219
- }
220
- onPressBack() {
221
- Services.navigation.goBack();
222
- }
223
- onPressType() {
224
- Services.navigation.navigate('jobTypePicker', {
225
- currentType: this.state.type,
226
- types: this.state.types,
227
- onSelectType: this.pickType.bind(this)
228
- });
229
- }
230
- onCloseConfirmationPopup() {
231
- this.setState({
232
- confirmationToShow: false
233
- });
234
- Services.navigation.goBack();
235
- this.props.onBack && this.props.onBack();
236
- }
237
- onConfirmationReset() {
238
- this.setState({
239
- confirmationToShow: false,
240
- title: '',
241
- description: '',
242
- times: '',
243
- isHome: false,
244
- uploadingImage: false,
245
- images: [{
246
- add: true
247
- }],
248
- submitting: false,
249
- success: false,
250
- fail: false
251
- });
252
- }
253
- getJobTypes() {
254
- const self = this;
255
- generalActions.getJobTypes(Helper.getSite(this.props.site)).then(res => {
256
- self.setState({
257
- types: res.data
258
- });
259
- self.getDefaultJob();
260
- }).catch(() => {});
261
- }
262
- getDefaultJob() {
263
- if (this.state.types.length !== 0 && this.state.jobId == null) {
264
- this.setState({
265
- type: this.state.types[0].typeName
266
- });
267
- }
268
- }
269
- pickType(type) {
270
- this.setState({
271
- type
272
- });
273
- }
274
- submitRequest() {
275
- if (this.state.submitting || !this.props.connected) {
276
- if (!this.props.connected) {
277
- this.setState({
278
- error: {
279
- message: 'No internet connection detected'
280
- }
281
- });
282
- }
283
- return;
284
- }
285
- if (this.state.uploadingImage) {
286
- return;
287
- }
288
- this.setState({
289
- error: null,
290
- showError: false
291
- });
292
- if (this.state.title.length === 0 || !this.state.roomNumber || this.state.roomNumber.length === 0) {
293
- this.setState({
294
- showError: true
295
- });
296
- return;
297
- }
298
- if (this.state.isHome && this.state.times.length < 2) {
299
- this.setState({
300
- showError: true
301
- });
302
- return;
303
- }
304
- this.submit();
305
- }
306
- renderUploadMenu() {
307
- return /*#__PURE__*/React.createElement(Components.ImageUploader, {
308
- ref: ref => this.imageUploader = ref,
309
- onUploadStarted: this.onUploadStarted,
310
- onUploadSuccess: this.onUploadSuccess,
311
- onUploadFailed: this.onUploadFailed,
312
- onUploadProgress: this.onUploadProgress,
313
- onLibrarySelected: this.onLibrarySelected,
314
- size: {
315
- width: 1400
316
- },
317
- quality: 0.8,
318
- fileName: 'serviceImage',
319
- popupTitle: 'Upload Image',
320
- userId: this.props.uid,
321
- allowsEditing: false,
322
- multiple: true,
323
- hideLibrary: true
324
- });
325
- }
326
- renderImage(item, index) {
327
- const isVideoUrl = Helper.isVideo(item.url);
328
- if (item.add) {
329
- return /*#__PURE__*/React.createElement(TouchableOpacity, {
330
- activeOpacity: 0.8,
331
- onPress: this.showUploadMenu
332
- }, /*#__PURE__*/React.createElement(View, {
333
- style: [styles.imageContainer, this.state.images.length > 1 && styles.imageContainerNotEmpty, index % 3 === 0 && {
334
- marginLeft: 0
335
- }, index > 2 && {
336
- marginTop: 8
337
- }]
338
- }, /*#__PURE__*/React.createElement(View, {
339
- style: styles.imageCircle
340
- }, /*#__PURE__*/React.createElement(Icon, {
341
- name: "camera",
342
- type: "font-awesome",
343
- iconStyle: styles.addImageIcon
344
- }))));
345
- }
346
- return /*#__PURE__*/React.createElement(View, {
347
- style: [styles.imageContainer, this.state.images.length > 1 && styles.imageContainerNotEmpty, index % 3 === 0 && {
348
- marginLeft: 0
349
- }, index > 2 && {
350
- marginTop: 8
351
- }]
352
- }, item.uploading ? /*#__PURE__*/React.createElement(Components.ImageUploadProgress, {
353
- uploader: this.imageUploader,
354
- image: item,
355
- color: this.props.colourBrandingMain
356
- }) : /*#__PURE__*/React.createElement(ImageBackground, {
357
- style: styles.imageBackground,
358
- source: Helper.getImageSource(item.thumbNailExists ? item.thumbNailUrl : item.url)
359
- }, isVideoUrl && /*#__PURE__*/React.createElement(View, {
360
- style: styles.imagePlayContainer
361
- }, /*#__PURE__*/React.createElement(TouchableOpacity, {
362
- onPress: this.toggleFullscreenVideo.bind(this, item.url)
363
- }, /*#__PURE__*/React.createElement(Icon, {
364
- name: "play",
365
- type: "font-awesome",
366
- iconStyle: styles.imageControlIcon
367
- }))), /*#__PURE__*/React.createElement(TouchableOpacity, {
368
- style: styles.removeImage,
369
- onPress: this.removeImage.bind(this, index)
370
- }, /*#__PURE__*/React.createElement(Icon, {
371
- name: "remove",
372
- type: "font-awesome",
373
- iconStyle: styles.imageControlIcon,
374
- style: styles.removeImage
375
- }))));
376
- }
377
- renderSuccess() {
378
- return /*#__PURE__*/React.createElement(View, {
379
- style: {
380
- padding: 16,
381
- flex: 1,
382
- backgroundColor: '#fff'
383
- }
384
- }, /*#__PURE__*/React.createElement(Text, {
385
- style: styles.requestSuccess
386
- }, "Your request has been submitted. Thank you."));
387
- }
388
- renderImageList() {
389
- return /*#__PURE__*/React.createElement(View, {
390
- style: styles.imageSection
391
- }, /*#__PURE__*/React.createElement(View, {
392
- style: [styles.imageListContainer, this.state.images.length < 2 && styles.imageListContainerEmpty]
393
- }, /*#__PURE__*/React.createElement(FlatList, {
394
- keyboardShouldPersistTaps: "always",
395
- enableEmptySections: true,
396
- data: this.state.images,
397
- renderItem: _ref => {
398
- let {
399
- item,
400
- index
401
- } = _ref;
402
- return this.renderImage(item, index);
403
- },
404
- keyExtractor: (item, index) => index,
405
- numColumns: 3
406
- })));
407
- }
408
- renderForm() {
409
- return /*#__PURE__*/React.createElement(View, {
410
- style: {
411
- flex: 1
412
- }
413
- }, /*#__PURE__*/React.createElement(ScrollView, {
414
- keyboardShouldPersistTaps: "always",
415
- style: {
416
- flex: 1
417
- },
418
- ref: ref => this.scrollContainer = ref
419
- }, /*#__PURE__*/React.createElement(View, {
420
- style: {
421
- paddingBottom: 2
422
- }
423
- }, /*#__PURE__*/React.createElement(Components.LoadingIndicator, {
424
- visible: this.state.submitting
425
- }), this.state.error && /*#__PURE__*/React.createElement(Text, {
426
- style: styles.errorText
427
- }, this.state.error), /*#__PURE__*/React.createElement(Components.FormCard, {
428
- style: {
429
- marginTop: 16
430
- }
431
- }, /*#__PURE__*/React.createElement(Components.FormCardSection, {
432
- label: 'Name',
433
- placeholder: 'Enter your name',
434
- textValue: this.state.userName,
435
- onChangeText: userName => this.setState({
436
- userName
437
- }),
438
- editable: this.props.userType === 'KIOSK' && this.state.submitting === false,
439
- isValid: () => {
440
- return this.state.userName.length > 1;
441
- },
442
- required: true,
443
- errorText: "Please enter your name.",
444
- showError: this.state.showError && this.state.userName.length < 2,
445
- hasUnderline: true
446
- }), /*#__PURE__*/React.createElement(Components.FormCardSection, {
447
- label: 'Contact number',
448
- placeholder: 'Enter phone number',
449
- textValue: this.state.phone,
450
- onChangeText: phone => this.setState({
451
- phone
452
- }),
453
- editable: this.state.submitting === false,
454
- hasUnderline: true,
455
- keyboardType: 'phone-pad'
456
- }), /*#__PURE__*/React.createElement(Components.FormCardSection, {
457
- label: 'Address',
458
- placeholder: 'Enter your address',
459
- textValue: this.state.roomNumber,
460
- onChangeText: roomNumber => this.setState({
461
- roomNumber
462
- }),
463
- editable: this.state.submitting === false,
464
- hasUnderline: true,
465
- isValid: () => {
466
- return this.state.roomNumber && this.state.roomNumber.length > 1;
467
- },
468
- required: true,
469
- errorText: "Please provide your address.",
470
- showError: this.state.showError && this.state.roomNumber && this.state.roomNumber.length < 2
471
- })), /*#__PURE__*/React.createElement(Components.FormCard, {
472
- style: {
473
- marginTop: 16,
474
- paddingHorizontal: 24,
475
- paddingVertical: 16,
476
- flexDirection: 'row',
477
- justifyContent: 'space-between'
478
- }
479
- }, /*#__PURE__*/React.createElement(Text, {
480
- style: styles.sectionTitle
481
- }, Config.env.strings.JOB_TYPE), /*#__PURE__*/React.createElement(TouchableOpacity, {
482
- onPress: this.onPressType.bind(this)
483
- }, /*#__PURE__*/React.createElement(View, {
484
- style: {
485
- flexDirection: 'row'
486
- }
487
- }, /*#__PURE__*/React.createElement(Text, {
488
- style: [styles.sectionTitle, {
489
- color: this.props.colourBrandingMain,
490
- marginRight: 16
491
- }]
492
- }, this.state.type), /*#__PURE__*/React.createElement(Icon, {
493
- name: "angle-right",
494
- type: "font-awesome",
495
- iconStyle: [styles.sectionTitle, {
496
- fontSize: 20,
497
- color: this.props.colourBrandingMain
498
- }]
499
- })))), /*#__PURE__*/React.createElement(Components.FormCard, {
500
- style: {
501
- marginTop: 16
502
- }
503
- }, /*#__PURE__*/React.createElement(Components.FormCardSection, {
504
- label: 'Title',
505
- placeholder: 'Enter a title for your request',
506
- textValue: this.state.title,
507
- onChangeText: title => this.setState({
508
- title
509
- }),
510
- editable: this.state.submitting === false,
511
- hasUnderline: true,
512
- isValid: () => {
513
- return this.state.title.length > 1;
514
- },
515
- required: true,
516
- errorText: "Please provide a title.",
517
- showError: this.state.showError && this.state.title.length < 2,
518
- autoCorrect: true,
519
- multiline: true,
520
- autoGrow: true
521
- }), /*#__PURE__*/React.createElement(Components.FormCardSection, {
522
- label: 'Description',
523
- placeholder: 'Describe your request here in detail',
524
- textValue: this.state.description,
525
- onChangeText: description => this.setState({
526
- description
527
- }),
528
- editable: this.state.submitting === false,
529
- hasUnderline: true,
530
- autoCorrect: true,
531
- multiline: true,
532
- autoGrow: true
533
- })), /*#__PURE__*/React.createElement(Components.FormCard, {
534
- style: {
535
- marginTop: 16,
536
- paddingHorizontal: 24
537
- }
538
- }, /*#__PURE__*/React.createElement(View, {
539
- style: [{
540
- width: '100%',
541
- paddingVertical: 16,
542
- flexDirection: 'row',
543
- justifyContent: 'space-between',
544
- alignItems: 'center',
545
- position: 'relative'
546
- }, this.state.isHome && {
547
- borderBottomWidth: 1,
548
- borderBottomColor: Colours.LINEGREY
549
- }]
550
- }, /*#__PURE__*/React.createElement(Text, {
551
- style: styles.sectionTitle
552
- }, Config.env.strings.MAINTENANCE_HOME), /*#__PURE__*/React.createElement(Switch, {
553
- value: this.state.isHome,
554
- disabled: this.state.submitting,
555
- onValueChange: value => this.setState({
556
- isHome: value
557
- }),
558
- trackColor: {
559
- false: '#ddd',
560
- true: this.props.colourBrandingMain
561
- },
562
- thumbColor: Platform.OS === 'android' ? '#fff' : null
563
- })), this.state.isHome && /*#__PURE__*/React.createElement(Components.FormCardSection, {
564
- label: 'Available times',
565
- placeholder: 'Describe your available times here in detail.',
566
- textValue: this.state.times,
567
- onChangeText: times => this.setState({
568
- times
569
- }),
570
- editable: this.state.submitting === false,
571
- hasUnderline: true,
572
- isValid: () => {
573
- return this.state.times.length > 1;
574
- },
575
- required: true,
576
- errorText: "Please provide available times.",
577
- showError: this.state.showError && this.state.isHome && this.state.times.length < 2,
578
- minHeight: 40,
579
- autoCorrect: true,
580
- multiline: true,
581
- autoGrow: true
582
- })), this.renderImageList())));
583
- }
584
- renderRegisterConfirmation() {
585
- return /*#__PURE__*/React.createElement(Components.ConfirmationPopup, {
586
- confirmText: 'Request submitted',
587
- repeatText: 'Submit another',
588
- visible: this.state.confirmationToShow,
589
- onClose: this.onCloseConfirmationPopup.bind(this),
590
- onPressAction: this.onConfirmationReset.bind(this)
591
- });
592
- }
593
- renderVideoPlayerPopup() {
594
- const {
595
- showFullscreenVideo,
596
- currentVideoUrl
597
- } = this.state;
598
- if (!currentVideoUrl) return;
599
- return /*#__PURE__*/React.createElement(Components.VideoPopup, {
600
- uri: currentVideoUrl,
601
- visible: showFullscreenVideo,
602
- showFullscreenButton: false,
603
- onClose: this.toggleFullscreenVideo
604
- });
605
- }
606
- render() {
607
- return /*#__PURE__*/React.createElement(KeyboardAvoidingView, {
608
- behavior: Platform.OS === 'ios' && 'padding',
609
- style: styles.viewContainer
610
- }, this.renderUploadMenu(), /*#__PURE__*/React.createElement(View, {
611
- style: styles.container
612
- }, /*#__PURE__*/React.createElement(Components.Header, {
613
- leftIcon: "angle-left",
614
- onPressLeft: this.onPressBack.bind(this),
615
- text: Config.env.strings.MAINTENANCE,
616
- rightText: this.state.submitting || this.state.success ? null : 'Done',
617
- onPressRight: this.submitRequest.bind(this),
618
- absoluteRight: true
619
- }), this.renderForm()), this.renderRegisterConfirmation(), this.renderVideoPlayerPopup());
620
- }
621
- }
622
- const styles = {
623
- viewContainer: {
624
- flex: 1,
625
- backgroundColor: '#fff'
626
- },
627
- container: {
628
- flex: 1,
629
- position: 'relative',
630
- backgroundColor: '#f0f0f5'
631
- },
632
- errorText: {
633
- fontFamily: 'sf-regular',
634
- color: Colours.COLOUR_TANGERINE,
635
- fontSize: 16
636
- },
637
- requestSuccess: {
638
- fontFamily: 'sf-regular',
639
- color: Colours.TEXT_DARK,
640
- fontSize: 17,
641
- textAlign: 'center'
642
- },
643
- sectionTitle: {
644
- fontFamily: 'sf-regular',
645
- fontSize: 17,
646
- color: Colours.TEXT_DARK
647
- },
648
- imageListContainer: {
649
- marginTop: 8,
650
- padding: 8,
651
- flexDirection: 'row',
652
- backgroundColor: Colours.BOXGREY,
653
- minHeight: 106
654
- },
655
- imageListContainerEmpty: {
656
- justifyContent: 'center',
657
- alignItems: 'center',
658
- flexDirection: 'column'
659
- },
660
- imageContainer: {
661
- width: PHOTO_SIZE,
662
- height: PHOTO_SIZE,
663
- borderStyle: 'dashed',
664
- justifyContent: 'center',
665
- alignItems: 'center',
666
- borderWidth: 1,
667
- borderColor: Colours.LINEGREY,
668
- borderRadius: 4,
669
- marginLeft: 8
670
- },
671
- imageContainerNotEmpty: {
672
- borderWidth: 1,
673
- borderColor: Colours.LINEGREY,
674
- backgroundColor: '#fff',
675
- borderStyle: 'dashed'
676
- },
677
- imageBackground: {
678
- flex: 1,
679
- height: '100%',
680
- width: '100%',
681
- borderRadius: 4
682
- },
683
- imageCircle: {
684
- width: 90,
685
- height: 90,
686
- borderRadius: 45,
687
- backgroundColor: Colours.PINKISH_GREY,
688
- justifyContent: 'center'
689
- },
690
- addImageIcon: {
691
- color: '#fff',
692
- fontSize: 32
693
- },
694
- imagePlayContainer: {
695
- position: 'absolute',
696
- top: 0,
697
- left: 0,
698
- right: 0,
699
- bottom: 0,
700
- alignItems: 'center',
701
- justifyContent: 'center'
702
- },
703
- imageControlIcon: {
704
- color: '#fff',
705
- fontSize: 20,
706
- textShadowColor: 'rgba(0,0,0,0.3)',
707
- textShadowOffset: {
708
- width: 2,
709
- height: 2
710
- }
711
- },
712
- removeImage: {
713
- position: 'absolute',
714
- top: 0,
715
- right: 0,
716
- padding: 4,
717
- width: 40,
718
- height: 40,
719
- alignItems: 'center',
720
- justifyContent: 'center'
721
- }
722
- };
723
- const mapStateToProps = state => {
724
- const {
725
- user,
726
- connection
727
- } = state;
728
- const {
729
- displayName,
730
- profilePic,
731
- uid,
732
- site,
733
- unit,
734
- phoneNumber
735
- } = user;
736
- return {
737
- connected: connection.connected,
738
- userType: user.type,
739
- displayName,
740
- profilePic,
741
- uid,
742
- site,
743
- unit,
744
- phoneNumber,
745
- colourBrandingMain: Colours.getMainBrandingColourFromState(state)
746
- };
747
- };
748
- export default connect(mapStateToProps, {
749
- jobAdded
750
- })(MaintenanceRequest);
751
- //# sourceMappingURL=ServiceRequest.js.map