@plusscommunities/pluss-maintenance-app 6.0.6-auth.0 → 6.1.2-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 (71) hide show
  1. package/dist/module/actions/types.js +4 -3
  2. package/dist/module/actions/types.js.map +1 -1
  3. package/dist/module/apis/{maintenanceActions.js → generalActions.js} +51 -33
  4. package/dist/module/apis/generalActions.js.map +1 -0
  5. package/dist/module/apis/index.js +1 -1
  6. package/dist/module/apis/index.js.map +1 -1
  7. package/dist/module/components/FilterPopupMenu.js +12 -48
  8. package/dist/module/components/FilterPopupMenu.js.map +1 -1
  9. package/dist/module/components/MaintenanceList.js +19 -52
  10. package/dist/module/components/MaintenanceList.js.map +1 -1
  11. package/dist/module/components/MaintenanceListItem.js +17 -15
  12. package/dist/module/components/MaintenanceListItem.js.map +1 -1
  13. package/dist/module/components/MaintenanceWidgetItem.js +9 -4
  14. package/dist/module/components/MaintenanceWidgetItem.js.map +1 -1
  15. package/dist/module/components/StatusSelectorPopup.js +1 -2
  16. package/dist/module/components/StatusSelectorPopup.js.map +1 -1
  17. package/dist/module/components/WidgetSmall.js +10 -7
  18. package/dist/module/components/WidgetSmall.js.map +1 -1
  19. package/dist/module/feature.config.js +18 -33
  20. package/dist/module/feature.config.js.map +1 -1
  21. package/dist/module/helper.js +2 -10
  22. package/dist/module/helper.js.map +1 -1
  23. package/dist/module/index.js +15 -10
  24. package/dist/module/index.js.map +1 -1
  25. package/dist/module/reducers/JobsReducer.js +2 -2
  26. package/dist/module/reducers/JobsReducer.js.map +1 -1
  27. package/dist/module/screens/JobTypePicker.js +2 -2
  28. package/dist/module/screens/MaintenancePage.js +9 -5
  29. package/dist/module/screens/MaintenancePage.js.map +1 -1
  30. package/dist/module/screens/RequestDetail.js +44 -145
  31. package/dist/module/screens/RequestDetail.js.map +1 -1
  32. package/dist/module/screens/RequestNotes.js +8 -7
  33. package/dist/module/screens/RequestNotes.js.map +1 -1
  34. package/dist/module/screens/ServiceRequest.js +12 -9
  35. package/dist/module/screens/ServiceRequest.js.map +1 -1
  36. package/dist/module/values.config.a.js +28 -0
  37. package/dist/module/values.config.a.js.map +1 -0
  38. package/dist/module/values.config.b.js +28 -0
  39. package/dist/module/values.config.b.js.map +1 -0
  40. package/dist/module/values.config.c.js +28 -0
  41. package/dist/module/values.config.c.js.map +1 -0
  42. package/dist/module/values.config.d.js +28 -0
  43. package/dist/module/values.config.d.js.map +1 -0
  44. package/dist/module/values.config.default.js +28 -0
  45. package/dist/module/values.config.default.js.map +1 -0
  46. package/dist/module/values.config.js +28 -0
  47. package/dist/module/values.config.js.map +1 -0
  48. package/package.json +13 -9
  49. package/src/actions/types.js +5 -3
  50. package/src/apis/{maintenanceActions.js → generalActions.js} +50 -30
  51. package/src/apis/index.js +1 -1
  52. package/src/components/FilterPopupMenu.js +7 -39
  53. package/src/components/MaintenanceList.js +21 -59
  54. package/src/components/MaintenanceListItem.js +10 -13
  55. package/src/components/MaintenanceWidgetItem.js +3 -2
  56. package/src/components/StatusSelectorPopup.js +1 -2
  57. package/src/components/WidgetSmall.js +8 -5
  58. package/src/feature.config.js +18 -30
  59. package/src/helper.js +2 -11
  60. package/src/index.js +15 -8
  61. package/src/screens/MaintenancePage.js +5 -4
  62. package/src/screens/RequestDetail.js +19 -135
  63. package/src/screens/RequestNotes.js +6 -5
  64. package/src/screens/ServiceRequest.js +8 -6
  65. package/src/values.config.a.js +28 -0
  66. package/src/values.config.b.js +28 -0
  67. package/src/values.config.c.js +28 -0
  68. package/src/values.config.d.js +28 -0
  69. package/src/values.config.default.js +28 -0
  70. package/src/values.config.js +28 -0
  71. package/dist/module/apis/maintenanceActions.js.map +0 -1
@@ -19,10 +19,11 @@ import moment from 'moment';
19
19
  import { getJobStatusProps, jobStatusOptions } from '../helper';
20
20
  import { Services } from '../feature.config';
21
21
  import { Helper, Colours } from '../core.config';
22
+ import { values } from '../values.config';
22
23
 
23
24
  class MaintenanceListItem extends Component {
24
25
  onPressJob = () => {
25
- Services.navigation.navigate('requestDetail', { job: this.props.job });
26
+ Services.navigation.navigate(values.screenRequestDetail, { job: this.props.job });
26
27
  };
27
28
 
28
29
  renderCommentCount() {
@@ -63,7 +64,7 @@ class MaintenanceListItem extends Component {
63
64
  const { job } = this.props;
64
65
  const createdTime = moment(job.createdUnix);
65
66
  const createdTimeText = `${createdTime.format('ddd, D MMMM')} • ${createdTime.format('h:mma')}`;
66
- const assigneeText = job.Assignee ? `Assigned to\n${job.Assignee.displayName}` : '';
67
+ const activityTimeText = job.expectedDate ? moment(job.expectedDate).format('D MMMM') : '--';
67
68
  const { statusText, statusColor } = getJobStatusProps(job.status);
68
69
 
69
70
  return (
@@ -77,9 +78,7 @@ class MaintenanceListItem extends Component {
77
78
  {job.room ? <Text style={styles.jobLocationText}>{job.room}</Text> : null}
78
79
  <View style={styles.jobTypeSeenContainer}>
79
80
  <View style={[styles.jobTypeContainer, { backgroundColor: Colours.hexToRGBAstring(this.props.colourBrandingMain, 0.2) }]}>
80
- <Text style={[styles.jobTypeText, { color: this.props.colourBrandingMain }]} numberOfLines={2}>
81
- {job.type}
82
- </Text>
81
+ <Text style={[styles.jobTypeText, { color: this.props.colourBrandingMain }]}>{job.type}</Text>
83
82
  </View>
84
83
  {this.renderSeen()}
85
84
  </View>
@@ -94,14 +93,14 @@ class MaintenanceListItem extends Component {
94
93
  <Text style={styles.jobCreatedText}>{createdTimeText}</Text>
95
94
  <View style={styles.jobActivityContainer}>
96
95
  <View style={[styles.jobStatusContainer, { backgroundColor: statusColor }]}>
97
- {/* <Icon name="wrench" type="font-awesome" iconStyle={styles.jobStatusIcon} /> */}
96
+ <Icon name="wrench" type="font-awesome" iconStyle={styles.jobStatusIcon} />
98
97
  <Text style={styles.jobStatusText}>{statusText}</Text>
99
98
  </View>
100
99
  <View style={[styles.jobStatusLine, { borderColor: statusColor }]}>
101
100
  <View style={styles.jobStatusLineMask} />
102
101
  </View>
103
102
  <View style={[styles.jobStatusCircle, { backgroundColor: statusColor }]} />
104
- <Text style={styles.jobStatusDateText}>{assigneeText}</Text>
103
+ <Text style={styles.jobStatusDateText}>{activityTimeText}</Text>
105
104
  </View>
106
105
  </View>
107
106
  </View>
@@ -153,9 +152,8 @@ const styles = StyleSheet.create({
153
152
  alignItems: 'center',
154
153
  },
155
154
  jobTypeContainer: {
156
- padding: 4,
157
- minWidth: 80,
158
- maxWidth: 140,
155
+ height: 20,
156
+ width: 80,
159
157
  borderRadius: 4,
160
158
  justifyContent: 'center',
161
159
  },
@@ -163,7 +161,6 @@ const styles = StyleSheet.create({
163
161
  fontFamily: 'sf-semibold',
164
162
  fontSize: 12,
165
163
  textAlign: 'center',
166
- maxWidth: '100%',
167
164
  },
168
165
  jobSeenContainer: {
169
166
  flexDirection: 'row',
@@ -231,7 +228,7 @@ const styles = StyleSheet.create({
231
228
  jobStatusContainer: {
232
229
  flexDirection: 'row',
233
230
  alignItems: 'center',
234
- justifyContent: 'center',
231
+ justifyContent: 'space-between',
235
232
  width: 105,
236
233
  height: 30,
237
234
  paddingHorizontal: 8,
@@ -269,7 +266,7 @@ const styles = StyleSheet.create({
269
266
  jobStatusDateText: {
270
267
  flex: 1,
271
268
  textAlign: 'right',
272
- fontFamily: 'sf-medium',
269
+ fontFamily: 'sf-bold',
273
270
  fontSize: 14,
274
271
  color: Colours.TEXT_DARK,
275
272
  },
@@ -7,10 +7,11 @@ import _ from 'lodash';
7
7
  import { getJobStatusProps, jobStatusOptions } from '../helper';
8
8
  import { Services } from '../feature.config';
9
9
  import { Colours, Helper } from '../core.config';
10
+ import { values } from '../values.config';
10
11
 
11
12
  class MaintenanceWidgetItem extends Component {
12
13
  onPressJob = () => {
13
- Services.navigation.navigate('requestDetail', { job: this.props.job });
14
+ Services.navigation.navigate(values.screenRequestDetail, { job: this.props.job });
14
15
  };
15
16
 
16
17
  render() {
@@ -43,7 +44,7 @@ class MaintenanceWidgetItem extends Component {
43
44
  </View>
44
45
  <View style={styles.jobBottomSection}>
45
46
  <View style={[styles.jobStatusContainer, { backgroundColor: statusColor }]}>
46
- {/* <Icon name="wrench" type="font-awesome" iconStyle={styles.jobStatusIcon} /> */}
47
+ <Icon name="wrench" type="font-awesome" iconStyle={styles.jobStatusIcon} />
47
48
  <Text style={styles.jobStatusText}>{statusText}</Text>
48
49
  </View>
49
50
  </View>
@@ -11,7 +11,6 @@ class StatusSelectorPopup extends PureComponent {
11
11
  ? filter.map(status => {
12
12
  return {
13
13
  name: status,
14
- label: getJobStatusLabel(status),
15
14
  color: getJobStatusColour(status),
16
15
  };
17
16
  })
@@ -33,7 +32,7 @@ class StatusSelectorPopup extends PureComponent {
33
32
  return (
34
33
  <TouchableOpacity key={status.name} onPress={() => onSelect(status.name)}>
35
34
  <View style={[styles.jobStatusContainer, { backgroundColor: status.color }]}>
36
- <Text style={styles.jobStatusText}>{status.label}</Text>
35
+ <Text style={styles.jobStatusText}>{status.name}</Text>
37
36
  </View>
38
37
  </TouchableOpacity>
39
38
  );
@@ -2,11 +2,12 @@ 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 { maintenanceActions } from '../apis';
5
+ import { generalActions } from '../apis';
6
6
  import { jobsLoaded } from '../actions';
7
7
  import MaintenanceWidgetItem from './MaintenanceWidgetItem';
8
8
  import { Services } from '../feature.config';
9
9
  import { Colours, Components, Config } from '../core.config';
10
+ import { values } from '../values.config';
10
11
 
11
12
  const MAX_ITEMS = 10;
12
13
 
@@ -27,7 +28,7 @@ class WidgetSmall extends Component {
27
28
  getTitle = () => {
28
29
  const { options } = this.props;
29
30
  if (options && !_.isEmpty(options.Title)) return options.Title;
30
- return Config.env.strings.MAINTENANCE;
31
+ return this.props.strings[`${values.featureKey}_textFeatureTitle`] || values.textFeatureTitle;
31
32
  };
32
33
 
33
34
  getEmptyStateText = () => {
@@ -39,7 +40,7 @@ class WidgetSmall extends Component {
39
40
  refresh = () => {
40
41
  this.onLoadingChanged(true, async () => {
41
42
  try {
42
- const res = await maintenanceActions.getJobsRecursive(this.props.site);
43
+ const res = await generalActions.getJobsRecursive(this.props.site);
43
44
  // console.log('WidgetSmall - refresh', res.data);
44
45
  this.props.jobsLoaded(res);
45
46
  } catch (error) {
@@ -136,13 +137,15 @@ const styles = StyleSheet.create({
136
137
  });
137
138
 
138
139
  const mapStateToProps = state => {
139
- const { user, jobs, notifications } = state;
140
+ const { user, notifications } = state;
141
+ const jobs = state[values.reducerKey];
140
142
  return {
141
143
  colourBrandingMain: Colours.getMainBrandingColourFromState(state),
142
144
  jobs: _.orderBy(jobs.jobs, ['createdUnix'], ['desc']),
143
145
  site: user.site,
144
146
  userCategory: user.category,
145
- dataUpdated: notifications.dataUpdated.jobs,
147
+ dataUpdated: notifications.dataUpdated[values.updateKey],
148
+ strings: state.strings?.config || {},
146
149
  };
147
150
  };
148
151
 
@@ -1,5 +1,6 @@
1
1
  // import * as PlussCore from '../../pluss-core/src';
2
2
  import * as PlussCore from '@plusscommunities/pluss-core-app';
3
+ import { values } from './values.config';
3
4
 
4
5
  export const Services = {
5
6
  navigation: null,
@@ -10,25 +11,25 @@ export const BaseComponents = {
10
11
  };
11
12
 
12
13
  const FeatureConfig = {
13
- key: 'maintenance',
14
- aliases: ['maintenanceRequest'],
15
- title: 'Request',
14
+ key: values.featureKey,
15
+ aliases: values.aliases,
16
+ title: values.textFeatureTitle,
16
17
  gridMenu: {
17
- icon: 'maintenance',
18
+ icon: values.iconGridMenu,
18
19
  viewBox: '0 0 30 30',
19
- navigate: 'maintenance',
20
+ navigate: values.screenMaintenance,
20
21
  },
21
22
  addMenu: {
22
- order: 5,
23
- icon: 'request',
24
- title: 'Request',
25
- navigate: 'serviceRequest',
26
- visibleExps: { type: 'feature', value: 'maintenance' },
23
+ order: values.orderAddMenu,
24
+ icon: values.iconAddMenu,
25
+ title: values.textAddMenuTitle,
26
+ navigate: values.screenServiceRequest,
27
+ visibleExps: { type: 'feature', value: values.featureKey },
27
28
  },
28
29
  moreMenu: {
29
- order: 4,
30
- title: 'Request',
31
- navigate: 'maintenance',
30
+ order: values.orderMoreMenu,
31
+ title: values.textMoreMenuTitle,
32
+ navigate: values.screenMaintenance,
32
33
  visibleExps: {
33
34
  type: 'and',
34
35
  exps: [
@@ -38,10 +39,10 @@ const FeatureConfig = {
38
39
  },
39
40
  },
40
41
  kioskAction: {
41
- order: 1,
42
- icon: 'wrench',
43
- title: 'Request',
44
- navigate: 'serviceRequest',
42
+ order: values.orderKioskAction,
43
+ icon: values.iconKioskAction,
44
+ title: values.textKioskActionTitle,
45
+ navigate: values.screenServiceRequest,
45
46
  },
46
47
  hideTabBar: [],
47
48
  env: {
@@ -65,19 +66,6 @@ const FeatureConfig = {
65
66
  Services.navigation = navigation;
66
67
  BaseComponents.NotificationBell = notificationBell;
67
68
  PlussCore.Config.init(environment, navigation);
68
-
69
- // Override strings
70
- if (environment && environment.strings) {
71
- const { MAINTENANCE, MAINTENANCE_REQUEST } = environment.strings;
72
- if (MAINTENANCE) {
73
- FeatureConfig.addMenu.title = MAINTENANCE;
74
- }
75
- if (MAINTENANCE_REQUEST) {
76
- FeatureConfig.title = MAINTENANCE_REQUEST;
77
- FeatureConfig.moreMenu.title = MAINTENANCE_REQUEST;
78
- FeatureConfig.kioskAction.title = MAINTENANCE_REQUEST;
79
- }
80
- }
81
69
  },
82
70
  };
83
71
  export default FeatureConfig;
package/src/helper.js CHANGED
@@ -1,20 +1,16 @@
1
- import { label } from 'aws-amplify';
2
1
  import { Colours } from './core.config';
3
2
 
4
3
  const jobStatusOptions = [
5
4
  {
6
5
  name: 'Unassigned',
7
- label: 'Open',
8
6
  color: Colours.LINEGREY,
9
7
  },
10
8
  {
11
9
  name: 'In Progress',
12
- label: 'In Progress',
13
10
  color: Colours.COLOUR_TEAL,
14
11
  },
15
12
  {
16
13
  name: 'Completed',
17
- label: 'Completed',
18
14
  color: Colours.COLOUR_GREEN_LIGHT,
19
15
  },
20
16
  ];
@@ -24,16 +20,11 @@ const getJobStatusColour = status => {
24
20
  return option ? option.color : jobStatusOptions[0].color;
25
21
  };
26
22
 
27
- const getJobStatusLabel = status => {
28
- const option = jobStatusOptions.find(item => item.name === status);
29
- return option ? option.label : jobStatusOptions[0].label;
30
- };
31
-
32
23
  const getJobStatusProps = status => {
33
- const statusText = getJobStatusLabel(status) || jobStatusOptions[0].label;
24
+ const statusText = status || jobStatusOptions[0].name;
34
25
  const statusColor = getJobStatusColour(statusText);
35
26
 
36
27
  return { statusText, statusColor };
37
28
  };
38
29
 
39
- export { jobStatusOptions, getJobStatusColour, getJobStatusProps, getJobStatusLabel };
30
+ export { jobStatusOptions, getJobStatusColour, getJobStatusProps };
package/src/index.js CHANGED
@@ -4,15 +4,22 @@ import ServiceRequest from './screens/ServiceRequest';
4
4
  import JobTypePicker from './screens/JobTypePicker';
5
5
  import RequestNotes from './screens/RequestNotes';
6
6
  import JobsReducer from './reducers/JobsReducer';
7
+ import { values } from './values.config';
7
8
 
8
- export const Reducers = { jobs: JobsReducer };
9
- export const Screens = {
10
- maintenance: MaintenancePage,
11
- requestDetail: RequestDetail,
12
- serviceRequest: ServiceRequest,
13
- jobTypePicker: JobTypePicker,
14
- requestNotes: RequestNotes,
15
- };
9
+ export const Reducers = (() => {
10
+ const reducers = {};
11
+ reducers[values.reducerKey] = JobsReducer;
12
+ return reducers;
13
+ })();
14
+ export const Screens = (() => {
15
+ const screens = {};
16
+ screens[values.screenMaintenance] = MaintenancePage;
17
+ screens[values.screenRequestDetail] = RequestDetail;
18
+ screens[values.screenServiceRequest] = ServiceRequest;
19
+ screens[values.screenJobTypePicker] = JobTypePicker;
20
+ screens[values.screenRequestNotes] = RequestNotes;
21
+ return screens;
22
+ })();
16
23
  export { default as Config } from './feature.config';
17
24
  export { default as WidgetSmall } from './components/WidgetSmall';
18
25
  export { default as WidgetLarge } from './components/WidgetLarge';
@@ -5,6 +5,7 @@ import _ from 'lodash';
5
5
  import MaintenanceList from '../components/MaintenanceList';
6
6
  import { Services, BaseComponents } from '../feature.config';
7
7
  import { Components, Helper, Styles, Config } from '../core.config';
8
+ import { values } from '../values.config';
8
9
 
9
10
  class MaintenancePage extends Component {
10
11
  constructor(props) {
@@ -29,10 +30,11 @@ class MaintenancePage extends Component {
29
30
  };
30
31
 
31
32
  renderHeader() {
33
+ const title = this.props.title || this.props.strings[`${values.featureKey}_textFeatureTitle`] || values.textFeatureTitle;
32
34
  if (this.state.isHomeTab) {
33
35
  return (
34
36
  <Components.Header
35
- text={this.props.title || Config.env.strings.MAINTENANCE}
37
+ text={title}
36
38
  rightContent={
37
39
  _.includes(this.props.user.hidden, 'notifications') ? null : (
38
40
  <View style={styles.notificationContainer}>
@@ -46,9 +48,7 @@ class MaintenancePage extends Component {
46
48
  />
47
49
  );
48
50
  }
49
- return (
50
- <Components.Header leftIcon="angle-left" onPressLeft={this.onPressBack} text={this.props.title || Config.env.strings.MAINTENANCE} />
51
- );
51
+ return <Components.Header leftIcon="angle-left" onPressLeft={this.onPressBack} text={values.textFeatureTitle} />;
52
52
  }
53
53
 
54
54
  render() {
@@ -89,6 +89,7 @@ const styles = StyleSheet.create({
89
89
  const mapStateToProps = state => {
90
90
  return {
91
91
  user: state.user,
92
+ strings: state.strings?.config || {},
92
93
  };
93
94
  };
94
95