@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,140 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { View, Dimensions,Text } from 'react-native';
|
|
3
|
+
import Overlay from 'react-native-modal-overlay';
|
|
4
|
+
import Icons from '../Common/Icons';
|
|
5
|
+
import { normalize } from '../CommonStyle/componentStyle';
|
|
6
|
+
|
|
7
|
+
const HOverlayCentered = (WrapComponent) => {
|
|
8
|
+
|
|
9
|
+
const { width, height } = Dimensions.get('window');
|
|
10
|
+
return function (props) {
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
let isMounted = true;
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
function getPopupContainerStyle() {
|
|
16
|
+
return (
|
|
17
|
+
props.overlaystyle
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Overlay
|
|
23
|
+
visible={true}
|
|
24
|
+
onClose={() => props.visibility != undefined ? props.visibility(false) : null}
|
|
25
|
+
closeOnTouchOutside={ props.disableOnTouch ? false : true}
|
|
26
|
+
animationType="fadeInUp"
|
|
27
|
+
// containerStyle={{ backgroundColor: 'rgba(0, 0, 0, 0.233)' }}
|
|
28
|
+
containerStyle={{ backgroundColor: 'rgba(0, 0, 0, 0.233)' }}
|
|
29
|
+
animationDuration={500}
|
|
30
|
+
childrenWrapperStyle={getPopupContainerStyle()}>
|
|
31
|
+
<View style={{ flex: 1 }} >
|
|
32
|
+
|
|
33
|
+
{props.position && props.position != null && props.position != undefined ?
|
|
34
|
+
null
|
|
35
|
+
:
|
|
36
|
+
<View
|
|
37
|
+
style={{
|
|
38
|
+
flexDirection: 'row',
|
|
39
|
+
justifyContent: 'space-between',
|
|
40
|
+
alignItems: 'center',
|
|
41
|
+
width: Dimensions.get('screen').width,
|
|
42
|
+
borderWidth: 0,
|
|
43
|
+
borderTopLeftRadius: 10,
|
|
44
|
+
paddingVertical: normalize(5),
|
|
45
|
+
borderTopRightRadius: 10,
|
|
46
|
+
}}>
|
|
47
|
+
|
|
48
|
+
<View style={{
|
|
49
|
+
width: '10%',
|
|
50
|
+
borderWidth: 0,
|
|
51
|
+
}}>
|
|
52
|
+
<Text>{''}</Text>
|
|
53
|
+
</View>
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
<View style={{
|
|
57
|
+
flex: 1,
|
|
58
|
+
width: '80%',
|
|
59
|
+
borderWidth: 0,
|
|
60
|
+
justifyContent: 'center',
|
|
61
|
+
alignItems: 'center',
|
|
62
|
+
}}>
|
|
63
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'center' }}>
|
|
64
|
+
{props.overlayheading != null && props.overlayheading != undefined ?
|
|
65
|
+
<Icons.FontAwesome5
|
|
66
|
+
name={props.overlayicon != null && props.overlayicon != undefined ? props.overlayicon : 'file'}
|
|
67
|
+
color={'#000000'}
|
|
68
|
+
size={normalize(11)}
|
|
69
|
+
style={{ marginHorizontal: normalize(5) }}
|
|
70
|
+
/>
|
|
71
|
+
: null}
|
|
72
|
+
<Text style={{ color: '#000000', fontSize: normalize(11), fontWeight: 'bold', textAlign: 'center' }}>{props.overlayheading != null && props.overlayheading != undefined ? props.overlayheading : ''}</Text>
|
|
73
|
+
</View>
|
|
74
|
+
</View>
|
|
75
|
+
|
|
76
|
+
<View style={{
|
|
77
|
+
width: '10%',
|
|
78
|
+
borderWidth: 0,
|
|
79
|
+
}}>
|
|
80
|
+
<Text>{' '}</Text>
|
|
81
|
+
</View>
|
|
82
|
+
</View>
|
|
83
|
+
}
|
|
84
|
+
<WrapComponent
|
|
85
|
+
{...props}
|
|
86
|
+
/>
|
|
87
|
+
{props.position && props.position != null && props.position != undefined && props.position == true ?
|
|
88
|
+
<View
|
|
89
|
+
style={{
|
|
90
|
+
position: 'absolute',
|
|
91
|
+
flexDirection: 'row',
|
|
92
|
+
justifyContent: 'space-between',
|
|
93
|
+
alignItems: 'center',
|
|
94
|
+
width: Dimensions.get('screen').width,
|
|
95
|
+
borderWidth: 0,
|
|
96
|
+
borderTopLeftRadius: 10,
|
|
97
|
+
paddingVertical: normalize(5),
|
|
98
|
+
borderTopRightRadius: 10,
|
|
99
|
+
}}>
|
|
100
|
+
|
|
101
|
+
<View style={{
|
|
102
|
+
width: '10%',
|
|
103
|
+
borderWidth: 0,
|
|
104
|
+
}}>
|
|
105
|
+
<Text>{''}</Text>
|
|
106
|
+
</View>
|
|
107
|
+
<View style={{
|
|
108
|
+
flex: 1,
|
|
109
|
+
width: '80%',
|
|
110
|
+
borderWidth: 0,
|
|
111
|
+
justifyContent: 'center',
|
|
112
|
+
alignItems: 'center',
|
|
113
|
+
}}>
|
|
114
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'center' }}>
|
|
115
|
+
{props.overlayheading != null && props.overlayheading != undefined ?
|
|
116
|
+
<Icons.FontAwesome5
|
|
117
|
+
name={props.overlayicon != null && props.overlayicon != undefined ? props.overlayicon : 'file'}
|
|
118
|
+
color={'#000000'}
|
|
119
|
+
size={normalize(11)}
|
|
120
|
+
style={{ marginHorizontal: normalize(5) }}
|
|
121
|
+
/>
|
|
122
|
+
: null}
|
|
123
|
+
<Text style={{ color: '#000000', fontSize: normalize(11), fontWeight: 'bold', textAlign: 'center' }}>{props.overlayheading != null && props.overlayheading != undefined ? props.overlayheading : ''}</Text>
|
|
124
|
+
</View>
|
|
125
|
+
</View>
|
|
126
|
+
<View style={{
|
|
127
|
+
width: '10%',
|
|
128
|
+
borderWidth: 0,
|
|
129
|
+
}}>
|
|
130
|
+
<Text>{' '}</Text>
|
|
131
|
+
</View>
|
|
132
|
+
</View>
|
|
133
|
+
: null}
|
|
134
|
+
</View>
|
|
135
|
+
</Overlay>
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export default HOverlayCentered;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Text, TouchableOpacity } from 'react-native';
|
|
2
|
+
import { isBNU, isNU, isNUQ, normalize } from '../CommonStyle/ComponentFunctions';
|
|
3
|
+
import HOCIcons from './HOCIcons';
|
|
4
|
+
import { Global } from '../Common/Global';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export default function HShadowButton(props) {
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<TouchableOpacity
|
|
11
|
+
disabled={props.disabled ? true : false}
|
|
12
|
+
onPress={() => {
|
|
13
|
+
isNU(props.buttonCallback) ? props.buttonCallback(true) : null;
|
|
14
|
+
}}
|
|
15
|
+
style={isNU(props.buttonstyle) ? props.buttonstyle : {}}>
|
|
16
|
+
{props.useicon ?
|
|
17
|
+
<HOCIcons.Icons
|
|
18
|
+
icongroup={isNU(props.icongroup) ? props.icongroup : 5}
|
|
19
|
+
name={isBNU(props.iconname) ? props.iconname : 'file-alt'}
|
|
20
|
+
color={isNU(props.iconcolor) ? props.iconcolor : Global.AppTheme.primary_color}
|
|
21
|
+
size={isNU(props.iconsize) ? props.iconsize : normalize(15)}
|
|
22
|
+
style={props.iconstyle ? props.iconstyle : {}}
|
|
23
|
+
/>
|
|
24
|
+
: null}
|
|
25
|
+
{props.usetext ?
|
|
26
|
+
<Text
|
|
27
|
+
numberOfLines={1}
|
|
28
|
+
adjustsFontSizeToFit={true}
|
|
29
|
+
style={
|
|
30
|
+
props.textstyle ?
|
|
31
|
+
props.textstyle :
|
|
32
|
+
{
|
|
33
|
+
color: Global.AppTheme.primary_color,
|
|
34
|
+
fontSize: normalize(6),
|
|
35
|
+
textAlign: 'center',
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
>
|
|
39
|
+
{isNUQ(props.displaytext) ? props.displaytext : null}
|
|
40
|
+
</Text>
|
|
41
|
+
: null}
|
|
42
|
+
</TouchableOpacity>
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
|
|
2
|
+
import { Text, TouchableOpacity, View, Platform } from 'react-native';
|
|
3
|
+
import { isBNU, isNU, isNUQ, normalize } from '../CommonStyle/ComponentFunctions';
|
|
4
|
+
import HOCIcons from './HOCIcons';
|
|
5
|
+
import { Global } from '../Common/Global';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export default function HShadowCountButton(props) {
|
|
10
|
+
return (
|
|
11
|
+
<TouchableOpacity
|
|
12
|
+
key={props.i}
|
|
13
|
+
disabled={props.disabled ? true : false}
|
|
14
|
+
onPress={() => {
|
|
15
|
+
isNU(props.buttonCallback) ? props.buttonCallback(true) : null;
|
|
16
|
+
}}
|
|
17
|
+
style={isNU(props.buttonstyle) ? props.buttonstyle : {}}>
|
|
18
|
+
{props.count ? (
|
|
19
|
+
<View
|
|
20
|
+
style={{
|
|
21
|
+
position: 'absolute',
|
|
22
|
+
right: normalize(10),
|
|
23
|
+
top: normalize(-5),
|
|
24
|
+
backgroundColor: 'white',
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
borderRadius: 20,
|
|
27
|
+
width: normalize(15),
|
|
28
|
+
borderWidth: 0.5,
|
|
29
|
+
zIndex: 10,
|
|
30
|
+
}}>
|
|
31
|
+
<Text
|
|
32
|
+
style={{
|
|
33
|
+
color: 'black',
|
|
34
|
+
fontSize: normalize(11),
|
|
35
|
+
fontWeight: 'bold',
|
|
36
|
+
}}>
|
|
37
|
+
{props.countValue || 0}
|
|
38
|
+
</Text>
|
|
39
|
+
</View>
|
|
40
|
+
) : null}
|
|
41
|
+
{props.useicon ? (
|
|
42
|
+
<HOCIcons.Icons
|
|
43
|
+
icongroup={isNU(props.icongroup) ? props.icongroup : 5}
|
|
44
|
+
name={isBNU(props.iconname) ? props.iconname : 'file-alt'}
|
|
45
|
+
color={
|
|
46
|
+
isNU(props.iconcolor)
|
|
47
|
+
? props.iconcolor
|
|
48
|
+
: Global.AppTheme.primary_color
|
|
49
|
+
}
|
|
50
|
+
size={
|
|
51
|
+
Platform.OS === 'web'
|
|
52
|
+
? 20 // desktop equivalent
|
|
53
|
+
: isNU(props.iconsize)
|
|
54
|
+
? props.iconsize
|
|
55
|
+
: normalize(15)
|
|
56
|
+
}
|
|
57
|
+
style={props.iconstyle ? props.iconstyle : {}}
|
|
58
|
+
/>
|
|
59
|
+
) : null}
|
|
60
|
+
{props.usetext ? (
|
|
61
|
+
<Text
|
|
62
|
+
numberOfLines={1}
|
|
63
|
+
adjustsFontSizeToFit={true}
|
|
64
|
+
style={
|
|
65
|
+
props.textstyle
|
|
66
|
+
? props.textstyle
|
|
67
|
+
: {
|
|
68
|
+
color: Global.AppTheme.primary_color,
|
|
69
|
+
fontSize:
|
|
70
|
+
Platform.OS === 'web'
|
|
71
|
+
? 12 // desktop readable size
|
|
72
|
+
: normalize(6), // android unchanged
|
|
73
|
+
textAlign: 'center',
|
|
74
|
+
}
|
|
75
|
+
}>
|
|
76
|
+
{isNUQ(props.displaytext) ? props.displaytext : null}
|
|
77
|
+
</Text>
|
|
78
|
+
) : null}
|
|
79
|
+
|
|
80
|
+
</TouchableOpacity>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, Modal, StyleSheet, TouchableWithoutFeedback } from 'react-native';
|
|
3
|
+
|
|
4
|
+
const OptionOverlay = ({ visible, onClose, children }, props) => {
|
|
5
|
+
return (
|
|
6
|
+
<Modal
|
|
7
|
+
transparent
|
|
8
|
+
visible={visible}
|
|
9
|
+
onRequestClose={onClose}
|
|
10
|
+
animationType="none"
|
|
11
|
+
>
|
|
12
|
+
<TouchableWithoutFeedback onPress={onClose}>
|
|
13
|
+
<View style={styles.overlay}>
|
|
14
|
+
<TouchableWithoutFeedback>
|
|
15
|
+
<View style={{
|
|
16
|
+
width: '95%', // Adjust this width as needed
|
|
17
|
+
height: props && props.height ? props.height : '80%',
|
|
18
|
+
// padding: 2,
|
|
19
|
+
backgroundColor: 'white',
|
|
20
|
+
borderRadius: 10,
|
|
21
|
+
}}>
|
|
22
|
+
{children}
|
|
23
|
+
</View>
|
|
24
|
+
</TouchableWithoutFeedback>
|
|
25
|
+
</View>
|
|
26
|
+
</TouchableWithoutFeedback>
|
|
27
|
+
</Modal>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const styles = StyleSheet.create({
|
|
32
|
+
overlay: {
|
|
33
|
+
flex: 1,
|
|
34
|
+
justifyContent: 'center',
|
|
35
|
+
alignItems: 'center',
|
|
36
|
+
backgroundColor: 'rgba(0, 0, 0, 0.5)', // Semi-transparent background
|
|
37
|
+
},
|
|
38
|
+
content: {
|
|
39
|
+
width: '95%', // Adjust this width as needed
|
|
40
|
+
height: '80%',
|
|
41
|
+
// padding: 2,
|
|
42
|
+
backgroundColor: 'white',
|
|
43
|
+
borderRadius: 10,
|
|
44
|
+
// elevation: 5,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export default OptionOverlay;
|
|
@@ -0,0 +1,347 @@
|
|
|
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
|
+
ActivityIndicator,
|
|
13
|
+
PermissionsAndroid,
|
|
14
|
+
} from 'react-native';
|
|
15
|
+
import {audioURL, APIURL} from '../Common/apiConstants';
|
|
16
|
+
import Fontisto from 'react-native-vector-icons/Fontisto';
|
|
17
|
+
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
18
|
+
import CAudioPlay from '../Media/CAudioPlay';
|
|
19
|
+
// import DocumentPicker from 'react-native-document-picker';
|
|
20
|
+
import { useNavigation } from '../Navigation/useNavigation';
|
|
21
|
+
|
|
22
|
+
import ReactNativeBlobUtil from 'react-native-blob-util';
|
|
23
|
+
import Sound from 'react-native-sound';
|
|
24
|
+
import SSpeedDial from '../StaticComponents/SSpeedDial';
|
|
25
|
+
import {Global} from '../Common/Global';
|
|
26
|
+
import EmrResponseComponentContext from '../Handlers/emrResponseComponentContext';
|
|
27
|
+
|
|
28
|
+
function AudioScreen(props) {
|
|
29
|
+
const navigation = useNavigation();
|
|
30
|
+
const {responseJSON, setResponseJSON} = useContext(
|
|
31
|
+
EmrResponseComponentContext,
|
|
32
|
+
);
|
|
33
|
+
const [data, setData] = useState(
|
|
34
|
+
props?.data?.savedaudio ? props.data.savedaudio : null,
|
|
35
|
+
//props.route.params.gallery.savedaudio
|
|
36
|
+
);
|
|
37
|
+
// console.log("savedaudio",JSON.stringify(data));
|
|
38
|
+
const [refreshCount, setrefreshCount] = useState(1); // TO refresh the page when add something on page
|
|
39
|
+
const [mediaUrlLink, setMediaUrlLink] = useState(false);
|
|
40
|
+
const [isAudioShow, setAudioShow] = useState(false);
|
|
41
|
+
const [deleteAudio, setDeleteAudio] = useState(false);
|
|
42
|
+
const [open, setOpen] = useState(true);
|
|
43
|
+
const [loading, setLoading] = useState(false);
|
|
44
|
+
const [process, setProcess] = useState('');
|
|
45
|
+
const [disablesave, setDisablesave] = useState(true);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
props.setData(data);
|
|
48
|
+
}, [data]);
|
|
49
|
+
|
|
50
|
+
function firebaseimagesave() {
|
|
51
|
+
console.log('firebaseimagesaveeeeeeeeee', data);
|
|
52
|
+
data.map(item => {
|
|
53
|
+
if (item.uritype == false) {
|
|
54
|
+
firebaseupload(item);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const firebaseupload = async item => {
|
|
60
|
+
console.log('firebaseupload', item.uri);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
function deleteSelectedAudio(itemid) {
|
|
64
|
+
data
|
|
65
|
+
.filter(item => item.deletestatus === true)
|
|
66
|
+
.forEach(item => data.splice(data.indexOf(item), 1));
|
|
67
|
+
setDeleteAudio(!deleteAudio);
|
|
68
|
+
setrefreshCount(refreshCount + 1);
|
|
69
|
+
}
|
|
70
|
+
function changeStatus(data) {
|
|
71
|
+
data.item.deletestatus = !data.item.deletestatus;
|
|
72
|
+
setrefreshCount(refreshCount + 1);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function retrievefirebaseimage(data) {}
|
|
76
|
+
|
|
77
|
+
function renderAudio(data) {
|
|
78
|
+
// retrievefirebaseimage(data)
|
|
79
|
+
return data.item.filename ? (
|
|
80
|
+
<View style={{flexDirection: 'row'}}>
|
|
81
|
+
<View style={{alignItems: 'center', flexDirection: 'row'}}>
|
|
82
|
+
<TouchableOpacity onLongPress={() => setDeleteAudio(true)}>
|
|
83
|
+
<CAudioPlay
|
|
84
|
+
audio={audioURL + data.item.filename}
|
|
85
|
+
component={data.item.file}
|
|
86
|
+
navigation={props.navigation}
|
|
87
|
+
deleterequest={val =>
|
|
88
|
+
val == undefined ? null : Delete_Media(val)
|
|
89
|
+
}
|
|
90
|
+
/>
|
|
91
|
+
</TouchableOpacity>
|
|
92
|
+
|
|
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
|
+
) : null;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const getResolvedPath = async (uri, filen) => {
|
|
114
|
+
const fileBase64 = await ReactNativeBlobUtil.fs.readFile(uri, 'base64');
|
|
115
|
+
const relativePath = ReactNativeBlobUtil.fs.dirs.CacheDir;
|
|
116
|
+
//const fileName = `${Date.now()}.aac`
|
|
117
|
+
const fileName = `${filen}`;
|
|
118
|
+
const path = `${relativePath}/${fileName}`;
|
|
119
|
+
|
|
120
|
+
// Create temporary file
|
|
121
|
+
await ReactNativeBlobUtil.fs.writeFile(path, fileBase64, 'base64');
|
|
122
|
+
return {relativePath, fileName, path};
|
|
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
|
+
async function browseFromDevice() {
|
|
142
|
+
if (await isPermitted()) {
|
|
143
|
+
try {
|
|
144
|
+
const res = await DocumentPicker.pick({
|
|
145
|
+
type: [DocumentPicker.types.audio],
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
const {relativePath, fileName, path} = await getResolvedPath(
|
|
149
|
+
res[0].uri,
|
|
150
|
+
res[0].name,
|
|
151
|
+
);
|
|
152
|
+
console.log('res[0].uri', JSON.stringify(res[0].uri));
|
|
153
|
+
console.log('res[0].name', JSON.stringify(res[0].name));
|
|
154
|
+
console.log('relativePath', JSON.stringify(relativePath));
|
|
155
|
+
console.log('fileName', JSON.stringify(fileName));
|
|
156
|
+
console.log('path', JSON.stringify(path));
|
|
157
|
+
let dataset = {
|
|
158
|
+
uri: 'file://' + path,
|
|
159
|
+
filetype: res[0].type,
|
|
160
|
+
filename: res[0].name,
|
|
161
|
+
uritype: false,
|
|
162
|
+
};
|
|
163
|
+
console.log('dataset', JSON.stringify(dataset));
|
|
164
|
+
const localAudio = new Sound(fileName, relativePath, error => {
|
|
165
|
+
if (error) {
|
|
166
|
+
console.log('failed to load the sound', error);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
// Loaded audio successfully
|
|
170
|
+
const audioDuration = localAudio.getDuration();
|
|
171
|
+
if (!audioDuration) {return;} // Audio length could not be estimated
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
Media_Upload(dataset);
|
|
175
|
+
} catch (err) {
|
|
176
|
+
if (DocumentPicker.isCancel(err)) {
|
|
177
|
+
// User cancelled the picker, exit any dialogs or menus and move on
|
|
178
|
+
} else {
|
|
179
|
+
throw err;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
async function Media_Upload(image) {
|
|
186
|
+
setLoading(true);
|
|
187
|
+
let date = new Date().getDate(); //Current Date
|
|
188
|
+
let month = new Date().getMonth() + 1; //Current Month
|
|
189
|
+
let year = new Date().getFullYear(); //Current Year
|
|
190
|
+
let hours = new Date().getHours(); //Current Hours
|
|
191
|
+
let min = new Date().getMinutes(); //Current Minutes
|
|
192
|
+
let sec = new Date().getSeconds(); //Current Seconds
|
|
193
|
+
let millisec = new Date().getMilliseconds(); //Current milliSeconds
|
|
194
|
+
let uniquename = '.aac';
|
|
195
|
+
|
|
196
|
+
let fileid_autogenerate = data != null && data.length > 0 ? data.length : 0;
|
|
197
|
+
let dataset2 = {
|
|
198
|
+
fileid: fileid_autogenerate + 1,
|
|
199
|
+
filename: uniquename,
|
|
200
|
+
filetype: image.filetype,
|
|
201
|
+
uri: image.uri,
|
|
202
|
+
uritype: false,
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
if (!dataset2.uritype) {
|
|
206
|
+
//console.log("dataset.uritype>>>>>>>>>>>>>",dataset.uritype);
|
|
207
|
+
if (dataset2.uri) {
|
|
208
|
+
//console.log("dataset.uri>>>>>>>>>>>>>>>",dataset.uri);
|
|
209
|
+
var formData = new FormData();
|
|
210
|
+
formData.append('file', {
|
|
211
|
+
uri: dataset2.uri,
|
|
212
|
+
type: 'audio/aac',
|
|
213
|
+
name: dataset2.filename,
|
|
214
|
+
});
|
|
215
|
+
// console.log("formData>>>>>>>>>>>>>",JSON.stringify(formData));
|
|
216
|
+
|
|
217
|
+
NetworkServiceCall(
|
|
218
|
+
'multiform',
|
|
219
|
+
APIURL + 'file/fileupload/emr/audio',
|
|
220
|
+
formData,
|
|
221
|
+
)
|
|
222
|
+
.then(function (responsedata) {
|
|
223
|
+
// console.log("responsedata>>>>>>>>>>>>>>>",JSON.stringify(responsedata));
|
|
224
|
+
if (responsedata.httpstatus == 200) {
|
|
225
|
+
console.log(
|
|
226
|
+
'responsedata.httpstatus>>>>>>>>>>>>>>>',
|
|
227
|
+
JSON.stringify(responsedata.httpstatus),
|
|
228
|
+
);
|
|
229
|
+
dataset2.filename = responsedata.data.fileuri;
|
|
230
|
+
// data.push(dataset2)
|
|
231
|
+
// props.setData([...data, dataset2]);
|
|
232
|
+
console.log(
|
|
233
|
+
'img66666666666666666666666666666666666666',
|
|
234
|
+
dataset2.filename,
|
|
235
|
+
);
|
|
236
|
+
setData(
|
|
237
|
+
data != null
|
|
238
|
+
? prevData => [...prevData, dataset2.filename]
|
|
239
|
+
: [dataset2.filename],
|
|
240
|
+
);
|
|
241
|
+
responseJSON.consultationEdit.editStatus = true;
|
|
242
|
+
setrefreshCount(refreshCount + 1);
|
|
243
|
+
props.editStatus(1);
|
|
244
|
+
props.data.usertype =
|
|
245
|
+
Global.PatientDetails != undefined &&
|
|
246
|
+
Global.PatientDetails.usertype != undefined &&
|
|
247
|
+
Global.PatientDetails.usertype != null
|
|
248
|
+
? Global.PatientDetails.usertype
|
|
249
|
+
: 'Z';
|
|
250
|
+
props.data.suuser =
|
|
251
|
+
Global.userData != undefined &&
|
|
252
|
+
Global.userData.suuser != undefined &&
|
|
253
|
+
Global.userData.suuser != null
|
|
254
|
+
? Global.userData.suuser
|
|
255
|
+
: 0;
|
|
256
|
+
setLoading(false);
|
|
257
|
+
setOpen(false);
|
|
258
|
+
//props.route.params.onSelect(true)
|
|
259
|
+
} else {
|
|
260
|
+
setLoading(false);
|
|
261
|
+
setOpen(false);
|
|
262
|
+
}
|
|
263
|
+
})
|
|
264
|
+
.catch(error => {
|
|
265
|
+
// console.log("errorrrrrrrrrr",JSON.stringify(error))
|
|
266
|
+
setLoading(false);
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function RecordAudio() {
|
|
273
|
+
console.log('record audiooooooooooooooo');
|
|
274
|
+
navigation.navigate('RecordAudio', {onSelect: Media_Upload});
|
|
275
|
+
}
|
|
276
|
+
return (
|
|
277
|
+
<View style={{flex: 1}}>
|
|
278
|
+
<View style={styles.itemContainer}>
|
|
279
|
+
{deleteAudio ? (
|
|
280
|
+
<TouchableOpacity
|
|
281
|
+
style={{alignItems: 'center', padding: 10}}
|
|
282
|
+
onPress={deleteSelectedAudio}>
|
|
283
|
+
<View>
|
|
284
|
+
<AntDesign name="delete" size={30} color={'red'} />
|
|
285
|
+
</View>
|
|
286
|
+
</TouchableOpacity>
|
|
287
|
+
) : null}
|
|
288
|
+
<FlatList
|
|
289
|
+
data={data}
|
|
290
|
+
renderItem={renderAudio}
|
|
291
|
+
contentContainerStyle={{alignItems: 'center', paddingTop: 10}}
|
|
292
|
+
keyExtractor={item => item.fileid}
|
|
293
|
+
/>
|
|
294
|
+
<View>
|
|
295
|
+
{loading ? (
|
|
296
|
+
<View
|
|
297
|
+
style={{
|
|
298
|
+
flex: 1,
|
|
299
|
+
backgroundColor: '#fff',
|
|
300
|
+
alignItems: 'center',
|
|
301
|
+
padding: 10,
|
|
302
|
+
}}>
|
|
303
|
+
<ActivityIndicator size="large" color="#0000ff" />
|
|
304
|
+
</View>
|
|
305
|
+
) : null}
|
|
306
|
+
</View>
|
|
307
|
+
|
|
308
|
+
<SSpeedDial
|
|
309
|
+
buttons={[
|
|
310
|
+
{
|
|
311
|
+
functionid: 1,
|
|
312
|
+
color: 'darkblue',
|
|
313
|
+
iconname: 'add',
|
|
314
|
+
title: 'Browse',
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
functionid: 2,
|
|
318
|
+
color: 'darkblue',
|
|
319
|
+
iconname: 'audiotrack',
|
|
320
|
+
title: 'Record Audio',
|
|
321
|
+
},
|
|
322
|
+
]}
|
|
323
|
+
callBack={val => (val == undefined ? null : getFunctions(val))}
|
|
324
|
+
/>
|
|
325
|
+
</View>
|
|
326
|
+
</View>
|
|
327
|
+
);
|
|
328
|
+
|
|
329
|
+
function getFunctions(key) {
|
|
330
|
+
switch (key) {
|
|
331
|
+
case 1:
|
|
332
|
+
browseFromDevice();
|
|
333
|
+
break;
|
|
334
|
+
case 2:
|
|
335
|
+
RecordAudio();
|
|
336
|
+
break;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
const styles = StyleSheet.create({
|
|
342
|
+
itemContainer: {
|
|
343
|
+
flex: 1,
|
|
344
|
+
},
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
export default memo(AudioScreen);
|