@jescon-technologies/react-native-ui-kit 0.0.1 → 0.0.2
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/index.js +70 -0
- package/package.json +26 -3
- package/src/Alerts/AAlert.js +1 -1
- package/src/HOC/ConfirmOverlay.js +192 -0
- package/src/HOC/HAbsolute.js +56 -0
- package/src/HOC/HDiscontinue.js +105 -0
- package/src/HOC/HHeading.js +70 -0
- package/src/HOC/HMoreButton.js +88 -0
- package/src/HOC/HNatureHeading.js +402 -0
- package/src/HOC/HOCIcons.js +80 -0
- package/src/HOC/HOverlay.js +99 -0
- package/src/HOC/HOverlayCentered.js +140 -0
- package/src/HOC/HShadowButton.js +45 -0
- package/src/HOC/HShadowCountButton.js +82 -0
- package/src/HOC/OptionOverlay.js +48 -0
- package/src/Media/AudioScreen.js +347 -0
- package/src/Media/BarcodeScan.js +145 -0
- package/src/Media/CAudioPlay.js +228 -0
- package/src/Media/CCaptureImageWithoutEdit.js +330 -0
- package/src/Media/CImageGallery.js +289 -0
- package/src/Media/CImageZoom.js +82 -0
- package/src/Media/CSingleImage.js +391 -0
- package/src/Media/CSketchCanvas.js +76 -0
- package/src/Media/CVideoPlay.js +31 -0
- package/src/Media/DocumentScreen.js +367 -0
- package/src/Media/DrawingScreen.js +582 -0
- package/src/Media/ImageScreen.js +313 -0
- package/src/Media/RecordAudio.js +250 -0
- package/src/Media/RecordVideo.js +223 -0
- package/src/Media/VideoScreen.js +383 -0
- package/src/StaticComponents/SAlphabet.js +47 -0
- package/src/StaticComponents/SCheckBox.js +42 -0
- package/src/StaticComponents/SDatePicker.js +208 -0
- package/src/StaticComponents/SDatePickerLabel.js +253 -0
- package/src/StaticComponents/SDatePickerNew.js +258 -0
- package/src/StaticComponents/SDateTimePickerNew.js +381 -0
- package/src/StaticComponents/SDropDownGenerate.js +450 -0
- package/src/StaticComponents/SDropDownHoc.js +636 -0
- package/src/StaticComponents/SDropDownIcon.js +500 -0
- package/src/StaticComponents/SMenuBox.js +131 -0
- package/src/StaticComponents/SOverlay.js +177 -0
- package/src/StaticComponents/SOverlayTextInput.js +109 -0
- package/src/StaticComponents/SSearch.js +438 -0
- package/src/StaticComponents/SSearchBar.js +53 -0
- package/src/StaticComponents/SSpeedDial.js +303 -0
- package/src/StaticComponents/STextInput.js +289 -0
- package/src/StaticComponents/STextInputProps.js +36 -0
- package/src/StaticComponents/STimePicker.js +171 -0
- package/src/StaticComponents/STimingDropDownNew.js +1589 -0
- package/src/StaticComponents/STimingSwitch.js +34 -0
- package/src/layout/CContainerView.js +21 -0
- package/src/layout/CDetailView.js +81 -0
- package/src/layout/FooterBlock.js +0 -3
- package/src/layout/HeaderBlock.js +353 -0
- package/src/index.js +0 -15
- package/src/screens/ForgotPassword.js +0 -346
- package/src/screens/Login.js +0 -328
- package/src/screens/Splash.js +0 -788
- /package/src/{components → layout}/Loader.js +0 -0
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
import React, {useState, useEffect, memo, useContext} from 'react';
|
|
2
|
+
import {
|
|
3
|
+
SafeAreaView,
|
|
4
|
+
Image,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
Dimensions,
|
|
7
|
+
Button,
|
|
8
|
+
FlatList,
|
|
9
|
+
Text,
|
|
10
|
+
View,
|
|
11
|
+
TouchableOpacity,
|
|
12
|
+
PermissionsAndroid,
|
|
13
|
+
ActivityIndicator,
|
|
14
|
+
Platform,
|
|
15
|
+
} from 'react-native';
|
|
16
|
+
import {audioURL, pdfURL, APIURL} from '../Common/apiConstants';
|
|
17
|
+
import Fontisto from 'react-native-vector-icons/Fontisto';
|
|
18
|
+
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
19
|
+
import {Global} from '../Common/Global';
|
|
20
|
+
// import DocumentPicker from 'react-native-document-picker';
|
|
21
|
+
import { useNavigation } from '../Navigation/useNavigation';
|
|
22
|
+
|
|
23
|
+
import {notifyMessage} from '../CommonStyle/ComponentFunctions';
|
|
24
|
+
import ReactNativeBlobUtil from 'react-native-blob-util';
|
|
25
|
+
import NetworkServiceCall from '../Common/NetworkServiceCall';
|
|
26
|
+
import EmrResponseComponentContext from '../Handlers/emrResponseComponentContext';
|
|
27
|
+
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
28
|
+
import FontAwesome from 'react-native-vector-icons/FontAwesome';
|
|
29
|
+
|
|
30
|
+
function DocumentScreen(props) {
|
|
31
|
+
const {responseJSON, setResponseJSON} = useContext(
|
|
32
|
+
EmrResponseComponentContext,
|
|
33
|
+
);
|
|
34
|
+
const navigation = useNavigation();
|
|
35
|
+
const windowWidth = Dimensions.get('window').width;
|
|
36
|
+
const windowHeight = Dimensions.get('window').height;
|
|
37
|
+
|
|
38
|
+
const [data, setData] = useState(
|
|
39
|
+
props.data?.savedpdf ? props?.data.savedpdf : null,
|
|
40
|
+
);
|
|
41
|
+
const [refreshCount, setrefreshCount] = useState(1);
|
|
42
|
+
const [mediaUrlLink, setMediaUrlLink] = useState(false);
|
|
43
|
+
const [isAudioShow, setAudioShow] = useState(false);
|
|
44
|
+
const [deleteAudio, setDeleteAudio] = useState(false);
|
|
45
|
+
const [loading, setLoading] = useState(false);
|
|
46
|
+
const [process, setProcess] = useState('');
|
|
47
|
+
const [disablesave, setDisablesave] = useState(true);
|
|
48
|
+
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
props.setData(data);
|
|
51
|
+
}, [data]);
|
|
52
|
+
|
|
53
|
+
function deleteSelectedAudio(itemid) {
|
|
54
|
+
data
|
|
55
|
+
.filter(item => item.deletestatus === true)
|
|
56
|
+
.forEach(item => data.splice(data.indexOf(item), 1));
|
|
57
|
+
setDeleteAudio(!deleteAudio);
|
|
58
|
+
props.editStatus(1);
|
|
59
|
+
setrefreshCount(refreshCount + 1);
|
|
60
|
+
console.log('audiooooooooooooooooooooo', data);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function changeStatus(data) {
|
|
64
|
+
data.item.deletestatus = !data.item.deletestatus;
|
|
65
|
+
setrefreshCount(refreshCount + 1);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function renderDocument(data) {
|
|
69
|
+
return (
|
|
70
|
+
<View style={{flexDirection: 'row'}}>
|
|
71
|
+
<View style={{alignItems: 'center', flexDirection: 'row'}}>
|
|
72
|
+
<TouchableOpacity
|
|
73
|
+
onLongPress={() => setDeleteAudio(true)}
|
|
74
|
+
style={{flexDirection: 'row'}}
|
|
75
|
+
onPress={() =>
|
|
76
|
+
navigation.navigate('PdfViewer', {
|
|
77
|
+
document: pdfURL + data.item.filename,
|
|
78
|
+
})
|
|
79
|
+
}>
|
|
80
|
+
<Image
|
|
81
|
+
style={{
|
|
82
|
+
height: windowHeight * 0.15,
|
|
83
|
+
width: windowWidth * 0.3,
|
|
84
|
+
margin: 5,
|
|
85
|
+
resizeMode: 'cover',
|
|
86
|
+
borderRadius: 10,
|
|
87
|
+
}}
|
|
88
|
+
source={{
|
|
89
|
+
uri: 'https://play-lh.googleusercontent.com/nufRXPpDI9XP8mPdAvOoJULuBIH_OK4YbZZVu8i_-eDPulZpgb-Xp-EmI8Z53AlXHpqX',
|
|
90
|
+
}}
|
|
91
|
+
/>
|
|
92
|
+
</TouchableOpacity>
|
|
93
|
+
{deleteAudio ? (
|
|
94
|
+
<TouchableOpacity onPress={() => changeStatus(data)}>
|
|
95
|
+
<View style={{justifyContent: 'center', alignItems: 'center'}}>
|
|
96
|
+
<Fontisto
|
|
97
|
+
name={
|
|
98
|
+
!data.item.deletestatus
|
|
99
|
+
? 'checkbox-passive'
|
|
100
|
+
: 'checkbox-active'
|
|
101
|
+
}
|
|
102
|
+
size={25}
|
|
103
|
+
color={!data.item.deletestatus ? 'lightgrey' : 'blue'}
|
|
104
|
+
/>
|
|
105
|
+
</View>
|
|
106
|
+
</TouchableOpacity>
|
|
107
|
+
) : null}
|
|
108
|
+
</View>
|
|
109
|
+
</View>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function firebasepdfsave() {
|
|
114
|
+
data.map(item => {
|
|
115
|
+
if (item.uritype == false) {
|
|
116
|
+
firebaseupload(item);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const firebaseupload = async item => {
|
|
122
|
+
// console.log("firebaseupload", item.uri)
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const isPermitted = async () => {
|
|
126
|
+
if (Platform.OS === 'android') {
|
|
127
|
+
try {
|
|
128
|
+
const granted = await PermissionsAndroid.request(
|
|
129
|
+
PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE,
|
|
130
|
+
);
|
|
131
|
+
return granted === PermissionsAndroid.RESULTS.GRANTED;
|
|
132
|
+
} catch (err) {
|
|
133
|
+
alert('Write permission err', err);
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
} else {
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const getResolvedPath = async (uri, filen) => {
|
|
142
|
+
setLoading(true);
|
|
143
|
+
const fileBase64 = await ReactNativeBlobUtil.fs.readFile(uri, 'base64');
|
|
144
|
+
const relativePath = ReactNativeBlobUtil.fs.dirs.CacheDir;
|
|
145
|
+
const fileName = `${filen}`;
|
|
146
|
+
const path = `${relativePath}/${fileName}`;
|
|
147
|
+
|
|
148
|
+
await ReactNativeBlobUtil.fs.writeFile(path, fileBase64, 'base64');
|
|
149
|
+
return {relativePath, fileName, path};
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const browsePDF = async () => {
|
|
153
|
+
if (await isPermitted()) {
|
|
154
|
+
try {
|
|
155
|
+
const fileDetails = await DocumentPicker.pick({
|
|
156
|
+
type: [DocumentPicker.types.pdf],
|
|
157
|
+
});
|
|
158
|
+
const {relativePath, fileName, path} = await getResolvedPath(
|
|
159
|
+
fileDetails[0].uri,
|
|
160
|
+
fileDetails[0].name,
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
let fileid_autogenerate =
|
|
164
|
+
data != null && data.length > 0 ? data.length : 0;
|
|
165
|
+
let dataset = {
|
|
166
|
+
fileid: fileid_autogenerate + 1,
|
|
167
|
+
uri: 'file://' + path,
|
|
168
|
+
filename: fileDetails[0].name,
|
|
169
|
+
uritype: false,
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
setLoading(false);
|
|
173
|
+
Media_Upload(dataset);
|
|
174
|
+
|
|
175
|
+
} catch (error) {
|
|
176
|
+
notifyMessage(
|
|
177
|
+
DocumentPicker.isCancel(error)
|
|
178
|
+
? 'Canceled'
|
|
179
|
+
: 'Unknown Error: ' + JSON.stringify(error),
|
|
180
|
+
2,
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
async function Media_Upload(image) {
|
|
187
|
+
setLoading(true);
|
|
188
|
+
console.log('imageeeeeeeeeee upload', JSON.stringify(image));
|
|
189
|
+
let date = new Date().getDate();
|
|
190
|
+
let month = new Date().getMonth() + 1;
|
|
191
|
+
let year = new Date().getFullYear();
|
|
192
|
+
let hours = new Date().getHours();
|
|
193
|
+
let min = new Date().getMinutes();
|
|
194
|
+
let sec = new Date().getSeconds();
|
|
195
|
+
let millisec = new Date().getMilliseconds();
|
|
196
|
+
let uniquename = '.pdf';
|
|
197
|
+
|
|
198
|
+
let fileid_autogenerate = data != null && data.length > 0 ? data.length : 0;
|
|
199
|
+
let dataset2 = {
|
|
200
|
+
fileid: fileid_autogenerate + 1,
|
|
201
|
+
filename: uniquename,
|
|
202
|
+
filetype: 'application/pdf',
|
|
203
|
+
uri: image.uri,
|
|
204
|
+
uritype: false,
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
if (!dataset2.uritype) {
|
|
208
|
+
if (dataset2.uri) {
|
|
209
|
+
var formData = new FormData();
|
|
210
|
+
formData.append('file', {
|
|
211
|
+
uri: dataset2.uri,
|
|
212
|
+
type: dataset2.filetype,
|
|
213
|
+
name: dataset2.filename,
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
console.log('formData>>>>>>>>>>>>>', JSON.stringify(formData));
|
|
217
|
+
let buttonapi = APIURL + 'file/fileupload/emr/document';
|
|
218
|
+
console.log('buttonapi', buttonapi);
|
|
219
|
+
|
|
220
|
+
NetworkServiceCall('multiform', buttonapi, formData)
|
|
221
|
+
.then(function (responsedata) {
|
|
222
|
+
console.log(
|
|
223
|
+
'responsedata>>>>>>>>>>>>>>>',
|
|
224
|
+
JSON.stringify(responsedata),
|
|
225
|
+
);
|
|
226
|
+
if (responsedata.httpstatus == 200) {
|
|
227
|
+
dataset2.filename = responsedata.data.fileuri;
|
|
228
|
+
setData(
|
|
229
|
+
data != null
|
|
230
|
+
? prevData => [...prevData, dataset2.filename]
|
|
231
|
+
: [dataset2.filename],
|
|
232
|
+
);
|
|
233
|
+
responseJSON.consultationEdit.editStatus = true;
|
|
234
|
+
setrefreshCount(refreshCount + 1);
|
|
235
|
+
props.editStatus(1);
|
|
236
|
+
props.data.usertype =
|
|
237
|
+
Global.PatientDetails != undefined &&
|
|
238
|
+
Global.PatientDetails.usertype != undefined &&
|
|
239
|
+
Global.PatientDetails.usertype != null
|
|
240
|
+
? Global.PatientDetails.usertype
|
|
241
|
+
: 'Z';
|
|
242
|
+
props.data.suuser =
|
|
243
|
+
Global.userData != undefined &&
|
|
244
|
+
Global.userData.suuser != undefined &&
|
|
245
|
+
Global.userData.suuser != null
|
|
246
|
+
? Global.userData.suuser
|
|
247
|
+
: 0;
|
|
248
|
+
setLoading(false);
|
|
249
|
+
} else {
|
|
250
|
+
setLoading(false);
|
|
251
|
+
}
|
|
252
|
+
})
|
|
253
|
+
.catch(error => {
|
|
254
|
+
console.log('errorrrrrrrrrr', JSON.stringify(error));
|
|
255
|
+
setLoading(false);
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
return (
|
|
262
|
+
<View style={{flex: 1}}>
|
|
263
|
+
<View style={styles.itemContainer}>
|
|
264
|
+
{/* Delete Button */}
|
|
265
|
+
{deleteAudio && (
|
|
266
|
+
<TouchableOpacity
|
|
267
|
+
style={styles.deleteButton}
|
|
268
|
+
onPress={deleteSelectedAudio}>
|
|
269
|
+
<AntDesign name="delete" size={30} color={'red'} />
|
|
270
|
+
<Text style={styles.deleteText}>Delete Selected</Text>
|
|
271
|
+
</TouchableOpacity>
|
|
272
|
+
)}
|
|
273
|
+
|
|
274
|
+
{/* Documents Grid */}
|
|
275
|
+
<FlatList
|
|
276
|
+
data={data}
|
|
277
|
+
renderItem={renderDocument}
|
|
278
|
+
contentContainerStyle={{alignItems: 'center', paddingTop: 10}}
|
|
279
|
+
keyExtractor={item => item.id}
|
|
280
|
+
numColumns={3}
|
|
281
|
+
/>
|
|
282
|
+
|
|
283
|
+
{/* Loading Indicator */}
|
|
284
|
+
{loading && (
|
|
285
|
+
<View style={styles.loadingContainer}>
|
|
286
|
+
<ActivityIndicator size="large" color="#0000ff" />
|
|
287
|
+
</View>
|
|
288
|
+
)}
|
|
289
|
+
</View>
|
|
290
|
+
|
|
291
|
+
{/* Bottom Action Bar */}
|
|
292
|
+
<View style={styles.bottomActionBar}>
|
|
293
|
+
<TouchableOpacity
|
|
294
|
+
style={styles.actionButton}
|
|
295
|
+
onPress={browsePDF}>
|
|
296
|
+
<MaterialIcons name="insert-drive-file" color={'white'} size={24} />
|
|
297
|
+
<Text style={styles.actionButtonText}>Browse PDF</Text>
|
|
298
|
+
</TouchableOpacity>
|
|
299
|
+
|
|
300
|
+
<TouchableOpacity
|
|
301
|
+
style={[styles.actionButton, disablesave && styles.disabledButton]}
|
|
302
|
+
disabled={disablesave}
|
|
303
|
+
onPress={firebasepdfsave}>
|
|
304
|
+
<FontAwesome name="save" color={'white'} size={24} />
|
|
305
|
+
<Text style={styles.actionButtonText}>Save All</Text>
|
|
306
|
+
</TouchableOpacity>
|
|
307
|
+
</View>
|
|
308
|
+
</View>
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
const styles = StyleSheet.create({
|
|
313
|
+
itemContainer: {
|
|
314
|
+
flex: 1,
|
|
315
|
+
backgroundColor: '#f5f5f5',
|
|
316
|
+
},
|
|
317
|
+
deleteButton: {
|
|
318
|
+
flexDirection: 'row',
|
|
319
|
+
alignItems: 'center',
|
|
320
|
+
justifyContent: 'center',
|
|
321
|
+
padding: 10,
|
|
322
|
+
backgroundColor: '#ffebee',
|
|
323
|
+
marginHorizontal: 10,
|
|
324
|
+
borderRadius: 5,
|
|
325
|
+
marginTop: 10,
|
|
326
|
+
},
|
|
327
|
+
deleteText: {
|
|
328
|
+
marginLeft: 10,
|
|
329
|
+
color: 'red',
|
|
330
|
+
fontSize: 16,
|
|
331
|
+
fontWeight: 'bold',
|
|
332
|
+
},
|
|
333
|
+
loadingContainer: {
|
|
334
|
+
position: 'absolute',
|
|
335
|
+
top: 0,
|
|
336
|
+
left: 0,
|
|
337
|
+
right: 0,
|
|
338
|
+
bottom: 0,
|
|
339
|
+
justifyContent: 'center',
|
|
340
|
+
alignItems: 'center',
|
|
341
|
+
backgroundColor: 'rgba(255, 255, 255, 0.8)',
|
|
342
|
+
},
|
|
343
|
+
bottomActionBar: {
|
|
344
|
+
flexDirection: 'row',
|
|
345
|
+
backgroundColor: 'darkblue',
|
|
346
|
+
height: 60,
|
|
347
|
+
justifyContent: 'space-around',
|
|
348
|
+
alignItems: 'center',
|
|
349
|
+
paddingHorizontal: 20,
|
|
350
|
+
},
|
|
351
|
+
actionButton: {
|
|
352
|
+
alignItems: 'center',
|
|
353
|
+
justifyContent: 'center',
|
|
354
|
+
padding: 10,
|
|
355
|
+
},
|
|
356
|
+
actionButtonText: {
|
|
357
|
+
color: 'white',
|
|
358
|
+
fontSize: 12,
|
|
359
|
+
marginTop: 5,
|
|
360
|
+
textAlign: 'center',
|
|
361
|
+
},
|
|
362
|
+
disabledButton: {
|
|
363
|
+
opacity: 0.5,
|
|
364
|
+
},
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
export default memo(DocumentScreen);
|