@plusscommunities/pluss-maintenance-app 7.0.0 → 7.0.1

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.
@@ -0,0 +1 @@
1
+ {"version":3,"names":["values","featureKey","aliases","reducerKey","serviceKey","updateKey","commentKey","actionJobsLoaded","actionJobAdded","actionJobsAdded","actionJobsStatusesLoaded","actionJobsHideSeen","actionJobFilterLoaded","screenMaintenance","screenRequestDetail","screenServiceRequest","screenJobTypePicker","screenRequestNotes","permissionMaintenanceTracking","permissionMaintenanceAssignment","iconGridMenu","gridViewBox","iconAddMenu","iconKioskAction","hasMoreOption","orderAddMenu","orderMoreMenu","orderKioskAction","textFeatureTitle","textAddMenuTitle","textMoreMenuTitle","textKioskActionTitle","textEntityName","textJobType","emptyRequestsStaff","emptyRequestsUser","forceCustomFields","stringConfigJobStatus","stringConfigHideSeen"],"sources":["values.config.food.js"],"sourcesContent":["const values = {\n featureKey: 'maintenanceFood',\n aliases: ['maintenanceRequest'],\n reducerKey: 'jobsFood',\n serviceKey: 'maintenanceFood',\n updateKey: 'jobsFood',\n commentKey: 'maintenancerequestFood',\n actionJobsLoaded: 'JOBS_LOADEDFood',\n actionJobAdded: 'JOB_ADDEDFood',\n actionJobsAdded: 'JOBS_ADDEDFood',\n actionJobsStatusesLoaded: 'JOBS_STATUSES_LOADEDFood',\n actionJobsHideSeen: 'JOBS_HIDE_SEENFood',\n actionJobFilterLoaded: 'JOBS_FILTER_LOADEDFood',\n screenMaintenance: 'maintenanceFood',\n screenRequestDetail: 'requestDetailFood',\n screenServiceRequest: 'serviceRequestFood',\n screenJobTypePicker: 'jobTypePickerFood',\n screenRequestNotes: 'requestNotesFood',\n permissionMaintenanceTracking: 'maintenanceTrackingFood',\n permissionMaintenanceAssignment: 'maintenanceAssignmentFood',\n iconGridMenu: 'form',\n gridViewBox: '0 0 256 256',\n iconAddMenu: 'form',\n iconKioskAction: 'form',\n hasMoreOption: false,\n orderAddMenu: 5,\n orderMoreMenu: 4,\n orderKioskAction: 1,\n textFeatureTitle: 'Food Ordering',\n textAddMenuTitle: 'New Food Order',\n textMoreMenuTitle: 'Food Ordering',\n textKioskActionTitle: 'Food Ordering',\n textEntityName: 'Food Order',\n textJobType: 'Food Order Type',\n emptyRequestsStaff: 'No active Food Orders',\n emptyRequestsUser: 'Your Food Orders will show here',\n forceCustomFields: true,\n stringConfigJobStatus: 'maintenanceJobStatusFood',\n stringConfigHideSeen: 'maintenanceDisableSeenFood',\n};\n\nexport { values };\n"],"mappings":"AAAA,MAAMA,MAAM,GAAG;EACbC,UAAU,EAAE,iBAAiB;EAC7BC,OAAO,EAAE,CAAC,oBAAoB,CAAC;EAC/BC,UAAU,EAAE,UAAU;EACtBC,UAAU,EAAE,iBAAiB;EAC7BC,SAAS,EAAE,UAAU;EACrBC,UAAU,EAAE,wBAAwB;EACpCC,gBAAgB,EAAE,iBAAiB;EACnCC,cAAc,EAAE,eAAe;EAC/BC,eAAe,EAAE,gBAAgB;EACjCC,wBAAwB,EAAE,0BAA0B;EACpDC,kBAAkB,EAAE,oBAAoB;EACxCC,qBAAqB,EAAE,wBAAwB;EAC/CC,iBAAiB,EAAE,iBAAiB;EACpCC,mBAAmB,EAAE,mBAAmB;EACxCC,oBAAoB,EAAE,oBAAoB;EAC1CC,mBAAmB,EAAE,mBAAmB;EACxCC,kBAAkB,EAAE,kBAAkB;EACtCC,6BAA6B,EAAE,yBAAyB;EACxDC,+BAA+B,EAAE,2BAA2B;EAC5DC,YAAY,EAAE,MAAM;EACpBC,WAAW,EAAE,aAAa;EAC1BC,WAAW,EAAE,MAAM;EACnBC,eAAe,EAAE,MAAM;EACvBC,aAAa,EAAE,KAAK;EACpBC,YAAY,EAAE,CAAC;EACfC,aAAa,EAAE,CAAC;EAChBC,gBAAgB,EAAE,CAAC;EACnBC,gBAAgB,EAAE,eAAe;EACjCC,gBAAgB,EAAE,gBAAgB;EAClCC,iBAAiB,EAAE,eAAe;EAClCC,oBAAoB,EAAE,eAAe;EACrCC,cAAc,EAAE,YAAY;EAC5BC,WAAW,EAAE,iBAAiB;EAC9BC,kBAAkB,EAAE,uBAAuB;EAC3CC,iBAAiB,EAAE,iCAAiC;EACpDC,iBAAiB,EAAE,IAAI;EACvBC,qBAAqB,EAAE,0BAA0B;EACjDC,oBAAoB,EAAE;AACxB,CAAC;AAED,SAAStC,MAAM","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plusscommunities/pluss-maintenance-app",
3
- "version": "7.0.0",
3
+ "version": "7.0.1",
4
4
  "description": "Extension package to enable maintenance on Pluss Communities Platform",
5
5
  "main": "dist/module/index.js",
6
6
  "module": "dist/module/index.js",
@@ -28,8 +28,9 @@
28
28
  "license": "ISC",
29
29
  "dependencies": {},
30
30
  "peerDependencies": {
31
- "@plusscommunities/pluss-core-app": "7.0.0",
31
+ "@plusscommunities/pluss-core-app": "7.0.2",
32
32
  "axios": "^1.6.8",
33
+ "expo-document-picker": "~13.0.3",
33
34
  "lodash": "^4.17.4",
34
35
  "moment": "^2.30.1",
35
36
  "react": "18.3.1",
@@ -4,7 +4,7 @@ import { connect } from 'react-redux';
4
4
  import _ from 'lodash';
5
5
  import { maintenanceActions } from '../apis';
6
6
  import { Colours, Helper } from '../core.config';
7
- import { getJobStatusOptions, getIncompleteJobStatuses, jobPriorityOptions } from '../helper';
7
+ import { getJobStatusOptions, getIncompleteJobStatuses, jobPriorityOptions, getDefaultJobPriority } from '../helper';
8
8
  import { values } from '../values.config';
9
9
 
10
10
  const SCREEN_HEIGHT = Dimensions.get('window').height;
@@ -21,16 +21,6 @@ class FilterPopupMenu extends Component {
21
21
  selectedAssignee: props.assignee || '',
22
22
  assignees: [],
23
23
  };
24
- this.priorityOptions = [
25
- {
26
- label: 'All',
27
- value: '',
28
- },
29
- ...jobPriorityOptions.map(p => ({
30
- label: p.label,
31
- value: p.label,
32
- }))
33
- ];
34
24
  }
35
25
 
36
26
  componentDidMount() {
@@ -53,16 +43,35 @@ class FilterPopupMenu extends Component {
53
43
  },
54
44
  {
55
45
  label: 'Incomplete',
56
- value: `Unassigned|${getIncompleteJobStatuses(this.props).map(s => s.text).join('|')}`,
46
+ value: `Unassigned|${getIncompleteJobStatuses(this.props)
47
+ .map(s => s.text)
48
+ .join('|')}`,
57
49
  },
58
50
  ...statusOptions.map(s => ({
59
51
  label: s.text,
60
52
  value: s.text,
61
53
  })),
62
54
  ];
63
- // console.log('getStatusOptions', options);
55
+ // console.log('getStatusOptions', JSON.stringify(options, null, 2));
64
56
  return options;
65
- }
57
+ };
58
+
59
+ getPriorityOptions = () => {
60
+ const priorityOptions = jobPriorityOptions;
61
+ const defaultPriority = getDefaultJobPriority();
62
+ const options = [
63
+ {
64
+ label: 'All',
65
+ value: '',
66
+ },
67
+ ...priorityOptions.map(p => ({
68
+ label: p.label,
69
+ value: p.label === defaultPriority?.label ? `${p.label}|undefined` : p.label,
70
+ })),
71
+ ];
72
+ // console.log('getPriorityOptions', JSON.stringify(options, null, 2));
73
+ return options;
74
+ };
66
75
 
67
76
  getAssignees = async () => {
68
77
  try {
@@ -110,6 +119,7 @@ class FilterPopupMenu extends Component {
110
119
  status: selectedStatus,
111
120
  statusText: this.getStatusOptions().find(o => o.value === selectedStatus)?.label,
112
121
  priority: selectedPriority,
122
+ priorityText: this.getPriorityOptions().find(o => o.value === selectedPriority)?.label,
113
123
  type: selectedType,
114
124
  assignee: selectedAssignee,
115
125
  assigneeName: this.state.assignees.find(a => a.value === selectedAssignee)?.label,
@@ -161,7 +171,7 @@ class FilterPopupMenu extends Component {
161
171
 
162
172
  render() {
163
173
  // console.log('FilterPopupMenu', JSON.stringify({ category: this.props.user.category, permissions: this.props.user.permissions }, null, 2))
164
- const isStaff = this.props.user.category === 'staff'
174
+ const isStaff = this.props.user.category === 'staff';
165
175
  const canFilterAssignee = !_.includes(this.props.user.permissions, values.permissionMaintenanceAssignment);
166
176
 
167
177
  return (
@@ -171,7 +181,7 @@ class FilterPopupMenu extends Component {
171
181
  {this.renderTitle()}
172
182
  <ScrollView style={styles.optionContent}>
173
183
  {this.renderOptions('Status', this.getStatusOptions(), 'selectedStatus')}
174
- {isStaff ? this.renderOptions('Priority', this.priorityOptions, 'selectedPriority') : null}
184
+ {isStaff ? this.renderOptions('Priority', this.getPriorityOptions(), 'selectedPriority') : null}
175
185
  {this.renderOptions('Type', this.state.types, 'selectedType')}
176
186
  {canFilterAssignee ? this.renderOptions('Assigned To', this.state.assignees, 'selectedAssignee') : null}
177
187
  </ScrollView>
@@ -153,7 +153,7 @@ class MaintenanceList extends Component {
153
153
  filterTexts.push(jobfilters.statusText);
154
154
  }
155
155
  if (!_.isEmpty(jobfilters.priority)) {
156
- filterTexts.push(jobfilters.priority);
156
+ filterTexts.push(jobfilters.priorityText);
157
157
  }
158
158
  if (!_.isEmpty(jobfilters.type)) {
159
159
  filterTexts.push(jobfilters.type);
@@ -317,10 +317,10 @@ const mapStateToProps = state => {
317
317
  colourBrandingMain: Colours.getMainBrandingColourFromState(state),
318
318
  dataUpdated: notifications.dataUpdated[values.updateKey],
319
319
  statusTypes: state[values.reducerKey].jobstatuses,
320
- jobfilters: state[values.reducerKey].jobfilters,
320
+ jobfilters: state[values.reducerKey].jobfilters || {},
321
321
  };
322
322
  };
323
323
 
324
- export default connect(mapStateToProps, { jobsLoaded, jobAdded, jobsAdded, jobStatusesUpdate, jobHideSeenUpdate, jobsFilterLoaded }, null, { forwardRef: true })(
325
- MaintenanceList,
326
- );
324
+ export default connect(mapStateToProps, { jobsLoaded, jobAdded, jobsAdded, jobStatusesUpdate, jobHideSeenUpdate, jobsFilterLoaded }, null, {
325
+ forwardRef: true,
326
+ })(MaintenanceList);
package/src/helper.js CHANGED
@@ -41,7 +41,7 @@ const jobPriorityOptions = [
41
41
  },
42
42
  ];
43
43
 
44
- const getJobStatusOptions = props => props?.statusTypes?.length ? props?.statusTypes : jobStatusOptions;
44
+ const getJobStatusOptions = props => (props?.statusTypes?.length ? props?.statusTypes : jobStatusOptions);
45
45
 
46
46
  const getDefaultJobStatuses = props => getJobStatusOptions(props).filter(s => s.category === STATUS_NOT_ACTIONED);
47
47
 
@@ -53,9 +53,11 @@ const getJobStatus = (status, props) => {
53
53
  let statusOption = null;
54
54
  if (status) statusOption = statusOptions.find(s => s.text === status);
55
55
  return statusOption || getDefaultJobStatuses(props)[0];
56
- }
56
+ };
57
+
58
+ const getDefaultJobPriority = () => jobPriorityOptions.find(p => p.default);
57
59
 
58
- const getJobPriority = priority => jobPriorityOptions.find(p => p.label === priority) || jobPriorityOptions.find(p => p.default);
60
+ const getJobPriority = priority => jobPriorityOptions.find(p => p.label === priority) || getDefaultJobPriority();
59
61
 
60
62
  export {
61
63
  jobStatusOptions,
@@ -65,4 +67,5 @@ export {
65
67
  getIncompleteJobStatuses,
66
68
  getJobStatus,
67
69
  getJobPriority,
70
+ getDefaultJobPriority,
68
71
  };
@@ -15,6 +15,7 @@ const INITIAL_STATE = {
15
15
  status: '',
16
16
  statusText: '',
17
17
  priority: '',
18
+ priorityText: '',
18
19
  type: '',
19
20
  assignee: '',
20
21
  assigneeName: '',
@@ -59,7 +60,7 @@ export default (state = INITIAL_STATE, action) => {
59
60
  case JOBS_HIDE_SEEN:
60
61
  return { ...state, hideSeen: action.payload };
61
62
  case JOB_FILTER_LOADED:
62
- return { ...state, jobfilters: action.payload };
63
+ return { ...state, jobfilters: action.payload || INITIAL_STATE.jobfilters };
63
64
  case REHYDRATE:
64
65
  if (!action.payload) return state;
65
66
  if (action.payload[REDUCER_KEY]) {
@@ -37,6 +37,7 @@ class RequestDetail extends Component {
37
37
  galleryImages: [],
38
38
  showMessages: false,
39
39
  assignees: [],
40
+ selectedPDF: null,
40
41
  };
41
42
 
42
43
  this.scrollView = React.createRef();
@@ -333,7 +334,7 @@ class RequestDetail extends Component {
333
334
  const statusOption = getJobStatus(status, this.props);
334
335
  const priority = getJobPriority(job.priority);
335
336
  const canEdit = this.hasPermission();
336
- const isStaff = this.props.user.category === 'staff'
337
+ const isStaff = this.props.user.category === 'staff';
337
338
  const showSeen = !status || status === getJobStatus(null, this.props).text;
338
339
 
339
340
  return (
@@ -464,6 +465,24 @@ class RequestDetail extends Component {
464
465
  return null;
465
466
  }
466
467
 
468
+ renderDocument(documents) {
469
+ const { colourBrandingMain } = this.props;
470
+
471
+ if (!_.isNil(documents) && !_.isEmpty(documents)) {
472
+ return documents.map((document, index) => {
473
+ return (
474
+ <TouchableOpacity key={index} style={styles.documentContainer} onPress={() => this.setState({ selectedPDF: document })}>
475
+ <View style={{ ...styles.documentTypeContainer, backgroundColor: colourBrandingMain }}>
476
+ <Text style={styles.documentTypeText}>{document.ext}</Text>
477
+ </View>
478
+ <Text style={styles.documentText}>{`${document.name}${document.uploading ? ` - ${document.uploadProgress}` : ''}`}</Text>
479
+ </TouchableOpacity>
480
+ );
481
+ });
482
+ }
483
+ return null;
484
+ }
485
+
467
486
  renderImagePopup() {
468
487
  return (
469
488
  <Components.ImagePopup
@@ -475,6 +494,18 @@ class RequestDetail extends Component {
475
494
  );
476
495
  }
477
496
 
497
+ renderDocumentPopup() {
498
+ if (_.isEmpty(this.state.selectedPDF)) return null;
499
+ return (
500
+ <Components.PDFPopup
501
+ source={this.state.selectedPDF.url}
502
+ onClose={() => this.setState({ selectedPDF: null })}
503
+ title={this.state.selectedPDF.name}
504
+ pdfCount={1}
505
+ />
506
+ );
507
+ }
508
+
478
509
  renderAssignee() {
479
510
  const { job } = this.state;
480
511
  if (!this.hasPermission() && !job.Assignee) return null;
@@ -526,7 +557,9 @@ class RequestDetail extends Component {
526
557
  case 'checkbox':
527
558
  return <Text style={styles.customText}>{field.answer && Array.isArray(field.answer) ? field.answer.join(', ') : ''}</Text>;
528
559
  case 'image':
529
- return <View style={{ marginTop: 8 }}>{this.renderImage(field.answer)}</View>;
560
+ return <View style={styles.customImage}>{this.renderImage(field.answer)}</View>;
561
+ case 'document':
562
+ return <View style={styles.customDocument}>{this.renderDocument(field.answer)}</View>;
530
563
  default:
531
564
  return <Text style={styles.customText}>{field.answer}</Text>;
532
565
  }
@@ -642,8 +675,8 @@ class RequestDetail extends Component {
642
675
  entityId={this.props.job.id}
643
676
  entityName={this.props.job.title}
644
677
  site={this.state.job.site || this.state.job.location}
645
- // noScroll={true}
646
- // style={{ position: 'absolute', bottom: 0, left: 0, right: 0 }}
678
+ // noScroll={true}
679
+ // style={{ position: 'absolute', bottom: 0, left: 0, right: 0 }}
647
680
  />
648
681
  );
649
682
  }
@@ -678,6 +711,7 @@ class RequestDetail extends Component {
678
711
  {this.renderStatusPopup()}
679
712
  {this.renderPriorityPopup()}
680
713
  {this.renderImagePopup()}
714
+ {this.renderDocumentPopup()}
681
715
  <DateTimePicker
682
716
  isVisible={this.state.isDateTimePickerVisible}
683
717
  onConfirm={this.onDateSelected}
@@ -949,6 +983,13 @@ const styles = StyleSheet.create({
949
983
  color: Colours.TEXT_DARKEST,
950
984
  paddingVertical: 8,
951
985
  },
986
+ customImage: {
987
+ marginTop: 8,
988
+ },
989
+ customDocument: {
990
+ marginTop: 8,
991
+ marginBottom: 16,
992
+ },
952
993
  customStaticTitle: {
953
994
  fontSize: 20,
954
995
  fontFamily: 'sf-semibold',
@@ -962,6 +1003,31 @@ const styles = StyleSheet.create({
962
1003
  lineHeight: 24,
963
1004
  marginBottom: 10,
964
1005
  },
1006
+ documentContainer: {
1007
+ flexDirection: 'row',
1008
+ alignItems: 'center',
1009
+ justifyContent: 'space-between',
1010
+ paddingVertical: 4,
1011
+ },
1012
+ documentTypeContainer: {
1013
+ width: 50,
1014
+ height: 60,
1015
+ justifyContent: 'center',
1016
+ alignItems: 'center',
1017
+ borderRadius: 5,
1018
+ marginRight: 8,
1019
+ },
1020
+ documentTypeText: {
1021
+ color: '#fff',
1022
+ fontFamily: 'sf-semibold',
1023
+ textAlign: 'center',
1024
+ },
1025
+ documentText: {
1026
+ flex: 1,
1027
+ fontFamily: 'sf-semibold',
1028
+ fontSize: 16,
1029
+ color: '#65686D',
1030
+ },
965
1031
  });
966
1032
 
967
1033
  const mapStateToProps = state => {