@plusscommunities/pluss-maintenance-app 6.0.5-auth.0 → 6.1.1-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/types.js +4 -3
- package/dist/module/actions/types.js.map +1 -1
- package/dist/module/apis/{maintenanceActions.js → generalActions.js} +51 -33
- package/dist/module/apis/generalActions.js.map +1 -0
- package/dist/module/apis/index.js +1 -1
- package/dist/module/apis/index.js.map +1 -1
- package/dist/module/components/FilterPopupMenu.js +12 -48
- package/dist/module/components/FilterPopupMenu.js.map +1 -1
- package/dist/module/components/MaintenanceList.js +19 -52
- package/dist/module/components/MaintenanceList.js.map +1 -1
- package/dist/module/components/MaintenanceListItem.js +13 -8
- package/dist/module/components/MaintenanceListItem.js.map +1 -1
- package/dist/module/components/MaintenanceWidgetItem.js +9 -4
- package/dist/module/components/MaintenanceWidgetItem.js.map +1 -1
- package/dist/module/components/StatusSelectorPopup.js +1 -2
- package/dist/module/components/StatusSelectorPopup.js.map +1 -1
- package/dist/module/components/WidgetSmall.js +10 -7
- package/dist/module/components/WidgetSmall.js.map +1 -1
- package/dist/module/feature.config.js +18 -33
- package/dist/module/feature.config.js.map +1 -1
- package/dist/module/helper.js +2 -10
- package/dist/module/helper.js.map +1 -1
- package/dist/module/index.js +15 -10
- package/dist/module/index.js.map +1 -1
- package/dist/module/reducers/JobsReducer.js +2 -2
- package/dist/module/reducers/JobsReducer.js.map +1 -1
- package/dist/module/screens/JobTypePicker.js +2 -2
- package/dist/module/screens/MaintenancePage.js +9 -5
- package/dist/module/screens/MaintenancePage.js.map +1 -1
- package/dist/module/screens/RequestDetail.js +39 -128
- package/dist/module/screens/RequestDetail.js.map +1 -1
- package/dist/module/screens/RequestNotes.js +8 -7
- package/dist/module/screens/RequestNotes.js.map +1 -1
- package/dist/module/screens/ServiceRequest.js +12 -9
- package/dist/module/screens/ServiceRequest.js.map +1 -1
- package/dist/module/values.config.a.js +28 -0
- package/dist/module/values.config.a.js.map +1 -0
- package/dist/module/values.config.b.js +28 -0
- package/dist/module/values.config.b.js.map +1 -0
- package/dist/module/values.config.c.js +28 -0
- package/dist/module/values.config.c.js.map +1 -0
- package/dist/module/values.config.d.js +28 -0
- package/dist/module/values.config.d.js.map +1 -0
- package/dist/module/values.config.default.js +28 -0
- package/dist/module/values.config.default.js.map +1 -0
- package/dist/module/values.config.js +28 -0
- package/dist/module/values.config.js.map +1 -0
- package/package.json +13 -9
- package/src/actions/types.js +5 -3
- package/src/apis/{maintenanceActions.js → generalActions.js} +50 -30
- package/src/apis/index.js +1 -1
- package/src/components/FilterPopupMenu.js +7 -39
- package/src/components/MaintenanceList.js +21 -59
- package/src/components/MaintenanceListItem.js +7 -6
- package/src/components/MaintenanceWidgetItem.js +3 -2
- package/src/components/StatusSelectorPopup.js +1 -2
- package/src/components/WidgetSmall.js +7 -4
- package/src/feature.config.js +18 -30
- package/src/helper.js +2 -11
- package/src/index.js +15 -8
- package/src/screens/MaintenancePage.js +5 -4
- package/src/screens/RequestDetail.js +16 -122
- package/src/screens/RequestNotes.js +6 -5
- package/src/screens/ServiceRequest.js +8 -6
- package/src/values.config.a.js +28 -0
- package/src/values.config.b.js +28 -0
- package/src/values.config.c.js +28 -0
- package/src/values.config.d.js +28 -0
- package/src/values.config.default.js +28 -0
- package/src/values.config.js +28 -0
- package/dist/module/apis/maintenanceActions.js.map +0 -1
@@ -7,10 +7,11 @@ import _ from 'lodash';
|
|
7
7
|
import { getJobStatusProps, jobStatusOptions } from '../helper';
|
8
8
|
import { Services } from '../feature.config';
|
9
9
|
import { Colours, Helper } from '../core.config';
|
10
|
+
import { values } from '../values.config';
|
10
11
|
|
11
12
|
class MaintenanceWidgetItem extends Component {
|
12
13
|
onPressJob = () => {
|
13
|
-
Services.navigation.navigate(
|
14
|
+
Services.navigation.navigate(values.screenRequestDetail, { job: this.props.job });
|
14
15
|
};
|
15
16
|
|
16
17
|
render() {
|
@@ -43,7 +44,7 @@ class MaintenanceWidgetItem extends Component {
|
|
43
44
|
</View>
|
44
45
|
<View style={styles.jobBottomSection}>
|
45
46
|
<View style={[styles.jobStatusContainer, { backgroundColor: statusColor }]}>
|
46
|
-
|
47
|
+
<Icon name="wrench" type="font-awesome" iconStyle={styles.jobStatusIcon} />
|
47
48
|
<Text style={styles.jobStatusText}>{statusText}</Text>
|
48
49
|
</View>
|
49
50
|
</View>
|
@@ -11,7 +11,6 @@ class StatusSelectorPopup extends PureComponent {
|
|
11
11
|
? filter.map(status => {
|
12
12
|
return {
|
13
13
|
name: status,
|
14
|
-
label: getJobStatusLabel(status),
|
15
14
|
color: getJobStatusColour(status),
|
16
15
|
};
|
17
16
|
})
|
@@ -33,7 +32,7 @@ class StatusSelectorPopup extends PureComponent {
|
|
33
32
|
return (
|
34
33
|
<TouchableOpacity key={status.name} onPress={() => onSelect(status.name)}>
|
35
34
|
<View style={[styles.jobStatusContainer, { backgroundColor: status.color }]}>
|
36
|
-
<Text style={styles.jobStatusText}>{status.
|
35
|
+
<Text style={styles.jobStatusText}>{status.name}</Text>
|
37
36
|
</View>
|
38
37
|
</TouchableOpacity>
|
39
38
|
);
|
@@ -2,11 +2,12 @@ import React, { Component } from 'react';
|
|
2
2
|
import { Text, View, ScrollView, StyleSheet } from 'react-native';
|
3
3
|
import { connect } from 'react-redux';
|
4
4
|
import _ from 'lodash';
|
5
|
-
import {
|
5
|
+
import { generalActions } from '../apis';
|
6
6
|
import { jobsLoaded } from '../actions';
|
7
7
|
import MaintenanceWidgetItem from './MaintenanceWidgetItem';
|
8
8
|
import { Services } from '../feature.config';
|
9
9
|
import { Colours, Components, Config } from '../core.config';
|
10
|
+
import { values } from '../values.config';
|
10
11
|
|
11
12
|
const MAX_ITEMS = 10;
|
12
13
|
|
@@ -27,7 +28,7 @@ class WidgetSmall extends Component {
|
|
27
28
|
getTitle = () => {
|
28
29
|
const { options } = this.props;
|
29
30
|
if (options && !_.isEmpty(options.Title)) return options.Title;
|
30
|
-
return
|
31
|
+
return this.props.strings[`${values.featureKey}_textFeatureTitle`] || values.textFeatureTitle;
|
31
32
|
};
|
32
33
|
|
33
34
|
getEmptyStateText = () => {
|
@@ -39,7 +40,7 @@ class WidgetSmall extends Component {
|
|
39
40
|
refresh = () => {
|
40
41
|
this.onLoadingChanged(true, async () => {
|
41
42
|
try {
|
42
|
-
const res = await
|
43
|
+
const res = await generalActions.getJobsRecursive(this.props.site);
|
43
44
|
// console.log('WidgetSmall - refresh', res.data);
|
44
45
|
this.props.jobsLoaded(res);
|
45
46
|
} catch (error) {
|
@@ -136,13 +137,15 @@ const styles = StyleSheet.create({
|
|
136
137
|
});
|
137
138
|
|
138
139
|
const mapStateToProps = state => {
|
139
|
-
const { user,
|
140
|
+
const { user, notifications } = state;
|
141
|
+
const jobs = state[values.reducerKey];
|
140
142
|
return {
|
141
143
|
colourBrandingMain: Colours.getMainBrandingColourFromState(state),
|
142
144
|
jobs: _.orderBy(jobs.jobs, ['createdUnix'], ['desc']),
|
143
145
|
site: user.site,
|
144
146
|
userCategory: user.category,
|
145
147
|
dataUpdated: notifications.dataUpdated.jobs,
|
148
|
+
strings: state.strings?.config || {},
|
146
149
|
};
|
147
150
|
};
|
148
151
|
|
package/src/feature.config.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
// import * as PlussCore from '../../pluss-core/src';
|
2
2
|
import * as PlussCore from '@plusscommunities/pluss-core-app';
|
3
|
+
import { values } from './values.config';
|
3
4
|
|
4
5
|
export const Services = {
|
5
6
|
navigation: null,
|
@@ -10,25 +11,25 @@ export const BaseComponents = {
|
|
10
11
|
};
|
11
12
|
|
12
13
|
const FeatureConfig = {
|
13
|
-
key:
|
14
|
-
aliases:
|
15
|
-
title:
|
14
|
+
key: values.featureKey,
|
15
|
+
aliases: values.aliases,
|
16
|
+
title: values.textFeatureTitle,
|
16
17
|
gridMenu: {
|
17
|
-
icon:
|
18
|
+
icon: values.iconGridMenu,
|
18
19
|
viewBox: '0 0 30 30',
|
19
|
-
navigate:
|
20
|
+
navigate: values.screenMaintenance,
|
20
21
|
},
|
21
22
|
addMenu: {
|
22
|
-
order:
|
23
|
-
icon:
|
24
|
-
title:
|
25
|
-
navigate:
|
26
|
-
visibleExps: { type: 'feature', value:
|
23
|
+
order: values.orderAddMenu,
|
24
|
+
icon: values.iconAddMenu,
|
25
|
+
title: values.textAddMenuTitle,
|
26
|
+
navigate: values.screenServiceRequest,
|
27
|
+
visibleExps: { type: 'feature', value: values.featureKey },
|
27
28
|
},
|
28
29
|
moreMenu: {
|
29
|
-
order:
|
30
|
-
title:
|
31
|
-
navigate:
|
30
|
+
order: values.orderMoreMenu,
|
31
|
+
title: values.textMoreMenuTitle,
|
32
|
+
navigate: values.screenMaintenance,
|
32
33
|
visibleExps: {
|
33
34
|
type: 'and',
|
34
35
|
exps: [
|
@@ -38,10 +39,10 @@ const FeatureConfig = {
|
|
38
39
|
},
|
39
40
|
},
|
40
41
|
kioskAction: {
|
41
|
-
order:
|
42
|
-
icon:
|
43
|
-
title:
|
44
|
-
navigate:
|
42
|
+
order: values.orderKioskAction,
|
43
|
+
icon: values.iconKioskAction,
|
44
|
+
title: values.textKioskActionTitle,
|
45
|
+
navigate: values.screenServiceRequest,
|
45
46
|
},
|
46
47
|
hideTabBar: [],
|
47
48
|
env: {
|
@@ -65,19 +66,6 @@ const FeatureConfig = {
|
|
65
66
|
Services.navigation = navigation;
|
66
67
|
BaseComponents.NotificationBell = notificationBell;
|
67
68
|
PlussCore.Config.init(environment, navigation);
|
68
|
-
|
69
|
-
// Override strings
|
70
|
-
if (environment && environment.strings) {
|
71
|
-
const { MAINTENANCE, MAINTENANCE_REQUEST } = environment.strings;
|
72
|
-
if (MAINTENANCE) {
|
73
|
-
FeatureConfig.addMenu.title = MAINTENANCE;
|
74
|
-
}
|
75
|
-
if (MAINTENANCE_REQUEST) {
|
76
|
-
FeatureConfig.title = MAINTENANCE_REQUEST;
|
77
|
-
FeatureConfig.moreMenu.title = MAINTENANCE_REQUEST;
|
78
|
-
FeatureConfig.kioskAction.title = MAINTENANCE_REQUEST;
|
79
|
-
}
|
80
|
-
}
|
81
69
|
},
|
82
70
|
};
|
83
71
|
export default FeatureConfig;
|
package/src/helper.js
CHANGED
@@ -1,20 +1,16 @@
|
|
1
|
-
import { label } from 'aws-amplify';
|
2
1
|
import { Colours } from './core.config';
|
3
2
|
|
4
3
|
const jobStatusOptions = [
|
5
4
|
{
|
6
5
|
name: 'Unassigned',
|
7
|
-
label: 'Open',
|
8
6
|
color: Colours.LINEGREY,
|
9
7
|
},
|
10
8
|
{
|
11
9
|
name: 'In Progress',
|
12
|
-
label: 'In Progress',
|
13
10
|
color: Colours.COLOUR_TEAL,
|
14
11
|
},
|
15
12
|
{
|
16
13
|
name: 'Completed',
|
17
|
-
label: 'Completed',
|
18
14
|
color: Colours.COLOUR_GREEN_LIGHT,
|
19
15
|
},
|
20
16
|
];
|
@@ -24,16 +20,11 @@ const getJobStatusColour = status => {
|
|
24
20
|
return option ? option.color : jobStatusOptions[0].color;
|
25
21
|
};
|
26
22
|
|
27
|
-
const getJobStatusLabel = status => {
|
28
|
-
const option = jobStatusOptions.find(item => item.name === status);
|
29
|
-
return option ? option.label : jobStatusOptions[0].label;
|
30
|
-
};
|
31
|
-
|
32
23
|
const getJobStatusProps = status => {
|
33
|
-
const statusText =
|
24
|
+
const statusText = status || jobStatusOptions[0].name;
|
34
25
|
const statusColor = getJobStatusColour(statusText);
|
35
26
|
|
36
27
|
return { statusText, statusColor };
|
37
28
|
};
|
38
29
|
|
39
|
-
export { jobStatusOptions, getJobStatusColour, getJobStatusProps
|
30
|
+
export { jobStatusOptions, getJobStatusColour, getJobStatusProps };
|
package/src/index.js
CHANGED
@@ -4,15 +4,22 @@ import ServiceRequest from './screens/ServiceRequest';
|
|
4
4
|
import JobTypePicker from './screens/JobTypePicker';
|
5
5
|
import RequestNotes from './screens/RequestNotes';
|
6
6
|
import JobsReducer from './reducers/JobsReducer';
|
7
|
+
import { values } from './values.config';
|
7
8
|
|
8
|
-
export const Reducers =
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
9
|
+
export const Reducers = (() => {
|
10
|
+
const reducers = {};
|
11
|
+
reducers[values.reducerKey] = JobsReducer;
|
12
|
+
return reducers;
|
13
|
+
})();
|
14
|
+
export const Screens = (() => {
|
15
|
+
const screens = {};
|
16
|
+
screens[values.screenMaintenance] = MaintenancePage;
|
17
|
+
screens[values.screenRequestDetail] = RequestDetail;
|
18
|
+
screens[values.screenServiceRequest] = ServiceRequest;
|
19
|
+
screens[values.screenJobTypePicker] = JobTypePicker;
|
20
|
+
screens[values.screenRequestNotes] = RequestNotes;
|
21
|
+
return screens;
|
22
|
+
})();
|
16
23
|
export { default as Config } from './feature.config';
|
17
24
|
export { default as WidgetSmall } from './components/WidgetSmall';
|
18
25
|
export { default as WidgetLarge } from './components/WidgetLarge';
|
@@ -5,6 +5,7 @@ import _ from 'lodash';
|
|
5
5
|
import MaintenanceList from '../components/MaintenanceList';
|
6
6
|
import { Services, BaseComponents } from '../feature.config';
|
7
7
|
import { Components, Helper, Styles, Config } from '../core.config';
|
8
|
+
import { values } from '../values.config';
|
8
9
|
|
9
10
|
class MaintenancePage extends Component {
|
10
11
|
constructor(props) {
|
@@ -29,10 +30,11 @@ class MaintenancePage extends Component {
|
|
29
30
|
};
|
30
31
|
|
31
32
|
renderHeader() {
|
33
|
+
const title = this.props.title || this.props.strings[`${values.featureKey}_textFeatureTitle`] || values.textFeatureTitle;
|
32
34
|
if (this.state.isHomeTab) {
|
33
35
|
return (
|
34
36
|
<Components.Header
|
35
|
-
text={
|
37
|
+
text={title}
|
36
38
|
rightContent={
|
37
39
|
_.includes(this.props.user.hidden, 'notifications') ? null : (
|
38
40
|
<View style={styles.notificationContainer}>
|
@@ -46,9 +48,7 @@ class MaintenancePage extends Component {
|
|
46
48
|
/>
|
47
49
|
);
|
48
50
|
}
|
49
|
-
return
|
50
|
-
<Components.Header leftIcon="angle-left" onPressLeft={this.onPressBack} text={this.props.title || Config.env.strings.MAINTENANCE} />
|
51
|
-
);
|
51
|
+
return <Components.Header leftIcon="angle-left" onPressLeft={this.onPressBack} text={values.textFeatureTitle} />;
|
52
52
|
}
|
53
53
|
|
54
54
|
render() {
|
@@ -89,6 +89,7 @@ const styles = StyleSheet.create({
|
|
89
89
|
const mapStateToProps = state => {
|
90
90
|
return {
|
91
91
|
user: state.user,
|
92
|
+
strings: state.strings?.config || {},
|
92
93
|
};
|
93
94
|
};
|
94
95
|
|
@@ -5,12 +5,13 @@ import { Icon } from 'react-native-elements';
|
|
5
5
|
import _ from 'lodash';
|
6
6
|
import moment from 'moment';
|
7
7
|
import { connect } from 'react-redux';
|
8
|
-
import {
|
8
|
+
import { generalActions } from '../apis';
|
9
9
|
import { jobAdded } from '../actions';
|
10
10
|
import StatusSelectorPopup from '../components/StatusSelectorPopup';
|
11
11
|
import { jobStatusOptions, getJobStatusProps } from '../helper';
|
12
12
|
import { Services } from '../feature.config';
|
13
13
|
import { Colours, Helper, Components, Config } from '../core.config';
|
14
|
+
import { values } from '../values.config';
|
14
15
|
|
15
16
|
class RequestDetail extends Component {
|
16
17
|
constructor(props) {
|
@@ -24,14 +25,13 @@ class RequestDetail extends Component {
|
|
24
25
|
expectedDate: null,
|
25
26
|
expectedDateText: '',
|
26
27
|
seen: false,
|
27
|
-
showMore:
|
28
|
+
showMore: false,
|
28
29
|
showStatusPopup: false,
|
29
30
|
loading: false,
|
30
31
|
showFullscreenVideo: false,
|
31
32
|
currentVideoUrl: '',
|
32
33
|
galleryOpen: false,
|
33
34
|
showMessages: false,
|
34
|
-
assignees: [],
|
35
35
|
};
|
36
36
|
|
37
37
|
this.scrollView = React.createRef();
|
@@ -40,9 +40,7 @@ class RequestDetail extends Component {
|
|
40
40
|
}
|
41
41
|
|
42
42
|
componentDidMount() {
|
43
|
-
this.getJob();
|
44
43
|
this.updateJobState();
|
45
|
-
this.getAssignees();
|
46
44
|
}
|
47
45
|
|
48
46
|
componentDidUpdate(prevProps) {
|
@@ -51,38 +49,6 @@ class RequestDetail extends Component {
|
|
51
49
|
}
|
52
50
|
}
|
53
51
|
|
54
|
-
getJob = async () => {
|
55
|
-
console.log('getting job');
|
56
|
-
this.setState({ loading: true }, async () => {
|
57
|
-
try {
|
58
|
-
const res = await maintenanceActions.getJob(this.props.job.site, this.props.job.id);
|
59
|
-
this.props.jobAdded(res.data);
|
60
|
-
console.log('got the job');
|
61
|
-
} catch (error) {
|
62
|
-
console.log('getJob error', error.toString());
|
63
|
-
// check for 403 or 404 error
|
64
|
-
if (error.response.status === 403 || error.response.status === 404) {
|
65
|
-
this.setState({
|
66
|
-
forbidden: true,
|
67
|
-
});
|
68
|
-
}
|
69
|
-
console.log('getJob error', error);
|
70
|
-
} finally {
|
71
|
-
this.setState({ loading: false });
|
72
|
-
}
|
73
|
-
});
|
74
|
-
};
|
75
|
-
|
76
|
-
getAssignees = async () => {
|
77
|
-
if (!this.hasPermission()) return;
|
78
|
-
try {
|
79
|
-
const res = await maintenanceActions.getAssignees(this.props.user.site);
|
80
|
-
this.setState({ assignees: res.data.Users });
|
81
|
-
} catch (error) {
|
82
|
-
console.log('getAssignees error', error);
|
83
|
-
}
|
84
|
-
};
|
85
|
-
|
86
52
|
updateJobState() {
|
87
53
|
const job = _.find(this.props.jobs, j => j.id === this.props.job.id) || this.props.job;
|
88
54
|
const newState = { job, status: job.status };
|
@@ -108,7 +74,7 @@ class RequestDetail extends Component {
|
|
108
74
|
this.setState({ loading: true }, async () => {
|
109
75
|
try {
|
110
76
|
const updated = { id: job.id, seen: true, status: job.status || 'Unassigned' };
|
111
|
-
const res = await
|
77
|
+
const res = await generalActions.editJob(updated, user.site);
|
112
78
|
// console.log('markSeen updated');
|
113
79
|
this.props.jobAdded(res.data.job);
|
114
80
|
this.setState({ loading: false, seen: true });
|
@@ -130,7 +96,7 @@ class RequestDetail extends Component {
|
|
130
96
|
.utc()
|
131
97
|
.toISOString();
|
132
98
|
}
|
133
|
-
const res = await
|
99
|
+
const res = await generalActions.editJob(updated, user.site);
|
134
100
|
this.props.jobAdded(res.data.job);
|
135
101
|
} catch (error) {
|
136
102
|
console.log('updateJob error', error);
|
@@ -143,7 +109,7 @@ class RequestDetail extends Component {
|
|
143
109
|
updateJobStatus = () => {
|
144
110
|
this.setState({ loading: true }, async () => {
|
145
111
|
try {
|
146
|
-
const res = await
|
112
|
+
const res = await generalActions.editJobStatus(this.props.job.id, this.state.status);
|
147
113
|
this.props.jobAdded(res.data.job);
|
148
114
|
} catch (error) {
|
149
115
|
console.log('updateJobStatus error', error);
|
@@ -172,7 +138,7 @@ class RequestDetail extends Component {
|
|
172
138
|
};
|
173
139
|
|
174
140
|
openStaffNotes = () => {
|
175
|
-
Services.navigation.navigate(
|
141
|
+
Services.navigation.navigate(values.screenRequestNotes, { job: this.state.job });
|
176
142
|
};
|
177
143
|
|
178
144
|
onOpenDatePicker = () => {
|
@@ -216,7 +182,7 @@ class RequestDetail extends Component {
|
|
216
182
|
onCommentAdded = () => {
|
217
183
|
this.setState({ loading: true }, async () => {
|
218
184
|
try {
|
219
|
-
const job = await
|
185
|
+
const job = await generalActions.getJob(this.props.user.site, this.props.job.id);
|
220
186
|
// console.log('onCommentAdded', job?.data);
|
221
187
|
this.props.jobAdded(job.data);
|
222
188
|
} catch (error) {
|
@@ -228,15 +194,8 @@ class RequestDetail extends Component {
|
|
228
194
|
};
|
229
195
|
|
230
196
|
hasPermission = () => {
|
231
|
-
const { job } = this.state;
|
232
197
|
const { permissions } = this.props.user;
|
233
|
-
|
234
|
-
return true;
|
235
|
-
}
|
236
|
-
if (_.includes(permissions, 'maintenanceAssignment')) {
|
237
|
-
return job.AssigneeId === this.props.user.Id;
|
238
|
-
}
|
239
|
-
return false;
|
198
|
+
return _.includes(permissions, values.permissionMaintenanceTracking);
|
240
199
|
};
|
241
200
|
|
242
201
|
toggleFullscreenVideo = url => {
|
@@ -257,32 +216,6 @@ class RequestDetail extends Component {
|
|
257
216
|
});
|
258
217
|
}
|
259
218
|
|
260
|
-
onOpenAssigneePicker = () => {
|
261
|
-
const options = this.state.assignees.map(a => {
|
262
|
-
return { key: a.id, name: a.displayName };
|
263
|
-
});
|
264
|
-
Services.navigation.navigate('optionSelector', {
|
265
|
-
options,
|
266
|
-
selection: this.state.job.AssigneeId,
|
267
|
-
title: 'Assign request',
|
268
|
-
onSelect: this.onSelectAssignee,
|
269
|
-
});
|
270
|
-
};
|
271
|
-
|
272
|
-
onSelectAssignee = assignee => {
|
273
|
-
this.setState({ loading: true }, async () => {
|
274
|
-
try {
|
275
|
-
console.log('onSelectAssignee', this.props.job.id, assignee.key);
|
276
|
-
const res = await maintenanceActions.assignJob(this.props.job.id, assignee.key);
|
277
|
-
this.props.jobAdded(res.data.job);
|
278
|
-
} catch (error) {
|
279
|
-
console.log('onSelectAssignee error', error);
|
280
|
-
} finally {
|
281
|
-
this.setState({ loading: false });
|
282
|
-
}
|
283
|
-
});
|
284
|
-
};
|
285
|
-
|
286
219
|
renderLoading() {
|
287
220
|
return <Components.LoadingIndicator visible={this.state.loading} />;
|
288
221
|
}
|
@@ -317,7 +250,7 @@ class RequestDetail extends Component {
|
|
317
250
|
</View>
|
318
251
|
</View>
|
319
252
|
)}
|
320
|
-
|
253
|
+
<View style={styles.textSectionInner}>
|
321
254
|
<Text style={styles.textSectionLabel}>Expected Date</Text>
|
322
255
|
<TouchableOpacity onPress={this.onOpenDatePicker}>
|
323
256
|
<View style={styles.textSectionTextContainer}>
|
@@ -329,13 +262,14 @@ class RequestDetail extends Component {
|
|
329
262
|
/>
|
330
263
|
</View>
|
331
264
|
</TouchableOpacity>
|
332
|
-
</View>
|
265
|
+
</View>
|
333
266
|
</View>
|
334
267
|
<View style={styles.jobStatusExpectedContainer}>
|
335
268
|
<View style={styles.jobStatusOuterContainer}>
|
336
269
|
<Text style={styles.jobStatusHeading}>STATUS</Text>
|
337
270
|
<TouchableOpacity onPress={canEdit ? this.onOpenStatusPicker : null}>
|
338
271
|
<View style={[styles.jobStatusContainer, { backgroundColor: statusColor }]}>
|
272
|
+
<Icon name="wrench" type="font-awesome" iconStyle={styles.jobStatusIcon} />
|
339
273
|
<Text style={styles.jobStatusText}>{statusText}</Text>
|
340
274
|
</View>
|
341
275
|
</TouchableOpacity>
|
@@ -416,42 +350,6 @@ class RequestDetail extends Component {
|
|
416
350
|
);
|
417
351
|
}
|
418
352
|
|
419
|
-
renderAssignee() {
|
420
|
-
const { job } = this.state;
|
421
|
-
if (!this.hasPermission() && !job.Assignee) return null;
|
422
|
-
|
423
|
-
const content = (
|
424
|
-
<View>
|
425
|
-
<Text style={styles.locationLabel}>Assigned To</Text>
|
426
|
-
<View>
|
427
|
-
{job.Assignee && (
|
428
|
-
<View style={styles.profileContainer}>
|
429
|
-
<Components.ProfilePic ProfilePic={job.Assignee.profilePic} Diameter={40} />
|
430
|
-
<View style={styles.nameContainer}>
|
431
|
-
<Text style={styles.nameText}>{job.Assignee.displayName}</Text>
|
432
|
-
</View>
|
433
|
-
</View>
|
434
|
-
)}
|
435
|
-
</View>
|
436
|
-
</View>
|
437
|
-
);
|
438
|
-
|
439
|
-
if (this.hasPermission()) {
|
440
|
-
return (
|
441
|
-
<Components.FormCardSectionOptionLauncher
|
442
|
-
onPress={this.onOpenAssigneePicker}
|
443
|
-
title="Assigned To"
|
444
|
-
value={job.Assignee ? job.Assignee.displayName : 'Unassigned'}
|
445
|
-
textStyle={styles.detailsText}
|
446
|
-
sectionStyle={styles.detailsSection}
|
447
|
-
>
|
448
|
-
{content}
|
449
|
-
</Components.FormCardSectionOptionLauncher>
|
450
|
-
);
|
451
|
-
}
|
452
|
-
return content;
|
453
|
-
}
|
454
|
-
|
455
353
|
rendeDetails() {
|
456
354
|
const { job } = this.state;
|
457
355
|
|
@@ -501,8 +399,8 @@ class RequestDetail extends Component {
|
|
501
399
|
ref={this.commentSection}
|
502
400
|
commentReply={this.commentReply}
|
503
401
|
scrollView={this.scrollView}
|
504
|
-
adminPermission=
|
505
|
-
entityType=
|
402
|
+
adminPermission={values.permissionMaintenanceTracking}
|
403
|
+
entityType={values.featureKey}
|
506
404
|
entityId={this.props.job.id}
|
507
405
|
entityName={this.props.job.title}
|
508
406
|
site={this.state.job.site || this.state.job.location}
|
@@ -539,7 +437,7 @@ class RequestDetail extends Component {
|
|
539
437
|
ref={this.commentReply}
|
540
438
|
commentSection={this.commentSection}
|
541
439
|
scrollView={this.scrollView}
|
542
|
-
entityType=
|
440
|
+
entityType={values.featureKey}
|
543
441
|
entityId={this.props.job.id}
|
544
442
|
entityName={this.props.job.title}
|
545
443
|
site={this.state.job.site || this.state.job.location}
|
@@ -555,9 +453,6 @@ class RequestDetail extends Component {
|
|
555
453
|
}
|
556
454
|
|
557
455
|
render() {
|
558
|
-
if (this.state.forbidden) {
|
559
|
-
return <Components.Forbidden />;
|
560
|
-
}
|
561
456
|
return (
|
562
457
|
<KeyboardAvoidingView behavior={Platform.OS === 'ios' && 'padding'} style={styles.container}>
|
563
458
|
<Components.Header leftIcon="angle-left" onPressLeft={this.onPressBack} text={Config.env.strings.MAINTENANCE_REQUEST_DETAILS} />
|
@@ -565,7 +460,6 @@ class RequestDetail extends Component {
|
|
565
460
|
<ScrollView ref={this.scrollView} contentContainerStyle={{ paddingBottom: 26 }} style={{ height: '100%' }}>
|
566
461
|
<View style={styles.innerContainer}>
|
567
462
|
{this.renderTop()}
|
568
|
-
{this.renderAssignee()}
|
569
463
|
{this.rendeDetails()}
|
570
464
|
{this.renderMessages()}
|
571
465
|
</View>
|
@@ -827,7 +721,7 @@ const mapStateToProps = state => {
|
|
827
721
|
return {
|
828
722
|
user: state.user,
|
829
723
|
colourBrandingMain: Colours.getMainBrandingColourFromState(state),
|
830
|
-
jobs: state.
|
724
|
+
jobs: state[values.reducerKey].jobs,
|
831
725
|
};
|
832
726
|
};
|
833
727
|
|
@@ -5,10 +5,11 @@ import { Icon } from 'react-native-elements';
|
|
5
5
|
import _ from 'lodash';
|
6
6
|
import moment from 'moment';
|
7
7
|
import { jobAdded } from '../actions';
|
8
|
-
import {
|
8
|
+
import { generalActions } from '../apis';
|
9
9
|
import { getBottomSpace } from 'react-native-iphone-x-helper';
|
10
10
|
import { Services } from '../feature.config';
|
11
11
|
import { Components, Colours, Helper } from '../core.config';
|
12
|
+
import { values } from '../values.config';
|
12
13
|
|
13
14
|
class RequestNotes extends Component {
|
14
15
|
constructor(props) {
|
@@ -61,7 +62,7 @@ class RequestNotes extends Component {
|
|
61
62
|
};
|
62
63
|
|
63
64
|
onPressConfirmDelete = () => {
|
64
|
-
|
65
|
+
generalActions.deleteNote(this.props.job.id, this.state.noteToDelete.Id);
|
65
66
|
const newNotes = _.filter(this.state.job.Notes, note => {
|
66
67
|
return note.Id !== this.state.noteToDelete.Id;
|
67
68
|
});
|
@@ -126,7 +127,7 @@ class RequestNotes extends Component {
|
|
126
127
|
try {
|
127
128
|
this.setState({ submittingNote: true });
|
128
129
|
const res = await (this.state.editingNote
|
129
|
-
?
|
130
|
+
? generalActions.editNote(
|
130
131
|
this.props.job.id,
|
131
132
|
this.state.editingNote,
|
132
133
|
this.state.noteInput,
|
@@ -137,7 +138,7 @@ class RequestNotes extends Component {
|
|
137
138
|
};
|
138
139
|
}),
|
139
140
|
)
|
140
|
-
:
|
141
|
+
: generalActions.addNote(
|
141
142
|
this.props.job.id,
|
142
143
|
this.state.noteInput,
|
143
144
|
this.state.noteAttachments.map(a => {
|
@@ -408,7 +409,7 @@ const mapStateToProps = state => {
|
|
408
409
|
user: state.user,
|
409
410
|
colourBrandingMain: Colours.getMainBrandingColourFromState(state),
|
410
411
|
colourBrandingLight: Colours.getLightBrandingColourFromState(state),
|
411
|
-
jobs: state.
|
412
|
+
jobs: state[values.reducerKey].jobs,
|
412
413
|
};
|
413
414
|
};
|
414
415
|
|
@@ -16,9 +16,10 @@ import _ from 'lodash';
|
|
16
16
|
import { Icon } from 'react-native-elements';
|
17
17
|
import { connect } from 'react-redux';
|
18
18
|
import { jobAdded } from '../actions';
|
19
|
-
import {
|
19
|
+
import { generalActions } from '../apis';
|
20
20
|
import { Services } from '../feature.config';
|
21
21
|
import { Components, Colours, Helper, Config } from '../core.config';
|
22
|
+
import { values } from '../values.config';
|
22
23
|
|
23
24
|
const PHOTO_SIZE = (Dimensions.get('window').width - 64) / 3;
|
24
25
|
|
@@ -143,7 +144,7 @@ class MaintenanceRequest extends Component {
|
|
143
144
|
}
|
144
145
|
|
145
146
|
onPressType() {
|
146
|
-
Services.navigation.navigate(
|
147
|
+
Services.navigation.navigate(values.screenJobTypePicker, {
|
147
148
|
currentType: this.state.type,
|
148
149
|
types: this.state.types,
|
149
150
|
onSelectType: this.pickType.bind(this),
|
@@ -179,7 +180,7 @@ class MaintenanceRequest extends Component {
|
|
179
180
|
|
180
181
|
getJobTypes() {
|
181
182
|
const self = this;
|
182
|
-
|
183
|
+
generalActions
|
183
184
|
.getJobTypes(Helper.getSite(this.props.site))
|
184
185
|
.then(res => {
|
185
186
|
self.setState({
|
@@ -227,7 +228,7 @@ class MaintenanceRequest extends Component {
|
|
227
228
|
return img.url;
|
228
229
|
});
|
229
230
|
|
230
|
-
|
231
|
+
generalActions
|
231
232
|
.sendMaintenanceRequest(
|
232
233
|
this.props.uid,
|
233
234
|
this.state.userName,
|
@@ -268,7 +269,7 @@ class MaintenanceRequest extends Component {
|
|
268
269
|
|
269
270
|
refreshRequest = async id => {
|
270
271
|
try {
|
271
|
-
const job = await
|
272
|
+
const job = await generalActions.getJob(Helper.getSite(this.props.site), id);
|
272
273
|
// console.log('refreshRequest', job?.data);
|
273
274
|
this.props.jobAdded(job.data);
|
274
275
|
} catch (error) {
|
@@ -614,7 +615,7 @@ class MaintenanceRequest extends Component {
|
|
614
615
|
<Components.Header
|
615
616
|
leftIcon="angle-left"
|
616
617
|
onPressLeft={this.onPressBack.bind(this)}
|
617
|
-
text={
|
618
|
+
text={this.props.strings[`${values.featureKey}_textFeatureTitle`] || values.textFeatureTitle}
|
618
619
|
rightText={this.state.submitting || this.state.success ? null : 'Done'}
|
619
620
|
onPressRight={this.submitRequest.bind(this)}
|
620
621
|
absoluteRight
|
@@ -740,6 +741,7 @@ const mapStateToProps = state => {
|
|
740
741
|
unit,
|
741
742
|
phoneNumber,
|
742
743
|
colourBrandingMain: Colours.getMainBrandingColourFromState(state),
|
744
|
+
strings: state.strings?.config || {},
|
743
745
|
};
|
744
746
|
};
|
745
747
|
|