@plusscommunities/pluss-maintenance-app 6.0.6-auth.0 → 6.0.6-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module/actions/JobActions.js.map +1 -1
- package/dist/module/actions/index.js.map +1 -1
- package/dist/module/actions/types.js +4 -3
- package/dist/module/actions/types.js.map +1 -1
- package/dist/module/apis/index.js.map +1 -1
- package/dist/module/apis/maintenanceActions.js +17 -15
- package/dist/module/apis/maintenanceActions.js.map +1 -1
- package/dist/module/components/FilterPopupMenu.js +2 -2
- package/dist/module/components/FilterPopupMenu.js.map +1 -1
- package/dist/module/components/MaintenanceList.js +6 -5
- package/dist/module/components/MaintenanceList.js.map +1 -1
- package/dist/module/components/MaintenanceListItem.js +5 -4
- package/dist/module/components/MaintenanceListItem.js.map +1 -1
- package/dist/module/components/MaintenanceWidgetItem.js +4 -3
- package/dist/module/components/MaintenanceWidgetItem.js.map +1 -1
- package/dist/module/components/StatusSelectorPopup.js.map +1 -1
- package/dist/module/components/WidgetLarge.js.map +1 -1
- package/dist/module/components/WidgetSmall.js +8 -5
- package/dist/module/components/WidgetSmall.js.map +1 -1
- package/dist/module/core.config.js.map +1 -1
- package/dist/module/feature.config.js +18 -33
- package/dist/module/feature.config.js.map +1 -1
- package/dist/module/helper.js.map +1 -1
- package/dist/module/index.js +15 -10
- package/dist/module/index.js.map +1 -1
- package/dist/module/reducers/JobsReducer.js.map +1 -1
- package/dist/module/screens/JobTypePicker.js +2 -2
- package/dist/module/screens/JobTypePicker.js.map +1 -1
- package/dist/module/screens/MaintenancePage.js +9 -5
- package/dist/module/screens/MaintenancePage.js.map +1 -1
- package/dist/module/screens/RequestDetail.js +121 -41
- package/dist/module/screens/RequestDetail.js.map +1 -1
- package/dist/module/screens/RequestNotes.js +7 -4
- package/dist/module/screens/RequestNotes.js.map +1 -1
- package/dist/module/screens/ServiceRequest.js +554 -86
- package/dist/module/screens/ServiceRequest.js.map +1 -1
- package/dist/module/values.config.a.js +30 -0
- package/dist/module/values.config.a.js.map +1 -0
- package/dist/module/values.config.b.js +30 -0
- package/dist/module/values.config.b.js.map +1 -0
- package/dist/module/values.config.c.js +30 -0
- package/dist/module/values.config.c.js.map +1 -0
- package/dist/module/values.config.d.js +30 -0
- package/dist/module/values.config.d.js.map +1 -0
- package/dist/module/values.config.default.js +30 -0
- package/dist/module/values.config.default.js.map +1 -0
- package/dist/module/values.config.js +30 -0
- package/dist/module/values.config.js.map +1 -0
- package/package.json +9 -6
- package/src/actions/types.js +5 -3
- package/src/apis/maintenanceActions.js +30 -14
- package/src/components/MaintenanceList.js +5 -3
- package/src/components/MaintenanceListItem.js +7 -2
- package/src/components/MaintenanceWidgetItem.js +2 -1
- package/src/components/WidgetSmall.js +6 -3
- package/src/feature.config.js +18 -30
- package/src/index.js +15 -8
- package/src/screens/MaintenancePage.js +5 -4
- package/src/screens/RequestDetail.js +113 -42
- package/src/screens/RequestNotes.js +5 -2
- package/src/screens/ServiceRequest.js +591 -149
- package/src/values.config.a.js +30 -0
- package/src/values.config.b.js +30 -0
- package/src/values.config.c.js +30 -0
- package/src/values.config.d.js +30 -0
- package/src/values.config.default.js +30 -0
- package/src/values.config.js +30 -0
@@ -1,5 +1,5 @@
|
|
1
|
-
function _defineProperty(
|
2
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i
|
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
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';
|
@@ -8,6 +8,7 @@ import _ from 'lodash';
|
|
8
8
|
import MaintenanceList from '../components/MaintenanceList';
|
9
9
|
import { Services, BaseComponents } from '../feature.config';
|
10
10
|
import { Components, Helper, Styles, Config } from '../core.config';
|
11
|
+
import { values } from '../values.config';
|
11
12
|
class MaintenancePage extends Component {
|
12
13
|
constructor(props) {
|
13
14
|
super(props);
|
@@ -31,9 +32,10 @@ class MaintenancePage extends Component {
|
|
31
32
|
});
|
32
33
|
}
|
33
34
|
renderHeader() {
|
35
|
+
const title = this.props.title || this.props.strings[`${values.featureKey}_textFeatureTitle`] || values.textFeatureTitle;
|
34
36
|
if (this.state.isHomeTab) {
|
35
37
|
return /*#__PURE__*/React.createElement(Components.Header, {
|
36
|
-
text:
|
38
|
+
text: title,
|
37
39
|
rightContent: _.includes(this.props.user.hidden, 'notifications') ? null : /*#__PURE__*/React.createElement(View, {
|
38
40
|
style: styles.notificationContainer
|
39
41
|
}, /*#__PURE__*/React.createElement(BaseComponents.NotificationBell, {
|
@@ -45,7 +47,7 @@ class MaintenancePage extends Component {
|
|
45
47
|
return /*#__PURE__*/React.createElement(Components.Header, {
|
46
48
|
leftIcon: "angle-left",
|
47
49
|
onPressLeft: this.onPressBack,
|
48
|
-
text:
|
50
|
+
text: values.textFeatureTitle
|
49
51
|
});
|
50
52
|
}
|
51
53
|
render() {
|
@@ -80,8 +82,10 @@ const styles = StyleSheet.create({
|
|
80
82
|
}
|
81
83
|
});
|
82
84
|
const mapStateToProps = state => {
|
85
|
+
var _state$strings;
|
83
86
|
return {
|
84
|
-
user: state.user
|
87
|
+
user: state.user,
|
88
|
+
strings: ((_state$strings = state.strings) === null || _state$strings === void 0 ? void 0 : _state$strings.config) || {}
|
85
89
|
};
|
86
90
|
};
|
87
91
|
export default connect(mapStateToProps, {})(MaintenancePage);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","Component","View","StyleSheet","connect","_","MaintenanceList","Services","BaseComponents","Components","Helper","Styles","Config","MaintenancePage","constructor","props","_defineProperty","navigation","goBack","loading","setState","state","isHomeTab","componentDidMount","getParentRoute","renderHeader","
|
1
|
+
{"version":3,"names":["React","Component","View","StyleSheet","connect","_","MaintenanceList","Services","BaseComponents","Components","Helper","Styles","Config","values","MaintenancePage","constructor","props","_defineProperty","navigation","goBack","loading","setState","state","isHomeTab","componentDidMount","getParentRoute","renderHeader","title","strings","featureKey","textFeatureTitle","createElement","Header","text","rightContent","includes","user","hidden","style","styles","notificationContainer","NotificationBell","colourBrandingHeader","containerStyle","notificationBell","leftIcon","onPressLeft","onPressBack","render","container","LoadingIndicator","visible","maintenanceList","onLoadingChanged","enableAdd","options","create","flex","position","top","bottom","right","paddingTop","StatusBarHeight","marginTop","mapStateToProps","_state$strings","config"],"sources":["MaintenancePage.js"],"sourcesContent":["import React, { Component } from 'react';\nimport { View, StyleSheet } from 'react-native';\nimport { connect } from 'react-redux';\nimport _ from 'lodash';\nimport MaintenanceList from '../components/MaintenanceList';\nimport { Services, BaseComponents } from '../feature.config';\nimport { Components, Helper, Styles, Config } from '../core.config';\nimport { values } from '../values.config';\n\nclass MaintenancePage extends Component {\n constructor(props) {\n super(props);\n this.state = {\n isHomeTab: false,\n loading: false,\n };\n }\n\n componentDidMount() {\n // console.log('!Services.navigation.getParentRoute()', !Services.navigation.getParentRoute());\n this.setState({ isHomeTab: !Services.navigation.getParentRoute() });\n }\n\n onPressBack = () => {\n Services.navigation.goBack();\n };\n\n onLoadingChanged = loading => {\n this.setState({ loading });\n };\n\n renderHeader() {\n const title = this.props.title || this.props.strings[`${values.featureKey}_textFeatureTitle`] || values.textFeatureTitle;\n if (this.state.isHomeTab) {\n return (\n <Components.Header\n text={title}\n rightContent={\n _.includes(this.props.user.hidden, 'notifications') ? null : (\n <View style={styles.notificationContainer}>\n <BaseComponents.NotificationBell\n colourBrandingHeader={this.props.colourBrandingHeader}\n containerStyle={Styles.notificationBell}\n />\n </View>\n )\n }\n />\n );\n }\n return <Components.Header leftIcon=\"angle-left\" onPressLeft={this.onPressBack} text={values.textFeatureTitle} />;\n }\n\n render() {\n const { isHomeTab } = this.state;\n\n return (\n <View style={styles.container}>\n {this.renderHeader()}\n <Components.LoadingIndicator visible={this.state.loading} />\n <MaintenanceList\n style={styles.maintenanceList}\n onLoadingChanged={this.onLoadingChanged}\n enableAdd={!isHomeTab}\n options={this.props.options}\n />\n {/* {isHomeTab && <Components.AddContentButton />} */}\n </View>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n notificationContainer: {\n position: 'absolute',\n top: 0,\n bottom: 0,\n right: 0,\n paddingTop: Helper.StatusBarHeight(0),\n },\n maintenanceList: {\n marginTop: 12,\n },\n});\n\nconst mapStateToProps = state => {\n return {\n user: state.user,\n strings: state.strings?.config || {},\n };\n};\n\nexport default connect(mapStateToProps, {})(MaintenancePage);\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AAC/C,SAASC,OAAO,QAAQ,aAAa;AACrC,OAAOC,CAAC,MAAM,QAAQ;AACtB,OAAOC,eAAe,MAAM,+BAA+B;AAC3D,SAASC,QAAQ,EAAEC,cAAc,QAAQ,mBAAmB;AAC5D,SAASC,UAAU,EAAEC,MAAM,EAAEC,MAAM,EAAEC,MAAM,QAAQ,gBAAgB;AACnE,SAASC,MAAM,QAAQ,kBAAkB;AAEzC,MAAMC,eAAe,SAASb,SAAS,CAAC;EACtCc,WAAWA,CAACC,KAAK,EAAE;IACjB,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA,sBAYD,MAAM;MAClBV,QAAQ,CAACW,UAAU,CAACC,MAAM,CAAC,CAAC;IAC9B,CAAC;IAAAF,eAAA,2BAEkBG,OAAO,IAAI;MAC5B,IAAI,CAACC,QAAQ,CAAC;QAAED;MAAQ,CAAC,CAAC;I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|
2
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i
|
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
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';
|
@@ -14,6 +14,7 @@ import StatusSelectorPopup from '../components/StatusSelectorPopup';
|
|
14
14
|
import { jobStatusOptions, getJobStatusProps } from '../helper';
|
15
15
|
import { Services } from '../feature.config';
|
16
16
|
import { Colours, Helper, Components, Config } from '../core.config';
|
17
|
+
import { values } from '../values.config';
|
17
18
|
class RequestDetail extends Component {
|
18
19
|
constructor(props) {
|
19
20
|
super(props);
|
@@ -25,7 +26,7 @@ class RequestDetail extends Component {
|
|
25
26
|
try {
|
26
27
|
const res = await maintenanceActions.getJob(this.props.job.site, this.props.job.id);
|
27
28
|
this.props.jobAdded(res.data);
|
28
|
-
|
29
|
+
this.updateJobState(res.data);
|
29
30
|
} catch (error) {
|
30
31
|
console.log('getJob error', error.toString());
|
31
32
|
// check for 403 or 404 error
|
@@ -77,6 +78,7 @@ class RequestDetail extends Component {
|
|
77
78
|
const res = await maintenanceActions.editJob(updated, user.site);
|
78
79
|
// console.log('markSeen updated');
|
79
80
|
this.props.jobAdded(res.data.job);
|
81
|
+
this.getJob();
|
80
82
|
this.setState({
|
81
83
|
loading: false,
|
82
84
|
seen: true
|
@@ -108,6 +110,7 @@ class RequestDetail extends Component {
|
|
108
110
|
}
|
109
111
|
const res = await maintenanceActions.editJob(updated, user.site);
|
110
112
|
this.props.jobAdded(res.data.job);
|
113
|
+
this.getJob();
|
111
114
|
} catch (error) {
|
112
115
|
console.log('updateJob error', error);
|
113
116
|
} finally {
|
@@ -124,6 +127,7 @@ class RequestDetail extends Component {
|
|
124
127
|
try {
|
125
128
|
const res = await maintenanceActions.editJobStatus(this.props.job.id, this.state.status);
|
126
129
|
this.props.jobAdded(res.data.job);
|
130
|
+
this.getJob();
|
127
131
|
} catch (error) {
|
128
132
|
console.log('updateJobStatus error', error);
|
129
133
|
} finally {
|
@@ -155,8 +159,9 @@ class RequestDetail extends Component {
|
|
155
159
|
});
|
156
160
|
});
|
157
161
|
_defineProperty(this, "openStaffNotes", () => {
|
158
|
-
Services.navigation.navigate(
|
159
|
-
job: this.state.job
|
162
|
+
Services.navigation.navigate(values.screenRequestNotes, {
|
163
|
+
job: this.state.job,
|
164
|
+
onChange: this.getJob
|
160
165
|
});
|
161
166
|
});
|
162
167
|
_defineProperty(this, "onOpenDatePicker", () => {
|
@@ -207,6 +212,7 @@ class RequestDetail extends Component {
|
|
207
212
|
const job = await maintenanceActions.getJob(this.props.user.site, this.props.job.id);
|
208
213
|
// console.log('onCommentAdded', job?.data);
|
209
214
|
this.props.jobAdded(job.data);
|
215
|
+
this.getJob();
|
210
216
|
} catch (error) {
|
211
217
|
console.log('onCommentAdded error', error);
|
212
218
|
} finally {
|
@@ -223,10 +229,10 @@ class RequestDetail extends Component {
|
|
223
229
|
const {
|
224
230
|
permissions
|
225
231
|
} = this.props.user;
|
226
|
-
if (_.includes(permissions,
|
232
|
+
if (_.includes(permissions, values.permissionMaintenanceTracking)) {
|
227
233
|
return true;
|
228
234
|
}
|
229
|
-
if (_.includes(permissions,
|
235
|
+
if (_.includes(permissions, values.permissionMaintenanceAssign)) {
|
230
236
|
return job.AssigneeId === this.props.user.Id;
|
231
237
|
}
|
232
238
|
return false;
|
@@ -260,6 +266,7 @@ class RequestDetail extends Component {
|
|
260
266
|
console.log('onSelectAssignee', this.props.job.id, assignee.key);
|
261
267
|
const res = await maintenanceActions.assignJob(this.props.job.id, assignee.key);
|
262
268
|
this.props.jobAdded(res.data.job);
|
269
|
+
this.getJob();
|
263
270
|
} catch (error) {
|
264
271
|
console.log('onSelectAssignee error', error);
|
265
272
|
} finally {
|
@@ -283,6 +290,7 @@ class RequestDetail extends Component {
|
|
283
290
|
showFullscreenVideo: false,
|
284
291
|
currentVideoUrl: '',
|
285
292
|
galleryOpen: false,
|
293
|
+
galleryImages: [],
|
286
294
|
showMessages: false,
|
287
295
|
assignees: []
|
288
296
|
};
|
@@ -292,16 +300,15 @@ class RequestDetail extends Component {
|
|
292
300
|
}
|
293
301
|
componentDidMount() {
|
294
302
|
this.getJob();
|
295
|
-
this.updateJobState();
|
303
|
+
this.updateJobState(this.props.job);
|
296
304
|
this.getAssignees();
|
297
305
|
}
|
298
|
-
|
299
|
-
|
300
|
-
|
306
|
+
updateJobState(defaultJob) {
|
307
|
+
const job = _.find(this.props.jobs, j => j.id === this.props.job.id) || defaultJob;
|
308
|
+
if (!job) {
|
309
|
+
this.getJob();
|
310
|
+
return;
|
301
311
|
}
|
302
|
-
}
|
303
|
-
updateJobState() {
|
304
|
-
const job = _.find(this.props.jobs, j => j.id === this.props.job.id) || this.props.job;
|
305
312
|
const newState = {
|
306
313
|
job,
|
307
314
|
status: job.status
|
@@ -315,9 +322,10 @@ class RequestDetail extends Component {
|
|
315
322
|
this.markSeen();
|
316
323
|
});
|
317
324
|
}
|
318
|
-
openGallery(index) {
|
325
|
+
openGallery(galleryImages, index) {
|
319
326
|
this.setState({
|
320
|
-
galleryOpen: true
|
327
|
+
galleryOpen: true,
|
328
|
+
galleryImages
|
321
329
|
});
|
322
330
|
this.refs.imagePopup.scrollTo(index);
|
323
331
|
}
|
@@ -352,7 +360,7 @@ class RequestDetail extends Component {
|
|
352
360
|
style: [styles.jobIdText, {
|
353
361
|
color: this.props.colourBrandingMain
|
354
362
|
}]
|
355
|
-
},
|
363
|
+
}, `${values.textEntityName} #${job.jobId}`) : null, /*#__PURE__*/React.createElement(Text, {
|
356
364
|
style: styles.jobTitleText
|
357
365
|
}, job.title), /*#__PURE__*/React.createElement(View, {
|
358
366
|
style: styles.jobTypeSeenContainer
|
@@ -417,7 +425,8 @@ class RequestDetail extends Component {
|
|
417
425
|
style: styles.jobStatusText
|
418
426
|
}, "Notes (", (job.Notes || []).length, ")"))))));
|
419
427
|
}
|
420
|
-
renderPlayableImageUrl(
|
428
|
+
renderPlayableImageUrl(images, index, containerStyle, showMore) {
|
429
|
+
const url = images[index || 0];
|
421
430
|
const thumbUrl = Helper.getThumb300(url);
|
422
431
|
if (Helper.isVideo(url)) {
|
423
432
|
return /*#__PURE__*/React.createElement(ImageBackground, {
|
@@ -440,7 +449,7 @@ class RequestDetail extends Component {
|
|
440
449
|
const imageUrl = Helper.get1400(url);
|
441
450
|
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
442
451
|
style: containerStyle,
|
443
|
-
onPress: this.openGallery.bind(this, index || 0)
|
452
|
+
onPress: this.openGallery.bind(this, images, index || 0)
|
444
453
|
}, /*#__PURE__*/React.createElement(ImageBackground, {
|
445
454
|
style: styles.imageContainer,
|
446
455
|
source: {
|
@@ -450,35 +459,31 @@ class RequestDetail extends Component {
|
|
450
459
|
style: styles.plusImages
|
451
460
|
}, "+", this.state.job.images.length - 2)));
|
452
461
|
}
|
453
|
-
renderPlayableImage(index, containerStyle, showMore) {
|
454
|
-
|
455
|
-
return this.renderPlayableImageUrl(url, index, containerStyle, showMore);
|
462
|
+
renderPlayableImage(images, index, containerStyle, showMore) {
|
463
|
+
return this.renderPlayableImageUrl(images, index, containerStyle, showMore);
|
456
464
|
}
|
457
|
-
renderImage() {
|
458
|
-
|
459
|
-
|
460
|
-
} = this.state;
|
461
|
-
if (!_.isNil(job.images) && !_.isEmpty(job.images)) {
|
462
|
-
if (job.images.length >= 2) {
|
465
|
+
renderImage(images, image = null) {
|
466
|
+
if (!_.isNil(images) && !_.isEmpty(images)) {
|
467
|
+
if (images.length >= 2) {
|
463
468
|
return /*#__PURE__*/React.createElement(View, {
|
464
469
|
style: styles.sideBySideImages
|
465
|
-
}, this.renderPlayableImage(0, styles.sideBySideImageContainer), this.renderPlayableImage(1, styles.sideBySideImageContainer,
|
470
|
+
}, this.renderPlayableImage(images, 0, styles.sideBySideImageContainer), this.renderPlayableImage(images, 1, styles.sideBySideImageContainer, images.length > 2));
|
466
471
|
} else {
|
467
472
|
return /*#__PURE__*/React.createElement(View, {
|
468
473
|
style: styles.singleImageContainer
|
469
|
-
}, this.renderPlayableImage(0));
|
474
|
+
}, this.renderPlayableImage(images, 0));
|
470
475
|
}
|
471
|
-
} else if (!_.isNil(
|
476
|
+
} else if (!_.isNil(image)) {
|
472
477
|
return /*#__PURE__*/React.createElement(View, {
|
473
478
|
style: styles.singleImageContainer
|
474
|
-
}, this.renderPlayableImageUrl(
|
479
|
+
}, this.renderPlayableImageUrl([image], 0));
|
475
480
|
}
|
476
481
|
return null;
|
477
482
|
}
|
478
483
|
renderImagePopup() {
|
479
484
|
return /*#__PURE__*/React.createElement(Components.ImagePopup, {
|
480
485
|
visible: this.state.galleryOpen,
|
481
|
-
images: this.state.
|
486
|
+
images: this.state.galleryImages,
|
482
487
|
onClose: this.closeGallery.bind(this),
|
483
488
|
ref: "imagePopup"
|
484
489
|
});
|
@@ -511,24 +516,75 @@ class RequestDetail extends Component {
|
|
511
516
|
}
|
512
517
|
return content;
|
513
518
|
}
|
519
|
+
renderCustomFields() {
|
520
|
+
const {
|
521
|
+
job
|
522
|
+
} = this.state;
|
523
|
+
const {
|
524
|
+
customFields
|
525
|
+
} = job;
|
526
|
+
const renderAnswer = field => {
|
527
|
+
switch (field.type) {
|
528
|
+
case 'date':
|
529
|
+
return /*#__PURE__*/React.createElement(Text, {
|
530
|
+
style: styles.customText
|
531
|
+
}, field.answer ? moment(field.answer, 'YYYY-MM-DD').format('DD MMM YYYY') : '');
|
532
|
+
case 'time':
|
533
|
+
return /*#__PURE__*/React.createElement(Text, {
|
534
|
+
style: styles.customText
|
535
|
+
}, field.answer ? moment(field.answer, 'HH:mm').format('h:mm a') : '');
|
536
|
+
case 'yn':
|
537
|
+
return /*#__PURE__*/React.createElement(Text, {
|
538
|
+
style: styles.customText
|
539
|
+
}, field.answer ? 'Yes' : 'No');
|
540
|
+
case 'checkbox':
|
541
|
+
return /*#__PURE__*/React.createElement(Text, {
|
542
|
+
style: styles.customText
|
543
|
+
}, field.answer && Array.isArray(field.answer) ? field.answer.join(', ') : '');
|
544
|
+
case 'image':
|
545
|
+
return /*#__PURE__*/React.createElement(View, {
|
546
|
+
style: {
|
547
|
+
marginTop: 8
|
548
|
+
}
|
549
|
+
}, this.renderImage(field.answer));
|
550
|
+
default:
|
551
|
+
return /*#__PURE__*/React.createElement(Text, {
|
552
|
+
style: styles.customText
|
553
|
+
}, field.answer);
|
554
|
+
}
|
555
|
+
};
|
556
|
+
return customFields.map((field, index) => {
|
557
|
+
if (['staticTitle', 'staticText'].includes(field.type)) return null;
|
558
|
+
if (_.isNil(field.answer) || field.answer === '' || Array.isArray(field.answer) && field.answer.length === 0) return null;
|
559
|
+
return /*#__PURE__*/React.createElement(View, {
|
560
|
+
key: index
|
561
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
562
|
+
style: styles.customLabel
|
563
|
+
}, field.label), renderAnswer(field));
|
564
|
+
});
|
565
|
+
}
|
514
566
|
rendeDetails() {
|
515
567
|
const {
|
516
568
|
job
|
517
569
|
} = this.state;
|
570
|
+
const {
|
571
|
+
customFields
|
572
|
+
} = job;
|
573
|
+
const hasCustomFields = customFields && customFields.length > 0;
|
518
574
|
return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(Components.FormCardSectionOptionLauncher, {
|
519
575
|
onPress: this.onToggleDetails,
|
520
576
|
title: "Details",
|
521
577
|
icon: this.state.showMore ? 'angle-up' : 'angle-down',
|
522
578
|
textStyle: styles.detailsText,
|
523
579
|
sectionStyle: styles.detailsSection
|
524
|
-
}), this.state.showMore && /*#__PURE__*/React.createElement(View, null, this.renderImage(), !_.isEmpty(job.description) && /*#__PURE__*/React.createElement(Text, {
|
580
|
+
}), 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, {
|
525
581
|
numberOfLines: 10,
|
526
582
|
style: styles.jobDescriptionText
|
527
|
-
}, job.description), /*#__PURE__*/React.createElement(Text, {
|
583
|
+
}, job.description)) : null, /*#__PURE__*/React.createElement(Text, {
|
528
584
|
style: styles.locationLabel
|
529
|
-
}, "
|
585
|
+
}, "Address"), /*#__PURE__*/React.createElement(Text, {
|
530
586
|
style: styles.locationText
|
531
|
-
}, job.room), job.isHome ? /*#__PURE__*/React.createElement(View, {
|
587
|
+
}, job.room), !hasCustomFields && job.isHome ? /*#__PURE__*/React.createElement(View, {
|
532
588
|
style: styles.detailsSection
|
533
589
|
}, /*#__PURE__*/React.createElement(Text, {
|
534
590
|
style: styles.locationLabel
|
@@ -554,8 +610,8 @@ class RequestDetail extends Component {
|
|
554
610
|
ref: this.commentSection,
|
555
611
|
commentReply: this.commentReply,
|
556
612
|
scrollView: this.scrollView,
|
557
|
-
adminPermission:
|
558
|
-
entityType:
|
613
|
+
adminPermission: values.permissionMaintenanceTracking,
|
614
|
+
entityType: values.featureKey,
|
559
615
|
entityId: this.props.job.id,
|
560
616
|
entityName: this.props.job.title,
|
561
617
|
site: this.state.job.site || this.state.job.location,
|
@@ -592,7 +648,7 @@ class RequestDetail extends Component {
|
|
592
648
|
ref: this.commentReply,
|
593
649
|
commentSection: this.commentSection,
|
594
650
|
scrollView: this.scrollView,
|
595
|
-
entityType:
|
651
|
+
entityType: values.featureKey,
|
596
652
|
entityId: this.props.job.id,
|
597
653
|
entityName: this.props.job.title,
|
598
654
|
site: this.state.job.site || this.state.job.location
|
@@ -885,13 +941,37 @@ const styles = StyleSheet.create({
|
|
885
941
|
fontSize: 24,
|
886
942
|
marginLeft: 10,
|
887
943
|
lineHeight: 24
|
944
|
+
},
|
945
|
+
customLabel: {
|
946
|
+
fontFamily: 'sf-bold',
|
947
|
+
fontSize: 14,
|
948
|
+
color: Colours.TEXT_DARKEST
|
949
|
+
},
|
950
|
+
customText: {
|
951
|
+
fontFamily: 'sf-regular',
|
952
|
+
fontSize: 16,
|
953
|
+
color: Colours.TEXT_DARKEST,
|
954
|
+
paddingVertical: 8
|
955
|
+
},
|
956
|
+
customStaticTitle: {
|
957
|
+
fontSize: 20,
|
958
|
+
fontFamily: 'sf-semibold',
|
959
|
+
color: Colours.TEXT_DARKEST,
|
960
|
+
marginBottom: 10
|
961
|
+
},
|
962
|
+
customStaticText: {
|
963
|
+
fontSize: 17,
|
964
|
+
fontFamily: 'sf-regular',
|
965
|
+
color: Colours.TEXT_DARKEST,
|
966
|
+
lineHeight: 24,
|
967
|
+
marginBottom: 10
|
888
968
|
}
|
889
969
|
});
|
890
970
|
const mapStateToProps = state => {
|
891
971
|
return {
|
892
972
|
user: state.user,
|
893
973
|
colourBrandingMain: Colours.getMainBrandingColourFromState(state),
|
894
|
-
jobs: state.
|
974
|
+
jobs: state[values.reducerKey].jobs
|
895
975
|
};
|
896
976
|
};
|
897
977
|
export default connect(mapStateToProps, {
|