@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.
Files changed (177) hide show
  1. package/index.d.ts +66 -0
  2. package/index.js +0 -4
  3. package/package.json +3 -2
  4. package/src/Alerts/AAlert.js +3 -3
  5. package/src/Alerts/AAlertIOS.js +3 -3
  6. package/src/{common → Common}/NetworkServiceCall.js +1 -1
  7. package/src/CommonStyle/CommonTheme.js +11 -0
  8. package/src/CommonStyle/ComponentFunctions.js +632 -0
  9. package/src/CommonStyle/PopupStyle.js +146 -0
  10. package/src/CommonStyle/commonStyle.js +93 -0
  11. package/src/CommonStyle/componentStyle.js +545 -0
  12. package/src/CommonStyle/optionListStyles.js +175 -0
  13. package/src/Components/ByProductPage.js +200 -0
  14. package/src/Components/CDropDownListNew.js +153 -0
  15. package/src/Components/CSupplierList.js +88 -0
  16. package/src/Components/CVerificationCard.js +2822 -0
  17. package/src/Components/CustomButton.js +67 -0
  18. package/src/Components/CustomCard.js +127 -0
  19. package/src/Components/CustomTextInput.js +47 -0
  20. package/src/Components/EquipmentPage.js +313 -0
  21. package/src/Components/FilterInput.Copy.js +723 -0
  22. package/src/Components/FilterInput.js +569 -0
  23. package/src/Components/HSubHeading.js +68 -0
  24. package/src/Components/HeaderCard.js +40 -0
  25. package/src/Components/MoreOptionsScreen.js +251 -0
  26. package/src/Components/NonSwipableProductCard.js +226 -0
  27. package/src/Components/NonSwipableSupplierCard.js +348 -0
  28. package/src/Components/ProductCard.js +1336 -0
  29. package/src/Components/QualityProductCard.js +1059 -0
  30. package/src/Components/RateProductCard.js +1452 -0
  31. package/src/Components/RawMaterial.js +261 -0
  32. package/src/Components/SDropDownEdited.js +549 -0
  33. package/src/Components/SDropDownNew.js +529 -0
  34. package/src/Components/SHelpDescription.js +147 -0
  35. package/src/Components/STextInputNew.js +510 -0
  36. package/src/Components/SearchProductCard.js +470 -0
  37. package/src/Components/StageByProduct.js +199 -0
  38. package/src/Components/SupplierCard.js +243 -0
  39. package/src/Components/SupplierInvoiceCard.js +405 -0
  40. package/src/Components/SwipableSupplierCard.js +136 -0
  41. package/src/Components/TagTemplate.js +74 -0
  42. package/src/Components/WrappedComponent.js +25 -0
  43. package/src/Custom/CBooking.js +944 -0
  44. package/src/Custom/CBookingPostpone.js +1822 -0
  45. package/src/Custom/CCalendar.js +560 -0
  46. package/src/Custom/CCard.js +880 -0
  47. package/src/Custom/CDetailCard.js +205 -0
  48. package/src/Custom/CHelpImage.js +52 -0
  49. package/src/Custom/CReport.js +569 -0
  50. package/src/Custom/CScrollView.js +73 -0
  51. package/src/Custom/CSignature.js +112 -0
  52. package/src/Custom/CSliderMenu.js +339 -0
  53. package/src/Custom/CSupplierCard.js +99 -0
  54. package/src/Custom/CTemplateCard.js +438 -0
  55. package/src/Custom/CTokenAllocation.js +1402 -0
  56. package/src/Custom/CTokenListOverlay.js +122 -0
  57. package/src/Custom/CWardStatus.js +444 -0
  58. package/src/Custom/Charts/CBarChart.js +218 -0
  59. package/src/Custom/Charts/CDashBoardList.js +133 -0
  60. package/src/Custom/Charts/CDashBoardTable.js +172 -0
  61. package/src/Custom/Charts/CLineChart.js +193 -0
  62. package/src/Custom/Charts/CPieChart.js +186 -0
  63. package/src/Custom/Loader.js +182 -0
  64. package/src/Custom/OUserView.js +1121 -0
  65. package/src/Custom/PreviewDosage.js +115 -0
  66. package/src/Custom/SearchLoader.js +32 -0
  67. package/src/Custom/TableComponent/CActivityTable.js +707 -0
  68. package/src/Custom/TableComponent/CMoreButtonTable.js +197 -0
  69. package/src/Custom/TableComponent/CTable.js +185 -0
  70. package/src/Custom/TableComponent/CTextBody.js +40 -0
  71. package/src/Custom/TableComponent/CTextHeader.js +17 -0
  72. package/src/Custom/TableComponent/PreviewPrescriptionNew.js +1011 -0
  73. package/src/Custom/TableComponent/SDropdownTable.js +491 -0
  74. package/src/Custom/TableComponent/TagTable.js +1200 -0
  75. package/src/CustomComponents/CAddColumn.js +140 -0
  76. package/src/CustomComponents/CAssessmentDelete.js +307 -0
  77. package/src/CustomComponents/CAwesomeButton.js +83 -0
  78. package/src/CustomComponents/CAwesomeMoreButton.js +54 -0
  79. package/src/CustomComponents/CBackHandler.js +273 -0
  80. package/src/CustomComponents/CCalendar.js +243 -0
  81. package/src/CustomComponents/CCommentOverlay.js +202 -0
  82. package/src/CustomComponents/CComments.js +162 -0
  83. package/src/CustomComponents/CContainerView.js +24 -0
  84. package/src/CustomComponents/CCustomTextInput.js +336 -0
  85. package/src/CustomComponents/CDetailView.js +40 -0
  86. package/src/CustomComponents/CDropDownList.js +153 -0
  87. package/src/CustomComponents/CDropdownSelect.js +555 -0
  88. package/src/CustomComponents/CFooterView.js +42 -0
  89. package/src/CustomComponents/CImagePickerSave.js +316 -0
  90. package/src/CustomComponents/CModalOverlay.js +91 -0
  91. package/src/CustomComponents/CNetworkStatus.js +327 -0
  92. package/src/CustomComponents/CNotesInstructions.js +1000 -0
  93. package/src/CustomComponents/COverlay.js +81 -0
  94. package/src/CustomComponents/CRemarks.js +176 -0
  95. package/src/CustomComponents/CRowAdd.js +143 -0
  96. package/src/CustomComponents/CSummaryDropDown.js +327 -0
  97. package/src/CustomComponents/CText.js +9 -0
  98. package/src/CustomComponents/CVectorIcon.js +34 -0
  99. package/src/CustomComponents/HtmlContentViewer.js +65 -0
  100. package/src/CustomComponents/PdfContentViewer.js +90 -0
  101. package/src/CustomComponents/SDropDownDosage.js +1087 -0
  102. package/src/CustomComponents/SwipableProductCard.js +246 -0
  103. package/src/CustomComponents/SwipableProductImageCard.js +254 -0
  104. package/src/CustomComponents/WorkOrderDetails.js +1216 -0
  105. package/src/CustomComponents/WorkOrderDetailsPage.js +1213 -0
  106. package/src/HOC/ConfirmOverlay.js +2 -2
  107. package/src/HOC/HMoreButton.js +1 -1
  108. package/src/HOC/HNatureHeading.js +1 -1
  109. package/src/HOC/HShadowButton.js +1 -1
  110. package/src/HOC/HShadowCountButton.js +1 -1
  111. package/src/Json/Chart.json +818 -0
  112. package/src/Json/Consultation.json +622 -0
  113. package/src/Json/CreditBill.json +490 -0
  114. package/src/Json/Dropdown.json +216 -0
  115. package/src/Json/DropdownConsultation.json +228 -0
  116. package/src/Json/DynamicReports.json +623 -0
  117. package/src/Json/Footer.json +79 -0
  118. package/src/Media/AudioScreen.js +2 -7
  119. package/src/Media/CCaptureImageWithoutEdit.js +1 -1
  120. package/src/Media/CImageGallery.js +2 -2
  121. package/src/Media/CSingleImage.js +2 -2
  122. package/src/Media/CVideoPlay.js +1 -1
  123. package/src/Media/DocumentScreen.js +2 -7
  124. package/src/Media/DrawingScreen.js +2 -6
  125. package/src/Media/ImageScreen.js +2 -6
  126. package/src/Media/VideoScreen.js +2 -7
  127. package/src/Navigation/PageNavigation.js +224 -0
  128. package/src/Navigation/useFocusEffect.js +2 -0
  129. package/src/Navigation/useFocusEffect.native.js +1 -0
  130. package/src/Navigation/useFocusEffect.web.js +1 -0
  131. package/src/Navigation/useIsFocused.js +1 -0
  132. package/src/Navigation/useIsFocused.native.js +1 -0
  133. package/src/Navigation/useIsFocused.web.js +1 -0
  134. package/src/Navigation/useNavigation.js +2 -0
  135. package/src/Navigation/useNavigation.native.js +1 -0
  136. package/src/Navigation/useNavigation.web.js +1 -0
  137. package/src/Screens/CMedications.js +528 -0
  138. package/src/Screens/CWebViewGallery.js +203 -0
  139. package/src/Screens/ChartScan.js +279 -0
  140. package/src/Screens/ChartScreenNew.js +1579 -0
  141. package/src/Screens/Consultation.js +1500 -0
  142. package/src/Screens/Dashboard.js +778 -0
  143. package/src/Screens/FileExplorer.js +288 -0
  144. package/src/Screens/Footer.js +340 -0
  145. package/src/Screens/ForgotPassword.js +288 -0
  146. package/src/Screens/HeaderBlock.js +353 -0
  147. package/src/Screens/Login.js +328 -0
  148. package/src/Screens/Notification.js +149 -0
  149. package/src/Screens/OcrScreen.js +20 -0
  150. package/src/Screens/PdfPreview.js +507 -0
  151. package/src/Screens/RegistrationDetails.js +467 -0
  152. package/src/Screens/SearchScreen.js +582 -0
  153. package/src/Screens/Splash.js +788 -0
  154. package/src/Screens/SwipeLeftView.js +1867 -0
  155. package/src/StaticComponents/SDatePickerLabel.js +1 -1
  156. package/src/StaticComponents/SDatePickerNew.js +1 -1
  157. package/src/StaticComponents/SDateTimePickerNew.js +2 -2
  158. package/src/StaticComponents/SDropDownGenerate.js +3 -3
  159. package/src/StaticComponents/SDropDownHoc.js +4 -4
  160. package/src/StaticComponents/SDropDownIcon.js +1 -1
  161. package/src/StaticComponents/SMenuBox.js +2 -2
  162. package/src/StaticComponents/SSearch.js +2 -2
  163. package/src/StaticComponents/STextInput.js +1 -1
  164. package/src/StaticComponents/STimePicker.js +1 -1
  165. package/src/StaticComponents/STimingDropDownNew.js +2 -6
  166. package/src/StaticComponents/STimingSwitch.js +1 -1
  167. package/src/layout/CContainerView.js +1 -1
  168. package/src/layout/CDetailView.js +3 -3
  169. package/src/layout/HeaderBlock.js +5 -5
  170. package/src/layout/INVLoginLayout.js +3 -4
  171. package/src/layout/Loader.js +2 -2
  172. package/src/HOC/HAbsolute.js +0 -56
  173. package/src/HOC/HDiscontinue.js +0 -105
  174. package/src/HOC/HOverlay.js +0 -99
  175. package/src/layout/FooterBlock.js +0 -821
  176. /package/src/{common → Common}/ErrorBoundary.tsx +0 -0
  177. /package/src/{common → Common}/Icons.js +0 -0
@@ -0,0 +1,218 @@
1
+ import React, { useState } from 'react';
2
+ import { Defs, LinearGradient, Stop, Text, Line } from 'react-native-svg';
3
+ import { View, Dimensions, TouchableOpacity } from 'react-native';
4
+ import { BarChart, Grid, XAxis } from 'react-native-svg-charts';
5
+ import CText from '../../CustomComponents/CText';
6
+ import moment from 'moment';
7
+ import SDatePickerNew from '../../StaticComponents/SDatePickerNew';
8
+ import { normalize } from '../../CommonStyle/componentStyle';
9
+
10
+ export default function CBarChart(props) {
11
+ const fill = '#0e4482';
12
+ // const OverlayHOCComponentChart = HChart(HeaderBlock);
13
+ const { height, width } = Dimensions.get('screen');
14
+ const [propsData, setPropsData] = useState(props.data);
15
+ const [Nested, setNested] = useState(false);
16
+ const [data, setData] = useState((propsData).map(({ value }) => value));
17
+ const axesSvg = { fontSize: normalize(11), fill: 'grey' };
18
+ const verticalContentInset = { top: 5, bottom: 5 };
19
+ const xAxisHeight = 30;
20
+
21
+ function getDateWiseLineChart(params) {
22
+ console.log('TYGWUFYUFUF', moment(params).format('YYYY-MM-DD'));
23
+ setPropsData([{
24
+ 'value': 55,
25
+ 'display': 'JAN',
26
+ },
27
+ {
28
+ 'value': 35,
29
+ 'display': 'FEB',
30
+ }]);
31
+ setData(([{
32
+ 'value': 55,
33
+ 'display': 'JANUVARY',
34
+ },
35
+ {
36
+ 'value': 35,
37
+ 'display': 'FEBRUVARY',
38
+ }]).map(({ value }) => value));
39
+ }
40
+
41
+ function getPreviousInfo() {
42
+ setNested(true);
43
+ }
44
+
45
+ const CUT_OFF = props.component != undefined && props.component.benchmarkcutoff != undefined &&
46
+ props.component.benchmarkcutoff != 0 ? props.component.benchmarkcutoff : 0;
47
+ console.log('CUTTTTTTTT OFFFFFFFFFFFF', JSON.stringify(CUT_OFF));
48
+ const Labels = ({ x, y, bandwidth, data }) => (
49
+ data.map((value, index) => (
50
+ <Text
51
+ key={index}
52
+ x={x(index) + (bandwidth / 2)}
53
+ y={value < CUT_OFF ? y(value) - 10 : y(value) + 15}
54
+ fontSize={normalize(10)}
55
+ fontWeight={'bold'}
56
+ fill={value >= CUT_OFF ? 'white' : 'red'}
57
+ alignmentBaseline={'middle'}
58
+ textAnchor={'middle'}
59
+ >
60
+ {value}
61
+ </Text>)));
62
+
63
+ const Gradient = () => (
64
+ <Defs key={'gradient'}>
65
+ <LinearGradient id={'gradient'} x1={'0%'} y={'0%'} x2={'0%'} y2={'100%'}>
66
+ <Stop offset={'0%'} stopColor={'black'} />
67
+ <Stop offset={'100%'} stopColor={'grey'} />
68
+ </LinearGradient>
69
+ </Defs>
70
+ );
71
+
72
+ const HorizontalLine = (({ y }) => (
73
+ <Line
74
+ key={'zero-axis'}
75
+ x1={'0%'}
76
+ x2={'100%'}
77
+ y1={y(50)}
78
+ y2={y(50)}
79
+ stroke={'green'}
80
+ strokeDasharray={[4, 6]}
81
+ strokeWidth={normalize(3)}
82
+ />
83
+ ));
84
+ return (
85
+ data != null && data != undefined ?
86
+ <>
87
+ {Nested ?
88
+ <CHistoryChart data={{
89
+ 'keyid': 3,
90
+ 'customcomponent': 'CBarChart',
91
+ 'heading': 'Monthly Profit',
92
+ 'date': '2021-03-01',
93
+ 'data': [
94
+ {
95
+ 'value': 65,
96
+ 'display': 'Billed',
97
+ },
98
+ {
99
+ 'value': 65,
100
+ 'display': 'Dispensed',
101
+ },
102
+ {
103
+ 'value': 467,
104
+ 'display': 'Picked',
105
+ },
106
+ ],
107
+ }} /> : null}
108
+ <View style={{ marginRight: 2, marginTop: 10 }}>
109
+ <View style={{ justifyContent: 'space-between', flexDirection: 'row' }}>
110
+ <CText style={{ fontSize: normalize(15), paddingHorizontal: 5, fontWeight: 'bold', color: 'black' }}>{props.component.heading}</CText>
111
+ {/* <TouchableOpacity onPress={() => getPreviousInfo()} style={{ alignItems: 'center' }}>
112
+ <MaterialCommunityIcons name={'scale-balance'} color="black" size={normalize(20)} style={{ opacity: 0.8 }} />
113
+ <CText style={{ fontSize: normalize(10), color: 'black' }}>{"Compare"}</CText>
114
+ </TouchableOpacity> */}
115
+ </View>
116
+
117
+ {props.component.date != undefined ?
118
+ <View>
119
+ <SDatePickerNew
120
+ callBack={val => (val == undefined ? null : getDateWiseLineChart(val))} />
121
+ </View> : null}
122
+
123
+ <View style={{ height: normalize(225), padding: normalize(5), flexDirection: 'row' }}>
124
+ <View style={{ flex: 1 }}>
125
+ <BarChart
126
+ style={{ flex: 1 }}
127
+ data={data}
128
+ svg={{
129
+ strokeWidth: 2,
130
+ fill: 'url(#gradient)',
131
+ }}
132
+ spacingInner={0.5}
133
+ spacing={0.2}
134
+ gridMin={0}
135
+ >
136
+ {CUT_OFF != 0 ? <HorizontalLine /> : null}
137
+ <Grid />
138
+ <Gradient />
139
+ <Labels />
140
+ </BarChart>
141
+ <XAxis
142
+ style={{ marginHorizontal: -10, height: xAxisHeight }}
143
+ data={propsData}
144
+ formatLabel={(value, index) => propsData[index].display}
145
+ contentInset={{ left: normalize(20), right: normalize(40) }}
146
+ svg={{ fontSize: normalize(9), fontWeight: 'bold', fill: 'black', translateY: normalize(8), rotation: normalize(10), originY: 40 }}
147
+ />
148
+ </View>
149
+ </View>
150
+
151
+ {CUT_OFF != 0 ?
152
+ <View style={{ flexDirection: 'row', justifyContent: 'space-evenly', width: '50%', marginBottom: normalize(10) }}>
153
+ <CText style={{ color: 'darkgreen', fontWeight: 'bold' }}>----</CText>
154
+ <CText style={{ color: 'black', fontSize: normalize(14) }}>Benchmark: {CUT_OFF}</CText>
155
+ </View> : null}
156
+ </View>
157
+ </>
158
+ : null
159
+ );
160
+ }
161
+
162
+ // <CBarChart
163
+ // component={BarChart}
164
+ // data={BarChart.data}
165
+ // />
166
+
167
+ // var BarChart = {
168
+ // "keyid": 3,
169
+ // "customcomponent": "CBarChart",
170
+ // "date": "2021-03-01",
171
+ // "benchmarkcutoff": 23,
172
+ // "heading": "Yearly",
173
+ // "data": [
174
+ // {
175
+ // "value": 13,
176
+ // "display": "1"
177
+ // },
178
+ // {
179
+ // "value": 45,
180
+ // "display": "2"
181
+ // },
182
+ // {
183
+ // "value": 87,
184
+ // "display": "3"
185
+ // },
186
+ // {
187
+ // "value": 98,
188
+ // "display": "4"
189
+ // },
190
+ // {
191
+ // "value": 34,
192
+ // "display": "5"
193
+ // },
194
+ // {
195
+ // "value": 19,
196
+ // "display": "6"
197
+ // },
198
+ // {
199
+ // "value": 12,
200
+ // "display": "7"
201
+ // },
202
+ // {
203
+ // "value": 13,
204
+ // "display": "8"
205
+ // },
206
+ // {
207
+ // "value": 67,
208
+ // "display": "9"
209
+ // },
210
+ // {
211
+ // "value": 45,
212
+ // "display": "10"
213
+ // }
214
+ // ]
215
+ // }
216
+
217
+
218
+
@@ -0,0 +1,133 @@
1
+ import React from 'react';
2
+ import { View, Text, TouchableOpacity, Dimensions } from 'react-native';
3
+ import { FlashList } from '@shopify/flash-list';
4
+ import { isBNU, isBNUL } from '../../CommonStyle/ComponentFunctions';
5
+ // import PieChart from 'react-native-pie-chart';
6
+ import { normalize } from '../../CommonStyle/componentStyle';
7
+ import Icons from '../../Common/Icons';
8
+
9
+ export default function CDashBoardList(params) {
10
+ function renderDataNew(params, l, pindex) {
11
+ let newdata = isBNUL(params.item.data) ? params.item.data.filter(function (item) { return item; }) : [];
12
+ return (
13
+ isBNUL(newdata) ?
14
+ <View style={{
15
+ margin: normalize(5),
16
+ borderWidth: 1,
17
+ backgroundColor: params.item.view ? '#ffffff36' : '#ffffff00',
18
+ borderColor: 'lightgrey',
19
+ borderRadius: 5,
20
+ justifyContent: 'center',
21
+ alignItems: 'center',
22
+ padding: normalize(5),
23
+ }}>
24
+ <View style={{ borderWidth: 0, width: '100%', justifyContent: 'center', alignItems: 'center', paddingBottom: normalize(5), borderWidth: 0 }}>
25
+ <Text
26
+ style={{
27
+ fontSize: normalize(10),
28
+ fontWeight: 'bold',
29
+ color: 'black',
30
+ }}>
31
+ {params.item.heading}
32
+ </Text>
33
+ </View>
34
+
35
+ <View
36
+ style={{
37
+ flexDirection: 'row',
38
+ borderRadius: 5,
39
+ justifyContent: 'center',
40
+ alignItems: 'center',
41
+ }}
42
+ >
43
+
44
+ <PieChart
45
+ widthAndHeight={normalize(150)}
46
+ series={isBNUL(newdata) ? newdata.map((val) => { return isBNU(val.value) ? val.value : undefined; }) : []}
47
+ sliceColor={isBNUL(newdata) ? newdata.map((val) => { return isBNU(val.bcolor) ? val.bcolor : undefined; }) : []}
48
+ coverRadius={0.1}
49
+ coverFill={'#ffffff8a'}
50
+ />
51
+
52
+ <View style={{ height: normalize(210), width: normalize(160) }}>
53
+ <FlashList
54
+ showsVerticalScrollIndicator={true}
55
+ persistentscrollbar={true}
56
+ data={newdata}
57
+ nestedScrollEnabled={true}
58
+ renderItem={val => renderChartList(val, pindex, l, params.index, newdata, params.item.view)}
59
+ keyExtractor={(item, index) => index.toString()}
60
+ estimatedItemSize={normalize(20)}
61
+ />
62
+ <View style={{ justifyContent: 'center', alignItems: 'center', marginVertical: 0, zIndex: 3 }}>
63
+ <Text style={{ fontSize: normalize(10), color: 'darkblue' }}>Scroll down</Text>
64
+ <Icons.FontAwesome5
65
+ name={'sort-down'}
66
+ size={normalize(18)}
67
+ color={'darkblue'}
68
+ />
69
+ </View>
70
+ </View>
71
+ </View>
72
+ </View>
73
+ : null
74
+ );
75
+
76
+ }
77
+ function renderChartList(v, pindex, pview, newindex, darray, arrayview) {
78
+ return (
79
+ <TouchableOpacity
80
+ onPress={() => { params.callback(pindex, true, pview, newindex, darray, v.index, v.item.link, false); }}
81
+ style={{
82
+ flexDirection: 'row',
83
+ alignItems: 'center',
84
+ justifyContent: 'flex-start',
85
+ borderWidth: (arrayview && v.item.view) ? 0 : 0,
86
+ borderRadius: 5,
87
+ borderColor: 'grey',
88
+ marginVertical: normalize(3),
89
+ marginHorizontal: normalize(5),
90
+ padding: normalize(3),
91
+ borderWidth: 0,
92
+ backgroundColor: (arrayview && v.item.view) ? '#f0f0f0' : 'transparent',
93
+ }}>
94
+ <View style={{ borderWidth: 0, borderColor: '#808080', backgroundColor: v.item.bcolor, textAlign: 'center', justifyContent: 'center', alignItems: 'center', borderRadius: 5, width: normalize(35), height: normalize(20) }}>
95
+ <Text adjustsFontSizeToFit numberOfLines={2} style={{
96
+ fontSize: normalize(11),
97
+ color: '#000000',
98
+ fontWeight: 'bold',
99
+ textShadowColor: '#ffffff',
100
+ textShadowRadius: 1,
101
+ textAlign: 'center',
102
+ textShadowOffset: { width: 0, height: 1 },
103
+ }}>
104
+ {v.item.value}
105
+ </Text>
106
+ </View>
107
+ <Text adjustsFontSizeToFit numberOfLines={2} style={{ marginHorizontal: normalize(5), fontWeight: 'bold', fontSize: normalize(10), color: '#000000', borderWidth: 0, width: '75%' }}>{v.item.display}</Text>
108
+ </TouchableOpacity>
109
+ );
110
+ }
111
+
112
+ function renderChartListNew(params, i) {
113
+ let newdata = isBNUL(params) ? params.filter(function (item) { return item; }) : [];
114
+ return (
115
+ <FlashList
116
+ showsHorizontalScrollIndicator={false}
117
+ horizontal={true}
118
+ nestedScrollEnabled={true}
119
+ data={newdata}
120
+ renderItem={val => renderDataNew(val, newdata, i)}
121
+ keyExtractor={(item, index) => index.toString()}
122
+ estimatedItemSize={normalize(300)}
123
+ />
124
+ );
125
+
126
+ }
127
+
128
+ return (
129
+ <View>
130
+ {renderChartListNew(params.data, params.index)}
131
+ </View>
132
+ );
133
+ }
@@ -0,0 +1,172 @@
1
+ import React from 'react';
2
+ import { View, Text, TouchableOpacity, Dimensions, ScrollView } from 'react-native';
3
+ import { FlashList } from '@shopify/flash-list';
4
+ import { ArrayCheck, isBNU, isBNUL, isPermitted, notifyMessage, ValueCheck } from '../../CommonStyle/ComponentFunctions';
5
+ import { normalize } from '../../CommonStyle/componentStyle';
6
+ import CTextHeader from '../TableComponent/CTextHeader';
7
+ import { Global } from '../../Common/Global';
8
+ import Icons from '../../Common/Icons';
9
+ import FileViewer from 'react-native-file-viewer';
10
+ import RNFetchBlob from 'rn-fetch-blob';
11
+
12
+ export default function CDashBoardTable(params) {
13
+ function renderDataNew(params, l, pindex) {
14
+ let newdata = isBNUL(params.item.data) ? params.item.data.filter(function (item) { return item; }) : [];
15
+ return (
16
+ isBNUL(newdata) ?
17
+ <View>
18
+ <View
19
+ style={{ flexDirection: 'row', alignItems: 'center', paddingVertical: normalize(5), paddingHorizontal: normalize(5) }}>
20
+ <Icons.FontAwesome5 name={'dot-circle'} color={'black'} size={normalize(10)} />
21
+ <Text style={{
22
+ fontSize: normalize(11),
23
+ fontWeight: '800',
24
+ color: Global.AppTheme.primary_color,
25
+ }}> {params.item.heading}
26
+ </Text>
27
+
28
+ <TouchableOpacity
29
+ onPress={() => getExcelReport(newdata)}
30
+ style={{ position: 'absolute', right: normalize(30) }}>
31
+ <Icons.FontAwesome5 name={'file-excel'} color={Global.AppTheme.primary_color} size={normalize(15)} />
32
+ </TouchableOpacity>
33
+ </View>
34
+
35
+ <ScrollView horizontal={true}>
36
+ <View style={{ marginTop: normalize(3), marginHorizontal: normalize(5) }}>
37
+ <View style={{ flexDirection: 'row' }}>
38
+ {newdata.map((item, i) => {
39
+ return (
40
+ <View key={i}>
41
+ <View style={{ flexDirection: 'row' }}>
42
+ {[{ 'header': item.displayheader, 'width': item.width }].map((header, j) => {
43
+ return (
44
+ <View key={j} style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
45
+ <CTextHeader key={i}
46
+ text={header.header}
47
+ widthArr={Dimensions.get('screen').width * header.width}
48
+ bgColor={'#eae8e8'} color={'black'} borderColor={'lightgrey'} marginHorizontal={normalize(2)} borderRadius={5} elevation={3}
49
+ />
50
+ </View>
51
+ );
52
+ })}
53
+ </View>
54
+
55
+ <View>
56
+ {item.rows.map((details, k) => {
57
+ return (
58
+ <TouchableOpacity key={k}
59
+ style={{
60
+ flexDirection: 'row',
61
+ marginTop: 1,
62
+ backgroundColor: 'white',
63
+ padding: 1,
64
+ }}>
65
+ {getSwitchComponent(item, details, k)}
66
+ </TouchableOpacity>);
67
+ })}
68
+ </View>
69
+ </View>
70
+ );
71
+ })}
72
+ </View>
73
+ </View>
74
+ </ScrollView>
75
+ </View>
76
+ : null
77
+ );
78
+ }
79
+
80
+ function getExcelReport(params) {
81
+
82
+ var arrayString = ArrayCheck(params) && ValueCheck(params[0].rows) && ArrayCheck(params[0].rows) ? params[0].rows.map(s => s.value) : null;
83
+ var headerString = ArrayCheck(arrayString) ? arrayString.map(d => `${d}`).join(',') + '\n' : null;
84
+
85
+ var rowEliminate1st = ArrayCheck(params) ? params.slice(0) : null;
86
+ var dataArrFormat = ArrayCheck(rowEliminate1st) ?
87
+ rowEliminate1st.flatMap(
88
+ (o, i) => o.rows.flatMap(
89
+ (y, k) => getObjectMAP(o)
90
+ )
91
+ ) : [];
92
+ var rowString = ArrayCheck(dataArrFormat) ? dataArrFormat.map(d => `${d.data1},"${d.data2}","${d.data3}","${d.data4}","${d.data5}","${d.data6}","${d.data7}","${d.data8}","${d.data9}","${d.data10}","${d.data11}","${d.data12}","${d.data13}","${d.data14}","${d.data15}","${d.data16}","${d.data17}","${d.data18}","${d.data19}","${d.data20}"\n`).join('') : null;
93
+ var csvString = `${headerString}${rowString}`;
94
+ console.log('OBJECTSTSTSTTSTSTSTSTTSTTSTTSTTS', JSON.stringify(csvString));
95
+ getExcel(csvString);
96
+ }
97
+
98
+ function getObjectMAP(params) {
99
+ var objects = {};
100
+ for (var x = 1; x < 71; x++) {
101
+ objects['data' + x] = ValueCheck(params.rows[x - 1]) ? params.rows[x - 1].value : '';
102
+ }
103
+ return objects;
104
+ }
105
+
106
+ const getExcel = async (arg1) => {
107
+ if (await isPermitted()) {
108
+ let filePath = RNFetchBlob.fs.dirs.DownloadDir +
109
+ '/' + 'ExcelTable' + Math.floor(Math.random() * 90 + 10) + '.csv';
110
+ RNFetchBlob.fs.writeFile(filePath, arg1, 'utf8').then(response => {
111
+ console.log(filePath);
112
+ console.log('response', response);
113
+ OpenFileView(filePath);
114
+ notifyMessage(filePath, 1);
115
+ })
116
+ .catch(errors => {
117
+ console.log('DOWNLOAD FAILED', errors);
118
+ notifyMessage('Download Failed', 2);
119
+ });
120
+ }
121
+ };
122
+
123
+ function OpenFileView(arg) {
124
+ console.log('EXCEL PATHHHHHHHHHHHHHHHH', JSON.stringify(arg));
125
+ FileViewer.open(arg)
126
+ .then(() => {
127
+ notifyMessage('SUCCESS', 1);
128
+ })
129
+ .catch((error) => {
130
+ notifyMessage('ERROR' + error, 2);
131
+ });
132
+ }
133
+
134
+ function renderChartListNew(params, i) {
135
+ let newdata = isBNUL(params) ? params.filter(function (item) { return item; }) : [];
136
+ return (
137
+ <FlashList
138
+ showsHorizontalScrollIndicator={false}
139
+ nestedScrollEnabled={true}
140
+ data={newdata}
141
+ renderItem={val => renderDataNew(val, newdata, i)}
142
+ keyExtractor={(item, index) => index.toString()}
143
+ estimatedItemSize={normalize(300)}
144
+ />
145
+ );
146
+
147
+ }
148
+
149
+ return (
150
+ <View>
151
+ {renderChartListNew(params.data, params.index)}
152
+ </View>
153
+ );
154
+
155
+ function getSwitchComponent(item, details, rowkey) {
156
+ switch (item.columntype) {
157
+ case 1:
158
+ return (
159
+ <View
160
+ style={{
161
+ borderWidth: 1, justifyContent: 'center', backgroundColor: '#fff', borderColor: 'lightgrey', height: normalize(25),
162
+ borderRadius: 5, elevation: 3, width: Dimensions.get('screen').width * item.width, alignItems: 'center',
163
+ }}>
164
+ <Text adjustsFontSizeToFit numberOfLines={1} style={{
165
+ fontSize: normalize(13), fontWeight: 'bold', paddingVertical: normalize(2.5),
166
+ color: 'black',
167
+ }}>{details.value}</Text>
168
+ </View>
169
+ );
170
+ }
171
+ }
172
+ }