@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.
- package/dist/module/actions/JobActions.js +44 -1
- 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 +4 -1
- package/dist/module/actions/types.js.map +1 -1
- package/dist/module/apis/index.js +4 -1
- package/dist/module/apis/index.js.map +1 -1
- package/dist/module/apis/maintenanceActions.js +61 -38
- package/dist/module/apis/maintenanceActions.js.map +1 -1
- package/dist/module/apis/userActions.js +23 -0
- package/dist/module/apis/userActions.js.map +1 -0
- package/dist/module/components/FilterPopupMenu.js +82 -58
- package/dist/module/components/FilterPopupMenu.js.map +1 -1
- package/dist/module/components/MaintenanceList.js +84 -92
- package/dist/module/components/MaintenanceList.js.map +1 -1
- package/dist/module/components/MaintenanceListItem.js +94 -80
- package/dist/module/components/MaintenanceListItem.js.map +1 -1
- package/dist/module/components/MaintenanceWidgetItem.js +39 -38
- package/dist/module/components/MaintenanceWidgetItem.js.map +1 -1
- package/dist/module/components/PrioritySelectorPopup.js +83 -0
- package/dist/module/components/PrioritySelectorPopup.js.map +1 -0
- package/dist/module/components/StatusSelectorPopup.js +23 -27
- 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 +25 -20
- package/dist/module/components/WidgetSmall.js.map +1 -1
- package/dist/module/core.config.js +2 -3
- 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 +41 -26
- package/dist/module/helper.js.map +1 -1
- package/dist/module/index.js +12 -10
- package/dist/module/index.js.map +1 -1
- package/dist/module/reducers/JobsReducer.js +36 -6
- package/dist/module/reducers/JobsReducer.js.map +1 -1
- package/dist/module/screens/JobTypePicker.js +18 -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 +219 -0
- package/dist/module/screens/MaintenanceUserPicker.js.map +1 -0
- package/dist/module/screens/RequestDetail.js +410 -142
- package/dist/module/screens/RequestDetail.js.map +1 -1
- package/dist/module/screens/RequestNotes.js +462 -52
- package/dist/module/screens/RequestNotes.js.map +1 -1
- package/dist/module/screens/ServiceRequest.js +519 -181
- package/dist/module/screens/ServiceRequest.js.map +1 -1
- package/dist/module/values.config.a.js +30 -23
- package/dist/module/values.config.a.js.map +1 -1
- package/dist/module/values.config.default.js +35 -28
- package/dist/module/values.config.default.js.map +1 -1
- package/dist/module/values.config.enquiry.js +43 -0
- package/dist/module/values.config.enquiry.js.map +1 -0
- package/dist/module/values.config.feedback.js +43 -0
- package/dist/module/values.config.feedback.js.map +1 -0
- package/dist/module/values.config.food.js +43 -0
- package/dist/module/values.config.food.js.map +1 -0
- package/dist/module/values.config.forms.js +35 -28
- package/dist/module/values.config.forms.js.map +1 -1
- package/dist/module/values.config.js +35 -28
- package/dist/module/values.config.js.map +1 -1
- package/package.json +55 -51
- package/src/actions/JobActions.js +75 -16
- package/src/actions/index.js +1 -1
- package/src/actions/types.js +4 -1
- package/src/apis/index.js +6 -1
- package/src/apis/maintenanceActions.js +189 -160
- package/src/apis/userActions.js +21 -0
- package/src/components/FilterPopupMenu.js +316 -230
- package/src/components/MaintenanceList.js +391 -326
- package/src/components/MaintenanceListItem.js +348 -274
- package/src/components/MaintenanceWidgetItem.js +146 -120
- package/src/components/PrioritySelectorPopup.js +93 -0
- package/src/components/StatusSelectorPopup.js +82 -76
- package/src/components/WidgetLarge.js +5 -5
- package/src/components/WidgetSmall.js +154 -131
- package/src/core.config.js +25 -3
- package/src/feature.config.js +62 -62
- package/src/helper.js +67 -30
- package/src/index.js +22 -20
- package/src/reducers/JobsReducer.js +85 -41
- package/src/screens/JobTypePicker.js +116 -92
- package/src/screens/MaintenancePage.js +89 -80
- package/src/screens/MaintenanceUserPicker.js +233 -0
- package/src/screens/RequestDetail.js +1354 -892
- package/src/screens/RequestNotes.js +946 -408
- package/src/screens/ServiceRequest.js +1808 -1222
- package/src/values.config.a.js +33 -26
- package/src/values.config.default.js +39 -32
- package/src/values.config.enquiry.js +43 -0
- package/src/values.config.feedback.js +43 -0
- package/src/values.config.food.js +43 -0
- package/src/values.config.forms.js +39 -32
- package/src/values.config.js +39 -32
- package/dist/module/values.config.b.js +0 -30
- package/dist/module/values.config.b.js.map +0 -1
- package/dist/module/values.config.c.js +0 -30
- package/dist/module/values.config.c.js.map +0 -1
- package/dist/module/values.config.d.js +0 -30
- package/dist/module/values.config.d.js.map +0 -1
- package/src/values.config.b.js +0 -30
- package/src/values.config.c.js +0 -30
- package/src/values.config.d.js +0 -30
|
@@ -1,152 +1,175 @@
|
|
|
1
|
-
import React, { Component } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
constructor(props) {
|
|
17
|
+
super(props);
|
|
18
|
+
this.state = { loading: false };
|
|
19
|
+
}
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
componentDidMount() {
|
|
22
|
+
this.props.jobStatusesUpdate(this.props.site);
|
|
23
|
+
this.props.jobHideSeenUpdate(this.props.site);
|
|
24
|
+
this.refresh();
|
|
25
|
+
}
|
|
23
26
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
componentDidUpdate(prevProps) {
|
|
28
|
+
if (!prevProps.dataUpdated && this.props.dataUpdated) this.refresh();
|
|
29
|
+
}
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
70
|
+
onPressAll = () => {
|
|
71
|
+
Services.navigation.navigate(values.screenMaintenance, {
|
|
72
|
+
options: this.props.options,
|
|
73
|
+
});
|
|
74
|
+
};
|
|
64
75
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
-
|
|
91
|
-
|
|
108
|
+
render() {
|
|
109
|
+
const { colourBrandingMain } = this.props;
|
|
92
110
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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(
|
|
170
|
+
export default connect(
|
|
171
|
+
mapStateToProps,
|
|
172
|
+
{ jobsLoaded, jobStatusesUpdate, jobHideSeenUpdate },
|
|
173
|
+
null,
|
|
174
|
+
{ forwardRef: true },
|
|
175
|
+
)(WidgetSmall);
|
package/src/core.config.js
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
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
|
+
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
|
+
};
|
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,39 +1,76 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
|
23
|
-
|
|
24
|
-
|
|
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
|
|
28
|
-
|
|
29
|
-
return option ? option.label : jobStatusOptions[0].label;
|
|
30
|
-
};
|
|
44
|
+
const getJobStatusOptions = (props) =>
|
|
45
|
+
props?.statusTypes?.length ? props?.statusTypes : jobStatusOptions;
|
|
31
46
|
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
const statusColor = getJobStatusColour(statusText);
|
|
47
|
+
const getDefaultJobStatuses = (props) =>
|
|
48
|
+
getJobStatusOptions(props).filter((s) => s.category === STATUS_NOT_ACTIONED);
|
|
35
49
|
|
|
36
|
-
|
|
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
|
-
|
|
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
|
|
2
|
-
import RequestDetail from
|
|
3
|
-
import ServiceRequest from
|
|
4
|
-
import JobTypePicker from
|
|
5
|
-
import RequestNotes from
|
|
6
|
-
import
|
|
7
|
-
import
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const reducers = {};
|
|
12
|
+
reducers[values.reducerKey] = JobsReducer;
|
|
13
|
+
return reducers;
|
|
13
14
|
})();
|
|
14
15
|
export const Screens = (() => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
|
24
|
-
export { default as WidgetSmall } from
|
|
25
|
-
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";
|