@jescon-technologies/react-native-ui-kit 0.0.6 → 0.0.8

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.
Files changed (191) hide show
  1. package/index.d.ts +2 -66
  2. package/index.js +1 -66
  3. package/package.json +1 -1
  4. package/src/Alerts/AAlert.js +0 -137
  5. package/src/Alerts/AAlertIOS.js +0 -97
  6. package/src/Alerts/ABlink.js +0 -40
  7. package/src/Common/Icons.js +0 -49
  8. package/src/Common/NetworkServiceCall.js +0 -265
  9. package/src/CommonStyle/CommonTheme.js +0 -11
  10. package/src/CommonStyle/ComponentFunctions.js +0 -632
  11. package/src/CommonStyle/PopupStyle.js +0 -146
  12. package/src/CommonStyle/commonStyle.js +0 -93
  13. package/src/CommonStyle/componentStyle.js +0 -545
  14. package/src/CommonStyle/optionListStyles.js +0 -175
  15. package/src/Components/ByProductPage.js +0 -200
  16. package/src/Components/CDropDownListNew.js +0 -153
  17. package/src/Components/CSupplierList.js +0 -88
  18. package/src/Components/CVerificationCard.js +0 -2822
  19. package/src/Components/CustomButton.js +0 -67
  20. package/src/Components/CustomCard.js +0 -127
  21. package/src/Components/CustomTextInput.js +0 -47
  22. package/src/Components/EquipmentPage.js +0 -313
  23. package/src/Components/FilterInput.Copy.js +0 -723
  24. package/src/Components/FilterInput.js +0 -569
  25. package/src/Components/HSubHeading.js +0 -68
  26. package/src/Components/HeaderCard.js +0 -40
  27. package/src/Components/MoreOptionsScreen.js +0 -251
  28. package/src/Components/NonSwipableProductCard.js +0 -226
  29. package/src/Components/NonSwipableSupplierCard.js +0 -348
  30. package/src/Components/ProductCard.js +0 -1336
  31. package/src/Components/QualityProductCard.js +0 -1059
  32. package/src/Components/RateProductCard.js +0 -1452
  33. package/src/Components/RawMaterial.js +0 -261
  34. package/src/Components/SDropDownEdited.js +0 -549
  35. package/src/Components/SDropDownNew.js +0 -529
  36. package/src/Components/SHelpDescription.js +0 -147
  37. package/src/Components/STextInputNew.js +0 -510
  38. package/src/Components/SearchProductCard.js +0 -470
  39. package/src/Components/StageByProduct.js +0 -199
  40. package/src/Components/SupplierCard.js +0 -243
  41. package/src/Components/SupplierInvoiceCard.js +0 -405
  42. package/src/Components/SwipableSupplierCard.js +0 -136
  43. package/src/Components/TagTemplate.js +0 -74
  44. package/src/Components/WrappedComponent.js +0 -25
  45. package/src/Custom/CBooking.js +0 -944
  46. package/src/Custom/CBookingPostpone.js +0 -1822
  47. package/src/Custom/CCalendar.js +0 -560
  48. package/src/Custom/CCard.js +0 -880
  49. package/src/Custom/CDetailCard.js +0 -205
  50. package/src/Custom/CHelpImage.js +0 -52
  51. package/src/Custom/CReport.js +0 -569
  52. package/src/Custom/CScrollView.js +0 -73
  53. package/src/Custom/CSignature.js +0 -112
  54. package/src/Custom/CSliderMenu.js +0 -339
  55. package/src/Custom/CSupplierCard.js +0 -99
  56. package/src/Custom/CTemplateCard.js +0 -438
  57. package/src/Custom/CTokenAllocation.js +0 -1402
  58. package/src/Custom/CTokenListOverlay.js +0 -122
  59. package/src/Custom/CWardStatus.js +0 -444
  60. package/src/Custom/Charts/CBarChart.js +0 -218
  61. package/src/Custom/Charts/CDashBoardList.js +0 -133
  62. package/src/Custom/Charts/CDashBoardTable.js +0 -172
  63. package/src/Custom/Charts/CLineChart.js +0 -193
  64. package/src/Custom/Charts/CPieChart.js +0 -186
  65. package/src/Custom/Loader.js +0 -182
  66. package/src/Custom/OUserView.js +0 -1121
  67. package/src/Custom/PreviewDosage.js +0 -115
  68. package/src/Custom/SearchLoader.js +0 -32
  69. package/src/Custom/TableComponent/CActivityTable.js +0 -707
  70. package/src/Custom/TableComponent/CMoreButtonTable.js +0 -197
  71. package/src/Custom/TableComponent/CTable.js +0 -185
  72. package/src/Custom/TableComponent/CTextBody.js +0 -40
  73. package/src/Custom/TableComponent/CTextHeader.js +0 -17
  74. package/src/Custom/TableComponent/PreviewPrescriptionNew.js +0 -1011
  75. package/src/Custom/TableComponent/SDropdownTable.js +0 -491
  76. package/src/Custom/TableComponent/TagTable.js +0 -1200
  77. package/src/CustomComponents/CAddColumn.js +0 -140
  78. package/src/CustomComponents/CAssessmentDelete.js +0 -307
  79. package/src/CustomComponents/CAwesomeButton.js +0 -83
  80. package/src/CustomComponents/CAwesomeMoreButton.js +0 -54
  81. package/src/CustomComponents/CBackHandler.js +0 -273
  82. package/src/CustomComponents/CCalendar.js +0 -243
  83. package/src/CustomComponents/CCommentOverlay.js +0 -202
  84. package/src/CustomComponents/CComments.js +0 -162
  85. package/src/CustomComponents/CContainerView.js +0 -24
  86. package/src/CustomComponents/CCustomTextInput.js +0 -336
  87. package/src/CustomComponents/CDetailView.js +0 -40
  88. package/src/CustomComponents/CDropDownList.js +0 -153
  89. package/src/CustomComponents/CDropdownSelect.js +0 -555
  90. package/src/CustomComponents/CFooterView.js +0 -42
  91. package/src/CustomComponents/CImagePickerSave.js +0 -316
  92. package/src/CustomComponents/CModalOverlay.js +0 -91
  93. package/src/CustomComponents/CNetworkStatus.js +0 -327
  94. package/src/CustomComponents/CNotesInstructions.js +0 -1000
  95. package/src/CustomComponents/COverlay.js +0 -81
  96. package/src/CustomComponents/CRemarks.js +0 -176
  97. package/src/CustomComponents/CRowAdd.js +0 -143
  98. package/src/CustomComponents/CSummaryDropDown.js +0 -327
  99. package/src/CustomComponents/CText.js +0 -9
  100. package/src/CustomComponents/CVectorIcon.js +0 -34
  101. package/src/CustomComponents/HtmlContentViewer.js +0 -65
  102. package/src/CustomComponents/PdfContentViewer.js +0 -90
  103. package/src/CustomComponents/SDropDownDosage.js +0 -1087
  104. package/src/CustomComponents/SwipableProductCard.js +0 -246
  105. package/src/CustomComponents/SwipableProductImageCard.js +0 -254
  106. package/src/CustomComponents/WorkOrderDetails.js +0 -1216
  107. package/src/CustomComponents/WorkOrderDetailsPage.js +0 -1213
  108. package/src/HOC/ConfirmOverlay.js +0 -192
  109. package/src/HOC/HHeading.js +0 -70
  110. package/src/HOC/HMoreButton.js +0 -88
  111. package/src/HOC/HNatureHeading.js +0 -402
  112. package/src/HOC/HOCIcons.js +0 -80
  113. package/src/HOC/HOverlayCentered.js +0 -140
  114. package/src/HOC/HShadowButton.js +0 -45
  115. package/src/HOC/HShadowCountButton.js +0 -82
  116. package/src/HOC/OptionOverlay.js +0 -48
  117. package/src/Json/Chart.json +0 -818
  118. package/src/Json/Consultation.json +0 -622
  119. package/src/Json/CreditBill.json +0 -490
  120. package/src/Json/Dropdown.json +0 -216
  121. package/src/Json/DropdownConsultation.json +0 -228
  122. package/src/Json/DynamicReports.json +0 -623
  123. package/src/Json/Footer.json +0 -79
  124. package/src/Media/AudioScreen.js +0 -342
  125. package/src/Media/BarcodeScan.js +0 -145
  126. package/src/Media/CAudioPlay.js +0 -228
  127. package/src/Media/CCaptureImageWithoutEdit.js +0 -330
  128. package/src/Media/CImageGallery.js +0 -289
  129. package/src/Media/CImageZoom.js +0 -82
  130. package/src/Media/CSingleImage.js +0 -391
  131. package/src/Media/CSketchCanvas.js +0 -76
  132. package/src/Media/CVideoPlay.js +0 -31
  133. package/src/Media/DocumentScreen.js +0 -362
  134. package/src/Media/DrawingScreen.js +0 -578
  135. package/src/Media/ImageScreen.js +0 -309
  136. package/src/Media/RecordAudio.js +0 -250
  137. package/src/Media/RecordVideo.js +0 -223
  138. package/src/Media/VideoScreen.js +0 -378
  139. package/src/Navigation/PageNavigation.js +0 -224
  140. package/src/Navigation/useFocusEffect.js +0 -2
  141. package/src/Navigation/useFocusEffect.native.js +0 -1
  142. package/src/Navigation/useFocusEffect.web.js +0 -1
  143. package/src/Navigation/useIsFocused.js +0 -1
  144. package/src/Navigation/useIsFocused.native.js +0 -1
  145. package/src/Navigation/useIsFocused.web.js +0 -1
  146. package/src/Navigation/useNavigation.js +0 -2
  147. package/src/Navigation/useNavigation.native.js +0 -1
  148. package/src/Navigation/useNavigation.web.js +0 -1
  149. package/src/Screens/CMedications.js +0 -528
  150. package/src/Screens/CWebViewGallery.js +0 -203
  151. package/src/Screens/ChartScan.js +0 -279
  152. package/src/Screens/ChartScreenNew.js +0 -1579
  153. package/src/Screens/Consultation.js +0 -1500
  154. package/src/Screens/Dashboard.js +0 -778
  155. package/src/Screens/FileExplorer.js +0 -288
  156. package/src/Screens/Footer.js +0 -340
  157. package/src/Screens/ForgotPassword.js +0 -288
  158. package/src/Screens/HeaderBlock.js +0 -353
  159. package/src/Screens/Login.js +0 -328
  160. package/src/Screens/Notification.js +0 -149
  161. package/src/Screens/OcrScreen.js +0 -20
  162. package/src/Screens/PdfPreview.js +0 -507
  163. package/src/Screens/RegistrationDetails.js +0 -467
  164. package/src/Screens/SearchScreen.js +0 -582
  165. package/src/Screens/Splash.js +0 -788
  166. package/src/Screens/SwipeLeftView.js +0 -1867
  167. package/src/StaticComponents/SAlphabet.js +0 -47
  168. package/src/StaticComponents/SCheckBox.js +0 -42
  169. package/src/StaticComponents/SDatePicker.js +0 -208
  170. package/src/StaticComponents/SDatePickerLabel.js +0 -253
  171. package/src/StaticComponents/SDatePickerNew.js +0 -258
  172. package/src/StaticComponents/SDateTimePickerNew.js +0 -381
  173. package/src/StaticComponents/SDropDownGenerate.js +0 -450
  174. package/src/StaticComponents/SDropDownHoc.js +0 -636
  175. package/src/StaticComponents/SDropDownIcon.js +0 -500
  176. package/src/StaticComponents/SMenuBox.js +0 -131
  177. package/src/StaticComponents/SOverlay.js +0 -177
  178. package/src/StaticComponents/SOverlayTextInput.js +0 -109
  179. package/src/StaticComponents/SSearch.js +0 -438
  180. package/src/StaticComponents/SSearchBar.js +0 -53
  181. package/src/StaticComponents/SSpeedDial.js +0 -303
  182. package/src/StaticComponents/STextInput.js +0 -289
  183. package/src/StaticComponents/STextInputProps.js +0 -36
  184. package/src/StaticComponents/STimePicker.js +0 -171
  185. package/src/StaticComponents/STimingDropDownNew.js +0 -1585
  186. package/src/StaticComponents/STimingSwitch.js +0 -34
  187. package/src/layout/CContainerView.js +0 -21
  188. package/src/layout/CDetailView.js +0 -81
  189. package/src/layout/HeaderBlock.js +0 -353
  190. package/src/layout/INVLoginLayout.js +0 -657
  191. package/src/layout/Loader.js +0 -176
@@ -1,223 +0,0 @@
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
- // });
@@ -1,378 +0,0 @@
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 '../../../../../src/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 {Global} from '../../../../../src/Common/Global';
25
- import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
26
- import FontAwesome from 'react-native-vector-icons/FontAwesome';
27
- import Ionicons from 'react-native-vector-icons/Ionicons';
28
-
29
- export default function VideoScreen(props) {
30
- const navigation = useNavigation();
31
- const windowWidth = Dimensions.get('window').width;
32
- const windowHeight = Dimensions.get('window').height;
33
-
34
- const [data, setData] = useState(
35
- props?.data?.savedvideo ? props.data.savedvideo : '',
36
- );
37
- console.log('savedvideooooooooooo', data);
38
- const [refreshCount, setrefreshCount] = useState(1);
39
- const [isVideoShow, setVideoShow] = useState(false);
40
- const [deleteVideo, setDeleteVideo] = useState(false);
41
- const [filePath, setFilePath] = useState({});
42
- const [process, setProcess] = useState('');
43
- const [loading, setLoading] = useState(false);
44
- const [disablesave, setDisablesave] = useState(true);
45
-
46
- useEffect(() => {
47
- props.setData(data);
48
- }, [data]);
49
-
50
- function deleteSelectedVideo() {
51
- data
52
- .filter(item => item.deletestatus === true)
53
- .forEach(item => data.splice(data.indexOf(item), 1));
54
- setDeleteVideo(!deleteVideo);
55
- setrefreshCount(refreshCount + 1);
56
- }
57
-
58
- function changeStatus(data) {
59
- data.item.deletestatus = !data.item.deletestatus;
60
- setrefreshCount(refreshCount + 1);
61
- }
62
-
63
- function renderVideo(data) {
64
- return (
65
- <View>
66
- <View>
67
- <TouchableOpacity
68
- onLongPress={() => setDeleteVideo(true)}
69
- onPress={() =>
70
- navigation.navigate('CVideoPlay', {
71
- video: videoURL + data.item.filename,
72
- })
73
- }>
74
- <Image
75
- style={{
76
- height: windowHeight * 0.15,
77
- width: windowWidth * 0.3,
78
- margin: 5,
79
- resizeMode: 'cover',
80
- borderRadius: 10,
81
- }}
82
- source={{
83
- 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=',
84
- }}
85
- />
86
- </TouchableOpacity>
87
- </View>
88
- {deleteVideo ? (
89
- <TouchableOpacity onPress={() => changeStatus(data)}>
90
- <View style={{justifyContent: 'center', alignItems: 'center'}}>
91
- {!data.item.deletestatus ? (
92
- <Fontisto name="checkbox-passive" size={25} color={'black'} />
93
- ) : (
94
- <Fontisto name="checkbox-active" size={25} color={'blue'} />
95
- )}
96
- </View>
97
- </TouchableOpacity>
98
- ) : null}
99
- </View>
100
- );
101
- }
102
-
103
- const getResolvedPath = async (uri, filen) => {
104
- const fileBase64 = await ReactNativeBlobUtil.fs.readFile(uri, 'base64');
105
- const relativePath = ReactNativeBlobUtil.fs.dirs.CacheDir;
106
- const fileName = `${filen}`;
107
- const path = `${relativePath}/${fileName}`;
108
-
109
- await ReactNativeBlobUtil.fs.writeFile(path, fileBase64, 'base64');
110
- return {relativePath, fileName, path};
111
- };
112
-
113
- const isPermitted = async () => {
114
- if (Platform.OS === 'android') {
115
- try {
116
- const granted = await PermissionsAndroid.request(
117
- PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE,
118
- );
119
- return granted === PermissionsAndroid.RESULTS.GRANTED;
120
- } catch (err) {
121
- alert('Write permission err', err);
122
- return false;
123
- }
124
- } else {
125
- return true;
126
- }
127
- };
128
-
129
- async function browseFromDevice() {
130
- if (await isPermitted()) {
131
- try {
132
- const res = await DocumentPicker.pick({
133
- type: [DocumentPicker.types.video],
134
- });
135
-
136
- const {relativePath, fileName, path} = await getResolvedPath(
137
- res[0].uri,
138
- res[0].name,
139
- );
140
- console.log('path', path);
141
-
142
- let fileid_autogenerate =
143
- data != null && data.length > 0 ? data.length : 0;
144
-
145
- let dataset2 = {
146
- fileid: fileid_autogenerate + 1,
147
- filename: res[0].name + Date(),
148
- filetype: res[0].type,
149
- uri: 'file://' + path,
150
- uritype: false,
151
- };
152
-
153
- Media_Upload(dataset2);
154
- setrefreshCount(refreshCount + 1);
155
-
156
- } catch (err) {
157
- if (DocumentPicker.isCancel(err)) {
158
- // User cancelled the picker
159
- } else {
160
- notifyMessage('Error selecting video', 2);
161
- }
162
- }
163
- }
164
- }
165
-
166
- async function Media_Upload(image) {
167
- setLoading(true);
168
- let date = new Date().getDate();
169
- let month = new Date().getMonth() + 1;
170
- let year = new Date().getFullYear();
171
- let hours = new Date().getHours();
172
- let min = new Date().getMinutes();
173
- let sec = new Date().getSeconds();
174
- let millisec = new Date().getMilliseconds();
175
- let uniquename =
176
- `${date}` +
177
- `${month}` +
178
- `${year}` +
179
- `${hours}` +
180
- `${min}` +
181
- `${sec}` +
182
- `${millisec}` +
183
- '.mp4';
184
-
185
- let fileid_autogenerate = data != null && data.length > 0 ? data.length : 0;
186
- let dataset2 = {
187
- fileid: fileid_autogenerate + 1,
188
- filename: uniquename,
189
- filetype: image.filetype,
190
- uri: image.uri,
191
- uritype: false,
192
- };
193
-
194
- if (!dataset2.uritype) {
195
- if (dataset2.uri) {
196
- var formData = new FormData();
197
- formData.append('file', {
198
- uri: dataset2.uri,
199
- type: dataset2.filetype,
200
- name: dataset2.filename,
201
- });
202
-
203
- // Add your NetworkServiceCall here
204
- // NetworkServiceCall(
205
- // 'multiform',
206
- // APIURL + 'file/fileupload/emr/video',
207
- // formData,
208
- // )
209
- // .then(function (responsedata) {
210
- // console.log('NetworkServiceCall', JSON.stringify(responsedata));
211
- // if (responsedata.httpstatus == 200) {
212
- // dataset2.filename = responsedata.data.fileuri;
213
- // setData(
214
- // data != null
215
- // ? prevData => [...prevData, dataset2.filename]
216
- // : [dataset2.filename],
217
- // );
218
- // responseJSON.consultationEdit.editStatus = true;
219
- // setrefreshCount(refreshCount + 1);
220
- // props.editStatus(1);
221
- // props.data.usertype =
222
- // Global.PatientDetails != undefined &&
223
- // Global.PatientDetails.usertype != undefined &&
224
- // Global.PatientDetails.usertype != null
225
- // ? Global.PatientDetails.usertype
226
- // : 'Z';
227
- // props.data.suuser =
228
- // Global.userData != undefined &&
229
- // Global.userData.suuser != undefined &&
230
- // Global.userData.suuser != null
231
- // ? Global.userData.suuser
232
- // : 0;
233
- // setLoading(false);
234
- // } else {
235
- // setLoading(false);
236
- // }
237
- // })
238
- // .catch(error => {
239
- // setLoading(false);
240
- // });
241
-
242
- // For now, just add to local state
243
- setData(
244
- data != null
245
- ? [...data, dataset2]
246
- : [dataset2],
247
- );
248
- setrefreshCount(refreshCount + 1);
249
- props.editStatus(1);
250
- setLoading(false);
251
- }
252
- }
253
- }
254
-
255
- function RecordVideo() {
256
- navigation.navigate('CCaptureImageWithoutEdit', {
257
- cameramoduletype: 1, // video
258
- hidebuttons: false,
259
- cameratype: 'back',
260
- onSelect: s => (s && isNU(s) ? Media_Upload(s) : null),
261
- });
262
- }
263
-
264
- return (
265
- <View style={{flex: 1}}>
266
- <View style={styles.itemContainer}>
267
- {/* Delete Button */}
268
- {deleteVideo && (
269
- <TouchableOpacity
270
- style={styles.deleteButton}
271
- onPress={deleteSelectedVideo}>
272
- <AntDesign name="delete" size={30} color={'red'} />
273
- <Text style={styles.deleteText}>Delete Selected</Text>
274
- </TouchableOpacity>
275
- )}
276
-
277
- {/* Videos Grid */}
278
- <FlatList
279
- data={data}
280
- renderItem={renderVideo}
281
- keyExtractor={item => item.id}
282
- numColumns={3}
283
- contentContainerStyle={{alignItems: 'center', paddingTop: 10}}
284
- />
285
-
286
- {/* Loading Indicator */}
287
- {loading && (
288
- <View style={styles.loadingContainer}>
289
- <ActivityIndicator size="large" color="#0000ff" />
290
- </View>
291
- )}
292
- </View>
293
-
294
- {/* Bottom Action Bar */}
295
- <View style={styles.bottomActionBar}>
296
- <TouchableOpacity
297
- style={styles.actionButton}
298
- onPress={browseFromDevice}>
299
- <MaterialIcons name="video-library" color={'white'} size={24} />
300
- <Text style={styles.actionButtonText}>Browse Video</Text>
301
- </TouchableOpacity>
302
-
303
- <TouchableOpacity
304
- style={styles.actionButton}
305
- onPress={RecordVideo}>
306
- <Ionicons name="videocam" color={'white'} size={24} />
307
- <Text style={styles.actionButtonText}>Record Video</Text>
308
- </TouchableOpacity>
309
-
310
- <TouchableOpacity
311
- style={[styles.actionButton, disablesave && styles.disabledButton]}
312
- disabled={disablesave}
313
- onPress={() => {
314
- // Save functionality here
315
- // firebasevideosave();
316
- }}>
317
- <FontAwesome name="save" color={'white'} size={24} />
318
- <Text style={styles.actionButtonText}>Save</Text>
319
- </TouchableOpacity>
320
- </View>
321
- </View>
322
- );
323
- }
324
-
325
- const styles = StyleSheet.create({
326
- itemContainer: {
327
- flex: 1,
328
- backgroundColor: '#f5f5f5',
329
- },
330
- deleteButton: {
331
- flexDirection: 'row',
332
- alignItems: 'center',
333
- justifyContent: 'center',
334
- padding: 10,
335
- backgroundColor: '#ffebee',
336
- marginHorizontal: 10,
337
- borderRadius: 5,
338
- marginTop: 10,
339
- },
340
- deleteText: {
341
- marginLeft: 10,
342
- color: 'red',
343
- fontSize: 16,
344
- fontWeight: 'bold',
345
- },
346
- loadingContainer: {
347
- position: 'absolute',
348
- top: 0,
349
- left: 0,
350
- right: 0,
351
- bottom: 0,
352
- justifyContent: 'center',
353
- alignItems: 'center',
354
- backgroundColor: 'rgba(255, 255, 255, 0.8)',
355
- },
356
- bottomActionBar: {
357
- flexDirection: 'row',
358
- backgroundColor: 'darkblue',
359
- height: 60,
360
- justifyContent: 'space-around',
361
- alignItems: 'center',
362
- paddingHorizontal: 10,
363
- },
364
- actionButton: {
365
- alignItems: 'center',
366
- justifyContent: 'center',
367
- padding: 5,
368
- },
369
- actionButtonText: {
370
- color: 'white',
371
- fontSize: 12,
372
- marginTop: 3,
373
- textAlign: 'center',
374
- },
375
- disabledButton: {
376
- opacity: 0.5,
377
- },
378
- });