@plusscommunities/pluss-maintenance-app 6.1.2-beta.0 → 7.0.0-beta.1
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/types.js +3 -0
- package/dist/module/actions/types.js.map +1 -1
- package/dist/module/apis/index.js +3 -1
- package/dist/module/apis/index.js.map +1 -1
- package/dist/module/apis/{generalActions.js → maintenanceActions.js} +44 -45
- package/dist/module/apis/maintenanceActions.js.map +1 -0
- package/dist/module/components/FilterPopupMenu.js +78 -26
- package/dist/module/components/FilterPopupMenu.js.map +1 -1
- package/dist/module/components/MaintenanceList.js +70 -45
- package/dist/module/components/MaintenanceList.js.map +1 -1
- package/dist/module/components/MaintenanceListItem.js +54 -42
- package/dist/module/components/MaintenanceListItem.js.map +1 -1
- package/dist/module/components/MaintenanceWidgetItem.js +16 -20
- package/dist/module/components/MaintenanceWidgetItem.js.map +1 -1
- package/dist/module/components/PrioritySelectorPopup.js +82 -0
- package/dist/module/components/PrioritySelectorPopup.js.map +1 -0
- package/dist/module/components/StatusSelectorPopup.js +9 -13
- package/dist/module/components/StatusSelectorPopup.js.map +1 -1
- package/dist/module/components/WidgetSmall.js +13 -9
- package/dist/module/components/WidgetSmall.js.map +1 -1
- package/dist/module/feature.config.js +3 -3
- package/dist/module/feature.config.js.map +1 -1
- package/dist/module/helper.js +39 -17
- package/dist/module/helper.js.map +1 -1
- package/dist/module/reducers/JobsReducer.js +33 -3
- package/dist/module/reducers/JobsReducer.js.map +1 -1
- package/dist/module/screens/JobTypePicker.js +3 -3
- package/dist/module/screens/JobTypePicker.js.map +1 -1
- package/dist/module/screens/MaintenancePage.js +2 -2
- package/dist/module/screens/RequestDetail.js +340 -88
- package/dist/module/screens/RequestDetail.js.map +1 -1
- package/dist/module/screens/RequestNotes.js +437 -26
- package/dist/module/screens/RequestNotes.js.map +1 -1
- package/dist/module/screens/ServiceRequest.js +596 -93
- package/dist/module/screens/ServiceRequest.js.map +1 -1
- package/dist/module/values.config.a.js +9 -1
- package/dist/module/values.config.a.js.map +1 -1
- package/dist/module/values.config.default.js +15 -1
- package/dist/module/values.config.default.js.map +1 -1
- package/dist/module/values.config.forms.js +42 -0
- package/dist/module/values.config.forms.js.map +1 -0
- package/dist/module/values.config.js +34 -20
- package/dist/module/values.config.js.map +1 -1
- package/package.json +11 -11
- package/src/actions/JobActions.js +53 -1
- package/src/actions/types.js +4 -0
- package/src/apis/index.js +5 -1
- package/src/apis/{generalActions.js → maintenanceActions.js} +51 -43
- package/src/components/FilterPopupMenu.js +75 -24
- package/src/components/MaintenanceList.js +64 -33
- package/src/components/MaintenanceListItem.js +53 -31
- package/src/components/MaintenanceWidgetItem.js +18 -14
- package/src/components/PrioritySelectorPopup.js +79 -0
- package/src/components/StatusSelectorPopup.js +8 -13
- package/src/components/WidgetSmall.js +9 -7
- package/src/feature.config.js +15 -13
- package/src/helper.js +51 -13
- package/src/reducers/JobsReducer.js +27 -2
- package/src/screens/JobTypePicker.js +1 -1
- package/src/screens/RequestDetail.js +324 -75
- package/src/screens/RequestNotes.js +434 -33
- package/src/screens/ServiceRequest.js +642 -157
- package/src/values.config.a.js +8 -0
- package/src/values.config.default.js +14 -0
- package/src/values.config.forms.js +42 -0
- package/src/values.config.js +34 -20
- package/dist/module/apis/generalActions.js.map +0 -1
- package/dist/module/values.config.b.js +0 -28
- package/dist/module/values.config.b.js.map +0 -1
- package/dist/module/values.config.c.js +0 -28
- package/dist/module/values.config.c.js.map +0 -1
- package/dist/module/values.config.d.js +0 -28
- package/dist/module/values.config.d.js.map +0 -1
- package/src/values.config.b.js +0 -28
- package/src/values.config.c.js +0 -28
- package/src/values.config.d.js +0 -28
@@ -1,22 +1,10 @@
|
|
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 '
|
4
|
+
import { Icon } from '@rneui/themed';
|
5
5
|
import { connect } from 'react-redux';
|
6
6
|
import moment from 'moment';
|
7
|
-
|
8
|
-
// getShadowStyle,
|
9
|
-
// LINEGREY,
|
10
|
-
// TEXT_DARK,
|
11
|
-
// TEXT_LIGHT,
|
12
|
-
// COLOUR_GREEN,
|
13
|
-
// getMainBrandingColourFromState,
|
14
|
-
// hexToRGBAstring,
|
15
|
-
// getJobStatusProps,
|
16
|
-
// jobStatusOptions,
|
17
|
-
// } from '../../js';
|
18
|
-
// import NavigationService from '../../js/NavigationService';
|
19
|
-
import { getJobStatusProps, jobStatusOptions } from '../helper';
|
7
|
+
import { getJobStatus, getJobPriority } from '../helper';
|
20
8
|
import { Services } from '../feature.config';
|
21
9
|
import { Helper, Colours } from '../core.config';
|
22
10
|
import { values } from '../values.config';
|
@@ -47,9 +35,9 @@ class MaintenanceListItem extends Component {
|
|
47
35
|
}
|
48
36
|
|
49
37
|
renderSeen() {
|
50
|
-
const { job } = this.props;
|
51
|
-
const showSeen = !job.status || job.status ===
|
52
|
-
if (!showSeen || !job.seen) {
|
38
|
+
const { job, hideSeen } = this.props;
|
39
|
+
const showSeen = !job.status || job.status === getJobStatus(null, this.props).text;
|
40
|
+
if (hideSeen || !showSeen || !job.seen) {
|
53
41
|
return null;
|
54
42
|
}
|
55
43
|
return (
|
@@ -64,8 +52,10 @@ class MaintenanceListItem extends Component {
|
|
64
52
|
const { job } = this.props;
|
65
53
|
const createdTime = moment(job.createdUnix);
|
66
54
|
const createdTimeText = `${createdTime.format('ddd, D MMMM')} • ${createdTime.format('h:mma')}`;
|
67
|
-
const
|
68
|
-
const
|
55
|
+
const assigneeText = job.Assignee ? `Assigned to\n${job.Assignee.displayName}` : '';
|
56
|
+
const status = getJobStatus(job.status, this.props);
|
57
|
+
const priority = getJobPriority(job.priority);
|
58
|
+
const isStaff = this.props.user.category === 'staff'
|
69
59
|
|
70
60
|
return (
|
71
61
|
<TouchableOpacity onPress={this.onPressJob}>
|
@@ -73,12 +63,18 @@ class MaintenanceListItem extends Component {
|
|
73
63
|
<View style={styles.jobInnerContainer}>
|
74
64
|
<View style={styles.jobTopSection}>
|
75
65
|
<View style={styles.jobTopLeft}>
|
76
|
-
{job.jobId ?
|
66
|
+
{job.jobId ? (
|
67
|
+
<Text
|
68
|
+
style={[styles.jobIdText, { color: this.props.colourBrandingMain }]}
|
69
|
+
>{`${values.textEntityName} #${job.jobId}`}</Text>
|
70
|
+
) : null}
|
77
71
|
<Text style={styles.jobTitleText}>{job.title}</Text>
|
78
72
|
{job.room ? <Text style={styles.jobLocationText}>{job.room}</Text> : null}
|
79
73
|
<View style={styles.jobTypeSeenContainer}>
|
80
74
|
<View style={[styles.jobTypeContainer, { backgroundColor: Colours.hexToRGBAstring(this.props.colourBrandingMain, 0.2) }]}>
|
81
|
-
<Text style={[styles.jobTypeText, { color: this.props.colourBrandingMain }]}
|
75
|
+
<Text style={[styles.jobTypeText, { color: this.props.colourBrandingMain }]} numberOfLines={2}>
|
76
|
+
{job.type}
|
77
|
+
</Text>
|
82
78
|
</View>
|
83
79
|
{this.renderSeen()}
|
84
80
|
</View>
|
@@ -92,16 +88,21 @@ class MaintenanceListItem extends Component {
|
|
92
88
|
{/* {this.renderDescription()} */}
|
93
89
|
<Text style={styles.jobCreatedText}>{createdTimeText}</Text>
|
94
90
|
<View style={styles.jobActivityContainer}>
|
95
|
-
<View style={[styles.jobStatusContainer, { backgroundColor:
|
96
|
-
<Icon name="wrench" type="font-awesome" iconStyle={styles.jobStatusIcon} />
|
97
|
-
<Text style={styles.jobStatusText}>{
|
91
|
+
<View style={[styles.jobStatusContainer, { backgroundColor: status?.color }]}>
|
92
|
+
{/* <Icon name="wrench" type="font-awesome" iconStyle={styles.jobStatusIcon} /> */}
|
93
|
+
<Text style={styles.jobStatusText}>{status?.text}</Text>
|
98
94
|
</View>
|
99
|
-
<View style={[styles.jobStatusLine, { borderColor:
|
95
|
+
<View style={[styles.jobStatusLine, { borderColor: status?.color }]}>
|
100
96
|
<View style={styles.jobStatusLineMask} />
|
101
97
|
</View>
|
102
|
-
<View style={[styles.jobStatusCircle, { backgroundColor:
|
103
|
-
<Text style={styles.jobStatusDateText}>{
|
98
|
+
<View style={[styles.jobStatusCircle, { backgroundColor: status?.color }]} />
|
99
|
+
<Text style={styles.jobStatusDateText}>{assigneeText}</Text>
|
104
100
|
</View>
|
101
|
+
{isStaff && (
|
102
|
+
<View style={[styles.jobPriorityContainer, { backgroundColor: priority.color }]}>
|
103
|
+
<Text style={styles.jobPriorityText}>{priority.label}</Text>
|
104
|
+
</View>
|
105
|
+
)}
|
105
106
|
</View>
|
106
107
|
</View>
|
107
108
|
</View>
|
@@ -152,8 +153,9 @@ const styles = StyleSheet.create({
|
|
152
153
|
alignItems: 'center',
|
153
154
|
},
|
154
155
|
jobTypeContainer: {
|
155
|
-
|
156
|
-
|
156
|
+
padding: 4,
|
157
|
+
minWidth: 80,
|
158
|
+
maxWidth: 140,
|
157
159
|
borderRadius: 4,
|
158
160
|
justifyContent: 'center',
|
159
161
|
},
|
@@ -161,6 +163,7 @@ const styles = StyleSheet.create({
|
|
161
163
|
fontFamily: 'sf-semibold',
|
162
164
|
fontSize: 12,
|
163
165
|
textAlign: 'center',
|
166
|
+
maxWidth: '100%',
|
164
167
|
},
|
165
168
|
jobSeenContainer: {
|
166
169
|
flexDirection: 'row',
|
@@ -228,7 +231,7 @@ const styles = StyleSheet.create({
|
|
228
231
|
jobStatusContainer: {
|
229
232
|
flexDirection: 'row',
|
230
233
|
alignItems: 'center',
|
231
|
-
justifyContent: '
|
234
|
+
justifyContent: 'center',
|
232
235
|
width: 105,
|
233
236
|
height: 30,
|
234
237
|
paddingHorizontal: 8,
|
@@ -266,15 +269,34 @@ const styles = StyleSheet.create({
|
|
266
269
|
jobStatusDateText: {
|
267
270
|
flex: 1,
|
268
271
|
textAlign: 'right',
|
269
|
-
fontFamily: 'sf-
|
272
|
+
fontFamily: 'sf-medium',
|
270
273
|
fontSize: 14,
|
271
274
|
color: Colours.TEXT_DARK,
|
272
275
|
},
|
276
|
+
jobPriorityContainer: {
|
277
|
+
flexDirection: 'row',
|
278
|
+
alignItems: 'center',
|
279
|
+
justifyContent: 'center',
|
280
|
+
width: 105,
|
281
|
+
height: 24,
|
282
|
+
paddingHorizontal: 8,
|
283
|
+
borderRadius: 4,
|
284
|
+
marginTop: 8,
|
285
|
+
},
|
286
|
+
jobPriorityText: {
|
287
|
+
color: '#fff',
|
288
|
+
textAlign: 'center',
|
289
|
+
fontFamily: 'sf-semibold',
|
290
|
+
fontSize: 13,
|
291
|
+
},
|
273
292
|
});
|
274
293
|
|
275
294
|
const mapStateToProps = state => {
|
276
295
|
return {
|
296
|
+
user: state.user,
|
277
297
|
colourBrandingMain: Colours.getMainBrandingColourFromState(state),
|
298
|
+
statusTypes: state[values.reducerKey].jobstatuses,
|
299
|
+
hideSeen: state[values.reducerKey].hideSeen,
|
278
300
|
};
|
279
301
|
};
|
280
302
|
|
@@ -1,10 +1,10 @@
|
|
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 '
|
4
|
+
import { Icon } from '@rneui/themed';
|
5
5
|
import moment from 'moment';
|
6
6
|
import _ from 'lodash';
|
7
|
-
import {
|
7
|
+
import { getJobStatus } from '../helper';
|
8
8
|
import { Services } from '../feature.config';
|
9
9
|
import { Colours, Helper } from '../core.config';
|
10
10
|
import { values } from '../values.config';
|
@@ -15,12 +15,12 @@ class MaintenanceWidgetItem extends Component {
|
|
15
15
|
};
|
16
16
|
|
17
17
|
render() {
|
18
|
-
const { job } = this.props;
|
18
|
+
const { job, hideSeen } = this.props;
|
19
19
|
const createdTime = moment(job.createdUnix);
|
20
20
|
const createdTimeText = `${createdTime.format('ddd, D MMMM')} • ${createdTime.format('h:mma')}`;
|
21
|
-
const
|
21
|
+
const status = getJobStatus(job.status, this.props);
|
22
22
|
const seenText = (() => {
|
23
|
-
if (!job.status || job.status ===
|
23
|
+
if (!job.status || job.status === getJobStatus(null, this.props).text) {
|
24
24
|
return job.seen ? 'Seen' : 'Unseen';
|
25
25
|
}
|
26
26
|
return '';
|
@@ -35,17 +35,19 @@ class MaintenanceWidgetItem extends Component {
|
|
35
35
|
{job.title}
|
36
36
|
</Text>
|
37
37
|
<Text style={styles.jobCreatedTimeText}>{createdTimeText}</Text>
|
38
|
-
|
39
|
-
{
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
38
|
+
{!hideSeen ? (
|
39
|
+
<View style={styles.jobSeenContainer}>
|
40
|
+
{job.seen && !_.isEmpty(seenText) && (
|
41
|
+
<Icon name="check" type="font-awesome" iconStyle={[styles.jobSeenIcon, { color: this.props.colourBrandingMain }]} />
|
42
|
+
)}
|
43
|
+
<Text style={[styles.jobSeenText, job.seen && { color: this.props.colourBrandingMain }]}>{seenText}</Text>
|
44
|
+
</View>
|
45
|
+
) : null}
|
44
46
|
</View>
|
45
47
|
<View style={styles.jobBottomSection}>
|
46
|
-
<View style={[styles.jobStatusContainer, { backgroundColor:
|
47
|
-
<Icon name="wrench" type="font-awesome" iconStyle={styles.jobStatusIcon} />
|
48
|
-
<Text style={styles.jobStatusText}>{
|
48
|
+
<View style={[styles.jobStatusContainer, { backgroundColor: status?.color }]}>
|
49
|
+
{/* <Icon name="wrench" type="font-awesome" iconStyle={styles.jobStatusIcon} /> */}
|
50
|
+
<Text style={styles.jobStatusText}>{status?.text}</Text>
|
49
51
|
</View>
|
50
52
|
</View>
|
51
53
|
</View>
|
@@ -126,6 +128,8 @@ const styles = StyleSheet.create({
|
|
126
128
|
const mapStateToProps = state => {
|
127
129
|
return {
|
128
130
|
colourBrandingMain: Colours.getMainBrandingColourFromState(state),
|
131
|
+
statusTypes: state[values.reducerKey].jobstatuses,
|
132
|
+
hideSeen: state[values.reducerKey].hideSeen,
|
129
133
|
};
|
130
134
|
};
|
131
135
|
|
@@ -0,0 +1,79 @@
|
|
1
|
+
import React, { PureComponent } from 'react';
|
2
|
+
import { View, StyleSheet, TouchableOpacity, Text } from 'react-native';
|
3
|
+
import { connect } from 'react-redux';
|
4
|
+
import { jobPriorityOptions } from '../helper';
|
5
|
+
import { Components, Colours } from '../core.config';
|
6
|
+
|
7
|
+
class PrioritySelectorPopup extends PureComponent {
|
8
|
+
render() {
|
9
|
+
const { title, includeAll, allText, onClose, onSelect } = this.props;
|
10
|
+
let priorities = jobPriorityOptions;
|
11
|
+
if (includeAll)
|
12
|
+
priorities = [
|
13
|
+
{
|
14
|
+
label: allText || 'Show All',
|
15
|
+
color: this.props.colourBrandingMain,
|
16
|
+
},
|
17
|
+
...priorities,
|
18
|
+
];
|
19
|
+
|
20
|
+
return (
|
21
|
+
<Components.MiddlePopup style={[styles.statusPopup, { height: priorities.length * 50 + 40 }]} onClose={onClose}>
|
22
|
+
<Text style={styles.statusPopupTitle}>{title || 'Select Priority'}</Text>
|
23
|
+
<View style={styles.statusPopupOptionsContainer}>
|
24
|
+
{priorities.map(priority => {
|
25
|
+
return (
|
26
|
+
<TouchableOpacity key={priority.label} onPress={() => onSelect(priority.label)}>
|
27
|
+
<View style={[styles.jobStatusContainer, { backgroundColor: priority.color }]}>
|
28
|
+
<Text style={styles.jobStatusText}>{priority.label}</Text>
|
29
|
+
</View>
|
30
|
+
</TouchableOpacity>
|
31
|
+
);
|
32
|
+
})}
|
33
|
+
</View>
|
34
|
+
</Components.MiddlePopup>
|
35
|
+
);
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
const styles = StyleSheet.create({
|
40
|
+
statusPopup: {
|
41
|
+
width: 160,
|
42
|
+
padding: 16,
|
43
|
+
borderRadius: 12,
|
44
|
+
},
|
45
|
+
statusPopupTitle: {
|
46
|
+
fontFamily: 'sf-bold',
|
47
|
+
color: Colours.TEXT_DARK,
|
48
|
+
fontSize: 18,
|
49
|
+
marginBottom: 16,
|
50
|
+
},
|
51
|
+
statusPopupOptionsContainer: {
|
52
|
+
flex: 1,
|
53
|
+
justifyContent: 'space-between',
|
54
|
+
},
|
55
|
+
jobStatusContainer: {
|
56
|
+
flexDirection: 'row',
|
57
|
+
alignItems: 'center',
|
58
|
+
justifyContent: 'space-between',
|
59
|
+
width: 105,
|
60
|
+
height: 30,
|
61
|
+
paddingHorizontal: 8,
|
62
|
+
borderRadius: 4,
|
63
|
+
},
|
64
|
+
jobStatusText: {
|
65
|
+
color: '#fff',
|
66
|
+
textAlign: 'center',
|
67
|
+
fontFamily: 'sf-semibold',
|
68
|
+
fontSize: 13,
|
69
|
+
flex: 1,
|
70
|
+
},
|
71
|
+
});
|
72
|
+
|
73
|
+
const mapStateToProps = state => {
|
74
|
+
return {
|
75
|
+
colourBrandingMain: Colours.getMainBrandingColourFromState(state),
|
76
|
+
};
|
77
|
+
};
|
78
|
+
|
79
|
+
export default connect(mapStateToProps, {})(PrioritySelectorPopup);
|
@@ -1,24 +1,18 @@
|
|
1
1
|
import React, { PureComponent } from 'react';
|
2
2
|
import { View, StyleSheet, TouchableOpacity, Text } from 'react-native';
|
3
3
|
import { connect } from 'react-redux';
|
4
|
-
import {
|
4
|
+
import { getJobStatusOptions } from '../helper';
|
5
5
|
import { Components, Colours } from '../core.config';
|
6
|
+
import { values } from '../values.config';
|
6
7
|
|
7
8
|
class StatusSelectorPopup extends PureComponent {
|
8
9
|
render() {
|
9
|
-
const { title,
|
10
|
-
let statuses =
|
11
|
-
? filter.map(status => {
|
12
|
-
return {
|
13
|
-
name: status,
|
14
|
-
color: getJobStatusColour(status),
|
15
|
-
};
|
16
|
-
})
|
17
|
-
: jobStatusOptions;
|
10
|
+
const { title, includeAll, allText, onClose, onSelect } = this.props;
|
11
|
+
let statuses = getJobStatusOptions(this.props);
|
18
12
|
if (includeAll)
|
19
13
|
statuses = [
|
20
14
|
{
|
21
|
-
|
15
|
+
text: allText || 'Show All',
|
22
16
|
color: this.props.colourBrandingMain,
|
23
17
|
},
|
24
18
|
...statuses,
|
@@ -30,9 +24,9 @@ class StatusSelectorPopup extends PureComponent {
|
|
30
24
|
<View style={styles.statusPopupOptionsContainer}>
|
31
25
|
{statuses.map(status => {
|
32
26
|
return (
|
33
|
-
<TouchableOpacity key={status.
|
27
|
+
<TouchableOpacity key={status.text} onPress={() => onSelect(status.text)}>
|
34
28
|
<View style={[styles.jobStatusContainer, { backgroundColor: status.color }]}>
|
35
|
-
<Text style={styles.jobStatusText}>{status.
|
29
|
+
<Text style={styles.jobStatusText}>{status.text}</Text>
|
36
30
|
</View>
|
37
31
|
</TouchableOpacity>
|
38
32
|
);
|
@@ -80,6 +74,7 @@ const styles = StyleSheet.create({
|
|
80
74
|
const mapStateToProps = state => {
|
81
75
|
return {
|
82
76
|
colourBrandingMain: Colours.getMainBrandingColourFromState(state),
|
77
|
+
statusTypes: state[values.reducerKey].jobstatuses,
|
83
78
|
};
|
84
79
|
};
|
85
80
|
|
@@ -2,11 +2,11 @@ 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 {
|
6
|
-
import { jobsLoaded } from '../actions';
|
5
|
+
import { maintenanceActions } from '../apis';
|
6
|
+
import { jobsLoaded, jobStatusesUpdate, jobHideSeenUpdate } from '../actions';
|
7
7
|
import MaintenanceWidgetItem from './MaintenanceWidgetItem';
|
8
8
|
import { Services } from '../feature.config';
|
9
|
-
import { Colours, Components
|
9
|
+
import { Colours, Components } from '../core.config';
|
10
10
|
import { values } from '../values.config';
|
11
11
|
|
12
12
|
const MAX_ITEMS = 10;
|
@@ -18,6 +18,8 @@ class WidgetSmall extends Component {
|
|
18
18
|
}
|
19
19
|
|
20
20
|
componentDidMount() {
|
21
|
+
this.props.jobStatusesUpdate(this.props.site);
|
22
|
+
this.props.jobHideSeenUpdate(this.props.site);
|
21
23
|
this.refresh();
|
22
24
|
}
|
23
25
|
|
@@ -34,13 +36,13 @@ class WidgetSmall extends Component {
|
|
34
36
|
getEmptyStateText = () => {
|
35
37
|
const { options, userCategory } = this.props;
|
36
38
|
if (options && !_.isEmpty(options.EmptyText)) return options.EmptyText;
|
37
|
-
return userCategory === 'staff' ?
|
39
|
+
return userCategory === 'staff' ? values.emptyRequestsStaff : values.emptyRequestsUser;
|
38
40
|
};
|
39
41
|
|
40
42
|
refresh = () => {
|
41
43
|
this.onLoadingChanged(true, async () => {
|
42
44
|
try {
|
43
|
-
const res = await
|
45
|
+
const res = await maintenanceActions.getJobsRecursive(this.props.site);
|
44
46
|
// console.log('WidgetSmall - refresh', res.data);
|
45
47
|
this.props.jobsLoaded(res);
|
46
48
|
} catch (error) {
|
@@ -59,7 +61,7 @@ class WidgetSmall extends Component {
|
|
59
61
|
};
|
60
62
|
|
61
63
|
onPressAll = () => {
|
62
|
-
Services.navigation.navigate(
|
64
|
+
Services.navigation.navigate(values.screenMaintenance, { options: this.props.options });
|
63
65
|
};
|
64
66
|
|
65
67
|
renderContent() {
|
@@ -149,4 +151,4 @@ const mapStateToProps = state => {
|
|
149
151
|
};
|
150
152
|
};
|
151
153
|
|
152
|
-
export default connect(mapStateToProps, { jobsLoaded }, null, { forwardRef: true })(WidgetSmall);
|
154
|
+
export default connect(mapStateToProps, { jobsLoaded, jobStatusesUpdate, jobHideSeenUpdate }, null, { forwardRef: true })(WidgetSmall);
|
package/src/feature.config.js
CHANGED
@@ -16,7 +16,7 @@ const FeatureConfig = {
|
|
16
16
|
title: values.textFeatureTitle,
|
17
17
|
gridMenu: {
|
18
18
|
icon: values.iconGridMenu,
|
19
|
-
viewBox:
|
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
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
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,30 +1,68 @@
|
|
1
1
|
import { Colours } from './core.config';
|
2
2
|
|
3
|
+
const STATUS_NOT_ACTIONED = 'Not Actioned';
|
4
|
+
const STATUS_IN_PROGRESS = 'In Progress';
|
5
|
+
const STATUS_COMPLETED = 'Completed';
|
6
|
+
|
3
7
|
const jobStatusOptions = [
|
4
8
|
{
|
5
|
-
|
9
|
+
text: 'Open',
|
10
|
+
order: 0,
|
6
11
|
color: Colours.LINEGREY,
|
12
|
+
category: STATUS_NOT_ACTIONED,
|
7
13
|
},
|
8
14
|
{
|
9
|
-
|
15
|
+
text: 'In Progress',
|
16
|
+
order: 1,
|
10
17
|
color: Colours.COLOUR_TEAL,
|
18
|
+
category: STATUS_IN_PROGRESS,
|
11
19
|
},
|
12
20
|
{
|
13
|
-
|
21
|
+
text: 'Completed',
|
22
|
+
order: 2,
|
14
23
|
color: Colours.COLOUR_GREEN_LIGHT,
|
24
|
+
category: STATUS_COMPLETED,
|
15
25
|
},
|
16
26
|
];
|
17
27
|
|
18
|
-
const
|
19
|
-
|
20
|
-
|
21
|
-
|
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
|
+
];
|
22
43
|
|
23
|
-
const
|
24
|
-
const statusText = status || jobStatusOptions[0].name;
|
25
|
-
const statusColor = getJobStatusColour(statusText);
|
44
|
+
const getJobStatusOptions = props => props?.statusTypes?.length ? props?.statusTypes : jobStatusOptions;
|
26
45
|
|
27
|
-
|
28
|
-
|
46
|
+
const getDefaultJobStatuses = props => getJobStatusOptions(props).filter(s => s.category === STATUS_NOT_ACTIONED);
|
47
|
+
|
48
|
+
const getIncompleteJobStatuses = props => getJobStatusOptions(props).filter(s => s.category === STATUS_IN_PROGRESS);
|
29
49
|
|
30
|
-
|
50
|
+
const getJobStatus = (status, props) => {
|
51
|
+
const statusOptions = getJobStatusOptions(props);
|
52
|
+
// console.log('getJobStatus', JSON.stringify({ status, statusOptions }, null, 2));
|
53
|
+
let statusOption = null;
|
54
|
+
if (status) statusOption = statusOptions.find(s => s.text === status);
|
55
|
+
return statusOption || getDefaultJobStatuses(props)[0];
|
56
|
+
}
|
57
|
+
|
58
|
+
const getJobPriority = priority => jobPriorityOptions.find(p => p.label === priority) || jobPriorityOptions.find(p => p.default);
|
59
|
+
|
60
|
+
export {
|
61
|
+
jobStatusOptions,
|
62
|
+
jobPriorityOptions,
|
63
|
+
getJobStatusOptions,
|
64
|
+
getDefaultJobStatuses,
|
65
|
+
getIncompleteJobStatuses,
|
66
|
+
getJobStatus,
|
67
|
+
getJobPriority,
|
68
|
+
};
|
@@ -1,18 +1,30 @@
|
|
1
1
|
/* eslint-disable no-param-reassign */
|
2
2
|
import _ from 'lodash';
|
3
3
|
import { REHYDRATE } from 'redux-persist';
|
4
|
-
import { JOBS_LOADED, JOB_ADDED, JOBS_ADDED } from '../actions/types';
|
4
|
+
import { JOBS_LOADED, JOB_ADDED, JOBS_ADDED, JOBS_STATUSES_LOADED, JOBS_HIDE_SEEN, JOB_FILTER_LOADED } from '../actions/types';
|
5
5
|
import { ActionTypes } from '../core.config';
|
6
|
+
import { values } from '../values.config';
|
6
7
|
|
7
|
-
const REDUCER_KEY =
|
8
|
+
const REDUCER_KEY = values.reducerKey;
|
8
9
|
|
9
10
|
const INITIAL_STATE = {
|
10
11
|
jobs: [],
|
12
|
+
jobstatuses: [],
|
13
|
+
hideSeen: false,
|
14
|
+
jobfilters: {
|
15
|
+
status: '',
|
16
|
+
statusText: '',
|
17
|
+
priority: '',
|
18
|
+
type: '',
|
19
|
+
assignee: '',
|
20
|
+
assigneeName: '',
|
21
|
+
},
|
11
22
|
};
|
12
23
|
|
13
24
|
export default (state = INITIAL_STATE, action) => {
|
14
25
|
let updateJobs = [];
|
15
26
|
let index = 0;
|
27
|
+
let jobstatuses = [];
|
16
28
|
|
17
29
|
switch (action.type) {
|
18
30
|
case ActionTypes.LOGOUT:
|
@@ -35,6 +47,19 @@ export default (state = INITIAL_STATE, action) => {
|
|
35
47
|
updateJobs.push(action.payload);
|
36
48
|
}
|
37
49
|
return { ...state, jobs: updateJobs };
|
50
|
+
case JOBS_STATUSES_LOADED:
|
51
|
+
jobstatuses = _.orderBy(
|
52
|
+
_.unionWith(action.payload, state.jobstatuses, (v1, v2) => {
|
53
|
+
return v1 != null && v2 != null && v1.text === v2.text;
|
54
|
+
}),
|
55
|
+
'order',
|
56
|
+
'asc',
|
57
|
+
);
|
58
|
+
return { ...state, jobstatuses };
|
59
|
+
case JOBS_HIDE_SEEN:
|
60
|
+
return { ...state, hideSeen: action.payload };
|
61
|
+
case JOB_FILTER_LOADED:
|
62
|
+
return { ...state, jobfilters: action.payload };
|
38
63
|
case REHYDRATE:
|
39
64
|
if (!action.payload) return state;
|
40
65
|
if (action.payload[REDUCER_KEY]) {
|
@@ -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 '
|
5
|
+
import { Icon } from '@rneui/themed';
|
6
6
|
import { Services } from '../feature.config';
|
7
7
|
import { Components, Colours } from '../core.config';
|
8
8
|
|