@plusscommunities/pluss-maintenance-app 7.0.0-beta.2 → 7.0.1-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/dist/module/components/FilterPopupMenu.js +18 -11
- package/dist/module/components/FilterPopupMenu.js.map +1 -1
- package/dist/module/components/MaintenanceList.js +2 -2
- package/dist/module/components/MaintenanceList.js.map +1 -1
- package/dist/module/helper.js +3 -2
- package/dist/module/helper.js.map +1 -1
- package/dist/module/reducers/JobsReducer.js +2 -1
- package/dist/module/reducers/JobsReducer.js.map +1 -1
- package/dist/module/screens/RequestDetail.js +77 -5
- package/dist/module/screens/RequestDetail.js.map +1 -1
- package/dist/module/screens/ServiceRequest.js +203 -17
- package/dist/module/screens/ServiceRequest.js.map +1 -1
- package/dist/module/values.config.enquiry.js +42 -0
- package/dist/module/values.config.enquiry.js.map +1 -0
- package/dist/module/values.config.feedback.js +42 -0
- package/dist/module/values.config.feedback.js.map +1 -0
- package/dist/module/values.config.food.js +42 -0
- package/dist/module/values.config.food.js.map +1 -0
- package/package.json +7 -3
- package/src/components/FilterPopupMenu.js +26 -16
- package/src/components/MaintenanceList.js +5 -5
- package/src/helper.js +6 -3
- package/src/reducers/JobsReducer.js +2 -1
- package/src/screens/RequestDetail.js +70 -4
- package/src/screens/ServiceRequest.js +208 -25
- package/src/values.config.enquiry.js +42 -0
- package/src/values.config.feedback.js +42 -0
- package/src/values.config.food.js +42 -0
@@ -92,7 +92,7 @@ class MaintenanceRequest extends Component {
|
|
92
92
|
}
|
93
93
|
this.setState(update);
|
94
94
|
});
|
95
|
-
_defineProperty(this, "
|
95
|
+
_defineProperty(this, "onUploadStartedImage", (uploadUri, imageUri) => {
|
96
96
|
const {
|
97
97
|
imageFieldId
|
98
98
|
} = this.state;
|
@@ -106,7 +106,7 @@ class MaintenanceRequest extends Component {
|
|
106
106
|
});
|
107
107
|
this.setImages(imagesUpdate, imageFieldId);
|
108
108
|
});
|
109
|
-
_defineProperty(this, "
|
109
|
+
_defineProperty(this, "onUploadProgressImage", progress => {
|
110
110
|
const {
|
111
111
|
imageFieldId
|
112
112
|
} = this.state;
|
@@ -120,7 +120,7 @@ class MaintenanceRequest extends Component {
|
|
120
120
|
});
|
121
121
|
this.setImages(imagesUpdate, imageFieldId);
|
122
122
|
});
|
123
|
-
_defineProperty(this, "
|
123
|
+
_defineProperty(this, "onUploadSuccessImage", async (uri, uploadUri) => {
|
124
124
|
const {
|
125
125
|
imageFieldId
|
126
126
|
} = this.state;
|
@@ -135,7 +135,7 @@ class MaintenanceRequest extends Component {
|
|
135
135
|
});
|
136
136
|
this.setImages(imagesUpdate, imageFieldId, () => this.waitForThumbnails());
|
137
137
|
});
|
138
|
-
_defineProperty(this, "
|
138
|
+
_defineProperty(this, "onUploadFailedImage", uploadUri => {
|
139
139
|
const {
|
140
140
|
imageFieldId
|
141
141
|
} = this.state;
|
@@ -163,6 +163,53 @@ class MaintenanceRequest extends Component {
|
|
163
163
|
});
|
164
164
|
this.setImages(imagesUpdate, imageFieldId);
|
165
165
|
});
|
166
|
+
_defineProperty(this, "onUploadStartedDocument", (uploadUri, documentUri, documentName, documentExt, documentFieldId) => {
|
167
|
+
const documentsUpdate = this.getDocuments(documentFieldId);
|
168
|
+
documentsUpdate.splice(documentsUpdate.length - 1, 0, {
|
169
|
+
uploading: true,
|
170
|
+
uploadProgress: '0%',
|
171
|
+
uploadUri,
|
172
|
+
documentUri,
|
173
|
+
documentName,
|
174
|
+
documentExt,
|
175
|
+
allowRetry: true
|
176
|
+
});
|
177
|
+
this.setDocuments(documentsUpdate, documentFieldId);
|
178
|
+
});
|
179
|
+
_defineProperty(this, "onUploadProgressDocument", (progress, documentFieldId) => {
|
180
|
+
const documentsUpdate = this.getDocuments(documentFieldId);
|
181
|
+
documentsUpdate.map(doc => {
|
182
|
+
if (doc.uploadUri === progress.uri) {
|
183
|
+
doc.uploadProgress = progress.percentage;
|
184
|
+
doc.uploading = true;
|
185
|
+
doc.allowRetry = true;
|
186
|
+
}
|
187
|
+
});
|
188
|
+
this.setDocuments(documentsUpdate, documentFieldId);
|
189
|
+
});
|
190
|
+
_defineProperty(this, "onUploadSuccessDocument", async (uri, uploadUri, documentFieldId) => {
|
191
|
+
const documentsUpdate = this.getDocuments(documentFieldId);
|
192
|
+
documentsUpdate.map(doc => {
|
193
|
+
if (doc.uploadUri === uploadUri && doc.uploading) {
|
194
|
+
doc.uploading = false;
|
195
|
+
doc.uploadProgress = '100%';
|
196
|
+
doc.url = uri;
|
197
|
+
doc.allowRetry = true;
|
198
|
+
}
|
199
|
+
});
|
200
|
+
this.setDocuments(documentsUpdate, documentFieldId);
|
201
|
+
});
|
202
|
+
_defineProperty(this, "onUploadFailedDocument", (uploadUri, documentFieldId) => {
|
203
|
+
const documentsUpdate = this.getDocuments(documentFieldId);
|
204
|
+
documentsUpdate.map(doc => {
|
205
|
+
if (doc.uploadUri === uploadUri) {
|
206
|
+
doc.uploading = true; // Requried for retry
|
207
|
+
doc.uploadProgress = '';
|
208
|
+
doc.allowRetry = true;
|
209
|
+
}
|
210
|
+
});
|
211
|
+
this.setDocuments(documentsUpdate, documentFieldId);
|
212
|
+
});
|
166
213
|
_defineProperty(this, "isFieldValid", (field, fieldId) => {
|
167
214
|
const {
|
168
215
|
mandatory,
|
@@ -170,14 +217,17 @@ class MaintenanceRequest extends Component {
|
|
170
217
|
answer
|
171
218
|
} = field;
|
172
219
|
if (['staticTitle', 'staticText'].includes(type)) return true;
|
173
|
-
const imagesList = type === 'image' ? this.getImageUrls(fieldId) : [];
|
174
220
|
const checkMandatory = () => {
|
175
221
|
if (!mandatory) return true;
|
176
222
|
switch (type) {
|
177
223
|
case 'yn':
|
178
224
|
return _.isBoolean(answer);
|
179
225
|
case 'image':
|
226
|
+
const imagesList = this.getImageUrls(fieldId);
|
180
227
|
return imagesList.length > 0;
|
228
|
+
case 'document':
|
229
|
+
const documentsList = this.getDocumentAnswers(fieldId);
|
230
|
+
return documentsList.length > 0;
|
181
231
|
case 'checkbox':
|
182
232
|
return _.isArray(answer) && answer.length > 0;
|
183
233
|
default:
|
@@ -229,6 +279,7 @@ class MaintenanceRequest extends Component {
|
|
229
279
|
const customFields = _.cloneDeep(this.state.customFields);
|
230
280
|
const updatedCustomFields = customFields.map((field, fieldId) => {
|
231
281
|
if (field.type === 'image') field.answer = this.getImageUrls(fieldId);
|
282
|
+
if (field.type === 'document') field.answer = this.getDocumentAnswers(fieldId);
|
232
283
|
return field;
|
233
284
|
});
|
234
285
|
maintenanceActions.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, updatedCustomFields).then(res => {
|
@@ -343,6 +394,39 @@ class MaintenanceRequest extends Component {
|
|
343
394
|
imagesUpdate.splice(index, 1);
|
344
395
|
this.setImages(imagesUpdate, fieldId);
|
345
396
|
});
|
397
|
+
_defineProperty(this, "getDocuments", fieldId => {
|
398
|
+
const {
|
399
|
+
customFieldDocuments
|
400
|
+
} = this.state;
|
401
|
+
const documentsList = _.cloneDeep(customFieldDocuments[fieldId]) || [];
|
402
|
+
return documentsList;
|
403
|
+
});
|
404
|
+
_defineProperty(this, "setDocuments", (documentsList, fieldId) => {
|
405
|
+
let update = {};
|
406
|
+
const customFieldDocuments = _.cloneDeep(this.state.customFieldDocuments);
|
407
|
+
customFieldDocuments[fieldId] = documentsList;
|
408
|
+
update = {
|
409
|
+
customFieldDocuments
|
410
|
+
};
|
411
|
+
this.setState(update);
|
412
|
+
});
|
413
|
+
_defineProperty(this, "getDocumentAnswers", fieldId => {
|
414
|
+
const documentsList = this.getDocuments(fieldId);
|
415
|
+
return _.filter(documentsList, doc => {
|
416
|
+
return !doc.uploading && doc.url;
|
417
|
+
}).map(doc => {
|
418
|
+
return {
|
419
|
+
name: doc.documentName,
|
420
|
+
ext: doc.documentExt,
|
421
|
+
url: doc.url
|
422
|
+
};
|
423
|
+
});
|
424
|
+
});
|
425
|
+
_defineProperty(this, "removeDocument", (index, fieldId) => {
|
426
|
+
const documentsUpdate = this.getDocuments(fieldId);
|
427
|
+
documentsUpdate.splice(index, 1);
|
428
|
+
this.setDocuments(documentsUpdate, fieldId);
|
429
|
+
});
|
346
430
|
_defineProperty(this, "toggleFullscreenVideo", url => {
|
347
431
|
if (typeof url !== 'string') url = '';
|
348
432
|
this.setState({
|
@@ -375,6 +459,7 @@ class MaintenanceRequest extends Component {
|
|
375
459
|
confirmationToShow: false,
|
376
460
|
customFields: [],
|
377
461
|
customFieldImages: {},
|
462
|
+
customFieldDocuments: {},
|
378
463
|
isDateTimePickerVisible: false,
|
379
464
|
popUpType: 'date',
|
380
465
|
dateFieldId: null,
|
@@ -433,6 +518,7 @@ class MaintenanceRequest extends Component {
|
|
433
518
|
fail: false,
|
434
519
|
customFields: [],
|
435
520
|
customFieldImages: {},
|
521
|
+
customFieldDocuments: {},
|
436
522
|
isDateTimePickerVisible: false,
|
437
523
|
popUpType: 'date',
|
438
524
|
dateFieldId: null,
|
@@ -444,7 +530,6 @@ class MaintenanceRequest extends Component {
|
|
444
530
|
this.setState({
|
445
531
|
types: res.data
|
446
532
|
});
|
447
|
-
console.log(res.data);
|
448
533
|
this.getDefaultJob();
|
449
534
|
}).catch(() => {});
|
450
535
|
}
|
@@ -454,7 +539,6 @@ class MaintenanceRequest extends Component {
|
|
454
539
|
} = this.state;
|
455
540
|
const selected = types.find(t => t.typeName === type) || {};
|
456
541
|
if (values.forceCustomFields && !selected.hasCustomFields) {
|
457
|
-
console.log(selected);
|
458
542
|
this.setState({
|
459
543
|
type,
|
460
544
|
customFields: [],
|
@@ -540,14 +624,14 @@ class MaintenanceRequest extends Component {
|
|
540
624
|
}
|
541
625
|
this.submit();
|
542
626
|
}
|
543
|
-
|
627
|
+
renderImageUploader() {
|
544
628
|
return /*#__PURE__*/React.createElement(Components.ImageUploader, {
|
545
629
|
ref: ref => this.imageUploader = ref,
|
546
|
-
onUploadStarted: this.
|
547
|
-
onUploadSuccess: this.
|
548
|
-
onUploadFailed: this.
|
549
|
-
onUploadProgress: this.
|
550
|
-
onLibrarySelected: this.
|
630
|
+
onUploadStarted: this.onUploadStartedImage,
|
631
|
+
onUploadSuccess: this.onUploadSuccessImage,
|
632
|
+
onUploadFailed: this.onUploadFailedImage,
|
633
|
+
onUploadProgress: this.onUploadProgressImage,
|
634
|
+
onLibrarySelected: this.onLibrarySelectedImage,
|
551
635
|
size: {
|
552
636
|
width: 1400
|
553
637
|
},
|
@@ -612,6 +696,34 @@ class MaintenanceRequest extends Component {
|
|
612
696
|
style: styles.removeImage
|
613
697
|
}))));
|
614
698
|
}
|
699
|
+
renderDocument(item, index, fieldId) {
|
700
|
+
const {
|
701
|
+
colourBrandingMain
|
702
|
+
} = this.props;
|
703
|
+
return /*#__PURE__*/React.createElement(View, {
|
704
|
+
key: index,
|
705
|
+
style: styles.documentContainer
|
706
|
+
}, /*#__PURE__*/React.createElement(View, {
|
707
|
+
style: {
|
708
|
+
...styles.documentTypeContainer,
|
709
|
+
backgroundColor: colourBrandingMain
|
710
|
+
}
|
711
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
712
|
+
style: styles.documentTypeText
|
713
|
+
}, item.documentExt)), /*#__PURE__*/React.createElement(Text, {
|
714
|
+
style: styles.documentText
|
715
|
+
}, `${item.documentName}${item.uploading ? ` - ${item.uploadProgress}` : ''}`), !item.uploading && /*#__PURE__*/React.createElement(TouchableOpacity, {
|
716
|
+
style: styles.removeDocumentButton,
|
717
|
+
onPress: () => this.removeDocument(index, fieldId)
|
718
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
719
|
+
name: "remove",
|
720
|
+
type: "font-awesome",
|
721
|
+
iconStyle: {
|
722
|
+
...styles.removeDocumentIcon,
|
723
|
+
color: colourBrandingMain
|
724
|
+
}
|
725
|
+
})));
|
726
|
+
}
|
615
727
|
renderSuccess() {
|
616
728
|
return /*#__PURE__*/React.createElement(View, {
|
617
729
|
style: {
|
@@ -626,8 +738,6 @@ class MaintenanceRequest extends Component {
|
|
626
738
|
renderImageList(fieldId = null) {
|
627
739
|
const imagesList = this.getImages(fieldId);
|
628
740
|
return /*#__PURE__*/React.createElement(View, {
|
629
|
-
style: styles.imageSection
|
630
|
-
}, /*#__PURE__*/React.createElement(View, {
|
631
741
|
style: [styles.imageListContainer, imagesList.length < 2 && styles.imageListContainerEmpty]
|
632
742
|
}, /*#__PURE__*/React.createElement(FlatList, {
|
633
743
|
keyboardShouldPersistTaps: "always",
|
@@ -639,8 +749,30 @@ class MaintenanceRequest extends Component {
|
|
639
749
|
}) => this.renderImage(item, index, fieldId),
|
640
750
|
keyExtractor: (item, index) => index,
|
641
751
|
numColumns: 3
|
642
|
-
}))
|
752
|
+
}));
|
643
753
|
}
|
754
|
+
|
755
|
+
// renderDocumentList(fieldId) {
|
756
|
+
// const documentsList = this.getDocuments(fieldId);
|
757
|
+
// return (
|
758
|
+
// <View style={styles.documentListContainer}>
|
759
|
+
// {documentsList.length > 0 ? documentsList.map((document, index) => this.renderDocument(document, index, fieldId)) : null}
|
760
|
+
// <Components.DocumentUploader
|
761
|
+
// buttonTitle="Add Files"
|
762
|
+
// allowedTypes={['application/pdf']}
|
763
|
+
// onUploadStarted={(uploadUri, uri, name, ext) => this.onUploadStartedDocument(uploadUri, uri, name, ext, fieldId)}
|
764
|
+
// onUploadProgress={progress => this.onUploadProgressDocument(progress, fieldId)}
|
765
|
+
// onUploadSuccess={(uri, uploadUri) => this.onUploadSuccessDocument(uri, uploadUri, fieldId)}
|
766
|
+
// onUploadFailed={uploadUri => this.onUploadFailedDocument(uploadUri, fieldId)}
|
767
|
+
// fileName="serviceDocument"
|
768
|
+
// userId={this.props.uid}
|
769
|
+
// disabled={false}
|
770
|
+
// multiple
|
771
|
+
// />
|
772
|
+
// </View>
|
773
|
+
// );
|
774
|
+
// }
|
775
|
+
|
644
776
|
renderDateField(field, fieldId, sectionStyle) {
|
645
777
|
let displayText, placeHolder, icon, errorText;
|
646
778
|
if (field.type === 'date') {
|
@@ -793,6 +925,19 @@ class MaintenanceRequest extends Component {
|
|
793
925
|
required: field.mandatory,
|
794
926
|
showError: this.state.showError
|
795
927
|
}, this.renderImageList(fieldId));
|
928
|
+
// case 'document':
|
929
|
+
// return (
|
930
|
+
// <Components.GenericInputSection
|
931
|
+
// key={fieldId}
|
932
|
+
// label={field.label}
|
933
|
+
// sectionStyle={sectionStyle}
|
934
|
+
// isValid={() => this.isFieldValid(field, fieldId)}
|
935
|
+
// required={field.mandatory}
|
936
|
+
// showError={this.state.showError}
|
937
|
+
// >
|
938
|
+
// {this.renderDocumentList(fieldId)}
|
939
|
+
// </Components.GenericInputSection>
|
940
|
+
// );
|
796
941
|
default:
|
797
942
|
return null;
|
798
943
|
}
|
@@ -1034,7 +1179,7 @@ class MaintenanceRequest extends Component {
|
|
1034
1179
|
return /*#__PURE__*/React.createElement(KeyboardAvoidingView, {
|
1035
1180
|
behavior: Platform.OS === 'ios' && 'padding',
|
1036
1181
|
style: styles.viewContainer
|
1037
|
-
}, this.
|
1182
|
+
}, this.renderImageUploader(), /*#__PURE__*/React.createElement(View, {
|
1038
1183
|
style: styles.container
|
1039
1184
|
}, /*#__PURE__*/React.createElement(Components.Header, {
|
1040
1185
|
leftIcon: "angle-left",
|
@@ -1092,6 +1237,11 @@ const styles = {
|
|
1092
1237
|
alignItems: 'center',
|
1093
1238
|
flexDirection: 'column'
|
1094
1239
|
},
|
1240
|
+
documentListContainer: {
|
1241
|
+
marginTop: 8,
|
1242
|
+
flexDirection: 'column',
|
1243
|
+
alignItems: 'flex-start'
|
1244
|
+
},
|
1095
1245
|
imageContainer: {
|
1096
1246
|
width: PHOTO_SIZE,
|
1097
1247
|
height: PHOTO_SIZE,
|
@@ -1219,6 +1369,42 @@ const styles = {
|
|
1219
1369
|
removeIcon: {
|
1220
1370
|
fontSize: 26,
|
1221
1371
|
color: Colours.TEXT_BLUEGREY
|
1372
|
+
},
|
1373
|
+
documentContainer: {
|
1374
|
+
flexDirection: 'row',
|
1375
|
+
alignItems: 'center',
|
1376
|
+
justifyContent: 'space-between',
|
1377
|
+
paddingVertical: 4
|
1378
|
+
},
|
1379
|
+
documentTypeContainer: {
|
1380
|
+
width: 50,
|
1381
|
+
height: 60,
|
1382
|
+
justifyContent: 'center',
|
1383
|
+
alignItems: 'center',
|
1384
|
+
borderRadius: 5,
|
1385
|
+
marginRight: 8
|
1386
|
+
},
|
1387
|
+
documentTypeText: {
|
1388
|
+
color: '#fff',
|
1389
|
+
fontFamily: 'sf-semibold',
|
1390
|
+
textAlign: 'center'
|
1391
|
+
},
|
1392
|
+
documentText: {
|
1393
|
+
flex: 1,
|
1394
|
+
fontFamily: 'sf-semibold',
|
1395
|
+
fontSize: 16,
|
1396
|
+
color: '#65686D'
|
1397
|
+
},
|
1398
|
+
removeDocumentButton: {
|
1399
|
+
padding: 4,
|
1400
|
+
width: 40,
|
1401
|
+
height: 40,
|
1402
|
+
alignItems: 'center',
|
1403
|
+
justifyContent: 'center',
|
1404
|
+
marginLeft: 8
|
1405
|
+
},
|
1406
|
+
removeDocumentIcon: {
|
1407
|
+
fontSize: 24
|
1222
1408
|
}
|
1223
1409
|
};
|
1224
1410
|
const mapStateToProps = state => {
|