@plusscommunities/pluss-maintenance-app-forms 7.0.21 → 8.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.
Files changed (58) hide show
  1. package/dist/module/apis/maintenanceActions.js +12 -4
  2. package/dist/module/apis/maintenanceActions.js.map +1 -1
  3. package/dist/module/components/FilterPopupMenu.js +30 -14
  4. package/dist/module/components/FilterPopupMenu.js.map +1 -1
  5. package/dist/module/components/MaintenanceList.js +199 -25
  6. package/dist/module/components/MaintenanceList.js.map +1 -1
  7. package/dist/module/components/MaintenanceListItem.js +2 -1
  8. package/dist/module/components/MaintenanceListItem.js.map +1 -1
  9. package/dist/module/components/MaintenanceWidgetItem.js +2 -1
  10. package/dist/module/components/MaintenanceWidgetItem.js.map +1 -1
  11. package/dist/module/components/PrioritySelectorPopup.js +2 -1
  12. package/dist/module/components/PrioritySelectorPopup.js.map +1 -1
  13. package/dist/module/components/StatusSelectorPopup.js +2 -1
  14. package/dist/module/components/StatusSelectorPopup.js.map +1 -1
  15. package/dist/module/components/WidgetSmall.js +5 -4
  16. package/dist/module/components/WidgetSmall.js.map +1 -1
  17. package/dist/module/core.config.js +1 -2
  18. package/dist/module/core.config.js.map +1 -1
  19. package/dist/module/screens/JobTypePicker.js +2 -1
  20. package/dist/module/screens/JobTypePicker.js.map +1 -1
  21. package/dist/module/screens/MaintenanceUserPicker.js +73 -91
  22. package/dist/module/screens/MaintenanceUserPicker.js.map +1 -1
  23. package/dist/module/screens/RequestDetail.js +76 -29
  24. package/dist/module/screens/RequestDetail.js.map +1 -1
  25. package/dist/module/screens/RequestNotes.js +11 -7
  26. package/dist/module/screens/RequestNotes.js.map +1 -1
  27. package/dist/module/screens/ServiceRequest.js +43 -42
  28. package/dist/module/screens/ServiceRequest.js.map +1 -1
  29. package/dist/module/values.config.a.js +1 -2
  30. package/dist/module/values.config.a.js.map +1 -1
  31. package/dist/module/values.config.default.js +1 -2
  32. package/dist/module/values.config.default.js.map +1 -1
  33. package/dist/module/values.config.enquiry.js +1 -2
  34. package/dist/module/values.config.enquiry.js.map +1 -1
  35. package/dist/module/values.config.feedback.js +1 -2
  36. package/dist/module/values.config.feedback.js.map +1 -1
  37. package/dist/module/values.config.food.js +1 -2
  38. package/dist/module/values.config.food.js.map +1 -1
  39. package/package.json +18 -14
  40. package/src/apis/maintenanceActions.js +17 -7
  41. package/src/components/FilterPopupMenu.js +67 -40
  42. package/src/components/MaintenanceList.js +234 -40
  43. package/src/components/MaintenanceListItem.js +2 -1
  44. package/src/components/MaintenanceWidgetItem.js +2 -1
  45. package/src/components/PrioritySelectorPopup.js +2 -1
  46. package/src/components/StatusSelectorPopup.js +2 -1
  47. package/src/components/WidgetSmall.js +12 -4
  48. package/src/core.config.js +0 -2
  49. package/src/screens/JobTypePicker.js +2 -1
  50. package/src/screens/MaintenanceUserPicker.js +77 -114
  51. package/src/screens/RequestDetail.js +88 -32
  52. package/src/screens/RequestNotes.js +17 -10
  53. package/src/screens/ServiceRequest.js +85 -44
  54. package/src/values.config.a.js +0 -1
  55. package/src/values.config.default.js +0 -1
  56. package/src/values.config.enquiry.js +0 -1
  57. package/src/values.config.feedback.js +0 -1
  58. package/src/values.config.food.js +0 -1
@@ -1,16 +1,17 @@
1
1
  import React, { Component } from "react";
2
+ import { Text } from "@plusscommunities/pluss-core-app/components";
2
3
  import {
3
4
  Dimensions,
4
5
  Platform,
5
6
  KeyboardAvoidingView,
6
7
  ScrollView,
7
- Text,
8
8
  TouchableOpacity,
9
9
  View,
10
10
  Switch,
11
11
  FlatList,
12
12
  ImageBackground,
13
13
  Keyboard,
14
+ Alert,
14
15
  } from "react-native";
15
16
  import DateTimePicker from "react-native-modal-datetime-picker";
16
17
  import { Icon } from "@rneui/themed";
@@ -109,8 +110,9 @@ class MaintenanceRequest extends Component {
109
110
  if (this.props.optionOnlyForResidents) {
110
111
  items = _.filter(items, (u) => u.category === "resident");
111
112
  }
112
-
113
- const users = _.sortBy(items, (u) => (u.displayName || "").toLowerCase());
113
+ const users = _.sortBy(response.data.Items || [], (u) =>
114
+ (u.displayName || "").toLowerCase(),
115
+ );
114
116
  this.setState({ users });
115
117
  } catch (error) {
116
118
  console.log("Error loading site users:", error);
@@ -195,7 +197,7 @@ class MaintenanceRequest extends Component {
195
197
  console.log("Could not fetch user details for auto-population:", error);
196
198
  } finally {
197
199
  // In any case, we still need a title. Inform the user to set one form field as a title.
198
- if (!state.title && !update.title) {
200
+ if (!this.state.title && !update.title) {
199
201
  update.title =
200
202
  "[Missing title - Set one of the form field as title in the community manager]";
201
203
  }
@@ -320,7 +322,7 @@ class MaintenanceRequest extends Component {
320
322
  this.setImages(imagesUpdate, imageFieldId);
321
323
  };
322
324
 
323
- onLibrarySelected = (uri) => {
325
+ onLibrarySelectedImage = (uri) => {
324
326
  const { imageFieldId } = this.state;
325
327
  const imagesUpdate = this.getImages(imageFieldId);
326
328
  imagesUpdate.splice(imagesUpdate.length - 1, 0, {
@@ -487,10 +489,14 @@ class MaintenanceRequest extends Component {
487
489
  maintenanceActions
488
490
  .getJobTypes(Helper.getSite(this.props.site))
489
491
  .then((res) => {
490
- this.setState({
491
- types: res.data,
492
- });
493
- this.getDefaultJob();
492
+ this.setState(
493
+ {
494
+ types: res.data,
495
+ },
496
+ () => {
497
+ this.getDefaultJob();
498
+ },
499
+ );
494
500
  })
495
501
  .catch(() => {});
496
502
  }
@@ -566,9 +572,14 @@ class MaintenanceRequest extends Component {
566
572
  return field;
567
573
  });
568
574
 
575
+ const userID =
576
+ this.state.canCreateOnBehalf && this.state.selectedUser
577
+ ? this.state.selectedUser.userId || this.state.selectedUser.Id
578
+ : this.props.uid;
579
+
569
580
  maintenanceActions
570
581
  .sendMaintenanceRequest(
571
- this.props.uid,
582
+ userID,
572
583
  this.state.userName,
573
584
  this.state.phone,
574
585
  this.state.roomNumber,
@@ -637,9 +648,11 @@ class MaintenanceRequest extends Component {
637
648
  title,
638
649
  roomNumber,
639
650
  isHome,
651
+ customFieldImages,
640
652
  times,
641
653
  } = this.state;
642
654
  const hasCustomFields = customFields && customFields.length > 0;
655
+ function showFormErrorAlert() {}
643
656
 
644
657
  if (submitting || !this.props.connected) {
645
658
  if (!this.props.connected) {
@@ -650,30 +663,45 @@ class MaintenanceRequest extends Component {
650
663
  return;
651
664
  }
652
665
  if (uploadingImage) return;
653
-
654
666
  this.setState({ error: null, showError: false });
655
667
 
656
668
  // PC-1255: Validate user selection for on-behalf requests
657
669
  if (this.state.canCreateOnBehalf && !this.state.selectedUser) {
658
670
  console.log("submitRequest - no user selected for on-behalf request");
671
+ Alert.alert(
672
+ "Missing Information",
673
+ "Please select a user to submit the form on behalf of",
674
+ );
659
675
  this.setState({ showError: true });
660
676
  return;
661
677
  }
662
678
 
663
679
  if (title.length === 0 || !roomNumber || roomNumber.length === 0) {
664
680
  console.log("submitRequest - error", { title, roomNumber });
681
+ Alert.alert(
682
+ "Missing Information",
683
+ "Please fill out your address details",
684
+ );
665
685
  this.setState({ showError: true });
666
686
  return;
667
687
  }
668
688
  if (hasCustomFields) {
669
689
  if (!this.validateCustomFields()) {
670
690
  console.log("submitRequest - custom fields error");
691
+ Alert.alert(
692
+ "Invalid Information",
693
+ "Please review the form for errors and try submitting again.",
694
+ );
671
695
  this.setState({ showError: true });
672
696
  return;
673
697
  }
674
698
  } else {
675
699
  if (isHome && times.length < 2) {
676
700
  console.log("submitRequest - error", { isHome, times });
701
+ Alert.alert(
702
+ "Invalid Information",
703
+ "Please review the form for errors and try submitting again.",
704
+ );
677
705
  this.setState({ showError: true });
678
706
  return;
679
707
  }
@@ -966,26 +994,38 @@ class MaintenanceRequest extends Component {
966
994
  );
967
995
  }
968
996
 
969
- // renderDocumentList(fieldId) {
970
- // const documentsList = this.getDocuments(fieldId);
971
- // return (
972
- // <View style={styles.documentListContainer}>
973
- // {documentsList.length > 0 ? documentsList.map((document, index) => this.renderDocument(document, index, fieldId)) : null}
974
- // <Components.DocumentUploader
975
- // buttonTitle="Add Files"
976
- // allowedTypes={['application/pdf']}
977
- // onUploadStarted={(uploadUri, uri, name, ext) => this.onUploadStartedDocument(uploadUri, uri, name, ext, fieldId)}
978
- // onUploadProgress={progress => this.onUploadProgressDocument(progress, fieldId)}
979
- // onUploadSuccess={(uri, uploadUri) => this.onUploadSuccessDocument(uri, uploadUri, fieldId)}
980
- // onUploadFailed={uploadUri => this.onUploadFailedDocument(uploadUri, fieldId)}
981
- // fileName="serviceDocument"
982
- // userId={this.props.uid}
983
- // disabled={false}
984
- // multiple
985
- // />
986
- // </View>
987
- // );
988
- // }
997
+ renderDocumentList(fieldId) {
998
+ const documentsList = this.getDocuments(fieldId);
999
+ return (
1000
+ <View style={styles.documentListContainer}>
1001
+ {documentsList.length > 0
1002
+ ? documentsList.map((document, index) =>
1003
+ this.renderDocument(document, index, fieldId),
1004
+ )
1005
+ : null}
1006
+ <Components.DocumentUploader
1007
+ buttonTitle="Add Files"
1008
+ allowedTypes={["application/pdf"]}
1009
+ onUploadStarted={(uploadUri, uri, name, ext) =>
1010
+ this.onUploadStartedDocument(uploadUri, uri, name, ext, fieldId)
1011
+ }
1012
+ onUploadProgress={(progress) =>
1013
+ this.onUploadProgressDocument(progress, fieldId)
1014
+ }
1015
+ onUploadSuccess={(uri, uploadUri) =>
1016
+ this.onUploadSuccessDocument(uri, uploadUri, fieldId)
1017
+ }
1018
+ onUploadFailed={(uploadUri) =>
1019
+ this.onUploadFailedDocument(uploadUri, fieldId)
1020
+ }
1021
+ fileName="serviceDocument"
1022
+ userId={this.props.uid}
1023
+ disabled={false}
1024
+ multiple
1025
+ />
1026
+ </View>
1027
+ );
1028
+ }
989
1029
 
990
1030
  renderDateField(field, fieldId, sectionStyle) {
991
1031
  let displayText, placeHolder, icon, errorText;
@@ -1176,19 +1216,19 @@ class MaintenanceRequest extends Component {
1176
1216
  {this.renderImageList(fieldId)}
1177
1217
  </Components.GenericInputSection>
1178
1218
  );
1179
- // case 'document':
1180
- // return (
1181
- // <Components.GenericInputSection
1182
- // key={fieldId}
1183
- // label={field.label}
1184
- // sectionStyle={sectionStyle}
1185
- // isValid={() => this.isFieldValid(field, fieldId)}
1186
- // required={field.mandatory}
1187
- // showError={this.state.showError}
1188
- // >
1189
- // {this.renderDocumentList(fieldId)}
1190
- // </Components.GenericInputSection>
1191
- // );
1219
+ case "document":
1220
+ return (
1221
+ <Components.GenericInputSection
1222
+ key={fieldId}
1223
+ label={field.label}
1224
+ sectionStyle={sectionStyle}
1225
+ isValid={() => this.isFieldValid(field, fieldId)}
1226
+ required={field.mandatory}
1227
+ showError={this.state.showError}
1228
+ >
1229
+ {this.renderDocumentList(fieldId)}
1230
+ </Components.GenericInputSection>
1231
+ );
1192
1232
  default:
1193
1233
  return null;
1194
1234
  }
@@ -1530,6 +1570,7 @@ class MaintenanceRequest extends Component {
1530
1570
  onCancel={() => this.setState({ isDateTimePickerVisible: false })}
1531
1571
  mode={popUpType}
1532
1572
  headerTextIOS={`Pick a ${popUpType}`}
1573
+ date={new Date()}
1533
1574
  />
1534
1575
  </KeyboardAvoidingView>
1535
1576
  );
@@ -32,7 +32,6 @@ const values = {
32
32
  textEntityName: "Job",
33
33
  stringConfigJobStatus: "maintenanceJobStatusA",
34
34
  stringConfigHideSeen: "maintenanceDisableSeenA",
35
- optionOnlyForResidents: "onlyForResidentsMaintenanceA",
36
35
  };
37
36
 
38
37
  export { values };
@@ -38,7 +38,6 @@ const values = {
38
38
  forceCustomFields: false,
39
39
  stringConfigJobStatus: "maintenanceJobStatus",
40
40
  stringConfigHideSeen: "maintenanceDisableSeen",
41
- optionOnlyForResidents: "onlyForResidentsMaintenance",
42
41
  };
43
42
 
44
43
  export { values };
@@ -38,7 +38,6 @@ const values = {
38
38
  forceCustomFields: true,
39
39
  stringConfigJobStatus: "maintenanceJobStatusEnquiry",
40
40
  stringConfigHideSeen: "maintenanceDisableSeenEnquiry",
41
- optionOnlyForResidents: "onlyForResidentsMaintenanceEnquiry",
42
41
  };
43
42
 
44
43
  export { values };
@@ -38,7 +38,6 @@ const values = {
38
38
  forceCustomFields: true,
39
39
  stringConfigJobStatus: "maintenanceJobStatusFeedback",
40
40
  stringConfigHideSeen: "maintenanceDisableSeenFeedback",
41
- optionOnlyForResidents: "onlyForResidentsMaintenanceFeedback",
42
41
  };
43
42
 
44
43
  export { values };
@@ -38,7 +38,6 @@ const values = {
38
38
  forceCustomFields: true,
39
39
  stringConfigJobStatus: "maintenanceJobStatusFood",
40
40
  stringConfigHideSeen: "maintenanceDisableSeenFood",
41
- optionOnlyForResidents: "onlyForResidentsMaintenanceFood",
42
41
  };
43
42
 
44
43
  export { values };