@plusscommunities/pluss-maintenance-app-forms 6.0.12 → 7.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.
@@ -1,7 +1,19 @@
1
1
  import React, { Component } from 'react';
2
- import { ScrollView, View, Text, TouchableOpacity, Modal, KeyboardAvoidingView, Platform, FlatList, Dimensions, ImageBackground, Keyboard } from 'react-native';
2
+ import {
3
+ ScrollView,
4
+ View,
5
+ Text,
6
+ TouchableOpacity,
7
+ Modal,
8
+ KeyboardAvoidingView,
9
+ Platform,
10
+ FlatList,
11
+ Dimensions,
12
+ ImageBackground,
13
+ Keyboard,
14
+ } from 'react-native';
3
15
  import { connect } from 'react-redux';
4
- import { Icon } from 'react-native-elements';
16
+ import { Icon } from '@rneui/themed';
5
17
  import _ from 'lodash';
6
18
  import moment from 'moment';
7
19
  import { jobAdded } from '../actions';
@@ -28,7 +40,7 @@ class RequestNotes extends Component {
28
40
  uploadingImage: false,
29
41
  galleryOpen: false,
30
42
  galleryImages: [],
31
- galleryIndex: 0
43
+ galleryIndex: 0,
32
44
  };
33
45
  this.checkThumb = null;
34
46
  }
@@ -97,7 +109,11 @@ class RequestNotes extends Component {
97
109
  const uploadingAttachments = _.some(this.state.noteAttachments, n => n.Uploading);
98
110
  const uploadingImages = _.some(this.state.noteImages, n => n.uploading);
99
111
  if (uploadingAttachments || uploadingImages) return false;
100
- return !_.isEmpty(this.state.noteInput) || !_.isEmpty(this.state.noteAttachments) || !_.isEmpty(this.state.noteImages.filter(img => !img.add));
112
+ return (
113
+ !_.isEmpty(this.state.noteInput) ||
114
+ !_.isEmpty(this.state.noteAttachments) ||
115
+ !_.isEmpty(this.state.noteImages.filter(img => !img.add))
116
+ );
101
117
  };
102
118
 
103
119
  openAddNote = () => {
@@ -121,7 +137,7 @@ class RequestNotes extends Component {
121
137
  };
122
138
 
123
139
  openEditNote = n => {
124
- const noteImages = [...((n.Images || []).map(i => ({ url: i, thumbNailUrl: Helper.getThumb300(i) }))), { add: true }];
140
+ const noteImages = [...(n.Images || []).map(i => ({ url: i, thumbNailUrl: Helper.getThumb300(i) })), { add: true }];
125
141
  this.setState({
126
142
  noteAttachments: n.Attachments || [],
127
143
  noteImages,
@@ -139,27 +155,18 @@ class RequestNotes extends Component {
139
155
 
140
156
  try {
141
157
  this.setState({ submittingNote: true });
142
- const attachments = this.state.noteAttachments.filter(a => !a.add).map(a => {
143
- return {
144
- Title: a.Title,
145
- Source: a.Source,
146
- };
147
- });
158
+ const attachments = this.state.noteAttachments
159
+ .filter(a => !a.add)
160
+ .map(a => {
161
+ return {
162
+ Title: a.Title,
163
+ Source: a.Source,
164
+ };
165
+ });
148
166
  const images = this.state.noteImages.filter(img => !img.add).map(img => img.url);
149
167
  const res = await (this.state.editingNote
150
- ? maintenanceActions.editNote(
151
- this.props.job.id,
152
- this.state.editingNote,
153
- this.state.noteInput,
154
- attachments,
155
- images,
156
- )
157
- : maintenanceActions.addNote(
158
- this.props.job.id,
159
- this.state.noteInput,
160
- attachments,
161
- images,
162
- ));
168
+ ? maintenanceActions.editNote(this.props.job.id, this.state.editingNote, this.state.noteInput, attachments, images)
169
+ : maintenanceActions.addNote(this.props.job.id, this.state.noteInput, attachments, images));
163
170
  this.setState(
164
171
  {
165
172
  job: res.data.job,
@@ -238,7 +245,7 @@ class RequestNotes extends Component {
238
245
  }, 2000);
239
246
  };
240
247
 
241
- removeImage = (index) => {
248
+ removeImage = index => {
242
249
  const imagesUpdate = this.getImages();
243
250
  imagesUpdate.splice(index, 1);
244
251
 
@@ -362,19 +369,17 @@ class RequestNotes extends Component {
362
369
  const imageUrl = Helper.get1400(url);
363
370
  return (
364
371
  <TouchableOpacity style={containerStyle} onPress={this.openGallery.bind(this, images, index || 0)}>
365
- <ImageBackground resizeMode='cover' style={styles.imageContainer} source={{ uri: imageUrl }} />
372
+ <ImageBackground resizeMode="cover" style={styles.imageContainer} source={{ uri: imageUrl }} />
366
373
  </TouchableOpacity>
367
374
  );
368
375
  }
369
376
 
370
377
  renderImages(note) {
371
- if (!note) return null
378
+ if (!note) return null;
372
379
  if (!_.isNil(note.Images) && !_.isEmpty(note.Images)) {
373
380
  return (
374
381
  <ScrollView horizontal style={styles.sideBySideImages}>
375
- {note.Images.map((_p, index) =>
376
- this.renderPlayableImageUrl(note.Images, index, styles.sideBySideImageContainer),
377
- )}
382
+ {note.Images.map((_p, index) => this.renderPlayableImageUrl(note.Images, index, styles.sideBySideImageContainer))}
378
383
  </ScrollView>
379
384
  );
380
385
  }
@@ -385,12 +390,7 @@ class RequestNotes extends Component {
385
390
  const { galleryOpen, galleryImages, galleryIndex } = this.state;
386
391
  console.log('renderimagepopup', { galleryOpen, galleryImages, galleryIndex });
387
392
  return (
388
- <Components.ImagePopup
389
- visible={galleryOpen}
390
- images={galleryImages}
391
- index={galleryIndex}
392
- onClose={this.closeGallery.bind(this)}
393
- />
393
+ <Components.ImagePopup visible={galleryOpen} images={galleryImages} index={galleryIndex} onClose={this.closeGallery.bind(this)} />
394
394
  );
395
395
  }
396
396
 
@@ -540,7 +540,7 @@ class RequestNotes extends Component {
540
540
  ) : (
541
541
  <ImageBackground
542
542
  style={styles.imageBackground}
543
- source={Helper.getImageSource(item.thumbNailExists ? item.thumbNailUrl : (item.url || item))}
543
+ source={Helper.getImageSource(item.thumbNailExists ? item.thumbNailUrl : item.url || item)}
544
544
  >
545
545
  {isVideoUrl && (
546
546
  <View style={styles.imagePlayContainer}>
@@ -13,7 +13,7 @@ import {
13
13
  Keyboard,
14
14
  } from 'react-native';
15
15
  import DateTimePicker from 'react-native-modal-datetime-picker';
16
- import { Icon } from 'react-native-elements';
16
+ import { Icon } from '@rneui/themed';
17
17
  import _ from 'lodash';
18
18
  import moment from 'moment';
19
19
  import { connect } from 'react-redux';
@@ -315,7 +315,7 @@ class MaintenanceRequest extends Component {
315
315
  console.log(res.data);
316
316
  this.getDefaultJob();
317
317
  })
318
- .catch(() => {});
318
+ .catch(() => { });
319
319
  }
320
320
 
321
321
  pickType(type) {