@plusscommunities/pluss-maintenance-app 6.0.19 → 6.0.21-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.
- package/dist/module/actions/JobActions.js +4 -4
- package/dist/module/actions/JobActions.js.map +1 -1
- package/dist/module/actions/index.js +1 -1
- package/dist/module/actions/index.js.map +1 -1
- package/dist/module/actions/types.js +1 -1
- package/dist/module/actions/types.js.map +1 -1
- package/dist/module/apis/index.js +3 -3
- package/dist/module/apis/index.js.map +1 -1
- package/dist/module/apis/maintenanceActions.js +36 -36
- package/dist/module/apis/maintenanceActions.js.map +1 -1
- package/dist/module/apis/userActions.js +5 -5
- package/dist/module/apis/userActions.js.map +1 -1
- package/dist/module/components/FilterPopupMenu.js +49 -49
- package/dist/module/components/FilterPopupMenu.js.map +1 -1
- package/dist/module/components/MaintenanceList.js +38 -38
- package/dist/module/components/MaintenanceList.js.map +1 -1
- package/dist/module/components/MaintenanceListItem.js +62 -62
- package/dist/module/components/MaintenanceListItem.js.map +1 -1
- package/dist/module/components/MaintenanceWidgetItem.js +27 -27
- package/dist/module/components/MaintenanceWidgetItem.js.map +1 -1
- package/dist/module/components/PrioritySelectorPopup.js +15 -15
- package/dist/module/components/PrioritySelectorPopup.js.map +1 -1
- package/dist/module/components/StatusSelectorPopup.js +16 -16
- package/dist/module/components/StatusSelectorPopup.js.map +1 -1
- package/dist/module/components/WidgetLarge.js +2 -2
- package/dist/module/components/WidgetLarge.js.map +1 -1
- package/dist/module/components/WidgetSmall.js +19 -19
- package/dist/module/components/WidgetSmall.js.map +1 -1
- package/dist/module/core.config.js +1 -1
- package/dist/module/core.config.js.map +1 -1
- package/dist/module/feature.config.js +17 -17
- package/dist/module/feature.config.js.map +1 -1
- package/dist/module/helper.js +10 -10
- package/dist/module/helper.js.map +1 -1
- package/dist/module/index.js +11 -11
- package/dist/module/index.js.map +1 -1
- package/dist/module/reducers/JobsReducer.js +13 -13
- package/dist/module/reducers/JobsReducer.js.map +1 -1
- package/dist/module/screens/JobTypePicker.js +17 -17
- package/dist/module/screens/JobTypePicker.js.map +1 -1
- package/dist/module/screens/MaintenancePage.js +10 -10
- package/dist/module/screens/MaintenancePage.js.map +1 -1
- package/dist/module/screens/MaintenanceUserPicker.js +129 -22
- package/dist/module/screens/MaintenanceUserPicker.js.map +1 -1
- package/dist/module/screens/RequestDetail.js +146 -146
- package/dist/module/screens/RequestDetail.js.map +1 -1
- package/dist/module/screens/RequestNotes.js +59 -59
- package/dist/module/screens/RequestNotes.js.map +1 -1
- package/dist/module/screens/ServiceRequest.js +187 -187
- package/dist/module/screens/ServiceRequest.js.map +1 -1
- package/dist/module/values.config.a.js +30 -30
- package/dist/module/values.config.a.js.map +1 -1
- package/dist/module/values.config.default.js +34 -34
- package/dist/module/values.config.default.js.map +1 -1
- package/dist/module/values.config.enquiry.js +34 -34
- package/dist/module/values.config.enquiry.js.map +1 -1
- package/dist/module/values.config.feedback.js +34 -34
- package/dist/module/values.config.feedback.js.map +1 -1
- package/dist/module/values.config.food.js +34 -34
- package/dist/module/values.config.food.js.map +1 -1
- package/dist/module/values.config.forms.js +34 -34
- package/dist/module/values.config.forms.js.map +1 -1
- package/dist/module/values.config.js +34 -34
- package/dist/module/values.config.js.map +1 -1
- package/package.json +51 -51
- package/src/actions/JobActions.js +67 -60
- package/src/actions/index.js +1 -1
- package/src/actions/types.js +1 -2
- package/src/apis/index.js +3 -3
- package/src/apis/maintenanceActions.js +189 -178
- package/src/apis/userActions.js +17 -17
- package/src/components/FilterPopupMenu.js +313 -256
- package/src/components/MaintenanceList.js +396 -317
- package/src/components/MaintenanceListItem.js +347 -288
- package/src/components/MaintenanceWidgetItem.js +145 -124
- package/src/components/PrioritySelectorPopup.js +81 -68
- package/src/components/StatusSelectorPopup.js +81 -70
- package/src/components/WidgetLarge.js +5 -5
- package/src/components/WidgetSmall.js +153 -133
- package/src/core.config.js +27 -3
- package/src/feature.config.js +62 -62
- package/src/helper.js +58 -53
- package/src/index.js +22 -22
- package/src/reducers/JobsReducer.js +85 -66
- package/src/screens/JobTypePicker.js +115 -92
- package/src/screens/MaintenancePage.js +89 -80
- package/src/screens/MaintenanceUserPicker.js +252 -100
- package/src/screens/RequestDetail.js +1348 -1125
- package/src/screens/RequestNotes.js +950 -806
- package/src/screens/ServiceRequest.js +1778 -1550
- package/src/values.config.a.js +33 -33
- package/src/values.config.default.js +39 -39
- package/src/values.config.enquiry.js +39 -39
- package/src/values.config.feedback.js +39 -39
- package/src/values.config.food.js +39 -39
- package/src/values.config.forms.js +39 -39
- package/src/values.config.js +39 -39
|
@@ -1,154 +1,174 @@
|
|
|
1
|
-
import React, { Component } from
|
|
2
|
-
import { Text, View, ScrollView, StyleSheet } from
|
|
3
|
-
import { connect } from
|
|
4
|
-
import _ from
|
|
5
|
-
import { maintenanceActions } from
|
|
6
|
-
import { jobsLoaded, jobStatusesUpdate, jobHideSeenUpdate } from
|
|
7
|
-
import MaintenanceWidgetItem from
|
|
8
|
-
import { Services } from
|
|
9
|
-
import { Colours, Components } from
|
|
10
|
-
import { values } from
|
|
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, jobStatusesUpdate, jobHideSeenUpdate } from "../actions";
|
|
7
|
+
import MaintenanceWidgetItem from "./MaintenanceWidgetItem";
|
|
8
|
+
import { Services } from "../feature.config";
|
|
9
|
+
import { Colours, Components } from "../core.config";
|
|
10
|
+
import { values } from "../values.config";
|
|
11
11
|
|
|
12
12
|
const MAX_ITEMS = 10;
|
|
13
13
|
|
|
14
14
|
class WidgetSmall extends Component {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
constructor(props) {
|
|
16
|
+
super(props);
|
|
17
|
+
this.state = { loading: false };
|
|
18
|
+
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
componentDidMount() {
|
|
21
|
+
this.props.jobStatusesUpdate(this.props.site);
|
|
22
|
+
this.props.jobHideSeenUpdate(this.props.site);
|
|
23
|
+
this.refresh();
|
|
24
|
+
}
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
componentDidUpdate(prevProps) {
|
|
27
|
+
if (!prevProps.dataUpdated && this.props.dataUpdated) this.refresh();
|
|
28
|
+
}
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
getTitle = () => {
|
|
31
|
+
const { options } = this.props;
|
|
32
|
+
if (options && !_.isEmpty(options.Title)) return options.Title;
|
|
33
|
+
return (
|
|
34
|
+
this.props.strings[`${values.featureKey}_textFeatureTitle`] ||
|
|
35
|
+
values.textFeatureTitle
|
|
36
|
+
);
|
|
37
|
+
};
|
|
35
38
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
getEmptyStateText = () => {
|
|
40
|
+
const { options, userCategory } = this.props;
|
|
41
|
+
if (options && !_.isEmpty(options.EmptyText)) return options.EmptyText;
|
|
42
|
+
return userCategory === "staff"
|
|
43
|
+
? values.emptyRequestsStaff
|
|
44
|
+
: values.emptyRequestsUser;
|
|
45
|
+
};
|
|
41
46
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
refresh = () => {
|
|
48
|
+
this.onLoadingChanged(true, async () => {
|
|
49
|
+
try {
|
|
50
|
+
const res = await maintenanceActions.getJobsRecursive(this.props.site);
|
|
51
|
+
// console.log('WidgetSmall - refresh', res.data);
|
|
52
|
+
this.props.jobsLoaded(res);
|
|
53
|
+
} catch (error) {
|
|
54
|
+
console.log("refresh error", error);
|
|
55
|
+
} finally {
|
|
56
|
+
this.onLoadingChanged(false);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
};
|
|
55
60
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
onLoadingChanged = (loading, callback) => {
|
|
62
|
+
this.setState({ loading }, () => {
|
|
63
|
+
if (this.props.onLoadingChanged)
|
|
64
|
+
this.props.onLoadingChanged(this.state.loading);
|
|
65
|
+
if (callback) callback();
|
|
66
|
+
});
|
|
67
|
+
};
|
|
62
68
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
69
|
+
onPressAll = () => {
|
|
70
|
+
Services.navigation.navigate(values.screenMaintenance, {
|
|
71
|
+
options: this.props.options,
|
|
72
|
+
});
|
|
73
|
+
};
|
|
66
74
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
75
|
+
renderContent() {
|
|
76
|
+
const { jobs } = this.props;
|
|
77
|
+
if (_.isEmpty(jobs)) {
|
|
78
|
+
if (this.state.loading) {
|
|
79
|
+
return (
|
|
80
|
+
<View style={styles.loadingPadding}>
|
|
81
|
+
<Components.LoadingStateWidget height={180} />
|
|
82
|
+
</View>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
return (
|
|
86
|
+
<View style={styles.loadingPadding}>
|
|
87
|
+
<Components.EmptyStateWidget
|
|
88
|
+
title={this.getEmptyStateText()}
|
|
89
|
+
height={180}
|
|
90
|
+
/>
|
|
91
|
+
</View>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
return (
|
|
95
|
+
<ScrollView
|
|
96
|
+
horizontal
|
|
97
|
+
contentContainerStyle={{ paddingLeft: 6, paddingRight: 8 }}
|
|
98
|
+
showsHorizontalScrollIndicator={false}
|
|
99
|
+
>
|
|
100
|
+
{jobs.slice(0, MAX_ITEMS).map((job) => {
|
|
101
|
+
return <MaintenanceWidgetItem key={job.id} job={job} />;
|
|
102
|
+
})}
|
|
103
|
+
</ScrollView>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
91
106
|
|
|
92
|
-
|
|
93
|
-
|
|
107
|
+
render() {
|
|
108
|
+
const { colourBrandingMain } = this.props;
|
|
94
109
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
return (
|
|
111
|
+
<View style={styles.sectionContainer}>
|
|
112
|
+
<View style={styles.sectionPadding}>
|
|
113
|
+
<View style={styles.sectionHeading}>
|
|
114
|
+
<Text style={styles.sectionTitle}>{this.getTitle()}</Text>
|
|
115
|
+
<Components.InlineButton
|
|
116
|
+
onPress={this.onPressAll}
|
|
117
|
+
color={colourBrandingMain}
|
|
118
|
+
touchableStyle={{ paddingTop: 6 }}
|
|
119
|
+
textStyle={{ color: "#fff" }}
|
|
120
|
+
>
|
|
121
|
+
View All
|
|
122
|
+
</Components.InlineButton>
|
|
123
|
+
</View>
|
|
124
|
+
</View>
|
|
125
|
+
{this.renderContent()}
|
|
126
|
+
</View>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
114
129
|
}
|
|
115
130
|
|
|
116
131
|
const styles = StyleSheet.create({
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
132
|
+
sectionContainer: {
|
|
133
|
+
backgroundColor: "#fff",
|
|
134
|
+
paddingTop: 16,
|
|
135
|
+
},
|
|
136
|
+
sectionPadding: {
|
|
137
|
+
paddingHorizontal: 16,
|
|
138
|
+
paddingBottom: 6,
|
|
139
|
+
},
|
|
140
|
+
loadingPadding: {
|
|
141
|
+
paddingHorizontal: 16,
|
|
142
|
+
},
|
|
143
|
+
sectionHeading: {
|
|
144
|
+
marginBottom: 4,
|
|
145
|
+
flexDirection: "row",
|
|
146
|
+
alignContent: "flex-start",
|
|
147
|
+
justifyContent: "space-between",
|
|
148
|
+
},
|
|
149
|
+
sectionTitle: {
|
|
150
|
+
fontFamily: "sf-bold",
|
|
151
|
+
fontSize: 24,
|
|
152
|
+
color: Colours.TEXT_DARKEST,
|
|
153
|
+
},
|
|
139
154
|
});
|
|
140
155
|
|
|
141
|
-
const mapStateToProps = state => {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
156
|
+
const mapStateToProps = (state) => {
|
|
157
|
+
const { user, notifications } = state;
|
|
158
|
+
const jobs = state[values.reducerKey];
|
|
159
|
+
return {
|
|
160
|
+
colourBrandingMain: Colours.getMainBrandingColourFromState(state),
|
|
161
|
+
jobs: _.orderBy(jobs.jobs, ["createdUnix"], ["desc"]),
|
|
162
|
+
site: user.site,
|
|
163
|
+
userCategory: user.category,
|
|
164
|
+
dataUpdated: notifications.dataUpdated[values.updateKey],
|
|
165
|
+
strings: state.strings?.config || {},
|
|
166
|
+
};
|
|
152
167
|
};
|
|
153
168
|
|
|
154
|
-
export default connect(
|
|
169
|
+
export default connect(
|
|
170
|
+
mapStateToProps,
|
|
171
|
+
{ jobsLoaded, jobStatusesUpdate, jobHideSeenUpdate },
|
|
172
|
+
null,
|
|
173
|
+
{ forwardRef: true },
|
|
174
|
+
)(WidgetSmall);
|
package/src/core.config.js
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
// import * as PlussCore from '../../pluss-core/src';
|
|
2
|
-
import * as PlussCore from
|
|
2
|
+
import * as PlussCore from "@plusscommunities/pluss-core-app";
|
|
3
3
|
|
|
4
|
-
const {
|
|
5
|
-
|
|
4
|
+
const {
|
|
5
|
+
Apis,
|
|
6
|
+
Fonts,
|
|
7
|
+
Actions,
|
|
8
|
+
ActionTypes,
|
|
9
|
+
Config,
|
|
10
|
+
Components,
|
|
11
|
+
Styles,
|
|
12
|
+
Session,
|
|
13
|
+
Helper,
|
|
14
|
+
Constants,
|
|
15
|
+
Colours,
|
|
16
|
+
} = PlussCore;
|
|
17
|
+
export {
|
|
18
|
+
Apis,
|
|
19
|
+
Fonts,
|
|
20
|
+
Actions,
|
|
21
|
+
ActionTypes,
|
|
22
|
+
Config,
|
|
23
|
+
Components,
|
|
24
|
+
Styles,
|
|
25
|
+
Session,
|
|
26
|
+
Helper,
|
|
27
|
+
Constants,
|
|
28
|
+
Colours,
|
|
29
|
+
};
|
package/src/feature.config.js
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
1
|
// import * as PlussCore from '../../pluss-core/src';
|
|
2
|
-
import * as PlussCore from
|
|
3
|
-
import { values } from
|
|
2
|
+
import * as PlussCore from "@plusscommunities/pluss-core-app";
|
|
3
|
+
import { values } from "./values.config";
|
|
4
4
|
|
|
5
5
|
export const Services = {
|
|
6
|
-
|
|
6
|
+
navigation: null,
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
export const BaseComponents = {
|
|
10
|
-
|
|
10
|
+
NotificationBell: null,
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
const FeatureConfig = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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,71 +1,76 @@
|
|
|
1
|
-
import { Colours } from
|
|
1
|
+
import { Colours } from "./core.config";
|
|
2
2
|
|
|
3
|
-
const STATUS_NOT_ACTIONED =
|
|
4
|
-
const STATUS_IN_PROGRESS =
|
|
5
|
-
const STATUS_COMPLETED =
|
|
3
|
+
const STATUS_NOT_ACTIONED = "Not Actioned";
|
|
4
|
+
const STATUS_IN_PROGRESS = "In Progress";
|
|
5
|
+
const STATUS_COMPLETED = "Completed";
|
|
6
6
|
|
|
7
7
|
const jobStatusOptions = [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
+
},
|
|
26
26
|
];
|
|
27
27
|
|
|
28
28
|
const jobPriorityOptions = [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
42
|
];
|
|
43
43
|
|
|
44
|
-
const getJobStatusOptions = props =>
|
|
44
|
+
const getJobStatusOptions = (props) =>
|
|
45
|
+
props?.statusTypes?.length ? props?.statusTypes : jobStatusOptions;
|
|
45
46
|
|
|
46
|
-
const getDefaultJobStatuses =
|
|
47
|
+
const getDefaultJobStatuses = (props) =>
|
|
48
|
+
getJobStatusOptions(props).filter((s) => s.category === STATUS_NOT_ACTIONED);
|
|
47
49
|
|
|
48
|
-
const getIncompleteJobStatuses =
|
|
50
|
+
const getIncompleteJobStatuses = (props) =>
|
|
51
|
+
getJobStatusOptions(props).filter((s) => s.category === STATUS_IN_PROGRESS);
|
|
49
52
|
|
|
50
53
|
const getJobStatus = (status, props) => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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];
|
|
56
59
|
};
|
|
57
60
|
|
|
58
|
-
const getDefaultJobPriority = () => jobPriorityOptions.find(p => p.default);
|
|
61
|
+
const getDefaultJobPriority = () => jobPriorityOptions.find((p) => p.default);
|
|
59
62
|
|
|
60
|
-
const getJobPriority =
|
|
63
|
+
const getJobPriority = (priority) =>
|
|
64
|
+
jobPriorityOptions.find((p) => p.label === priority) ||
|
|
65
|
+
getDefaultJobPriority();
|
|
61
66
|
|
|
62
67
|
export {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
jobStatusOptions,
|
|
69
|
+
jobPriorityOptions,
|
|
70
|
+
getJobStatusOptions,
|
|
71
|
+
getDefaultJobStatuses,
|
|
72
|
+
getIncompleteJobStatuses,
|
|
73
|
+
getJobStatus,
|
|
74
|
+
getJobPriority,
|
|
75
|
+
getDefaultJobPriority,
|
|
71
76
|
};
|
package/src/index.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import MaintenancePage from
|
|
2
|
-
import RequestDetail from
|
|
3
|
-
import ServiceRequest from
|
|
4
|
-
import JobTypePicker from
|
|
5
|
-
import RequestNotes from
|
|
6
|
-
import MaintenanceUserPicker from
|
|
7
|
-
import JobsReducer from
|
|
8
|
-
import { values } from
|
|
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";
|
|
9
9
|
|
|
10
10
|
export const Reducers = (() => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const reducers = {};
|
|
12
|
+
reducers[values.reducerKey] = JobsReducer;
|
|
13
|
+
return reducers;
|
|
14
14
|
})();
|
|
15
15
|
export const Screens = (() => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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;
|
|
24
24
|
})();
|
|
25
|
-
export { default as Config } from
|
|
26
|
-
export { default as WidgetSmall } from
|
|
27
|
-
export { default as WidgetLarge } from
|
|
25
|
+
export { default as Config } from "./feature.config";
|
|
26
|
+
export { default as WidgetSmall } from "./components/WidgetSmall";
|
|
27
|
+
export { default as WidgetLarge } from "./components/WidgetLarge";
|