@plusscommunities/pluss-maintenance-app-forms 6.0.10 → 6.0.11-auth.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/dist/module/actions/JobActions.js +44 -1
  2. package/dist/module/actions/JobActions.js.map +1 -1
  3. package/dist/module/actions/index.js +1 -1
  4. package/dist/module/actions/index.js.map +1 -1
  5. package/dist/module/actions/types.js +4 -1
  6. package/dist/module/actions/types.js.map +1 -1
  7. package/dist/module/apis/index.js +4 -1
  8. package/dist/module/apis/index.js.map +1 -1
  9. package/dist/module/apis/maintenanceActions.js +61 -38
  10. package/dist/module/apis/maintenanceActions.js.map +1 -1
  11. package/dist/module/apis/userActions.js +23 -0
  12. package/dist/module/apis/userActions.js.map +1 -0
  13. package/dist/module/components/FilterPopupMenu.js +82 -58
  14. package/dist/module/components/FilterPopupMenu.js.map +1 -1
  15. package/dist/module/components/MaintenanceList.js +84 -92
  16. package/dist/module/components/MaintenanceList.js.map +1 -1
  17. package/dist/module/components/MaintenanceListItem.js +94 -80
  18. package/dist/module/components/MaintenanceListItem.js.map +1 -1
  19. package/dist/module/components/MaintenanceWidgetItem.js +39 -38
  20. package/dist/module/components/MaintenanceWidgetItem.js.map +1 -1
  21. package/dist/module/components/PrioritySelectorPopup.js +83 -0
  22. package/dist/module/components/PrioritySelectorPopup.js.map +1 -0
  23. package/dist/module/components/StatusSelectorPopup.js +23 -27
  24. package/dist/module/components/StatusSelectorPopup.js.map +1 -1
  25. package/dist/module/components/WidgetLarge.js +2 -2
  26. package/dist/module/components/WidgetLarge.js.map +1 -1
  27. package/dist/module/components/WidgetSmall.js +25 -20
  28. package/dist/module/components/WidgetSmall.js.map +1 -1
  29. package/dist/module/core.config.js +2 -3
  30. package/dist/module/core.config.js.map +1 -1
  31. package/dist/module/feature.config.js +17 -17
  32. package/dist/module/feature.config.js.map +1 -1
  33. package/dist/module/helper.js +41 -26
  34. package/dist/module/helper.js.map +1 -1
  35. package/dist/module/index.js +12 -10
  36. package/dist/module/index.js.map +1 -1
  37. package/dist/module/reducers/JobsReducer.js +36 -6
  38. package/dist/module/reducers/JobsReducer.js.map +1 -1
  39. package/dist/module/screens/JobTypePicker.js +18 -17
  40. package/dist/module/screens/JobTypePicker.js.map +1 -1
  41. package/dist/module/screens/MaintenancePage.js +10 -10
  42. package/dist/module/screens/MaintenancePage.js.map +1 -1
  43. package/dist/module/screens/MaintenanceUserPicker.js +219 -0
  44. package/dist/module/screens/MaintenanceUserPicker.js.map +1 -0
  45. package/dist/module/screens/RequestDetail.js +410 -142
  46. package/dist/module/screens/RequestDetail.js.map +1 -1
  47. package/dist/module/screens/RequestNotes.js +462 -52
  48. package/dist/module/screens/RequestNotes.js.map +1 -1
  49. package/dist/module/screens/ServiceRequest.js +519 -181
  50. package/dist/module/screens/ServiceRequest.js.map +1 -1
  51. package/dist/module/values.config.a.js +30 -23
  52. package/dist/module/values.config.a.js.map +1 -1
  53. package/dist/module/values.config.default.js +35 -28
  54. package/dist/module/values.config.default.js.map +1 -1
  55. package/dist/module/values.config.enquiry.js +43 -0
  56. package/dist/module/values.config.enquiry.js.map +1 -0
  57. package/dist/module/values.config.feedback.js +43 -0
  58. package/dist/module/values.config.feedback.js.map +1 -0
  59. package/dist/module/values.config.food.js +43 -0
  60. package/dist/module/values.config.food.js.map +1 -0
  61. package/dist/module/values.config.forms.js +35 -28
  62. package/dist/module/values.config.forms.js.map +1 -1
  63. package/dist/module/values.config.js +35 -28
  64. package/dist/module/values.config.js.map +1 -1
  65. package/package.json +55 -51
  66. package/src/actions/JobActions.js +75 -16
  67. package/src/actions/index.js +1 -1
  68. package/src/actions/types.js +4 -1
  69. package/src/apis/index.js +6 -1
  70. package/src/apis/maintenanceActions.js +189 -160
  71. package/src/apis/userActions.js +21 -0
  72. package/src/components/FilterPopupMenu.js +316 -230
  73. package/src/components/MaintenanceList.js +391 -326
  74. package/src/components/MaintenanceListItem.js +348 -274
  75. package/src/components/MaintenanceWidgetItem.js +146 -120
  76. package/src/components/PrioritySelectorPopup.js +93 -0
  77. package/src/components/StatusSelectorPopup.js +82 -76
  78. package/src/components/WidgetLarge.js +5 -5
  79. package/src/components/WidgetSmall.js +154 -131
  80. package/src/core.config.js +25 -3
  81. package/src/feature.config.js +62 -62
  82. package/src/helper.js +67 -30
  83. package/src/index.js +22 -20
  84. package/src/reducers/JobsReducer.js +85 -41
  85. package/src/screens/JobTypePicker.js +116 -92
  86. package/src/screens/MaintenancePage.js +89 -80
  87. package/src/screens/MaintenanceUserPicker.js +233 -0
  88. package/src/screens/RequestDetail.js +1354 -892
  89. package/src/screens/RequestNotes.js +946 -408
  90. package/src/screens/ServiceRequest.js +1808 -1222
  91. package/src/values.config.a.js +33 -26
  92. package/src/values.config.default.js +39 -32
  93. package/src/values.config.enquiry.js +43 -0
  94. package/src/values.config.feedback.js +43 -0
  95. package/src/values.config.food.js +43 -0
  96. package/src/values.config.forms.js +39 -32
  97. package/src/values.config.js +39 -32
  98. package/dist/module/values.config.b.js +0 -30
  99. package/dist/module/values.config.b.js.map +0 -1
  100. package/dist/module/values.config.c.js +0 -30
  101. package/dist/module/values.config.c.js.map +0 -1
  102. package/dist/module/values.config.d.js +0 -30
  103. package/dist/module/values.config.d.js.map +0 -1
  104. package/src/values.config.b.js +0 -30
  105. package/src/values.config.c.js +0 -30
  106. package/src/values.config.d.js +0 -30
@@ -1,152 +1,175 @@
1
- import React, { Component } from 'react';
2
- import { Text, View, ScrollView, StyleSheet } from 'react-native';
3
- import { connect } from 'react-redux';
4
- import _ from 'lodash';
5
- import { maintenanceActions } from '../apis';
6
- import { jobsLoaded } from '../actions';
7
- import MaintenanceWidgetItem from './MaintenanceWidgetItem';
8
- import { Services } from '../feature.config';
9
- import { Colours, Components, Config } from '../core.config';
10
- import { values } from '../values.config';
1
+ import React, { Component } from "react";
2
+ import { View, ScrollView, StyleSheet } from "react-native";
3
+ import { Text } from "@plusscommunities/pluss-core-app/components";
4
+ import { connect } from "react-redux";
5
+ import _ from "lodash";
6
+ import { maintenanceActions } from "../apis";
7
+ import { jobsLoaded, jobStatusesUpdate, jobHideSeenUpdate } from "../actions";
8
+ import MaintenanceWidgetItem from "./MaintenanceWidgetItem";
9
+ import { Services } from "../feature.config";
10
+ import { Colours, Components } from "../core.config";
11
+ import { values } from "../values.config";
11
12
 
12
13
  const MAX_ITEMS = 10;
13
14
 
14
15
  class WidgetSmall extends Component {
15
- constructor(props) {
16
- super(props);
17
- this.state = { loading: false };
18
- }
16
+ constructor(props) {
17
+ super(props);
18
+ this.state = { loading: false };
19
+ }
19
20
 
20
- componentDidMount() {
21
- this.refresh();
22
- }
21
+ componentDidMount() {
22
+ this.props.jobStatusesUpdate(this.props.site);
23
+ this.props.jobHideSeenUpdate(this.props.site);
24
+ this.refresh();
25
+ }
23
26
 
24
- componentDidUpdate(prevProps) {
25
- if (!prevProps.dataUpdated && this.props.dataUpdated) this.refresh();
26
- }
27
+ componentDidUpdate(prevProps) {
28
+ if (!prevProps.dataUpdated && this.props.dataUpdated) this.refresh();
29
+ }
27
30
 
28
- getTitle = () => {
29
- const { options } = this.props;
30
- if (options && !_.isEmpty(options.Title)) return options.Title;
31
- return this.props.strings[`${values.featureKey}_textFeatureTitle`] || values.textFeatureTitle;
32
- };
31
+ getTitle = () => {
32
+ const { options } = this.props;
33
+ if (options && !_.isEmpty(options.Title)) return options.Title;
34
+ return (
35
+ this.props.strings[`${values.featureKey}_textFeatureTitle`] ||
36
+ values.textFeatureTitle
37
+ );
38
+ };
33
39
 
34
- getEmptyStateText = () => {
35
- const { options, userCategory } = this.props;
36
- if (options && !_.isEmpty(options.EmptyText)) return options.EmptyText;
37
- return userCategory === 'staff' ? values.emptyRequestsStaff : values.emptyRequestsUser;
38
- };
40
+ getEmptyStateText = () => {
41
+ const { options, userCategory } = this.props;
42
+ if (options && !_.isEmpty(options.EmptyText)) return options.EmptyText;
43
+ return userCategory === "staff"
44
+ ? values.emptyRequestsStaff
45
+ : values.emptyRequestsUser;
46
+ };
39
47
 
40
- refresh = () => {
41
- this.onLoadingChanged(true, async () => {
42
- try {
43
- const res = await maintenanceActions.getJobsRecursive(this.props.site);
44
- // console.log('WidgetSmall - refresh', res.data);
45
- this.props.jobsLoaded(res);
46
- } catch (error) {
47
- console.log('refresh error', error);
48
- } finally {
49
- this.onLoadingChanged(false);
50
- }
51
- });
52
- };
48
+ refresh = () => {
49
+ this.onLoadingChanged(true, async () => {
50
+ try {
51
+ const res = await maintenanceActions.getJobsRecursive(this.props.site);
52
+ // console.log('WidgetSmall - refresh', res.data);
53
+ this.props.jobsLoaded(res);
54
+ } catch (error) {
55
+ console.log("refresh error", error);
56
+ } finally {
57
+ this.onLoadingChanged(false);
58
+ }
59
+ });
60
+ };
53
61
 
54
- onLoadingChanged = (loading, callback) => {
55
- this.setState({ loading }, () => {
56
- if (this.props.onLoadingChanged) this.props.onLoadingChanged(this.state.loading);
57
- if (callback) callback();
58
- });
59
- };
62
+ onLoadingChanged = (loading, callback) => {
63
+ this.setState({ loading }, () => {
64
+ if (this.props.onLoadingChanged)
65
+ this.props.onLoadingChanged(this.state.loading);
66
+ if (callback) callback();
67
+ });
68
+ };
60
69
 
61
- onPressAll = () => {
62
- Services.navigation.navigate(values.screenMaintenance, { options: this.props.options });
63
- };
70
+ onPressAll = () => {
71
+ Services.navigation.navigate(values.screenMaintenance, {
72
+ options: this.props.options,
73
+ });
74
+ };
64
75
 
65
- renderContent() {
66
- const { jobs } = this.props;
67
- if (_.isEmpty(jobs)) {
68
- if (this.state.loading) {
69
- return (
70
- <View style={styles.loadingPadding}>
71
- <Components.LoadingStateWidget height={180} />
72
- </View>
73
- );
74
- }
75
- return (
76
- <View style={styles.loadingPadding}>
77
- <Components.EmptyStateWidget title={this.getEmptyStateText()} height={180} />
78
- </View>
79
- );
80
- }
81
- return (
82
- <ScrollView horizontal contentContainerStyle={{ paddingLeft: 6, paddingRight: 8 }} showsHorizontalScrollIndicator={false}>
83
- {jobs.slice(0, MAX_ITEMS).map(job => {
84
- return <MaintenanceWidgetItem key={job.id} job={job} />;
85
- })}
86
- </ScrollView>
87
- );
88
- }
76
+ renderContent() {
77
+ const { jobs } = this.props;
78
+ if (_.isEmpty(jobs)) {
79
+ if (this.state.loading) {
80
+ return (
81
+ <View style={styles.loadingPadding}>
82
+ <Components.LoadingStateWidget height={180} />
83
+ </View>
84
+ );
85
+ }
86
+ return (
87
+ <View style={styles.loadingPadding}>
88
+ <Components.EmptyStateWidget
89
+ title={this.getEmptyStateText()}
90
+ height={180}
91
+ />
92
+ </View>
93
+ );
94
+ }
95
+ return (
96
+ <ScrollView
97
+ horizontal
98
+ contentContainerStyle={{ paddingLeft: 6, paddingRight: 8 }}
99
+ showsHorizontalScrollIndicator={false}
100
+ >
101
+ {jobs.slice(0, MAX_ITEMS).map((job) => {
102
+ return <MaintenanceWidgetItem key={job.id} job={job} />;
103
+ })}
104
+ </ScrollView>
105
+ );
106
+ }
89
107
 
90
- render() {
91
- const { colourBrandingMain } = this.props;
108
+ render() {
109
+ const { colourBrandingMain } = this.props;
92
110
 
93
- return (
94
- <View style={styles.sectionContainer}>
95
- <View style={styles.sectionPadding}>
96
- <View style={styles.sectionHeading}>
97
- <Text style={styles.sectionTitle}>{this.getTitle()}</Text>
98
- <Components.InlineButton
99
- onPress={this.onPressAll}
100
- color={colourBrandingMain}
101
- touchableStyle={{ paddingTop: 6 }}
102
- textStyle={{ color: '#fff' }}
103
- >
104
- View All
105
- </Components.InlineButton>
106
- </View>
107
- </View>
108
- {this.renderContent()}
109
- </View>
110
- );
111
- }
111
+ return (
112
+ <View style={styles.sectionContainer}>
113
+ <View style={styles.sectionPadding}>
114
+ <View style={styles.sectionHeading}>
115
+ <Text style={styles.sectionTitle}>{this.getTitle()}</Text>
116
+ <Components.InlineButton
117
+ onPress={this.onPressAll}
118
+ color={colourBrandingMain}
119
+ touchableStyle={{ paddingTop: 6 }}
120
+ textStyle={{ color: "#fff" }}
121
+ >
122
+ View All
123
+ </Components.InlineButton>
124
+ </View>
125
+ </View>
126
+ {this.renderContent()}
127
+ </View>
128
+ );
129
+ }
112
130
  }
113
131
 
114
132
  const styles = StyleSheet.create({
115
- sectionContainer: {
116
- backgroundColor: '#fff',
117
- paddingTop: 16,
118
- },
119
- sectionPadding: {
120
- paddingHorizontal: 16,
121
- paddingBottom: 6,
122
- },
123
- loadingPadding: {
124
- paddingHorizontal: 16,
125
- },
126
- sectionHeading: {
127
- marginBottom: 4,
128
- flexDirection: 'row',
129
- alignContent: 'flex-start',
130
- justifyContent: 'space-between',
131
- },
132
- sectionTitle: {
133
- fontFamily: 'sf-bold',
134
- fontSize: 24,
135
- color: Colours.TEXT_DARKEST,
136
- },
133
+ sectionContainer: {
134
+ backgroundColor: "#fff",
135
+ paddingTop: 16,
136
+ },
137
+ sectionPadding: {
138
+ paddingHorizontal: 16,
139
+ paddingBottom: 6,
140
+ },
141
+ loadingPadding: {
142
+ paddingHorizontal: 16,
143
+ },
144
+ sectionHeading: {
145
+ marginBottom: 4,
146
+ flexDirection: "row",
147
+ alignContent: "flex-start",
148
+ justifyContent: "space-between",
149
+ },
150
+ sectionTitle: {
151
+ fontFamily: "sf-bold",
152
+ fontSize: 24,
153
+ color: Colours.TEXT_DARKEST,
154
+ },
137
155
  });
138
156
 
139
- const mapStateToProps = state => {
140
- const { user, notifications } = state;
141
- const jobs = state[values.reducerKey];
142
- return {
143
- colourBrandingMain: Colours.getMainBrandingColourFromState(state),
144
- jobs: _.orderBy(jobs.jobs, ['createdUnix'], ['desc']),
145
- site: user.site,
146
- userCategory: user.category,
147
- dataUpdated: notifications.dataUpdated[values.updateKey],
148
- strings: state.strings?.config || {},
149
- };
157
+ const mapStateToProps = (state) => {
158
+ const { user, notifications } = state;
159
+ const jobs = state[values.reducerKey];
160
+ return {
161
+ colourBrandingMain: Colours.getMainBrandingColourFromState(state),
162
+ jobs: _.orderBy(jobs.jobs, ["createdUnix"], ["desc"]),
163
+ site: user.site,
164
+ userCategory: user.category,
165
+ dataUpdated: notifications.dataUpdated[values.updateKey],
166
+ strings: state.strings?.config || {},
167
+ };
150
168
  };
151
169
 
152
- export default connect(mapStateToProps, { jobsLoaded }, null, { forwardRef: true })(WidgetSmall);
170
+ export default connect(
171
+ mapStateToProps,
172
+ { jobsLoaded, jobStatusesUpdate, jobHideSeenUpdate },
173
+ null,
174
+ { forwardRef: true },
175
+ )(WidgetSmall);
@@ -1,5 +1,27 @@
1
1
  // import * as PlussCore from '../../pluss-core/src';
2
- import * as PlussCore from '@plusscommunities/pluss-core-app';
2
+ import * as PlussCore from "@plusscommunities/pluss-core-app";
3
3
 
4
- const { Apis, Fonts, Actions, ActionTypes, Config, Components, Styles, Session, Helper, Constants, Colours } = PlussCore;
5
- export { Apis, Fonts, Actions, ActionTypes, Config, Components, Styles, Session, Helper, Constants, Colours };
4
+ const {
5
+ Apis,
6
+ Actions,
7
+ ActionTypes,
8
+ Config,
9
+ Components,
10
+ Styles,
11
+ Session,
12
+ Helper,
13
+ Constants,
14
+ Colours,
15
+ } = PlussCore;
16
+ export {
17
+ Apis,
18
+ Actions,
19
+ ActionTypes,
20
+ Config,
21
+ Components,
22
+ Styles,
23
+ Session,
24
+ Helper,
25
+ Constants,
26
+ Colours,
27
+ };
@@ -1,73 +1,73 @@
1
1
  // import * as PlussCore from '../../pluss-core/src';
2
- import * as PlussCore from '@plusscommunities/pluss-core-app';
3
- import { values } from './values.config';
2
+ import * as PlussCore from "@plusscommunities/pluss-core-app";
3
+ import { values } from "./values.config";
4
4
 
5
5
  export const Services = {
6
- navigation: null,
6
+ navigation: null,
7
7
  };
8
8
 
9
9
  export const BaseComponents = {
10
- NotificationBell: null,
10
+ NotificationBell: null,
11
11
  };
12
12
 
13
13
  const FeatureConfig = {
14
- key: values.featureKey,
15
- aliases: values.aliases,
16
- title: values.textFeatureTitle,
17
- gridMenu: {
18
- icon: values.iconGridMenu,
19
- viewBox: values.gridViewBox,
20
- navigate: values.screenMaintenance,
21
- },
22
- addMenu: {
23
- order: values.orderAddMenu,
24
- icon: values.iconAddMenu,
25
- title: values.textAddMenuTitle,
26
- navigate: values.screenServiceRequest,
27
- visibleExps: { type: 'feature', value: values.featureKey },
28
- },
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,
43
- kioskAction: {
44
- order: values.orderKioskAction,
45
- icon: values.iconKioskAction,
46
- title: values.textKioskActionTitle,
47
- navigate: values.screenServiceRequest,
48
- },
49
- hideTabBar: [],
50
- env: {
51
- baseStage: '',
52
- baseAPIUrl: '',
53
- hasGradientHeader: false,
54
- defaultProfileImage: '',
55
- tinyChatDefault: '',
56
- baseUploadsUrl: '',
57
- allowMediaDownload: false,
58
- allowMediaSharing: false,
59
- awsUploadsBucket: '',
60
- awsStorageBucket: '',
61
- preferredSite: '',
62
- strings: {},
63
- newEventDefaults: '',
64
- defaultAllowComments: true,
65
- },
66
- init: (environment, navigation, notificationBell) => {
67
- FeatureConfig.env = environment;
68
- Services.navigation = navigation;
69
- BaseComponents.NotificationBell = notificationBell;
70
- PlussCore.Config.init(environment, navigation);
71
- },
14
+ key: values.featureKey,
15
+ aliases: values.aliases,
16
+ title: values.textFeatureTitle,
17
+ gridMenu: {
18
+ icon: values.iconGridMenu,
19
+ viewBox: values.gridViewBox,
20
+ navigate: values.screenMaintenance,
21
+ },
22
+ addMenu: {
23
+ order: values.orderAddMenu,
24
+ icon: values.iconAddMenu,
25
+ title: values.textAddMenuTitle,
26
+ navigate: values.screenServiceRequest,
27
+ visibleExps: { type: "feature", value: values.featureKey },
28
+ },
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,
43
+ kioskAction: {
44
+ order: values.orderKioskAction,
45
+ icon: values.iconKioskAction,
46
+ title: values.textKioskActionTitle,
47
+ navigate: values.screenServiceRequest,
48
+ },
49
+ hideTabBar: [],
50
+ env: {
51
+ baseStage: "",
52
+ baseAPIUrl: "",
53
+ hasGradientHeader: false,
54
+ defaultProfileImage: "",
55
+ tinyChatDefault: "",
56
+ baseUploadsUrl: "",
57
+ allowMediaDownload: false,
58
+ allowMediaSharing: false,
59
+ awsUploadsBucket: "",
60
+ awsStorageBucket: "",
61
+ preferredSite: "",
62
+ strings: {},
63
+ newEventDefaults: "",
64
+ defaultAllowComments: true,
65
+ },
66
+ init: (environment, navigation, notificationBell) => {
67
+ FeatureConfig.env = environment;
68
+ Services.navigation = navigation;
69
+ BaseComponents.NotificationBell = notificationBell;
70
+ PlussCore.Config.init(environment, navigation);
71
+ },
72
72
  };
73
73
  export default FeatureConfig;
package/src/helper.js CHANGED
@@ -1,39 +1,76 @@
1
- import { label } from 'aws-amplify';
2
- import { Colours } from './core.config';
1
+ import { Colours } from "./core.config";
2
+
3
+ const STATUS_NOT_ACTIONED = "Not Actioned";
4
+ const STATUS_IN_PROGRESS = "In Progress";
5
+ const STATUS_COMPLETED = "Completed";
3
6
 
4
7
  const jobStatusOptions = [
5
- {
6
- name: 'Unassigned',
7
- label: 'Open',
8
- color: Colours.LINEGREY,
9
- },
10
- {
11
- name: 'In Progress',
12
- label: 'In Progress',
13
- color: Colours.COLOUR_TEAL,
14
- },
15
- {
16
- name: 'Completed',
17
- label: 'Completed',
18
- color: Colours.COLOUR_GREEN_LIGHT,
19
- },
8
+ {
9
+ text: "Open",
10
+ order: 0,
11
+ color: Colours.LINEGREY,
12
+ category: STATUS_NOT_ACTIONED,
13
+ },
14
+ {
15
+ text: "In Progress",
16
+ order: 1,
17
+ color: Colours.COLOUR_TEAL,
18
+ category: STATUS_IN_PROGRESS,
19
+ },
20
+ {
21
+ text: "Completed",
22
+ order: 2,
23
+ color: Colours.COLOUR_GREEN_LIGHT,
24
+ category: STATUS_COMPLETED,
25
+ },
20
26
  ];
21
27
 
22
- const getJobStatusColour = status => {
23
- const option = jobStatusOptions.find(item => item.name === status);
24
- return option ? option.color : jobStatusOptions[0].color;
25
- };
28
+ const jobPriorityOptions = [
29
+ {
30
+ label: "Low",
31
+ color: Colours.COLOUR_GREEN,
32
+ default: true,
33
+ },
34
+ {
35
+ label: "Medium",
36
+ color: Colours.COLOUR_TANGERINE,
37
+ },
38
+ {
39
+ label: "High",
40
+ color: Colours.COLOUR_RED,
41
+ },
42
+ ];
26
43
 
27
- const getJobStatusLabel = status => {
28
- const option = jobStatusOptions.find(item => item.name === status);
29
- return option ? option.label : jobStatusOptions[0].label;
30
- };
44
+ const getJobStatusOptions = (props) =>
45
+ props?.statusTypes?.length ? props?.statusTypes : jobStatusOptions;
31
46
 
32
- const getJobStatusProps = status => {
33
- const statusText = getJobStatusLabel(status) || jobStatusOptions[0].label;
34
- const statusColor = getJobStatusColour(statusText);
47
+ const getDefaultJobStatuses = (props) =>
48
+ getJobStatusOptions(props).filter((s) => s.category === STATUS_NOT_ACTIONED);
35
49
 
36
- return { statusText, statusColor };
50
+ const getIncompleteJobStatuses = (props) =>
51
+ getJobStatusOptions(props).filter((s) => s.category === STATUS_IN_PROGRESS);
52
+
53
+ const getJobStatus = (status, props) => {
54
+ const statusOptions = getJobStatusOptions(props);
55
+ // console.log('getJobStatus', JSON.stringify({ status, statusOptions }, null, 2));
56
+ let statusOption = null;
57
+ if (status) statusOption = statusOptions.find((s) => s.text === status);
58
+ return statusOption || getDefaultJobStatuses(props)[0];
37
59
  };
38
60
 
39
- export { jobStatusOptions, getJobStatusColour, getJobStatusProps, getJobStatusLabel };
61
+ const getDefaultJobPriority = () => jobPriorityOptions.find((p) => p.default);
62
+
63
+ const getJobPriority = (priority) =>
64
+ jobPriorityOptions.find((p) => p.label === priority) ||
65
+ getDefaultJobPriority();
66
+
67
+ export {
68
+ jobStatusOptions,
69
+ jobPriorityOptions,
70
+ getJobStatusOptions,
71
+ getDefaultJobStatuses,
72
+ getIncompleteJobStatuses,
73
+ getJobStatus,
74
+ getJobPriority,
75
+ getDefaultJobPriority,
76
+ };
package/src/index.js CHANGED
@@ -1,25 +1,27 @@
1
- import MaintenancePage from './screens/MaintenancePage';
2
- import RequestDetail from './screens/RequestDetail';
3
- import ServiceRequest from './screens/ServiceRequest';
4
- import JobTypePicker from './screens/JobTypePicker';
5
- import RequestNotes from './screens/RequestNotes';
6
- import JobsReducer from './reducers/JobsReducer';
7
- import { values } from './values.config';
1
+ import MaintenancePage from "./screens/MaintenancePage";
2
+ import RequestDetail from "./screens/RequestDetail";
3
+ import ServiceRequest from "./screens/ServiceRequest";
4
+ import JobTypePicker from "./screens/JobTypePicker";
5
+ import RequestNotes from "./screens/RequestNotes";
6
+ import MaintenanceUserPicker from "./screens/MaintenanceUserPicker";
7
+ import JobsReducer from "./reducers/JobsReducer";
8
+ import { values } from "./values.config";
8
9
 
9
10
  export const Reducers = (() => {
10
- const reducers = {};
11
- reducers[values.reducerKey] = JobsReducer;
12
- return reducers;
11
+ const reducers = {};
12
+ reducers[values.reducerKey] = JobsReducer;
13
+ return reducers;
13
14
  })();
14
15
  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;
16
+ const screens = {};
17
+ screens[values.screenMaintenance] = MaintenancePage;
18
+ screens[values.screenRequestDetail] = RequestDetail;
19
+ screens[values.screenServiceRequest] = ServiceRequest;
20
+ screens[values.screenJobTypePicker] = JobTypePicker;
21
+ screens[values.screenRequestNotes] = RequestNotes;
22
+ screens[values.screenUserPicker] = MaintenanceUserPicker;
23
+ return screens;
22
24
  })();
23
- export { default as Config } from './feature.config';
24
- export { default as WidgetSmall } from './components/WidgetSmall';
25
- export { default as WidgetLarge } from './components/WidgetLarge';
25
+ export { default as Config } from "./feature.config";
26
+ export { default as WidgetSmall } from "./components/WidgetSmall";
27
+ export { default as WidgetLarge } from "./components/WidgetLarge";