@plusscommunities/pluss-maintenance-app 6.1.2-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 (69) hide show
  1. package/dist/module/apis/index.js +1 -1
  2. package/dist/module/apis/index.js.map +1 -1
  3. package/dist/module/apis/{generalActions.js → maintenanceActions.js} +25 -41
  4. package/dist/module/apis/maintenanceActions.js.map +1 -0
  5. package/dist/module/components/FilterPopupMenu.js +48 -12
  6. package/dist/module/components/FilterPopupMenu.js.map +1 -1
  7. package/dist/module/components/MaintenanceList.js +52 -18
  8. package/dist/module/components/MaintenanceList.js.map +1 -1
  9. package/dist/module/components/MaintenanceListItem.js +16 -17
  10. package/dist/module/components/MaintenanceListItem.js.map +1 -1
  11. package/dist/module/components/MaintenanceWidgetItem.js +4 -8
  12. package/dist/module/components/MaintenanceWidgetItem.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 +6 -6
  16. package/dist/module/components/WidgetSmall.js.map +1 -1
  17. package/dist/module/feature.config.js +3 -3
  18. package/dist/module/feature.config.js.map +1 -1
  19. package/dist/module/helper.js +10 -2
  20. package/dist/module/helper.js.map +1 -1
  21. package/dist/module/reducers/JobsReducer.js +2 -1
  22. package/dist/module/reducers/JobsReducer.js.map +1 -1
  23. package/dist/module/screens/JobTypePicker.js +3 -3
  24. package/dist/module/screens/JobTypePicker.js.map +1 -1
  25. package/dist/module/screens/MaintenancePage.js +2 -2
  26. package/dist/module/screens/RequestDetail.js +252 -72
  27. package/dist/module/screens/RequestDetail.js.map +1 -1
  28. package/dist/module/screens/RequestNotes.js +10 -8
  29. package/dist/module/screens/RequestNotes.js.map +1 -1
  30. package/dist/module/screens/ServiceRequest.js +596 -93
  31. package/dist/module/screens/ServiceRequest.js.map +1 -1
  32. package/dist/module/values.config.a.js +4 -1
  33. package/dist/module/values.config.a.js.map +1 -1
  34. package/dist/module/values.config.default.js +10 -1
  35. package/dist/module/values.config.default.js.map +1 -1
  36. package/dist/module/values.config.forms.js +37 -0
  37. package/dist/module/values.config.forms.js.map +1 -0
  38. package/dist/module/values.config.js +10 -1
  39. package/dist/module/values.config.js.map +1 -1
  40. package/package.json +12 -12
  41. package/src/apis/index.js +1 -1
  42. package/src/apis/{generalActions.js → maintenanceActions.js} +35 -39
  43. package/src/components/FilterPopupMenu.js +39 -7
  44. package/src/components/MaintenanceList.js +59 -19
  45. package/src/components/MaintenanceListItem.js +18 -10
  46. package/src/components/MaintenanceWidgetItem.js +2 -2
  47. package/src/components/StatusSelectorPopup.js +2 -1
  48. package/src/components/WidgetSmall.js +4 -4
  49. package/src/feature.config.js +15 -13
  50. package/src/helper.js +11 -2
  51. package/src/reducers/JobsReducer.js +2 -1
  52. package/src/screens/JobTypePicker.js +1 -1
  53. package/src/screens/RequestDetail.js +237 -51
  54. package/src/screens/RequestNotes.js +27 -25
  55. package/src/screens/ServiceRequest.js +642 -157
  56. package/src/values.config.a.js +3 -0
  57. package/src/values.config.default.js +9 -0
  58. package/src/values.config.forms.js +37 -0
  59. package/src/values.config.js +9 -0
  60. package/dist/module/apis/generalActions.js.map +0 -1
  61. package/dist/module/values.config.b.js +0 -28
  62. package/dist/module/values.config.b.js.map +0 -1
  63. package/dist/module/values.config.c.js +0 -28
  64. package/dist/module/values.config.c.js.map +0 -1
  65. package/dist/module/values.config.d.js +0 -28
  66. package/dist/module/values.config.d.js.map +0 -1
  67. package/src/values.config.b.js +0 -28
  68. package/src/values.config.c.js +0 -28
  69. package/src/values.config.d.js +0 -28
@@ -1,10 +1,7 @@
1
- // import axios from 'axios';
2
- // import { getUrl } from './helper';
3
- // import { authedFunction } from '../js';
4
1
  import { Helper, Session } from '../core.config';
5
2
  import { values } from '../values.config';
6
3
 
7
- export const generalActions = {
4
+ export const maintenanceActions = {
8
5
  getJob: (site, id) => {
9
6
  return Session.authedFunction({
10
7
  method: 'POST',
@@ -44,16 +41,30 @@ export const generalActions = {
44
41
  },
45
42
  getJobsRecursive: (site, status, type, lastKey, jobs = []) => {
46
43
  return new Promise(resolve => {
47
- generalActions.getJobs2(site, status, 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(generalActions.getJobsRecursive(site, status, type, jobRes.data.LastKey, newJobs));
49
+ return resolve(maintenanceActions.getJobsRecursive(site, status, type, jobRes.data.LastKey, newJobs));
53
50
  });
54
51
  });
55
52
  },
56
- sendMaintenanceRequest: (userID, userName, phone, room, title, description, date, type, images, location, isHome, homeText) => {
53
+ sendMaintenanceRequest: (
54
+ userID,
55
+ userName,
56
+ phone,
57
+ room,
58
+ title,
59
+ description,
60
+ date,
61
+ type,
62
+ images,
63
+ location,
64
+ isHome,
65
+ homeText,
66
+ customFields,
67
+ ) => {
57
68
  const request = {
58
69
  method: 'POST',
59
70
  url: Helper.getUrl(values.serviceKey, 'sendMaintenance'),
@@ -70,6 +81,7 @@ export const generalActions = {
70
81
  location,
71
82
  isHome,
72
83
  homeText,
84
+ customFields,
73
85
  },
74
86
  };
75
87
  return Session.authedFunction(request);
@@ -88,6 +100,22 @@ export const generalActions = {
88
100
  data: { id, status },
89
101
  });
90
102
  },
103
+ assignJob: (jobId, userId) => {
104
+ return Session.authedFunction({
105
+ method: 'POST',
106
+ url: Helper.getUrl(values.serviceKey, 'update/assign'),
107
+ data: {
108
+ id: jobId,
109
+ userId,
110
+ },
111
+ });
112
+ },
113
+ getAssignees: site => {
114
+ return Session.authedFunction({
115
+ method: 'GET',
116
+ url: Helper.getUrl(values.serviceKey, 'get/assignees', { site }),
117
+ });
118
+ },
91
119
  addNote: (jobId, note, attachments) => {
92
120
  return Session.authedFunction({
93
121
  method: 'POST',
@@ -124,10 +152,6 @@ export const generalActions = {
124
152
  },
125
153
  });
126
154
  },
127
- // getWeeklyMenu: async time => {
128
- // //deprecated
129
- // return null;
130
- // },
131
155
  getJobTypes: async site => {
132
156
  const url = Helper.getUrl(values.serviceKey, 'getjobtypes');
133
157
  return Session.authedFunction({
@@ -136,32 +160,4 @@ export const generalActions = {
136
160
  data: { site },
137
161
  });
138
162
  },
139
- // sendBookingRequest: async bookingInfo => {
140
- // return authedFunction({
141
- // method: 'POST',
142
- // data: {
143
- // bookingInfo,
144
- // },
145
- // url: getUrl('utility', 'sendBookingRequest'),
146
- // });
147
- // },
148
- // getString: async (site, id, useDefault) => {
149
- // return axios({
150
- // method: 'GET',
151
- // url: getUrl('strings', `get/${site}_${id}`, useDefault ? { useDefault } : undefined),
152
- // }).catch(error => {
153
- // console.log('getString error', error);
154
- // throw error;
155
- // });
156
- // },
157
- // getGeneralTerms: async () => {
158
- // return axios({
159
- // method: 'GET',
160
- // url: 'https://pluss.plussapp.com.au/strings-prd/get/plussSpace_termsofuse',
161
- // });
162
- // },
163
- // declineTerms: async (site, userID) => {
164
- // //deprecated
165
- // return null;
166
- // },
167
163
  };
@@ -1,10 +1,12 @@
1
1
  import React, { Component } from 'react';
2
- import { View, Text, TouchableOpacity, Modal } from 'react-native';
2
+ import { View, Text, TouchableOpacity, Modal, ScrollView, Dimensions } from 'react-native';
3
3
  import { connect } from 'react-redux';
4
4
  import _ from 'lodash';
5
- import { generalActions } from '../apis';
5
+ import { maintenanceActions } from '../apis';
6
6
  import { Colours, Helper } from '../core.config';
7
7
 
8
+ const SCREEN_HEIGHT = Dimensions.get('window').height;
9
+
8
10
  class FilterPopupMenu extends Component {
9
11
  constructor(props) {
10
12
  super(props);
@@ -13,6 +15,8 @@ class FilterPopupMenu extends Component {
13
15
  types: props.types || [],
14
16
  selectedStatus: props.status || '',
15
17
  selectedType: props.type || '',
18
+ selectedAssignee: props.assignee || '',
19
+ assignees: [],
16
20
  };
17
21
  this.statusOptions = [
18
22
  {
@@ -24,7 +28,7 @@ class FilterPopupMenu extends Component {
24
28
  value: 'Unassigned|In Progress',
25
29
  },
26
30
  {
27
- label: 'Unassigned',
31
+ label: 'Open',
28
32
  value: 'Unassigned',
29
33
  },
30
34
  {
@@ -39,6 +43,7 @@ class FilterPopupMenu extends Component {
39
43
  }
40
44
 
41
45
  componentDidMount() {
46
+ this.getAssignees();
42
47
  if (_.isEmpty(this.state.types)) this.refreshTypes();
43
48
  }
44
49
 
@@ -48,8 +53,30 @@ class FilterPopupMenu extends Component {
48
53
  }
49
54
  }
50
55
 
56
+ getAssignees = async () => {
57
+ try {
58
+ const res = await maintenanceActions.getAssignees(this.props.site);
59
+ let assignees = res.data.Users.map(t => {
60
+ return { label: t.displayName, value: t.id };
61
+ });
62
+ assignees = _.orderBy(assignees, 'label');
63
+
64
+ assignees.splice(0, 0, { label: 'All', value: '' });
65
+
66
+ const newState = { assignees };
67
+
68
+ if (!assignees.some(a => a.value === this.state.selectedAssignee)) {
69
+ newState.selectedAssignee = '';
70
+ }
71
+ // console.log('refreshassignees', assignees);
72
+ this.setState(newState);
73
+ } catch (error) {
74
+ console.error('getAssignees', error);
75
+ }
76
+ };
77
+
51
78
  refreshTypes = async () => {
52
- const { data } = await generalActions.getJobTypes(Helper.getSite(this.props.site));
79
+ const { data } = await maintenanceActions.getJobTypes(Helper.getSite(this.props.site));
53
80
  const types = data.map(t => {
54
81
  return { label: t.typeName, value: t.typeName };
55
82
  });
@@ -66,11 +93,14 @@ class FilterPopupMenu extends Component {
66
93
 
67
94
  onDone = () => {
68
95
  const { onClose } = this.props;
69
- const { selectedStatus, selectedType } = this.state;
96
+ const { selectedStatus, selectedType, selectedAssignee } = this.state;
70
97
  if (onClose)
71
98
  onClose({
72
99
  status: selectedStatus,
100
+ statusText: this.statusOptions.find(o => o.value === selectedStatus)?.label,
73
101
  type: selectedType,
102
+ assignee: selectedAssignee,
103
+ assigneeName: this.state.assignees.find(a => a.value === selectedAssignee)?.label,
74
104
  });
75
105
  };
76
106
 
@@ -123,10 +153,11 @@ class FilterPopupMenu extends Component {
123
153
  <View style={styles.container}>
124
154
  <View style={styles.menu}>
125
155
  {this.renderTitle()}
126
- <View style={styles.optionContent}>
156
+ <ScrollView style={styles.optionContent}>
127
157
  {this.renderOptions('Status', this.statusOptions, 'selectedStatus')}
128
158
  {this.renderOptions('Type', this.state.types, 'selectedType')}
129
- </View>
159
+ {this.renderOptions('Assigned To', this.state.assignees, 'selectedAssignee')}
160
+ </ScrollView>
130
161
  {this.renderCancel()}
131
162
  </View>
132
163
  </View>
@@ -153,6 +184,7 @@ const styles = {
153
184
  backgroundColor: '#fff',
154
185
  borderTopLeftRadius: 12,
155
186
  borderTopRightRadius: 12,
187
+ maxHeight: SCREEN_HEIGHT * 0.8,
156
188
  },
157
189
  cancelContainer: {
158
190
  paddingVertical: 16,
@@ -2,7 +2,7 @@ import React, { Component } from 'react';
2
2
  import { View, StyleSheet, FlatList, TouchableOpacity, Text } from 'react-native';
3
3
  import _ from 'lodash';
4
4
  import { connect } from 'react-redux';
5
- import { generalActions } from '../apis';
5
+ import { maintenanceActions } from '../apis';
6
6
  import { jobsLoaded, jobAdded, jobsAdded } from '../actions';
7
7
  import MaintenanceListItem from '../components/MaintenanceListItem';
8
8
  import FilterPopupMenu from './FilterPopupMenu';
@@ -14,6 +14,7 @@ class MaintenanceList extends Component {
14
14
  super(props);
15
15
 
16
16
  this.initialStatus = props.hasPermission ? 'Unassigned|In Progress' : '';
17
+ this.initialStatusText = props.hasPermission ? 'Incomplete' : '';
17
18
 
18
19
  this.state = {
19
20
  types: [],
@@ -22,7 +23,10 @@ class MaintenanceList extends Component {
22
23
  searchText: '',
23
24
  showFilterPopup: false,
24
25
  selectedStatus: this.initialStatus,
26
+ selectedStatusText: this.initialStatusText,
25
27
  selectedType: '',
28
+ selectedAssignee: '',
29
+ selectedAssigneeName: '',
26
30
  };
27
31
  }
28
32
 
@@ -43,8 +47,8 @@ class MaintenanceList extends Component {
43
47
  try {
44
48
  const { selectedStatus, selectedType } = this.state;
45
49
  // console.log('filters', { selectedStatus, selectedType });
46
- const res = await generalActions.getJobsRecursive(this.props.site, selectedStatus, selectedType);
47
- // console.log('refresh', JSON.stringify(res, null, 2));
50
+ const res = await maintenanceActions.getJobsRecursive(this.props.site, selectedStatus, selectedType);
51
+ // console.log('refresh', res?.data);
48
52
  if (selectedStatus !== this.initialStatus || !_.isEmpty(selectedType)) {
49
53
  this.props.jobsAdded(res);
50
54
  } else {
@@ -59,7 +63,7 @@ class MaintenanceList extends Component {
59
63
  };
60
64
 
61
65
  refreshTypes = async () => {
62
- const { data } = await generalActions.getJobTypes(Helper.getSite(this.props.site));
66
+ const { data } = await maintenanceActions.getJobTypes(Helper.getSite(this.props.site));
63
67
  const types = data.map(t => {
64
68
  return { label: t.typeName, value: t.typeName };
65
69
  });
@@ -73,7 +77,7 @@ class MaintenanceList extends Component {
73
77
 
74
78
  this.onLoadingChanged(true, async () => {
75
79
  try {
76
- const job = await generalActions.getJobByJobId(this.props.site, jobId);
80
+ const job = await maintenanceActions.getJobByJobId(this.props.site, jobId);
77
81
  // console.log('fetchJob', job?.data);
78
82
  this.props.jobAdded(job.data);
79
83
  } catch (error) {
@@ -88,11 +92,11 @@ class MaintenanceList extends Component {
88
92
  if (this.props.options && !_.isEmpty(this.props.options.EmptyText)) {
89
93
  return this.props.options.EmptyText;
90
94
  }
91
- return this.props.userCategory === 'staff' ? Config.env.strings.EMPTY_REQUESTS_STAFF : Config.env.strings.EMPTY_REQUESTS_USER;
95
+ return this.props.userCategory === 'staff' ? values.emptyRequestsStaff : values.emptyRequestsUser;
92
96
  }
93
97
 
94
98
  resetDataSource = (source = '') => {
95
- const { searchText, selectedStatus, selectedType } = this.state;
99
+ const { searchText, selectedStatus, selectedType, selectedAssignee } = this.state;
96
100
  const { jobs } = this.props;
97
101
 
98
102
  let filteredList = jobs;
@@ -109,6 +113,7 @@ class MaintenanceList extends Component {
109
113
  }
110
114
  if (selectedStatus) filteredList = filteredList.filter(j => selectedStatus.includes(j.status));
111
115
  if (selectedType) filteredList = filteredList.filter(j => selectedType.includes(j.type));
116
+ if (selectedAssignee) filteredList = filteredList.filter(j => selectedAssignee.includes(j.AssigneeId));
112
117
  if (jobIdMatch) {
113
118
  const jobIndex = filteredList.indexOf(jobIdMatch);
114
119
  if (jobIndex > -1) {
@@ -143,10 +148,38 @@ class MaintenanceList extends Component {
143
148
  };
144
149
 
145
150
  onSelectFilter = selected => {
146
- this.setState({ selectedStatus: selected.status, selectedType: selected.type }, () => {
147
- this.resetDataSource();
148
- this.onToggleFilter();
149
- });
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
+ );
164
+ };
165
+
166
+ getFilterButtonText = () => {
167
+ const { selectedStatus, selectedStatusText, selectedType, selectedAssignee, selectedAssigneeName } = this.state;
168
+ const filterTexts = [];
169
+ if (!_.isEmpty(selectedStatus)) {
170
+ filterTexts.push(selectedStatusText);
171
+ }
172
+
173
+ if (!_.isEmpty(selectedType)) {
174
+ filterTexts.push(selectedType);
175
+ }
176
+ if (!_.isEmpty(selectedAssignee)) {
177
+ filterTexts.push(selectedAssigneeName);
178
+ }
179
+ if (_.isEmpty(filterTexts)) {
180
+ return 'Filter';
181
+ }
182
+ return `Filtering by ${filterTexts.join(', ')}`;
150
183
  };
151
184
 
152
185
  renderEmptyList() {
@@ -157,7 +190,7 @@ class MaintenanceList extends Component {
157
190
  return (
158
191
  <TouchableOpacity onPress={this.onToggleFilter}>
159
192
  <View style={styles.filterButton}>
160
- <Text style={[styles.filterButtonText, { color: this.props.colourBrandingMain }]}>Filter</Text>
193
+ <Text style={[styles.filterButtonText, { color: this.props.colourBrandingMain }]}>{this.getFilterButtonText()}</Text>
161
194
  </View>
162
195
  </TouchableOpacity>
163
196
  );
@@ -169,7 +202,7 @@ class MaintenanceList extends Component {
169
202
  return (
170
203
  <View style={styles.searchContainer}>
171
204
  <Components.GenericInput
172
- placeholder="Search by Job ID or Location"
205
+ placeholder={`Search by ${values.textEntityName} ID or Address`}
173
206
  value={this.state.searchText}
174
207
  onChangeText={this.onSearchText}
175
208
  onSubmitEditing={this.onSearchSubmit}
@@ -186,7 +219,7 @@ class MaintenanceList extends Component {
186
219
  const { ListHeaderComponent } = this.props;
187
220
  return (
188
221
  <View>
189
- {ListHeaderComponent ? ListHeaderComponent : <View style={{ height: 32 }} />}
222
+ {ListHeaderComponent ? ListHeaderComponent : <View style={{ height: 8 }} />}
190
223
  {this.renderFilterButton()}
191
224
  {this.renderSearch()}
192
225
  </View>
@@ -211,11 +244,18 @@ class MaintenanceList extends Component {
211
244
  }
212
245
 
213
246
  renderFilterPopup() {
214
- const { showFilterPopup, types, selectedStatus, selectedType } = this.state;
247
+ const { showFilterPopup, types, selectedStatus, selectedType, selectedAssignee } = this.state;
215
248
  if (!showFilterPopup) return null;
216
249
 
217
250
  return (
218
- <FilterPopupMenu site={this.props.site} types={types} status={selectedStatus} type={selectedType} onClose={this.onSelectFilter} />
251
+ <FilterPopupMenu
252
+ site={this.props.site}
253
+ types={types}
254
+ status={selectedStatus}
255
+ assignee={selectedAssignee}
256
+ type={selectedType}
257
+ onClose={this.onSelectFilter}
258
+ />
219
259
  );
220
260
  }
221
261
 
@@ -266,9 +306,9 @@ const styles = StyleSheet.create({
266
306
  paddingHorizontal: 16,
267
307
  },
268
308
  filterButton: {
269
- position: 'absolute',
270
- right: 20,
271
- top: -32,
309
+ paddingBottom: 8,
310
+ paddingHorizontal: 16,
311
+ flexDirection: 'row-reverse',
272
312
  },
273
313
  filterButtonText: {
274
314
  fontFamily: 'sf-semibold',
@@ -1,7 +1,7 @@
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
7
  // import {
@@ -64,7 +64,7 @@ class MaintenanceListItem extends Component {
64
64
  const { job } = this.props;
65
65
  const createdTime = moment(job.createdUnix);
66
66
  const createdTimeText = `${createdTime.format('ddd, D MMMM')} • ${createdTime.format('h:mma')}`;
67
- const activityTimeText = job.expectedDate ? moment(job.expectedDate).format('D MMMM') : '--';
67
+ const assigneeText = job.Assignee ? `Assigned to\n${job.Assignee.displayName}` : '';
68
68
  const { statusText, statusColor } = getJobStatusProps(job.status);
69
69
 
70
70
  return (
@@ -73,12 +73,18 @@ class MaintenanceListItem extends Component {
73
73
  <View style={styles.jobInnerContainer}>
74
74
  <View style={styles.jobTopSection}>
75
75
  <View style={styles.jobTopLeft}>
76
- {job.jobId ? <Text style={[styles.jobIdText, { color: this.props.colourBrandingMain }]}>{`Job #${job.jobId}`}</Text> : null}
76
+ {job.jobId ? (
77
+ <Text
78
+ style={[styles.jobIdText, { color: this.props.colourBrandingMain }]}
79
+ >{`${values.textEntityName} #${job.jobId}`}</Text>
80
+ ) : null}
77
81
  <Text style={styles.jobTitleText}>{job.title}</Text>
78
82
  {job.room ? <Text style={styles.jobLocationText}>{job.room}</Text> : null}
79
83
  <View style={styles.jobTypeSeenContainer}>
80
84
  <View style={[styles.jobTypeContainer, { backgroundColor: Colours.hexToRGBAstring(this.props.colourBrandingMain, 0.2) }]}>
81
- <Text style={[styles.jobTypeText, { color: this.props.colourBrandingMain }]}>{job.type}</Text>
85
+ <Text style={[styles.jobTypeText, { color: this.props.colourBrandingMain }]} numberOfLines={2}>
86
+ {job.type}
87
+ </Text>
82
88
  </View>
83
89
  {this.renderSeen()}
84
90
  </View>
@@ -93,14 +99,14 @@ class MaintenanceListItem extends Component {
93
99
  <Text style={styles.jobCreatedText}>{createdTimeText}</Text>
94
100
  <View style={styles.jobActivityContainer}>
95
101
  <View style={[styles.jobStatusContainer, { backgroundColor: statusColor }]}>
96
- <Icon name="wrench" type="font-awesome" iconStyle={styles.jobStatusIcon} />
102
+ {/* <Icon name="wrench" type="font-awesome" iconStyle={styles.jobStatusIcon} /> */}
97
103
  <Text style={styles.jobStatusText}>{statusText}</Text>
98
104
  </View>
99
105
  <View style={[styles.jobStatusLine, { borderColor: statusColor }]}>
100
106
  <View style={styles.jobStatusLineMask} />
101
107
  </View>
102
108
  <View style={[styles.jobStatusCircle, { backgroundColor: statusColor }]} />
103
- <Text style={styles.jobStatusDateText}>{activityTimeText}</Text>
109
+ <Text style={styles.jobStatusDateText}>{assigneeText}</Text>
104
110
  </View>
105
111
  </View>
106
112
  </View>
@@ -152,8 +158,9 @@ const styles = StyleSheet.create({
152
158
  alignItems: 'center',
153
159
  },
154
160
  jobTypeContainer: {
155
- height: 20,
156
- width: 80,
161
+ padding: 4,
162
+ minWidth: 80,
163
+ maxWidth: 140,
157
164
  borderRadius: 4,
158
165
  justifyContent: 'center',
159
166
  },
@@ -161,6 +168,7 @@ const styles = StyleSheet.create({
161
168
  fontFamily: 'sf-semibold',
162
169
  fontSize: 12,
163
170
  textAlign: 'center',
171
+ maxWidth: '100%',
164
172
  },
165
173
  jobSeenContainer: {
166
174
  flexDirection: 'row',
@@ -228,7 +236,7 @@ const styles = StyleSheet.create({
228
236
  jobStatusContainer: {
229
237
  flexDirection: 'row',
230
238
  alignItems: 'center',
231
- justifyContent: 'space-between',
239
+ justifyContent: 'center',
232
240
  width: 105,
233
241
  height: 30,
234
242
  paddingHorizontal: 8,
@@ -266,7 +274,7 @@ const styles = StyleSheet.create({
266
274
  jobStatusDateText: {
267
275
  flex: 1,
268
276
  textAlign: 'right',
269
- fontFamily: 'sf-bold',
277
+ fontFamily: 'sf-medium',
270
278
  fontSize: 14,
271
279
  color: Colours.TEXT_DARK,
272
280
  },
@@ -1,7 +1,7 @@
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
7
  import { getJobStatusProps, jobStatusOptions } from '../helper';
@@ -44,7 +44,7 @@ class MaintenanceWidgetItem extends Component {
44
44
  </View>
45
45
  <View style={styles.jobBottomSection}>
46
46
  <View style={[styles.jobStatusContainer, { backgroundColor: statusColor }]}>
47
- <Icon name="wrench" type="font-awesome" iconStyle={styles.jobStatusIcon} />
47
+ {/* <Icon name="wrench" type="font-awesome" iconStyle={styles.jobStatusIcon} /> */}
48
48
  <Text style={styles.jobStatusText}>{statusText}</Text>
49
49
  </View>
50
50
  </View>
@@ -11,6 +11,7 @@ class StatusSelectorPopup extends PureComponent {
11
11
  ? filter.map(status => {
12
12
  return {
13
13
  name: status,
14
+ label: getJobStatusLabel(status),
14
15
  color: getJobStatusColour(status),
15
16
  };
16
17
  })
@@ -32,7 +33,7 @@ class StatusSelectorPopup extends PureComponent {
32
33
  return (
33
34
  <TouchableOpacity key={status.name} onPress={() => onSelect(status.name)}>
34
35
  <View style={[styles.jobStatusContainer, { backgroundColor: status.color }]}>
35
- <Text style={styles.jobStatusText}>{status.name}</Text>
36
+ <Text style={styles.jobStatusText}>{status.label}</Text>
36
37
  </View>
37
38
  </TouchableOpacity>
38
39
  );
@@ -2,7 +2,7 @@ import React, { Component } from 'react';
2
2
  import { Text, View, ScrollView, StyleSheet } from 'react-native';
3
3
  import { connect } from 'react-redux';
4
4
  import _ from 'lodash';
5
- import { generalActions } from '../apis';
5
+ import { maintenanceActions } from '../apis';
6
6
  import { jobsLoaded } from '../actions';
7
7
  import MaintenanceWidgetItem from './MaintenanceWidgetItem';
8
8
  import { Services } from '../feature.config';
@@ -34,13 +34,13 @@ class WidgetSmall extends Component {
34
34
  getEmptyStateText = () => {
35
35
  const { options, userCategory } = this.props;
36
36
  if (options && !_.isEmpty(options.EmptyText)) return options.EmptyText;
37
- return userCategory === 'staff' ? Config.env.strings.EMPTY_REQUESTS_STAFF : Config.env.strings.EMPTY_REQUESTS_USER;
37
+ return userCategory === 'staff' ? values.emptyRequestsStaff : values.emptyRequestsUser;
38
38
  };
39
39
 
40
40
  refresh = () => {
41
41
  this.onLoadingChanged(true, async () => {
42
42
  try {
43
- const res = await generalActions.getJobsRecursive(this.props.site);
43
+ const res = await maintenanceActions.getJobsRecursive(this.props.site);
44
44
  // console.log('WidgetSmall - refresh', res.data);
45
45
  this.props.jobsLoaded(res);
46
46
  } catch (error) {
@@ -59,7 +59,7 @@ class WidgetSmall extends Component {
59
59
  };
60
60
 
61
61
  onPressAll = () => {
62
- Services.navigation.navigate('maintenance', { options: this.props.options });
62
+ Services.navigation.navigate(values.screenMaintenance, { options: this.props.options });
63
63
  };
64
64
 
65
65
  renderContent() {
@@ -16,7 +16,7 @@ const FeatureConfig = {
16
16
  title: values.textFeatureTitle,
17
17
  gridMenu: {
18
18
  icon: values.iconGridMenu,
19
- viewBox: '0 0 30 30',
19
+ viewBox: values.gridViewBox,
20
20
  navigate: values.screenMaintenance,
21
21
  },
22
22
  addMenu: {
@@ -26,18 +26,20 @@ const FeatureConfig = {
26
26
  navigate: values.screenServiceRequest,
27
27
  visibleExps: { type: 'feature', value: values.featureKey },
28
28
  },
29
- moreMenu: {
30
- order: values.orderMoreMenu,
31
- title: values.textMoreMenuTitle,
32
- navigate: values.screenMaintenance,
33
- visibleExps: {
34
- type: 'and',
35
- exps: [
36
- { type: 'notHidden', value: 'maintenanceRequest' },
37
- { type: 'notUserType', value: 'KIOSK' },
38
- ],
39
- },
40
- },
29
+ moreMenu: values.hasMoreOption
30
+ ? {
31
+ order: values.orderMoreMenu,
32
+ title: values.textMoreMenuTitle,
33
+ navigate: values.screenMaintenance,
34
+ visibleExps: {
35
+ type: 'and',
36
+ exps: [
37
+ { type: 'notHidden', value: 'maintenanceRequest' },
38
+ { type: 'notUserType', value: 'KIOSK' },
39
+ ],
40
+ },
41
+ }
42
+ : undefined,
41
43
  kioskAction: {
42
44
  order: values.orderKioskAction,
43
45
  icon: values.iconKioskAction,
package/src/helper.js CHANGED
@@ -1,16 +1,20 @@
1
+ import { label } from 'aws-amplify';
1
2
  import { Colours } from './core.config';
2
3
 
3
4
  const jobStatusOptions = [
4
5
  {
5
6
  name: 'Unassigned',
7
+ label: 'Open',
6
8
  color: Colours.LINEGREY,
7
9
  },
8
10
  {
9
11
  name: 'In Progress',
12
+ label: 'In Progress',
10
13
  color: Colours.COLOUR_TEAL,
11
14
  },
12
15
  {
13
16
  name: 'Completed',
17
+ label: 'Completed',
14
18
  color: Colours.COLOUR_GREEN_LIGHT,
15
19
  },
16
20
  ];
@@ -20,11 +24,16 @@ const getJobStatusColour = status => {
20
24
  return option ? option.color : jobStatusOptions[0].color;
21
25
  };
22
26
 
27
+ const getJobStatusLabel = status => {
28
+ const option = jobStatusOptions.find(item => item.name === status);
29
+ return option ? option.label : jobStatusOptions[0].label;
30
+ };
31
+
23
32
  const getJobStatusProps = status => {
24
- const statusText = status || jobStatusOptions[0].name;
33
+ const statusText = getJobStatusLabel(status) || jobStatusOptions[0].label;
25
34
  const statusColor = getJobStatusColour(statusText);
26
35
 
27
36
  return { statusText, statusColor };
28
37
  };
29
38
 
30
- export { jobStatusOptions, getJobStatusColour, getJobStatusProps };
39
+ export { jobStatusOptions, getJobStatusColour, getJobStatusProps, getJobStatusLabel };
@@ -3,8 +3,9 @@ import _ from 'lodash';
3
3
  import { REHYDRATE } from 'redux-persist';
4
4
  import { JOBS_LOADED, JOB_ADDED, JOBS_ADDED } from '../actions/types';
5
5
  import { ActionTypes } from '../core.config';
6
+ import { values } from '../values.config';
6
7
 
7
- const REDUCER_KEY = 'jobs';
8
+ const REDUCER_KEY = values.reducerKey;
8
9
 
9
10
  const INITIAL_STATE = {
10
11
  jobs: [],
@@ -2,7 +2,7 @@ import React, { Component } from 'react';
2
2
  import _ from 'lodash';
3
3
  import { TouchableOpacity, View, ScrollView, Text } from 'react-native';
4
4
  import { connect } from 'react-redux';
5
- import { Icon } from 'react-native-elements';
5
+ import { Icon } from '@rneui/themed';
6
6
  import { Services } from '../feature.config';
7
7
  import { Components, Colours } from '../core.config';
8
8