@jescon-technologies/react-native-ui-kit 0.0.4 → 0.0.5
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.d.ts +66 -0
- package/index.js +0 -4
- package/package.json +3 -2
- package/src/Alerts/AAlert.js +3 -3
- package/src/Alerts/AAlertIOS.js +3 -3
- package/src/{common → Common}/NetworkServiceCall.js +1 -1
- package/src/CommonStyle/CommonTheme.js +11 -0
- package/src/CommonStyle/ComponentFunctions.js +632 -0
- package/src/CommonStyle/PopupStyle.js +146 -0
- package/src/CommonStyle/commonStyle.js +93 -0
- package/src/CommonStyle/componentStyle.js +545 -0
- package/src/CommonStyle/optionListStyles.js +175 -0
- package/src/Components/ByProductPage.js +200 -0
- package/src/Components/CDropDownListNew.js +153 -0
- package/src/Components/CSupplierList.js +88 -0
- package/src/Components/CVerificationCard.js +2822 -0
- package/src/Components/CustomButton.js +67 -0
- package/src/Components/CustomCard.js +127 -0
- package/src/Components/CustomTextInput.js +47 -0
- package/src/Components/EquipmentPage.js +313 -0
- package/src/Components/FilterInput.Copy.js +723 -0
- package/src/Components/FilterInput.js +569 -0
- package/src/Components/HSubHeading.js +68 -0
- package/src/Components/HeaderCard.js +40 -0
- package/src/Components/MoreOptionsScreen.js +251 -0
- package/src/Components/NonSwipableProductCard.js +226 -0
- package/src/Components/NonSwipableSupplierCard.js +348 -0
- package/src/Components/ProductCard.js +1336 -0
- package/src/Components/QualityProductCard.js +1059 -0
- package/src/Components/RateProductCard.js +1452 -0
- package/src/Components/RawMaterial.js +261 -0
- package/src/Components/SDropDownEdited.js +549 -0
- package/src/Components/SDropDownNew.js +529 -0
- package/src/Components/SHelpDescription.js +147 -0
- package/src/Components/STextInputNew.js +510 -0
- package/src/Components/SearchProductCard.js +470 -0
- package/src/Components/StageByProduct.js +199 -0
- package/src/Components/SupplierCard.js +243 -0
- package/src/Components/SupplierInvoiceCard.js +405 -0
- package/src/Components/SwipableSupplierCard.js +136 -0
- package/src/Components/TagTemplate.js +74 -0
- package/src/Components/WrappedComponent.js +25 -0
- package/src/Custom/CBooking.js +944 -0
- package/src/Custom/CBookingPostpone.js +1822 -0
- package/src/Custom/CCalendar.js +560 -0
- package/src/Custom/CCard.js +880 -0
- package/src/Custom/CDetailCard.js +205 -0
- package/src/Custom/CHelpImage.js +52 -0
- package/src/Custom/CReport.js +569 -0
- package/src/Custom/CScrollView.js +73 -0
- package/src/Custom/CSignature.js +112 -0
- package/src/Custom/CSliderMenu.js +339 -0
- package/src/Custom/CSupplierCard.js +99 -0
- package/src/Custom/CTemplateCard.js +438 -0
- package/src/Custom/CTokenAllocation.js +1402 -0
- package/src/Custom/CTokenListOverlay.js +122 -0
- package/src/Custom/CWardStatus.js +444 -0
- package/src/Custom/Charts/CBarChart.js +218 -0
- package/src/Custom/Charts/CDashBoardList.js +133 -0
- package/src/Custom/Charts/CDashBoardTable.js +172 -0
- package/src/Custom/Charts/CLineChart.js +193 -0
- package/src/Custom/Charts/CPieChart.js +186 -0
- package/src/Custom/Loader.js +182 -0
- package/src/Custom/OUserView.js +1121 -0
- package/src/Custom/PreviewDosage.js +115 -0
- package/src/Custom/SearchLoader.js +32 -0
- package/src/Custom/TableComponent/CActivityTable.js +707 -0
- package/src/Custom/TableComponent/CMoreButtonTable.js +197 -0
- package/src/Custom/TableComponent/CTable.js +185 -0
- package/src/Custom/TableComponent/CTextBody.js +40 -0
- package/src/Custom/TableComponent/CTextHeader.js +17 -0
- package/src/Custom/TableComponent/PreviewPrescriptionNew.js +1011 -0
- package/src/Custom/TableComponent/SDropdownTable.js +491 -0
- package/src/Custom/TableComponent/TagTable.js +1200 -0
- package/src/CustomComponents/CAddColumn.js +140 -0
- package/src/CustomComponents/CAssessmentDelete.js +307 -0
- package/src/CustomComponents/CAwesomeButton.js +83 -0
- package/src/CustomComponents/CAwesomeMoreButton.js +54 -0
- package/src/CustomComponents/CBackHandler.js +273 -0
- package/src/CustomComponents/CCalendar.js +243 -0
- package/src/CustomComponents/CCommentOverlay.js +202 -0
- package/src/CustomComponents/CComments.js +162 -0
- package/src/CustomComponents/CContainerView.js +24 -0
- package/src/CustomComponents/CCustomTextInput.js +336 -0
- package/src/CustomComponents/CDetailView.js +40 -0
- package/src/CustomComponents/CDropDownList.js +153 -0
- package/src/CustomComponents/CDropdownSelect.js +555 -0
- package/src/CustomComponents/CFooterView.js +42 -0
- package/src/CustomComponents/CImagePickerSave.js +316 -0
- package/src/CustomComponents/CModalOverlay.js +91 -0
- package/src/CustomComponents/CNetworkStatus.js +327 -0
- package/src/CustomComponents/CNotesInstructions.js +1000 -0
- package/src/CustomComponents/COverlay.js +81 -0
- package/src/CustomComponents/CRemarks.js +176 -0
- package/src/CustomComponents/CRowAdd.js +143 -0
- package/src/CustomComponents/CSummaryDropDown.js +327 -0
- package/src/CustomComponents/CText.js +9 -0
- package/src/CustomComponents/CVectorIcon.js +34 -0
- package/src/CustomComponents/HtmlContentViewer.js +65 -0
- package/src/CustomComponents/PdfContentViewer.js +90 -0
- package/src/CustomComponents/SDropDownDosage.js +1087 -0
- package/src/CustomComponents/SwipableProductCard.js +246 -0
- package/src/CustomComponents/SwipableProductImageCard.js +254 -0
- package/src/CustomComponents/WorkOrderDetails.js +1216 -0
- package/src/CustomComponents/WorkOrderDetailsPage.js +1213 -0
- package/src/HOC/ConfirmOverlay.js +2 -2
- package/src/HOC/HMoreButton.js +1 -1
- package/src/HOC/HNatureHeading.js +1 -1
- package/src/HOC/HShadowButton.js +1 -1
- package/src/HOC/HShadowCountButton.js +1 -1
- package/src/Json/Chart.json +818 -0
- package/src/Json/Consultation.json +622 -0
- package/src/Json/CreditBill.json +490 -0
- package/src/Json/Dropdown.json +216 -0
- package/src/Json/DropdownConsultation.json +228 -0
- package/src/Json/DynamicReports.json +623 -0
- package/src/Json/Footer.json +79 -0
- package/src/Media/AudioScreen.js +2 -7
- package/src/Media/CCaptureImageWithoutEdit.js +1 -1
- package/src/Media/CImageGallery.js +2 -2
- package/src/Media/CSingleImage.js +2 -2
- package/src/Media/CVideoPlay.js +1 -1
- package/src/Media/DocumentScreen.js +2 -7
- package/src/Media/DrawingScreen.js +2 -6
- package/src/Media/ImageScreen.js +2 -6
- package/src/Media/VideoScreen.js +2 -7
- package/src/Navigation/PageNavigation.js +224 -0
- package/src/Navigation/useFocusEffect.js +2 -0
- package/src/Navigation/useFocusEffect.native.js +1 -0
- package/src/Navigation/useFocusEffect.web.js +1 -0
- package/src/Navigation/useIsFocused.js +1 -0
- package/src/Navigation/useIsFocused.native.js +1 -0
- package/src/Navigation/useIsFocused.web.js +1 -0
- package/src/Navigation/useNavigation.js +2 -0
- package/src/Navigation/useNavigation.native.js +1 -0
- package/src/Navigation/useNavigation.web.js +1 -0
- package/src/Screens/CMedications.js +528 -0
- package/src/Screens/CWebViewGallery.js +203 -0
- package/src/Screens/ChartScan.js +279 -0
- package/src/Screens/ChartScreenNew.js +1579 -0
- package/src/Screens/Consultation.js +1500 -0
- package/src/Screens/Dashboard.js +778 -0
- package/src/Screens/FileExplorer.js +288 -0
- package/src/Screens/Footer.js +340 -0
- package/src/Screens/ForgotPassword.js +288 -0
- package/src/Screens/HeaderBlock.js +353 -0
- package/src/Screens/Login.js +328 -0
- package/src/Screens/Notification.js +149 -0
- package/src/Screens/OcrScreen.js +20 -0
- package/src/Screens/PdfPreview.js +507 -0
- package/src/Screens/RegistrationDetails.js +467 -0
- package/src/Screens/SearchScreen.js +582 -0
- package/src/Screens/Splash.js +788 -0
- package/src/Screens/SwipeLeftView.js +1867 -0
- package/src/StaticComponents/SDatePickerLabel.js +1 -1
- package/src/StaticComponents/SDatePickerNew.js +1 -1
- package/src/StaticComponents/SDateTimePickerNew.js +2 -2
- package/src/StaticComponents/SDropDownGenerate.js +3 -3
- package/src/StaticComponents/SDropDownHoc.js +4 -4
- package/src/StaticComponents/SDropDownIcon.js +1 -1
- package/src/StaticComponents/SMenuBox.js +2 -2
- package/src/StaticComponents/SSearch.js +2 -2
- package/src/StaticComponents/STextInput.js +1 -1
- package/src/StaticComponents/STimePicker.js +1 -1
- package/src/StaticComponents/STimingDropDownNew.js +2 -6
- package/src/StaticComponents/STimingSwitch.js +1 -1
- package/src/layout/CContainerView.js +1 -1
- package/src/layout/CDetailView.js +3 -3
- package/src/layout/HeaderBlock.js +5 -5
- package/src/layout/INVLoginLayout.js +3 -4
- package/src/layout/Loader.js +2 -2
- package/src/HOC/HAbsolute.js +0 -56
- package/src/HOC/HDiscontinue.js +0 -105
- package/src/HOC/HOverlay.js +0 -99
- package/src/layout/FooterBlock.js +0 -821
- /package/src/{common → Common}/ErrorBoundary.tsx +0 -0
- /package/src/{common → Common}/Icons.js +0 -0
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import React, { useState, useEffect, useContext } from 'react';
|
|
2
|
+
import FontAwesome from 'react-native-vector-icons/FontAwesome5';
|
|
3
|
+
import {
|
|
4
|
+
Text,
|
|
5
|
+
View,
|
|
6
|
+
TouchableOpacity,
|
|
7
|
+
BackHandler,
|
|
8
|
+
} from 'react-native';
|
|
9
|
+
import Entypo from 'react-native-vector-icons/Entypo';
|
|
10
|
+
import ImageScreen from '../Media/ImageScreen';
|
|
11
|
+
import AudioScreen from '../Media/AudioScreen';
|
|
12
|
+
import VideoScreen from '../Media/VideoScreen';
|
|
13
|
+
import HeaderBlock from './HeaderBlock';
|
|
14
|
+
import CDetailView from '../CustomComponents/CDetailView';
|
|
15
|
+
import CContainerView from '../CustomComponents/CContainerView';
|
|
16
|
+
import { normalize } from '../CommonStyle/componentStyle';
|
|
17
|
+
import DrawingScreen from '../Media/DrawingScreen';
|
|
18
|
+
import DocumentScreen from '../Media/DocumentScreen';
|
|
19
|
+
import HShadowButton from '../HOC/HShadowButton';
|
|
20
|
+
import { CButtonShadow, isBNUL, isNU } from '../CommonStyle/ComponentFunctions';
|
|
21
|
+
import { Global } from '../../../../../src/Common/Global';
|
|
22
|
+
//
|
|
23
|
+
export default function FileExplorer(props) {
|
|
24
|
+
|
|
25
|
+
const navigation = useNavigation();
|
|
26
|
+
// console.log("PROPSSSSSSSSSSSSSS FILE EXPLORERERERRERERRERER",JSON.stringify(props))
|
|
27
|
+
const [stage, setStage] = useState(props.route.params.visibility != undefined ? props.route.params.visibility : 1);
|
|
28
|
+
const [visibility, setVisibility] = useState(props.route.params.visibility != undefined ? props.route.params.visibility : 0);
|
|
29
|
+
|
|
30
|
+
// useEffect(() => {
|
|
31
|
+
// const backAction = () => {
|
|
32
|
+
// props.navigation.goBack();
|
|
33
|
+
// return true;
|
|
34
|
+
// };
|
|
35
|
+
// const backHandler = BackHandler.addEventListener(
|
|
36
|
+
// 'hardwareBackPress',
|
|
37
|
+
// backAction,
|
|
38
|
+
// );
|
|
39
|
+
// return () => backHandler.remove();
|
|
40
|
+
// });
|
|
41
|
+
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
const backAction = () => {
|
|
44
|
+
if (!navigation.isFocused()) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
navigation.goBack();
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
return true;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const backHandler = BackHandler.addEventListener(
|
|
55
|
+
"hardwareBackPress",
|
|
56
|
+
backAction
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
return () => backHandler.remove();
|
|
60
|
+
}, [navigation]);
|
|
61
|
+
|
|
62
|
+
const IconData = [
|
|
63
|
+
{
|
|
64
|
+
name: 'folder-images',
|
|
65
|
+
displaytext: 'Image',
|
|
66
|
+
colour: '#3dc6bd',
|
|
67
|
+
state: 1,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: 'video',
|
|
71
|
+
displaytext: 'Video',
|
|
72
|
+
colour: 'red',
|
|
73
|
+
state: 3,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: 'music',
|
|
77
|
+
displaytext: 'Audio',
|
|
78
|
+
colour: '#b04ebf',
|
|
79
|
+
state: 2,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'folder',
|
|
83
|
+
displaytext: 'Document',
|
|
84
|
+
colour: 'darkgreen',
|
|
85
|
+
state: 4,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: 'folder-images',
|
|
89
|
+
displaytext: 'Draw',
|
|
90
|
+
colour: '#800000',
|
|
91
|
+
state: 5,
|
|
92
|
+
},
|
|
93
|
+
];
|
|
94
|
+
|
|
95
|
+
let data;
|
|
96
|
+
const [gallery, setGallery] = useState(props.route.params.data);
|
|
97
|
+
var editstatus = props.route.params.eventData;
|
|
98
|
+
|
|
99
|
+
gallery != null && gallery != undefined ? (data = gallery) : null;
|
|
100
|
+
|
|
101
|
+
// console.log("GALLERYYYYYYY SAVEVEVEVVEVEVEVVEVEVEVEVVE", JSON.stringify(data))
|
|
102
|
+
|
|
103
|
+
function findFilesLength(item) {
|
|
104
|
+
|
|
105
|
+
if (item.state == 1) {
|
|
106
|
+
return isNU(data) && isBNUL(data.savedimages) ? data.savedimages.length : 0
|
|
107
|
+
}
|
|
108
|
+
else if (item.state == 2) {
|
|
109
|
+
return isNU(data) && isBNUL(data.savedaudio) ? data.savedaudio.length : 0
|
|
110
|
+
}
|
|
111
|
+
else if (item.state == 3) {
|
|
112
|
+
return isNU(data) && isBNUL(data.savedvideo) ? data.savedvideo.length : 0
|
|
113
|
+
}
|
|
114
|
+
else if (item.state == 4) {
|
|
115
|
+
return isNU(data) && isBNUL(data.savedpdf) ? data.savedpdf.length : 0
|
|
116
|
+
}
|
|
117
|
+
else if (item.state == 5) {
|
|
118
|
+
return isNU(data) && isBNUL(data.saveddoc) ? data.saveddoc.length : 0
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
return 0
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function mainView() {
|
|
127
|
+
|
|
128
|
+
// console.log('mainView', JSON.stringify(data.savedimages.length));
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<>
|
|
132
|
+
<View style={{}}>
|
|
133
|
+
<View
|
|
134
|
+
style={{
|
|
135
|
+
flexDirection: 'row',
|
|
136
|
+
width: '100%',
|
|
137
|
+
alignItems: 'center',
|
|
138
|
+
justifyContent: 'space-evenly',
|
|
139
|
+
}}>
|
|
140
|
+
{IconData.map((item, k) => {
|
|
141
|
+
return (
|
|
142
|
+
visibility == item.state || visibility == 0 ?
|
|
143
|
+
|
|
144
|
+
<View>
|
|
145
|
+
<HShadowButton
|
|
146
|
+
useicon={true}
|
|
147
|
+
usetext={true}
|
|
148
|
+
buttonstyle={{
|
|
149
|
+
margin: normalize(5),
|
|
150
|
+
borderLeftWidth: 0,
|
|
151
|
+
borderBottomWidth: 0,
|
|
152
|
+
borderRadius: 5,
|
|
153
|
+
borderWidth: 0,
|
|
154
|
+
borderColor: Global.AppTheme.primary_color,
|
|
155
|
+
justifyContent: 'center',
|
|
156
|
+
alignItems: 'center',
|
|
157
|
+
backgroundColor: item.state == stage ? '#bdd8d8' : 'white',
|
|
158
|
+
height: normalize(40),
|
|
159
|
+
width: normalize(40),
|
|
160
|
+
...CButtonShadow(),
|
|
161
|
+
}}
|
|
162
|
+
icongroup={11}
|
|
163
|
+
iconcolor={item.colour}
|
|
164
|
+
iconname={item.name}
|
|
165
|
+
iconsize={normalize(23)}
|
|
166
|
+
iconstyle={{ textAlign: 'center', borderWidth: 0 }}
|
|
167
|
+
displaytext={item.displaytext}
|
|
168
|
+
buttonCallback={() => {
|
|
169
|
+
setStage(item.state)
|
|
170
|
+
}}
|
|
171
|
+
textstyle={{
|
|
172
|
+
color: Global.AppTheme.primary_color,
|
|
173
|
+
fontSize: normalize(8),
|
|
174
|
+
textAlign: 'center',
|
|
175
|
+
fontWeight: 'normal'
|
|
176
|
+
}}
|
|
177
|
+
|
|
178
|
+
/>
|
|
179
|
+
{isNU(findFilesLength(item)) && findFilesLength(item) != 0 ?
|
|
180
|
+
<View style={{ position: 'absolute', top: -2, right: -2, borderWidth: 0.5, borderColor: 'lightgrey', elevation: 1, borderRadius: 1000, backgroundColor: Global.AppTheme.primary_color, height: normalize(18), width: normalize(18), justifyContent: 'center', alignItems: 'center' }}>
|
|
181
|
+
<Text adjustsFontSizeToFit numberOfLines={1} style={{ textAlign: 'center', fontSize: normalize(10), color: 'white', fontWeight: 'bold' }}>
|
|
182
|
+
{findFilesLength(item)}
|
|
183
|
+
</Text>
|
|
184
|
+
</View>
|
|
185
|
+
: null
|
|
186
|
+
}
|
|
187
|
+
</View>
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
// <TouchableOpacity key={k}
|
|
191
|
+
// onPress={() => setStage(item.state)}>
|
|
192
|
+
// <View
|
|
193
|
+
// style={{
|
|
194
|
+
// width: '100%',
|
|
195
|
+
// flexDirection: 'column',
|
|
196
|
+
// alignItems: 'center',
|
|
197
|
+
// justifyContent: 'center',
|
|
198
|
+
// }}>
|
|
199
|
+
// <View
|
|
200
|
+
// style={{
|
|
201
|
+
// backgroundColor:
|
|
202
|
+
// item.state == stage ? 'black' : 'white',
|
|
203
|
+
// alignItems: 'center',
|
|
204
|
+
// justifyContent: 'center',
|
|
205
|
+
// width: normalize(40),
|
|
206
|
+
// height: normalize(40),
|
|
207
|
+
// borderRadius: normalize(40) / 2,
|
|
208
|
+
// }}>
|
|
209
|
+
// <Entypo
|
|
210
|
+
// name={item.name}
|
|
211
|
+
// size={normalize(24)}
|
|
212
|
+
// color={item.colour}
|
|
213
|
+
// />
|
|
214
|
+
// </View>
|
|
215
|
+
// <View>
|
|
216
|
+
// <Text
|
|
217
|
+
// style={{
|
|
218
|
+
// color: item.state == stage ? 'lightblue' : 'black',
|
|
219
|
+
// fontSize: normalize(16),
|
|
220
|
+
// fontWeight: 'bold',
|
|
221
|
+
// }}>
|
|
222
|
+
// {item.displaytext}
|
|
223
|
+
// </Text>
|
|
224
|
+
// </View>
|
|
225
|
+
// </View>
|
|
226
|
+
// </TouchableOpacity>
|
|
227
|
+
|
|
228
|
+
: null
|
|
229
|
+
);
|
|
230
|
+
})}
|
|
231
|
+
</View>
|
|
232
|
+
</View>
|
|
233
|
+
|
|
234
|
+
{stage == 1 ?
|
|
235
|
+
<ImageScreen
|
|
236
|
+
data={data}
|
|
237
|
+
editStatus={val =>
|
|
238
|
+
val == undefined ? null : props.route.params.onselect(editstatus)
|
|
239
|
+
}
|
|
240
|
+
/>
|
|
241
|
+
|
|
242
|
+
: stage == 2 ?
|
|
243
|
+
<AudioScreen
|
|
244
|
+
data={data}
|
|
245
|
+
editStatus={val =>
|
|
246
|
+
val == undefined ? null : props.route.params.onselect(editstatus)
|
|
247
|
+
}
|
|
248
|
+
/> :
|
|
249
|
+
stage == 3 ?
|
|
250
|
+
<VideoScreen
|
|
251
|
+
data={data}
|
|
252
|
+
editStatus={val =>
|
|
253
|
+
val == undefined ? null : props.route.params.onselect(editstatus)
|
|
254
|
+
}
|
|
255
|
+
/>
|
|
256
|
+
: stage == 5 ?
|
|
257
|
+
<DrawingScreen
|
|
258
|
+
data={data}
|
|
259
|
+
editStatus={val =>
|
|
260
|
+
val == undefined ? null : props.route.params.onselect(editstatus)
|
|
261
|
+
}
|
|
262
|
+
/> :
|
|
263
|
+
<DocumentScreen
|
|
264
|
+
data={data}
|
|
265
|
+
editStatus={val =>
|
|
266
|
+
val == undefined ? null : props.route.params.onselect(editstatus)
|
|
267
|
+
}
|
|
268
|
+
/>
|
|
269
|
+
}
|
|
270
|
+
</>
|
|
271
|
+
)
|
|
272
|
+
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
return (
|
|
276
|
+
props.route.params.componenttype ?
|
|
277
|
+
mainView()
|
|
278
|
+
:
|
|
279
|
+
<CContainerView>
|
|
280
|
+
<HeaderBlock style={{ marginBottom: 30 }} />
|
|
281
|
+
<CDetailView>
|
|
282
|
+
{mainView()}
|
|
283
|
+
</CDetailView>
|
|
284
|
+
</CContainerView>
|
|
285
|
+
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import React, { useState, memo, useEffect, useContext } from 'react';
|
|
2
|
+
import { TouchableOpacity, Text, View, FlatList, Switch, Dimensions } from 'react-native';
|
|
3
|
+
import FontAwesome from 'react-native-vector-icons/FontAwesome';
|
|
4
|
+
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
5
|
+
import RNExitApp from 'react-native-exit-app';
|
|
6
|
+
import InsureResponseComponentContext from '../Handlers/insureResponseComponentContext';
|
|
7
|
+
import { Menu, MenuOptions, MenuOption, MenuTrigger, } from 'react-native-popup-menu';
|
|
8
|
+
import Loader from '../Custom/Loader';
|
|
9
|
+
import { Global } from '../../../../../src/Common/Global';
|
|
10
|
+
import { normalize } from '../CommonStyle/componentStyle';
|
|
11
|
+
import { CButtonShadow, isBNUL, isNU } from '../CommonStyle/ComponentFunctions';
|
|
12
|
+
import HShadowButton from '../HOC/HShadowButton';
|
|
13
|
+
|
|
14
|
+
const Footer = props => {
|
|
15
|
+
|
|
16
|
+
const { responseJSON, setResponseJSON } = useContext(InsureResponseComponentContext);
|
|
17
|
+
|
|
18
|
+
const [usertype] = useState(Global.PatientDetails != null && Global.PatientDetails.usertype != undefined ? Global.PatientDetails.usertype : "A")
|
|
19
|
+
let UserSpecificFooter = props.footerIcon != undefined ? (props.footerIcon).filter(obj => {
|
|
20
|
+
return obj.itemid != 2
|
|
21
|
+
}) : []
|
|
22
|
+
|
|
23
|
+
let UserSpecificMoreButton = props.footerIcon != undefined ? props.footerIcon.map(obj => ({
|
|
24
|
+
morebutton: obj.morebuttons && obj.morebuttons != null && obj.morebuttons != undefined ? obj.morebuttons.filter(element => { return element.itemid == 5 }) : null
|
|
25
|
+
})) : []
|
|
26
|
+
|
|
27
|
+
var editVar =
|
|
28
|
+
props.footerIcon != null && props.footerIcon != undefined
|
|
29
|
+
? props.footerIcon
|
|
30
|
+
: null;
|
|
31
|
+
|
|
32
|
+
if (editVar != undefined && editVar != null) {
|
|
33
|
+
var result = editVar.filter(obj => {
|
|
34
|
+
return obj.heading === 'More';
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function actionButton(data) {
|
|
39
|
+
props.buttonFunction(data)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function moreButton(data) {
|
|
43
|
+
props.buttonFunction(data)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function getIconColor(color) {
|
|
47
|
+
switch (color) {
|
|
48
|
+
case 0:
|
|
49
|
+
return Global.AppTheme.primary_color;
|
|
50
|
+
break;
|
|
51
|
+
case 1:
|
|
52
|
+
return '#f76c8f';
|
|
53
|
+
break;
|
|
54
|
+
case 2:
|
|
55
|
+
return 'lightgreen';
|
|
56
|
+
break;
|
|
57
|
+
default:
|
|
58
|
+
return Global.AppTheme.primary_color;
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function renderFooter(data) {
|
|
64
|
+
|
|
65
|
+
var x = usertype == "A" ? data.item.morebuttons : UserSpecificMoreButton[UserSpecificMoreButton.length - 1].morebutton
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<View style={{ borderWidth: 0 }}>
|
|
69
|
+
{data.item.heading == 'More' ? (
|
|
70
|
+
<View style={{ borderWidth: 0 }}>
|
|
71
|
+
<Menu>
|
|
72
|
+
<MenuTrigger>
|
|
73
|
+
<HShadowButton
|
|
74
|
+
useicon={true}
|
|
75
|
+
usetext={true}
|
|
76
|
+
disabled={true}
|
|
77
|
+
buttonstyle={{
|
|
78
|
+
...CButtonShadow(),
|
|
79
|
+
alignItems: 'center',
|
|
80
|
+
justifyContent: 'center',
|
|
81
|
+
borderWidth: 1,
|
|
82
|
+
borderColor: 'lightblue',
|
|
83
|
+
borderRadius: 10,
|
|
84
|
+
height: normalize(40),
|
|
85
|
+
width: normalize(50),
|
|
86
|
+
marginVertical: normalize(7),
|
|
87
|
+
backgroundColor: 'white'
|
|
88
|
+
}}
|
|
89
|
+
iconcolor={Global.AppTheme.primary_color}
|
|
90
|
+
icongroup={3}
|
|
91
|
+
iconname={'dots-horizontal-circle'}
|
|
92
|
+
iconsize={normalize(24)}
|
|
93
|
+
displaytext={'More'}
|
|
94
|
+
buttonCallback={() => {
|
|
95
|
+
|
|
96
|
+
}}
|
|
97
|
+
textstyle={{
|
|
98
|
+
color: Global.AppTheme.primary_color,
|
|
99
|
+
fontSize: normalize(9),
|
|
100
|
+
textAlign: 'center',
|
|
101
|
+
alignSelf: 'center'
|
|
102
|
+
}}
|
|
103
|
+
/>
|
|
104
|
+
{/* <View style={{
|
|
105
|
+
...CButtonShadow(),
|
|
106
|
+
alignItems: 'center',
|
|
107
|
+
borderWidth: 1,
|
|
108
|
+
borderColor: 'lightblue',
|
|
109
|
+
borderRadius: 10,
|
|
110
|
+
height: normalize(40),
|
|
111
|
+
width: normalize(50),
|
|
112
|
+
marginVertical: normalize(7)
|
|
113
|
+
}}>
|
|
114
|
+
<MaterialCommunityIcons
|
|
115
|
+
name={'dots-horizontal-circle'}
|
|
116
|
+
color={Global.AppTheme.primary_color}
|
|
117
|
+
size={normalize(24)}
|
|
118
|
+
/>
|
|
119
|
+
<Text
|
|
120
|
+
style={{
|
|
121
|
+
color: Global.AppTheme.primary_color,
|
|
122
|
+
fontSize: normalize(9),
|
|
123
|
+
alignSelf: 'center',
|
|
124
|
+
}}>
|
|
125
|
+
{"More"}
|
|
126
|
+
</Text>
|
|
127
|
+
</View> */}
|
|
128
|
+
</MenuTrigger>
|
|
129
|
+
<MenuOptions
|
|
130
|
+
optionsContainerStyle={{ marginTop: normalize(-52) }}
|
|
131
|
+
customStyles={{ optionsContainer: { width: '100%', shadowColor: '#ffffff00', backgroundColor: '#ffffffff' }, optionText: {}, }}>
|
|
132
|
+
<View style={{ flexDirection: 'row', flexWrap: 'wrap-reverse', justifyContent: 'flex-end', borderWidth: 0 }}>
|
|
133
|
+
{/* <MenuOptions
|
|
134
|
+
customStyles={{
|
|
135
|
+
optionsContainer: { width: '35%' },
|
|
136
|
+
optionText: {},
|
|
137
|
+
}}>
|
|
138
|
+
<View> */}
|
|
139
|
+
{x != null &&
|
|
140
|
+
x != undefined &&
|
|
141
|
+
x.map((item, key) => {
|
|
142
|
+
return (
|
|
143
|
+
|
|
144
|
+
<MenuOption
|
|
145
|
+
key={key}
|
|
146
|
+
onSelect={() => {
|
|
147
|
+
moreButton(item, item.functionname, data.item)
|
|
148
|
+
}}
|
|
149
|
+
style={{ marginHorizontal: normalize(3) }}>
|
|
150
|
+
<HShadowButton
|
|
151
|
+
useicon={true}
|
|
152
|
+
usetext={true}
|
|
153
|
+
disabled={true}
|
|
154
|
+
buttonstyle={{
|
|
155
|
+
...CButtonShadow(),
|
|
156
|
+
alignItems: 'center',
|
|
157
|
+
justifyContent: 'center',
|
|
158
|
+
borderWidth: 1,
|
|
159
|
+
borderColor: 'lightblue',
|
|
160
|
+
borderRadius: 10,
|
|
161
|
+
height: normalize(40),
|
|
162
|
+
width: normalize(50),
|
|
163
|
+
marginVertical: normalize(7),
|
|
164
|
+
backgroundColor: 'white'
|
|
165
|
+
}}
|
|
166
|
+
iconcolor={Global.AppTheme.primary_color}
|
|
167
|
+
icongroup={4}
|
|
168
|
+
iconname={item.iconname}
|
|
169
|
+
iconsize={normalize(24)}
|
|
170
|
+
displaytext={item.heading}
|
|
171
|
+
buttonCallback={() => {
|
|
172
|
+
// getFunctions(item)
|
|
173
|
+
}}
|
|
174
|
+
textstyle={{
|
|
175
|
+
color: Global.AppTheme.primary_color,
|
|
176
|
+
fontSize: normalize(9),
|
|
177
|
+
textAlign: 'center',
|
|
178
|
+
alignSelf: 'center'
|
|
179
|
+
}}
|
|
180
|
+
/>
|
|
181
|
+
</MenuOption>
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
// <MenuOption
|
|
185
|
+
// key={key}
|
|
186
|
+
// onSelect={() => moreButton(item, item.functionname, data.item)}
|
|
187
|
+
// style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
188
|
+
// <FontAwesome
|
|
189
|
+
// name={item.iconname}
|
|
190
|
+
// color={item.iconcolor ? item.iconcolor : Global.AppTheme.primary_color}
|
|
191
|
+
// size={normalize(23)}
|
|
192
|
+
// />
|
|
193
|
+
// <Text
|
|
194
|
+
// style={{
|
|
195
|
+
// fontSize: normalize(10),
|
|
196
|
+
// marginLeft: '10%',
|
|
197
|
+
// }}>
|
|
198
|
+
// {item.heading}
|
|
199
|
+
// </Text>
|
|
200
|
+
// </MenuOption>
|
|
201
|
+
);
|
|
202
|
+
})}
|
|
203
|
+
</View>
|
|
204
|
+
</MenuOptions>
|
|
205
|
+
</Menu>
|
|
206
|
+
</View>
|
|
207
|
+
) : (
|
|
208
|
+
|
|
209
|
+
<HShadowButton
|
|
210
|
+
useicon={true}
|
|
211
|
+
usetext={true}
|
|
212
|
+
disabled={false}
|
|
213
|
+
buttonstyle={{
|
|
214
|
+
...CButtonShadow(),
|
|
215
|
+
alignItems: 'center',
|
|
216
|
+
justifyContent: 'center',
|
|
217
|
+
borderWidth: 1,
|
|
218
|
+
borderColor: 'lightblue',
|
|
219
|
+
borderRadius: 10,
|
|
220
|
+
height: normalize(40),
|
|
221
|
+
width: normalize(50),
|
|
222
|
+
marginVertical: normalize(7),
|
|
223
|
+
backgroundColor: 'white'
|
|
224
|
+
}}
|
|
225
|
+
iconcolor={CheckSaveColor(data, responseJSON)}
|
|
226
|
+
icongroup={4}
|
|
227
|
+
iconname={data.item.iconname}
|
|
228
|
+
iconsize={normalize(24)}
|
|
229
|
+
displaytext={data.item.heading}
|
|
230
|
+
buttonCallback={() => {
|
|
231
|
+
actionButton(data.item)
|
|
232
|
+
}}
|
|
233
|
+
textstyle={{
|
|
234
|
+
color: Global.AppTheme.primary_color,
|
|
235
|
+
fontSize: normalize(9),
|
|
236
|
+
textAlign: 'center',
|
|
237
|
+
alignSelf: 'center'
|
|
238
|
+
}}
|
|
239
|
+
/>
|
|
240
|
+
// <TouchableOpacity
|
|
241
|
+
// onPress={() => {
|
|
242
|
+
// actionButton(data.item)
|
|
243
|
+
// }}
|
|
244
|
+
// style={{
|
|
245
|
+
// borderWidth: 1,
|
|
246
|
+
// borderColor: 'lightblue',
|
|
247
|
+
// borderRadius: 10,
|
|
248
|
+
// height: normalize(40),
|
|
249
|
+
// width: normalize(50),
|
|
250
|
+
// marginVertical: normalize(7),
|
|
251
|
+
// justifyContent: 'center',
|
|
252
|
+
// alignItems: 'center',
|
|
253
|
+
// }}>
|
|
254
|
+
// <FontAwesome
|
|
255
|
+
// name={data.item.iconname}
|
|
256
|
+
// color={CheckSaveColor(data, responseJSON)}
|
|
257
|
+
// size={normalize(24)}
|
|
258
|
+
// />
|
|
259
|
+
// <Text numberOfLines={1} adjustsFontSizeToFit style={{ color: Global.AppTheme.primary_color, fontSize: normalize(9) }}>
|
|
260
|
+
// {data.item.heading}
|
|
261
|
+
// </Text>
|
|
262
|
+
// </TouchableOpacity>
|
|
263
|
+
// <AwesomeButton
|
|
264
|
+
// onPress={() => actionButton(data.item)}
|
|
265
|
+
// borderRadius={10}
|
|
266
|
+
// borderWidth={1}
|
|
267
|
+
// height={normalize(40)}
|
|
268
|
+
// width={normalize(55)}
|
|
269
|
+
// backgroundColor={"#fff"}
|
|
270
|
+
// paddingHorizontal={0}
|
|
271
|
+
// raiseLevel={2}
|
|
272
|
+
// paddingBottom={0}
|
|
273
|
+
// borderColor={'lightblue'}
|
|
274
|
+
// paddingTop={0}>
|
|
275
|
+
|
|
276
|
+
// <View style={{ alignItems: 'center', width: normalize(50) }} >
|
|
277
|
+
// <FontAwesome
|
|
278
|
+
// name={data.item.iconname}
|
|
279
|
+
// // color={(data.item.heading == 'Save' && responseJSON.editStatus) ? '#f76c8f' : Global.AppTheme.primary_color}
|
|
280
|
+
// color={CheckSaveColor(data, responseJSON)}
|
|
281
|
+
// size={normalize(22)}
|
|
282
|
+
// />
|
|
283
|
+
// <Text numberOfLines={1} style={{ color: Global.AppTheme.primary_color, fontSize: normalize(10) }}>
|
|
284
|
+
// {data.item.heading}
|
|
285
|
+
// </Text>
|
|
286
|
+
// </View>
|
|
287
|
+
// </AwesomeButton>
|
|
288
|
+
)}
|
|
289
|
+
</View>
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function CheckSaveColor(data, context) {
|
|
294
|
+
|
|
295
|
+
if (data.item.heading == 'Save' && isNU(context) && isBNUL(context.consultation) && CheckIfEdited(context.consultation)) {
|
|
296
|
+
return '#f76c8f'
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
return Global.AppTheme.primary_color
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
function CheckIfEdited(array) {
|
|
304
|
+
|
|
305
|
+
let prevcodearray = array.filter((i, k) => { return i.editStatus ? { ...i } : undefined });
|
|
306
|
+
let prevcode = isBNUL(prevcodearray) ? true : false;
|
|
307
|
+
return prevcode;
|
|
308
|
+
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
return (
|
|
317
|
+
<View
|
|
318
|
+
style={[{
|
|
319
|
+
// ...CFooterShadow(), // offsetX offsetY blurRadius spreadDistance color
|
|
320
|
+
minHeight: Dimensions.get('screen').height * 0.06,
|
|
321
|
+
paddingVertical: 5,
|
|
322
|
+
justifyContent: 'center',
|
|
323
|
+
backgroundColor: 'white',
|
|
324
|
+
borderTopWidth: 1,
|
|
325
|
+
borderTopColor: 'lightgrey'
|
|
326
|
+
}, props.style]}
|
|
327
|
+
>
|
|
328
|
+
<View style={{ flexDirection: 'row'}}>
|
|
329
|
+
<FlatList
|
|
330
|
+
data={usertype == "A" ? props.footerIcon : UserSpecificFooter}
|
|
331
|
+
contentContainerStyle={{ flexDirection: 'row', justifyContent: 'space-between', paddingHorizontal: normalize(5) }}
|
|
332
|
+
renderItem={renderFooter}
|
|
333
|
+
keyExtractor={item => item.itemid}
|
|
334
|
+
/>
|
|
335
|
+
</View>
|
|
336
|
+
</View>
|
|
337
|
+
);
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
export default memo(Footer);
|