@plusscommunities/pluss-maintenance-app 6.0.4-auth.0 → 6.0.5-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/apis/index.js +1 -1
- package/dist/module/apis/index.js.map +1 -1
- package/dist/module/apis/{generalActions.js → maintenanceActions.js} +22 -39
- package/dist/module/apis/maintenanceActions.js.map +1 -0
- package/dist/module/components/FilterPopupMenu.js +46 -10
- package/dist/module/components/FilterPopupMenu.js.map +1 -1
- package/dist/module/components/MaintenanceList.js +47 -13
- package/dist/module/components/MaintenanceList.js.map +1 -1
- package/dist/module/components/MaintenanceListItem.js +5 -9
- package/dist/module/components/MaintenanceListItem.js.map +1 -1
- package/dist/module/components/MaintenanceWidgetItem.js +1 -5
- package/dist/module/components/MaintenanceWidgetItem.js.map +1 -1
- package/dist/module/components/StatusSelectorPopup.js +2 -1
- package/dist/module/components/StatusSelectorPopup.js.map +1 -1
- package/dist/module/components/WidgetSmall.js +2 -2
- package/dist/module/components/WidgetSmall.js.map +1 -1
- package/dist/module/helper.js +10 -2
- package/dist/module/helper.js.map +1 -1
- package/dist/module/screens/RequestDetail.js +122 -32
- package/dist/module/screens/RequestDetail.js.map +1 -1
- package/dist/module/screens/RequestNotes.js +4 -4
- package/dist/module/screens/RequestNotes.js.map +1 -1
- package/dist/module/screens/ServiceRequest.js +4 -4
- package/dist/module/screens/ServiceRequest.js.map +1 -1
- package/package.json +2 -2
- package/src/apis/index.js +1 -1
- package/src/apis/{generalActions.js → maintenanceActions.js} +19 -38
- package/src/components/FilterPopupMenu.js +39 -7
- package/src/components/MaintenanceList.js +56 -16
- package/src/components/MaintenanceListItem.js +5 -5
- package/src/components/MaintenanceWidgetItem.js +1 -1
- package/src/components/StatusSelectorPopup.js +2 -1
- package/src/components/WidgetSmall.js +2 -2
- package/src/helper.js +11 -2
- package/src/screens/RequestDetail.js +118 -11
- package/src/screens/RequestNotes.js +4 -4
- package/src/screens/ServiceRequest.js +4 -4
- package/dist/module/apis/generalActions.js.map +0 -1
@@ -63,7 +63,7 @@ class MaintenanceListItem extends Component {
|
|
63
63
|
const { job } = this.props;
|
64
64
|
const createdTime = moment(job.createdUnix);
|
65
65
|
const createdTimeText = `${createdTime.format('ddd, D MMMM')} • ${createdTime.format('h:mma')}`;
|
66
|
-
const
|
66
|
+
const assigneeText = job.Assignee ? `Assigned to\n${job.Assignee.displayName}` : '';
|
67
67
|
const { statusText, statusColor } = getJobStatusProps(job.status);
|
68
68
|
|
69
69
|
return (
|
@@ -92,14 +92,14 @@ class MaintenanceListItem extends Component {
|
|
92
92
|
<Text style={styles.jobCreatedText}>{createdTimeText}</Text>
|
93
93
|
<View style={styles.jobActivityContainer}>
|
94
94
|
<View style={[styles.jobStatusContainer, { backgroundColor: statusColor }]}>
|
95
|
-
<Icon name="wrench" type="font-awesome" iconStyle={styles.jobStatusIcon} />
|
95
|
+
{/* <Icon name="wrench" type="font-awesome" iconStyle={styles.jobStatusIcon} /> */}
|
96
96
|
<Text style={styles.jobStatusText}>{statusText}</Text>
|
97
97
|
</View>
|
98
98
|
<View style={[styles.jobStatusLine, { borderColor: statusColor }]}>
|
99
99
|
<View style={styles.jobStatusLineMask} />
|
100
100
|
</View>
|
101
101
|
<View style={[styles.jobStatusCircle, { backgroundColor: statusColor }]} />
|
102
|
-
<Text style={styles.jobStatusDateText}>{
|
102
|
+
<Text style={styles.jobStatusDateText}>{assigneeText}</Text>
|
103
103
|
</View>
|
104
104
|
</View>
|
105
105
|
</View>
|
@@ -227,7 +227,7 @@ const styles = StyleSheet.create({
|
|
227
227
|
jobStatusContainer: {
|
228
228
|
flexDirection: 'row',
|
229
229
|
alignItems: 'center',
|
230
|
-
justifyContent: '
|
230
|
+
justifyContent: 'center',
|
231
231
|
width: 105,
|
232
232
|
height: 30,
|
233
233
|
paddingHorizontal: 8,
|
@@ -265,7 +265,7 @@ const styles = StyleSheet.create({
|
|
265
265
|
jobStatusDateText: {
|
266
266
|
flex: 1,
|
267
267
|
textAlign: 'right',
|
268
|
-
fontFamily: 'sf-
|
268
|
+
fontFamily: 'sf-medium',
|
269
269
|
fontSize: 14,
|
270
270
|
color: Colours.TEXT_DARK,
|
271
271
|
},
|
@@ -43,7 +43,7 @@ class MaintenanceWidgetItem extends Component {
|
|
43
43
|
</View>
|
44
44
|
<View style={styles.jobBottomSection}>
|
45
45
|
<View style={[styles.jobStatusContainer, { backgroundColor: statusColor }]}>
|
46
|
-
<Icon name="wrench" type="font-awesome" iconStyle={styles.jobStatusIcon} />
|
46
|
+
{/* <Icon name="wrench" type="font-awesome" iconStyle={styles.jobStatusIcon} /> */}
|
47
47
|
<Text style={styles.jobStatusText}>{statusText}</Text>
|
48
48
|
</View>
|
49
49
|
</View>
|
@@ -11,6 +11,7 @@ class StatusSelectorPopup extends PureComponent {
|
|
11
11
|
? filter.map(status => {
|
12
12
|
return {
|
13
13
|
name: status,
|
14
|
+
label: getJobStatusLabel(status),
|
14
15
|
color: getJobStatusColour(status),
|
15
16
|
};
|
16
17
|
})
|
@@ -32,7 +33,7 @@ class StatusSelectorPopup extends PureComponent {
|
|
32
33
|
return (
|
33
34
|
<TouchableOpacity key={status.name} onPress={() => onSelect(status.name)}>
|
34
35
|
<View style={[styles.jobStatusContainer, { backgroundColor: status.color }]}>
|
35
|
-
<Text style={styles.jobStatusText}>{status.
|
36
|
+
<Text style={styles.jobStatusText}>{status.label}</Text>
|
36
37
|
</View>
|
37
38
|
</TouchableOpacity>
|
38
39
|
);
|
@@ -2,7 +2,7 @@ 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 { maintenanceActions } from '../apis';
|
6
6
|
import { jobsLoaded } from '../actions';
|
7
7
|
import MaintenanceWidgetItem from './MaintenanceWidgetItem';
|
8
8
|
import { Services } from '../feature.config';
|
@@ -39,7 +39,7 @@ class WidgetSmall extends Component {
|
|
39
39
|
refresh = () => {
|
40
40
|
this.onLoadingChanged(true, async () => {
|
41
41
|
try {
|
42
|
-
const res = await
|
42
|
+
const res = await maintenanceActions.getJobsRecursive(this.props.site);
|
43
43
|
// console.log('WidgetSmall - refresh', res.data);
|
44
44
|
this.props.jobsLoaded(res);
|
45
45
|
} catch (error) {
|
package/src/helper.js
CHANGED
@@ -1,16 +1,20 @@
|
|
1
|
+
import { label } from 'aws-amplify';
|
1
2
|
import { Colours } from './core.config';
|
2
3
|
|
3
4
|
const jobStatusOptions = [
|
4
5
|
{
|
5
6
|
name: 'Unassigned',
|
7
|
+
label: 'Open',
|
6
8
|
color: Colours.LINEGREY,
|
7
9
|
},
|
8
10
|
{
|
9
11
|
name: 'In Progress',
|
12
|
+
label: 'In Progress',
|
10
13
|
color: Colours.COLOUR_TEAL,
|
11
14
|
},
|
12
15
|
{
|
13
16
|
name: 'Completed',
|
17
|
+
label: 'Completed',
|
14
18
|
color: Colours.COLOUR_GREEN_LIGHT,
|
15
19
|
},
|
16
20
|
];
|
@@ -20,11 +24,16 @@ const getJobStatusColour = status => {
|
|
20
24
|
return option ? option.color : jobStatusOptions[0].color;
|
21
25
|
};
|
22
26
|
|
27
|
+
const getJobStatusLabel = status => {
|
28
|
+
const option = jobStatusOptions.find(item => item.name === status);
|
29
|
+
return option ? option.label : jobStatusOptions[0].label;
|
30
|
+
};
|
31
|
+
|
23
32
|
const getJobStatusProps = status => {
|
24
|
-
const statusText = status || jobStatusOptions[0].
|
33
|
+
const statusText = getJobStatusLabel(status) || jobStatusOptions[0].label;
|
25
34
|
const statusColor = getJobStatusColour(statusText);
|
26
35
|
|
27
36
|
return { statusText, statusColor };
|
28
37
|
};
|
29
38
|
|
30
|
-
export { jobStatusOptions, getJobStatusColour, getJobStatusProps };
|
39
|
+
export { jobStatusOptions, getJobStatusColour, getJobStatusProps, getJobStatusLabel };
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import React, { Component } from 'react';
|
2
|
-
import { ScrollView, View, StyleSheet, Text, KeyboardAvoidingView, TouchableOpacity, ImageBackground } from 'react-native';
|
2
|
+
import { ScrollView, View, StyleSheet, Text, KeyboardAvoidingView, TouchableOpacity, ImageBackground, Platform } from 'react-native';
|
3
3
|
import DateTimePicker from 'react-native-modal-datetime-picker';
|
4
4
|
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 { maintenanceActions } from '../apis';
|
9
9
|
import { jobAdded } from '../actions';
|
10
10
|
import StatusSelectorPopup from '../components/StatusSelectorPopup';
|
11
11
|
import { jobStatusOptions, getJobStatusProps } from '../helper';
|
@@ -24,13 +24,14 @@ class RequestDetail extends Component {
|
|
24
24
|
expectedDate: null,
|
25
25
|
expectedDateText: '',
|
26
26
|
seen: false,
|
27
|
-
showMore:
|
27
|
+
showMore: true,
|
28
28
|
showStatusPopup: false,
|
29
29
|
loading: false,
|
30
30
|
showFullscreenVideo: false,
|
31
31
|
currentVideoUrl: '',
|
32
32
|
galleryOpen: false,
|
33
33
|
showMessages: false,
|
34
|
+
assignees: [],
|
34
35
|
};
|
35
36
|
|
36
37
|
this.scrollView = React.createRef();
|
@@ -39,7 +40,9 @@ class RequestDetail extends Component {
|
|
39
40
|
}
|
40
41
|
|
41
42
|
componentDidMount() {
|
43
|
+
this.getJob();
|
42
44
|
this.updateJobState();
|
45
|
+
this.getAssignees();
|
43
46
|
}
|
44
47
|
|
45
48
|
componentDidUpdate(prevProps) {
|
@@ -48,6 +51,38 @@ class RequestDetail extends Component {
|
|
48
51
|
}
|
49
52
|
}
|
50
53
|
|
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
|
+
|
51
86
|
updateJobState() {
|
52
87
|
const job = _.find(this.props.jobs, j => j.id === this.props.job.id) || this.props.job;
|
53
88
|
const newState = { job, status: job.status };
|
@@ -73,7 +108,7 @@ class RequestDetail extends Component {
|
|
73
108
|
this.setState({ loading: true }, async () => {
|
74
109
|
try {
|
75
110
|
const updated = { id: job.id, seen: true, status: job.status || 'Unassigned' };
|
76
|
-
const res = await
|
111
|
+
const res = await maintenanceActions.editJob(updated, user.site);
|
77
112
|
// console.log('markSeen updated');
|
78
113
|
this.props.jobAdded(res.data.job);
|
79
114
|
this.setState({ loading: false, seen: true });
|
@@ -95,7 +130,7 @@ class RequestDetail extends Component {
|
|
95
130
|
.utc()
|
96
131
|
.toISOString();
|
97
132
|
}
|
98
|
-
const res = await
|
133
|
+
const res = await maintenanceActions.editJob(updated, user.site);
|
99
134
|
this.props.jobAdded(res.data.job);
|
100
135
|
} catch (error) {
|
101
136
|
console.log('updateJob error', error);
|
@@ -108,7 +143,7 @@ class RequestDetail extends Component {
|
|
108
143
|
updateJobStatus = () => {
|
109
144
|
this.setState({ loading: true }, async () => {
|
110
145
|
try {
|
111
|
-
const res = await
|
146
|
+
const res = await maintenanceActions.editJobStatus(this.props.job.id, this.state.status);
|
112
147
|
this.props.jobAdded(res.data.job);
|
113
148
|
} catch (error) {
|
114
149
|
console.log('updateJobStatus error', error);
|
@@ -181,7 +216,7 @@ class RequestDetail extends Component {
|
|
181
216
|
onCommentAdded = () => {
|
182
217
|
this.setState({ loading: true }, async () => {
|
183
218
|
try {
|
184
|
-
const job = await
|
219
|
+
const job = await maintenanceActions.getJob(this.props.user.site, this.props.job.id);
|
185
220
|
// console.log('onCommentAdded', job?.data);
|
186
221
|
this.props.jobAdded(job.data);
|
187
222
|
} catch (error) {
|
@@ -193,8 +228,15 @@ class RequestDetail extends Component {
|
|
193
228
|
};
|
194
229
|
|
195
230
|
hasPermission = () => {
|
231
|
+
const { job } = this.state;
|
196
232
|
const { permissions } = this.props.user;
|
197
|
-
|
233
|
+
if (_.includes(permissions, 'maintenanceTracking')) {
|
234
|
+
return true;
|
235
|
+
}
|
236
|
+
if (_.includes(permissions, 'maintenanceAssignment')) {
|
237
|
+
return job.AssigneeId === this.props.user.Id;
|
238
|
+
}
|
239
|
+
return false;
|
198
240
|
};
|
199
241
|
|
200
242
|
toggleFullscreenVideo = url => {
|
@@ -215,6 +257,32 @@ class RequestDetail extends Component {
|
|
215
257
|
});
|
216
258
|
}
|
217
259
|
|
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
|
+
|
218
286
|
renderLoading() {
|
219
287
|
return <Components.LoadingIndicator visible={this.state.loading} />;
|
220
288
|
}
|
@@ -249,7 +317,7 @@ class RequestDetail extends Component {
|
|
249
317
|
</View>
|
250
318
|
</View>
|
251
319
|
)}
|
252
|
-
<View style={styles.textSectionInner}>
|
320
|
+
{/* <View style={styles.textSectionInner}>
|
253
321
|
<Text style={styles.textSectionLabel}>Expected Date</Text>
|
254
322
|
<TouchableOpacity onPress={this.onOpenDatePicker}>
|
255
323
|
<View style={styles.textSectionTextContainer}>
|
@@ -261,14 +329,13 @@ class RequestDetail extends Component {
|
|
261
329
|
/>
|
262
330
|
</View>
|
263
331
|
</TouchableOpacity>
|
264
|
-
</View>
|
332
|
+
</View> */}
|
265
333
|
</View>
|
266
334
|
<View style={styles.jobStatusExpectedContainer}>
|
267
335
|
<View style={styles.jobStatusOuterContainer}>
|
268
336
|
<Text style={styles.jobStatusHeading}>STATUS</Text>
|
269
337
|
<TouchableOpacity onPress={canEdit ? this.onOpenStatusPicker : null}>
|
270
338
|
<View style={[styles.jobStatusContainer, { backgroundColor: statusColor }]}>
|
271
|
-
<Icon name="wrench" type="font-awesome" iconStyle={styles.jobStatusIcon} />
|
272
339
|
<Text style={styles.jobStatusText}>{statusText}</Text>
|
273
340
|
</View>
|
274
341
|
</TouchableOpacity>
|
@@ -349,6 +416,42 @@ class RequestDetail extends Component {
|
|
349
416
|
);
|
350
417
|
}
|
351
418
|
|
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
|
+
|
352
455
|
rendeDetails() {
|
353
456
|
const { job } = this.state;
|
354
457
|
|
@@ -452,6 +555,9 @@ class RequestDetail extends Component {
|
|
452
555
|
}
|
453
556
|
|
454
557
|
render() {
|
558
|
+
if (this.state.forbidden) {
|
559
|
+
return <Components.Forbidden />;
|
560
|
+
}
|
455
561
|
return (
|
456
562
|
<KeyboardAvoidingView behavior={Platform.OS === 'ios' && 'padding'} style={styles.container}>
|
457
563
|
<Components.Header leftIcon="angle-left" onPressLeft={this.onPressBack} text={Config.env.strings.MAINTENANCE_REQUEST_DETAILS} />
|
@@ -459,6 +565,7 @@ class RequestDetail extends Component {
|
|
459
565
|
<ScrollView ref={this.scrollView} contentContainerStyle={{ paddingBottom: 26 }} style={{ height: '100%' }}>
|
460
566
|
<View style={styles.innerContainer}>
|
461
567
|
{this.renderTop()}
|
568
|
+
{this.renderAssignee()}
|
462
569
|
{this.rendeDetails()}
|
463
570
|
{this.renderMessages()}
|
464
571
|
</View>
|
@@ -5,7 +5,7 @@ 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 { maintenanceActions } 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';
|
@@ -61,7 +61,7 @@ class RequestNotes extends Component {
|
|
61
61
|
};
|
62
62
|
|
63
63
|
onPressConfirmDelete = () => {
|
64
|
-
|
64
|
+
maintenanceActions.deleteNote(this.props.job.id, this.state.noteToDelete.Id);
|
65
65
|
const newNotes = _.filter(this.state.job.Notes, note => {
|
66
66
|
return note.Id !== this.state.noteToDelete.Id;
|
67
67
|
});
|
@@ -126,7 +126,7 @@ class RequestNotes extends Component {
|
|
126
126
|
try {
|
127
127
|
this.setState({ submittingNote: true });
|
128
128
|
const res = await (this.state.editingNote
|
129
|
-
?
|
129
|
+
? maintenanceActions.editNote(
|
130
130
|
this.props.job.id,
|
131
131
|
this.state.editingNote,
|
132
132
|
this.state.noteInput,
|
@@ -137,7 +137,7 @@ class RequestNotes extends Component {
|
|
137
137
|
};
|
138
138
|
}),
|
139
139
|
)
|
140
|
-
:
|
140
|
+
: maintenanceActions.addNote(
|
141
141
|
this.props.job.id,
|
142
142
|
this.state.noteInput,
|
143
143
|
this.state.noteAttachments.map(a => {
|
@@ -16,7 +16,7 @@ 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 { maintenanceActions } from '../apis';
|
20
20
|
import { Services } from '../feature.config';
|
21
21
|
import { Components, Colours, Helper, Config } from '../core.config';
|
22
22
|
|
@@ -179,7 +179,7 @@ class MaintenanceRequest extends Component {
|
|
179
179
|
|
180
180
|
getJobTypes() {
|
181
181
|
const self = this;
|
182
|
-
|
182
|
+
maintenanceActions
|
183
183
|
.getJobTypes(Helper.getSite(this.props.site))
|
184
184
|
.then(res => {
|
185
185
|
self.setState({
|
@@ -227,7 +227,7 @@ class MaintenanceRequest extends Component {
|
|
227
227
|
return img.url;
|
228
228
|
});
|
229
229
|
|
230
|
-
|
230
|
+
maintenanceActions
|
231
231
|
.sendMaintenanceRequest(
|
232
232
|
this.props.uid,
|
233
233
|
this.state.userName,
|
@@ -268,7 +268,7 @@ class MaintenanceRequest extends Component {
|
|
268
268
|
|
269
269
|
refreshRequest = async id => {
|
270
270
|
try {
|
271
|
-
const job = await
|
271
|
+
const job = await maintenanceActions.getJob(Helper.getSite(this.props.site), id);
|
272
272
|
// console.log('refreshRequest', job?.data);
|
273
273
|
this.props.jobAdded(job.data);
|
274
274
|
} catch (error) {
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["Helper","Session","generalActions","getJob","site","id","authedFunction","method","url","getUrl","data","getJobByJobId","jobId","getJobs","status","type","getJobs2","lastKey","query","JSON","stringify","getJobsRecursive","jobs","Promise","resolve","then","jobRes","newJobs","Items","LastKey","sendMaintenanceRequest","userID","userName","phone","room","title","description","date","images","location","isHome","homeText","request","editJob","job","editJobStatus","addNote","note","attachments","action","editNote","noteId","deleteNote","getJobTypes"],"sources":["generalActions.js"],"sourcesContent":["// import axios from 'axios';\n// import { getUrl } from './helper';\n// import { authedFunction } from '../js';\nimport { Helper, Session } from '../core.config';\n\nexport const generalActions = {\n getJob: (site, id) => {\n return Session.authedFunction({\n method: 'POST',\n url: Helper.getUrl('maintenance', 'getJob'),\n data: { site, id },\n });\n },\n getJobByJobId: (site, jobId) => {\n return Session.authedFunction({\n method: 'POST',\n url: Helper.getUrl('maintenance', 'getJob'),\n data: { site, jobId },\n });\n },\n getJobs: (site, status = '', type = '') => {\n return Session.authedFunction({\n method: 'POST',\n url: Helper.getUrl('maintenance', 'getJobs'),\n data: { site, status, type },\n });\n },\n getJobs2: (site, status, type, lastKey) => {\n const query = { site };\n if (status) {\n query.status = status;\n }\n if (type) {\n query.type = type;\n }\n if (lastKey) {\n query.lastKey = JSON.stringify(lastKey);\n }\n return Session.authedFunction({\n method: 'GET',\n url: Helper.getUrl('maintenance', 'get/requests', query),\n });\n },\n getJobsRecursive: (site, status, type, lastKey, jobs = []) => {\n return new Promise(resolve => {\n generalActions.getJobs2(site, status, type, lastKey).then(jobRes => {\n const newJobs = [...jobs, ...jobRes.data.Items];\n if (!jobRes.data.LastKey) {\n return resolve(newJobs);\n }\n return resolve(generalActions.getJobsRecursive(site, status, type, jobRes.data.LastKey, newJobs));\n });\n });\n },\n sendMaintenanceRequest: (userID, userName, phone, room, title, description, date, type, images, location, isHome, homeText) => {\n const request = {\n method: 'POST',\n url: Helper.getUrl('maintenance', 'sendMaintenance'),\n data: {\n userID,\n userName,\n phone,\n room,\n title,\n description,\n date,\n type,\n images,\n location,\n isHome,\n homeText,\n },\n };\n return Session.authedFunction(request);\n },\n editJob: (job, site) => {\n return Session.authedFunction({\n method: 'POST',\n url: Helper.getUrl('maintenance', 'editJob'),\n data: { job, site },\n });\n },\n editJobStatus: (id, status) => {\n return Session.authedFunction({\n method: 'POST',\n url: Helper.getUrl('maintenance', 'editJobStatus'),\n data: { id, status },\n });\n },\n addNote: (jobId, note, attachments) => {\n return Session.authedFunction({\n method: 'POST',\n url: Helper.getUrl('maintenance', 'requests/note'),\n data: {\n id: jobId,\n note,\n attachments,\n action: 'AddNote',\n },\n });\n },\n editNote: (jobId, noteId, note, attachments) => {\n return Session.authedFunction({\n method: 'POST',\n url: Helper.getUrl('maintenance', 'requests/note'),\n data: {\n id: jobId,\n note,\n attachments,\n noteId,\n action: 'EditNote',\n },\n });\n },\n deleteNote: (jobId, noteId) => {\n return Session.authedFunction({\n method: 'POST',\n url: Helper.getUrl('maintenance', 'requests/note'),\n data: {\n id: jobId,\n noteId,\n action: 'DeleteNote',\n },\n });\n },\n // getWeeklyMenu: async time => {\n // //deprecated\n // return null;\n // },\n getJobTypes: async site => {\n const url = Helper.getUrl('maintenance', 'getjobtypes');\n return Session.authedFunction({\n method: 'POST',\n url,\n data: { site },\n });\n },\n // sendBookingRequest: async bookingInfo => {\n // return authedFunction({\n // method: 'POST',\n // data: {\n // bookingInfo,\n // },\n // url: getUrl('utility', 'sendBookingRequest'),\n // });\n // },\n // getString: async (site, id, useDefault) => {\n // return axios({\n // method: 'GET',\n // url: getUrl('strings', `get/${site}_${id}`, useDefault ? { useDefault } : undefined),\n // }).catch(error => {\n // console.log('getString error', error);\n // throw error;\n // });\n // },\n // getGeneralTerms: async () => {\n // return axios({\n // method: 'GET',\n // url: 'https://pluss.plussapp.com.au/strings-prd/get/plussSpace_termsofuse',\n // });\n // },\n // declineTerms: async (site, userID) => {\n // //deprecated\n // return null;\n // },\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,OAAO,QAAQ,gBAAgB;AAEhD,OAAO,MAAMC,cAAc,GAAG;EAC5BC,MAAM,EAAEA,CAACC,IAAI,EAAEC,EAAE,KAAK;IACpB,OAAOJ,OAAO,CAACK,cAAc,CAAC;MAC5BC,MAAM,EAAE,MAAM;MACdC,GAAG,EAAER,MAAM,CAACS,MAAM,CAAC,aAAa,EAAE,QAAQ,CAAC;MAC3CC,IAAI,EAAE;QAAEN,IAAI;QAAEC;MAAG;IACnB,CAAC,CAAC;EACJ,CAAC;EACDM,aAAa,EAAEA,CAACP,IAAI,EAAEQ,KAAK,KAAK;IAC9B,OAAOX,OAAO,CAACK,cAAc,CAAC;MAC5BC,MAAM,EAAE,MAAM;MACdC,GAAG,EAAER,MAAM,CAACS,MAAM,CAAC,aAAa,EAAE,QAAQ,CAAC;MAC3CC,IAAI,EAAE;QAAEN,IAAI;QAAEQ;MAAM;IACtB,CAAC,CAAC;EACJ,CAAC;EACDC,OAAO,EAAEA,CAACT,IAAI,EAAEU,MAAM,GAAG,EAAE,EAAEC,IAAI,GAAG,EAAE,KAAK;IACzC,OAAOd,OAAO,CAACK,cAAc,CAAC;MAC5BC,MAAM,EAAE,MA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