@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,23 +1,60 @@
|
|
1
|
-
function _defineProperty(
|
2
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i :
|
1
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
2
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
3
3
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
4
4
|
import React, { Component } from 'react';
|
5
5
|
import { ScrollView, View, StyleSheet, Text, KeyboardAvoidingView, TouchableOpacity, ImageBackground, Platform } from 'react-native';
|
6
6
|
import DateTimePicker from 'react-native-modal-datetime-picker';
|
7
|
-
import { Icon } from '
|
7
|
+
import { Icon } from '@rneui/themed';
|
8
8
|
import _ from 'lodash';
|
9
9
|
import moment from 'moment';
|
10
10
|
import { connect } from 'react-redux';
|
11
|
-
import {
|
12
|
-
import { jobAdded } from '../actions';
|
11
|
+
import { maintenanceActions } from '../apis';
|
12
|
+
import { jobAdded, jobStatusesUpdate, jobHideSeenUpdate } from '../actions';
|
13
13
|
import StatusSelectorPopup from '../components/StatusSelectorPopup';
|
14
|
-
import
|
14
|
+
import PrioritySelectorPopup from '../components/PrioritySelectorPopup';
|
15
|
+
import { getJobStatus, getJobPriority } from '../helper';
|
15
16
|
import { Services } from '../feature.config';
|
16
17
|
import { Colours, Helper, Components, Config } from '../core.config';
|
17
18
|
import { values } from '../values.config';
|
18
19
|
class RequestDetail extends Component {
|
19
20
|
constructor(props) {
|
20
21
|
super(props);
|
22
|
+
_defineProperty(this, "getJob", async () => {
|
23
|
+
this.setState({
|
24
|
+
loading: true
|
25
|
+
}, async () => {
|
26
|
+
try {
|
27
|
+
const res = await maintenanceActions.getJob(this.props.job.site, this.props.job.id);
|
28
|
+
// console.log('getJob', JSON.stringify(res.data, null, 2));
|
29
|
+
this.props.jobAdded(res.data);
|
30
|
+
this.updateJobState(res.data);
|
31
|
+
} catch (error) {
|
32
|
+
console.log('getJob error', error.toString());
|
33
|
+
// check for 403 or 404 error
|
34
|
+
if (error.response.status === 403 || error.response.status === 404) {
|
35
|
+
this.setState({
|
36
|
+
forbidden: true
|
37
|
+
});
|
38
|
+
}
|
39
|
+
console.log('getJob error', error);
|
40
|
+
} finally {
|
41
|
+
this.setState({
|
42
|
+
loading: false
|
43
|
+
});
|
44
|
+
}
|
45
|
+
});
|
46
|
+
});
|
47
|
+
_defineProperty(this, "getAssignees", async () => {
|
48
|
+
if (!this.hasPermission()) return;
|
49
|
+
try {
|
50
|
+
const res = await maintenanceActions.getAssignees(this.props.user.site);
|
51
|
+
this.setState({
|
52
|
+
assignees: res.data.Users
|
53
|
+
});
|
54
|
+
} catch (error) {
|
55
|
+
console.log('getAssignees error', error);
|
56
|
+
}
|
57
|
+
});
|
21
58
|
_defineProperty(this, "markSeen", () => {
|
22
59
|
const {
|
23
60
|
user
|
@@ -39,9 +76,10 @@ class RequestDetail extends Component {
|
|
39
76
|
seen: true,
|
40
77
|
status: job.status || 'Unassigned'
|
41
78
|
};
|
42
|
-
const res = await
|
79
|
+
const res = await maintenanceActions.editJob(updated, user.site);
|
43
80
|
// console.log('markSeen updated');
|
44
81
|
this.props.jobAdded(res.data.job);
|
82
|
+
this.getJob();
|
45
83
|
this.setState({
|
46
84
|
loading: false,
|
47
85
|
seen: true
|
@@ -71,8 +109,9 @@ class RequestDetail extends Component {
|
|
71
109
|
if (this.state.expectedDate) {
|
72
110
|
updated.expectedDate = moment(this.state.expectedDate).utc().toISOString();
|
73
111
|
}
|
74
|
-
const res = await
|
112
|
+
const res = await maintenanceActions.editJob(updated, user.site);
|
75
113
|
this.props.jobAdded(res.data.job);
|
114
|
+
this.getJob();
|
76
115
|
} catch (error) {
|
77
116
|
console.log('updateJob error', error);
|
78
117
|
} finally {
|
@@ -87,8 +126,9 @@ class RequestDetail extends Component {
|
|
87
126
|
loading: true
|
88
127
|
}, async () => {
|
89
128
|
try {
|
90
|
-
const res = await
|
129
|
+
const res = await maintenanceActions.editJobStatus(this.props.job.id, this.state.status);
|
91
130
|
this.props.jobAdded(res.data.job);
|
131
|
+
this.getJob();
|
92
132
|
} catch (error) {
|
93
133
|
console.log('updateJobStatus error', error);
|
94
134
|
} finally {
|
@@ -98,6 +138,23 @@ class RequestDetail extends Component {
|
|
98
138
|
}
|
99
139
|
});
|
100
140
|
});
|
141
|
+
_defineProperty(this, "updateJobPriority", () => {
|
142
|
+
this.setState({
|
143
|
+
loading: true
|
144
|
+
}, async () => {
|
145
|
+
try {
|
146
|
+
const res = await maintenanceActions.editJobPriority(this.props.job.id, this.state.priority);
|
147
|
+
this.props.jobAdded(res.data.job);
|
148
|
+
this.getJob();
|
149
|
+
} catch (error) {
|
150
|
+
console.log('updateJobPriority error', error);
|
151
|
+
} finally {
|
152
|
+
this.setState({
|
153
|
+
loading: false
|
154
|
+
});
|
155
|
+
}
|
156
|
+
});
|
157
|
+
});
|
101
158
|
_defineProperty(this, "onPressBack", () => {
|
102
159
|
Services.navigation.goBack();
|
103
160
|
});
|
@@ -112,6 +169,7 @@ class RequestDetail extends Component {
|
|
112
169
|
});
|
113
170
|
});
|
114
171
|
_defineProperty(this, "onSelectStatus", status => {
|
172
|
+
if (this.state.loading) return;
|
115
173
|
this.setState({
|
116
174
|
status,
|
117
175
|
showStatusPopup: false
|
@@ -119,9 +177,29 @@ class RequestDetail extends Component {
|
|
119
177
|
this.updateJobStatus();
|
120
178
|
});
|
121
179
|
});
|
180
|
+
_defineProperty(this, "onOpenPriorityPicker", () => {
|
181
|
+
this.setState({
|
182
|
+
showPriorityPopup: true
|
183
|
+
});
|
184
|
+
});
|
185
|
+
_defineProperty(this, "onClosePriorityPopup", () => {
|
186
|
+
this.setState({
|
187
|
+
showPriorityPopup: false
|
188
|
+
});
|
189
|
+
});
|
190
|
+
_defineProperty(this, "onSelectPriority", priority => {
|
191
|
+
if (this.state.loading) return;
|
192
|
+
this.setState({
|
193
|
+
priority,
|
194
|
+
showPriorityPopup: false
|
195
|
+
}, () => {
|
196
|
+
this.updateJobPriority();
|
197
|
+
});
|
198
|
+
});
|
122
199
|
_defineProperty(this, "openStaffNotes", () => {
|
123
200
|
Services.navigation.navigate(values.screenRequestNotes, {
|
124
|
-
job: this.state.job
|
201
|
+
job: this.state.job,
|
202
|
+
onChange: this.getJob
|
125
203
|
});
|
126
204
|
});
|
127
205
|
_defineProperty(this, "onOpenDatePicker", () => {
|
@@ -169,9 +247,10 @@ class RequestDetail extends Component {
|
|
169
247
|
loading: true
|
170
248
|
}, async () => {
|
171
249
|
try {
|
172
|
-
const job = await
|
250
|
+
const job = await maintenanceActions.getJob(this.props.user.site, this.props.job.id);
|
173
251
|
// console.log('onCommentAdded', job?.data);
|
174
252
|
this.props.jobAdded(job.data);
|
253
|
+
this.getJob();
|
175
254
|
} catch (error) {
|
176
255
|
console.log('onCommentAdded error', error);
|
177
256
|
} finally {
|
@@ -182,10 +261,19 @@ class RequestDetail extends Component {
|
|
182
261
|
});
|
183
262
|
});
|
184
263
|
_defineProperty(this, "hasPermission", () => {
|
264
|
+
const {
|
265
|
+
job
|
266
|
+
} = this.state;
|
185
267
|
const {
|
186
268
|
permissions
|
187
269
|
} = this.props.user;
|
188
|
-
|
270
|
+
if (_.includes(permissions, values.permissionMaintenanceTracking)) {
|
271
|
+
return true;
|
272
|
+
}
|
273
|
+
if (_.includes(permissions, values.permissionMaintenanceAssignment)) {
|
274
|
+
return job.AssigneeId === this.props.user.Id;
|
275
|
+
}
|
276
|
+
return false;
|
189
277
|
});
|
190
278
|
_defineProperty(this, "toggleFullscreenVideo", url => {
|
191
279
|
if (typeof url !== 'string') url = '';
|
@@ -194,36 +282,75 @@ class RequestDetail extends Component {
|
|
194
282
|
currentVideoUrl: url
|
195
283
|
});
|
196
284
|
});
|
285
|
+
_defineProperty(this, "onOpenAssigneePicker", () => {
|
286
|
+
const options = this.state.assignees.map(a => {
|
287
|
+
return {
|
288
|
+
key: a.id,
|
289
|
+
name: a.displayName
|
290
|
+
};
|
291
|
+
});
|
292
|
+
Services.navigation.navigate('optionSelector', {
|
293
|
+
options,
|
294
|
+
selection: this.state.job.AssigneeId,
|
295
|
+
title: 'Assign request',
|
296
|
+
onSelect: this.onSelectAssignee
|
297
|
+
});
|
298
|
+
});
|
299
|
+
_defineProperty(this, "onSelectAssignee", assignee => {
|
300
|
+
this.setState({
|
301
|
+
loading: true
|
302
|
+
}, async () => {
|
303
|
+
try {
|
304
|
+
console.log('onSelectAssignee', this.props.job.id, assignee.key);
|
305
|
+
const res = await maintenanceActions.assignJob(this.props.job.id, assignee.key);
|
306
|
+
this.props.jobAdded(res.data.job);
|
307
|
+
this.getJob();
|
308
|
+
} catch (error) {
|
309
|
+
console.log('onSelectAssignee error', error);
|
310
|
+
} finally {
|
311
|
+
this.setState({
|
312
|
+
loading: false
|
313
|
+
});
|
314
|
+
}
|
315
|
+
});
|
316
|
+
});
|
197
317
|
this.state = {
|
198
318
|
job: {},
|
199
319
|
isDateTimePickerVisible: false,
|
200
320
|
popUpType: '',
|
201
321
|
status: '',
|
322
|
+
priority: '',
|
202
323
|
expectedDate: null,
|
203
324
|
expectedDateText: '',
|
204
325
|
seen: false,
|
205
|
-
showMore:
|
326
|
+
showMore: true,
|
206
327
|
showStatusPopup: false,
|
328
|
+
showPriorityPopup: false,
|
207
329
|
loading: false,
|
208
330
|
showFullscreenVideo: false,
|
209
331
|
currentVideoUrl: '',
|
210
332
|
galleryOpen: false,
|
211
|
-
|
333
|
+
galleryImages: [],
|
334
|
+
showMessages: false,
|
335
|
+
assignees: []
|
212
336
|
};
|
213
337
|
this.scrollView = /*#__PURE__*/React.createRef();
|
214
338
|
this.commentReply = /*#__PURE__*/React.createRef();
|
215
339
|
this.commentSection = /*#__PURE__*/React.createRef();
|
216
340
|
}
|
217
341
|
componentDidMount() {
|
218
|
-
this.
|
342
|
+
this.props.jobStatusesUpdate(this.props.job.site);
|
343
|
+
this.props.jobHideSeenUpdate(this.props.job.site);
|
344
|
+
this.getJob();
|
345
|
+
this.updateJobState(this.props.job);
|
346
|
+
this.getAssignees();
|
219
347
|
}
|
220
|
-
|
221
|
-
|
222
|
-
|
348
|
+
updateJobState(defaultJob) {
|
349
|
+
const job = _.find(this.props.jobs, j => j.id === this.props.job.id) || defaultJob;
|
350
|
+
if (!job) {
|
351
|
+
this.getJob();
|
352
|
+
return;
|
223
353
|
}
|
224
|
-
}
|
225
|
-
updateJobState() {
|
226
|
-
const job = _.find(this.props.jobs, j => j.id === this.props.job.id) || this.props.job;
|
227
354
|
const newState = {
|
228
355
|
job,
|
229
356
|
status: job.status
|
@@ -237,9 +364,10 @@ class RequestDetail extends Component {
|
|
237
364
|
this.markSeen();
|
238
365
|
});
|
239
366
|
}
|
240
|
-
openGallery(index) {
|
367
|
+
openGallery(galleryImages, index) {
|
241
368
|
this.setState({
|
242
|
-
galleryOpen: true
|
369
|
+
galleryOpen: true,
|
370
|
+
galleryImages
|
243
371
|
});
|
244
372
|
this.refs.imagePopup.scrollTo(index);
|
245
373
|
}
|
@@ -258,19 +386,22 @@ class RequestDetail extends Component {
|
|
258
386
|
status,
|
259
387
|
job
|
260
388
|
} = this.state;
|
261
|
-
const
|
262
|
-
|
263
|
-
statusColor
|
264
|
-
} = getJobStatusProps(status);
|
389
|
+
const statusOption = getJobStatus(status, this.props);
|
390
|
+
const priority = getJobPriority(job.priority);
|
265
391
|
const canEdit = this.hasPermission();
|
266
|
-
const
|
392
|
+
const isStaff = this.props.user.category === 'staff';
|
393
|
+
const showSeen = !status || status === getJobStatus(null, this.props).text;
|
267
394
|
return /*#__PURE__*/React.createElement(View, {
|
268
395
|
style: {
|
269
396
|
...Helper.getShadowStyle()
|
270
397
|
}
|
271
398
|
}, /*#__PURE__*/React.createElement(View, {
|
272
399
|
style: styles.jobTitleContainer
|
273
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
400
|
+
}, job.jobId ? /*#__PURE__*/React.createElement(Text, {
|
401
|
+
style: [styles.jobIdText, {
|
402
|
+
color: this.props.colourBrandingMain
|
403
|
+
}]
|
404
|
+
}, `${values.textEntityName} #${job.jobId}`) : null, /*#__PURE__*/React.createElement(Text, {
|
274
405
|
style: styles.jobTitleText
|
275
406
|
}, job.title), /*#__PURE__*/React.createElement(View, {
|
276
407
|
style: styles.jobTypeSeenContainer
|
@@ -281,8 +412,9 @@ class RequestDetail extends Component {
|
|
281
412
|
}, /*#__PURE__*/React.createElement(Text, {
|
282
413
|
style: [styles.jobTypeText, {
|
283
414
|
color: this.props.colourBrandingMain
|
284
|
-
}]
|
285
|
-
|
415
|
+
}],
|
416
|
+
numberOfLines: 2
|
417
|
+
}, job.type)), !this.props.hideSeen && showSeen && this.state.seen && /*#__PURE__*/React.createElement(View, {
|
286
418
|
style: styles.jobSeenContainer
|
287
419
|
}, /*#__PURE__*/React.createElement(Icon, {
|
288
420
|
name: "check",
|
@@ -302,23 +434,9 @@ class RequestDetail extends Component {
|
|
302
434
|
style: styles.textSectionTextContainer
|
303
435
|
}, /*#__PURE__*/React.createElement(Text, {
|
304
436
|
style: styles.textSectionText
|
305
|
-
}, moment(job.lastActivityUnix).format('ddd D MMMM, h:mm A')))), /*#__PURE__*/React.createElement(View, {
|
306
|
-
style: styles.
|
307
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
308
|
-
style: styles.textSectionLabel
|
309
|
-
}, "Expected Date"), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
310
|
-
onPress: this.onOpenDatePicker
|
437
|
+
}, moment(job.lastActivityUnix).format('ddd D MMMM, h:mm A'))))), /*#__PURE__*/React.createElement(View, {
|
438
|
+
style: styles.jobInfoContainer
|
311
439
|
}, /*#__PURE__*/React.createElement(View, {
|
312
|
-
style: styles.textSectionTextContainer
|
313
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
314
|
-
style: styles.textSectionText
|
315
|
-
}, this.state.expectedDateText || 'Select Date'), /*#__PURE__*/React.createElement(Icon, {
|
316
|
-
name: "angle-right",
|
317
|
-
type: "font-awesome",
|
318
|
-
iconStyle: [styles.textSectionAngleRight, {
|
319
|
-
color: this.props.colourBrandingMain
|
320
|
-
}]
|
321
|
-
}))))), /*#__PURE__*/React.createElement(View, {
|
322
440
|
style: styles.jobStatusExpectedContainer
|
323
441
|
}, /*#__PURE__*/React.createElement(View, {
|
324
442
|
style: styles.jobStatusOuterContainer
|
@@ -328,15 +446,11 @@ class RequestDetail extends Component {
|
|
328
446
|
onPress: canEdit ? this.onOpenStatusPicker : null
|
329
447
|
}, /*#__PURE__*/React.createElement(View, {
|
330
448
|
style: [styles.jobStatusContainer, {
|
331
|
-
backgroundColor:
|
449
|
+
backgroundColor: statusOption.color
|
332
450
|
}]
|
333
|
-
}, /*#__PURE__*/React.createElement(
|
334
|
-
name: "wrench",
|
335
|
-
type: "font-awesome",
|
336
|
-
iconStyle: styles.jobStatusIcon
|
337
|
-
}), /*#__PURE__*/React.createElement(Text, {
|
451
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
338
452
|
style: styles.jobStatusText
|
339
|
-
},
|
453
|
+
}, statusOption === null || statusOption === void 0 ? void 0 : statusOption.text)))), this.hasPermission() && /*#__PURE__*/React.createElement(View, {
|
340
454
|
style: styles.jobStatusOuterContainer
|
341
455
|
}, /*#__PURE__*/React.createElement(Text, {
|
342
456
|
style: styles.jobStatusHeading
|
@@ -352,9 +466,22 @@ class RequestDetail extends Component {
|
|
352
466
|
iconStyle: styles.jobStatusIcon
|
353
467
|
}), /*#__PURE__*/React.createElement(Text, {
|
354
468
|
style: styles.jobStatusText
|
355
|
-
}, "Notes (", (job.Notes || []).length, ")")))))
|
469
|
+
}, "Notes (", (job.Notes || []).length, ")"))))), isStaff && /*#__PURE__*/React.createElement(View, {
|
470
|
+
style: styles.jobPriorityOuterContainer
|
471
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
472
|
+
style: styles.jobStatusHeading
|
473
|
+
}, "PRIORITY"), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
474
|
+
onPress: canEdit ? this.onOpenPriorityPicker : null
|
475
|
+
}, /*#__PURE__*/React.createElement(View, {
|
476
|
+
style: [styles.jobStatusContainer, {
|
477
|
+
backgroundColor: priority.color
|
478
|
+
}]
|
479
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
480
|
+
style: styles.jobStatusText
|
481
|
+
}, priority.label))))));
|
356
482
|
}
|
357
|
-
renderPlayableImageUrl(
|
483
|
+
renderPlayableImageUrl(images, index, containerStyle, showMore) {
|
484
|
+
const url = images[index || 0];
|
358
485
|
const thumbUrl = Helper.getThumb300(url);
|
359
486
|
if (Helper.isVideo(url)) {
|
360
487
|
return /*#__PURE__*/React.createElement(ImageBackground, {
|
@@ -377,7 +504,7 @@ class RequestDetail extends Component {
|
|
377
504
|
const imageUrl = Helper.get1400(url);
|
378
505
|
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
379
506
|
style: containerStyle,
|
380
|
-
onPress: this.openGallery.bind(this, index || 0)
|
507
|
+
onPress: this.openGallery.bind(this, images, index || 0)
|
381
508
|
}, /*#__PURE__*/React.createElement(ImageBackground, {
|
382
509
|
style: styles.imageContainer,
|
383
510
|
source: {
|
@@ -387,57 +514,132 @@ class RequestDetail extends Component {
|
|
387
514
|
style: styles.plusImages
|
388
515
|
}, "+", this.state.job.images.length - 2)));
|
389
516
|
}
|
390
|
-
renderPlayableImage(index, containerStyle, showMore) {
|
391
|
-
|
392
|
-
return this.renderPlayableImageUrl(url, index, containerStyle, showMore);
|
517
|
+
renderPlayableImage(images, index, containerStyle, showMore) {
|
518
|
+
return this.renderPlayableImageUrl(images, index, containerStyle, showMore);
|
393
519
|
}
|
394
|
-
renderImage() {
|
395
|
-
|
396
|
-
|
397
|
-
} = this.state;
|
398
|
-
if (!_.isNil(job.images) && !_.isEmpty(job.images)) {
|
399
|
-
if (job.images.length >= 2) {
|
520
|
+
renderImage(images, image = null) {
|
521
|
+
if (!_.isNil(images) && !_.isEmpty(images)) {
|
522
|
+
if (images.length >= 2) {
|
400
523
|
return /*#__PURE__*/React.createElement(View, {
|
401
524
|
style: styles.sideBySideImages
|
402
|
-
}, this.renderPlayableImage(0, styles.sideBySideImageContainer), this.renderPlayableImage(1, styles.sideBySideImageContainer,
|
525
|
+
}, this.renderPlayableImage(images, 0, styles.sideBySideImageContainer), this.renderPlayableImage(images, 1, styles.sideBySideImageContainer, images.length > 2));
|
403
526
|
} else {
|
404
527
|
return /*#__PURE__*/React.createElement(View, {
|
405
528
|
style: styles.singleImageContainer
|
406
|
-
}, this.renderPlayableImage(0));
|
529
|
+
}, this.renderPlayableImage(images, 0));
|
407
530
|
}
|
408
|
-
} else if (!_.isNil(
|
531
|
+
} else if (!_.isNil(image)) {
|
409
532
|
return /*#__PURE__*/React.createElement(View, {
|
410
533
|
style: styles.singleImageContainer
|
411
|
-
}, this.renderPlayableImageUrl(
|
534
|
+
}, this.renderPlayableImageUrl([image], 0));
|
412
535
|
}
|
413
536
|
return null;
|
414
537
|
}
|
415
538
|
renderImagePopup() {
|
416
539
|
return /*#__PURE__*/React.createElement(Components.ImagePopup, {
|
417
540
|
visible: this.state.galleryOpen,
|
418
|
-
images: this.state.
|
541
|
+
images: this.state.galleryImages,
|
419
542
|
onClose: this.closeGallery.bind(this),
|
420
543
|
ref: "imagePopup"
|
421
544
|
});
|
422
545
|
}
|
546
|
+
renderAssignee() {
|
547
|
+
const {
|
548
|
+
job
|
549
|
+
} = this.state;
|
550
|
+
if (!this.hasPermission() && !job.Assignee) return null;
|
551
|
+
const content = /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(Text, {
|
552
|
+
style: styles.locationLabel
|
553
|
+
}, "Assigned To"), /*#__PURE__*/React.createElement(View, null, job.Assignee && /*#__PURE__*/React.createElement(View, {
|
554
|
+
style: styles.profileContainer
|
555
|
+
}, /*#__PURE__*/React.createElement(Components.ProfilePic, {
|
556
|
+
ProfilePic: job.Assignee.profilePic,
|
557
|
+
Diameter: 40
|
558
|
+
}), /*#__PURE__*/React.createElement(View, {
|
559
|
+
style: styles.nameContainer
|
560
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
561
|
+
style: styles.nameText
|
562
|
+
}, job.Assignee.displayName)))));
|
563
|
+
if (this.hasPermission()) {
|
564
|
+
return /*#__PURE__*/React.createElement(Components.FormCardSectionOptionLauncher, {
|
565
|
+
onPress: this.onOpenAssigneePicker,
|
566
|
+
title: "Assigned To",
|
567
|
+
value: job.Assignee ? job.Assignee.displayName : 'Unassigned',
|
568
|
+
textStyle: styles.detailsText,
|
569
|
+
sectionStyle: styles.detailsSection
|
570
|
+
}, content);
|
571
|
+
}
|
572
|
+
return content;
|
573
|
+
}
|
574
|
+
renderCustomFields() {
|
575
|
+
const {
|
576
|
+
job
|
577
|
+
} = this.state;
|
578
|
+
const {
|
579
|
+
customFields
|
580
|
+
} = job;
|
581
|
+
const renderAnswer = field => {
|
582
|
+
switch (field.type) {
|
583
|
+
case 'date':
|
584
|
+
return /*#__PURE__*/React.createElement(Text, {
|
585
|
+
style: styles.customText
|
586
|
+
}, field.answer ? moment(field.answer, 'YYYY-MM-DD').format('DD MMM YYYY') : '');
|
587
|
+
case 'time':
|
588
|
+
return /*#__PURE__*/React.createElement(Text, {
|
589
|
+
style: styles.customText
|
590
|
+
}, field.answer ? moment(field.answer, 'HH:mm').format('h:mm a') : '');
|
591
|
+
case 'yn':
|
592
|
+
return /*#__PURE__*/React.createElement(Text, {
|
593
|
+
style: styles.customText
|
594
|
+
}, field.answer ? 'Yes' : 'No');
|
595
|
+
case 'checkbox':
|
596
|
+
return /*#__PURE__*/React.createElement(Text, {
|
597
|
+
style: styles.customText
|
598
|
+
}, field.answer && Array.isArray(field.answer) ? field.answer.join(', ') : '');
|
599
|
+
case 'image':
|
600
|
+
return /*#__PURE__*/React.createElement(View, {
|
601
|
+
style: {
|
602
|
+
marginTop: 8
|
603
|
+
}
|
604
|
+
}, this.renderImage(field.answer));
|
605
|
+
default:
|
606
|
+
return /*#__PURE__*/React.createElement(Text, {
|
607
|
+
style: styles.customText
|
608
|
+
}, field.answer);
|
609
|
+
}
|
610
|
+
};
|
611
|
+
return customFields.map((field, index) => {
|
612
|
+
if (['staticTitle', 'staticText'].includes(field.type)) return null;
|
613
|
+
if (_.isNil(field.answer) || field.answer === '' || Array.isArray(field.answer) && field.answer.length === 0) return null;
|
614
|
+
return /*#__PURE__*/React.createElement(View, {
|
615
|
+
key: index
|
616
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
617
|
+
style: styles.customLabel
|
618
|
+
}, field.label), renderAnswer(field));
|
619
|
+
});
|
620
|
+
}
|
423
621
|
rendeDetails() {
|
424
622
|
const {
|
425
623
|
job
|
426
624
|
} = this.state;
|
625
|
+
const {
|
626
|
+
customFields
|
627
|
+
} = job;
|
628
|
+
const hasCustomFields = customFields && customFields.length > 0;
|
427
629
|
return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(Components.FormCardSectionOptionLauncher, {
|
428
630
|
onPress: this.onToggleDetails,
|
429
631
|
title: "Details",
|
430
632
|
icon: this.state.showMore ? 'angle-up' : 'angle-down',
|
431
633
|
textStyle: styles.detailsText,
|
432
634
|
sectionStyle: styles.detailsSection
|
433
|
-
}), this.state.showMore && /*#__PURE__*/React.createElement(View, null, this.renderImage(), !_.isEmpty(job.description) && /*#__PURE__*/React.createElement(Text, {
|
635
|
+
}), this.state.showMore && /*#__PURE__*/React.createElement(View, null, hasCustomFields ? this.renderCustomFields() : null, !hasCustomFields ? /*#__PURE__*/React.createElement(React.Fragment, null, this.renderImage(job.images, job.image), !_.isEmpty(job.description) && /*#__PURE__*/React.createElement(Text, {
|
434
636
|
numberOfLines: 10,
|
435
637
|
style: styles.jobDescriptionText
|
436
|
-
}, job.description), /*#__PURE__*/React.createElement(Text, {
|
638
|
+
}, job.description)) : null, /*#__PURE__*/React.createElement(Text, {
|
437
639
|
style: styles.locationLabel
|
438
|
-
}, "
|
640
|
+
}, "Address"), /*#__PURE__*/React.createElement(Text, {
|
439
641
|
style: styles.locationText
|
440
|
-
}, job.room), job.isHome ? /*#__PURE__*/React.createElement(View, {
|
642
|
+
}, job.room), !hasCustomFields && job.isHome ? /*#__PURE__*/React.createElement(View, {
|
441
643
|
style: styles.detailsSection
|
442
644
|
}, /*#__PURE__*/React.createElement(Text, {
|
443
645
|
style: styles.locationLabel
|
@@ -445,7 +647,7 @@ class RequestDetail extends Component {
|
|
445
647
|
style: styles.locationText
|
446
648
|
}, job.homeText)) : null, /*#__PURE__*/React.createElement(Text, {
|
447
649
|
style: styles.requesterLabel
|
448
|
-
}, "
|
650
|
+
}, "Submitted By"), /*#__PURE__*/React.createElement(View, {
|
449
651
|
style: styles.profileContainer
|
450
652
|
}, /*#__PURE__*/React.createElement(Components.ProfilePic, {
|
451
653
|
ProfilePic: job.userProfilePic,
|
@@ -464,7 +666,7 @@ class RequestDetail extends Component {
|
|
464
666
|
commentReply: this.commentReply,
|
465
667
|
scrollView: this.scrollView,
|
466
668
|
adminPermission: values.permissionMaintenanceTracking,
|
467
|
-
entityType: values.
|
669
|
+
entityType: values.commentKey,
|
468
670
|
entityId: this.props.job.id,
|
469
671
|
entityName: this.props.job.title,
|
470
672
|
site: this.state.job.site || this.state.job.location,
|
@@ -501,7 +703,7 @@ class RequestDetail extends Component {
|
|
501
703
|
ref: this.commentReply,
|
502
704
|
commentSection: this.commentSection,
|
503
705
|
scrollView: this.scrollView,
|
504
|
-
entityType: values.
|
706
|
+
entityType: values.commentKey,
|
505
707
|
entityId: this.props.job.id,
|
506
708
|
entityName: this.props.job.title,
|
507
709
|
site: this.state.job.site || this.state.job.location
|
@@ -516,7 +718,17 @@ class RequestDetail extends Component {
|
|
516
718
|
onSelect: this.onSelectStatus
|
517
719
|
});
|
518
720
|
}
|
721
|
+
renderPriorityPopup() {
|
722
|
+
if (!this.state.showPriorityPopup) return null;
|
723
|
+
return /*#__PURE__*/React.createElement(PrioritySelectorPopup, {
|
724
|
+
onClose: this.onClosePriorityPopup,
|
725
|
+
onSelect: this.onSelectPriority
|
726
|
+
});
|
727
|
+
}
|
519
728
|
render() {
|
729
|
+
if (this.state.forbidden) {
|
730
|
+
return /*#__PURE__*/React.createElement(Components.Forbidden, null);
|
731
|
+
}
|
520
732
|
return /*#__PURE__*/React.createElement(KeyboardAvoidingView, {
|
521
733
|
behavior: Platform.OS === 'ios' && 'padding',
|
522
734
|
style: styles.container
|
@@ -534,7 +746,7 @@ class RequestDetail extends Component {
|
|
534
746
|
}
|
535
747
|
}, /*#__PURE__*/React.createElement(View, {
|
536
748
|
style: styles.innerContainer
|
537
|
-
}, this.renderTop(), this.rendeDetails(), this.renderMessages())), this.renderMessagesReply(), this.renderStatusPopup(), this.renderImagePopup(), /*#__PURE__*/React.createElement(DateTimePicker, {
|
749
|
+
}, this.renderTop(), this.renderAssignee(), this.rendeDetails(), this.renderMessages())), this.renderMessagesReply(), this.renderStatusPopup(), this.renderPriorityPopup(), this.renderImagePopup(), /*#__PURE__*/React.createElement(DateTimePicker, {
|
538
750
|
isVisible: this.state.isDateTimePickerVisible,
|
539
751
|
onConfirm: this.onDateSelected,
|
540
752
|
onCancel: this.onCloseDatePicker,
|
@@ -556,6 +768,11 @@ const styles = StyleSheet.create({
|
|
556
768
|
paddingVertical: 14,
|
557
769
|
paddingHorizontal: 12
|
558
770
|
},
|
771
|
+
jobIdText: {
|
772
|
+
fontFamily: 'sf-medium',
|
773
|
+
fontSize: 12,
|
774
|
+
marginBottom: 4
|
775
|
+
},
|
559
776
|
jobTitleText: {
|
560
777
|
fontFamily: 'sf-semibold',
|
561
778
|
fontSize: 20,
|
@@ -567,15 +784,17 @@ const styles = StyleSheet.create({
|
|
567
784
|
alignItems: 'center'
|
568
785
|
},
|
569
786
|
jobTypeContainer: {
|
570
|
-
|
571
|
-
|
787
|
+
padding: 4,
|
788
|
+
minWidth: 80,
|
789
|
+
maxWidth: 140,
|
572
790
|
borderRadius: 4,
|
573
791
|
justifyContent: 'center'
|
574
792
|
},
|
575
793
|
jobTypeText: {
|
576
794
|
fontFamily: 'sf-semibold',
|
577
795
|
fontSize: 12,
|
578
|
-
textAlign: 'center'
|
796
|
+
textAlign: 'center',
|
797
|
+
maxWidth: '100%'
|
579
798
|
},
|
580
799
|
jobSeenContainer: {
|
581
800
|
flexDirection: 'row',
|
@@ -596,15 +815,17 @@ const styles = StyleSheet.create({
|
|
596
815
|
fontSize: 13,
|
597
816
|
color: Colours.TEXT_LIGHT
|
598
817
|
},
|
599
|
-
|
600
|
-
flexDirection: 'row',
|
601
|
-
alignItems: 'flex-start',
|
602
|
-
justifyContent: 'space-between',
|
818
|
+
jobInfoContainer: {
|
603
819
|
borderTopWidth: 1,
|
604
820
|
borderTopColor: Colours.LINEGREY,
|
605
821
|
paddingVertical: 14,
|
606
822
|
paddingHorizontal: 12
|
607
823
|
},
|
824
|
+
jobStatusExpectedContainer: {
|
825
|
+
flexDirection: 'row',
|
826
|
+
alignItems: 'flex-start',
|
827
|
+
justifyContent: 'space-between'
|
828
|
+
},
|
608
829
|
jobStatusOuterContainer: {
|
609
830
|
// marginRight: 50,
|
610
831
|
},
|
@@ -636,6 +857,9 @@ const styles = StyleSheet.create({
|
|
636
857
|
flex: 1,
|
637
858
|
textAlign: 'center'
|
638
859
|
},
|
860
|
+
jobPriorityOuterContainer: {
|
861
|
+
marginTop: 12
|
862
|
+
},
|
639
863
|
jobExpectedDateContainer: {
|
640
864
|
backgroundColor: Colours.BOXGREY,
|
641
865
|
flexDirection: 'row',
|
@@ -784,16 +1008,44 @@ const styles = StyleSheet.create({
|
|
784
1008
|
fontSize: 24,
|
785
1009
|
marginLeft: 10,
|
786
1010
|
lineHeight: 24
|
1011
|
+
},
|
1012
|
+
customLabel: {
|
1013
|
+
fontFamily: 'sf-bold',
|
1014
|
+
fontSize: 14,
|
1015
|
+
color: Colours.TEXT_DARKEST
|
1016
|
+
},
|
1017
|
+
customText: {
|
1018
|
+
fontFamily: 'sf-regular',
|
1019
|
+
fontSize: 16,
|
1020
|
+
color: Colours.TEXT_DARKEST,
|
1021
|
+
paddingVertical: 8
|
1022
|
+
},
|
1023
|
+
customStaticTitle: {
|
1024
|
+
fontSize: 20,
|
1025
|
+
fontFamily: 'sf-semibold',
|
1026
|
+
color: Colours.TEXT_DARKEST,
|
1027
|
+
marginBottom: 10
|
1028
|
+
},
|
1029
|
+
customStaticText: {
|
1030
|
+
fontSize: 17,
|
1031
|
+
fontFamily: 'sf-regular',
|
1032
|
+
color: Colours.TEXT_DARKEST,
|
1033
|
+
lineHeight: 24,
|
1034
|
+
marginBottom: 10
|
787
1035
|
}
|
788
1036
|
});
|
789
1037
|
const mapStateToProps = state => {
|
790
1038
|
return {
|
791
1039
|
user: state.user,
|
792
1040
|
colourBrandingMain: Colours.getMainBrandingColourFromState(state),
|
793
|
-
jobs: state[values.reducerKey].jobs
|
1041
|
+
jobs: state[values.reducerKey].jobs,
|
1042
|
+
statusTypes: state[values.reducerKey].jobstatuses,
|
1043
|
+
hideSeen: state[values.reducerKey].hideSeen
|
794
1044
|
};
|
795
1045
|
};
|
796
1046
|
export default connect(mapStateToProps, {
|
797
|
-
jobAdded
|
1047
|
+
jobAdded,
|
1048
|
+
jobStatusesUpdate,
|
1049
|
+
jobHideSeenUpdate
|
798
1050
|
})(RequestDetail);
|
799
1051
|
//# sourceMappingURL=RequestDetail.js.map
|