@plusscommunities/pluss-maintenance-app 4.0.3 → 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.
- package/package.json +6 -3
- package/dist/module/actions/JobActions.js +0 -20
- package/dist/module/actions/JobActions.js.map +0 -1
- package/dist/module/actions/index.js +0 -2
- package/dist/module/actions/index.js.map +0 -1
- package/dist/module/actions/types.js +0 -4
- package/dist/module/actions/types.js.map +0 -1
- package/dist/module/apis/generalActions.js +0 -186
- package/dist/module/apis/generalActions.js.map +0 -1
- package/dist/module/apis/index.js +0 -2
- package/dist/module/apis/index.js.map +0 -1
- package/dist/module/components/FilterPopupMenu.js +0 -235
- package/dist/module/components/FilterPopupMenu.js.map +0 -1
- package/dist/module/components/MaintenanceList.js +0 -325
- package/dist/module/components/MaintenanceList.js.map +0 -1
- package/dist/module/components/MaintenanceListItem.js +0 -322
- package/dist/module/components/MaintenanceListItem.js.map +0 -1
- package/dist/module/components/MaintenanceWidgetItem.js +0 -152
- package/dist/module/components/MaintenanceWidgetItem.js.map +0 -1
- package/dist/module/components/StatusSelectorPopup.js +0 -88
- package/dist/module/components/StatusSelectorPopup.js.map +0 -1
- package/dist/module/components/WidgetLarge.js +0 -9
- package/dist/module/components/WidgetLarge.js.map +0 -1
- package/dist/module/components/WidgetSmall.js +0 -168
- package/dist/module/components/WidgetSmall.js.map +0 -1
- package/dist/module/core.config.js +0 -17
- package/dist/module/core.config.js.map +0 -1
- package/dist/module/feature.config.js +0 -90
- package/dist/module/feature.config.js.map +0 -1
- package/dist/module/helper.js +0 -25
- package/dist/module/helper.js.map +0 -1
- package/dist/module/images/speechbubble.png +0 -0
- package/dist/module/index.js +0 -20
- package/dist/module/index.js.map +0 -1
- package/dist/module/reducers/JobsReducer.js +0 -62
- package/dist/module/reducers/JobsReducer.js.map +0 -1
- package/dist/module/screens/JobTypePicker.js +0 -130
- package/dist/module/screens/JobTypePicker.js.map +0 -1
- package/dist/module/screens/MaintenancePage.js +0 -88
- package/dist/module/screens/MaintenancePage.js.map +0 -1
- package/dist/module/screens/RequestDetail.js +0 -798
- package/dist/module/screens/RequestDetail.js.map +0 -1
- package/dist/module/screens/RequestNotes.js +0 -387
- package/dist/module/screens/RequestNotes.js.map +0 -1
- package/dist/module/screens/ServiceRequest.js +0 -748
- package/dist/module/screens/ServiceRequest.js.map +0 -1
@@ -1,748 +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(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
3
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
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: ({
|
398
|
-
item,
|
399
|
-
index
|
400
|
-
}) => this.renderImage(item, index),
|
401
|
-
keyExtractor: (item, index) => index,
|
402
|
-
numColumns: 3
|
403
|
-
})));
|
404
|
-
}
|
405
|
-
renderForm() {
|
406
|
-
return /*#__PURE__*/React.createElement(View, {
|
407
|
-
style: {
|
408
|
-
flex: 1
|
409
|
-
}
|
410
|
-
}, /*#__PURE__*/React.createElement(ScrollView, {
|
411
|
-
keyboardShouldPersistTaps: "always",
|
412
|
-
style: {
|
413
|
-
flex: 1
|
414
|
-
},
|
415
|
-
ref: ref => this.scrollContainer = ref
|
416
|
-
}, /*#__PURE__*/React.createElement(View, {
|
417
|
-
style: {
|
418
|
-
paddingBottom: 2
|
419
|
-
}
|
420
|
-
}, /*#__PURE__*/React.createElement(Components.LoadingIndicator, {
|
421
|
-
visible: this.state.submitting
|
422
|
-
}), this.state.error && /*#__PURE__*/React.createElement(Text, {
|
423
|
-
style: styles.errorText
|
424
|
-
}, this.state.error), /*#__PURE__*/React.createElement(Components.FormCard, {
|
425
|
-
style: {
|
426
|
-
marginTop: 16
|
427
|
-
}
|
428
|
-
}, /*#__PURE__*/React.createElement(Components.FormCardSection, {
|
429
|
-
label: 'Name',
|
430
|
-
placeholder: 'Enter your name',
|
431
|
-
textValue: this.state.userName,
|
432
|
-
onChangeText: userName => this.setState({
|
433
|
-
userName
|
434
|
-
}),
|
435
|
-
editable: this.props.userType === 'KIOSK' && this.state.submitting === false,
|
436
|
-
isValid: () => {
|
437
|
-
return this.state.userName.length > 1;
|
438
|
-
},
|
439
|
-
required: true,
|
440
|
-
errorText: "Please enter your name.",
|
441
|
-
showError: this.state.showError && this.state.userName.length < 2,
|
442
|
-
hasUnderline: true
|
443
|
-
}), /*#__PURE__*/React.createElement(Components.FormCardSection, {
|
444
|
-
label: 'Contact number',
|
445
|
-
placeholder: 'Enter phone number',
|
446
|
-
textValue: this.state.phone,
|
447
|
-
onChangeText: phone => this.setState({
|
448
|
-
phone
|
449
|
-
}),
|
450
|
-
editable: this.state.submitting === false,
|
451
|
-
hasUnderline: true,
|
452
|
-
keyboardType: 'phone-pad'
|
453
|
-
}), /*#__PURE__*/React.createElement(Components.FormCardSection, {
|
454
|
-
label: 'Address',
|
455
|
-
placeholder: 'Enter your address',
|
456
|
-
textValue: this.state.roomNumber,
|
457
|
-
onChangeText: roomNumber => this.setState({
|
458
|
-
roomNumber
|
459
|
-
}),
|
460
|
-
editable: this.state.submitting === false,
|
461
|
-
hasUnderline: true,
|
462
|
-
isValid: () => {
|
463
|
-
return this.state.roomNumber && this.state.roomNumber.length > 1;
|
464
|
-
},
|
465
|
-
required: true,
|
466
|
-
errorText: "Please provide your address.",
|
467
|
-
showError: this.state.showError && this.state.roomNumber && this.state.roomNumber.length < 2
|
468
|
-
})), /*#__PURE__*/React.createElement(Components.FormCard, {
|
469
|
-
style: {
|
470
|
-
marginTop: 16,
|
471
|
-
paddingHorizontal: 24,
|
472
|
-
paddingVertical: 16,
|
473
|
-
flexDirection: 'row',
|
474
|
-
justifyContent: 'space-between'
|
475
|
-
}
|
476
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
477
|
-
style: styles.sectionTitle
|
478
|
-
}, Config.env.strings.JOB_TYPE), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
479
|
-
onPress: this.onPressType.bind(this)
|
480
|
-
}, /*#__PURE__*/React.createElement(View, {
|
481
|
-
style: {
|
482
|
-
flexDirection: 'row'
|
483
|
-
}
|
484
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
485
|
-
style: [styles.sectionTitle, {
|
486
|
-
color: this.props.colourBrandingMain,
|
487
|
-
marginRight: 16
|
488
|
-
}]
|
489
|
-
}, this.state.type), /*#__PURE__*/React.createElement(Icon, {
|
490
|
-
name: "angle-right",
|
491
|
-
type: "font-awesome",
|
492
|
-
iconStyle: [styles.sectionTitle, {
|
493
|
-
fontSize: 20,
|
494
|
-
color: this.props.colourBrandingMain
|
495
|
-
}]
|
496
|
-
})))), /*#__PURE__*/React.createElement(Components.FormCard, {
|
497
|
-
style: {
|
498
|
-
marginTop: 16
|
499
|
-
}
|
500
|
-
}, /*#__PURE__*/React.createElement(Components.FormCardSection, {
|
501
|
-
label: 'Title',
|
502
|
-
placeholder: 'Enter a title for your request',
|
503
|
-
textValue: this.state.title,
|
504
|
-
onChangeText: title => this.setState({
|
505
|
-
title
|
506
|
-
}),
|
507
|
-
editable: this.state.submitting === false,
|
508
|
-
hasUnderline: true,
|
509
|
-
isValid: () => {
|
510
|
-
return this.state.title.length > 1;
|
511
|
-
},
|
512
|
-
required: true,
|
513
|
-
errorText: "Please provide a title.",
|
514
|
-
showError: this.state.showError && this.state.title.length < 2,
|
515
|
-
autoCorrect: true,
|
516
|
-
multiline: true,
|
517
|
-
autoGrow: true
|
518
|
-
}), /*#__PURE__*/React.createElement(Components.FormCardSection, {
|
519
|
-
label: 'Description',
|
520
|
-
placeholder: 'Describe your request here in detail',
|
521
|
-
textValue: this.state.description,
|
522
|
-
onChangeText: description => this.setState({
|
523
|
-
description
|
524
|
-
}),
|
525
|
-
editable: this.state.submitting === false,
|
526
|
-
hasUnderline: true,
|
527
|
-
autoCorrect: true,
|
528
|
-
multiline: true,
|
529
|
-
autoGrow: true
|
530
|
-
})), /*#__PURE__*/React.createElement(Components.FormCard, {
|
531
|
-
style: {
|
532
|
-
marginTop: 16,
|
533
|
-
paddingHorizontal: 24
|
534
|
-
}
|
535
|
-
}, /*#__PURE__*/React.createElement(View, {
|
536
|
-
style: [{
|
537
|
-
width: '100%',
|
538
|
-
paddingVertical: 16,
|
539
|
-
flexDirection: 'row',
|
540
|
-
justifyContent: 'space-between',
|
541
|
-
alignItems: 'center',
|
542
|
-
position: 'relative'
|
543
|
-
}, this.state.isHome && {
|
544
|
-
borderBottomWidth: 1,
|
545
|
-
borderBottomColor: Colours.LINEGREY
|
546
|
-
}]
|
547
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
548
|
-
style: styles.sectionTitle
|
549
|
-
}, Config.env.strings.MAINTENANCE_HOME), /*#__PURE__*/React.createElement(Switch, {
|
550
|
-
value: this.state.isHome,
|
551
|
-
disabled: this.state.submitting,
|
552
|
-
onValueChange: value => this.setState({
|
553
|
-
isHome: value
|
554
|
-
}),
|
555
|
-
trackColor: {
|
556
|
-
false: '#ddd',
|
557
|
-
true: this.props.colourBrandingMain
|
558
|
-
},
|
559
|
-
thumbColor: Platform.OS === 'android' ? '#fff' : null
|
560
|
-
})), this.state.isHome && /*#__PURE__*/React.createElement(Components.FormCardSection, {
|
561
|
-
label: 'Available times',
|
562
|
-
placeholder: 'Describe your available times here in detail.',
|
563
|
-
textValue: this.state.times,
|
564
|
-
onChangeText: times => this.setState({
|
565
|
-
times
|
566
|
-
}),
|
567
|
-
editable: this.state.submitting === false,
|
568
|
-
hasUnderline: true,
|
569
|
-
isValid: () => {
|
570
|
-
return this.state.times.length > 1;
|
571
|
-
},
|
572
|
-
required: true,
|
573
|
-
errorText: "Please provide available times.",
|
574
|
-
showError: this.state.showError && this.state.isHome && this.state.times.length < 2,
|
575
|
-
minHeight: 40,
|
576
|
-
autoCorrect: true,
|
577
|
-
multiline: true,
|
578
|
-
autoGrow: true
|
579
|
-
})), this.renderImageList())));
|
580
|
-
}
|
581
|
-
renderRegisterConfirmation() {
|
582
|
-
return /*#__PURE__*/React.createElement(Components.ConfirmationPopup, {
|
583
|
-
confirmText: 'Request submitted',
|
584
|
-
repeatText: 'Submit another',
|
585
|
-
visible: this.state.confirmationToShow,
|
586
|
-
onClose: this.onCloseConfirmationPopup.bind(this),
|
587
|
-
onPressAction: this.onConfirmationReset.bind(this)
|
588
|
-
});
|
589
|
-
}
|
590
|
-
renderVideoPlayerPopup() {
|
591
|
-
const {
|
592
|
-
showFullscreenVideo,
|
593
|
-
currentVideoUrl
|
594
|
-
} = this.state;
|
595
|
-
if (!currentVideoUrl) return;
|
596
|
-
return /*#__PURE__*/React.createElement(Components.VideoPopup, {
|
597
|
-
uri: currentVideoUrl,
|
598
|
-
visible: showFullscreenVideo,
|
599
|
-
showFullscreenButton: false,
|
600
|
-
onClose: this.toggleFullscreenVideo
|
601
|
-
});
|
602
|
-
}
|
603
|
-
render() {
|
604
|
-
return /*#__PURE__*/React.createElement(KeyboardAvoidingView, {
|
605
|
-
behavior: Platform.OS === 'ios' && 'padding',
|
606
|
-
style: styles.viewContainer
|
607
|
-
}, this.renderUploadMenu(), /*#__PURE__*/React.createElement(View, {
|
608
|
-
style: styles.container
|
609
|
-
}, /*#__PURE__*/React.createElement(Components.Header, {
|
610
|
-
leftIcon: "angle-left",
|
611
|
-
onPressLeft: this.onPressBack.bind(this),
|
612
|
-
text: Config.env.strings.MAINTENANCE,
|
613
|
-
rightText: this.state.submitting || this.state.success ? null : 'Done',
|
614
|
-
onPressRight: this.submitRequest.bind(this),
|
615
|
-
absoluteRight: true
|
616
|
-
}), this.renderForm()), this.renderRegisterConfirmation(), this.renderVideoPlayerPopup());
|
617
|
-
}
|
618
|
-
}
|
619
|
-
const styles = {
|
620
|
-
viewContainer: {
|
621
|
-
flex: 1,
|
622
|
-
backgroundColor: '#fff'
|
623
|
-
},
|
624
|
-
container: {
|
625
|
-
flex: 1,
|
626
|
-
position: 'relative',
|
627
|
-
backgroundColor: '#f0f0f5'
|
628
|
-
},
|
629
|
-
errorText: {
|
630
|
-
fontFamily: 'sf-regular',
|
631
|
-
color: Colours.COLOUR_TANGERINE,
|
632
|
-
fontSize: 16
|
633
|
-
},
|
634
|
-
requestSuccess: {
|
635
|
-
fontFamily: 'sf-regular',
|
636
|
-
color: Colours.TEXT_DARK,
|
637
|
-
fontSize: 17,
|
638
|
-
textAlign: 'center'
|
639
|
-
},
|
640
|
-
sectionTitle: {
|
641
|
-
fontFamily: 'sf-regular',
|
642
|
-
fontSize: 17,
|
643
|
-
color: Colours.TEXT_DARK
|
644
|
-
},
|
645
|
-
imageListContainer: {
|
646
|
-
marginTop: 8,
|
647
|
-
padding: 8,
|
648
|
-
flexDirection: 'row',
|
649
|
-
backgroundColor: Colours.BOXGREY,
|
650
|
-
minHeight: 106
|
651
|
-
},
|
652
|
-
imageListContainerEmpty: {
|
653
|
-
justifyContent: 'center',
|
654
|
-
alignItems: 'center',
|
655
|
-
flexDirection: 'column'
|
656
|
-
},
|
657
|
-
imageContainer: {
|
658
|
-
width: PHOTO_SIZE,
|
659
|
-
height: PHOTO_SIZE,
|
660
|
-
borderStyle: 'dashed',
|
661
|
-
justifyContent: 'center',
|
662
|
-
alignItems: 'center',
|
663
|
-
borderWidth: 1,
|
664
|
-
borderColor: Colours.LINEGREY,
|
665
|
-
borderRadius: 4,
|
666
|
-
marginLeft: 8
|
667
|
-
},
|
668
|
-
imageContainerNotEmpty: {
|
669
|
-
borderWidth: 1,
|
670
|
-
borderColor: Colours.LINEGREY,
|
671
|
-
backgroundColor: '#fff',
|
672
|
-
borderStyle: 'dashed'
|
673
|
-
},
|
674
|
-
imageBackground: {
|
675
|
-
flex: 1,
|
676
|
-
height: '100%',
|
677
|
-
width: '100%',
|
678
|
-
borderRadius: 4
|
679
|
-
},
|
680
|
-
imageCircle: {
|
681
|
-
width: 90,
|
682
|
-
height: 90,
|
683
|
-
borderRadius: 45,
|
684
|
-
backgroundColor: Colours.PINKISH_GREY,
|
685
|
-
justifyContent: 'center'
|
686
|
-
},
|
687
|
-
addImageIcon: {
|
688
|
-
color: '#fff',
|
689
|
-
fontSize: 32
|
690
|
-
},
|
691
|
-
imagePlayContainer: {
|
692
|
-
position: 'absolute',
|
693
|
-
top: 0,
|
694
|
-
left: 0,
|
695
|
-
right: 0,
|
696
|
-
bottom: 0,
|
697
|
-
alignItems: 'center',
|
698
|
-
justifyContent: 'center'
|
699
|
-
},
|
700
|
-
imageControlIcon: {
|
701
|
-
color: '#fff',
|
702
|
-
fontSize: 20,
|
703
|
-
textShadowColor: 'rgba(0,0,0,0.3)',
|
704
|
-
textShadowOffset: {
|
705
|
-
width: 2,
|
706
|
-
height: 2
|
707
|
-
}
|
708
|
-
},
|
709
|
-
removeImage: {
|
710
|
-
position: 'absolute',
|
711
|
-
top: 0,
|
712
|
-
right: 0,
|
713
|
-
padding: 4,
|
714
|
-
width: 40,
|
715
|
-
height: 40,
|
716
|
-
alignItems: 'center',
|
717
|
-
justifyContent: 'center'
|
718
|
-
}
|
719
|
-
};
|
720
|
-
const mapStateToProps = state => {
|
721
|
-
const {
|
722
|
-
user,
|
723
|
-
connection
|
724
|
-
} = state;
|
725
|
-
const {
|
726
|
-
displayName,
|
727
|
-
profilePic,
|
728
|
-
uid,
|
729
|
-
site,
|
730
|
-
unit,
|
731
|
-
phoneNumber
|
732
|
-
} = user;
|
733
|
-
return {
|
734
|
-
connected: connection.connected,
|
735
|
-
userType: user.type,
|
736
|
-
displayName,
|
737
|
-
profilePic,
|
738
|
-
uid,
|
739
|
-
site,
|
740
|
-
unit,
|
741
|
-
phoneNumber,
|
742
|
-
colourBrandingMain: Colours.getMainBrandingColourFromState(state)
|
743
|
-
};
|
744
|
-
};
|
745
|
-
export default connect(mapStateToProps, {
|
746
|
-
jobAdded
|
747
|
-
})(MaintenanceRequest);
|
748
|
-
//# sourceMappingURL=ServiceRequest.js.map
|