@plusscommunities/pluss-maintenance-app-forms 6.0.12-beta.0 → 7.0.0-beta.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 (64) hide show
  1. package/dist/module/actions/JobActions.js +1 -44
  2. package/dist/module/actions/JobActions.js.map +1 -1
  3. package/dist/module/actions/types.js +0 -3
  4. package/dist/module/actions/types.js.map +1 -1
  5. package/dist/module/apis/index.js +0 -2
  6. package/dist/module/apis/index.js.map +1 -1
  7. package/dist/module/apis/maintenanceActions.js +6 -21
  8. package/dist/module/apis/maintenanceActions.js.map +1 -1
  9. package/dist/module/components/FilterPopupMenu.js +18 -34
  10. package/dist/module/components/FilterPopupMenu.js.map +1 -1
  11. package/dist/module/components/MaintenanceList.js +56 -47
  12. package/dist/module/components/MaintenanceList.js.map +1 -1
  13. package/dist/module/components/MaintenanceListItem.js +27 -40
  14. package/dist/module/components/MaintenanceListItem.js.map +1 -1
  15. package/dist/module/components/MaintenanceWidgetItem.js +13 -13
  16. package/dist/module/components/MaintenanceWidgetItem.js.map +1 -1
  17. package/dist/module/components/StatusSelectorPopup.js +14 -9
  18. package/dist/module/components/StatusSelectorPopup.js.map +1 -1
  19. package/dist/module/components/WidgetSmall.js +3 -7
  20. package/dist/module/components/WidgetSmall.js.map +1 -1
  21. package/dist/module/helper.js +25 -39
  22. package/dist/module/helper.js.map +1 -1
  23. package/dist/module/reducers/JobsReducer.js +2 -31
  24. package/dist/module/reducers/JobsReducer.js.map +1 -1
  25. package/dist/module/screens/JobTypePicker.js +1 -1
  26. package/dist/module/screens/JobTypePicker.js.map +1 -1
  27. package/dist/module/screens/RequestDetail.js +19 -91
  28. package/dist/module/screens/RequestDetail.js.map +1 -1
  29. package/dist/module/screens/RequestNotes.js +20 -336
  30. package/dist/module/screens/RequestNotes.js.map +1 -1
  31. package/dist/module/screens/ServiceRequest.js +1 -1
  32. package/dist/module/screens/ServiceRequest.js.map +1 -1
  33. package/dist/module/values.config.a.js +1 -6
  34. package/dist/module/values.config.a.js.map +1 -1
  35. package/dist/module/values.config.default.js +1 -6
  36. package/dist/module/values.config.default.js.map +1 -1
  37. package/dist/module/values.config.forms.js +1 -6
  38. package/dist/module/values.config.forms.js.map +1 -1
  39. package/dist/module/values.config.js +1 -6
  40. package/dist/module/values.config.js.map +1 -1
  41. package/package.json +9 -8
  42. package/src/actions/JobActions.js +1 -53
  43. package/src/actions/types.js +0 -4
  44. package/src/apis/index.js +0 -4
  45. package/src/apis/maintenanceActions.js +6 -18
  46. package/src/components/FilterPopupMenu.js +21 -40
  47. package/src/components/MaintenanceList.js +47 -38
  48. package/src/components/MaintenanceListItem.js +22 -36
  49. package/src/components/MaintenanceWidgetItem.js +13 -17
  50. package/src/components/StatusSelectorPopup.js +14 -8
  51. package/src/components/WidgetSmall.js +3 -5
  52. package/src/helper.js +21 -50
  53. package/src/reducers/JobsReducer.js +1 -25
  54. package/src/screens/JobTypePicker.js +1 -1
  55. package/src/screens/RequestDetail.js +25 -88
  56. package/src/screens/RequestNotes.js +22 -342
  57. package/src/screens/ServiceRequest.js +2 -2
  58. package/src/values.config.a.js +0 -5
  59. package/src/values.config.default.js +0 -5
  60. package/src/values.config.forms.js +0 -5
  61. package/src/values.config.js +0 -5
  62. package/dist/module/components/PrioritySelectorPopup.js +0 -82
  63. package/dist/module/components/PrioritySelectorPopup.js.map +0 -1
  64. package/src/components/PrioritySelectorPopup.js +0 -79
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plusscommunities/pluss-maintenance-app-forms",
3
- "version": "6.0.12-beta.0",
3
+ "version": "7.0.0-beta.0",
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",
@@ -10,7 +10,7 @@
10
10
  "src/"
11
11
  ],
12
12
  "scripts": {
13
- "build": "npm i --legacy-peer-deps && bob build",
13
+ "build": "npm i && bob build",
14
14
  "betapatch": "npm version prepatch --preid=beta",
15
15
  "patch": "npm version patch",
16
16
  "betaupload": "npm run build && npm publish --access public --tag beta",
@@ -28,15 +28,16 @@
28
28
  "license": "ISC",
29
29
  "dependencies": {},
30
30
  "peerDependencies": {
31
- "@plusscommunities/pluss-core-app": "^6.1.6",
31
+ "@plusscommunities/pluss-core-app": "7.0.0-beta.0",
32
32
  "axios": "^1.6.8",
33
33
  "lodash": "^4.17.4",
34
34
  "moment": "^2.30.1",
35
- "react": "18.2.0",
36
- "react-native": "0.73.6",
37
- "react-native-elements": "^0.17.0",
35
+ "react": "18.3.1",
36
+ "react-native": "0.76.9",
37
+ "@rneui/base": "^4.0.0-rc.8",
38
+ "@rneui/themed": "^4.0.0-rc.8",
38
39
  "react-native-iphone-x-helper": "^1.3.1",
39
- "react-native-webview": "13.6.4",
40
+ "react-native-webview": "13.12.5",
40
41
  "react-redux": "^7.2.6",
41
42
  "redux-persist": "^6.0.0"
42
43
  },
@@ -50,4 +51,4 @@
50
51
  "module"
51
52
  ]
52
53
  }
53
- }
54
+ }
@@ -1,7 +1,4 @@
1
- import { JOBS_LOADED, JOB_ADDED, JOBS_ADDED, JOBS_STATUSES_LOADED, JOBS_HIDE_SEEN, JOB_FILTER_LOADED } from './types';
2
- import { stringActions } from '../apis';
3
- import { values } from '../values.config';
4
- import { jobStatusOptions } from '../helper';
1
+ import { JOBS_LOADED, JOB_ADDED, JOBS_ADDED } from './types';
5
2
 
6
3
  export const jobsLoaded = jobs => {
7
4
  return {
@@ -23,52 +20,3 @@ export const jobsAdded = jobs => {
23
20
  payload: jobs,
24
21
  };
25
22
  };
26
-
27
- export const jobStatusesUpdate = (site, callback = null) => {
28
- return dispatch => {
29
- stringActions
30
- .getString(site, values.stringConfigJobStatus)
31
- .then(res => {
32
- dispatch({
33
- type: JOBS_STATUSES_LOADED,
34
- payload: res.data,
35
- });
36
- if (callback) callback(res.data);
37
- })
38
- .catch(() => {
39
- dispatch({
40
- type: JOBS_STATUSES_LOADED,
41
- payload: jobStatusOptions,
42
- });
43
- if (callback) callback(jobStatusOptions);
44
- });
45
- };
46
- };
47
-
48
- export const jobHideSeenUpdate = (site, callback = null) => {
49
- return (dispatch) => {
50
- stringActions
51
- .getString(site, values.stringConfigHideSeen)
52
- .then((res) => {
53
- dispatch({
54
- type: JOBS_HIDE_SEEN,
55
- payload: res.data,
56
- });
57
- if (callback) callback(res.data);
58
- })
59
- .catch((_error) => {
60
- dispatch({
61
- type: JOBS_HIDE_SEEN,
62
- payload: false,
63
- });
64
- if (callback) callback(false);
65
- });
66
- };
67
- };
68
-
69
- export const jobsFilterLoaded = filters => {
70
- return {
71
- type: JOB_FILTER_LOADED,
72
- payload: filters,
73
- };
74
- };
@@ -3,7 +3,3 @@ import { values } from '../values.config';
3
3
  export const JOBS_LOADED = values.actionJobsLoaded;
4
4
  export const JOB_ADDED = values.actionJobAdded;
5
5
  export const JOBS_ADDED = values.actionJobsAdded;
6
- export const JOBS_STATUSES_LOADED = values.actionJobsStatusesLoaded;
7
- export const JOBS_HIDE_SEEN = values.actionJobsHideSeen;
8
- export const JOB_FILTER_LOADED = values.actionJobFilterLoaded;
9
-
package/src/apis/index.js CHANGED
@@ -1,5 +1 @@
1
- import { Apis } from '../core.config';
2
-
3
- export const stringActions = Apis.stringActions;
4
-
5
1
  export * from './maintenanceActions';
@@ -23,14 +23,11 @@ export const maintenanceActions = {
23
23
  data: { site, status, type },
24
24
  });
25
25
  },
26
- getJobs2: (site, status, priority, type, lastKey) => {
26
+ getJobs2: (site, status, type, lastKey) => {
27
27
  const query = { site };
28
28
  if (status) {
29
29
  query.status = status;
30
30
  }
31
- if (priority) {
32
- query.priority = priority;
33
- }
34
31
  if (type) {
35
32
  query.type = type;
36
33
  }
@@ -42,14 +39,14 @@ export const maintenanceActions = {
42
39
  url: Helper.getUrl(values.serviceKey, 'get/requests', query),
43
40
  });
44
41
  },
45
- getJobsRecursive: (site, status, priority, type, lastKey, jobs = []) => {
42
+ getJobsRecursive: (site, status, type, lastKey, jobs = []) => {
46
43
  return new Promise(resolve => {
47
- maintenanceActions.getJobs2(site, status, priority, type, lastKey).then(jobRes => {
44
+ maintenanceActions.getJobs2(site, status, type, lastKey).then(jobRes => {
48
45
  const newJobs = [...jobs, ...jobRes.data.Items];
49
46
  if (!jobRes.data.LastKey) {
50
47
  return resolve(newJobs);
51
48
  }
52
- return resolve(maintenanceActions.getJobsRecursive(site, status, priority, type, jobRes.data.LastKey, newJobs));
49
+ return resolve(maintenanceActions.getJobsRecursive(site, status, type, jobRes.data.LastKey, newJobs));
53
50
  });
54
51
  });
55
52
  },
@@ -103,13 +100,6 @@ export const maintenanceActions = {
103
100
  data: { id, status },
104
101
  });
105
102
  },
106
- editJobPriority: (id, priority) => {
107
- return Session.authedFunction({
108
- method: 'POST',
109
- url: Helper.getUrl(values.serviceKey, 'update/priority'),
110
- data: { id, priority },
111
- });
112
- },
113
103
  assignJob: (jobId, userId) => {
114
104
  return Session.authedFunction({
115
105
  method: 'POST',
@@ -126,7 +116,7 @@ export const maintenanceActions = {
126
116
  url: Helper.getUrl(values.serviceKey, 'get/assignees', { site }),
127
117
  });
128
118
  },
129
- addNote: (jobId, note, attachments, images) => {
119
+ addNote: (jobId, note, attachments) => {
130
120
  return Session.authedFunction({
131
121
  method: 'POST',
132
122
  url: Helper.getUrl(values.serviceKey, 'requests/note'),
@@ -134,12 +124,11 @@ export const maintenanceActions = {
134
124
  id: jobId,
135
125
  note,
136
126
  attachments,
137
- images,
138
127
  action: 'AddNote',
139
128
  },
140
129
  });
141
130
  },
142
- editNote: (jobId, noteId, note, attachments, images) => {
131
+ editNote: (jobId, noteId, note, attachments) => {
143
132
  return Session.authedFunction({
144
133
  method: 'POST',
145
134
  url: Helper.getUrl(values.serviceKey, 'requests/note'),
@@ -147,7 +136,6 @@ export const maintenanceActions = {
147
136
  id: jobId,
148
137
  note,
149
138
  attachments,
150
- images,
151
139
  noteId,
152
140
  action: 'EditNote',
153
141
  },
@@ -4,8 +4,6 @@ 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';
8
- import { values } from '../values.config';
9
7
 
10
8
  const SCREEN_HEIGHT = Dimensions.get('window').height;
11
9
 
@@ -16,20 +14,31 @@ class FilterPopupMenu extends Component {
16
14
  this.state = {
17
15
  types: props.types || [],
18
16
  selectedStatus: props.status || '',
19
- selectedPriority: props.priority || '',
20
17
  selectedType: props.type || '',
21
18
  selectedAssignee: props.assignee || '',
22
19
  assignees: [],
23
20
  };
24
- this.priorityOptions = [
21
+ this.statusOptions = [
25
22
  {
26
23
  label: 'All',
27
24
  value: '',
28
25
  },
29
- ...jobPriorityOptions.map(p => ({
30
- label: p.label,
31
- value: p.label,
32
- }))
26
+ {
27
+ label: 'Incomplete',
28
+ value: 'Unassigned|In Progress',
29
+ },
30
+ {
31
+ label: 'Open',
32
+ value: 'Unassigned',
33
+ },
34
+ {
35
+ label: 'In Progress',
36
+ value: 'In Progress',
37
+ },
38
+ {
39
+ label: 'Completed',
40
+ value: 'Completed',
41
+ },
33
42
  ];
34
43
  }
35
44
 
@@ -44,26 +53,6 @@ class FilterPopupMenu extends Component {
44
53
  }
45
54
  }
46
55
 
47
- getStatusOptions = () => {
48
- const statusOptions = getJobStatusOptions(this.props);
49
- const options = [
50
- {
51
- label: 'All',
52
- value: '',
53
- },
54
- {
55
- label: 'Incomplete',
56
- value: `Unassigned|${getIncompleteJobStatuses(this.props).map(s => s.text).join('|')}`,
57
- },
58
- ...statusOptions.map(s => ({
59
- label: s.text,
60
- value: s.text,
61
- })),
62
- ];
63
- // console.log('getStatusOptions', options);
64
- return options;
65
- }
66
-
67
56
  getAssignees = async () => {
68
57
  try {
69
58
  const res = await maintenanceActions.getAssignees(this.props.site);
@@ -104,12 +93,11 @@ class FilterPopupMenu extends Component {
104
93
 
105
94
  onDone = () => {
106
95
  const { onClose } = this.props;
107
- const { selectedStatus, selectedPriority, selectedType, selectedAssignee } = this.state;
96
+ const { selectedStatus, selectedType, selectedAssignee } = this.state;
108
97
  if (onClose)
109
98
  onClose({
110
99
  status: selectedStatus,
111
- statusText: this.getStatusOptions().find(o => o.value === selectedStatus)?.label,
112
- priority: selectedPriority,
100
+ statusText: this.statusOptions.find(o => o.value === selectedStatus)?.label,
113
101
  type: selectedType,
114
102
  assignee: selectedAssignee,
115
103
  assigneeName: this.state.assignees.find(a => a.value === selectedAssignee)?.label,
@@ -160,20 +148,15 @@ class FilterPopupMenu extends Component {
160
148
  }
161
149
 
162
150
  render() {
163
- // 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'
165
- const canFilterAssignee = !_.includes(this.props.user.permissions, values.permissionMaintenanceAssignment);
166
-
167
151
  return (
168
152
  <Modal visible transparent animationType="slide" onRequestClose={this.onDone}>
169
153
  <View style={styles.container}>
170
154
  <View style={styles.menu}>
171
155
  {this.renderTitle()}
172
156
  <ScrollView style={styles.optionContent}>
173
- {this.renderOptions('Status', this.getStatusOptions(), 'selectedStatus')}
174
- {isStaff ? this.renderOptions('Priority', this.priorityOptions, 'selectedPriority') : null}
157
+ {this.renderOptions('Status', this.statusOptions, 'selectedStatus')}
175
158
  {this.renderOptions('Type', this.state.types, 'selectedType')}
176
- {canFilterAssignee ? this.renderOptions('Assigned To', this.state.assignees, 'selectedAssignee') : null}
159
+ {this.renderOptions('Assigned To', this.state.assignees, 'selectedAssignee')}
177
160
  </ScrollView>
178
161
  {this.renderCancel()}
179
162
  </View>
@@ -265,10 +248,8 @@ const mapStateToProps = state => {
265
248
  const { user } = state;
266
249
 
267
250
  return {
268
- user,
269
251
  site: user.site,
270
252
  colourBrandingMain: Colours.getMainBrandingColourFromState(state),
271
- statusTypes: state[values.reducerKey].jobstatuses,
272
253
  };
273
254
  };
274
255
 
@@ -3,45 +3,53 @@ import { View, StyleSheet, FlatList, TouchableOpacity, Text } from 'react-native
3
3
  import _ from 'lodash';
4
4
  import { connect } from 'react-redux';
5
5
  import { maintenanceActions } from '../apis';
6
- import { jobsLoaded, jobAdded, jobsAdded, jobStatusesUpdate, jobHideSeenUpdate, jobsFilterLoaded } from '../actions';
6
+ import { jobsLoaded, jobAdded, jobsAdded } from '../actions';
7
7
  import MaintenanceListItem from '../components/MaintenanceListItem';
8
8
  import FilterPopupMenu from './FilterPopupMenu';
9
- import { Components, Colours, Helper } from '../core.config';
9
+ import { Components, Colours, Config, Helper } from '../core.config';
10
10
  import { values } from '../values.config';
11
11
 
12
12
  class MaintenanceList extends Component {
13
13
  constructor(props) {
14
14
  super(props);
15
15
 
16
+ this.initialStatus = props.hasPermission ? 'Unassigned|In Progress' : '';
17
+ this.initialStatusText = props.hasPermission ? 'Incomplete' : '';
18
+
16
19
  this.state = {
17
20
  types: [],
18
21
  filteredList: props.jobs,
19
22
  loading: false,
20
23
  searchText: '',
21
24
  showFilterPopup: false,
25
+ selectedStatus: this.initialStatus,
26
+ selectedStatusText: this.initialStatusText,
27
+ selectedType: '',
28
+ selectedAssignee: '',
29
+ selectedAssigneeName: '',
22
30
  };
23
31
  }
24
32
 
25
33
  componentDidMount() {
26
- this.props.jobStatusesUpdate(this.props.site);
27
- this.props.jobHideSeenUpdate(this.props.site);
28
34
  this.refresh();
29
35
  this.refreshTypes();
36
+
30
37
  this.resetDataSource();
31
38
  }
32
39
 
33
40
  componentDidUpdate(prevProps) {
34
41
  if (!prevProps.dataUpdated && this.props.dataUpdated) this.refresh();
35
- if (!_.isEqual(prevProps.jobs, this.props.jobs) || !_.isEqual(prevProps.jobfilters, this.props.jobfilters)) this.resetDataSource();
42
+ if (!_.isEqual(prevProps.jobs, this.props.jobs)) this.resetDataSource();
36
43
  }
37
44
 
38
45
  refresh = () => {
39
46
  this.onLoadingChanged(true, async () => {
40
47
  try {
41
- const { jobfilters } = this.props;
42
- const res = await maintenanceActions.getJobsRecursive(this.props.site, jobfilters.status, jobfilters.priority, jobfilters.type);
43
- // console.log('refresh', res ? JSON.stringify(res[0], null, 2) : null);
44
- if (!_.isEmpty(jobfilters.status) || !_.isEmpty(jobfilters.priority) || !_.isEmpty(jobfilters.type)) {
48
+ const { selectedStatus, selectedType } = this.state;
49
+ // console.log('filters', { selectedStatus, selectedType });
50
+ const res = await maintenanceActions.getJobsRecursive(this.props.site, selectedStatus, selectedType);
51
+ // console.log('refresh', res?.data);
52
+ if (selectedStatus !== this.initialStatus || !_.isEmpty(selectedType)) {
45
53
  this.props.jobsAdded(res);
46
54
  } else {
47
55
  this.props.jobsLoaded(res);
@@ -88,8 +96,7 @@ class MaintenanceList extends Component {
88
96
  }
89
97
 
90
98
  resetDataSource = (source = '') => {
91
- const { jobfilters } = this.props;
92
- const { searchText } = this.state;
99
+ const { searchText, selectedStatus, selectedType, selectedAssignee } = this.state;
93
100
  const { jobs } = this.props;
94
101
 
95
102
  let filteredList = jobs;
@@ -104,10 +111,9 @@ class MaintenanceList extends Component {
104
111
  });
105
112
  if (!jobIdMatch) this.fetchJob(searchText);
106
113
  }
107
- if (jobfilters.status) filteredList = filteredList.filter(j => jobfilters.status.includes(j.status));
108
- if (jobfilters.priority) filteredList = filteredList.filter(j => jobfilters.priority.includes(j.priority));
109
- if (jobfilters.type) filteredList = filteredList.filter(j => jobfilters.type.includes(j.type));
110
- if (jobfilters.assignee) filteredList = filteredList.filter(j => jobfilters.assignee.includes(j.AssigneeId));
114
+ if (selectedStatus) filteredList = filteredList.filter(j => selectedStatus.includes(j.status));
115
+ if (selectedType) filteredList = filteredList.filter(j => selectedType.includes(j.type));
116
+ if (selectedAssignee) filteredList = filteredList.filter(j => selectedAssignee.includes(j.AssigneeId));
111
117
  if (jobIdMatch) {
112
118
  const jobIndex = filteredList.indexOf(jobIdMatch);
113
119
  if (jobIndex > -1) {
@@ -142,24 +148,33 @@ class MaintenanceList extends Component {
142
148
  };
143
149
 
144
150
  onSelectFilter = selected => {
145
- this.props.jobsFilterLoaded(selected);
146
- this.onToggleFilter();
151
+ this.setState(
152
+ {
153
+ selectedStatus: selected.status,
154
+ selectedStatusText: selected.statusText,
155
+ selectedType: selected.type,
156
+ selectedAssignee: selected.assignee,
157
+ selectedAssigneeName: selected.assigneeName,
158
+ },
159
+ () => {
160
+ this.resetDataSource();
161
+ this.onToggleFilter();
162
+ },
163
+ );
147
164
  };
148
165
 
149
166
  getFilterButtonText = () => {
150
- const { jobfilters } = this.props;
167
+ const { selectedStatus, selectedStatusText, selectedType, selectedAssignee, selectedAssigneeName } = this.state;
151
168
  const filterTexts = [];
152
- if (!_.isEmpty(jobfilters.status)) {
153
- filterTexts.push(jobfilters.statusText);
169
+ if (!_.isEmpty(selectedStatus)) {
170
+ filterTexts.push(selectedStatusText);
154
171
  }
155
- if (!_.isEmpty(jobfilters.priority)) {
156
- filterTexts.push(jobfilters.priority);
157
- }
158
- if (!_.isEmpty(jobfilters.type)) {
159
- filterTexts.push(jobfilters.type);
172
+
173
+ if (!_.isEmpty(selectedType)) {
174
+ filterTexts.push(selectedType);
160
175
  }
161
- if (!_.isEmpty(jobfilters.assignee)) {
162
- filterTexts.push(jobfilters.assigneeName);
176
+ if (!_.isEmpty(selectedAssignee)) {
177
+ filterTexts.push(selectedAssigneeName);
163
178
  }
164
179
  if (_.isEmpty(filterTexts)) {
165
180
  return 'Filter';
@@ -229,18 +244,16 @@ class MaintenanceList extends Component {
229
244
  }
230
245
 
231
246
  renderFilterPopup() {
232
- const { jobfilters } = this.props;
233
- const { showFilterPopup, types } = this.state;
247
+ const { showFilterPopup, types, selectedStatus, selectedType, selectedAssignee } = this.state;
234
248
  if (!showFilterPopup) return null;
235
249
 
236
250
  return (
237
251
  <FilterPopupMenu
238
252
  site={this.props.site}
239
253
  types={types}
240
- status={jobfilters.status}
241
- priority={jobfilters.priority}
242
- assignee={jobfilters.assignee}
243
- type={jobfilters.type}
254
+ status={selectedStatus}
255
+ assignee={selectedAssignee}
256
+ type={selectedType}
244
257
  onClose={this.onSelectFilter}
245
258
  />
246
259
  );
@@ -316,11 +329,7 @@ const mapStateToProps = state => {
316
329
  userCategory: user.category,
317
330
  colourBrandingMain: Colours.getMainBrandingColourFromState(state),
318
331
  dataUpdated: notifications.dataUpdated[values.updateKey],
319
- statusTypes: state[values.reducerKey].jobstatuses,
320
- jobfilters: state[values.reducerKey].jobfilters,
321
332
  };
322
333
  };
323
334
 
324
- export default connect(mapStateToProps, { jobsLoaded, jobAdded, jobsAdded, jobStatusesUpdate, jobHideSeenUpdate, jobsFilterLoaded }, null, { forwardRef: true })(
325
- MaintenanceList,
326
- );
335
+ export default connect(mapStateToProps, { jobsLoaded, jobAdded, jobsAdded }, null, { forwardRef: true })(MaintenanceList);
@@ -1,10 +1,22 @@
1
1
  import React, { Component } from 'react';
2
2
  import { Image, Text, TouchableOpacity, View, StyleSheet } from 'react-native';
3
3
  import _ from 'lodash';
4
- import { Icon } from 'react-native-elements';
4
+ import { Icon } from '@rneui/themed';
5
5
  import { connect } from 'react-redux';
6
6
  import moment from 'moment';
7
- import { getJobStatus, getJobPriority } from '../helper';
7
+ // import {
8
+ // getShadowStyle,
9
+ // LINEGREY,
10
+ // TEXT_DARK,
11
+ // TEXT_LIGHT,
12
+ // COLOUR_GREEN,
13
+ // getMainBrandingColourFromState,
14
+ // hexToRGBAstring,
15
+ // getJobStatusProps,
16
+ // jobStatusOptions,
17
+ // } from '../../js';
18
+ // import NavigationService from '../../js/NavigationService';
19
+ import { getJobStatusProps, jobStatusOptions } from '../helper';
8
20
  import { Services } from '../feature.config';
9
21
  import { Helper, Colours } from '../core.config';
10
22
  import { values } from '../values.config';
@@ -35,9 +47,9 @@ class MaintenanceListItem extends Component {
35
47
  }
36
48
 
37
49
  renderSeen() {
38
- const { job, hideSeen } = this.props;
39
- const showSeen = !job.status || job.status === getJobStatus(null, this.props).text;
40
- if (hideSeen || !showSeen || !job.seen) {
50
+ const { job } = this.props;
51
+ const showSeen = !job.status || job.status === jobStatusOptions[0].name;
52
+ if (!showSeen || !job.seen) {
41
53
  return null;
42
54
  }
43
55
  return (
@@ -53,9 +65,7 @@ class MaintenanceListItem extends Component {
53
65
  const createdTime = moment(job.createdUnix);
54
66
  const createdTimeText = `${createdTime.format('ddd, D MMMM')} • ${createdTime.format('h:mma')}`;
55
67
  const assigneeText = job.Assignee ? `Assigned to\n${job.Assignee.displayName}` : '';
56
- const status = getJobStatus(job.status, this.props);
57
- const priority = getJobPriority(job.priority);
58
- const isStaff = this.props.user.category === 'staff'
68
+ const { statusText, statusColor } = getJobStatusProps(job.status);
59
69
 
60
70
  return (
61
71
  <TouchableOpacity onPress={this.onPressJob}>
@@ -88,21 +98,16 @@ class MaintenanceListItem extends Component {
88
98
  {/* {this.renderDescription()} */}
89
99
  <Text style={styles.jobCreatedText}>{createdTimeText}</Text>
90
100
  <View style={styles.jobActivityContainer}>
91
- <View style={[styles.jobStatusContainer, { backgroundColor: status?.color }]}>
101
+ <View style={[styles.jobStatusContainer, { backgroundColor: statusColor }]}>
92
102
  {/* <Icon name="wrench" type="font-awesome" iconStyle={styles.jobStatusIcon} /> */}
93
- <Text style={styles.jobStatusText}>{status?.text}</Text>
103
+ <Text style={styles.jobStatusText}>{statusText}</Text>
94
104
  </View>
95
- <View style={[styles.jobStatusLine, { borderColor: status?.color }]}>
105
+ <View style={[styles.jobStatusLine, { borderColor: statusColor }]}>
96
106
  <View style={styles.jobStatusLineMask} />
97
107
  </View>
98
- <View style={[styles.jobStatusCircle, { backgroundColor: status?.color }]} />
108
+ <View style={[styles.jobStatusCircle, { backgroundColor: statusColor }]} />
99
109
  <Text style={styles.jobStatusDateText}>{assigneeText}</Text>
100
110
  </View>
101
- {isStaff && (
102
- <View style={[styles.jobPriorityContainer, { backgroundColor: priority.color }]}>
103
- <Text style={styles.jobPriorityText}>{priority.label}</Text>
104
- </View>
105
- )}
106
111
  </View>
107
112
  </View>
108
113
  </View>
@@ -273,30 +278,11 @@ const styles = StyleSheet.create({
273
278
  fontSize: 14,
274
279
  color: Colours.TEXT_DARK,
275
280
  },
276
- jobPriorityContainer: {
277
- flexDirection: 'row',
278
- alignItems: 'center',
279
- justifyContent: 'center',
280
- width: 105,
281
- height: 24,
282
- paddingHorizontal: 8,
283
- borderRadius: 4,
284
- marginTop: 8,
285
- },
286
- jobPriorityText: {
287
- color: '#fff',
288
- textAlign: 'center',
289
- fontFamily: 'sf-semibold',
290
- fontSize: 13,
291
- },
292
281
  });
293
282
 
294
283
  const mapStateToProps = state => {
295
284
  return {
296
- user: state.user,
297
285
  colourBrandingMain: Colours.getMainBrandingColourFromState(state),
298
- statusTypes: state[values.reducerKey].jobstatuses,
299
- hideSeen: state[values.reducerKey].hideSeen,
300
286
  };
301
287
  };
302
288
 
@@ -1,10 +1,10 @@
1
1
  import React, { Component } from 'react';
2
2
  import { Text, View, StyleSheet, TouchableOpacity } from 'react-native';
3
3
  import { connect } from 'react-redux';
4
- import { Icon } from 'react-native-elements';
4
+ import { Icon } from '@rneui/themed';
5
5
  import moment from 'moment';
6
6
  import _ from 'lodash';
7
- import { getJobStatus } from '../helper';
7
+ import { getJobStatusProps, jobStatusOptions } from '../helper';
8
8
  import { Services } from '../feature.config';
9
9
  import { Colours, Helper } from '../core.config';
10
10
  import { values } from '../values.config';
@@ -15,12 +15,12 @@ class MaintenanceWidgetItem extends Component {
15
15
  };
16
16
 
17
17
  render() {
18
- const { job, hideSeen } = this.props;
18
+ const { job } = this.props;
19
19
  const createdTime = moment(job.createdUnix);
20
20
  const createdTimeText = `${createdTime.format('ddd, D MMMM')} • ${createdTime.format('h:mma')}`;
21
- const status = getJobStatus(job.status, this.props);
21
+ const { statusText, statusColor } = getJobStatusProps(job.status);
22
22
  const seenText = (() => {
23
- if (!job.status || job.status === getJobStatus(null, this.props).text) {
23
+ if (!job.status || job.status === jobStatusOptions[0].name) {
24
24
  return job.seen ? 'Seen' : 'Unseen';
25
25
  }
26
26
  return '';
@@ -35,19 +35,17 @@ class MaintenanceWidgetItem extends Component {
35
35
  {job.title}
36
36
  </Text>
37
37
  <Text style={styles.jobCreatedTimeText}>{createdTimeText}</Text>
38
- {!hideSeen ? (
39
- <View style={styles.jobSeenContainer}>
40
- {job.seen && !_.isEmpty(seenText) && (
41
- <Icon name="check" type="font-awesome" iconStyle={[styles.jobSeenIcon, { color: this.props.colourBrandingMain }]} />
42
- )}
43
- <Text style={[styles.jobSeenText, job.seen && { color: this.props.colourBrandingMain }]}>{seenText}</Text>
44
- </View>
45
- ) : null}
38
+ <View style={styles.jobSeenContainer}>
39
+ {job.seen && !_.isEmpty(seenText) && (
40
+ <Icon name="check" type="font-awesome" iconStyle={[styles.jobSeenIcon, { color: this.props.colourBrandingMain }]} />
41
+ )}
42
+ <Text style={[styles.jobSeenText, job.seen && { color: this.props.colourBrandingMain }]}>{seenText}</Text>
43
+ </View>
46
44
  </View>
47
45
  <View style={styles.jobBottomSection}>
48
- <View style={[styles.jobStatusContainer, { backgroundColor: status?.color }]}>
46
+ <View style={[styles.jobStatusContainer, { backgroundColor: statusColor }]}>
49
47
  {/* <Icon name="wrench" type="font-awesome" iconStyle={styles.jobStatusIcon} /> */}
50
- <Text style={styles.jobStatusText}>{status?.text}</Text>
48
+ <Text style={styles.jobStatusText}>{statusText}</Text>
51
49
  </View>
52
50
  </View>
53
51
  </View>
@@ -128,8 +126,6 @@ const styles = StyleSheet.create({
128
126
  const mapStateToProps = state => {
129
127
  return {
130
128
  colourBrandingMain: Colours.getMainBrandingColourFromState(state),
131
- statusTypes: state[values.reducerKey].jobstatuses,
132
- hideSeen: state[values.reducerKey].hideSeen,
133
129
  };
134
130
  };
135
131