@plusscommunities/pluss-maintenance-app 6.0.7-auth.0 → 6.0.8-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/types.js +4 -3
- package/dist/module/actions/types.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/MaintenanceList.js +5 -4
- package/dist/module/components/MaintenanceList.js.map +1 -1
- package/dist/module/components/MaintenanceListItem.js +3 -2
- package/dist/module/components/MaintenanceListItem.js.map +1 -1
- package/dist/module/components/MaintenanceWidgetItem.js +2 -1
- package/dist/module/components/MaintenanceWidgetItem.js.map +1 -1
- package/dist/module/components/WidgetSmall.js +8 -5
- package/dist/module/components/WidgetSmall.js.map +1 -1
- package/dist/module/feature.config.js +21 -36
- package/dist/module/feature.config.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 +2 -1
- package/dist/module/reducers/JobsReducer.js.map +1 -1
- package/dist/module/screens/MaintenancePage.js +7 -3
- package/dist/module/screens/MaintenancePage.js.map +1 -1
- package/dist/module/screens/RequestDetail.js +106 -31
- package/dist/module/screens/RequestDetail.js.map +1 -1
- package/dist/module/screens/RequestNotes.js +2 -1
- package/dist/module/screens/RequestNotes.js.map +1 -1
- package/dist/module/screens/ServiceRequest.js +581 -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 +35 -0
- package/dist/module/values.config.default.js.map +1 -0
- package/dist/module/values.config.forms.js +35 -0
- package/dist/module/values.config.forms.js.map +1 -0
- package/dist/module/values.config.js +35 -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 +6 -4
- package/src/components/MaintenanceListItem.js +7 -2
- package/src/components/MaintenanceWidgetItem.js +2 -1
- package/src/components/WidgetSmall.js +8 -5
- package/src/feature.config.js +30 -40
- package/src/index.js +15 -8
- package/src/reducers/JobsReducer.js +2 -1
- package/src/screens/MaintenancePage.js +5 -4
- package/src/screens/RequestDetail.js +101 -33
- package/src/screens/RequestNotes.js +2 -1
- package/src/screens/ServiceRequest.js +625 -152
- 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 +35 -0
- package/src/values.config.forms.js +35 -0
- package/src/values.config.js +35 -0
@@ -11,6 +11,7 @@ import StatusSelectorPopup from '../components/StatusSelectorPopup';
|
|
11
11
|
import { jobStatusOptions, getJobStatusProps } from '../helper';
|
12
12
|
import { Services } from '../feature.config';
|
13
13
|
import { Colours, Helper, Components, Config } from '../core.config';
|
14
|
+
import { values } from '../values.config';
|
14
15
|
|
15
16
|
class RequestDetail extends Component {
|
16
17
|
constructor(props) {
|
@@ -30,6 +31,7 @@ class RequestDetail extends Component {
|
|
30
31
|
showFullscreenVideo: false,
|
31
32
|
currentVideoUrl: '',
|
32
33
|
galleryOpen: false,
|
34
|
+
galleryImages: [],
|
33
35
|
showMessages: false,
|
34
36
|
assignees: [],
|
35
37
|
};
|
@@ -173,7 +175,7 @@ class RequestDetail extends Component {
|
|
173
175
|
};
|
174
176
|
|
175
177
|
openStaffNotes = () => {
|
176
|
-
Services.navigation.navigate(
|
178
|
+
Services.navigation.navigate(values.screenRequestNotes, { job: this.state.job, onChange: this.getJob });
|
177
179
|
};
|
178
180
|
|
179
181
|
onOpenDatePicker = () => {
|
@@ -232,10 +234,10 @@ class RequestDetail extends Component {
|
|
232
234
|
hasPermission = () => {
|
233
235
|
const { job } = this.state;
|
234
236
|
const { permissions } = this.props.user;
|
235
|
-
if (_.includes(permissions,
|
237
|
+
if (_.includes(permissions, values.permissionMaintenanceTracking)) {
|
236
238
|
return true;
|
237
239
|
}
|
238
|
-
if (_.includes(permissions,
|
240
|
+
if (_.includes(permissions, values.permissionMaintenanceAssign)) {
|
239
241
|
return job.AssigneeId === this.props.user.Id;
|
240
242
|
}
|
241
243
|
return false;
|
@@ -246,9 +248,10 @@ class RequestDetail extends Component {
|
|
246
248
|
this.setState({ showFullscreenVideo: url.length > 0, currentVideoUrl: url });
|
247
249
|
};
|
248
250
|
|
249
|
-
openGallery(index) {
|
251
|
+
openGallery(galleryImages, index) {
|
250
252
|
this.setState({
|
251
253
|
galleryOpen: true,
|
254
|
+
galleryImages,
|
252
255
|
});
|
253
256
|
this.refs.imagePopup.scrollTo(index);
|
254
257
|
}
|
@@ -299,7 +302,9 @@ class RequestDetail extends Component {
|
|
299
302
|
return (
|
300
303
|
<View style={{ ...Helper.getShadowStyle() }}>
|
301
304
|
<View style={styles.jobTitleContainer}>
|
302
|
-
{job.jobId ?
|
305
|
+
{job.jobId ? (
|
306
|
+
<Text style={[styles.jobIdText, { color: this.props.colourBrandingMain }]}>{`${values.textEntityName} #${job.jobId}`}</Text>
|
307
|
+
) : null}
|
303
308
|
<Text style={styles.jobTitleText}>{job.title}</Text>
|
304
309
|
<View style={styles.jobTypeSeenContainer}>
|
305
310
|
<View style={[styles.jobTypeContainer, { backgroundColor: Colours.hexToRGBAstring(this.props.colourBrandingMain, 0.2) }]}>
|
@@ -362,7 +367,8 @@ class RequestDetail extends Component {
|
|
362
367
|
);
|
363
368
|
}
|
364
369
|
|
365
|
-
renderPlayableImageUrl(
|
370
|
+
renderPlayableImageUrl(images, index, containerStyle, showMore) {
|
371
|
+
const url = images[index || 0];
|
366
372
|
const thumbUrl = Helper.getThumb300(url);
|
367
373
|
|
368
374
|
if (Helper.isVideo(url)) {
|
@@ -379,7 +385,7 @@ class RequestDetail extends Component {
|
|
379
385
|
|
380
386
|
const imageUrl = Helper.get1400(url);
|
381
387
|
return (
|
382
|
-
<TouchableOpacity style={containerStyle} onPress={this.openGallery.bind(this, index || 0)}>
|
388
|
+
<TouchableOpacity style={containerStyle} onPress={this.openGallery.bind(this, images, index || 0)}>
|
383
389
|
<ImageBackground style={styles.imageContainer} source={{ uri: imageUrl }}>
|
384
390
|
{showMore && <Text style={styles.plusImages}>+{this.state.job.images.length - 2}</Text>}
|
385
391
|
</ImageBackground>
|
@@ -387,26 +393,24 @@ class RequestDetail extends Component {
|
|
387
393
|
);
|
388
394
|
}
|
389
395
|
|
390
|
-
renderPlayableImage(index, containerStyle, showMore) {
|
391
|
-
|
392
|
-
return this.renderPlayableImageUrl(url, index, containerStyle, showMore);
|
396
|
+
renderPlayableImage(images, index, containerStyle, showMore) {
|
397
|
+
return this.renderPlayableImageUrl(images, index, containerStyle, showMore);
|
393
398
|
}
|
394
399
|
|
395
|
-
renderImage() {
|
396
|
-
|
397
|
-
|
398
|
-
if (job.images.length >= 2) {
|
400
|
+
renderImage(images, image = null) {
|
401
|
+
if (!_.isNil(images) && !_.isEmpty(images)) {
|
402
|
+
if (images.length >= 2) {
|
399
403
|
return (
|
400
404
|
<View style={styles.sideBySideImages}>
|
401
|
-
{this.renderPlayableImage(0, styles.sideBySideImageContainer)}
|
402
|
-
{this.renderPlayableImage(1, styles.sideBySideImageContainer,
|
405
|
+
{this.renderPlayableImage(images, 0, styles.sideBySideImageContainer)}
|
406
|
+
{this.renderPlayableImage(images, 1, styles.sideBySideImageContainer, images.length > 2)}
|
403
407
|
</View>
|
404
408
|
);
|
405
409
|
} else {
|
406
|
-
return <View style={styles.singleImageContainer}>{this.renderPlayableImage(0)}</View>;
|
410
|
+
return <View style={styles.singleImageContainer}>{this.renderPlayableImage(images, 0)}</View>;
|
407
411
|
}
|
408
|
-
} else if (!_.isNil(
|
409
|
-
return <View style={styles.singleImageContainer}>{this.renderPlayableImageUrl(
|
412
|
+
} else if (!_.isNil(image)) {
|
413
|
+
return <View style={styles.singleImageContainer}>{this.renderPlayableImageUrl([image], 0)}</View>;
|
410
414
|
}
|
411
415
|
return null;
|
412
416
|
}
|
@@ -415,7 +419,7 @@ class RequestDetail extends Component {
|
|
415
419
|
return (
|
416
420
|
<Components.ImagePopup
|
417
421
|
visible={this.state.galleryOpen}
|
418
|
-
images={this.state.
|
422
|
+
images={this.state.galleryImages}
|
419
423
|
onClose={this.closeGallery.bind(this)}
|
420
424
|
ref="imagePopup"
|
421
425
|
/>
|
@@ -458,8 +462,43 @@ class RequestDetail extends Component {
|
|
458
462
|
return content;
|
459
463
|
}
|
460
464
|
|
465
|
+
renderCustomFields() {
|
466
|
+
const { job } = this.state;
|
467
|
+
const { customFields } = job;
|
468
|
+
|
469
|
+
const renderAnswer = field => {
|
470
|
+
switch (field.type) {
|
471
|
+
case 'date':
|
472
|
+
return <Text style={styles.customText}>{field.answer ? moment(field.answer, 'YYYY-MM-DD').format('DD MMM YYYY') : ''}</Text>;
|
473
|
+
case 'time':
|
474
|
+
return <Text style={styles.customText}>{field.answer ? moment(field.answer, 'HH:mm').format('h:mm a') : ''}</Text>;
|
475
|
+
case 'yn':
|
476
|
+
return <Text style={styles.customText}>{field.answer ? 'Yes' : 'No'}</Text>;
|
477
|
+
case 'checkbox':
|
478
|
+
return <Text style={styles.customText}>{field.answer && Array.isArray(field.answer) ? field.answer.join(', ') : ''}</Text>;
|
479
|
+
case 'image':
|
480
|
+
return <View style={{ marginTop: 8 }}>{this.renderImage(field.answer)}</View>;
|
481
|
+
default:
|
482
|
+
return <Text style={styles.customText}>{field.answer}</Text>;
|
483
|
+
}
|
484
|
+
};
|
485
|
+
|
486
|
+
return customFields.map((field, index) => {
|
487
|
+
if (['staticTitle', 'staticText'].includes(field.type)) return null;
|
488
|
+
if (_.isNil(field.answer) || field.answer === '' || (Array.isArray(field.answer) && field.answer.length === 0)) return null;
|
489
|
+
return (
|
490
|
+
<View key={index}>
|
491
|
+
<Text style={styles.customLabel}>{field.label}</Text>
|
492
|
+
{renderAnswer(field)}
|
493
|
+
</View>
|
494
|
+
);
|
495
|
+
});
|
496
|
+
}
|
497
|
+
|
461
498
|
rendeDetails() {
|
462
499
|
const { job } = this.state;
|
500
|
+
const { customFields } = job;
|
501
|
+
const hasCustomFields = customFields && customFields.length > 0;
|
463
502
|
|
464
503
|
return (
|
465
504
|
<View>
|
@@ -472,21 +511,26 @@ class RequestDetail extends Component {
|
|
472
511
|
/>
|
473
512
|
{this.state.showMore && (
|
474
513
|
<View>
|
475
|
-
{this.
|
476
|
-
{!
|
477
|
-
|
478
|
-
{job.
|
479
|
-
|
480
|
-
|
481
|
-
|
514
|
+
{hasCustomFields ? this.renderCustomFields() : null}
|
515
|
+
{!hasCustomFields ? (
|
516
|
+
<>
|
517
|
+
{this.renderImage(job.images, job.image)}
|
518
|
+
{!_.isEmpty(job.description) && (
|
519
|
+
<Text numberOfLines={10} style={styles.jobDescriptionText}>
|
520
|
+
{job.description}
|
521
|
+
</Text>
|
522
|
+
)}
|
523
|
+
</>
|
524
|
+
) : null}
|
525
|
+
<Text style={styles.locationLabel}>Address</Text>
|
482
526
|
<Text style={styles.locationText}>{job.room}</Text>
|
483
|
-
{job.isHome ? (
|
527
|
+
{!hasCustomFields && job.isHome ? (
|
484
528
|
<View style={styles.detailsSection}>
|
485
529
|
<Text style={styles.locationLabel}>Must be home</Text>
|
486
530
|
<Text style={styles.locationText}>{job.homeText}</Text>
|
487
531
|
</View>
|
488
532
|
) : null}
|
489
|
-
<Text style={styles.requesterLabel}>
|
533
|
+
<Text style={styles.requesterLabel}>Submitted By</Text>
|
490
534
|
<View style={styles.profileContainer}>
|
491
535
|
<Components.ProfilePic ProfilePic={job.userProfilePic} Diameter={40} />
|
492
536
|
<View style={styles.nameContainer}>
|
@@ -507,8 +551,8 @@ class RequestDetail extends Component {
|
|
507
551
|
ref={this.commentSection}
|
508
552
|
commentReply={this.commentReply}
|
509
553
|
scrollView={this.scrollView}
|
510
|
-
adminPermission=
|
511
|
-
entityType=
|
554
|
+
adminPermission={values.permissionMaintenanceTracking}
|
555
|
+
entityType={values.featureKey}
|
512
556
|
entityId={this.props.job.id}
|
513
557
|
entityName={this.props.job.title}
|
514
558
|
site={this.state.job.site || this.state.job.location}
|
@@ -545,7 +589,7 @@ class RequestDetail extends Component {
|
|
545
589
|
ref={this.commentReply}
|
546
590
|
commentSection={this.commentSection}
|
547
591
|
scrollView={this.scrollView}
|
548
|
-
entityType=
|
592
|
+
entityType={values.featureKey}
|
549
593
|
entityId={this.props.job.id}
|
550
594
|
entityName={this.props.job.title}
|
551
595
|
site={this.state.job.site || this.state.job.location}
|
@@ -834,13 +878,37 @@ const styles = StyleSheet.create({
|
|
834
878
|
marginLeft: 10,
|
835
879
|
lineHeight: 24,
|
836
880
|
},
|
881
|
+
customLabel: {
|
882
|
+
fontFamily: 'sf-bold',
|
883
|
+
fontSize: 14,
|
884
|
+
color: Colours.TEXT_DARKEST,
|
885
|
+
},
|
886
|
+
customText: {
|
887
|
+
fontFamily: 'sf-regular',
|
888
|
+
fontSize: 16,
|
889
|
+
color: Colours.TEXT_DARKEST,
|
890
|
+
paddingVertical: 8,
|
891
|
+
},
|
892
|
+
customStaticTitle: {
|
893
|
+
fontSize: 20,
|
894
|
+
fontFamily: 'sf-semibold',
|
895
|
+
color: Colours.TEXT_DARKEST,
|
896
|
+
marginBottom: 10,
|
897
|
+
},
|
898
|
+
customStaticText: {
|
899
|
+
fontSize: 17,
|
900
|
+
fontFamily: 'sf-regular',
|
901
|
+
color: Colours.TEXT_DARKEST,
|
902
|
+
lineHeight: 24,
|
903
|
+
marginBottom: 10,
|
904
|
+
},
|
837
905
|
});
|
838
906
|
|
839
907
|
const mapStateToProps = state => {
|
840
908
|
return {
|
841
909
|
user: state.user,
|
842
910
|
colourBrandingMain: Colours.getMainBrandingColourFromState(state),
|
843
|
-
jobs: state.
|
911
|
+
jobs: state[values.reducerKey].jobs,
|
844
912
|
};
|
845
913
|
};
|
846
914
|
|
@@ -9,6 +9,7 @@ import { maintenanceActions } from '../apis';
|
|
9
9
|
import { getBottomSpace } from 'react-native-iphone-x-helper';
|
10
10
|
import { Services } from '../feature.config';
|
11
11
|
import { Components, Colours, Helper } from '../core.config';
|
12
|
+
import { values } from '../values.config';
|
12
13
|
|
13
14
|
class RequestNotes extends Component {
|
14
15
|
constructor(props) {
|
@@ -410,7 +411,7 @@ const mapStateToProps = state => {
|
|
410
411
|
user: state.user,
|
411
412
|
colourBrandingMain: Colours.getMainBrandingColourFromState(state),
|
412
413
|
colourBrandingLight: Colours.getLightBrandingColourFromState(state),
|
413
|
-
jobs: state.
|
414
|
+
jobs: state[values.reducerKey].jobs,
|
414
415
|
};
|
415
416
|
};
|
416
417
|
|