@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,223 @@
|
|
|
1
|
+
import React, { useState, useRef } from 'react';
|
|
2
|
+
import { Text, View, StyleSheet, TouchableOpacity } from 'react-native';
|
|
3
|
+
// import { RNCamera } from 'react-native-camera';
|
|
4
|
+
import RNFetchBlob from 'rn-fetch-blob';
|
|
5
|
+
|
|
6
|
+
const RecordVideo = ({ navigation, route }) => {
|
|
7
|
+
const [path, setPath] = useState('');
|
|
8
|
+
const [recorded, setRecorded] = useState(null);
|
|
9
|
+
const [isRecording, setIsRecording] = useState(false);
|
|
10
|
+
const [startRecording, setStartRecording] = useState(false);
|
|
11
|
+
|
|
12
|
+
const cameraRef = useRef(null);
|
|
13
|
+
|
|
14
|
+
const takeVideo = () => {
|
|
15
|
+
setStartRecording(true);
|
|
16
|
+
saveVideo();
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const saveVideo = async () => {
|
|
20
|
+
if (cameraRef.current) {
|
|
21
|
+
const options = {
|
|
22
|
+
quality: RNCamera.Constants.VideoQuality['4:3'],
|
|
23
|
+
forceUpOrientation: true,
|
|
24
|
+
};
|
|
25
|
+
const data = await cameraRef.current.recordAsync(options);
|
|
26
|
+
setPath(data.uri);
|
|
27
|
+
setRecorded(false);
|
|
28
|
+
setIsRecording(false);
|
|
29
|
+
stopRecord();
|
|
30
|
+
console.log('video data', data);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const stopRecord = async () => {
|
|
35
|
+
setIsRecording(false);
|
|
36
|
+
setStartRecording(false);
|
|
37
|
+
cameraRef.current.stopRecording();
|
|
38
|
+
const str = path;
|
|
39
|
+
const res = path.length > 0 ? await fetch(str) : null;
|
|
40
|
+
const blob = res != null ? await res.blob() : null;
|
|
41
|
+
|
|
42
|
+
let fileName = str.substr(str.lastIndexOf('/') + 1);
|
|
43
|
+
let videoPath = str.replace('file:///', '');
|
|
44
|
+
if (path.length > 0) {
|
|
45
|
+
navigation.goBack();
|
|
46
|
+
route.params.onSelect({
|
|
47
|
+
uri: str,
|
|
48
|
+
filename: 'video',
|
|
49
|
+
filetype: blob.type,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<View style={layoutstyles.container}>
|
|
56
|
+
<RNCamera
|
|
57
|
+
ref={cameraRef}
|
|
58
|
+
style={layoutstyles.preview}
|
|
59
|
+
type={RNCamera.Constants.Type.back}
|
|
60
|
+
flashMode={RNCamera.Constants.FlashMode.on}
|
|
61
|
+
/>
|
|
62
|
+
<View style={layoutstyles.child_container}>
|
|
63
|
+
{!startRecording ? (
|
|
64
|
+
<TouchableOpacity onPress={takeVideo} style={layoutstyles.capture} />
|
|
65
|
+
) : (
|
|
66
|
+
<TouchableOpacity onPress={stopRecord} style={[layoutstyles.capture, layoutstyles.stop_recording]} />
|
|
67
|
+
)}
|
|
68
|
+
</View>
|
|
69
|
+
</View>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const layoutstyles = StyleSheet.create({
|
|
74
|
+
container: {
|
|
75
|
+
flex: 1,
|
|
76
|
+
flexDirection: 'column',
|
|
77
|
+
backgroundColor: 'black',
|
|
78
|
+
},
|
|
79
|
+
child_container: {
|
|
80
|
+
flex: 0,
|
|
81
|
+
flexDirection: 'row',
|
|
82
|
+
justifyContent: 'center',
|
|
83
|
+
margin: 20,
|
|
84
|
+
},
|
|
85
|
+
preview: {
|
|
86
|
+
flex: 1,
|
|
87
|
+
justifyContent: 'flex-end',
|
|
88
|
+
alignItems: 'center',
|
|
89
|
+
},
|
|
90
|
+
stop_recording: {
|
|
91
|
+
backgroundColor: 'red',
|
|
92
|
+
},
|
|
93
|
+
capture: {
|
|
94
|
+
flex: 0,
|
|
95
|
+
backgroundColor: '#fff',
|
|
96
|
+
borderRadius: 5,
|
|
97
|
+
padding: 15,
|
|
98
|
+
paddingHorizontal: 20,
|
|
99
|
+
alignSelf: 'center',
|
|
100
|
+
margin: 20,
|
|
101
|
+
height: 40,
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
export default RecordVideo;
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
// import React, { Component } from 'react';
|
|
119
|
+
// import { Text, View, StyleSheet, TouchableOpacity } from 'react-native';
|
|
120
|
+
// import { RNCamera } from 'react-native-camera';
|
|
121
|
+
// import RNFetchBlob from "rn-fetch-blob";
|
|
122
|
+
|
|
123
|
+
// export default class RecordVideo extends Component {
|
|
124
|
+
// constructor(props) {
|
|
125
|
+
// super(props);
|
|
126
|
+
// this.state = {
|
|
127
|
+
// path: "",
|
|
128
|
+
// recorded: null,
|
|
129
|
+
// isRecording: null,
|
|
130
|
+
// startRecording: false
|
|
131
|
+
// }
|
|
132
|
+
// }
|
|
133
|
+
// takeVideo() {
|
|
134
|
+
// this.setState({ startRecording: true })
|
|
135
|
+
// this.saveVideo()
|
|
136
|
+
// }
|
|
137
|
+
// async saveVideo() {
|
|
138
|
+
|
|
139
|
+
// if (this.camera) {
|
|
140
|
+
// const options = {
|
|
141
|
+
// quality: RNCamera.Constants.VideoQuality["4:3"],
|
|
142
|
+
// forceUpOrientation: true,
|
|
143
|
+
// }
|
|
144
|
+
// const data = await this.camera.recordAsync(options)
|
|
145
|
+
// this.setState({ path: data.uri })
|
|
146
|
+
// this.setState({ recorded: false })
|
|
147
|
+
// this.setState({ isRecording: false })
|
|
148
|
+
// this.stopRecord()
|
|
149
|
+
// console.log("video data",data);
|
|
150
|
+
// }
|
|
151
|
+
// }
|
|
152
|
+
// async stopRecord() {
|
|
153
|
+
// this.setState({ isRecording: false, startRecording: false })
|
|
154
|
+
// this.camera.stopRecording();
|
|
155
|
+
// const str = this.state.path;
|
|
156
|
+
// const res = this.state.path.length > 0 ? await fetch(str) : null;
|
|
157
|
+
// const blob = res != null ? await res.blob() : null;
|
|
158
|
+
|
|
159
|
+
// let fileName = str.substr(str.lastIndexOf('/') + 1);
|
|
160
|
+
// let videoPath = str.replace('file:///', '');
|
|
161
|
+
// this.state.path.length > 0 && this.props.navigation.goBack();
|
|
162
|
+
// this.state.path.length > 0 && this.props.route.params.onSelect({
|
|
163
|
+
// uri: str,
|
|
164
|
+
// filename: 'video',
|
|
165
|
+
// filetype: blob.type,
|
|
166
|
+
// });
|
|
167
|
+
// }
|
|
168
|
+
// render() {
|
|
169
|
+
// return (
|
|
170
|
+
// <View style={layoutstyles.container}>
|
|
171
|
+
// <RNCamera
|
|
172
|
+
// ref={ref => {
|
|
173
|
+
// this.camera = ref;
|
|
174
|
+
// }}
|
|
175
|
+
// style={layoutstyles.preview}
|
|
176
|
+
// type={RNCamera.Constants.Type.back}
|
|
177
|
+
// flashMode={RNCamera.Constants.FlashMode.on}
|
|
178
|
+
// />
|
|
179
|
+
// <View style={layoutstyles.child_container}>
|
|
180
|
+
// {!this.state.startRecording ?
|
|
181
|
+
// <TouchableOpacity onPress={this.takeVideo.bind(this)}
|
|
182
|
+
// style={layoutstyles.capture}>
|
|
183
|
+
// </TouchableOpacity>
|
|
184
|
+
// :
|
|
185
|
+
// <TouchableOpacity onPress={this.stopRecord.bind(this)}
|
|
186
|
+
// style={[layoutstyles.capture, layoutstyles.stop_recording]}>
|
|
187
|
+
|
|
188
|
+
// </TouchableOpacity>
|
|
189
|
+
// }
|
|
190
|
+
// </View>
|
|
191
|
+
// </View>
|
|
192
|
+
// );
|
|
193
|
+
// }
|
|
194
|
+
// }
|
|
195
|
+
// const layoutstyles = StyleSheet.create({
|
|
196
|
+
// container: {
|
|
197
|
+
// flex: 1,
|
|
198
|
+
// flexDirection: 'column',
|
|
199
|
+
// backgroundColor: 'black',
|
|
200
|
+
// },
|
|
201
|
+
// child_container: {
|
|
202
|
+
// flex: 0, flexDirection: 'row',
|
|
203
|
+
// justifyContent: 'center', margin: 20,
|
|
204
|
+
// },
|
|
205
|
+
// preview: {
|
|
206
|
+
// flex: 1,
|
|
207
|
+
// justifyContent: 'flex-end',
|
|
208
|
+
// alignItems: 'center',
|
|
209
|
+
// },
|
|
210
|
+
// stop_recording: {
|
|
211
|
+
// backgroundColor: 'red'
|
|
212
|
+
// },
|
|
213
|
+
// capture: {
|
|
214
|
+
// flex: 0,
|
|
215
|
+
// backgroundColor: '#fff',
|
|
216
|
+
// borderRadius: 5,
|
|
217
|
+
// padding: 15,
|
|
218
|
+
// paddingHorizontal: 20,
|
|
219
|
+
// alignSelf: 'center',
|
|
220
|
+
// margin: 20,
|
|
221
|
+
// height:40
|
|
222
|
+
// },
|
|
223
|
+
// });
|
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
import React, {useState, useEffect, 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
|
+
Platform,
|
|
15
|
+
} from 'react-native';
|
|
16
|
+
import Fontisto from 'react-native-vector-icons/Fontisto';
|
|
17
|
+
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
18
|
+
// import DocumentPicker from 'react-native-document-picker';
|
|
19
|
+
import {videoURL, APIURL} from '../Common/apiConstants';
|
|
20
|
+
import { useNavigation } from '../Navigation/useNavigation';
|
|
21
|
+
|
|
22
|
+
import ReactNativeBlobUtil from 'react-native-blob-util';
|
|
23
|
+
import {isNU, notifyMessage} from '../CommonStyle/ComponentFunctions';
|
|
24
|
+
import EmrResponseComponentContext from '../Handlers/emrResponseComponentContext';
|
|
25
|
+
import {Global} from '../Common/Global';
|
|
26
|
+
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
27
|
+
import FontAwesome from 'react-native-vector-icons/FontAwesome';
|
|
28
|
+
import Ionicons from 'react-native-vector-icons/Ionicons';
|
|
29
|
+
|
|
30
|
+
export default function VideoScreen(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?.savedvideo ? props.data.savedvideo : '',
|
|
40
|
+
);
|
|
41
|
+
console.log('savedvideooooooooooo', data);
|
|
42
|
+
const [refreshCount, setrefreshCount] = useState(1);
|
|
43
|
+
const [isVideoShow, setVideoShow] = useState(false);
|
|
44
|
+
const [deleteVideo, setDeleteVideo] = useState(false);
|
|
45
|
+
const [filePath, setFilePath] = useState({});
|
|
46
|
+
const [process, setProcess] = useState('');
|
|
47
|
+
const [loading, setLoading] = useState(false);
|
|
48
|
+
const [disablesave, setDisablesave] = useState(true);
|
|
49
|
+
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
props.setData(data);
|
|
52
|
+
}, [data]);
|
|
53
|
+
|
|
54
|
+
function deleteSelectedVideo() {
|
|
55
|
+
data
|
|
56
|
+
.filter(item => item.deletestatus === true)
|
|
57
|
+
.forEach(item => data.splice(data.indexOf(item), 1));
|
|
58
|
+
setDeleteVideo(!deleteVideo);
|
|
59
|
+
setrefreshCount(refreshCount + 1);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function changeStatus(data) {
|
|
63
|
+
data.item.deletestatus = !data.item.deletestatus;
|
|
64
|
+
setrefreshCount(refreshCount + 1);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function renderVideo(data) {
|
|
68
|
+
return (
|
|
69
|
+
<View>
|
|
70
|
+
<View>
|
|
71
|
+
<TouchableOpacity
|
|
72
|
+
onLongPress={() => setDeleteVideo(true)}
|
|
73
|
+
onPress={() =>
|
|
74
|
+
navigation.navigate('CVideoPlay', {
|
|
75
|
+
video: videoURL + data.item.filename,
|
|
76
|
+
})
|
|
77
|
+
}>
|
|
78
|
+
<Image
|
|
79
|
+
style={{
|
|
80
|
+
height: windowHeight * 0.15,
|
|
81
|
+
width: windowWidth * 0.3,
|
|
82
|
+
margin: 5,
|
|
83
|
+
resizeMode: 'cover',
|
|
84
|
+
borderRadius: 10,
|
|
85
|
+
}}
|
|
86
|
+
source={{
|
|
87
|
+
uri: 'https://media.istockphoto.com/vectors/video-player-screen-with-bar-multimedia-interface-with-player-bar-for-vector-id1252447446?k=6&m=1252447446&s=612x612&w=0&h=he5mazXCrZRAfeJuHvFdu0P5NxfUeV2msDTXUnzJ7AQ=',
|
|
88
|
+
}}
|
|
89
|
+
/>
|
|
90
|
+
</TouchableOpacity>
|
|
91
|
+
</View>
|
|
92
|
+
{deleteVideo ? (
|
|
93
|
+
<TouchableOpacity onPress={() => changeStatus(data)}>
|
|
94
|
+
<View style={{justifyContent: 'center', alignItems: 'center'}}>
|
|
95
|
+
{!data.item.deletestatus ? (
|
|
96
|
+
<Fontisto name="checkbox-passive" size={25} color={'black'} />
|
|
97
|
+
) : (
|
|
98
|
+
<Fontisto name="checkbox-active" size={25} color={'blue'} />
|
|
99
|
+
)}
|
|
100
|
+
</View>
|
|
101
|
+
</TouchableOpacity>
|
|
102
|
+
) : null}
|
|
103
|
+
</View>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const getResolvedPath = async (uri, filen) => {
|
|
108
|
+
const fileBase64 = await ReactNativeBlobUtil.fs.readFile(uri, 'base64');
|
|
109
|
+
const relativePath = ReactNativeBlobUtil.fs.dirs.CacheDir;
|
|
110
|
+
const fileName = `${filen}`;
|
|
111
|
+
const path = `${relativePath}/${fileName}`;
|
|
112
|
+
|
|
113
|
+
await ReactNativeBlobUtil.fs.writeFile(path, fileBase64, 'base64');
|
|
114
|
+
return {relativePath, fileName, path};
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const isPermitted = async () => {
|
|
118
|
+
if (Platform.OS === 'android') {
|
|
119
|
+
try {
|
|
120
|
+
const granted = await PermissionsAndroid.request(
|
|
121
|
+
PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE,
|
|
122
|
+
);
|
|
123
|
+
return granted === PermissionsAndroid.RESULTS.GRANTED;
|
|
124
|
+
} catch (err) {
|
|
125
|
+
alert('Write permission err', err);
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
} else {
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
async function browseFromDevice() {
|
|
134
|
+
if (await isPermitted()) {
|
|
135
|
+
try {
|
|
136
|
+
const res = await DocumentPicker.pick({
|
|
137
|
+
type: [DocumentPicker.types.video],
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
const {relativePath, fileName, path} = await getResolvedPath(
|
|
141
|
+
res[0].uri,
|
|
142
|
+
res[0].name,
|
|
143
|
+
);
|
|
144
|
+
console.log('path', path);
|
|
145
|
+
|
|
146
|
+
let fileid_autogenerate =
|
|
147
|
+
data != null && data.length > 0 ? data.length : 0;
|
|
148
|
+
|
|
149
|
+
let dataset2 = {
|
|
150
|
+
fileid: fileid_autogenerate + 1,
|
|
151
|
+
filename: res[0].name + Date(),
|
|
152
|
+
filetype: res[0].type,
|
|
153
|
+
uri: 'file://' + path,
|
|
154
|
+
uritype: false,
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
Media_Upload(dataset2);
|
|
158
|
+
setrefreshCount(refreshCount + 1);
|
|
159
|
+
|
|
160
|
+
} catch (err) {
|
|
161
|
+
if (DocumentPicker.isCancel(err)) {
|
|
162
|
+
// User cancelled the picker
|
|
163
|
+
} else {
|
|
164
|
+
notifyMessage('Error selecting video', 2);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
async function Media_Upload(image) {
|
|
171
|
+
setLoading(true);
|
|
172
|
+
let date = new Date().getDate();
|
|
173
|
+
let month = new Date().getMonth() + 1;
|
|
174
|
+
let year = new Date().getFullYear();
|
|
175
|
+
let hours = new Date().getHours();
|
|
176
|
+
let min = new Date().getMinutes();
|
|
177
|
+
let sec = new Date().getSeconds();
|
|
178
|
+
let millisec = new Date().getMilliseconds();
|
|
179
|
+
let uniquename =
|
|
180
|
+
`${date}` +
|
|
181
|
+
`${month}` +
|
|
182
|
+
`${year}` +
|
|
183
|
+
`${hours}` +
|
|
184
|
+
`${min}` +
|
|
185
|
+
`${sec}` +
|
|
186
|
+
`${millisec}` +
|
|
187
|
+
'.mp4';
|
|
188
|
+
|
|
189
|
+
let fileid_autogenerate = data != null && data.length > 0 ? data.length : 0;
|
|
190
|
+
let dataset2 = {
|
|
191
|
+
fileid: fileid_autogenerate + 1,
|
|
192
|
+
filename: uniquename,
|
|
193
|
+
filetype: image.filetype,
|
|
194
|
+
uri: image.uri,
|
|
195
|
+
uritype: false,
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
if (!dataset2.uritype) {
|
|
199
|
+
if (dataset2.uri) {
|
|
200
|
+
var formData = new FormData();
|
|
201
|
+
formData.append('file', {
|
|
202
|
+
uri: dataset2.uri,
|
|
203
|
+
type: dataset2.filetype,
|
|
204
|
+
name: dataset2.filename,
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
// Add your NetworkServiceCall here
|
|
208
|
+
// NetworkServiceCall(
|
|
209
|
+
// 'multiform',
|
|
210
|
+
// APIURL + 'file/fileupload/emr/video',
|
|
211
|
+
// formData,
|
|
212
|
+
// )
|
|
213
|
+
// .then(function (responsedata) {
|
|
214
|
+
// console.log('NetworkServiceCall', JSON.stringify(responsedata));
|
|
215
|
+
// if (responsedata.httpstatus == 200) {
|
|
216
|
+
// dataset2.filename = responsedata.data.fileuri;
|
|
217
|
+
// setData(
|
|
218
|
+
// data != null
|
|
219
|
+
// ? prevData => [...prevData, dataset2.filename]
|
|
220
|
+
// : [dataset2.filename],
|
|
221
|
+
// );
|
|
222
|
+
// responseJSON.consultationEdit.editStatus = true;
|
|
223
|
+
// setrefreshCount(refreshCount + 1);
|
|
224
|
+
// props.editStatus(1);
|
|
225
|
+
// props.data.usertype =
|
|
226
|
+
// Global.PatientDetails != undefined &&
|
|
227
|
+
// Global.PatientDetails.usertype != undefined &&
|
|
228
|
+
// Global.PatientDetails.usertype != null
|
|
229
|
+
// ? Global.PatientDetails.usertype
|
|
230
|
+
// : 'Z';
|
|
231
|
+
// props.data.suuser =
|
|
232
|
+
// Global.userData != undefined &&
|
|
233
|
+
// Global.userData.suuser != undefined &&
|
|
234
|
+
// Global.userData.suuser != null
|
|
235
|
+
// ? Global.userData.suuser
|
|
236
|
+
// : 0;
|
|
237
|
+
// setLoading(false);
|
|
238
|
+
// } else {
|
|
239
|
+
// setLoading(false);
|
|
240
|
+
// }
|
|
241
|
+
// })
|
|
242
|
+
// .catch(error => {
|
|
243
|
+
// setLoading(false);
|
|
244
|
+
// });
|
|
245
|
+
|
|
246
|
+
// For now, just add to local state
|
|
247
|
+
setData(
|
|
248
|
+
data != null
|
|
249
|
+
? [...data, dataset2]
|
|
250
|
+
: [dataset2],
|
|
251
|
+
);
|
|
252
|
+
responseJSON.consultationEdit.editStatus = true;
|
|
253
|
+
setrefreshCount(refreshCount + 1);
|
|
254
|
+
props.editStatus(1);
|
|
255
|
+
setLoading(false);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function RecordVideo() {
|
|
261
|
+
navigation.navigate('CCaptureImageWithoutEdit', {
|
|
262
|
+
cameramoduletype: 1, // video
|
|
263
|
+
hidebuttons: false,
|
|
264
|
+
cameratype: 'back',
|
|
265
|
+
onSelect: s => (s && isNU(s) ? Media_Upload(s) : null),
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
return (
|
|
270
|
+
<View style={{flex: 1}}>
|
|
271
|
+
<View style={styles.itemContainer}>
|
|
272
|
+
{/* Delete Button */}
|
|
273
|
+
{deleteVideo && (
|
|
274
|
+
<TouchableOpacity
|
|
275
|
+
style={styles.deleteButton}
|
|
276
|
+
onPress={deleteSelectedVideo}>
|
|
277
|
+
<AntDesign name="delete" size={30} color={'red'} />
|
|
278
|
+
<Text style={styles.deleteText}>Delete Selected</Text>
|
|
279
|
+
</TouchableOpacity>
|
|
280
|
+
)}
|
|
281
|
+
|
|
282
|
+
{/* Videos Grid */}
|
|
283
|
+
<FlatList
|
|
284
|
+
data={data}
|
|
285
|
+
renderItem={renderVideo}
|
|
286
|
+
keyExtractor={item => item.id}
|
|
287
|
+
numColumns={3}
|
|
288
|
+
contentContainerStyle={{alignItems: 'center', paddingTop: 10}}
|
|
289
|
+
/>
|
|
290
|
+
|
|
291
|
+
{/* Loading Indicator */}
|
|
292
|
+
{loading && (
|
|
293
|
+
<View style={styles.loadingContainer}>
|
|
294
|
+
<ActivityIndicator size="large" color="#0000ff" />
|
|
295
|
+
</View>
|
|
296
|
+
)}
|
|
297
|
+
</View>
|
|
298
|
+
|
|
299
|
+
{/* Bottom Action Bar */}
|
|
300
|
+
<View style={styles.bottomActionBar}>
|
|
301
|
+
<TouchableOpacity
|
|
302
|
+
style={styles.actionButton}
|
|
303
|
+
onPress={browseFromDevice}>
|
|
304
|
+
<MaterialIcons name="video-library" color={'white'} size={24} />
|
|
305
|
+
<Text style={styles.actionButtonText}>Browse Video</Text>
|
|
306
|
+
</TouchableOpacity>
|
|
307
|
+
|
|
308
|
+
<TouchableOpacity
|
|
309
|
+
style={styles.actionButton}
|
|
310
|
+
onPress={RecordVideo}>
|
|
311
|
+
<Ionicons name="videocam" color={'white'} size={24} />
|
|
312
|
+
<Text style={styles.actionButtonText}>Record Video</Text>
|
|
313
|
+
</TouchableOpacity>
|
|
314
|
+
|
|
315
|
+
<TouchableOpacity
|
|
316
|
+
style={[styles.actionButton, disablesave && styles.disabledButton]}
|
|
317
|
+
disabled={disablesave}
|
|
318
|
+
onPress={() => {
|
|
319
|
+
// Save functionality here
|
|
320
|
+
// firebasevideosave();
|
|
321
|
+
}}>
|
|
322
|
+
<FontAwesome name="save" color={'white'} size={24} />
|
|
323
|
+
<Text style={styles.actionButtonText}>Save</Text>
|
|
324
|
+
</TouchableOpacity>
|
|
325
|
+
</View>
|
|
326
|
+
</View>
|
|
327
|
+
);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
const styles = StyleSheet.create({
|
|
331
|
+
itemContainer: {
|
|
332
|
+
flex: 1,
|
|
333
|
+
backgroundColor: '#f5f5f5',
|
|
334
|
+
},
|
|
335
|
+
deleteButton: {
|
|
336
|
+
flexDirection: 'row',
|
|
337
|
+
alignItems: 'center',
|
|
338
|
+
justifyContent: 'center',
|
|
339
|
+
padding: 10,
|
|
340
|
+
backgroundColor: '#ffebee',
|
|
341
|
+
marginHorizontal: 10,
|
|
342
|
+
borderRadius: 5,
|
|
343
|
+
marginTop: 10,
|
|
344
|
+
},
|
|
345
|
+
deleteText: {
|
|
346
|
+
marginLeft: 10,
|
|
347
|
+
color: 'red',
|
|
348
|
+
fontSize: 16,
|
|
349
|
+
fontWeight: 'bold',
|
|
350
|
+
},
|
|
351
|
+
loadingContainer: {
|
|
352
|
+
position: 'absolute',
|
|
353
|
+
top: 0,
|
|
354
|
+
left: 0,
|
|
355
|
+
right: 0,
|
|
356
|
+
bottom: 0,
|
|
357
|
+
justifyContent: 'center',
|
|
358
|
+
alignItems: 'center',
|
|
359
|
+
backgroundColor: 'rgba(255, 255, 255, 0.8)',
|
|
360
|
+
},
|
|
361
|
+
bottomActionBar: {
|
|
362
|
+
flexDirection: 'row',
|
|
363
|
+
backgroundColor: 'darkblue',
|
|
364
|
+
height: 60,
|
|
365
|
+
justifyContent: 'space-around',
|
|
366
|
+
alignItems: 'center',
|
|
367
|
+
paddingHorizontal: 10,
|
|
368
|
+
},
|
|
369
|
+
actionButton: {
|
|
370
|
+
alignItems: 'center',
|
|
371
|
+
justifyContent: 'center',
|
|
372
|
+
padding: 5,
|
|
373
|
+
},
|
|
374
|
+
actionButtonText: {
|
|
375
|
+
color: 'white',
|
|
376
|
+
fontSize: 12,
|
|
377
|
+
marginTop: 3,
|
|
378
|
+
textAlign: 'center',
|
|
379
|
+
},
|
|
380
|
+
disabledButton: {
|
|
381
|
+
opacity: 0.5,
|
|
382
|
+
},
|
|
383
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { View, Text, FlatList, Dimensions, TouchableOpacity } from 'react-native';
|
|
3
|
+
import { normalize } from '../CommonStyle/componentStyle';
|
|
4
|
+
|
|
5
|
+
export default function SAlphabet(props) {
|
|
6
|
+
const [alphaindex, setAlphaIndex] = useState(0);
|
|
7
|
+
return (
|
|
8
|
+
<View style={{
|
|
9
|
+
// height: Dimensions.get('window').height * 0.6,
|
|
10
|
+
marginBottom: Dimensions.get('window').height * 0.01,
|
|
11
|
+
}}>
|
|
12
|
+
<FlatList
|
|
13
|
+
data={['#', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '.']}
|
|
14
|
+
renderItem={renderAlphabet}
|
|
15
|
+
style={{ paddingBottom: 20 }}
|
|
16
|
+
contentContainerStyle={{ alignItems: 'center' }}
|
|
17
|
+
keyExtractor={(item, index) => 'key' + index}
|
|
18
|
+
initialNumToRender={50}
|
|
19
|
+
maxToRenderPerBatch={100}
|
|
20
|
+
/>
|
|
21
|
+
</View>
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
function renderAlphabet({ index, item }) {
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<TouchableOpacity style={{
|
|
28
|
+
width: normalize(25), alignItems: 'center', paddingVertical: 2, borderRadius: normalize(40) / 2,
|
|
29
|
+
backgroundColor: index == alphaindex ? '#8162fc' : 'white',
|
|
30
|
+
}}
|
|
31
|
+
onPress={() => getAlphabetData(item, index)}>
|
|
32
|
+
<Text style={{
|
|
33
|
+
color: index == alphaindex ? 'white' : 'black',
|
|
34
|
+
fontWeight: index == alphaindex ? 'bold' : 'normal',
|
|
35
|
+
}}>{item}</Text>
|
|
36
|
+
</TouchableOpacity>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function getAlphabetData(alpha, index) {
|
|
41
|
+
setAlphaIndex(index);
|
|
42
|
+
props.callBack != undefined ? props.callBack({
|
|
43
|
+
'alpha': alpha,
|
|
44
|
+
'index': index,
|
|
45
|
+
}) : null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, TouchableOpacity } from 'react-native';
|
|
3
|
+
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
4
|
+
import { normalize } from '../CommonStyle/componentStyle';
|
|
5
|
+
import CText from '../CustomComponents/CText';
|
|
6
|
+
|
|
7
|
+
const SCheckBox = (props) => {
|
|
8
|
+
// Normalize value to boolean for rendering
|
|
9
|
+
const checked = Number(props.data?.value) === 1;
|
|
10
|
+
|
|
11
|
+
const handlePress = () => {
|
|
12
|
+
if (props.callBack) {
|
|
13
|
+
// Toggle and send back numeric value (0 or 1)
|
|
14
|
+
const newValue = checked ? 0 : 1;
|
|
15
|
+
props.callBack(newValue);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
21
|
+
{props.data?.displaytext && (
|
|
22
|
+
<CText style={{ color: 'black', fontSize: normalize(14) }}>
|
|
23
|
+
{props.data.displaytext}
|
|
24
|
+
</CText>
|
|
25
|
+
)}
|
|
26
|
+
|
|
27
|
+
<TouchableOpacity
|
|
28
|
+
onPress={handlePress}
|
|
29
|
+
disabled={props.disabled ?? false}
|
|
30
|
+
style={{ paddingHorizontal: 5 }}
|
|
31
|
+
>
|
|
32
|
+
<AntDesign
|
|
33
|
+
name={checked ? 'checksquare' : 'checksquareo'}
|
|
34
|
+
size={normalize(props.data?.size ?? 20)}
|
|
35
|
+
color={checked ? 'darkblue' : 'grey'}
|
|
36
|
+
/>
|
|
37
|
+
</TouchableOpacity>
|
|
38
|
+
</View>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default SCheckBox;
|