@jescon-technologies/react-native-ui-kit 0.0.5 → 0.0.7
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/dist/Common/ErrorBoundary.d.ts +15 -0
- package/dist/Common/ErrorBoundary.d.ts.map +1 -0
- package/dist/Common/ErrorBoundary.js +64 -0
- package/dist/Common/ErrorBoundary.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/src/Common/ErrorBoundary.d.ts +15 -0
- package/dist/src/Common/ErrorBoundary.d.ts.map +1 -0
- package/dist/src/Common/ErrorBoundary.js +64 -0
- package/dist/src/Common/ErrorBoundary.js.map +1 -0
- package/package.json +17 -5
- package/.gitattributes +0 -2
- package/index.d.ts +0 -66
- package/index.js +0 -66
- package/src/Alerts/AAlert.js +0 -137
- package/src/Alerts/AAlertIOS.js +0 -97
- package/src/Alerts/ABlink.js +0 -40
- package/src/Common/ErrorBoundary.tsx +0 -73
- package/src/Common/Icons.js +0 -49
- package/src/Common/NetworkServiceCall.js +0 -265
- package/src/CommonStyle/CommonTheme.js +0 -11
- package/src/CommonStyle/ComponentFunctions.js +0 -632
- package/src/CommonStyle/PopupStyle.js +0 -146
- package/src/CommonStyle/commonStyle.js +0 -93
- package/src/CommonStyle/componentStyle.js +0 -545
- package/src/CommonStyle/optionListStyles.js +0 -175
- package/src/Components/ByProductPage.js +0 -200
- package/src/Components/CDropDownListNew.js +0 -153
- package/src/Components/CSupplierList.js +0 -88
- package/src/Components/CVerificationCard.js +0 -2822
- package/src/Components/CustomButton.js +0 -67
- package/src/Components/CustomCard.js +0 -127
- package/src/Components/CustomTextInput.js +0 -47
- package/src/Components/EquipmentPage.js +0 -313
- package/src/Components/FilterInput.Copy.js +0 -723
- package/src/Components/FilterInput.js +0 -569
- package/src/Components/HSubHeading.js +0 -68
- package/src/Components/HeaderCard.js +0 -40
- package/src/Components/MoreOptionsScreen.js +0 -251
- package/src/Components/NonSwipableProductCard.js +0 -226
- package/src/Components/NonSwipableSupplierCard.js +0 -348
- package/src/Components/ProductCard.js +0 -1336
- package/src/Components/QualityProductCard.js +0 -1059
- package/src/Components/RateProductCard.js +0 -1452
- package/src/Components/RawMaterial.js +0 -261
- package/src/Components/SDropDownEdited.js +0 -549
- package/src/Components/SDropDownNew.js +0 -529
- package/src/Components/SHelpDescription.js +0 -147
- package/src/Components/STextInputNew.js +0 -510
- package/src/Components/SearchProductCard.js +0 -470
- package/src/Components/StageByProduct.js +0 -199
- package/src/Components/SupplierCard.js +0 -243
- package/src/Components/SupplierInvoiceCard.js +0 -405
- package/src/Components/SwipableSupplierCard.js +0 -136
- package/src/Components/TagTemplate.js +0 -74
- package/src/Components/WrappedComponent.js +0 -25
- package/src/Custom/CBooking.js +0 -944
- package/src/Custom/CBookingPostpone.js +0 -1822
- package/src/Custom/CCalendar.js +0 -560
- package/src/Custom/CCard.js +0 -880
- package/src/Custom/CDetailCard.js +0 -205
- package/src/Custom/CHelpImage.js +0 -52
- package/src/Custom/CReport.js +0 -569
- package/src/Custom/CScrollView.js +0 -73
- package/src/Custom/CSignature.js +0 -112
- package/src/Custom/CSliderMenu.js +0 -339
- package/src/Custom/CSupplierCard.js +0 -99
- package/src/Custom/CTemplateCard.js +0 -438
- package/src/Custom/CTokenAllocation.js +0 -1402
- package/src/Custom/CTokenListOverlay.js +0 -122
- package/src/Custom/CWardStatus.js +0 -444
- package/src/Custom/Charts/CBarChart.js +0 -218
- package/src/Custom/Charts/CDashBoardList.js +0 -133
- package/src/Custom/Charts/CDashBoardTable.js +0 -172
- package/src/Custom/Charts/CLineChart.js +0 -193
- package/src/Custom/Charts/CPieChart.js +0 -186
- package/src/Custom/Loader.js +0 -182
- package/src/Custom/OUserView.js +0 -1121
- package/src/Custom/PreviewDosage.js +0 -115
- package/src/Custom/SearchLoader.js +0 -32
- package/src/Custom/TableComponent/CActivityTable.js +0 -707
- package/src/Custom/TableComponent/CMoreButtonTable.js +0 -197
- package/src/Custom/TableComponent/CTable.js +0 -185
- package/src/Custom/TableComponent/CTextBody.js +0 -40
- package/src/Custom/TableComponent/CTextHeader.js +0 -17
- package/src/Custom/TableComponent/PreviewPrescriptionNew.js +0 -1011
- package/src/Custom/TableComponent/SDropdownTable.js +0 -491
- package/src/Custom/TableComponent/TagTable.js +0 -1200
- package/src/CustomComponents/CAddColumn.js +0 -140
- package/src/CustomComponents/CAssessmentDelete.js +0 -307
- package/src/CustomComponents/CAwesomeButton.js +0 -83
- package/src/CustomComponents/CAwesomeMoreButton.js +0 -54
- package/src/CustomComponents/CBackHandler.js +0 -273
- package/src/CustomComponents/CCalendar.js +0 -243
- package/src/CustomComponents/CCommentOverlay.js +0 -202
- package/src/CustomComponents/CComments.js +0 -162
- package/src/CustomComponents/CContainerView.js +0 -24
- package/src/CustomComponents/CCustomTextInput.js +0 -336
- package/src/CustomComponents/CDetailView.js +0 -40
- package/src/CustomComponents/CDropDownList.js +0 -153
- package/src/CustomComponents/CDropdownSelect.js +0 -555
- package/src/CustomComponents/CFooterView.js +0 -42
- package/src/CustomComponents/CImagePickerSave.js +0 -316
- package/src/CustomComponents/CModalOverlay.js +0 -91
- package/src/CustomComponents/CNetworkStatus.js +0 -327
- package/src/CustomComponents/CNotesInstructions.js +0 -1000
- package/src/CustomComponents/COverlay.js +0 -81
- package/src/CustomComponents/CRemarks.js +0 -176
- package/src/CustomComponents/CRowAdd.js +0 -143
- package/src/CustomComponents/CSummaryDropDown.js +0 -327
- package/src/CustomComponents/CText.js +0 -9
- package/src/CustomComponents/CVectorIcon.js +0 -34
- package/src/CustomComponents/HtmlContentViewer.js +0 -65
- package/src/CustomComponents/PdfContentViewer.js +0 -90
- package/src/CustomComponents/SDropDownDosage.js +0 -1087
- package/src/CustomComponents/SwipableProductCard.js +0 -246
- package/src/CustomComponents/SwipableProductImageCard.js +0 -254
- package/src/CustomComponents/WorkOrderDetails.js +0 -1216
- package/src/CustomComponents/WorkOrderDetailsPage.js +0 -1213
- package/src/HOC/ConfirmOverlay.js +0 -192
- package/src/HOC/HHeading.js +0 -70
- package/src/HOC/HMoreButton.js +0 -88
- package/src/HOC/HNatureHeading.js +0 -402
- package/src/HOC/HOCIcons.js +0 -80
- package/src/HOC/HOverlayCentered.js +0 -140
- package/src/HOC/HShadowButton.js +0 -45
- package/src/HOC/HShadowCountButton.js +0 -82
- package/src/HOC/OptionOverlay.js +0 -48
- package/src/Json/Chart.json +0 -818
- package/src/Json/Consultation.json +0 -622
- package/src/Json/CreditBill.json +0 -490
- package/src/Json/Dropdown.json +0 -216
- package/src/Json/DropdownConsultation.json +0 -228
- package/src/Json/DynamicReports.json +0 -623
- package/src/Json/Footer.json +0 -79
- package/src/Media/AudioScreen.js +0 -342
- package/src/Media/BarcodeScan.js +0 -145
- package/src/Media/CAudioPlay.js +0 -228
- package/src/Media/CCaptureImageWithoutEdit.js +0 -330
- package/src/Media/CImageGallery.js +0 -289
- package/src/Media/CImageZoom.js +0 -82
- package/src/Media/CSingleImage.js +0 -391
- package/src/Media/CSketchCanvas.js +0 -76
- package/src/Media/CVideoPlay.js +0 -31
- package/src/Media/DocumentScreen.js +0 -362
- package/src/Media/DrawingScreen.js +0 -578
- package/src/Media/ImageScreen.js +0 -309
- package/src/Media/RecordAudio.js +0 -250
- package/src/Media/RecordVideo.js +0 -223
- package/src/Media/VideoScreen.js +0 -378
- package/src/Navigation/PageNavigation.js +0 -224
- package/src/Navigation/useFocusEffect.js +0 -2
- package/src/Navigation/useFocusEffect.native.js +0 -1
- package/src/Navigation/useFocusEffect.web.js +0 -1
- package/src/Navigation/useIsFocused.js +0 -1
- package/src/Navigation/useIsFocused.native.js +0 -1
- package/src/Navigation/useIsFocused.web.js +0 -1
- package/src/Navigation/useNavigation.js +0 -2
- package/src/Navigation/useNavigation.native.js +0 -1
- package/src/Navigation/useNavigation.web.js +0 -1
- package/src/Screens/CMedications.js +0 -528
- package/src/Screens/CWebViewGallery.js +0 -203
- package/src/Screens/ChartScan.js +0 -279
- package/src/Screens/ChartScreenNew.js +0 -1579
- package/src/Screens/Consultation.js +0 -1500
- package/src/Screens/Dashboard.js +0 -778
- package/src/Screens/FileExplorer.js +0 -288
- package/src/Screens/Footer.js +0 -340
- package/src/Screens/ForgotPassword.js +0 -288
- package/src/Screens/HeaderBlock.js +0 -353
- package/src/Screens/Login.js +0 -328
- package/src/Screens/Notification.js +0 -149
- package/src/Screens/OcrScreen.js +0 -20
- package/src/Screens/PdfPreview.js +0 -507
- package/src/Screens/RegistrationDetails.js +0 -467
- package/src/Screens/SearchScreen.js +0 -582
- package/src/Screens/Splash.js +0 -788
- package/src/Screens/SwipeLeftView.js +0 -1867
- package/src/StaticComponents/SAlphabet.js +0 -47
- package/src/StaticComponents/SCheckBox.js +0 -42
- package/src/StaticComponents/SDatePicker.js +0 -208
- package/src/StaticComponents/SDatePickerLabel.js +0 -253
- package/src/StaticComponents/SDatePickerNew.js +0 -258
- package/src/StaticComponents/SDateTimePickerNew.js +0 -381
- package/src/StaticComponents/SDropDownGenerate.js +0 -450
- package/src/StaticComponents/SDropDownHoc.js +0 -636
- package/src/StaticComponents/SDropDownIcon.js +0 -500
- package/src/StaticComponents/SMenuBox.js +0 -131
- package/src/StaticComponents/SOverlay.js +0 -177
- package/src/StaticComponents/SOverlayTextInput.js +0 -109
- package/src/StaticComponents/SSearch.js +0 -438
- package/src/StaticComponents/SSearchBar.js +0 -53
- package/src/StaticComponents/SSpeedDial.js +0 -303
- package/src/StaticComponents/STextInput.js +0 -289
- package/src/StaticComponents/STextInputProps.js +0 -36
- package/src/StaticComponents/STimePicker.js +0 -171
- package/src/StaticComponents/STimingDropDownNew.js +0 -1585
- package/src/StaticComponents/STimingSwitch.js +0 -34
- package/src/layout/CContainerView.js +0 -21
- package/src/layout/CDetailView.js +0 -81
- package/src/layout/HeaderBlock.js +0 -353
- package/src/layout/INVLoginLayout.js +0 -657
- package/src/layout/Loader.js +0 -176
|
@@ -1,578 +0,0 @@
|
|
|
1
|
-
import React, {useState, useEffect, memo, useContext} from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Image,
|
|
4
|
-
StyleSheet,
|
|
5
|
-
FlatList,
|
|
6
|
-
Dimensions,
|
|
7
|
-
Text,
|
|
8
|
-
View,
|
|
9
|
-
TouchableOpacity,
|
|
10
|
-
ImageBackground,
|
|
11
|
-
ActivityIndicator,
|
|
12
|
-
PermissionsAndroid,
|
|
13
|
-
Platform,
|
|
14
|
-
} from 'react-native';
|
|
15
|
-
import Fontisto from 'react-native-vector-icons/Fontisto';
|
|
16
|
-
import CImageZoom from '../Media/CImageZoom';
|
|
17
|
-
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
18
|
-
import {APIURL, imageURL, drawingURL} from '../../../../../src/Common/apiConstants';
|
|
19
|
-
// import DocumentPicker from 'react-native-document-picker';
|
|
20
|
-
import ComponentStyles, {normalize} from '../CommonStyle/componentStyle';
|
|
21
|
-
import { useNavigation } from '../Navigation/useNavigation';
|
|
22
|
-
|
|
23
|
-
import {notifyMessage} from '../CommonStyle/ComponentFunctions';
|
|
24
|
-
import ReactNativeBlobUtil from 'react-native-blob-util';
|
|
25
|
-
import RNSketchCanvas from '@terrylinla/react-native-sketch-canvas';
|
|
26
|
-
import {Global} from '../../../../../src/Common/Global';
|
|
27
|
-
import FontAwesome from 'react-native-vector-icons/FontAwesome';
|
|
28
|
-
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
29
|
-
|
|
30
|
-
/*---------------------------------------------------------------------------------------*/
|
|
31
|
-
function DrawingScreen(props) {
|
|
32
|
-
const navigation = useNavigation();
|
|
33
|
-
const windowWidth = Dimensions.get('window').width;
|
|
34
|
-
const windowHeight = Dimensions.get('window').height;
|
|
35
|
-
const [data, setData] = useState(
|
|
36
|
-
props.data.saveddoc ? props.data.saveddoc : null,
|
|
37
|
-
);
|
|
38
|
-
console.log('props.data.saveddoc', JSON.stringify(data));
|
|
39
|
-
const [isImageShow, setImageShow] = useState(false);
|
|
40
|
-
const [mediaUrlLink, setMediaUrlLink] = useState(false);
|
|
41
|
-
const [refreshCount, setrefreshCount] = useState(1);
|
|
42
|
-
const [deleteImage, setDeleteImage] = useState(false);
|
|
43
|
-
const [loading, setLoading] = useState(false);
|
|
44
|
-
const [drawview, setDrawView] = useState(false);
|
|
45
|
-
const [process, setProcess] = useState('');
|
|
46
|
-
const [disablesave, setDisablesave] = useState(true);
|
|
47
|
-
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
props.setData(data);
|
|
50
|
-
}, [data]);
|
|
51
|
-
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
setTimeout(() => {
|
|
54
|
-
setrefreshCount(refreshCount + 1);
|
|
55
|
-
}, 2000);
|
|
56
|
-
}, []);
|
|
57
|
-
|
|
58
|
-
const SaveDrawing = async (success, pathk) => {
|
|
59
|
-
setDrawView(false);
|
|
60
|
-
console.log('Save drawing function called');
|
|
61
|
-
|
|
62
|
-
if (await isPermitted()) {
|
|
63
|
-
try {
|
|
64
|
-
var pathname = pathk;
|
|
65
|
-
var NewPathName = pathname.slice(-12);
|
|
66
|
-
console.log('newpathname', NewPathName);
|
|
67
|
-
|
|
68
|
-
const {relativePath, fileName, path} = await getResolvedPath(
|
|
69
|
-
pathk,
|
|
70
|
-
NewPathName,
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
console.log('path', path);
|
|
74
|
-
let fileid_autogenerate =
|
|
75
|
-
data != null && data.length > 0 ? data.length : 0;
|
|
76
|
-
let dataset = {
|
|
77
|
-
fileid: fileid_autogenerate + 1,
|
|
78
|
-
uri: 'file://' + path,
|
|
79
|
-
filename: NewPathName + Date(),
|
|
80
|
-
uritype: false,
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
setLoading(false);
|
|
84
|
-
Media_Upload(dataset);
|
|
85
|
-
|
|
86
|
-
} catch (error) {
|
|
87
|
-
notifyMessage(
|
|
88
|
-
DocumentPicker.isCancel(error)
|
|
89
|
-
? 'Canceled'
|
|
90
|
-
: 'Unknown Error: ' + JSON.stringify(error),
|
|
91
|
-
2,
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
/*---------------------------------------------------------------------------------------*/
|
|
98
|
-
const isPermitted = async () => {
|
|
99
|
-
if (Platform.OS === 'android') {
|
|
100
|
-
try {
|
|
101
|
-
const granted = await PermissionsAndroid.request(
|
|
102
|
-
PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE,
|
|
103
|
-
);
|
|
104
|
-
return granted === PermissionsAndroid.RESULTS.GRANTED;
|
|
105
|
-
} catch (err) {
|
|
106
|
-
alert('Write permission error', err);
|
|
107
|
-
return false;
|
|
108
|
-
}
|
|
109
|
-
} else {
|
|
110
|
-
return true;
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
/*---------------------------------------------------------------------------------------*/
|
|
114
|
-
function deleteSelectedImage() {
|
|
115
|
-
data
|
|
116
|
-
.filter(item => item.deletestatus === true)
|
|
117
|
-
.forEach(item => data.splice(data.indexOf(item), 1));
|
|
118
|
-
setDeleteImage(!deleteImage);
|
|
119
|
-
setrefreshCount(refreshCount + 1);
|
|
120
|
-
}
|
|
121
|
-
/*---------------------------------------------------------------------------------------*/
|
|
122
|
-
function ImageZoom(data) {
|
|
123
|
-
data.item.uritype
|
|
124
|
-
? setMediaUrlLink(data.item.uri)
|
|
125
|
-
: setMediaUrlLink(data.item.uri);
|
|
126
|
-
setImageShow(true);
|
|
127
|
-
}
|
|
128
|
-
/*---------------------------------------------------------------------------------------*/
|
|
129
|
-
function changeStatus(data) {
|
|
130
|
-
data.item.deletestatus = !data.item.deletestatus;
|
|
131
|
-
setrefreshCount(refreshCount + 1);
|
|
132
|
-
}
|
|
133
|
-
/*---------------------------------------------------------------------------------------*/
|
|
134
|
-
function renderImage(renderdata) {
|
|
135
|
-
return (
|
|
136
|
-
<View>
|
|
137
|
-
{renderdata.item.filename ? (
|
|
138
|
-
<TouchableOpacity
|
|
139
|
-
style={{
|
|
140
|
-
height: windowHeight * 0.15,
|
|
141
|
-
width: windowWidth * 0.3,
|
|
142
|
-
margin: 5,
|
|
143
|
-
backgroundColor: '#e1e4e8',
|
|
144
|
-
borderRadius: 5,
|
|
145
|
-
}}
|
|
146
|
-
onPress={() =>
|
|
147
|
-
navigation.navigate('CImageGallery', {
|
|
148
|
-
savedimages: data,
|
|
149
|
-
index: renderdata.index,
|
|
150
|
-
})
|
|
151
|
-
}
|
|
152
|
-
onLongPress={() => setDeleteImage(true)}>
|
|
153
|
-
<Image
|
|
154
|
-
style={{
|
|
155
|
-
width: '100%',
|
|
156
|
-
height: '100%',
|
|
157
|
-
borderRadius: normalize(10),
|
|
158
|
-
}}
|
|
159
|
-
source={{
|
|
160
|
-
uri: imageURL + renderdata.item.filename,
|
|
161
|
-
}}
|
|
162
|
-
/>
|
|
163
|
-
</TouchableOpacity>
|
|
164
|
-
) : null}
|
|
165
|
-
{isImageShow ? (
|
|
166
|
-
<CImageZoom
|
|
167
|
-
image={mediaUrlLink}
|
|
168
|
-
navigation={navigation}
|
|
169
|
-
visibility={val => (val == undefined ? null : setImageShow(val))}
|
|
170
|
-
mediaupload={Media_Upload}
|
|
171
|
-
/>
|
|
172
|
-
) : null}
|
|
173
|
-
{deleteImage ? (
|
|
174
|
-
<TouchableOpacity onPress={() => changeStatus(renderdata)}>
|
|
175
|
-
<View style={{justifyContent: 'center', alignItems: 'center'}}>
|
|
176
|
-
<Fontisto
|
|
177
|
-
name={
|
|
178
|
-
!renderdata.item.deletestatus
|
|
179
|
-
? 'checkbox-passive'
|
|
180
|
-
: 'checkbox-active'
|
|
181
|
-
}
|
|
182
|
-
size={25}
|
|
183
|
-
color={!renderdata.item.deletestatus ? 'lightgrey' : 'blue'}
|
|
184
|
-
/>
|
|
185
|
-
</View>
|
|
186
|
-
</TouchableOpacity>
|
|
187
|
-
) : null}
|
|
188
|
-
</View>
|
|
189
|
-
);
|
|
190
|
-
}
|
|
191
|
-
/*---------------------------------------------------------------------------------------*/
|
|
192
|
-
const getResolvedPath = async (uri, filen) => {
|
|
193
|
-
console.log('getResolvedPath', uri, filen);
|
|
194
|
-
const fileBase64 = await ReactNativeBlobUtil.fs.readFile(uri, 'base64');
|
|
195
|
-
const relativePath = ReactNativeBlobUtil.fs.dirs.CacheDir;
|
|
196
|
-
const fileName = `${filen}`;
|
|
197
|
-
const path = `${relativePath}/${fileName}`;
|
|
198
|
-
|
|
199
|
-
await ReactNativeBlobUtil.fs.writeFile(path, fileBase64, 'base64');
|
|
200
|
-
return {relativePath, fileName, path};
|
|
201
|
-
};
|
|
202
|
-
/*---------------------------------------------------------------------------------------*/
|
|
203
|
-
|
|
204
|
-
const startDrawing = () => {
|
|
205
|
-
setDrawView(true);
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
const browseFromDevice = async () => {
|
|
209
|
-
if (await isPermitted()) {
|
|
210
|
-
try {
|
|
211
|
-
setLoading(true);
|
|
212
|
-
const fileDetails = await DocumentPicker.pick({
|
|
213
|
-
type: [DocumentPicker.types.images],
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
const {relativePath, fileName, path} = await getResolvedPath(
|
|
217
|
-
fileDetails[0].uri,
|
|
218
|
-
fileDetails[0].name,
|
|
219
|
-
);
|
|
220
|
-
|
|
221
|
-
let fileid_autogenerate =
|
|
222
|
-
data != null && data.length > 0 ? data.length : 0;
|
|
223
|
-
let dataset = {
|
|
224
|
-
fileid: fileid_autogenerate + 1,
|
|
225
|
-
uri: 'file://' + path,
|
|
226
|
-
filename: fileDetails[0].name + Date(),
|
|
227
|
-
uritype: false,
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
setLoading(false);
|
|
231
|
-
Media_Upload(dataset);
|
|
232
|
-
|
|
233
|
-
} catch (error) {
|
|
234
|
-
notifyMessage(
|
|
235
|
-
DocumentPicker.isCancel(error)
|
|
236
|
-
? 'Canceled'
|
|
237
|
-
: 'Unknown Error: ' + JSON.stringify(error),
|
|
238
|
-
2,
|
|
239
|
-
);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
async function Media_Upload(image) {
|
|
245
|
-
console.log('imageeeeeeeeeee upload', JSON.stringify(image));
|
|
246
|
-
let date = new Date().getDate();
|
|
247
|
-
let month = new Date().getMonth() + 1;
|
|
248
|
-
let year = new Date().getFullYear();
|
|
249
|
-
let hours = new Date().getHours();
|
|
250
|
-
let min = new Date().getMinutes();
|
|
251
|
-
let sec = new Date().getSeconds();
|
|
252
|
-
let millisec = new Date().getMilliseconds();
|
|
253
|
-
let uniquename = `${millisec}` + '.png';
|
|
254
|
-
|
|
255
|
-
let fileid_autogenerate = data != null && data.length > 0 ? data.length : 0;
|
|
256
|
-
let dataset2 = {
|
|
257
|
-
fileid: fileid_autogenerate + 1,
|
|
258
|
-
filename: uniquename,
|
|
259
|
-
filetype: image.filetype,
|
|
260
|
-
uri: image.uri,
|
|
261
|
-
uritype: false,
|
|
262
|
-
};
|
|
263
|
-
|
|
264
|
-
if (!dataset2.uritype) {
|
|
265
|
-
if (dataset2.uri) {
|
|
266
|
-
var formData = new FormData();
|
|
267
|
-
formData.append('file', {
|
|
268
|
-
uri: dataset2.uri,
|
|
269
|
-
type: 'image/png',
|
|
270
|
-
name: dataset2.filename,
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
console.log('formData>>>>>>>>>>>>>', JSON.stringify(formData));
|
|
274
|
-
|
|
275
|
-
// Replace NetworkServiceCall with your actual API call
|
|
276
|
-
// NetworkServiceCall(
|
|
277
|
-
// 'multiform',
|
|
278
|
-
// APIURL + 'file/fileupload/emr/image',
|
|
279
|
-
// formData,
|
|
280
|
-
// )
|
|
281
|
-
// .then(function (responsedata) {
|
|
282
|
-
// console.log('responsedata>>>>>>>>>>>>>>>', JSON.stringify(responsedata));
|
|
283
|
-
// if (responsedata.httpstatus == 200) {
|
|
284
|
-
// dataset2.filename = responsedata.data.fileuri;
|
|
285
|
-
// setData(
|
|
286
|
-
// data != null
|
|
287
|
-
// ? prevData => [...prevData, dataset2.filename]
|
|
288
|
-
// : [dataset2.filename],
|
|
289
|
-
// );
|
|
290
|
-
// responseJSON.consultationEdit.editStatus = true;
|
|
291
|
-
// setrefreshCount(refreshCount + 1);
|
|
292
|
-
// props.editStatus(1);
|
|
293
|
-
// props.data.usertype =
|
|
294
|
-
// Global.PatientDetails != undefined &&
|
|
295
|
-
// Global.PatientDetails.usertype != undefined &&
|
|
296
|
-
// Global.PatientDetails.usertype != null
|
|
297
|
-
// ? Global.PatientDetails.usertype
|
|
298
|
-
// : 'Z';
|
|
299
|
-
// props.data.suuser =
|
|
300
|
-
// Global.userData != undefined &&
|
|
301
|
-
// Global.userData.suuser != undefined &&
|
|
302
|
-
// Global.userData.suuser != null
|
|
303
|
-
// ? Global.userData.suuser
|
|
304
|
-
// : 0;
|
|
305
|
-
// setLoading(false);
|
|
306
|
-
// } else {
|
|
307
|
-
// setLoading(false);
|
|
308
|
-
// }
|
|
309
|
-
// })
|
|
310
|
-
// .catch(error => {
|
|
311
|
-
// console.log('errorrrrrrrrrr', JSON.stringify(error));
|
|
312
|
-
// setLoading(false);
|
|
313
|
-
// });
|
|
314
|
-
|
|
315
|
-
// For now, just add to local state
|
|
316
|
-
setData(
|
|
317
|
-
data != null
|
|
318
|
-
? [...data, dataset2]
|
|
319
|
-
: [dataset2],
|
|
320
|
-
);
|
|
321
|
-
setrefreshCount(refreshCount + 1);
|
|
322
|
-
setLoading(false);
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
return (
|
|
328
|
-
<View style={{flex: 1}}>
|
|
329
|
-
<View style={styles.itemContainer}>
|
|
330
|
-
{/* Delete Button */}
|
|
331
|
-
{deleteImage && (
|
|
332
|
-
<TouchableOpacity
|
|
333
|
-
style={styles.deleteButton}
|
|
334
|
-
onPress={deleteSelectedImage}>
|
|
335
|
-
<AntDesign name="delete" size={30} color={'red'} />
|
|
336
|
-
<Text style={styles.deleteText}>Delete Selected</Text>
|
|
337
|
-
</TouchableOpacity>
|
|
338
|
-
)}
|
|
339
|
-
|
|
340
|
-
{/* Images Grid */}
|
|
341
|
-
{!drawview && (
|
|
342
|
-
<FlatList
|
|
343
|
-
data={data}
|
|
344
|
-
contentContainerStyle={{alignItems: 'center', marginTop: 10}}
|
|
345
|
-
renderItem={renderImage}
|
|
346
|
-
keyExtractor={item => item.fileid}
|
|
347
|
-
numColumns={3}
|
|
348
|
-
/>
|
|
349
|
-
)}
|
|
350
|
-
|
|
351
|
-
{/* Drawing Canvas */}
|
|
352
|
-
{drawview && (
|
|
353
|
-
<View style={styles.container}>
|
|
354
|
-
<View style={{flex: 1, flexDirection: 'row'}}>
|
|
355
|
-
<RNSketchCanvas
|
|
356
|
-
containerStyle={{backgroundColor: 'transparent', flex: 1}}
|
|
357
|
-
canvasStyle={{backgroundColor: 'transparent', flex: 1}}
|
|
358
|
-
defaultStrokeIndex={0}
|
|
359
|
-
defaultStrokeWidth={5}
|
|
360
|
-
closeComponent={
|
|
361
|
-
<View style={styles.functionButton}>
|
|
362
|
-
<Text style={{color: 'white'}}>Close</Text>
|
|
363
|
-
</View>
|
|
364
|
-
}
|
|
365
|
-
onClosePressed={() => {
|
|
366
|
-
setDrawView(false);
|
|
367
|
-
}}
|
|
368
|
-
undoComponent={
|
|
369
|
-
<View style={styles.functionButton}>
|
|
370
|
-
<Text style={{color: 'white'}}>Undo</Text>
|
|
371
|
-
</View>
|
|
372
|
-
}
|
|
373
|
-
clearComponent={
|
|
374
|
-
<View style={styles.functionButton}>
|
|
375
|
-
<Text style={{color: 'white'}}>Clear</Text>
|
|
376
|
-
</View>
|
|
377
|
-
}
|
|
378
|
-
eraseComponent={
|
|
379
|
-
<View style={styles.functionButton}>
|
|
380
|
-
<Text style={{color: 'white'}}>Eraser</Text>
|
|
381
|
-
</View>
|
|
382
|
-
}
|
|
383
|
-
strokeComponent={color => (
|
|
384
|
-
<View
|
|
385
|
-
style={[{backgroundColor: color}, styles.strokeColorButton]}
|
|
386
|
-
/>
|
|
387
|
-
)}
|
|
388
|
-
strokeSelectedComponent={(color, index, changed) => {
|
|
389
|
-
return (
|
|
390
|
-
<View
|
|
391
|
-
style={[
|
|
392
|
-
{backgroundColor: color, borderWidth: 2},
|
|
393
|
-
styles.strokeColorButton,
|
|
394
|
-
]}
|
|
395
|
-
/>
|
|
396
|
-
);
|
|
397
|
-
}}
|
|
398
|
-
strokeWidthComponent={w => {
|
|
399
|
-
return (
|
|
400
|
-
<View style={styles.strokeWidthButton}>
|
|
401
|
-
<View
|
|
402
|
-
style={{
|
|
403
|
-
backgroundColor: 'white',
|
|
404
|
-
marginHorizontal: 2.5,
|
|
405
|
-
width: Math.sqrt(w / 3) * 10,
|
|
406
|
-
height: Math.sqrt(w / 3) * 10,
|
|
407
|
-
borderRadius: (Math.sqrt(w / 3) * 10) / 2,
|
|
408
|
-
}}
|
|
409
|
-
/>
|
|
410
|
-
</View>
|
|
411
|
-
);
|
|
412
|
-
}}
|
|
413
|
-
saveComponent={
|
|
414
|
-
<View style={styles.functionButton}>
|
|
415
|
-
<Text style={{color: 'white'}}>Save</Text>
|
|
416
|
-
</View>
|
|
417
|
-
}
|
|
418
|
-
savePreference={() => {
|
|
419
|
-
return {
|
|
420
|
-
folder: ReactNativeBlobUtil.fs.dirs.CacheDir,
|
|
421
|
-
filename: String(Math.ceil(Math.random() * 100000000)),
|
|
422
|
-
transparent: false,
|
|
423
|
-
imageType: 'png',
|
|
424
|
-
};
|
|
425
|
-
}}
|
|
426
|
-
onSketchSaved={(success, pathk) => {
|
|
427
|
-
SaveDrawing(success, pathk);
|
|
428
|
-
console.log('success,path', success, pathk);
|
|
429
|
-
}}
|
|
430
|
-
onPathsChange={pathsCount => {
|
|
431
|
-
console.log('pathsCount', pathsCount);
|
|
432
|
-
}}
|
|
433
|
-
permissionDialogTitle={'PERMISSION'}
|
|
434
|
-
permissionDialogMessage={'App needs access to Storage data'}
|
|
435
|
-
/>
|
|
436
|
-
</View>
|
|
437
|
-
</View>
|
|
438
|
-
)}
|
|
439
|
-
|
|
440
|
-
{/* Loading Indicator */}
|
|
441
|
-
{loading && (
|
|
442
|
-
<View style={styles.loadingContainer}>
|
|
443
|
-
<ActivityIndicator size="large" color="#0000ff" />
|
|
444
|
-
</View>
|
|
445
|
-
)}
|
|
446
|
-
</View>
|
|
447
|
-
|
|
448
|
-
{/* Bottom Action Bar */}
|
|
449
|
-
{!drawview && (
|
|
450
|
-
<View style={styles.bottomActionBar}>
|
|
451
|
-
<TouchableOpacity
|
|
452
|
-
style={styles.actionButton}
|
|
453
|
-
onPress={startDrawing}>
|
|
454
|
-
<MaterialIcons name="edit" color={'white'} size={normalize(24)} />
|
|
455
|
-
<Text style={styles.actionButtonText}>Draw</Text>
|
|
456
|
-
</TouchableOpacity>
|
|
457
|
-
|
|
458
|
-
<TouchableOpacity
|
|
459
|
-
style={styles.actionButton}
|
|
460
|
-
onPress={browseFromDevice}>
|
|
461
|
-
<MaterialIcons name="insert-photo" color={'white'} size={normalize(24)} />
|
|
462
|
-
<Text style={styles.actionButtonText}>Browse</Text>
|
|
463
|
-
</TouchableOpacity>
|
|
464
|
-
|
|
465
|
-
<TouchableOpacity
|
|
466
|
-
style={styles.actionButton}
|
|
467
|
-
onPress={() => {
|
|
468
|
-
// Add camera functionality here
|
|
469
|
-
// CaptureImage();
|
|
470
|
-
}}>
|
|
471
|
-
<FontAwesome name="camera" color={'white'} size={normalize(24)} />
|
|
472
|
-
<Text style={styles.actionButtonText}>Camera</Text>
|
|
473
|
-
</TouchableOpacity>
|
|
474
|
-
|
|
475
|
-
<TouchableOpacity
|
|
476
|
-
style={[styles.actionButton, disablesave && styles.disabledButton]}
|
|
477
|
-
disabled={disablesave}
|
|
478
|
-
onPress={() => {
|
|
479
|
-
// Save functionality
|
|
480
|
-
// firebaseimagesave();
|
|
481
|
-
}}>
|
|
482
|
-
<FontAwesome name="save" color={'white'} size={normalize(24)} />
|
|
483
|
-
<Text style={styles.actionButtonText}>Save</Text>
|
|
484
|
-
</TouchableOpacity>
|
|
485
|
-
</View>
|
|
486
|
-
)}
|
|
487
|
-
</View>
|
|
488
|
-
);
|
|
489
|
-
}
|
|
490
|
-
/*---------------------------------------------------------------------------------------*/
|
|
491
|
-
const styles = StyleSheet.create({
|
|
492
|
-
itemContainer: {
|
|
493
|
-
flex: 1,
|
|
494
|
-
backgroundColor: 'transparent',
|
|
495
|
-
},
|
|
496
|
-
container: {
|
|
497
|
-
flex: 1,
|
|
498
|
-
justifyContent: 'center',
|
|
499
|
-
alignItems: 'center',
|
|
500
|
-
backgroundColor: '#F5FCFF',
|
|
501
|
-
},
|
|
502
|
-
strokeColorButton: {
|
|
503
|
-
marginHorizontal: 2.5,
|
|
504
|
-
marginVertical: 8,
|
|
505
|
-
width: 30,
|
|
506
|
-
height: 30,
|
|
507
|
-
borderRadius: 15,
|
|
508
|
-
},
|
|
509
|
-
strokeWidthButton: {
|
|
510
|
-
marginHorizontal: 2.5,
|
|
511
|
-
marginVertical: 8,
|
|
512
|
-
width: 30,
|
|
513
|
-
height: 30,
|
|
514
|
-
borderRadius: 15,
|
|
515
|
-
justifyContent: 'center',
|
|
516
|
-
alignItems: 'center',
|
|
517
|
-
backgroundColor: '#39579A',
|
|
518
|
-
},
|
|
519
|
-
functionButton: {
|
|
520
|
-
marginHorizontal: 2.5,
|
|
521
|
-
marginVertical: 8,
|
|
522
|
-
height: 30,
|
|
523
|
-
width: 60,
|
|
524
|
-
backgroundColor: '#39579A',
|
|
525
|
-
justifyContent: 'center',
|
|
526
|
-
alignItems: 'center',
|
|
527
|
-
borderRadius: 5,
|
|
528
|
-
},
|
|
529
|
-
deleteButton: {
|
|
530
|
-
flexDirection: 'row',
|
|
531
|
-
alignItems: 'center',
|
|
532
|
-
justifyContent: 'center',
|
|
533
|
-
padding: 10,
|
|
534
|
-
backgroundColor: '#ffebee',
|
|
535
|
-
marginHorizontal: 10,
|
|
536
|
-
borderRadius: 5,
|
|
537
|
-
marginTop: 10,
|
|
538
|
-
},
|
|
539
|
-
deleteText: {
|
|
540
|
-
marginLeft: 10,
|
|
541
|
-
color: 'red',
|
|
542
|
-
fontSize: 16,
|
|
543
|
-
fontWeight: 'bold',
|
|
544
|
-
},
|
|
545
|
-
loadingContainer: {
|
|
546
|
-
position: 'absolute',
|
|
547
|
-
top: 0,
|
|
548
|
-
left: 0,
|
|
549
|
-
right: 0,
|
|
550
|
-
bottom: 0,
|
|
551
|
-
justifyContent: 'center',
|
|
552
|
-
alignItems: 'center',
|
|
553
|
-
backgroundColor: 'rgba(255, 255, 255, 0.8)',
|
|
554
|
-
},
|
|
555
|
-
bottomActionBar: {
|
|
556
|
-
flexDirection: 'row',
|
|
557
|
-
backgroundColor: 'darkblue',
|
|
558
|
-
height: normalize(60),
|
|
559
|
-
justifyContent: 'space-around',
|
|
560
|
-
alignItems: 'center',
|
|
561
|
-
paddingHorizontal: 10,
|
|
562
|
-
},
|
|
563
|
-
actionButton: {
|
|
564
|
-
alignItems: 'center',
|
|
565
|
-
justifyContent: 'center',
|
|
566
|
-
padding: 5,
|
|
567
|
-
},
|
|
568
|
-
actionButtonText: {
|
|
569
|
-
color: 'white',
|
|
570
|
-
fontSize: normalize(10),
|
|
571
|
-
marginTop: 3,
|
|
572
|
-
},
|
|
573
|
-
disabledButton: {
|
|
574
|
-
opacity: 0.5,
|
|
575
|
-
},
|
|
576
|
-
});
|
|
577
|
-
/*---------------------------------------------------------------------------------------*/
|
|
578
|
-
export default memo(DrawingScreen);
|