@plusscommunities/pluss-maintenance-app 4.0.4-auth.0 → 6.0.0-auth.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module/actions/JobActions.js +20 -0
- package/dist/module/actions/JobActions.js.map +1 -0
- package/dist/module/actions/index.js +2 -0
- package/dist/module/actions/index.js.map +1 -0
- package/dist/module/actions/types.js +4 -0
- package/dist/module/actions/types.js.map +1 -0
- package/dist/module/apis/generalActions.js +186 -0
- package/dist/module/apis/generalActions.js.map +1 -0
- package/dist/module/apis/index.js +2 -0
- package/dist/module/apis/index.js.map +1 -0
- package/dist/module/components/FilterPopupMenu.js +235 -0
- package/dist/module/components/FilterPopupMenu.js.map +1 -0
- package/dist/module/components/MaintenanceList.js +325 -0
- package/dist/module/components/MaintenanceList.js.map +1 -0
- package/dist/module/components/MaintenanceListItem.js +322 -0
- package/dist/module/components/MaintenanceListItem.js.map +1 -0
- package/dist/module/components/MaintenanceWidgetItem.js +152 -0
- package/dist/module/components/MaintenanceWidgetItem.js.map +1 -0
- package/dist/module/components/StatusSelectorPopup.js +88 -0
- package/dist/module/components/StatusSelectorPopup.js.map +1 -0
- package/dist/module/components/WidgetLarge.js +9 -0
- package/dist/module/components/WidgetLarge.js.map +1 -0
- package/dist/module/components/WidgetSmall.js +168 -0
- package/dist/module/components/WidgetSmall.js.map +1 -0
- package/dist/module/core.config.js +17 -0
- package/dist/module/core.config.js.map +1 -0
- package/dist/module/feature.config.js +90 -0
- package/dist/module/feature.config.js.map +1 -0
- package/dist/module/helper.js +25 -0
- package/dist/module/helper.js.map +1 -0
- package/dist/module/images/speechbubble.png +0 -0
- package/dist/module/index.js +20 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/reducers/JobsReducer.js +62 -0
- package/dist/module/reducers/JobsReducer.js.map +1 -0
- package/dist/module/screens/JobTypePicker.js +130 -0
- package/dist/module/screens/JobTypePicker.js.map +1 -0
- package/dist/module/screens/MaintenancePage.js +88 -0
- package/dist/module/screens/MaintenancePage.js.map +1 -0
- package/dist/module/screens/RequestDetail.js +798 -0
- package/dist/module/screens/RequestDetail.js.map +1 -0
- package/dist/module/screens/RequestNotes.js +387 -0
- package/dist/module/screens/RequestNotes.js.map +1 -0
- package/dist/module/screens/ServiceRequest.js +748 -0
- package/dist/module/screens/ServiceRequest.js.map +1 -0
- package/package.json +7 -8
@@ -0,0 +1,798 @@
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
2
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
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
|
+
import React, { Component } from 'react';
|
5
|
+
import { ScrollView, View, StyleSheet, Text, KeyboardAvoidingView, TouchableOpacity, ImageBackground } from 'react-native';
|
6
|
+
import DateTimePicker from 'react-native-modal-datetime-picker';
|
7
|
+
import { Icon } from 'react-native-elements';
|
8
|
+
import _ from 'lodash';
|
9
|
+
import moment from 'moment';
|
10
|
+
import { connect } from 'react-redux';
|
11
|
+
import { generalActions } from '../apis';
|
12
|
+
import { jobAdded } from '../actions';
|
13
|
+
import StatusSelectorPopup from '../components/StatusSelectorPopup';
|
14
|
+
import { jobStatusOptions, getJobStatusProps } from '../helper';
|
15
|
+
import { Services } from '../feature.config';
|
16
|
+
import { Colours, Helper, Components, Config } from '../core.config';
|
17
|
+
class RequestDetail extends Component {
|
18
|
+
constructor(props) {
|
19
|
+
super(props);
|
20
|
+
_defineProperty(this, "markSeen", () => {
|
21
|
+
const {
|
22
|
+
user
|
23
|
+
} = this.props;
|
24
|
+
const {
|
25
|
+
job
|
26
|
+
} = this.state;
|
27
|
+
// Must have maintenance permission and not the requester
|
28
|
+
// console.log('markSeen check', job.userID, user.Id);
|
29
|
+
if (job.seen === true) return;
|
30
|
+
if (!this.hasPermission()) return;
|
31
|
+
if (user.Id === job.userID) return;
|
32
|
+
this.setState({
|
33
|
+
loading: true
|
34
|
+
}, async () => {
|
35
|
+
try {
|
36
|
+
const updated = {
|
37
|
+
id: job.id,
|
38
|
+
seen: true,
|
39
|
+
status: job.status || 'Unassigned'
|
40
|
+
};
|
41
|
+
const res = await generalActions.editJob(updated, user.site);
|
42
|
+
// console.log('markSeen updated');
|
43
|
+
this.props.jobAdded(res.data.job);
|
44
|
+
this.setState({
|
45
|
+
loading: false,
|
46
|
+
seen: true
|
47
|
+
});
|
48
|
+
} catch (error) {
|
49
|
+
console.log('markSeen error', error);
|
50
|
+
this.setState({
|
51
|
+
loading: false
|
52
|
+
});
|
53
|
+
}
|
54
|
+
});
|
55
|
+
});
|
56
|
+
_defineProperty(this, "updateJob", () => {
|
57
|
+
this.setState({
|
58
|
+
loading: true
|
59
|
+
}, async () => {
|
60
|
+
const {
|
61
|
+
user
|
62
|
+
} = this.props;
|
63
|
+
const {
|
64
|
+
job
|
65
|
+
} = this.state;
|
66
|
+
try {
|
67
|
+
const updated = {
|
68
|
+
id: job.id
|
69
|
+
};
|
70
|
+
if (this.state.expectedDate) {
|
71
|
+
updated.expectedDate = moment(this.state.expectedDate).utc().toISOString();
|
72
|
+
}
|
73
|
+
const res = await generalActions.editJob(updated, user.site);
|
74
|
+
this.props.jobAdded(res.data.job);
|
75
|
+
} catch (error) {
|
76
|
+
console.log('updateJob error', error);
|
77
|
+
} finally {
|
78
|
+
this.setState({
|
79
|
+
loading: false
|
80
|
+
});
|
81
|
+
}
|
82
|
+
});
|
83
|
+
});
|
84
|
+
_defineProperty(this, "updateJobStatus", () => {
|
85
|
+
this.setState({
|
86
|
+
loading: true
|
87
|
+
}, async () => {
|
88
|
+
try {
|
89
|
+
const res = await generalActions.editJobStatus(this.props.job.id, this.state.status);
|
90
|
+
this.props.jobAdded(res.data.job);
|
91
|
+
} catch (error) {
|
92
|
+
console.log('updateJobStatus error', error);
|
93
|
+
} finally {
|
94
|
+
this.setState({
|
95
|
+
loading: false
|
96
|
+
});
|
97
|
+
}
|
98
|
+
});
|
99
|
+
});
|
100
|
+
_defineProperty(this, "onPressBack", () => {
|
101
|
+
Services.navigation.goBack();
|
102
|
+
});
|
103
|
+
_defineProperty(this, "onOpenStatusPicker", () => {
|
104
|
+
this.setState({
|
105
|
+
showStatusPopup: true
|
106
|
+
});
|
107
|
+
});
|
108
|
+
_defineProperty(this, "onCloseStatusPopup", () => {
|
109
|
+
this.setState({
|
110
|
+
showStatusPopup: false
|
111
|
+
});
|
112
|
+
});
|
113
|
+
_defineProperty(this, "onSelectStatus", status => {
|
114
|
+
this.setState({
|
115
|
+
status,
|
116
|
+
showStatusPopup: false
|
117
|
+
}, () => {
|
118
|
+
this.updateJobStatus();
|
119
|
+
});
|
120
|
+
});
|
121
|
+
_defineProperty(this, "openStaffNotes", () => {
|
122
|
+
Services.navigation.navigate('requestNotes', {
|
123
|
+
job: this.state.job
|
124
|
+
});
|
125
|
+
});
|
126
|
+
_defineProperty(this, "onOpenDatePicker", () => {
|
127
|
+
this.setState({
|
128
|
+
popUpType: 'date',
|
129
|
+
isDateTimePickerVisible: true
|
130
|
+
});
|
131
|
+
});
|
132
|
+
_defineProperty(this, "onCloseDatePicker", () => {
|
133
|
+
this.setState({
|
134
|
+
isDateTimePickerVisible: false
|
135
|
+
});
|
136
|
+
});
|
137
|
+
_defineProperty(this, "onDateSelected", date => {
|
138
|
+
if (this.state.popUpType === 'date') {
|
139
|
+
date = moment(date);
|
140
|
+
this.setState({
|
141
|
+
expectedDate: date,
|
142
|
+
expectedDateText: date.format('DD/MM/YYYY'),
|
143
|
+
isDateTimePickerVisible: false
|
144
|
+
}, () => {
|
145
|
+
this.updateJob();
|
146
|
+
});
|
147
|
+
}
|
148
|
+
});
|
149
|
+
_defineProperty(this, "onToggleDetails", () => {
|
150
|
+
this.setState({
|
151
|
+
showMore: !this.state.showMore
|
152
|
+
});
|
153
|
+
});
|
154
|
+
_defineProperty(this, "onLeaveMessage", () => {
|
155
|
+
this.setState({
|
156
|
+
showMessages: true
|
157
|
+
});
|
158
|
+
});
|
159
|
+
_defineProperty(this, "onCommentsLoaded", count => {
|
160
|
+
if (count > 0) {
|
161
|
+
this.setState({
|
162
|
+
showMessages: true
|
163
|
+
});
|
164
|
+
}
|
165
|
+
});
|
166
|
+
_defineProperty(this, "onCommentAdded", () => {
|
167
|
+
this.setState({
|
168
|
+
loading: true
|
169
|
+
}, async () => {
|
170
|
+
try {
|
171
|
+
const job = await generalActions.getJob(this.props.user.site, this.props.job.id);
|
172
|
+
// console.log('onCommentAdded', job?.data);
|
173
|
+
this.props.jobAdded(job.data);
|
174
|
+
} catch (error) {
|
175
|
+
console.log('onCommentAdded error', error);
|
176
|
+
} finally {
|
177
|
+
this.setState({
|
178
|
+
loading: false
|
179
|
+
});
|
180
|
+
}
|
181
|
+
});
|
182
|
+
});
|
183
|
+
_defineProperty(this, "hasPermission", () => {
|
184
|
+
const {
|
185
|
+
permissions
|
186
|
+
} = this.props.user;
|
187
|
+
return _.includes(permissions, 'maintenanceTracking');
|
188
|
+
});
|
189
|
+
_defineProperty(this, "toggleFullscreenVideo", url => {
|
190
|
+
if (typeof url !== 'string') url = '';
|
191
|
+
this.setState({
|
192
|
+
showFullscreenVideo: url.length > 0,
|
193
|
+
currentVideoUrl: url
|
194
|
+
});
|
195
|
+
});
|
196
|
+
this.state = {
|
197
|
+
job: {},
|
198
|
+
isDateTimePickerVisible: false,
|
199
|
+
popUpType: '',
|
200
|
+
status: '',
|
201
|
+
expectedDate: null,
|
202
|
+
expectedDateText: '',
|
203
|
+
seen: false,
|
204
|
+
showMore: false,
|
205
|
+
showStatusPopup: false,
|
206
|
+
loading: false,
|
207
|
+
showFullscreenVideo: false,
|
208
|
+
currentVideoUrl: '',
|
209
|
+
galleryOpen: false,
|
210
|
+
showMessages: false
|
211
|
+
};
|
212
|
+
this.scrollView = /*#__PURE__*/React.createRef();
|
213
|
+
this.commentReply = /*#__PURE__*/React.createRef();
|
214
|
+
this.commentSection = /*#__PURE__*/React.createRef();
|
215
|
+
}
|
216
|
+
componentDidMount() {
|
217
|
+
this.updateJobState();
|
218
|
+
}
|
219
|
+
componentDidUpdate(prevProps) {
|
220
|
+
if (prevProps.jobs !== this.props.jobs) {
|
221
|
+
this.updateJobState();
|
222
|
+
}
|
223
|
+
}
|
224
|
+
updateJobState() {
|
225
|
+
const job = _.find(this.props.jobs, j => j.id === this.props.job.id) || this.props.job;
|
226
|
+
const newState = {
|
227
|
+
job,
|
228
|
+
status: job.status
|
229
|
+
};
|
230
|
+
if (job.expectedDate) {
|
231
|
+
newState.expectedDate = moment(job.expectedDate);
|
232
|
+
newState.expectedDateText = newState.expectedDate.format('DD/MM/YYYY');
|
233
|
+
}
|
234
|
+
if (job.seen) newState.seen = job.seen;
|
235
|
+
this.setState(newState, () => {
|
236
|
+
this.markSeen();
|
237
|
+
});
|
238
|
+
}
|
239
|
+
openGallery(index) {
|
240
|
+
this.setState({
|
241
|
+
galleryOpen: true
|
242
|
+
});
|
243
|
+
this.refs.imagePopup.scrollTo(index);
|
244
|
+
}
|
245
|
+
closeGallery() {
|
246
|
+
this.setState({
|
247
|
+
galleryOpen: false
|
248
|
+
});
|
249
|
+
}
|
250
|
+
renderLoading() {
|
251
|
+
return /*#__PURE__*/React.createElement(Components.LoadingIndicator, {
|
252
|
+
visible: this.state.loading
|
253
|
+
});
|
254
|
+
}
|
255
|
+
renderTop() {
|
256
|
+
const {
|
257
|
+
status,
|
258
|
+
job
|
259
|
+
} = this.state;
|
260
|
+
const {
|
261
|
+
statusText,
|
262
|
+
statusColor
|
263
|
+
} = getJobStatusProps(status);
|
264
|
+
const canEdit = this.hasPermission();
|
265
|
+
const showSeen = !status || status === jobStatusOptions[0].name;
|
266
|
+
return /*#__PURE__*/React.createElement(View, {
|
267
|
+
style: {
|
268
|
+
...Helper.getShadowStyle()
|
269
|
+
}
|
270
|
+
}, /*#__PURE__*/React.createElement(View, {
|
271
|
+
style: styles.jobTitleContainer
|
272
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
273
|
+
style: styles.jobTitleText
|
274
|
+
}, job.title), /*#__PURE__*/React.createElement(View, {
|
275
|
+
style: styles.jobTypeSeenContainer
|
276
|
+
}, /*#__PURE__*/React.createElement(View, {
|
277
|
+
style: [styles.jobTypeContainer, {
|
278
|
+
backgroundColor: Colours.hexToRGBAstring(this.props.colourBrandingMain, 0.2)
|
279
|
+
}]
|
280
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
281
|
+
style: [styles.jobTypeText, {
|
282
|
+
color: this.props.colourBrandingMain
|
283
|
+
}]
|
284
|
+
}, job.type)), showSeen && this.state.seen && /*#__PURE__*/React.createElement(View, {
|
285
|
+
style: styles.jobSeenContainer
|
286
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
287
|
+
name: "check",
|
288
|
+
type: "font-awesome",
|
289
|
+
iconStyle: [styles.jobSeenIcon, {
|
290
|
+
color: this.props.colourBrandingMain
|
291
|
+
}]
|
292
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
293
|
+
style: [styles.jobSeenText, {
|
294
|
+
color: this.props.colourBrandingMain
|
295
|
+
}]
|
296
|
+
}, "Seen"))), job.lastActivityUnix && /*#__PURE__*/React.createElement(View, {
|
297
|
+
style: styles.textSectionInner
|
298
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
299
|
+
style: styles.textSectionLabel
|
300
|
+
}, "Last Updated On"), /*#__PURE__*/React.createElement(View, {
|
301
|
+
style: styles.textSectionTextContainer
|
302
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
303
|
+
style: styles.textSectionText
|
304
|
+
}, moment(job.lastActivityUnix).format('ddd D MMMM, h:mm A')))), /*#__PURE__*/React.createElement(View, {
|
305
|
+
style: styles.textSectionInner
|
306
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
307
|
+
style: styles.textSectionLabel
|
308
|
+
}, "Expected Date"), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
309
|
+
onPress: this.onOpenDatePicker
|
310
|
+
}, /*#__PURE__*/React.createElement(View, {
|
311
|
+
style: styles.textSectionTextContainer
|
312
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
313
|
+
style: styles.textSectionText
|
314
|
+
}, this.state.expectedDateText || 'Select Date'), /*#__PURE__*/React.createElement(Icon, {
|
315
|
+
name: "angle-right",
|
316
|
+
type: "font-awesome",
|
317
|
+
iconStyle: [styles.textSectionAngleRight, {
|
318
|
+
color: this.props.colourBrandingMain
|
319
|
+
}]
|
320
|
+
}))))), /*#__PURE__*/React.createElement(View, {
|
321
|
+
style: styles.jobStatusExpectedContainer
|
322
|
+
}, /*#__PURE__*/React.createElement(View, {
|
323
|
+
style: styles.jobStatusOuterContainer
|
324
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
325
|
+
style: styles.jobStatusHeading
|
326
|
+
}, "STATUS"), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
327
|
+
onPress: canEdit ? this.onOpenStatusPicker : null
|
328
|
+
}, /*#__PURE__*/React.createElement(View, {
|
329
|
+
style: [styles.jobStatusContainer, {
|
330
|
+
backgroundColor: statusColor
|
331
|
+
}]
|
332
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
333
|
+
name: "wrench",
|
334
|
+
type: "font-awesome",
|
335
|
+
iconStyle: styles.jobStatusIcon
|
336
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
337
|
+
style: styles.jobStatusText
|
338
|
+
}, statusText)))), this.hasPermission() && /*#__PURE__*/React.createElement(View, {
|
339
|
+
style: styles.jobStatusOuterContainer
|
340
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
341
|
+
style: styles.jobStatusHeading
|
342
|
+
}, "STAFF NOTES"), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
343
|
+
onPress: this.openStaffNotes
|
344
|
+
}, /*#__PURE__*/React.createElement(View, {
|
345
|
+
style: [styles.jobStatusContainer, {
|
346
|
+
backgroundColor: this.props.colourBrandingMain
|
347
|
+
}]
|
348
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
349
|
+
name: "pencil-square-o",
|
350
|
+
type: "font-awesome",
|
351
|
+
iconStyle: styles.jobStatusIcon
|
352
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
353
|
+
style: styles.jobStatusText
|
354
|
+
}, "Notes (", (job.Notes || []).length, ")"))))));
|
355
|
+
}
|
356
|
+
renderPlayableImageUrl(url, index, containerStyle, showMore) {
|
357
|
+
const thumbUrl = Helper.getThumb300(url);
|
358
|
+
if (Helper.isVideo(url)) {
|
359
|
+
return /*#__PURE__*/React.createElement(ImageBackground, {
|
360
|
+
style: [{
|
361
|
+
flex: 1
|
362
|
+
}, containerStyle],
|
363
|
+
source: {
|
364
|
+
uri: thumbUrl
|
365
|
+
}
|
366
|
+
}, /*#__PURE__*/React.createElement(View, {
|
367
|
+
style: styles.imagePlayContainer
|
368
|
+
}, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
369
|
+
onPress: this.toggleFullscreenVideo.bind(this, url)
|
370
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
371
|
+
name: "play",
|
372
|
+
type: "font-awesome",
|
373
|
+
iconStyle: styles.imageControlIcon
|
374
|
+
}))));
|
375
|
+
}
|
376
|
+
const imageUrl = Helper.get1400(url);
|
377
|
+
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
378
|
+
style: containerStyle,
|
379
|
+
onPress: this.openGallery.bind(this, index || 0)
|
380
|
+
}, /*#__PURE__*/React.createElement(ImageBackground, {
|
381
|
+
style: styles.imageContainer,
|
382
|
+
source: {
|
383
|
+
uri: imageUrl
|
384
|
+
}
|
385
|
+
}, showMore && /*#__PURE__*/React.createElement(Text, {
|
386
|
+
style: styles.plusImages
|
387
|
+
}, "+", this.state.job.images.length - 2)));
|
388
|
+
}
|
389
|
+
renderPlayableImage(index, containerStyle, showMore) {
|
390
|
+
const url = this.state.job.images[index];
|
391
|
+
return this.renderPlayableImageUrl(url, index, containerStyle, showMore);
|
392
|
+
}
|
393
|
+
renderImage() {
|
394
|
+
const {
|
395
|
+
job
|
396
|
+
} = this.state;
|
397
|
+
if (!_.isNil(job.images) && !_.isEmpty(job.images)) {
|
398
|
+
if (job.images.length >= 2) {
|
399
|
+
return /*#__PURE__*/React.createElement(View, {
|
400
|
+
style: styles.sideBySideImages
|
401
|
+
}, this.renderPlayableImage(0, styles.sideBySideImageContainer), this.renderPlayableImage(1, styles.sideBySideImageContainer, job.images.length > 2));
|
402
|
+
} else {
|
403
|
+
return /*#__PURE__*/React.createElement(View, {
|
404
|
+
style: styles.singleImageContainer
|
405
|
+
}, this.renderPlayableImage(0));
|
406
|
+
}
|
407
|
+
} else if (!_.isNil(job.image)) {
|
408
|
+
return /*#__PURE__*/React.createElement(View, {
|
409
|
+
style: styles.singleImageContainer
|
410
|
+
}, this.renderPlayableImageUrl(job.image));
|
411
|
+
}
|
412
|
+
return null;
|
413
|
+
}
|
414
|
+
renderImagePopup() {
|
415
|
+
return /*#__PURE__*/React.createElement(Components.ImagePopup, {
|
416
|
+
visible: this.state.galleryOpen,
|
417
|
+
images: this.state.job.images || [this.state.job.image],
|
418
|
+
onClose: this.closeGallery.bind(this),
|
419
|
+
ref: "imagePopup"
|
420
|
+
});
|
421
|
+
}
|
422
|
+
rendeDetails() {
|
423
|
+
const {
|
424
|
+
job
|
425
|
+
} = this.state;
|
426
|
+
return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(Components.FormCardSectionOptionLauncher, {
|
427
|
+
onPress: this.onToggleDetails,
|
428
|
+
title: "Details",
|
429
|
+
icon: this.state.showMore ? 'angle-up' : 'angle-down',
|
430
|
+
textStyle: styles.detailsText,
|
431
|
+
sectionStyle: styles.detailsSection
|
432
|
+
}), this.state.showMore && /*#__PURE__*/React.createElement(View, null, this.renderImage(), !_.isEmpty(job.description) && /*#__PURE__*/React.createElement(Text, {
|
433
|
+
numberOfLines: 10,
|
434
|
+
style: styles.jobDescriptionText
|
435
|
+
}, job.description), /*#__PURE__*/React.createElement(Text, {
|
436
|
+
style: styles.locationLabel
|
437
|
+
}, "Location"), /*#__PURE__*/React.createElement(Text, {
|
438
|
+
style: styles.locationText
|
439
|
+
}, job.room), job.isHome ? /*#__PURE__*/React.createElement(View, {
|
440
|
+
style: styles.detailsSection
|
441
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
442
|
+
style: styles.locationLabel
|
443
|
+
}, "Must be home"), /*#__PURE__*/React.createElement(Text, {
|
444
|
+
style: styles.locationText
|
445
|
+
}, job.homeText)) : null, /*#__PURE__*/React.createElement(Text, {
|
446
|
+
style: styles.requesterLabel
|
447
|
+
}, "Person Requesting"), /*#__PURE__*/React.createElement(View, {
|
448
|
+
style: styles.profileContainer
|
449
|
+
}, /*#__PURE__*/React.createElement(Components.ProfilePic, {
|
450
|
+
ProfilePic: job.userProfilePic,
|
451
|
+
Diameter: 40
|
452
|
+
}), /*#__PURE__*/React.createElement(View, {
|
453
|
+
style: styles.nameContainer
|
454
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
455
|
+
style: styles.nameText
|
456
|
+
}, job.userName), !_.isEmpty(job.phone) && /*#__PURE__*/React.createElement(Text, {
|
457
|
+
style: styles.phoneText
|
458
|
+
}, job.phone)))));
|
459
|
+
}
|
460
|
+
renderMessages() {
|
461
|
+
return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(Components.CommentSection, {
|
462
|
+
ref: this.commentSection,
|
463
|
+
commentReply: this.commentReply,
|
464
|
+
scrollView: this.scrollView,
|
465
|
+
adminPermission: "maintenanceTracking",
|
466
|
+
entityType: "maintenancerequest",
|
467
|
+
entityId: this.props.job.id,
|
468
|
+
entityName: this.props.job.title,
|
469
|
+
site: this.state.job.site || this.state.job.location,
|
470
|
+
live: true,
|
471
|
+
refreshFrequency: 10000,
|
472
|
+
placeHolder: '',
|
473
|
+
style: {
|
474
|
+
flex: 1,
|
475
|
+
paddingHorizontal: 0,
|
476
|
+
paddingTop: 16
|
477
|
+
},
|
478
|
+
onCommentsLoaded: this.onCommentsLoaded,
|
479
|
+
onCommentAdded: this.onCommentAdded,
|
480
|
+
hideAddComment: true,
|
481
|
+
disableFlag: true
|
482
|
+
}), !this.state.showMessages && /*#__PURE__*/React.createElement(Components.InlineButton, {
|
483
|
+
onPress: this.onLeaveMessage,
|
484
|
+
color: this.props.colourBrandingMain,
|
485
|
+
touchableStyle: {
|
486
|
+
marginTop: 10
|
487
|
+
},
|
488
|
+
style: {
|
489
|
+
height: 36
|
490
|
+
},
|
491
|
+
textStyle: {
|
492
|
+
color: '#fff'
|
493
|
+
},
|
494
|
+
fullWidth: true
|
495
|
+
}, "Leave Message"));
|
496
|
+
}
|
497
|
+
renderMessagesReply() {
|
498
|
+
if (!this.state.showMessages) return null;
|
499
|
+
return /*#__PURE__*/React.createElement(Components.CommentReply, {
|
500
|
+
ref: this.commentReply,
|
501
|
+
commentSection: this.commentSection,
|
502
|
+
scrollView: this.scrollView,
|
503
|
+
entityType: "maintenancerequest",
|
504
|
+
entityId: this.props.job.id,
|
505
|
+
entityName: this.props.job.title,
|
506
|
+
site: this.state.job.site || this.state.job.location
|
507
|
+
// noScroll={true}
|
508
|
+
// style={{ position: 'absolute', bottom: 0, left: 0, right: 0 }}
|
509
|
+
});
|
510
|
+
}
|
511
|
+
renderStatusPopup() {
|
512
|
+
if (!this.state.showStatusPopup) return null;
|
513
|
+
return /*#__PURE__*/React.createElement(StatusSelectorPopup, {
|
514
|
+
onClose: this.onCloseStatusPopup,
|
515
|
+
onSelect: this.onSelectStatus
|
516
|
+
});
|
517
|
+
}
|
518
|
+
render() {
|
519
|
+
return /*#__PURE__*/React.createElement(KeyboardAvoidingView, {
|
520
|
+
behavior: Platform.OS === 'ios' && 'padding',
|
521
|
+
style: styles.container
|
522
|
+
}, /*#__PURE__*/React.createElement(Components.Header, {
|
523
|
+
leftIcon: "angle-left",
|
524
|
+
onPressLeft: this.onPressBack,
|
525
|
+
text: Config.env.strings.MAINTENANCE_REQUEST_DETAILS
|
526
|
+
}), this.renderLoading(), /*#__PURE__*/React.createElement(ScrollView, {
|
527
|
+
ref: this.scrollView,
|
528
|
+
contentContainerStyle: {
|
529
|
+
paddingBottom: 26
|
530
|
+
},
|
531
|
+
style: {
|
532
|
+
height: '100%'
|
533
|
+
}
|
534
|
+
}, /*#__PURE__*/React.createElement(View, {
|
535
|
+
style: styles.innerContainer
|
536
|
+
}, this.renderTop(), this.rendeDetails(), this.renderMessages())), this.renderMessagesReply(), this.renderStatusPopup(), this.renderImagePopup(), /*#__PURE__*/React.createElement(DateTimePicker, {
|
537
|
+
isVisible: this.state.isDateTimePickerVisible,
|
538
|
+
onConfirm: this.onDateSelected,
|
539
|
+
onCancel: this.onCloseDatePicker,
|
540
|
+
mode: this.state.popUpType,
|
541
|
+
headerTextIOS: `Pick a ${this.state.popUpType}`
|
542
|
+
}));
|
543
|
+
}
|
544
|
+
}
|
545
|
+
const styles = StyleSheet.create({
|
546
|
+
container: {
|
547
|
+
flex: 1,
|
548
|
+
backgroundColor: '#fff'
|
549
|
+
},
|
550
|
+
innerContainer: {
|
551
|
+
paddingTop: 23,
|
552
|
+
paddingHorizontal: 16
|
553
|
+
},
|
554
|
+
jobTitleContainer: {
|
555
|
+
paddingVertical: 14,
|
556
|
+
paddingHorizontal: 12
|
557
|
+
},
|
558
|
+
jobTitleText: {
|
559
|
+
fontFamily: 'sf-semibold',
|
560
|
+
fontSize: 20,
|
561
|
+
color: Colours.TEXT_DARKEST,
|
562
|
+
marginBottom: 8
|
563
|
+
},
|
564
|
+
jobTypeSeenContainer: {
|
565
|
+
flexDirection: 'row',
|
566
|
+
alignItems: 'center'
|
567
|
+
},
|
568
|
+
jobTypeContainer: {
|
569
|
+
height: 20,
|
570
|
+
width: 80,
|
571
|
+
borderRadius: 4,
|
572
|
+
justifyContent: 'center'
|
573
|
+
},
|
574
|
+
jobTypeText: {
|
575
|
+
fontFamily: 'sf-semibold',
|
576
|
+
fontSize: 12,
|
577
|
+
textAlign: 'center'
|
578
|
+
},
|
579
|
+
jobSeenContainer: {
|
580
|
+
flexDirection: 'row',
|
581
|
+
alignItems: 'center',
|
582
|
+
marginLeft: 10
|
583
|
+
},
|
584
|
+
jobSeenIcon: {
|
585
|
+
fontSize: 12
|
586
|
+
},
|
587
|
+
jobSeenText: {
|
588
|
+
fontFamily: 'sf-semibold',
|
589
|
+
fontSize: 12,
|
590
|
+
marginLeft: 4
|
591
|
+
},
|
592
|
+
jobStatusDateText: {
|
593
|
+
marginTop: 8,
|
594
|
+
fontFamily: 'sf-medium',
|
595
|
+
fontSize: 13,
|
596
|
+
color: Colours.TEXT_LIGHT
|
597
|
+
},
|
598
|
+
jobStatusExpectedContainer: {
|
599
|
+
flexDirection: 'row',
|
600
|
+
alignItems: 'flex-start',
|
601
|
+
justifyContent: 'space-between',
|
602
|
+
borderTopWidth: 1,
|
603
|
+
borderTopColor: Colours.LINEGREY,
|
604
|
+
paddingVertical: 14,
|
605
|
+
paddingHorizontal: 12
|
606
|
+
},
|
607
|
+
jobStatusOuterContainer: {
|
608
|
+
// marginRight: 50,
|
609
|
+
},
|
610
|
+
jobStatusHeading: {
|
611
|
+
fontFamily: 'sf-bold',
|
612
|
+
fontSize: 11,
|
613
|
+
letterSpacing: 0.8,
|
614
|
+
color: Colours.TEXT_DARK,
|
615
|
+
marginBottom: 6
|
616
|
+
},
|
617
|
+
jobStatusContainer: {
|
618
|
+
flexDirection: 'row',
|
619
|
+
alignItems: 'center',
|
620
|
+
width: 120,
|
621
|
+
height: 30,
|
622
|
+
paddingHorizontal: 8,
|
623
|
+
borderRadius: 4
|
624
|
+
},
|
625
|
+
jobStatusIcon: {
|
626
|
+
color: '#fff',
|
627
|
+
fontSize: 14,
|
628
|
+
marginRight: 8
|
629
|
+
},
|
630
|
+
jobStatusText: {
|
631
|
+
color: '#fff',
|
632
|
+
textAlign: 'center',
|
633
|
+
fontFamily: 'sf-semibold',
|
634
|
+
fontSize: 13,
|
635
|
+
flex: 1,
|
636
|
+
textAlign: 'center'
|
637
|
+
},
|
638
|
+
jobExpectedDateContainer: {
|
639
|
+
backgroundColor: Colours.BOXGREY,
|
640
|
+
flexDirection: 'row',
|
641
|
+
width: 115,
|
642
|
+
height: 30,
|
643
|
+
borderRadius: 4,
|
644
|
+
alignItems: 'center',
|
645
|
+
paddingLeft: 8
|
646
|
+
},
|
647
|
+
jobExpectedDate: {
|
648
|
+
fontFamily: 'sf-regular',
|
649
|
+
fontSize: 13,
|
650
|
+
color: Colours.hexToRGBAstring(Colours.TEXT_DARKEST, 0.5)
|
651
|
+
},
|
652
|
+
detailsText: {
|
653
|
+
fontFamily: 'sf-semibold',
|
654
|
+
fontSize: 16,
|
655
|
+
color: Colours.TEXT_DARKEST
|
656
|
+
},
|
657
|
+
detailsSection: {
|
658
|
+
marginTop: 8,
|
659
|
+
paddingHorizontal: 0,
|
660
|
+
paddingBottom: 12
|
661
|
+
},
|
662
|
+
sideBySideImages: {
|
663
|
+
flex: 1,
|
664
|
+
flexDirection: 'row',
|
665
|
+
justifyContent: 'space-between',
|
666
|
+
marginBottom: 16
|
667
|
+
},
|
668
|
+
sideBySideImageContainer: {
|
669
|
+
backgroundColor: '#fff',
|
670
|
+
width: '48%',
|
671
|
+
height: 150,
|
672
|
+
borderRadius: 2,
|
673
|
+
overflow: 'hidden'
|
674
|
+
},
|
675
|
+
singleImageContainer: {
|
676
|
+
backgroundColor: '#fff',
|
677
|
+
width: '100%',
|
678
|
+
height: 150,
|
679
|
+
flex: 1,
|
680
|
+
borderRadius: 2,
|
681
|
+
overflow: 'hidden',
|
682
|
+
marginBottom: 16
|
683
|
+
},
|
684
|
+
imageContainer: {
|
685
|
+
height: 150,
|
686
|
+
width: 'auto',
|
687
|
+
justifyContent: 'center'
|
688
|
+
},
|
689
|
+
imagePlayContainer: {
|
690
|
+
position: 'absolute',
|
691
|
+
top: 0,
|
692
|
+
left: 0,
|
693
|
+
right: 0,
|
694
|
+
bottom: 0,
|
695
|
+
alignItems: 'center',
|
696
|
+
justifyContent: 'center'
|
697
|
+
},
|
698
|
+
imageControlIcon: {
|
699
|
+
color: '#fff',
|
700
|
+
fontSize: 30,
|
701
|
+
textShadowColor: 'rgba(0,0,0,0.3)',
|
702
|
+
textShadowOffset: {
|
703
|
+
width: 2,
|
704
|
+
height: 2
|
705
|
+
}
|
706
|
+
},
|
707
|
+
plusImages: {
|
708
|
+
fontFamily: 'sf-bold',
|
709
|
+
fontSize: 32,
|
710
|
+
textAlign: 'center',
|
711
|
+
color: '#fff',
|
712
|
+
textShadowColor: 'rgba(0, 0, 0, 0.5)',
|
713
|
+
textShadowOffset: {
|
714
|
+
width: 0,
|
715
|
+
height: 2
|
716
|
+
},
|
717
|
+
textShadowRadius: 8
|
718
|
+
},
|
719
|
+
jobDescriptionText: {
|
720
|
+
fontFamily: 'sf-medium',
|
721
|
+
fontSize: 14,
|
722
|
+
color: Colours.TEXT_LIGHT,
|
723
|
+
paddingBottom: 16
|
724
|
+
},
|
725
|
+
locationLabel: {
|
726
|
+
fontFamily: 'sf-bold',
|
727
|
+
fontSize: 14,
|
728
|
+
color: Colours.TEXT_DARKEST
|
729
|
+
},
|
730
|
+
locationText: {
|
731
|
+
fontFamily: 'sf-regular',
|
732
|
+
fontSize: 16,
|
733
|
+
color: Colours.TEXT_DARKEST,
|
734
|
+
paddingVertical: 8
|
735
|
+
},
|
736
|
+
requesterLabel: {
|
737
|
+
fontFamily: 'sf-bold',
|
738
|
+
fontSize: 14,
|
739
|
+
color: Colours.TEXT_DARKEST,
|
740
|
+
paddingVertical: 10
|
741
|
+
},
|
742
|
+
profileContainer: {
|
743
|
+
flexDirection: 'row',
|
744
|
+
alignItems: 'center'
|
745
|
+
},
|
746
|
+
nameContainer: {
|
747
|
+
marginLeft: 18
|
748
|
+
},
|
749
|
+
nameText: {
|
750
|
+
fontSize: 'sf-semibold',
|
751
|
+
fontSize: 14,
|
752
|
+
color: Colours.TEXT_DARKEST,
|
753
|
+
marginBottom: 4
|
754
|
+
},
|
755
|
+
phoneText: {
|
756
|
+
fontSize: 'sf-medium',
|
757
|
+
fontSize: 14,
|
758
|
+
color: Colours.TEXT_LIGHT
|
759
|
+
},
|
760
|
+
textSectionInner: {
|
761
|
+
flexDirection: 'row',
|
762
|
+
justifyContent: 'space-between',
|
763
|
+
alignItems: 'center',
|
764
|
+
marginTop: 8
|
765
|
+
},
|
766
|
+
textSectionLabel: {
|
767
|
+
fontFamily: 'sf-semibold',
|
768
|
+
fontSize: 12,
|
769
|
+
lineHeight: 24,
|
770
|
+
color: Colours.TEXT_DARKEST
|
771
|
+
},
|
772
|
+
textSectionTextContainer: {
|
773
|
+
flexDirection: 'row',
|
774
|
+
alignItems: 'center'
|
775
|
+
},
|
776
|
+
textSectionText: {
|
777
|
+
fontFamily: 'sf-regular',
|
778
|
+
fontSize: 13,
|
779
|
+
lineHeight: 24,
|
780
|
+
color: Colours.TEXT_LIGHT
|
781
|
+
},
|
782
|
+
textSectionAngleRight: {
|
783
|
+
fontSize: 24,
|
784
|
+
marginLeft: 10,
|
785
|
+
lineHeight: 24
|
786
|
+
}
|
787
|
+
});
|
788
|
+
const mapStateToProps = state => {
|
789
|
+
return {
|
790
|
+
user: state.user,
|
791
|
+
colourBrandingMain: Colours.getMainBrandingColourFromState(state),
|
792
|
+
jobs: state.jobs.jobs
|
793
|
+
};
|
794
|
+
};
|
795
|
+
export default connect(mapStateToProps, {
|
796
|
+
jobAdded
|
797
|
+
})(RequestDetail);
|
798
|
+
//# sourceMappingURL=RequestDetail.js.map
|