@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,778 @@
1
+ import React, { useState, useEffect, useRef, useLayoutEffect, useContext } from 'react';
2
+ import {
3
+ StyleSheet,
4
+ Text,
5
+ View,
6
+ Dimensions,
7
+ FlatList,
8
+ BackHandler,
9
+ Image,
10
+ Platform
11
+ } from 'react-native';
12
+ import moment from 'moment';
13
+ import ComponentStyles, { normalize, width } from '../CommonStyle/componentStyle';
14
+ import NetworkServiceCall from '../Common/NetworkServiceCall';
15
+ import { APIURL, BASE_URL } from '../../../../../src/Common/apiConstants';
16
+ import Loader from '../Custom/Loader';
17
+ import { Global } from '../../../../../src/Common/Global';
18
+ import HeaderBlock from './HeaderBlock';
19
+ import CContainerView from '../CustomComponents/CContainerView';
20
+ import CDetailView from '../CustomComponents/CDetailView';
21
+ import CFooterView from '../CustomComponents/CFooterView';
22
+ import {
23
+ CButtonShadow,
24
+ CShadowDynamic,
25
+ getLoading,
26
+ isBNUL,
27
+ isNU,
28
+ notifyMessage,
29
+ } from '../CommonStyle/ComponentFunctions';
30
+ import CCard from '../Custom/CCard';
31
+ import SSearch from '../StaticComponents/SSearch';
32
+ import CBackHandler from '../CustomComponents/CBackHandler';
33
+ import HShadowButton from '../HOC/HShadowButton';
34
+ import CProgressCircle from '../CustomComponents/CProgressCircle';
35
+ import SDatePickerLabel from '../StaticComponents/SDatePickerLabel';
36
+ import { useDataContext } from '../Handlers/ContextBio';
37
+ import { useNavigation } from '../Navigation/useNavigation';
38
+ import { useIsFocused } from '../Navigation/useIsFocused';
39
+
40
+ export default function Dashboard({ route }) {
41
+ // State declarations
42
+ const routeData = route?.params;
43
+ const [searchWord, setSearchWord] = useState('');
44
+ const [isLoading, setIsLoading] = useState(false);
45
+ const { dashData, setDashData } = useDataContext();
46
+ const [patientdata, setPatientData] = useState();
47
+ const [index, setIndex] = useState(0);
48
+ const [refresh, setRefresh] = useState(0);
49
+ const [SearchRefresh, setSearchRefresh] = useState(0);
50
+ const isFocused = useIsFocused();
51
+ const [backHandlerLogOut, setBackHandlerLogOut] = useState(false);
52
+ const [totalObj, setTotalObj] = useState();
53
+ const [filter, setFilter] = useState('Patient ID');
54
+
55
+ const today = moment().format('YYYY-MM-DD');
56
+ const [dateData, setDateData] = useState({
57
+ fromdate: today,
58
+ todate: today,
59
+ dateview: false,
60
+ });
61
+
62
+ const navigation = useNavigation();
63
+ const scrollRef = useRef();
64
+
65
+ // Footer menu configuration
66
+ const FooterArr = [
67
+ {
68
+ keyid: 2,
69
+ icongroup: 5,
70
+ displaytext: "SEARCH",
71
+ size: 10,
72
+ iconname: 'cogs', // perfect for "more"
73
+ iconcolor: "#F16767",
74
+ fontcolor: "#F16767",
75
+ shadowcolor: "#fce0e0",
76
+ selected: false,
77
+ visibility: true,
78
+ iconsize: 20,
79
+ functionid: "D02",
80
+ componenttype: "screen",
81
+ component: "MoreOptionsScreen",
82
+ procedurename: "rnjrintrpurequestdynamicdetailreport",
83
+ argumentname: "13",
84
+ optiondetailhelpurl: "hisfiles/help/video/loginhelp.mp4",
85
+ },
86
+ {
87
+ keyid: 1,
88
+ icongroup: 3,
89
+ displaytext: "MENU",
90
+ size: 10,
91
+ iconname: "dots-horizontal-circle", // perfect for "more"
92
+ iconcolor: "#F16767",
93
+ fontcolor: "#F16767",
94
+ shadowcolor: "#fce0e0",
95
+ selected: false,
96
+ visibility: true,
97
+ iconsize: 20,
98
+ functionid: "D01",
99
+ componenttype: "screen",
100
+ component: "MoreOptionsScreen",
101
+ procedurename: "rnjrintrpurequestdynamicdetailreport",
102
+ argumentname: "13",
103
+ optiondetailhelpurl: "hisfiles/help/video/loginhelp.mp4",
104
+ more: true,
105
+ },
106
+ ];
107
+
108
+ // Effects
109
+ useEffect(() => {
110
+ if (routeData?.patientData?.id) {
111
+ setSearchWord(routeData.patientData.id);
112
+ }
113
+ }, [routeData]);
114
+
115
+ useEffect(() => {
116
+ getAllMedicines();
117
+ }, []);
118
+
119
+ useLayoutEffect(() => {
120
+ FirstGetData();
121
+ }, []);
122
+
123
+ useEffect(() => {
124
+ if (isFocused) {
125
+ Global.PatientDetails = null;
126
+ Global.ChartDataLeft = null;
127
+ Global.ChartDataAll = null;
128
+ }
129
+ }, [isFocused]);
130
+
131
+ useEffect(() => {
132
+ const backAction = () => {
133
+ if (!navigation.isFocused()) {
134
+ return false;
135
+ }
136
+ else { setBackHandlerLogOut(true) }
137
+ return true;
138
+ };
139
+ const backHandler = BackHandler.addEventListener(
140
+ 'hardwareBackPress', backAction);
141
+ return () => backHandler.remove();
142
+ }, [navigation]);
143
+
144
+
145
+ // Functions
146
+ function FirstGetData() {
147
+ setIsLoading(true);
148
+ setIndex(0);
149
+ setPatientData(null);
150
+ setDashData();
151
+ Global.PatientDetails = null;
152
+ const buttonapi = APIURL + Global.userData.insurancedetailapi
153
+ console.log('insurancedeetailapi', JSON.stringify(buttonapi))
154
+ NetworkServiceCall(
155
+ 'get',
156
+ buttonapi,
157
+ '',
158
+ ).then(function (response) {
159
+ if (response.httpstatus === 200) {
160
+ let objForProgress = response.data.dashboard.find(
161
+ val => val.dbname === 'TOTAL',
162
+ );
163
+ if (objForProgress !== undefined) {
164
+ setTotalObj(objForProgress.dbvalue);
165
+ }
166
+ setDashData(response.data.dashboard);
167
+ setPatientData(response.data.datalist);
168
+ setIsLoading(false);
169
+ } else {
170
+ setIsLoading(false);
171
+ notifyMessage('No Dashboard icons', 4);
172
+ }
173
+ });
174
+
175
+ getLoading(v => setIsLoading(false));
176
+ }
177
+
178
+ function getAllMedicines() {
179
+ const buttonapi =
180
+ "insuranceadvanceget/emrcommonget/exec rndddaconsultationaddparameter 20,''";
181
+
182
+ NetworkServiceCall('get', APIURL + buttonapi, '').then(function (response) {
183
+ if (
184
+ response.httpstatus === 200 &&
185
+ isNU(response.data) &&
186
+ isNU(response.data.data)
187
+ ) {
188
+ Global.AllMedicinesArr = response.data.data;
189
+ }
190
+ });
191
+ }
192
+
193
+ function getTotalPatientList(data, index, fromdate, todate) {
194
+ setIndex(index);
195
+ setIsLoading(true);
196
+ setPatientData(null);
197
+
198
+ const buttonapi = `${APIURL}${data?.dbdetailapi},'${fromdate}','${todate}',${Global?.userData?.suuser}`;
199
+ console.log('GETTOTALPATIENTLISTAPI', JSON.stringify(buttonapi))
200
+ NetworkServiceCall('get', buttonapi, '').then(function (response) {
201
+ if (response.httpstatus === 200) {
202
+ if (
203
+ response.data.datalist !== undefined &&
204
+ response.data.datalist.length > 0
205
+ ) {
206
+ setPatientData(response.data.datalist);
207
+ setDashData(response.data.dashboard);
208
+ setRefresh(refresh + 1);
209
+ setIsLoading(false);
210
+ } else {
211
+ setIsLoading(false);
212
+ notifyMessage('No Patients', 3);
213
+ }
214
+ } else {
215
+ setIsLoading(false);
216
+ notifyMessage('Network Error', 4);
217
+ }
218
+ });
219
+
220
+ getLoading(v => setIsLoading(false));
221
+ }
222
+
223
+ function getNewUser() {
224
+ setSearchWord('');
225
+ setIsLoading(true);
226
+
227
+ let buttonapi =
228
+ filter !== 'Patient ID'
229
+ ? `${APIURL}insuranceadvanceget/emrcommonget/rnlainsure ${searchWord},0,${Global.userData.suuser}`
230
+ : `${APIURL}insuranceadvanceget/emrcommonget/rnlainsure 0,${searchWord},${Global.userData.suuser}`;
231
+
232
+ console.log('buttonapi------------', buttonapi)
233
+ NetworkServiceCall('get', buttonapi, '').then(function (response) {
234
+ if (response.httpstatus === 200) {
235
+ if (
236
+ response.data &&
237
+ response.data !== null &&
238
+ response.data.datalist !== undefined &&
239
+ response.data.datalist.length > 0
240
+ ) {
241
+ setIsLoading(false);
242
+ setPatientData(null);
243
+ setTimeout(() => {
244
+ setPatientData(response.data.datalist);
245
+ });
246
+ } else {
247
+ setIsLoading(false);
248
+ notifyMessage('Please enter valid patient id or mobile number', 3);
249
+ }
250
+ } else {
251
+ setIsLoading(false);
252
+ notifyMessage('Please enter valid patient id or mobile number', 3);
253
+ }
254
+ });
255
+
256
+ getLoading(v => setIsLoading(false));
257
+ }
258
+
259
+ function onDetectVisionCameraBarcode(params) {
260
+ setSearchWord(params.data);
261
+ }
262
+
263
+ function FnNavigate() {
264
+ if (Platform.OS === "web") return;
265
+ navigation.navigate('CCaptureImageWithoutEdit', {
266
+ cameramoduletype: 2,
267
+ hidebuttons: true,
268
+ cameratype: 'back',
269
+ onSelect: s => (s && isNU(s) ? onDetectVisionCameraBarcode(s) : null),
270
+ });
271
+ }
272
+
273
+ function getFunctions(params) {
274
+ console.log('getfunctiondashboard---', JSON.stringify(params))
275
+ if (!params.visibility) {
276
+ notifyMessage('Incorporate Soon', 5);
277
+ return;
278
+ }
279
+ switch (params.functionid) {
280
+ case 'D01':
281
+ navigation.navigate('MoreOptionsScreen')
282
+ break;
283
+ case 'D02':
284
+ navigation.navigate('SearchScreen', { searchKey: 1 });
285
+ break;
286
+ default:
287
+ notifyMessage('Incorporate Soon', 5);
288
+ break;
289
+ }
290
+ }
291
+
292
+ function renderItemNew(data) {
293
+ return (
294
+ <View style={styles.progressCircleContainer}>
295
+ <CProgressCircle
296
+ borderWidth={2}
297
+ radius={normalize(24)}
298
+ bgColor={
299
+ index === data.index ? getColorCodeDashboard(data.item) : null
300
+ }
301
+ percent={(data.item.dbvalue / totalObj) * 100}
302
+ iconname={data.item.iconname ? data.item.iconname : 'file-alt'}
303
+ iconcolor={
304
+ index === data.index ? null : getColorCodeDashboard(data.item)
305
+ }
306
+ iconsize={normalize(15)}
307
+ displaytext={isNU(data.item.dbvalue) ? data.item.dbvalue : ''}
308
+ textFontSize={normalize(15)}
309
+ textColor={
310
+ index === data.index ? null : getColorCodeDashboard(data.item)
311
+ }
312
+ onCallback={s => {
313
+ getTotalPatientList(
314
+ data.item,
315
+ data.index,
316
+ dateData.fromdate,
317
+ dateData.todate,
318
+ );
319
+ }}
320
+ />
321
+ <Text style={[styles.progressCircleText, { color: index === data.index ? getColorCodeDashboard(data.item) : Global.AppTheme.primary_color }]}>{data.item.dbname}</Text>
322
+ </View>
323
+ );
324
+ }
325
+
326
+ function getColorCodeDashboard(params) {
327
+ switch (params.dbname) {
328
+ case 'ALLOCATED':
329
+ return '#28a745';
330
+ case 'DEALLOCATED':
331
+ return '#dc3545';
332
+ case 'CANCELED':
333
+ return '#fd7e14';
334
+ case 'TOTAL':
335
+ return Global.AppTheme.secondary_color;
336
+ default:
337
+ return Global.AppTheme.primary_color;
338
+ }
339
+ }
340
+
341
+ function getFilter(params) {
342
+ let dayBefore = null;
343
+
344
+ const updateDateData = (from, to, dateview = false) => {
345
+ setDateData(prevState => ({
346
+ ...prevState,
347
+ fromdate: from,
348
+ todate: to,
349
+ dateview,
350
+ }));
351
+ };
352
+
353
+ const fetchPatients = (from, to) => {
354
+ getTotalPatientList(dashData[index], index, from, to);
355
+ };
356
+
357
+ switch (params.datavalue) {
358
+ case 2: // Today
359
+ updateDateData(today, today, false);
360
+ fetchPatients(today, today);
361
+ break;
362
+
363
+ case 3: // Yesterday
364
+ dayBefore = moment().subtract(1, 'days').format('YYYY-MM-DD');
365
+ updateDateData(dayBefore, today, false);
366
+ fetchPatients(dayBefore, today);
367
+ break;
368
+
369
+ case 4: // One week before
370
+ dayBefore = moment().subtract(7, 'days').format('YYYY-MM-DD');
371
+ updateDateData(dayBefore, today, false);
372
+ fetchPatients(dayBefore, today);
373
+ break;
374
+
375
+ case 5: // One month before
376
+ dayBefore = moment().subtract(1, 'month').format('YYYY-MM-DD');
377
+ updateDateData(dayBefore, today, false);
378
+ fetchPatients(dayBefore, today);
379
+ break;
380
+
381
+ case 6: // Six months before
382
+ dayBefore = moment().subtract(6, 'months').format('YYYY-MM-DD');
383
+ updateDateData(dayBefore, today, false);
384
+ fetchPatients(dayBefore, today);
385
+ break;
386
+
387
+ case 7: // One year before
388
+ dayBefore = moment().subtract(1, 'year').format('YYYY-MM-DD');
389
+ updateDateData(dayBefore, today, false);
390
+ fetchPatients(dayBefore, today);
391
+ break;
392
+
393
+ case 8: // Five years before
394
+ dayBefore = moment().subtract(5, 'years').format('YYYY-MM-DD');
395
+ updateDateData(dayBefore, today, false);
396
+ fetchPatients(dayBefore, today);
397
+ break;
398
+
399
+ case 9: // Custom date view
400
+ if (dateData?.dateview) {
401
+ fetchPatients(dateData.fromdate, dateData.todate);
402
+ } else {
403
+ updateDateData(today, today, true);
404
+ }
405
+ break;
406
+ default:
407
+ console.error('Unknown datavalue:', params.datavalue);
408
+ break;
409
+ }
410
+ }
411
+
412
+ // Render
413
+ return (
414
+ <CContainerView>
415
+ {<HeaderBlock
416
+ navigation={navigation.navigate}
417
+ callback={() => {
418
+ setBackHandlerLogOut(true);
419
+ }}
420
+ />}
421
+
422
+ <CDetailView hideCard={true} >
423
+ <View style={styles.detailContainer}>
424
+ {isBNUL(dashData) && (
425
+ <FlatList
426
+ data={dashData}
427
+ renderItem={renderItemNew}
428
+ numColumns={4}
429
+ keyExtractor={(item, index) => 'key' + index}
430
+ columnWrapperStyle={styles.dashboardColumnWrapper}
431
+ // refreshControl={
432
+ // <RefreshControl
433
+ // refreshing={refreshing}
434
+ // onRefresh={onRefresh}
435
+ // colors={[Global.AppTheme.primary_color]}
436
+ // tintColor={Global.AppTheme.primary_color}
437
+ // />
438
+ // }
439
+ />
440
+ )}
441
+
442
+ {/* Date Search Section */}
443
+ {isBNUL(dashData) && (
444
+ <View style={styles.dateSearchContainer}>
445
+ <SSearch
446
+ disabled={false}
447
+ editable={true}
448
+ dropdownapi={`insurance/emrcommonget/rnddhosudatefilter`}
449
+ disablesearchcomponent={true}
450
+ onChangeData={val => val && getFilter(val)}
451
+ />
452
+ </View>
453
+ )}
454
+
455
+ {dateData?.dateview && (
456
+ <View style={styles.datePickerRow}>
457
+ <View style={styles.datePickerContainer}>
458
+ <SDatePickerLabel
459
+ labeltext={'From Date'}
460
+ icon={{
461
+ icongroup: 5,
462
+ name: 'calendar-alt',
463
+ color: Global.AppTheme.primary_color,
464
+ size: normalize(15),
465
+ style: styles.datePickerIcon,
466
+ }}
467
+ positionviewstyle={styles.datePickerLabel}
468
+ positiontextstyle={styles.datePickerLabelText}
469
+ pickerstyle={styles.datePicker}
470
+ textstyle={styles.datePickerText}
471
+ maximumdate={today}
472
+ passingDate={moment(dateData?.fromdate).format('YYYY-MM-DD')}
473
+ onChangeData={val =>
474
+ val &&
475
+ (setDateData(prevState => ({
476
+ ...prevState,
477
+ fromdate: moment(val).format('YYYY-MM-DD'),
478
+ })),
479
+ fetchPatients(
480
+ moment(val).format('YYYY-MM-DD'),
481
+ dateData.todate,
482
+ ))
483
+ }
484
+ />
485
+ </View>
486
+
487
+ <View style={styles.datePickerContainer}>
488
+ <SDatePickerLabel
489
+ labeltext={'To Date'}
490
+ icon={{
491
+ icongroup: 5,
492
+ name: 'calendar-alt',
493
+ color: Global.AppTheme.primary_color,
494
+ size: normalize(15),
495
+ style: styles.datePickerIcon,
496
+ }}
497
+ positionviewstyle={styles.datePickerLabel}
498
+ positiontextstyle={styles.datePickerLabelText}
499
+ pickerstyle={styles.datePicker}
500
+ textstyle={styles.datePickerText}
501
+ maximumdate={today}
502
+ passingDate={moment(dateData?.todate).format('YYYY-MM-DD')}
503
+ onChangeData={val =>
504
+ val &&
505
+ (setDateData(prevState => ({
506
+ ...prevState,
507
+ todate: moment(val).format('YYYY-MM-DD'),
508
+ })),
509
+ fetchPatients(
510
+ dateData.fromdate,
511
+ moment(val).format('YYYY-MM-DD'),
512
+ ))
513
+ }
514
+ />
515
+ </View>
516
+ </View>
517
+ )}
518
+
519
+
520
+ <SSearch
521
+ editable={true}
522
+ navigation={navigation.navigate}
523
+ value={searchWord}
524
+ visibility={val => val && {}}
525
+ onChangeText={text => setSearchWord(text)}
526
+ onChangeData={val => val && setFilter(val.searchparam)}
527
+ onBarCodeScan={val => val && FnNavigate()}
528
+ onSearch={val => val && getNewUser()}
529
+ onRefresh={val => val && setSearchRefresh(SearchRefresh + 1)}
530
+ />
531
+
532
+ {!(isBNUL(dashData) || isLoading) && (
533
+ <View style={styles.refreshContainer}>
534
+ <HShadowButton
535
+ useicon={true}
536
+ usetext={true}
537
+ buttonstyle={styles.refreshButton}
538
+ icongroup={4}
539
+ iconcolor={Global.AppTheme.primary_color}
540
+ iconname={'refresh'}
541
+ iconsize={normalize(22)}
542
+ iconstyle={styles.refreshIcon}
543
+ displaytext={'Refresh'}
544
+ buttonCallback={FirstGetData}
545
+ textstyle={styles.refreshText}
546
+ />
547
+ </View>
548
+ )}
549
+ </View>
550
+
551
+ {patientdata && patientdata !== undefined && (
552
+ <View ref={scrollRef} style={styles.patientListContainer}>
553
+ <CCard
554
+ filter={filter}
555
+ search={searchWord}
556
+ navigation={navigation.navigate}
557
+ data={patientdata}
558
+ onRefresh={SearchRefresh}
559
+ disabled={index === 3}
560
+ />
561
+ </View>
562
+ )}
563
+ </CDetailView>
564
+
565
+ <CFooterView style={styles.footerContainer}>
566
+ {FooterArr &&
567
+ FooterArr.map((item, i) => {
568
+ return item.visibility && (
569
+ <HShadowButton
570
+ key={item.keyid || i}
571
+ useicon={true}
572
+ usetext={true}
573
+ disabled={false}
574
+ buttonstyle={[styles.footerButton, CShadowDynamic(-3, 3, 5, 0, Global.AppTheme.primary_color)]}
575
+ iconcolor={Global.AppTheme.primary_color}
576
+ icongroup={item.icongroup || 5}
577
+ iconname={item.iconname}
578
+ iconsize={normalize(24)}
579
+ displaytext={item.displaytext}
580
+ buttonCallback={() => getFunctions(item)}
581
+ textstyle={styles.optionText}
582
+ />
583
+ )
584
+ })}
585
+ </CFooterView>
586
+
587
+ {backHandlerLogOut ?
588
+ <CBackHandler
589
+ type={6} // 2 for exit/logout
590
+ callBack={val =>
591
+ val == undefined
592
+ ? null
593
+ : (setBackHandlerLogOut(val), navigation.goBack())
594
+ }
595
+ close={val => (val == undefined ? null : setBackHandlerLogOut(val))}
596
+ /> : null}
597
+ {isLoading && <Loader displaytext={true} />}
598
+ </CContainerView>
599
+ );
600
+ }
601
+
602
+ const styles = StyleSheet.create({
603
+ detailContainer: {
604
+ borderWidth: 0,
605
+ },
606
+ progressCircleContainer: {
607
+ alignItems: 'center',
608
+ justifyContent: 'center',
609
+ },
610
+ progressCircleText: {
611
+ fontSize: normalize(10),
612
+ fontWeight: 'bold',
613
+ paddingVertical: normalize(4),
614
+ },
615
+ dashboardColumnWrapper: {
616
+ justifyContent: 'space-evenly',
617
+ },
618
+ dateSearchContainer: {
619
+ marginTop: normalize(7),
620
+ },
621
+ datePickerRow: {
622
+ flexDirection: 'row',
623
+ width: '100%',
624
+ justifyContent: 'space-evenly',
625
+ marginTop: normalize(7),
626
+ },
627
+ datePickerContainer: {
628
+ borderWidth: 0,
629
+ width: '47%',
630
+ },
631
+ datePickerIcon: {
632
+ marginHorizontal: normalize(5),
633
+ },
634
+ datePickerLabel: {
635
+ position: 'absolute',
636
+ top: normalize(-5),
637
+ left: normalize(7),
638
+ backgroundColor: 'white',
639
+ flexDirection: 'row',
640
+ alignItems: 'center',
641
+ },
642
+ datePickerLabelText: {
643
+ color: Global.AppTheme.primary_color,
644
+ fontSize: normalize(10),
645
+ textAlign: 'left',
646
+ fontWeight: 'normal',
647
+ },
648
+ datePicker: {
649
+ flexDirection: 'row',
650
+ backgroundColor: '#fff',
651
+ width: '100%',
652
+ borderColor: 'grey',
653
+ borderWidth: 0.5,
654
+ borderRadius: 5,
655
+ alignItems: 'center',
656
+ height: normalize(30),
657
+ elevation: 2,
658
+ justifyContent: 'center',
659
+ marginVertical: normalize(3),
660
+ },
661
+ datePickerText: {
662
+ fontSize: normalize(12),
663
+ color: 'black',
664
+ fontWeight: 'bold',
665
+ },
666
+ refreshContainer: {
667
+ borderWidth: 0,
668
+ width: '100%',
669
+ justifyContent: 'center',
670
+ alignItems: 'center',
671
+ },
672
+ refreshButton: {
673
+ margin: normalize(5),
674
+ borderLeftWidth: 0,
675
+ borderBottomWidth: 0,
676
+ borderRadius: 5,
677
+ borderWidth: 0,
678
+ borderColor: Global.AppTheme.primary_color,
679
+ justifyContent: 'center',
680
+ alignItems: 'center',
681
+ backgroundColor: 'white',
682
+ height: normalize(30),
683
+ width: normalize(60),
684
+ shadowColor: '#000',
685
+ shadowOffset: {
686
+ width: 0,
687
+ height: 2,
688
+ },
689
+ shadowOpacity: 0.25,
690
+ shadowRadius: 3.84,
691
+ elevation: 5,
692
+ },
693
+ refreshIcon: {
694
+ textAlign: 'center',
695
+ borderWidth: 0,
696
+ },
697
+ refreshText: {
698
+ color: '#B8621B',
699
+ fontSize: normalize(6),
700
+ textAlign: 'center',
701
+ fontWeight: 'normal',
702
+ lineHeight: normalize(6),
703
+ },
704
+ patientListContainer: {
705
+ flex: 1,
706
+ },
707
+ footerContainer: {
708
+ flexDirection: 'row',
709
+ alignItems: 'center',
710
+ justifyContent: 'space-between',
711
+ paddingHorizontal: 2,
712
+ },
713
+ footerButton: {
714
+ borderRadius: 10,
715
+ borderWidth: 0.5,
716
+ height: Dimensions.get('screen').height * 0.054,
717
+ width: Dimensions.get('screen').height * 0.07,
718
+ backgroundColor: '#fff',
719
+ paddingHorizontal: 0,
720
+ paddingBottom: 0,
721
+ paddingTop: 0,
722
+ borderColor: Global.AppTheme.primary_color,
723
+ justifyContent: 'center',
724
+ alignItems: 'center',
725
+ marginHorizontal: normalize(3),
726
+ elevation: 4, // raiseLevel equivalent for Android
727
+ shadowColor: '#ffe5e5', // optional for iOS shadow
728
+ shadowOffset: { width: 0, height: 2 },
729
+ shadowOpacity: 0.2,
730
+ shadowRadius: 2,
731
+ },
732
+ footerButtonText: {
733
+ fontSize: normalize(9),
734
+ textAlign: 'center',
735
+ alignSelf: 'center',
736
+ },
737
+ moreButtonContainer: {
738
+ borderWidth: 0,
739
+ },
740
+ menuOptions: {
741
+ marginTop: normalize(-52),
742
+ },
743
+ moreOptionsContainer: {
744
+ flexDirection: 'row',
745
+ flexWrap: 'wrap-reverse',
746
+ justifyContent: 'flex-end',
747
+ borderWidth: 0,
748
+ },
749
+ menuOption: {
750
+ marginHorizontal: normalize(3),
751
+ },
752
+ subFooterButton: {
753
+ shadowColor: '#000',
754
+ shadowOffset: {
755
+ width: 0,
756
+ height: 2,
757
+ },
758
+ shadowOpacity: 0.25,
759
+ shadowRadius: 3.84,
760
+ elevation: 5,
761
+ alignItems: 'center',
762
+ justifyContent: 'center',
763
+ borderWidth: 1,
764
+ borderColor: 'lightblue',
765
+ borderRadius: 10,
766
+ height: normalize(40),
767
+ width: normalize(50),
768
+ marginVertical: normalize(7),
769
+ backgroundColor: 'white',
770
+ },
771
+ optionText: {
772
+ fontSize: normalize(8),
773
+ color: Global.AppTheme.primary_color,
774
+ fontWeight: 'bold',
775
+ textAlign: 'center',
776
+ maxWidth: normalize(60),
777
+ }
778
+ });