@plusscommunities/pluss-maintenance-app 6.1.2-beta.0 → 7.0.0-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/apis/index.js +1 -1
- package/dist/module/apis/index.js.map +1 -1
- package/dist/module/apis/{generalActions.js → maintenanceActions.js} +25 -41
- package/dist/module/apis/maintenanceActions.js.map +1 -0
- package/dist/module/components/FilterPopupMenu.js +48 -12
- package/dist/module/components/FilterPopupMenu.js.map +1 -1
- package/dist/module/components/MaintenanceList.js +52 -18
- package/dist/module/components/MaintenanceList.js.map +1 -1
- package/dist/module/components/MaintenanceListItem.js +16 -17
- package/dist/module/components/MaintenanceListItem.js.map +1 -1
- package/dist/module/components/MaintenanceWidgetItem.js +4 -8
- 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 +6 -6
- 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 +10 -2
- package/dist/module/helper.js.map +1 -1
- package/dist/module/reducers/JobsReducer.js +2 -1
- 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 +252 -72
- package/dist/module/screens/RequestDetail.js.map +1 -1
- package/dist/module/screens/RequestNotes.js +10 -8
- 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 +4 -1
- package/dist/module/values.config.a.js.map +1 -1
- package/dist/module/values.config.default.js +10 -1
- package/dist/module/values.config.default.js.map +1 -1
- package/dist/module/values.config.forms.js +37 -0
- package/dist/module/values.config.forms.js.map +1 -0
- package/dist/module/values.config.js +10 -1
- package/dist/module/values.config.js.map +1 -1
- package/package.json +12 -12
- package/src/apis/index.js +1 -1
- package/src/apis/{generalActions.js → maintenanceActions.js} +35 -39
- package/src/components/FilterPopupMenu.js +39 -7
- package/src/components/MaintenanceList.js +59 -19
- package/src/components/MaintenanceListItem.js +18 -10
- package/src/components/MaintenanceWidgetItem.js +2 -2
- package/src/components/StatusSelectorPopup.js +2 -1
- package/src/components/WidgetSmall.js +4 -4
- package/src/feature.config.js +15 -13
- package/src/helper.js +11 -2
- package/src/reducers/JobsReducer.js +2 -1
- package/src/screens/JobTypePicker.js +1 -1
- package/src/screens/RequestDetail.js +237 -51
- package/src/screens/RequestNotes.js +27 -25
- package/src/screens/ServiceRequest.js +642 -157
- package/src/values.config.a.js +3 -0
- package/src/values.config.default.js +9 -0
- package/src/values.config.forms.js +37 -0
- package/src/values.config.js +9 -0
- 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 +1 @@
|
|
1
|
-
{"version":3,"names":["React","Component","_","TouchableOpacity","View","ScrollView","Text","connect","Icon","Services","Components","Colours","JobTypePicker","constructor","args","_defineProperty","currentType","UNSAFE_componentWillMount","setState","props","onPressBack","navigation","goBack","onTypePress","type","onSelectType","setTimeout","renderMain","isEmpty","types","createElement","style","marginTop","Spinner","FormCard","renderOptions","map","rep","index","key","onPress","bind","typeName","FormCardSection","label","labelStyle","height","margin","hasUnderline","hasContent","styles","labelContainer","labelText","name","iconStyle","color","fontSize","state","COLOUR_GREEN","description","render","container","Header","leftIcon","onPressLeft","text","flex","position","backgroundColor","row","flexDirection","alignItems","minHeight","fontFamily","TEXT_DARK","justifyContent"],"sources":["JobTypePicker.js"],"sourcesContent":["import React, { Component } from 'react';\nimport _ from 'lodash';\nimport { TouchableOpacity, View, ScrollView, Text } from 'react-native';\nimport { connect } from 'react-redux';\nimport { Icon } from '
|
1
|
+
{"version":3,"names":["React","Component","_","TouchableOpacity","View","ScrollView","Text","connect","Icon","Services","Components","Colours","JobTypePicker","constructor","args","_defineProperty","currentType","UNSAFE_componentWillMount","setState","props","onPressBack","navigation","goBack","onTypePress","type","onSelectType","setTimeout","renderMain","isEmpty","types","createElement","style","marginTop","Spinner","FormCard","renderOptions","map","rep","index","key","onPress","bind","typeName","FormCardSection","label","labelStyle","height","margin","hasUnderline","hasContent","styles","labelContainer","labelText","name","iconStyle","color","fontSize","state","COLOUR_GREEN","description","render","container","Header","leftIcon","onPressLeft","text","flex","position","backgroundColor","row","flexDirection","alignItems","minHeight","fontFamily","TEXT_DARK","justifyContent"],"sources":["JobTypePicker.js"],"sourcesContent":["import React, { Component } from 'react';\nimport _ from 'lodash';\nimport { TouchableOpacity, View, ScrollView, Text } from 'react-native';\nimport { connect } from 'react-redux';\nimport { Icon } from '@rneui/themed';\nimport { Services } from '../feature.config';\nimport { Components, Colours } from '../core.config';\n\nclass JobTypePicker extends Component {\n state = {\n currentType: null,\n };\n\n UNSAFE_componentWillMount() {\n this.setState({ currentType: this.props.currentType });\n }\n\n onPressBack() {\n Services.navigation.goBack();\n }\n\n onTypePress(type) {\n this.props.onSelectType(type);\n this.setState({ currentType: type });\n setTimeout(() => {\n this.onPressBack();\n }, 200);\n }\n\n renderMain() {\n if (_.isEmpty(this.props.types)) {\n return (\n <View style={{ marginTop: 16 }}>\n <Components.Spinner />\n </View>\n );\n }\n\n return <Components.FormCard style={{ marginTop: 16 }}>{this.renderOptions()}</Components.FormCard>;\n }\n\n renderOptions() {\n return this.props.types.map((rep, index) => {\n return (\n <TouchableOpacity key={index} onPress={this.onTypePress.bind(this, rep.typeName)}>\n <Components.FormCardSection label={rep.typeName} labelStyle={{ height: 0, margin: 0 }} hasUnderline hasContent>\n <View style={styles.labelContainer}>\n <Text style={styles.labelText}>{rep.typeName}</Text>\n <Icon\n name=\"check-circle\"\n //style={styles.uploadButtonInner}\n type=\"font-awesome\"\n iconStyle={[{ color: '#d5d9e0', fontSize: 20 }, rep.typeName === this.state.currentType && { color: Colours.COLOUR_GREEN }]}\n />\n </View>\n {!_.isEmpty(rep.description) && <Text style={styles.description}>{rep.description}</Text>}\n </Components.FormCardSection>\n </TouchableOpacity>\n );\n });\n }\n\n render() {\n return (\n <View style={styles.container}>\n <Components.Header leftIcon=\"angle-left\" onPressLeft={this.onPressBack.bind(this)} text=\"Select type\" />\n <ScrollView style={{ flex: 1 }}>{this.renderMain()}</ScrollView>\n </View>\n );\n }\n}\n\nconst styles = {\n container: {\n flex: 1,\n position: 'relative',\n backgroundColor: '#f0f0f5',\n },\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n minHeight: 22,\n },\n text: {\n flex: 1,\n fontFamily: 'sf-regular',\n fontSize: 14,\n color: Colours.TEXT_DARK,\n },\n labelContainer: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n labelText: {\n fontFamily: 'sf-medium',\n fontSize: 16,\n color: Colours.TEXT_DARK,\n },\n description: {\n marginTop: 5,\n fontSize: 14,\n fontFamily: 'sf-regular',\n color: Colours.TEXT_DARK,\n },\n};\n\nexport default connect(null, {})(JobTypePicker);\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,OAAOC,CAAC,MAAM,QAAQ;AACtB,SAASC,gBAAgB,EAAEC,IAAI,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AACvE,SAASC,OAAO,QAAQ,aAAa;AACrC,SAASC,IAAI,QAAQ,eAAe;AACpC,SAASC,QAAQ,QAAQ,mBAAmB;AAC5C,SAASC,UAAU,EAAEC,OAAO,QAAQ,gBAAgB;AAEpD,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M;MAACC,QAAQ,EAAC,YAAY;MAACC,WAAW,EAAE,IAAI,CAAC5C,WAAW,CAACqB,IAAI,CAAC,IAAI,CAAE;MAACwB,IAAI,EAAC;IAAa,CAAE,CAAC,eACxGjE,KAAA,CAAA8B,aAAA,CAACzB,UAAU;MAAC0B,KAAK,EAAE;QAAEmC,IAAI,EAAE;MAAE;IAAE,GAAE,IAAI,CAACvC,UAAU,CAAC,CAAc,CAC3D,CAAC;EAEX;AACF;AAEA,MAAMuB,MAAM,GAAG;EACbW,SAAS,EAAE;IACTK,IAAI,EAAE,CAAC;IACPC,QAAQ,EAAE,UAAU;IACpBC,eAAe,EAAE;EACnB,CAAC;EACDC,GAAG,EAAE;IACHC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBC,SAAS,EAAE;EACb,CAAC;EACDP,IAAI,EAAE;IACJC,IAAI,EAAE,CAAC;IACPO,UAAU,EAAE,YAAY;IACxBjB,QAAQ,EAAE,EAAE;IACZD,KAAK,EAAE5C,OAAO,CAAC+D;EACjB,CAAC;EACDvB,cAAc,EAAE;IACdmB,aAAa,EAAE,KAAK;IACpBK,cAAc,EAAE;EAClB,CAAC;EACDvB,SAAS,EAAE;IACTqB,UAAU,EAAE,WAAW;IACvBjB,QAAQ,EAAE,EAAE;IACZD,KAAK,EAAE5C,OAAO,CAAC+D;EACjB,CAAC;EACDf,WAAW,EAAE;IACX3B,SAAS,EAAE,CAAC;IACZwB,QAAQ,EAAE,EAAE;IACZiB,UAAU,EAAE,YAAY;IACxBlB,KAAK,EAAE5C,OAAO,CAAC+D;EACjB;AACF,CAAC;AAED,eAAenE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAACK,aAAa,CAAC","ignoreList":[]}
|
@@ -1,5 +1,5 @@
|
|
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 { View, StyleSheet } from 'react-native';
|
@@ -1,14 +1,14 @@
|
|
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 {
|
11
|
+
import { maintenanceActions } from '../apis';
|
12
12
|
import { jobAdded } from '../actions';
|
13
13
|
import StatusSelectorPopup from '../components/StatusSelectorPopup';
|
14
14
|
import { jobStatusOptions, getJobStatusProps } from '../helper';
|
@@ -18,6 +18,41 @@ import { values } from '../values.config';
|
|
18
18
|
class RequestDetail extends Component {
|
19
19
|
constructor(props) {
|
20
20
|
super(props);
|
21
|
+
_defineProperty(this, "getJob", async () => {
|
22
|
+
this.setState({
|
23
|
+
loading: true
|
24
|
+
}, async () => {
|
25
|
+
try {
|
26
|
+
const res = await maintenanceActions.getJob(this.props.job.site, this.props.job.id);
|
27
|
+
this.props.jobAdded(res.data);
|
28
|
+
this.updateJobState(res.data);
|
29
|
+
} catch (error) {
|
30
|
+
console.log('getJob error', error.toString());
|
31
|
+
// check for 403 or 404 error
|
32
|
+
if (error.response.status === 403 || error.response.status === 404) {
|
33
|
+
this.setState({
|
34
|
+
forbidden: true
|
35
|
+
});
|
36
|
+
}
|
37
|
+
console.log('getJob error', error);
|
38
|
+
} finally {
|
39
|
+
this.setState({
|
40
|
+
loading: false
|
41
|
+
});
|
42
|
+
}
|
43
|
+
});
|
44
|
+
});
|
45
|
+
_defineProperty(this, "getAssignees", async () => {
|
46
|
+
if (!this.hasPermission()) return;
|
47
|
+
try {
|
48
|
+
const res = await maintenanceActions.getAssignees(this.props.user.site);
|
49
|
+
this.setState({
|
50
|
+
assignees: res.data.Users
|
51
|
+
});
|
52
|
+
} catch (error) {
|
53
|
+
console.log('getAssignees error', error);
|
54
|
+
}
|
55
|
+
});
|
21
56
|
_defineProperty(this, "markSeen", () => {
|
22
57
|
const {
|
23
58
|
user
|
@@ -39,9 +74,10 @@ class RequestDetail extends Component {
|
|
39
74
|
seen: true,
|
40
75
|
status: job.status || 'Unassigned'
|
41
76
|
};
|
42
|
-
const res = await
|
77
|
+
const res = await maintenanceActions.editJob(updated, user.site);
|
43
78
|
// console.log('markSeen updated');
|
44
79
|
this.props.jobAdded(res.data.job);
|
80
|
+
this.getJob();
|
45
81
|
this.setState({
|
46
82
|
loading: false,
|
47
83
|
seen: true
|
@@ -71,8 +107,9 @@ class RequestDetail extends Component {
|
|
71
107
|
if (this.state.expectedDate) {
|
72
108
|
updated.expectedDate = moment(this.state.expectedDate).utc().toISOString();
|
73
109
|
}
|
74
|
-
const res = await
|
110
|
+
const res = await maintenanceActions.editJob(updated, user.site);
|
75
111
|
this.props.jobAdded(res.data.job);
|
112
|
+
this.getJob();
|
76
113
|
} catch (error) {
|
77
114
|
console.log('updateJob error', error);
|
78
115
|
} finally {
|
@@ -87,8 +124,9 @@ class RequestDetail extends Component {
|
|
87
124
|
loading: true
|
88
125
|
}, async () => {
|
89
126
|
try {
|
90
|
-
const res = await
|
127
|
+
const res = await maintenanceActions.editJobStatus(this.props.job.id, this.state.status);
|
91
128
|
this.props.jobAdded(res.data.job);
|
129
|
+
this.getJob();
|
92
130
|
} catch (error) {
|
93
131
|
console.log('updateJobStatus error', error);
|
94
132
|
} finally {
|
@@ -121,7 +159,8 @@ class RequestDetail extends Component {
|
|
121
159
|
});
|
122
160
|
_defineProperty(this, "openStaffNotes", () => {
|
123
161
|
Services.navigation.navigate(values.screenRequestNotes, {
|
124
|
-
job: this.state.job
|
162
|
+
job: this.state.job,
|
163
|
+
onChange: this.getJob
|
125
164
|
});
|
126
165
|
});
|
127
166
|
_defineProperty(this, "onOpenDatePicker", () => {
|
@@ -169,9 +208,10 @@ class RequestDetail extends Component {
|
|
169
208
|
loading: true
|
170
209
|
}, async () => {
|
171
210
|
try {
|
172
|
-
const job = await
|
211
|
+
const job = await maintenanceActions.getJob(this.props.user.site, this.props.job.id);
|
173
212
|
// console.log('onCommentAdded', job?.data);
|
174
213
|
this.props.jobAdded(job.data);
|
214
|
+
this.getJob();
|
175
215
|
} catch (error) {
|
176
216
|
console.log('onCommentAdded error', error);
|
177
217
|
} finally {
|
@@ -182,10 +222,19 @@ class RequestDetail extends Component {
|
|
182
222
|
});
|
183
223
|
});
|
184
224
|
_defineProperty(this, "hasPermission", () => {
|
225
|
+
const {
|
226
|
+
job
|
227
|
+
} = this.state;
|
185
228
|
const {
|
186
229
|
permissions
|
187
230
|
} = this.props.user;
|
188
|
-
|
231
|
+
if (_.includes(permissions, values.permissionMaintenanceTracking)) {
|
232
|
+
return true;
|
233
|
+
}
|
234
|
+
if (_.includes(permissions, values.permissionMaintenanceAssignment)) {
|
235
|
+
return job.AssigneeId === this.props.user.Id;
|
236
|
+
}
|
237
|
+
return false;
|
189
238
|
});
|
190
239
|
_defineProperty(this, "toggleFullscreenVideo", url => {
|
191
240
|
if (typeof url !== 'string') url = '';
|
@@ -194,6 +243,38 @@ class RequestDetail extends Component {
|
|
194
243
|
currentVideoUrl: url
|
195
244
|
});
|
196
245
|
});
|
246
|
+
_defineProperty(this, "onOpenAssigneePicker", () => {
|
247
|
+
const options = this.state.assignees.map(a => {
|
248
|
+
return {
|
249
|
+
key: a.id,
|
250
|
+
name: a.displayName
|
251
|
+
};
|
252
|
+
});
|
253
|
+
Services.navigation.navigate('optionSelector', {
|
254
|
+
options,
|
255
|
+
selection: this.state.job.AssigneeId,
|
256
|
+
title: 'Assign request',
|
257
|
+
onSelect: this.onSelectAssignee
|
258
|
+
});
|
259
|
+
});
|
260
|
+
_defineProperty(this, "onSelectAssignee", assignee => {
|
261
|
+
this.setState({
|
262
|
+
loading: true
|
263
|
+
}, async () => {
|
264
|
+
try {
|
265
|
+
console.log('onSelectAssignee', this.props.job.id, assignee.key);
|
266
|
+
const res = await maintenanceActions.assignJob(this.props.job.id, assignee.key);
|
267
|
+
this.props.jobAdded(res.data.job);
|
268
|
+
this.getJob();
|
269
|
+
} catch (error) {
|
270
|
+
console.log('onSelectAssignee error', error);
|
271
|
+
} finally {
|
272
|
+
this.setState({
|
273
|
+
loading: false
|
274
|
+
});
|
275
|
+
}
|
276
|
+
});
|
277
|
+
});
|
197
278
|
this.state = {
|
198
279
|
job: {},
|
199
280
|
isDateTimePickerVisible: false,
|
@@ -202,28 +283,31 @@ class RequestDetail extends Component {
|
|
202
283
|
expectedDate: null,
|
203
284
|
expectedDateText: '',
|
204
285
|
seen: false,
|
205
|
-
showMore:
|
286
|
+
showMore: true,
|
206
287
|
showStatusPopup: false,
|
207
288
|
loading: false,
|
208
289
|
showFullscreenVideo: false,
|
209
290
|
currentVideoUrl: '',
|
210
291
|
galleryOpen: false,
|
211
|
-
|
292
|
+
galleryImages: [],
|
293
|
+
showMessages: false,
|
294
|
+
assignees: []
|
212
295
|
};
|
213
296
|
this.scrollView = /*#__PURE__*/React.createRef();
|
214
297
|
this.commentReply = /*#__PURE__*/React.createRef();
|
215
298
|
this.commentSection = /*#__PURE__*/React.createRef();
|
216
299
|
}
|
217
300
|
componentDidMount() {
|
218
|
-
this.
|
301
|
+
this.getJob();
|
302
|
+
this.updateJobState(this.props.job);
|
303
|
+
this.getAssignees();
|
219
304
|
}
|
220
|
-
|
221
|
-
|
222
|
-
|
305
|
+
updateJobState(defaultJob) {
|
306
|
+
const job = _.find(this.props.jobs, j => j.id === this.props.job.id) || defaultJob;
|
307
|
+
if (!job) {
|
308
|
+
this.getJob();
|
309
|
+
return;
|
223
310
|
}
|
224
|
-
}
|
225
|
-
updateJobState() {
|
226
|
-
const job = _.find(this.props.jobs, j => j.id === this.props.job.id) || this.props.job;
|
227
311
|
const newState = {
|
228
312
|
job,
|
229
313
|
status: job.status
|
@@ -237,9 +321,10 @@ class RequestDetail extends Component {
|
|
237
321
|
this.markSeen();
|
238
322
|
});
|
239
323
|
}
|
240
|
-
openGallery(index) {
|
324
|
+
openGallery(galleryImages, index) {
|
241
325
|
this.setState({
|
242
|
-
galleryOpen: true
|
326
|
+
galleryOpen: true,
|
327
|
+
galleryImages
|
243
328
|
});
|
244
329
|
this.refs.imagePopup.scrollTo(index);
|
245
330
|
}
|
@@ -270,7 +355,11 @@ class RequestDetail extends Component {
|
|
270
355
|
}
|
271
356
|
}, /*#__PURE__*/React.createElement(View, {
|
272
357
|
style: styles.jobTitleContainer
|
273
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
358
|
+
}, job.jobId ? /*#__PURE__*/React.createElement(Text, {
|
359
|
+
style: [styles.jobIdText, {
|
360
|
+
color: this.props.colourBrandingMain
|
361
|
+
}]
|
362
|
+
}, `${values.textEntityName} #${job.jobId}`) : null, /*#__PURE__*/React.createElement(Text, {
|
274
363
|
style: styles.jobTitleText
|
275
364
|
}, job.title), /*#__PURE__*/React.createElement(View, {
|
276
365
|
style: styles.jobTypeSeenContainer
|
@@ -281,7 +370,8 @@ class RequestDetail extends Component {
|
|
281
370
|
}, /*#__PURE__*/React.createElement(Text, {
|
282
371
|
style: [styles.jobTypeText, {
|
283
372
|
color: this.props.colourBrandingMain
|
284
|
-
}]
|
373
|
+
}],
|
374
|
+
numberOfLines: 2
|
285
375
|
}, job.type)), showSeen && this.state.seen && /*#__PURE__*/React.createElement(View, {
|
286
376
|
style: styles.jobSeenContainer
|
287
377
|
}, /*#__PURE__*/React.createElement(Icon, {
|
@@ -302,23 +392,7 @@ class RequestDetail extends Component {
|
|
302
392
|
style: styles.textSectionTextContainer
|
303
393
|
}, /*#__PURE__*/React.createElement(Text, {
|
304
394
|
style: styles.textSectionText
|
305
|
-
}, moment(job.lastActivityUnix).format('ddd D MMMM, h:mm A')))), /*#__PURE__*/React.createElement(View, {
|
306
|
-
style: styles.textSectionInner
|
307
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
308
|
-
style: styles.textSectionLabel
|
309
|
-
}, "Expected Date"), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
310
|
-
onPress: this.onOpenDatePicker
|
311
|
-
}, /*#__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, {
|
395
|
+
}, moment(job.lastActivityUnix).format('ddd D MMMM, h:mm A'))))), /*#__PURE__*/React.createElement(View, {
|
322
396
|
style: styles.jobStatusExpectedContainer
|
323
397
|
}, /*#__PURE__*/React.createElement(View, {
|
324
398
|
style: styles.jobStatusOuterContainer
|
@@ -330,11 +404,7 @@ class RequestDetail extends Component {
|
|
330
404
|
style: [styles.jobStatusContainer, {
|
331
405
|
backgroundColor: statusColor
|
332
406
|
}]
|
333
|
-
}, /*#__PURE__*/React.createElement(
|
334
|
-
name: "wrench",
|
335
|
-
type: "font-awesome",
|
336
|
-
iconStyle: styles.jobStatusIcon
|
337
|
-
}), /*#__PURE__*/React.createElement(Text, {
|
407
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
338
408
|
style: styles.jobStatusText
|
339
409
|
}, statusText)))), this.hasPermission() && /*#__PURE__*/React.createElement(View, {
|
340
410
|
style: styles.jobStatusOuterContainer
|
@@ -354,7 +424,8 @@ class RequestDetail extends Component {
|
|
354
424
|
style: styles.jobStatusText
|
355
425
|
}, "Notes (", (job.Notes || []).length, ")"))))));
|
356
426
|
}
|
357
|
-
renderPlayableImageUrl(
|
427
|
+
renderPlayableImageUrl(images, index, containerStyle, showMore) {
|
428
|
+
const url = images[index || 0];
|
358
429
|
const thumbUrl = Helper.getThumb300(url);
|
359
430
|
if (Helper.isVideo(url)) {
|
360
431
|
return /*#__PURE__*/React.createElement(ImageBackground, {
|
@@ -377,7 +448,7 @@ class RequestDetail extends Component {
|
|
377
448
|
const imageUrl = Helper.get1400(url);
|
378
449
|
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
379
450
|
style: containerStyle,
|
380
|
-
onPress: this.openGallery.bind(this, index || 0)
|
451
|
+
onPress: this.openGallery.bind(this, images, index || 0)
|
381
452
|
}, /*#__PURE__*/React.createElement(ImageBackground, {
|
382
453
|
style: styles.imageContainer,
|
383
454
|
source: {
|
@@ -387,57 +458,132 @@ class RequestDetail extends Component {
|
|
387
458
|
style: styles.plusImages
|
388
459
|
}, "+", this.state.job.images.length - 2)));
|
389
460
|
}
|
390
|
-
renderPlayableImage(index, containerStyle, showMore) {
|
391
|
-
|
392
|
-
return this.renderPlayableImageUrl(url, index, containerStyle, showMore);
|
461
|
+
renderPlayableImage(images, index, containerStyle, showMore) {
|
462
|
+
return this.renderPlayableImageUrl(images, index, containerStyle, showMore);
|
393
463
|
}
|
394
|
-
renderImage() {
|
395
|
-
|
396
|
-
|
397
|
-
} = this.state;
|
398
|
-
if (!_.isNil(job.images) && !_.isEmpty(job.images)) {
|
399
|
-
if (job.images.length >= 2) {
|
464
|
+
renderImage(images, image = null) {
|
465
|
+
if (!_.isNil(images) && !_.isEmpty(images)) {
|
466
|
+
if (images.length >= 2) {
|
400
467
|
return /*#__PURE__*/React.createElement(View, {
|
401
468
|
style: styles.sideBySideImages
|
402
|
-
}, this.renderPlayableImage(0, styles.sideBySideImageContainer), this.renderPlayableImage(1, styles.sideBySideImageContainer,
|
469
|
+
}, this.renderPlayableImage(images, 0, styles.sideBySideImageContainer), this.renderPlayableImage(images, 1, styles.sideBySideImageContainer, images.length > 2));
|
403
470
|
} else {
|
404
471
|
return /*#__PURE__*/React.createElement(View, {
|
405
472
|
style: styles.singleImageContainer
|
406
|
-
}, this.renderPlayableImage(0));
|
473
|
+
}, this.renderPlayableImage(images, 0));
|
407
474
|
}
|
408
|
-
} else if (!_.isNil(
|
475
|
+
} else if (!_.isNil(image)) {
|
409
476
|
return /*#__PURE__*/React.createElement(View, {
|
410
477
|
style: styles.singleImageContainer
|
411
|
-
}, this.renderPlayableImageUrl(
|
478
|
+
}, this.renderPlayableImageUrl([image], 0));
|
412
479
|
}
|
413
480
|
return null;
|
414
481
|
}
|
415
482
|
renderImagePopup() {
|
416
483
|
return /*#__PURE__*/React.createElement(Components.ImagePopup, {
|
417
484
|
visible: this.state.galleryOpen,
|
418
|
-
images: this.state.
|
485
|
+
images: this.state.galleryImages,
|
419
486
|
onClose: this.closeGallery.bind(this),
|
420
487
|
ref: "imagePopup"
|
421
488
|
});
|
422
489
|
}
|
490
|
+
renderAssignee() {
|
491
|
+
const {
|
492
|
+
job
|
493
|
+
} = this.state;
|
494
|
+
if (!this.hasPermission() && !job.Assignee) return null;
|
495
|
+
const content = /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(Text, {
|
496
|
+
style: styles.locationLabel
|
497
|
+
}, "Assigned To"), /*#__PURE__*/React.createElement(View, null, job.Assignee && /*#__PURE__*/React.createElement(View, {
|
498
|
+
style: styles.profileContainer
|
499
|
+
}, /*#__PURE__*/React.createElement(Components.ProfilePic, {
|
500
|
+
ProfilePic: job.Assignee.profilePic,
|
501
|
+
Diameter: 40
|
502
|
+
}), /*#__PURE__*/React.createElement(View, {
|
503
|
+
style: styles.nameContainer
|
504
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
505
|
+
style: styles.nameText
|
506
|
+
}, job.Assignee.displayName)))));
|
507
|
+
if (this.hasPermission()) {
|
508
|
+
return /*#__PURE__*/React.createElement(Components.FormCardSectionOptionLauncher, {
|
509
|
+
onPress: this.onOpenAssigneePicker,
|
510
|
+
title: "Assigned To",
|
511
|
+
value: job.Assignee ? job.Assignee.displayName : 'Unassigned',
|
512
|
+
textStyle: styles.detailsText,
|
513
|
+
sectionStyle: styles.detailsSection
|
514
|
+
}, content);
|
515
|
+
}
|
516
|
+
return content;
|
517
|
+
}
|
518
|
+
renderCustomFields() {
|
519
|
+
const {
|
520
|
+
job
|
521
|
+
} = this.state;
|
522
|
+
const {
|
523
|
+
customFields
|
524
|
+
} = job;
|
525
|
+
const renderAnswer = field => {
|
526
|
+
switch (field.type) {
|
527
|
+
case 'date':
|
528
|
+
return /*#__PURE__*/React.createElement(Text, {
|
529
|
+
style: styles.customText
|
530
|
+
}, field.answer ? moment(field.answer, 'YYYY-MM-DD').format('DD MMM YYYY') : '');
|
531
|
+
case 'time':
|
532
|
+
return /*#__PURE__*/React.createElement(Text, {
|
533
|
+
style: styles.customText
|
534
|
+
}, field.answer ? moment(field.answer, 'HH:mm').format('h:mm a') : '');
|
535
|
+
case 'yn':
|
536
|
+
return /*#__PURE__*/React.createElement(Text, {
|
537
|
+
style: styles.customText
|
538
|
+
}, field.answer ? 'Yes' : 'No');
|
539
|
+
case 'checkbox':
|
540
|
+
return /*#__PURE__*/React.createElement(Text, {
|
541
|
+
style: styles.customText
|
542
|
+
}, field.answer && Array.isArray(field.answer) ? field.answer.join(', ') : '');
|
543
|
+
case 'image':
|
544
|
+
return /*#__PURE__*/React.createElement(View, {
|
545
|
+
style: {
|
546
|
+
marginTop: 8
|
547
|
+
}
|
548
|
+
}, this.renderImage(field.answer));
|
549
|
+
default:
|
550
|
+
return /*#__PURE__*/React.createElement(Text, {
|
551
|
+
style: styles.customText
|
552
|
+
}, field.answer);
|
553
|
+
}
|
554
|
+
};
|
555
|
+
return customFields.map((field, index) => {
|
556
|
+
if (['staticTitle', 'staticText'].includes(field.type)) return null;
|
557
|
+
if (_.isNil(field.answer) || field.answer === '' || Array.isArray(field.answer) && field.answer.length === 0) return null;
|
558
|
+
return /*#__PURE__*/React.createElement(View, {
|
559
|
+
key: index
|
560
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
561
|
+
style: styles.customLabel
|
562
|
+
}, field.label), renderAnswer(field));
|
563
|
+
});
|
564
|
+
}
|
423
565
|
rendeDetails() {
|
424
566
|
const {
|
425
567
|
job
|
426
568
|
} = this.state;
|
569
|
+
const {
|
570
|
+
customFields
|
571
|
+
} = job;
|
572
|
+
const hasCustomFields = customFields && customFields.length > 0;
|
427
573
|
return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(Components.FormCardSectionOptionLauncher, {
|
428
574
|
onPress: this.onToggleDetails,
|
429
575
|
title: "Details",
|
430
576
|
icon: this.state.showMore ? 'angle-up' : 'angle-down',
|
431
577
|
textStyle: styles.detailsText,
|
432
578
|
sectionStyle: styles.detailsSection
|
433
|
-
}), this.state.showMore && /*#__PURE__*/React.createElement(View, null, this.renderImage(), !_.isEmpty(job.description) && /*#__PURE__*/React.createElement(Text, {
|
579
|
+
}), 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
580
|
numberOfLines: 10,
|
435
581
|
style: styles.jobDescriptionText
|
436
|
-
}, job.description), /*#__PURE__*/React.createElement(Text, {
|
582
|
+
}, job.description)) : null, /*#__PURE__*/React.createElement(Text, {
|
437
583
|
style: styles.locationLabel
|
438
|
-
}, "
|
584
|
+
}, "Address"), /*#__PURE__*/React.createElement(Text, {
|
439
585
|
style: styles.locationText
|
440
|
-
}, job.room), job.isHome ? /*#__PURE__*/React.createElement(View, {
|
586
|
+
}, job.room), !hasCustomFields && job.isHome ? /*#__PURE__*/React.createElement(View, {
|
441
587
|
style: styles.detailsSection
|
442
588
|
}, /*#__PURE__*/React.createElement(Text, {
|
443
589
|
style: styles.locationLabel
|
@@ -445,7 +591,7 @@ class RequestDetail extends Component {
|
|
445
591
|
style: styles.locationText
|
446
592
|
}, job.homeText)) : null, /*#__PURE__*/React.createElement(Text, {
|
447
593
|
style: styles.requesterLabel
|
448
|
-
}, "
|
594
|
+
}, "Submitted By"), /*#__PURE__*/React.createElement(View, {
|
449
595
|
style: styles.profileContainer
|
450
596
|
}, /*#__PURE__*/React.createElement(Components.ProfilePic, {
|
451
597
|
ProfilePic: job.userProfilePic,
|
@@ -464,7 +610,7 @@ class RequestDetail extends Component {
|
|
464
610
|
commentReply: this.commentReply,
|
465
611
|
scrollView: this.scrollView,
|
466
612
|
adminPermission: values.permissionMaintenanceTracking,
|
467
|
-
entityType: values.
|
613
|
+
entityType: values.commentKey,
|
468
614
|
entityId: this.props.job.id,
|
469
615
|
entityName: this.props.job.title,
|
470
616
|
site: this.state.job.site || this.state.job.location,
|
@@ -501,7 +647,7 @@ class RequestDetail extends Component {
|
|
501
647
|
ref: this.commentReply,
|
502
648
|
commentSection: this.commentSection,
|
503
649
|
scrollView: this.scrollView,
|
504
|
-
entityType: values.
|
650
|
+
entityType: values.commentKey,
|
505
651
|
entityId: this.props.job.id,
|
506
652
|
entityName: this.props.job.title,
|
507
653
|
site: this.state.job.site || this.state.job.location
|
@@ -517,6 +663,9 @@ class RequestDetail extends Component {
|
|
517
663
|
});
|
518
664
|
}
|
519
665
|
render() {
|
666
|
+
if (this.state.forbidden) {
|
667
|
+
return /*#__PURE__*/React.createElement(Components.Forbidden, null);
|
668
|
+
}
|
520
669
|
return /*#__PURE__*/React.createElement(KeyboardAvoidingView, {
|
521
670
|
behavior: Platform.OS === 'ios' && 'padding',
|
522
671
|
style: styles.container
|
@@ -534,7 +683,7 @@ class RequestDetail extends Component {
|
|
534
683
|
}
|
535
684
|
}, /*#__PURE__*/React.createElement(View, {
|
536
685
|
style: styles.innerContainer
|
537
|
-
}, this.renderTop(), this.rendeDetails(), this.renderMessages())), this.renderMessagesReply(), this.renderStatusPopup(), this.renderImagePopup(), /*#__PURE__*/React.createElement(DateTimePicker, {
|
686
|
+
}, this.renderTop(), this.renderAssignee(), this.rendeDetails(), this.renderMessages())), this.renderMessagesReply(), this.renderStatusPopup(), this.renderImagePopup(), /*#__PURE__*/React.createElement(DateTimePicker, {
|
538
687
|
isVisible: this.state.isDateTimePickerVisible,
|
539
688
|
onConfirm: this.onDateSelected,
|
540
689
|
onCancel: this.onCloseDatePicker,
|
@@ -556,6 +705,11 @@ const styles = StyleSheet.create({
|
|
556
705
|
paddingVertical: 14,
|
557
706
|
paddingHorizontal: 12
|
558
707
|
},
|
708
|
+
jobIdText: {
|
709
|
+
fontFamily: 'sf-medium',
|
710
|
+
fontSize: 12,
|
711
|
+
marginBottom: 4
|
712
|
+
},
|
559
713
|
jobTitleText: {
|
560
714
|
fontFamily: 'sf-semibold',
|
561
715
|
fontSize: 20,
|
@@ -567,15 +721,17 @@ const styles = StyleSheet.create({
|
|
567
721
|
alignItems: 'center'
|
568
722
|
},
|
569
723
|
jobTypeContainer: {
|
570
|
-
|
571
|
-
|
724
|
+
padding: 4,
|
725
|
+
minWidth: 80,
|
726
|
+
maxWidth: 140,
|
572
727
|
borderRadius: 4,
|
573
728
|
justifyContent: 'center'
|
574
729
|
},
|
575
730
|
jobTypeText: {
|
576
731
|
fontFamily: 'sf-semibold',
|
577
732
|
fontSize: 12,
|
578
|
-
textAlign: 'center'
|
733
|
+
textAlign: 'center',
|
734
|
+
maxWidth: '100%'
|
579
735
|
},
|
580
736
|
jobSeenContainer: {
|
581
737
|
flexDirection: 'row',
|
@@ -784,6 +940,30 @@ const styles = StyleSheet.create({
|
|
784
940
|
fontSize: 24,
|
785
941
|
marginLeft: 10,
|
786
942
|
lineHeight: 24
|
943
|
+
},
|
944
|
+
customLabel: {
|
945
|
+
fontFamily: 'sf-bold',
|
946
|
+
fontSize: 14,
|
947
|
+
color: Colours.TEXT_DARKEST
|
948
|
+
},
|
949
|
+
customText: {
|
950
|
+
fontFamily: 'sf-regular',
|
951
|
+
fontSize: 16,
|
952
|
+
color: Colours.TEXT_DARKEST,
|
953
|
+
paddingVertical: 8
|
954
|
+
},
|
955
|
+
customStaticTitle: {
|
956
|
+
fontSize: 20,
|
957
|
+
fontFamily: 'sf-semibold',
|
958
|
+
color: Colours.TEXT_DARKEST,
|
959
|
+
marginBottom: 10
|
960
|
+
},
|
961
|
+
customStaticText: {
|
962
|
+
fontSize: 17,
|
963
|
+
fontFamily: 'sf-regular',
|
964
|
+
color: Colours.TEXT_DARKEST,
|
965
|
+
lineHeight: 24,
|
966
|
+
marginBottom: 10
|
787
967
|
}
|
788
968
|
});
|
789
969
|
const mapStateToProps = state => {
|