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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/index.d.ts +2 -66
  2. package/index.js +1 -66
  3. package/package.json +1 -1
  4. package/src/Alerts/AAlert.js +0 -137
  5. package/src/Alerts/AAlertIOS.js +0 -97
  6. package/src/Alerts/ABlink.js +0 -40
  7. package/src/Common/Icons.js +0 -49
  8. package/src/Common/NetworkServiceCall.js +0 -265
  9. package/src/CommonStyle/CommonTheme.js +0 -11
  10. package/src/CommonStyle/ComponentFunctions.js +0 -632
  11. package/src/CommonStyle/PopupStyle.js +0 -146
  12. package/src/CommonStyle/commonStyle.js +0 -93
  13. package/src/CommonStyle/componentStyle.js +0 -545
  14. package/src/CommonStyle/optionListStyles.js +0 -175
  15. package/src/Components/ByProductPage.js +0 -200
  16. package/src/Components/CDropDownListNew.js +0 -153
  17. package/src/Components/CSupplierList.js +0 -88
  18. package/src/Components/CVerificationCard.js +0 -2822
  19. package/src/Components/CustomButton.js +0 -67
  20. package/src/Components/CustomCard.js +0 -127
  21. package/src/Components/CustomTextInput.js +0 -47
  22. package/src/Components/EquipmentPage.js +0 -313
  23. package/src/Components/FilterInput.Copy.js +0 -723
  24. package/src/Components/FilterInput.js +0 -569
  25. package/src/Components/HSubHeading.js +0 -68
  26. package/src/Components/HeaderCard.js +0 -40
  27. package/src/Components/MoreOptionsScreen.js +0 -251
  28. package/src/Components/NonSwipableProductCard.js +0 -226
  29. package/src/Components/NonSwipableSupplierCard.js +0 -348
  30. package/src/Components/ProductCard.js +0 -1336
  31. package/src/Components/QualityProductCard.js +0 -1059
  32. package/src/Components/RateProductCard.js +0 -1452
  33. package/src/Components/RawMaterial.js +0 -261
  34. package/src/Components/SDropDownEdited.js +0 -549
  35. package/src/Components/SDropDownNew.js +0 -529
  36. package/src/Components/SHelpDescription.js +0 -147
  37. package/src/Components/STextInputNew.js +0 -510
  38. package/src/Components/SearchProductCard.js +0 -470
  39. package/src/Components/StageByProduct.js +0 -199
  40. package/src/Components/SupplierCard.js +0 -243
  41. package/src/Components/SupplierInvoiceCard.js +0 -405
  42. package/src/Components/SwipableSupplierCard.js +0 -136
  43. package/src/Components/TagTemplate.js +0 -74
  44. package/src/Components/WrappedComponent.js +0 -25
  45. package/src/Custom/CBooking.js +0 -944
  46. package/src/Custom/CBookingPostpone.js +0 -1822
  47. package/src/Custom/CCalendar.js +0 -560
  48. package/src/Custom/CCard.js +0 -880
  49. package/src/Custom/CDetailCard.js +0 -205
  50. package/src/Custom/CHelpImage.js +0 -52
  51. package/src/Custom/CReport.js +0 -569
  52. package/src/Custom/CScrollView.js +0 -73
  53. package/src/Custom/CSignature.js +0 -112
  54. package/src/Custom/CSliderMenu.js +0 -339
  55. package/src/Custom/CSupplierCard.js +0 -99
  56. package/src/Custom/CTemplateCard.js +0 -438
  57. package/src/Custom/CTokenAllocation.js +0 -1402
  58. package/src/Custom/CTokenListOverlay.js +0 -122
  59. package/src/Custom/CWardStatus.js +0 -444
  60. package/src/Custom/Charts/CBarChart.js +0 -218
  61. package/src/Custom/Charts/CDashBoardList.js +0 -133
  62. package/src/Custom/Charts/CDashBoardTable.js +0 -172
  63. package/src/Custom/Charts/CLineChart.js +0 -193
  64. package/src/Custom/Charts/CPieChart.js +0 -186
  65. package/src/Custom/Loader.js +0 -182
  66. package/src/Custom/OUserView.js +0 -1121
  67. package/src/Custom/PreviewDosage.js +0 -115
  68. package/src/Custom/SearchLoader.js +0 -32
  69. package/src/Custom/TableComponent/CActivityTable.js +0 -707
  70. package/src/Custom/TableComponent/CMoreButtonTable.js +0 -197
  71. package/src/Custom/TableComponent/CTable.js +0 -185
  72. package/src/Custom/TableComponent/CTextBody.js +0 -40
  73. package/src/Custom/TableComponent/CTextHeader.js +0 -17
  74. package/src/Custom/TableComponent/PreviewPrescriptionNew.js +0 -1011
  75. package/src/Custom/TableComponent/SDropdownTable.js +0 -491
  76. package/src/Custom/TableComponent/TagTable.js +0 -1200
  77. package/src/CustomComponents/CAddColumn.js +0 -140
  78. package/src/CustomComponents/CAssessmentDelete.js +0 -307
  79. package/src/CustomComponents/CAwesomeButton.js +0 -83
  80. package/src/CustomComponents/CAwesomeMoreButton.js +0 -54
  81. package/src/CustomComponents/CBackHandler.js +0 -273
  82. package/src/CustomComponents/CCalendar.js +0 -243
  83. package/src/CustomComponents/CCommentOverlay.js +0 -202
  84. package/src/CustomComponents/CComments.js +0 -162
  85. package/src/CustomComponents/CContainerView.js +0 -24
  86. package/src/CustomComponents/CCustomTextInput.js +0 -336
  87. package/src/CustomComponents/CDetailView.js +0 -40
  88. package/src/CustomComponents/CDropDownList.js +0 -153
  89. package/src/CustomComponents/CDropdownSelect.js +0 -555
  90. package/src/CustomComponents/CFooterView.js +0 -42
  91. package/src/CustomComponents/CImagePickerSave.js +0 -316
  92. package/src/CustomComponents/CModalOverlay.js +0 -91
  93. package/src/CustomComponents/CNetworkStatus.js +0 -327
  94. package/src/CustomComponents/CNotesInstructions.js +0 -1000
  95. package/src/CustomComponents/COverlay.js +0 -81
  96. package/src/CustomComponents/CRemarks.js +0 -176
  97. package/src/CustomComponents/CRowAdd.js +0 -143
  98. package/src/CustomComponents/CSummaryDropDown.js +0 -327
  99. package/src/CustomComponents/CText.js +0 -9
  100. package/src/CustomComponents/CVectorIcon.js +0 -34
  101. package/src/CustomComponents/HtmlContentViewer.js +0 -65
  102. package/src/CustomComponents/PdfContentViewer.js +0 -90
  103. package/src/CustomComponents/SDropDownDosage.js +0 -1087
  104. package/src/CustomComponents/SwipableProductCard.js +0 -246
  105. package/src/CustomComponents/SwipableProductImageCard.js +0 -254
  106. package/src/CustomComponents/WorkOrderDetails.js +0 -1216
  107. package/src/CustomComponents/WorkOrderDetailsPage.js +0 -1213
  108. package/src/HOC/ConfirmOverlay.js +0 -192
  109. package/src/HOC/HHeading.js +0 -70
  110. package/src/HOC/HMoreButton.js +0 -88
  111. package/src/HOC/HNatureHeading.js +0 -402
  112. package/src/HOC/HOCIcons.js +0 -80
  113. package/src/HOC/HOverlayCentered.js +0 -140
  114. package/src/HOC/HShadowButton.js +0 -45
  115. package/src/HOC/HShadowCountButton.js +0 -82
  116. package/src/HOC/OptionOverlay.js +0 -48
  117. package/src/Json/Chart.json +0 -818
  118. package/src/Json/Consultation.json +0 -622
  119. package/src/Json/CreditBill.json +0 -490
  120. package/src/Json/Dropdown.json +0 -216
  121. package/src/Json/DropdownConsultation.json +0 -228
  122. package/src/Json/DynamicReports.json +0 -623
  123. package/src/Json/Footer.json +0 -79
  124. package/src/Media/AudioScreen.js +0 -342
  125. package/src/Media/BarcodeScan.js +0 -145
  126. package/src/Media/CAudioPlay.js +0 -228
  127. package/src/Media/CCaptureImageWithoutEdit.js +0 -330
  128. package/src/Media/CImageGallery.js +0 -289
  129. package/src/Media/CImageZoom.js +0 -82
  130. package/src/Media/CSingleImage.js +0 -391
  131. package/src/Media/CSketchCanvas.js +0 -76
  132. package/src/Media/CVideoPlay.js +0 -31
  133. package/src/Media/DocumentScreen.js +0 -362
  134. package/src/Media/DrawingScreen.js +0 -578
  135. package/src/Media/ImageScreen.js +0 -309
  136. package/src/Media/RecordAudio.js +0 -250
  137. package/src/Media/RecordVideo.js +0 -223
  138. package/src/Media/VideoScreen.js +0 -378
  139. package/src/Navigation/PageNavigation.js +0 -224
  140. package/src/Navigation/useFocusEffect.js +0 -2
  141. package/src/Navigation/useFocusEffect.native.js +0 -1
  142. package/src/Navigation/useFocusEffect.web.js +0 -1
  143. package/src/Navigation/useIsFocused.js +0 -1
  144. package/src/Navigation/useIsFocused.native.js +0 -1
  145. package/src/Navigation/useIsFocused.web.js +0 -1
  146. package/src/Navigation/useNavigation.js +0 -2
  147. package/src/Navigation/useNavigation.native.js +0 -1
  148. package/src/Navigation/useNavigation.web.js +0 -1
  149. package/src/Screens/CMedications.js +0 -528
  150. package/src/Screens/CWebViewGallery.js +0 -203
  151. package/src/Screens/ChartScan.js +0 -279
  152. package/src/Screens/ChartScreenNew.js +0 -1579
  153. package/src/Screens/Consultation.js +0 -1500
  154. package/src/Screens/Dashboard.js +0 -778
  155. package/src/Screens/FileExplorer.js +0 -288
  156. package/src/Screens/Footer.js +0 -340
  157. package/src/Screens/ForgotPassword.js +0 -288
  158. package/src/Screens/HeaderBlock.js +0 -353
  159. package/src/Screens/Login.js +0 -328
  160. package/src/Screens/Notification.js +0 -149
  161. package/src/Screens/OcrScreen.js +0 -20
  162. package/src/Screens/PdfPreview.js +0 -507
  163. package/src/Screens/RegistrationDetails.js +0 -467
  164. package/src/Screens/SearchScreen.js +0 -582
  165. package/src/Screens/Splash.js +0 -788
  166. package/src/Screens/SwipeLeftView.js +0 -1867
  167. package/src/StaticComponents/SAlphabet.js +0 -47
  168. package/src/StaticComponents/SCheckBox.js +0 -42
  169. package/src/StaticComponents/SDatePicker.js +0 -208
  170. package/src/StaticComponents/SDatePickerLabel.js +0 -253
  171. package/src/StaticComponents/SDatePickerNew.js +0 -258
  172. package/src/StaticComponents/SDateTimePickerNew.js +0 -381
  173. package/src/StaticComponents/SDropDownGenerate.js +0 -450
  174. package/src/StaticComponents/SDropDownHoc.js +0 -636
  175. package/src/StaticComponents/SDropDownIcon.js +0 -500
  176. package/src/StaticComponents/SMenuBox.js +0 -131
  177. package/src/StaticComponents/SOverlay.js +0 -177
  178. package/src/StaticComponents/SOverlayTextInput.js +0 -109
  179. package/src/StaticComponents/SSearch.js +0 -438
  180. package/src/StaticComponents/SSearchBar.js +0 -53
  181. package/src/StaticComponents/SSpeedDial.js +0 -303
  182. package/src/StaticComponents/STextInput.js +0 -289
  183. package/src/StaticComponents/STextInputProps.js +0 -36
  184. package/src/StaticComponents/STimePicker.js +0 -171
  185. package/src/StaticComponents/STimingDropDownNew.js +0 -1585
  186. package/src/StaticComponents/STimingSwitch.js +0 -34
  187. package/src/layout/CContainerView.js +0 -21
  188. package/src/layout/CDetailView.js +0 -81
  189. package/src/layout/HeaderBlock.js +0 -353
  190. package/src/layout/INVLoginLayout.js +0 -657
  191. package/src/layout/Loader.js +0 -176
@@ -1,1585 +0,0 @@
1
- import React, { useState, useEffect, useContext } from 'react';
2
- import { View, Text, TouchableOpacity, Dimensions, Image, StyleSheet, ActivityIndicator, TextInput, FlatList, ScrollView, Switch } from 'react-native';
3
- import Overlay from 'react-native-modal-overlay';
4
- import Icons from '../Common/Icons';
5
- import ComponentStyles, { normalize } from '../CommonStyle/componentStyle';
6
- import Dropdown from '../Json/Dropdown.json';
7
- import SDropDownNew from '../Components/SDropDownNew';
8
-
9
- import Entypo from 'react-native-vector-icons/Entypo';
10
- import FontAwesome from 'react-native-vector-icons/FontAwesome';
11
- import FontAwesome5 from 'react-native-vector-icons/FontAwesome5';
12
- import NetworkServiceCall from '../Common/NetworkServiceCall';
13
- import { APIURL } from '../../../../../src/Common/apiConstants';
14
- import { isNU, notifyMessage } from '../CommonStyle/ComponentFunctions';
15
- import SDropDownDosage from '../CustomComponents/SDropDownDosage';
16
- import SearchLoader from '../Custom/SearchLoader';
17
- import { getPopupHeadingOptionText } from '../CommonStyle/PopupStyle';
18
- import { colors } from '../CommonStyle/commonStyle';
19
- import PreviewDosage from '../Custom/PreviewDosage';
20
- import AntDesign from 'react-native-vector-icons/AntDesign';
21
- import { Global } from '../../../../../src/Common/Global';
22
- import STimingSwitch from './STimingSwitch';
23
- import moment from 'moment';
24
- import AwesomeButton from 'react-native-really-awesome-button';
25
- import CAwesomeButton from '../CustomComponents/CAwesomeButton';
26
-
27
-
28
- var searchResult = [];
29
- export default function STimingDropDownNew(props) {
30
- // console.log("------JJ-------TT----------HH-----------JJ--------UU------",JSON.stringify(props.completeData))
31
- const [timingsArray, setTimingsArray] = useState();
32
- const [description, setDescription] = useState('');
33
- const [tempString, settempString] = useState([]);
34
- // console.log("ooooooooooooooooooo", JSON.stringify(tempString))
35
- const [category, setCategory] = useState({
36
- 'categorycode': 0,
37
- 'categoryname': '',
38
- });
39
- const [data, setData] = useState();
40
- const [searchData, setSearchData] = useState('');
41
- const [visibility, setVisibility] = useState(true);
42
- const [savevisibility, setSaveVisibility] = useState(true);
43
- const [section, setSection] = useState(3);
44
- const [isLoading, setIsLoading] = useState(false);
45
- const [refresh, setRefresh] = useState(0);
46
- const [displayData, setDisplayData] = useState([]);
47
- const [filterPurpose, setFilterPurpose] = useState([]);
48
- const [categoryrefresh, setCategoryRefresh] = useState(true);
49
- const dropdowndata = props.dropdowndata;
50
- const [alphaindex, setAlphaIndex] = useState();
51
- const [alphaFilter, setAlphaFilter] = useState(false);
52
- const [isdropdownshow, setDropdownShow] = useState(false);
53
- const [switchRefresh, setswitchRefresh] = useState(true);
54
- function getOverlay() {
55
- setDropdownShow(true);
56
- getTimingsData({
57
- 'datavalue': 0,
58
- 'displaytext': 'HHHH',
59
- });
60
- }
61
-
62
-
63
- function getTimings(params) {
64
- setDropdownShow(true);
65
- // setTimeout(() => {
66
- setTimingsArray(props.completeData.timingdata[0].timings.timingsarray);
67
- // });
68
- setDescription(props.completeData.timingdata[0].timings.description);
69
- setRefresh(refresh + 1);
70
- }
71
-
72
- // useEffect(() => {
73
- // // getTimingsData()
74
- // }, [])
75
-
76
- const convertTime12to24 = (time12h) => {
77
- const [time, modifier] = time12h.split(' ');
78
- let [hours, minutes] = time.split(':');
79
- if (hours === '12') {
80
- hours = '00';
81
- }
82
- if (modifier === 'PM') {
83
- hours = parseInt(hours, 10) + 12;
84
- }
85
- return `${hours}:${minutes}`;
86
- };
87
-
88
- function AddNewTimings(params) {
89
- console.log('CATEGORY CODE>>>>>>>>>>>>>>>>>>>>', category.categorycode);
90
- // const newArr = timingsArray.map((item) => item.data)
91
- // const merged = [].concat.apply([], newArr);
92
-
93
- const DosageCount = timingsArray.map(obj => ({
94
- ...obj,
95
- dosage: obj.dosage,
96
- }));
97
-
98
- var filterforemptydosage = timingsArray.filter(function (event) {
99
- return event.usagename != '';
100
- });
101
-
102
- // console.log("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$", JSON.stringify(category.categorycode))
103
-
104
- // console.log("ytftydtcyccyctyctccsewaqawhgvjjh", JSON.stringify(DosageCount))
105
- var totalCount = DosageCount.reduce((accum, item) => accum + item.dosage[0].volume, 0);
106
- // console.log("--------------------------- TOTALLLLLLLLLLLLLLLL COUNTTTTTTTTTTTTTTTTTT --------------------", JSON.stringify(totalCount))
107
-
108
- if (description != '' && description != 0 && description != '' &&
109
- filterforemptydosage.length > 0) {
110
-
111
- props.onNewTimings({
112
- 'medicinecode': 0,
113
- 'hosuconsultant': Global.userData != undefined && Global.userData != null ? Global.userData.hosuconsultant : 0,
114
- 'ssuser': Global.userData != undefined && Global.userData != null ? Global.userData.suuser : 0,
115
- 'flag': 1,
116
- 'calculationcount': totalCount,
117
- 'datavalue': data.datavalue != undefined ? data.datavalue : props.completeData != undefined ? props.completeData.hosumrprescriptiontiming : 0,
118
- 'timingdescription': description,
119
-
120
- 'timingcategorycode': category.categorycode != 0 ? category.categorycode :
121
- props.completeData != undefined && props.completeData.timingdata != undefined &&
122
- props.completeData.timingdata[0].timings != undefined
123
- && props.completeData.timingdata[0].timings.timingcategorycode != undefined ?
124
- props.completeData.timingdata[0].timings.timingcategorycode : 4,
125
-
126
- 'timingcategoryname': category.categorycode != 0 ? category.categoryname :
127
- props.completeData != undefined && props.completeData.timingdata[0].timings != undefined
128
- && props.completeData.timingdata[0].timings.timingcategoryname != undefined ?
129
- props.completeData.timingdata[0].timings.timingcategoryname : 'SCHEDULED',
130
-
131
- 'timingsarray': timingsArray.map(obj => ({
132
- ...obj,
133
- dosage: obj.dosage,
134
- })),
135
- });
136
-
137
- props.onDuplicate({
138
- 'medicinecode': 0,
139
- 'ssuser': Global.userData != undefined && Global.userData != null ? Global.userData.suuser : 0,
140
- 'flag': 1,
141
- 'datavalue': data.datavalue,
142
- 'timingdescription': description,
143
- // "timingcategorycode": category.categorycode,
144
- // "timingcategoryname": category.categoryname,
145
- 'timingcategorycode': category.categorycode != 0 ? category.categorycode :
146
- props.completeData != undefined && props.completeData.timingdata[0].timings != undefined
147
- && props.completeData.timingdata[0].timings.timingcategorycode != undefined ?
148
- props.completeData.timingdata[0].timings.timingcategorycode : 0,
149
-
150
- 'timingcategoryname': category.categorycode != 0 ? category.categoryname :
151
- props.completeData != undefined && props.completeData.timingdata[0].timings != undefined
152
- && props.completeData.timingdata[0].timings.timingcategoryname != undefined ?
153
- props.completeData.timingdata[0].timings.timingcategoryname : 0,
154
-
155
- 'timingsarray': timingsArray,
156
- });
157
- // setDropDownData(description)
158
- setDropdownShow(false);
159
- props.singlelinepreview != undefined ? props.singlelinepreview(1) : null;
160
- } else {
161
- notifyMessage('Please fill out required fields', 3);
162
- }
163
- }
164
- // console.log("Timings Arrrrrayyy Outsideeeeeee network call", JSON.stringify(timingsArray))
165
-
166
- function getTimingsData(val) {
167
-
168
- var TestTimingNewFormat = {
169
- 'data': {
170
- 'title': 'Timing',
171
- 'medicincode': 0,
172
- 'doctorcode': 0,
173
- 'timingdescription': '',
174
- 'flag': 1,
175
- 'datavalue': 0,
176
- 'timingsarray': [
177
- {
178
- 'timingslot': 1,
179
- 'timingslotname': '',
180
- 'timingslotfrom': '',
181
- 'timingslotto': '',
182
- 'usagename': '',
183
- 'editstatus': false,
184
- 'dosage': [
185
- {
186
- 'volume': 0,
187
- 'unit': '',
188
- 'intake': '0',
189
- 'usagename': '',
190
- 'usagetype': 0,
191
- 'patientdescription': '',
192
- 'consultantdescription': '',
193
- 'medicationdescription': '',
194
- 'patientdescriptionlocalfont': '',
195
- 'remarks': '',
196
- 'description': '',
197
- 'intakedisplay': 'NA',
198
- },
199
- ],
200
- },
201
- ],
202
- },
203
- };
204
-
205
- setTimingsArray();
206
- setIsLoading(true);
207
- let buttonapi = APIURL + 'emr/emrcommonget/rnhosumrtimings ' + val.datavalue;
208
- console.log('Butttttooonnnn apiiiiiiiiiii', JSON.stringify(buttonapi));
209
- NetworkServiceCall('get', buttonapi)
210
- .then(function (response) {
211
- if (response.httpstatus == 200) {
212
- setData(response.data);
213
- setDescription(response.data.timingdescription);
214
- setTimingsArray(response.data.timingsarray);
215
- setIsLoading(false);
216
- if (response.data.datavalue == 0) {
217
- setSaveVisibility(true);
218
- }
219
- setRefresh(refresh + 1);
220
- setCategory({
221
- 'categorycode': 4,
222
- 'categoryname': 'SCHEDULED',
223
- });
224
- setCategoryRefresh(false);
225
- setTimeout(() => {
226
- setCategoryRefresh(true);
227
- });
228
- } else {
229
- setIsLoading(false);
230
- notifyMessage('Network Error', 4);
231
- }
232
- });
233
- }
234
-
235
- function getOverlayScreenChildcontainer() {
236
- return (
237
- {
238
- height: Dimensions.get('window').height * 0.6,
239
- marginBottom: Dimensions.get('window').height * 0.01,
240
- // marginTop: Dimensions.get('window').height * 0.01
241
- }
242
- );
243
- }
244
-
245
-
246
- function GetDropdown(data) {
247
- const newDropDownData = data.filter(function (item) {
248
- const dataItem = item.displayvalue ? item.displayvalue.toUpperCase() : ''.toUpperCase();
249
- const textData = searchData.toUpperCase();
250
- return dataItem.indexOf(textData) > -1;
251
- });
252
- return (
253
- <View style={{ flexDirection: 'row' }}>
254
- <FlatList
255
- data={newDropDownData}
256
- keyboardShouldPersistTaps="handled"
257
- renderItem={renderItemDropdown}
258
- initialNumToRender={10}
259
- keyExtractor={(item, index) => 'key' + index}
260
- />
261
- {displayData != undefined && displayData.length > 0 ?
262
- <View style={{
263
- marginBottom: Dimensions.get('window').height * 0.01,
264
- }}>
265
- <FlatList
266
- data={['#', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '.', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']}
267
- renderItem={renderAlphabet}
268
- keyboardShouldPersistTaps="handled"
269
- style={{ paddingBottom: 20 }}
270
- contentContainerStyle={{ alignItems: 'center' }}
271
- keyExtractor={(item, index) => 'key' + index}
272
- />
273
- </View> : null}
274
- </View>
275
- );
276
- }
277
-
278
- function renderAlphabet({ index, item }) {
279
- return (
280
- <TouchableOpacity style={{
281
- width: normalize(20), alignItems: 'center', paddingVertical: 2, borderRadius: normalize(40) / 2,
282
- backgroundColor: index == alphaindex ? Global.AppTheme.primary_color : 'white',
283
- }}
284
- onPress={() => getAlphabetData(item, index)}>
285
- <Text style={{
286
- color: index == alphaindex ? 'white' : 'black',
287
- fontWeight: index == alphaindex ? 'bold' : 'normal',
288
- }}>{item}</Text>
289
- </TouchableOpacity>
290
- );
291
- }
292
-
293
- function getAlphabetData(alpha, index) {
294
- var filter = displayData.filter(value => value.displayvalue != undefined ? (value.displayvalue).charAt(0) == alpha : '');
295
- setAlphaIndex(index);
296
- setFilterPurpose(filter);
297
- setSearchData(alpha);
298
- index == 0 ? (setAlphaFilter(false), setSearchData('')) : (setAlphaFilter(true), setSearchData(alpha));
299
- }
300
-
301
- function getDeleteTiming(params) {
302
- if (tempString.length > 0) {
303
- let buttonapi = APIURL + 'emr/emrcommonget/rnlatimingtemplatedelete ' + "'" + tempString[0] + "'" + ',' + Global.userData.hosuconsultant;
304
- console.log('Template Stringggggggggggggggg', JSON.stringify(buttonapi));
305
- NetworkServiceCall('get', buttonapi, '')
306
- .then(function (response) {
307
- console.log('Template', JSON.stringify(response));
308
- if (response.httpstatus == 200 &&
309
- response.data != undefined &&
310
- response.data.message != undefined) {
311
- notifyMessage(response.data.message, 1);
312
- if (response.data.deletestatus == true) {
313
- FetchDropdownList(1);
314
- settempString([]);
315
- }
316
- } else {
317
- notifyMessage('Error On Delete', 2);
318
- }
319
- });
320
- } else {
321
- notifyMessage('Long Press to select a timing', 3);
322
- }
323
- }
324
-
325
- function mode(array) {
326
- if (array.length == 0)
327
- {return null;}
328
- var modeMap = {};
329
- var maxEl = array[0], maxCount = 1;
330
- for (var i = 0; i < array.length; i++) {
331
- var el = array[i];
332
- if (modeMap[el] == null)
333
- {modeMap[el] = 1;}
334
- else
335
- {modeMap[el]++;}
336
- if (modeMap[el] > maxCount) {
337
- maxEl = el;
338
- maxCount = modeMap[el];
339
- }
340
- }
341
- return maxEl;
342
- }
343
-
344
- function selection(item, changevalue, keycode) {
345
-
346
- const DosageCount = item.timingsarray.map((obj, i) => ({
347
- ...obj,
348
- dosage: obj.dosage,
349
- }));
350
- const totalCount = DosageCount.reduce((accum, item) => accum + item.dosage[0].volume, 0);
351
- console.log('props.completeData.timingdata[0].keyid,', props.completeData.timingdata[0].keyid);
352
- const dataset = {
353
- ...item,
354
- 'ssuser': Global.userData != undefined && Global.userData != null ? Global.userData.suuser : 0,
355
- 'hosuconsultant': Global.userData != undefined && Global.userData != null ? Global.userData.hosuconsultant : 0,
356
- 'calculationcount': totalCount,
357
- 'key': keycode,
358
- 'timingsarray': item.timingsarray.map(obj => ({
359
- ...obj,
360
- keyid: isNU(props.completeData.timingdata[0].keyid) ? props.completeData.timingdata[0].keyid : 1,
361
- dosage: obj.dosage,
362
- })),
363
- };
364
-
365
- //
366
- // let onDuplicate = {
367
- // "keykk": dataset.key
368
- // }
369
-
370
- // let onDuplicate = {
371
- // ...item,
372
- // "ssuser": Global.userData != undefined && Global.userData != null ? Global.userData.suuser : 0,
373
- // "hosuconsultant": Global.userData != undefined && Global.userData != null ? Global.userData.hosuconsultant : 0,
374
- // "key": keycode
375
- // }
376
-
377
- (props.completeData.flag != 2 ?
378
- props.onNewTimings(dataset) :
379
- props.UpdateNewTimings(dataset));
380
- // props.onDuplicate({
381
- // ...item,
382
- // "ssuser": Global.userData != undefined && Global.userData != null ? Global.userData.suuser : 0,
383
- // "hosuconsultant": Global.userData != undefined && Global.userData != null ? Global.userData.hosuconsultant : 0,
384
- // "key": keycode,
385
- // "timingsarray": item.timingsarray
386
- // });
387
- // props.refreshCount(1);
388
- // (props.singlelinepreview != undefined ? props.singlelinepreview(1) : null);
389
- // props.editStatus(1);
390
- // setDropDownData(item.displayvalue);
391
- setDropdownShow(false);
392
- }
393
-
394
- function getLongPress(datavalue) {
395
- if (tempString.includes(datavalue.datavalue)) {
396
- datavalue.selected = !datavalue.selected;
397
- setRefresh(refresh + 1);
398
- var index = tempString.indexOf(datavalue.datavalue);
399
- if (index > -1) {
400
- tempString.splice(index, 1);
401
- }
402
- } else {
403
- datavalue.selected = !datavalue.selected;
404
- setRefresh(refresh + 1);
405
- tempString.push(datavalue.datavalue);
406
- }
407
- }
408
-
409
- function getDropDownIntake(item) {
410
- let dropdownvaluenew3 = ' ';
411
- Dropdown.Intake != null
412
- ? Dropdown.Intake.map(val => {
413
- if (val.datavalue == item) {
414
- dropdownvaluenew3 = val.displayvalue;
415
- }
416
- })
417
- : null;
418
- return ' ' + dropdownvaluenew3;
419
- }
420
-
421
- function getDosageUnit(details) {
422
- let dropdownvaluenew4;
423
- Global.DosageArray != null && Global.DosageArray != undefined
424
- && Global.DosageArray.length > 0
425
- ? Global.DosageArray.map(val => {
426
- if (val.datavalue == parseInt(details)) {
427
- dropdownvaluenew4 = val.displayvalue;
428
- }
429
- })
430
- : null;
431
- return dropdownvaluenew4;
432
- }
433
-
434
- function renderItemDropdown(data) {
435
- return (
436
- <TouchableOpacity style={{
437
- borderColor: 'lightblue', borderWidth: 1, borderBottomWidth: 1, borderRadius: 7,
438
- backgroundColor: data.item.selected ? '#fcb8b8' : '#fff', marginVertical: normalize(2),
439
- }}
440
- onPress={() => selection(data.item, data.item.selected, props.keycode)}
441
- onLongPress={() => getLongPress(data.item)}>
442
- <TouchableOpacity
443
- style={{
444
- flexDirection: 'row',
445
- alignItems: 'center',
446
- width: '100%',
447
- }}
448
- disabled={true}
449
- // onPress={() => selection(data.item, data.item.selected, props.keycode)}
450
- // activeOpacity={0.5}
451
- >
452
- <FontAwesome name="dot-circle-o" color={Global.AppTheme.primary_color} size={normalize(15)} style={{ paddingHorizontal: normalize(7) }} />
453
- <Text style={{ fontWeight: 'bold', fontSize: normalize(14) }}>
454
- {data.item.displayvalue}
455
- </Text>
456
- </TouchableOpacity>
457
-
458
- {data.item.timingcategoryname != undefined &&
459
- data.item.timingcategoryname != null &&
460
- data.item.timingcategoryname != '' ?
461
- <View style={{ position: 'absolute', top: 0, right: 3 }}>
462
- <Text style={{ fontSize: normalize(9), alignSelf: 'flex-start', fontWeight: 'bold' }} >
463
- {data.item.timingcategoryname}
464
- </Text>
465
- </View> : null}
466
-
467
- {/* <ScrollView horizontal={true} showsHorizontalScrollIndicator={false}> */}
468
- <View style={{ flexDirection: 'row', paddingLeft: normalize(25), width: '100%', flexWrap: 'wrap' }}>
469
- {data.item.timingsarray != undefined ? data.item.timingsarray.map((subitem, k) => {
470
- // console.log("........KKKKK........LLLL........KKKKK.......",JSON.stringify(subitem))
471
- return (
472
- <View key={k}>
473
- {subitem.dosage != undefined && subitem.dosage[0].volume != 0 ?
474
- <View style={{ flexDirection: 'row', paddingLeft: normalize(5), justifyContent: 'center', alignItems: 'center' }} >
475
- <Text style={{ fontSize: normalize(11) }}>{subitem.timingslotname} {''}</Text>
476
- <Text style={{ fontSize: normalize(11) }}>{subitem.dosage[0].volume} {''}</Text>
477
- <Text style={{ fontSize: normalize(11) }}>{getDosageUnit(subitem.dosage[0].unit) != 'Not Applicable' ? getDosageUnit(subitem.dosage[0].unit) : ''} {' '}</Text>
478
- <Text style={{ fontSize: normalize(10) }}>{getDropDownIntake(subitem.dosage[0].intake)}</Text>
479
- <Text style={{ fontSize: normalize(11), fontWeight: 'bold' }}> | </Text>
480
- </View>
481
- : null}
482
- </View>
483
- );
484
- }) : null}
485
- </View>
486
- {/* </ScrollView> */}
487
- </TouchableOpacity>
488
- );
489
- }
490
-
491
- function DropdownLayout() {
492
- return (
493
- <View style={layoutstyles.overlay_screen_container}>
494
- <View style={{ alignItems: 'center' }}>
495
- {/* <Text style={{ fontSize: normalize(12), fontWeight: 'bold' }}> Select Option </Text> */}
496
- </View>
497
- <View style={getOverlayScreenContainer()}>
498
- <View
499
- style={[ComponentStyles.searchTextbox_View,
500
- layoutstyles.overlay_searchTextbox_View,
501
- ]}
502
- >
503
- <View style={layoutstyles.textinput_view}>
504
- <TextInput
505
- style={[ComponentStyles.searchTextbox]}
506
- editable={true}
507
- autoCapitalize={'characters'}
508
- value={searchData}
509
- onChangeText={text => setSearchData(text)}
510
- secureTextEntry={false}
511
- keyboardType={'default'}
512
- placeholder="Search"
513
- />
514
- </View>
515
- <Image style={[ComponentStyles.searchIcon]}
516
- source={{ uri: 'https://i.ibb.co/j8ywYpJ/search.png' }}
517
- />
518
-
519
- </View>
520
- </View>
521
- <View style={getOverlayScreenChildcontainer()}>
522
- {GetDropdown(alphaFilter ? filterPurpose : displayData)}
523
- </View>
524
-
525
-
526
- </View>
527
-
528
- );
529
- }
530
-
531
- // console.log("SECTIONNNNNNNNNN INFORMATIONNNNNNNNNNNN", JSON.stringify(section))
532
-
533
- function FetchDropdownList(key) {
534
- // console.log("AFTERRRRRRRRRRRRR INFORMATIONNNNNNNNNNNN", JSON.stringify(key))
535
-
536
- props.singlelinepreview != undefined ? props.singlelinepreview(1) : null;
537
- setSearchData('');
538
- settempString([]);
539
- setIsLoading(true);
540
- setDropdownShow(true);
541
- let buttonapi = key == 3 ? APIURL + 'emr/emrcommonget/rnlafavoritetimings ' + Global.userData.hosuconsultant + ',' + hosumrclassificationnature : APIURL + props.dropdownapi;
542
- console.log('DROPDOWN', buttonapi);
543
- NetworkServiceCall('get', buttonapi, '')
544
- .then(function (response) {
545
- // console.log("RESPOSEEEEEEEEEEEEEEEEEEEEE", JSON.stringify(response))
546
- if (response.data.data != null && response.data.data != undefined) {
547
- searchResult = response;
548
- setDisplayData(response.data.data);
549
- setIsLoading(false);
550
- }
551
- else {
552
- searchResult = [];
553
- setDisplayData([]);
554
- setIsLoading(false);
555
- }
556
- });
557
- }
558
-
559
- function getFavTimings() {
560
- setSection(3);
561
- FetchDropdownList(3);
562
- }
563
-
564
- function getOverlayScreenContainer() {
565
- return ({
566
- flexDirection: 'row',
567
- marginHorizontal: 5,
568
- marginVertical: 4,
569
- height: Dimensions.get('window').height * 0.045,
570
- });
571
- }
572
-
573
- function getSavedDataTimings(params) {
574
- // console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", JSON.stringify(params))
575
- if (props.completeData.timingdata[0].timings != undefined && props.completeData.timingdata[0].timings != null && props.completeData.timingdata[0].timings.timingsarray != undefined) {
576
- // console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", JSON.stringify(params))
577
- setSection(2);
578
- setSaveVisibility(false);
579
- setDropdownShow(true);
580
-
581
- setTimingsArray();
582
- setIsLoading(true);
583
-
584
- // const Destructure = props.completeData.timingdata[0].timings.timingsarray.map(obj => ({
585
- // ...obj,
586
- // dosage: [obj.dosage],
587
- // }))
588
-
589
- // console.log("DESTRUCTREDDDDDDDDDD ARRRAYYYYYYYYY",JSON.stringify())
590
- const SavedJSON = {
591
- 'medicinecode': props.completeData.timingdata[0].timings.medicinecode,
592
- 'ssuser': props.completeData.timingdata[0].timings.ssuser,
593
- 'flag': props.completeData.timingdata[0].timings.flag,
594
- 'calculationcount': props.completeData.timingdata[0].timings.calculationcount,
595
- 'datavalue': props.completeData.timingdata[0].timings.datavalue,
596
- 'timingcategorycode': props.completeData.timingdata[0].timings.timingcategorycode,
597
- 'timingcategoryname': props.completeData.timingdata[0].timings.timingcategoryname,
598
- 'timingdescription': props.completeData.timing != '' && props.completeData.timing != undefined && props.completeData.timing != null ? props.completeData.timing : props.completeData.timingdata[0].timings.timingdescription,
599
- 'timingsarray': props.completeData.timingdata[0].timings.timingsarray,
600
- };
601
-
602
- // console.log(".............................SAVED DATA ...................... ", JSON.stringify(SavedJSON))
603
-
604
- setTimeout(() => {
605
- setData(SavedJSON);
606
- setDescription(SavedJSON.timingdescription);
607
- setTimingsArray(SavedJSON.timingsarray);
608
- setIsLoading(false);
609
- setRefresh(refresh + 1);
610
- });
611
- }
612
- }
613
-
614
- function getSectionData(params) {
615
- setSection(2);
616
- setSaveVisibility(false);
617
- setDropdownShow(true);
618
- // console.log(".............................SECTION DATA ...................... ", JSON.stringify(props.completeData))
619
- getTimingsData({
620
- 'datavalue': props.completeData.hosumrprescriptiontiming,
621
- 'displaytext': props.completeData.timing,
622
- });
623
- }
624
-
625
- function getButtonClick(item) {
626
- // console.log("JSON STRINGYFY", JSON.stringify(item.stage))
627
- switch (item.stage) {
628
- case 3: getFavTimings();
629
- break;
630
- case 4: setDropdownShow(false);
631
- break;
632
-
633
- case 1: getSearch();
634
- break;
635
- case 2: setSection(2, getTimingsData({
636
- 'datavalue': 0,
637
- 'displaytext': 'HHHH',
638
- }));
639
- }
640
- }
641
-
642
- function getSearch() {
643
- setSection(1);
644
- FetchDropdownList(1);
645
-
646
- }
647
-
648
-
649
- function getSectionDataDuplicate(params) {
650
- // console.log(".......IIIIIIIII>>>>>YYYYYYYYYYNNNNNNNN>>>>>>>>KKKKKKK", JSON.stringify(props.completeData.timingdata[0].duplicatedata.timingsarray))
651
- setSection(2);
652
- setSaveVisibility(false);
653
- setDropdownShow(true);
654
- // console.log(".............................DETAILS ...................... ", JSON.stringify(props.completeData.duplicatedata.timingcategoryname))
655
- setTimingsArray();
656
- setIsLoading(true);
657
-
658
- setTimeout(() => {
659
- setData(props.completeData.timingdata[0].duplicatedata);
660
- setDescription(props.completeData.timingdata[0].duplicatedata.timingdescription);
661
- setTimingsArray(props.completeData.timingdata[0].duplicatedata.timingsarray);
662
- setIsLoading(false);
663
- setRefresh(refresh + 1);
664
- });
665
- }
666
-
667
- return (
668
- <View>
669
- {props.type == undefined && props.type != 2 ?
670
- <TouchableOpacity
671
- // onPress={() => props.editable ? getOverlay() : getTimings()}
672
- disabled={props.multiformat != undefined ? props.multiformat : false}
673
- // onPress={() => props.editable ? FetchDropdownList() : props.completeData.duplicatedata != undefined ? getSectionDataDuplicate() : props.completeData.flag != 2 ? getSectionData() : getSavedDataTimings()}
674
- onPress={() => setSection(3, FetchDropdownList(3))}
675
- // onPress={() => FetchDropdownList() }
676
- style={{
677
- borderWidth: 1,
678
- borderColor: 'lightgrey',
679
- borderRadius: 5,
680
- paddingLeft: 2,
681
- width: props.widthArr,
682
- alignItems: 'center',
683
- paddingRight: 15,
684
- paddingLeft: normalize(5),
685
- elevation: 3,
686
- marginVertical: normalize(2),
687
- marginHorizontal: normalize(2),
688
- backgroundColor:
689
- props.completeData != undefined && props.completeData.timingdata != undefined && props.completeData.timingdata[0].timings != undefined
690
- && props.completeData.timingdata[0].timings.timingcategorycode != undefined ?
691
- props.completeData.timingdata[0].timings.timingcategorycode == 4 || props.completeData.timingdata[0].timings.timingcategorycode == 0 ?
692
- props.cornerKey % 2 ? '#fff' : 'white' : '#fff' :
693
- props.cornerKey % 2 ? '#fff' : 'white',
694
- height: Dimensions.get('screen').height * 0.055,
695
- flexDirection: 'row',
696
- justifyContent: 'space-between',
697
- }}>
698
- <Text
699
- adjustsFontSizeToFit
700
- style={{
701
- fontSize: normalize(13),
702
- alignSelf: 'center',
703
- fontWeight: 'bold',
704
- width: '90%',
705
- }}>
706
- {dropdowndata != null && dropdowndata != undefined
707
- ? dropdowndata
708
- : ''}
709
- {' '}
710
- </Text>
711
-
712
- {props.completeData != undefined && props.completeData.timingdata != undefined
713
- && props.completeData.timingdata.length > 0 && props.completeData.timingdata[0].timings != undefined
714
- && props.completeData.timingdata[0].timings.timingcategoryname != undefined
715
- && dropdowndata != null && dropdowndata != undefined && dropdowndata != '' && dropdowndata != ' ' ?
716
- <View style={{ position: 'absolute', bottom: 0, right: 3 }}>
717
- <Text style={{ fontSize: normalize(9), alignSelf: 'flex-start', fontWeight: 'bold' }} >
718
- {props.completeData.timingdata[0].timings.timingcategoryname}
719
- </Text>
720
- </View> : null}
721
-
722
- {dropdowndata != null && dropdowndata != undefined && dropdowndata != '' && dropdowndata != ' ' ?
723
- <TouchableOpacity
724
- // onPress={() => props.completeData.duplicatedata != undefined ? getSectionDataDuplicate() : props.completeData.flag != 2 ? getSectionData() : getSavedDataTimings()}>
725
- onPress={() => props.completeData.timingdata[0].duplicatedata != undefined ? getSectionDataDuplicate() : getSavedDataTimings()}>
726
- <FontAwesome
727
- name="edit"
728
- color={Global.AppTheme.primary_color}
729
- size={normalize(20)}
730
- style={{}}
731
- />
732
- </TouchableOpacity> : null}
733
- </TouchableOpacity>
734
- :
735
- <View style={{ flexDirection: 'column' }}>
736
- <View style={{ flexDirection: 'row', alignItems: 'center', marginLeft: normalize(5) }}>
737
- <Icons.MaterialCommunityIcons name={'clock-time-eight'} color={Global.AppTheme.primary_color} style={{ opacity: 0.9 }}
738
- size={normalize(13)} />
739
- <Text style={{
740
- fontSize: normalize(11),
741
- fontWeight: Platform.OS == 'ios' ? '300' : '325',
742
- color: Global.AppTheme.primary_color,
743
- }}> Timings *
744
- </Text>
745
- </View>
746
-
747
- <TouchableOpacity
748
- disabled={props.multiformat != undefined ? props.multiformat : false}
749
- onPress={() => setSection(3, FetchDropdownList(3))}
750
- style={{
751
- width: Dimensions.get('screen').width * 0.5,
752
- alignItems: 'center',
753
- backgroundColor: '#fff',
754
- height: normalize(30),
755
- borderColor: 'lightgrey',
756
- borderWidth: 1, borderRadius: 5,
757
- paddingHorizontal: normalize(10),
758
- flexDirection: 'row',
759
- justifyContent: 'space-between', elevation: 3, marginHorizontal: normalize(5),
760
- }}>
761
- <Text
762
- adjustsFontSizeToFit
763
- style={{
764
- fontSize: normalize(13),
765
- alignSelf: 'center',
766
- fontWeight: 'bold',
767
- width: '90%',
768
- }}>
769
- {dropdowndata != null && dropdowndata != undefined
770
- ? dropdowndata
771
- : ''}
772
- {' '}
773
- </Text>
774
-
775
- {props.completeData != undefined && props.completeData.timingdata[0].timings != undefined
776
- && props.completeData.timingdata[0].timings.timingcategoryname != undefined
777
- && dropdowndata != null && dropdowndata != undefined && dropdowndata != '' && dropdowndata != ' ' ?
778
- <View style={{ position: 'absolute', bottom: 0, right: 3 }}>
779
- <Text style={{ fontSize: normalize(8), alignSelf: 'flex-start', fontWeight: 'bold' }} >
780
- {props.completeData.timingdata[0].timings.timingcategoryname}
781
- </Text>
782
- </View> : null}
783
-
784
- {dropdowndata != null && dropdowndata != undefined && dropdowndata != '' && dropdowndata != ' ' ?
785
- <TouchableOpacity
786
- onPress={() => props.completeData.timingdata[0].duplicatedata != undefined ? getSectionDataDuplicate() : getSavedDataTimings()}>
787
- <FontAwesome
788
- name="edit"
789
- color={Global.AppTheme.primary_color}
790
- size={normalize(15)}
791
- style={{}}
792
- />
793
- </TouchableOpacity> : null}
794
- </TouchableOpacity>
795
- </View>
796
- }
797
-
798
- {isdropdownshow ? (
799
- <Overlay
800
- visible={true}
801
- onClose={() => setDropdownShow(false)}
802
- closeOnTouchOutside
803
- animationType="fadeInUp"
804
- containerStyle={{ backgroundColor: 'transparent' }}
805
- childrenWrapperStyle={getPopupContainerStyle()}
806
- animationDuration={500}>
807
- <View style={{ flex: 1, width: '100%', marginTop: normalize(-10) }}>
808
-
809
- {/* <TouchableOpacity style={{ position: 'absolute', right: 0, zIndex: 1, top: normalize(-5) }}
810
- onPress={() => setDropdownShow(false)}
811
- >
812
- <AntDesign name={"close"}
813
- color={Global.AppTheme.primary_color} size={normalize(30)} />
814
- </TouchableOpacity> */}
815
-
816
- <Text style={{ alignSelf: 'center', fontSize: normalize(13), fontWeight: 'bold', color: Global.AppTheme.primary_color }}>{section == 1 || section == 3 ? props.heading + ' TIMINGS' : savevisibility ? 'CREATE ' + props.heading + ' TIMINGS' : 'EDIT ' + props.heading + ' TIMINGS'}</Text>
817
- <View
818
- style={{
819
- //marginTop: normalize(10),
820
- // backgroundColor: '#eae5e5',
821
- width: '100%',
822
- borderRadius: 5,
823
- // height: normalize(35),
824
- flexDirection: 'row',
825
- alignItems: 'center',
826
- justifyContent: 'space-evenly',
827
- paddingTop: normalize(5),
828
- }}>
829
-
830
- {[{ 'iconname': 'heartbeat', 'width': 73, 'displayvalue': 'FAV', 'color': Global.AppTheme.primary_color, 'stage': 3 },
831
- { 'iconname': 'search', 'width': 73, 'displayvalue': 'ALL', 'color': Global.AppTheme.primary_color, 'stage': 1 },
832
- { 'iconname': 'list-ul', 'width': 73, 'displayvalue': 'CREATE', 'color': Global.AppTheme.primary_color, 'stage': 2 },
833
- { 'iconname': 'reply', 'width': 73, 'displayvalue': 'BACK', 'color': Global.AppTheme.primary_color, 'stage': 4 },
834
- ].map((buttons, i) => {
835
- return (
836
- <AwesomeButton key={i}
837
- onPress={() => getButtonClick(buttons)}
838
- borderRadius={10}
839
- borderWidth={1}
840
- height={normalize(35)}
841
- // width={normalize(buttons.width)}
842
- width={normalize(55)}
843
- backgroundColor={section == buttons.stage ? '#eaf2ff' : '#fff'}
844
- paddingHorizontal={0}
845
- raiseLevel={2}
846
- paddingBottom={0}
847
- borderColor={section == buttons.stage ? '#eaf2ff' : Global.AppTheme.primary_color}
848
- paddingTop={0}
849
- style={{ padding: 0 }}
850
- >
851
- <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
852
- <Icons.FontAwesome5 name={buttons.iconname} style={{ paddingRight: normalize(0) }}
853
- color={Global.AppTheme.primary_color} size={normalize(17)} />
854
- <Text style={[getPopupHeadingOptionText(
855
- section == buttons.stage ? buttons.color : colors.color_DeselectText,
856
- ), { fontSize: normalize(10), paddingLeft: normalize(0) }]}>{buttons.displayvalue}</Text>
857
- </View>
858
- </AwesomeButton>
859
-
860
- // <TouchableOpacity key={i}
861
- // onPress={() => getButtonClick(buttons)}
862
- // style={{
863
- // height: '100%',
864
- // flexDirection: 'row',
865
- // alignItems: 'center',
866
- // }}>
867
- // <View>
868
- // <FontAwesome5
869
- // name={buttons.iconname}
870
- // color={section == buttons.stage ? buttons.color : colors.color_DeselectText}
871
- // size={normalize(20)}
872
- // />
873
- // </View>
874
- // <View>
875
- // <Text
876
- // style={getPopupHeadingOptionText(
877
- // section == buttons.stage ? buttons.color : colors.color_DeselectText,
878
- // )}>
879
- // {buttons.displayvalue}
880
- // </Text>
881
- // </View>
882
- // </TouchableOpacity>
883
- );
884
- })}
885
- </View>
886
-
887
-
888
- {section == 1 || section == 3 ?
889
- <View style={{ flex: 1, width: '100%' }}>
890
- {!isLoading ?
891
- searchResult.httpstatus == 200 ?
892
- DropdownLayout()
893
- :
894
- <View>
895
- <Text style={[ComponentStyles.no_data_found_text]}>No Result Found</Text>
896
- </View>
897
- :
898
- <View style={{
899
- flex: 1, width: '100%', justifyContent: 'center',
900
- backgroundColor: 'transparent', borderRadius: 10,
901
- }}>
902
- <SearchLoader />
903
- </View>}
904
- </View> :
905
- <View style={{ flex: 1, width: '100%' }}>
906
- {getTimingsView()}
907
- </View>}
908
- </View>
909
- {section == 1 ?
910
- <View style={{
911
- position: 'relative', flexDirection: 'column', alignSelf: 'flex-start',
912
- }}>
913
-
914
- <CAwesomeButton
915
- data={{
916
- 'displaytext': 'Delete',
917
- 'size': 10,
918
- 'iconname': 'trash',
919
- 'selected': false,
920
- 'visibility': true,
921
- 'iconsize': 20,
922
- 'functionid': 'STD01',
923
- 'shadowcolor': '#eaf2ff',
924
- 'iconcolor': Global.AppTheme.primary_color,
925
- 'fontcolor': 'red',
926
- }}
927
- callBack={val => val == undefined ? null : getDeleteTiming()}
928
- />
929
-
930
- {/* <TouchableOpacity style={{
931
- justifyContent: 'center', backgroundColor: '#f7f4f4', marginLeft: normalize(0),
932
- borderRadius: 10, alignItems: 'center', paddingHorizontal: normalize(15), paddingTop: normalize(5)
933
- }}
934
- onPress={() => getDeleteTiming()}
935
- >
936
- <AntDesign name={"delete"}
937
- color={"red"} size={normalize(20)} />
938
-
939
- <Text
940
- style={{
941
- fontSize: normalize(11),
942
- color: 'red',
943
- fontWeight: 'bold',
944
- }}>
945
- {' '}
946
- {"Delete"}
947
- </Text>
948
- </TouchableOpacity> */}
949
- </View> : null}
950
-
951
- </Overlay>
952
- ) : null}
953
- </View>
954
- );
955
-
956
- function SaveTimings() {
957
- var filterforemptydosage = timingsArray.filter(function (event) {
958
- return event.editstatus == true;
959
- });
960
-
961
- // console.log("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$", JSON.stringify(filterforemptydosage))
962
-
963
- var output = {
964
- 'groups': {
965
- 'procedurename': 'hosumrtimingtemplates1',
966
- 'medicinecode': 0,
967
- 'ssuser': Global.userData != undefined && Global.userData != null ? Global.userData.suuser : 0,
968
- 'flag': 1,
969
- 'hosuconsultant': Global.userData != undefined && Global.userData != null ? Global.userData.hosuconsultant : 0,
970
- 'timingdescription': description,
971
- 'hosumrclassificationnature': hosumrclassificationnature,
972
- 'timingcategorycode': category.categorycode != 0 ? category.categorycode : 4,
973
- 'timingcategoryname': category.categoryname,
974
- 'timingsarray': timingsArray.map(obj => ({
975
- ...obj,
976
- dosage: obj.dosage,
977
- })),
978
- },
979
- };
980
-
981
- if (description != '' && description != 0 && description != '' &&
982
- filterforemptydosage.length > 0 && output.timingcategorycode != 0) {
983
- let buttonapi = APIURL + 'commontemplatesave/RnCommonTemplateSave';
984
- console.log('+++++++++++++++++++++++++++++', buttonapi);
985
- console.log('+++++++++++++++++++++++++++++', JSON.stringify(output));
986
- setIsLoading(true);
987
- NetworkServiceCall('post', buttonapi, output)
988
- .then(function (response) {
989
- console.log('RESPONSEE>>>>>>>>>>>>>>>>>>>>>', JSON.stringify(response));
990
- if (response.httpstatus == 200
991
- && response.data != undefined
992
- && response.data.code != undefined && response.data.code > 0) {
993
- setIsLoading(false);
994
- setSection(1);
995
- FetchDropdownList(1);
996
- notifyMessage('Data Saved!!!!!', 1);
997
- setIsLoading(false);
998
-
999
- } else {
1000
- setIsLoading(false);
1001
- notifyMessage('Data Not Saved!!!!!', 2);
1002
- }
1003
- });
1004
- } else {
1005
- notifyMessage('Please fill out required fields', 3);
1006
- }
1007
- }
1008
-
1009
- function getBgColor(key) {
1010
- switch (key) {
1011
- case 1: return 'yellow';
1012
- case 2: return 'orange';
1013
- case 3: return 'blue';
1014
- case 4: return 'black';
1015
- default: return 'black';
1016
- }
1017
- }
1018
-
1019
- function getTimingsView(params) {
1020
- return (
1021
- <View style={{ marginTop: normalize(10), flex: 1 }}>
1022
- <View style={{ flexDirection: 'row-reverse', alignItems: 'center', justifyContent: 'space-evenly', width: '100%' }}>
1023
- {data != undefined && categoryrefresh ?
1024
- <View style={{ flexDirection: 'column', marginHorizontal: normalize(5) }}>
1025
- <Text style={{ fontSize: normalize(11), paddingBottom: normalize(2), paddingLeft: normalize(8) }}>Timing Category</Text>
1026
- <SDropDownNew
1027
- dropdownapi={'emr/emrcommonget/rnladropdown 13'}
1028
- dropdowndata={savevisibility ? category.categoryname : props.completeData != undefined &&
1029
- props.completeData.timingdata[0].timings != undefined &&
1030
- props.completeData.timingdata[0].timings.timingcategoryname != undefined ? props.completeData.timingdata[0].timings.timingcategoryname : data.timingcategoryname}
1031
- onChangeData={val =>
1032
- val == undefined ? null : (category.categorycode = val.datavalue,
1033
- category.categoryname = val.displayvalue)}
1034
- iconName={'clock'}
1035
- editable={true}
1036
- widthArr={Dimensions.get('screen').width * 0.45}
1037
- refreshCount={val =>
1038
- val == undefined ? null : setRefresh(refresh + val)
1039
- }
1040
- />
1041
- </View> : null}
1042
-
1043
- <View style={{}}>
1044
- <Text style={{ fontSize: normalize(11), paddingHorizontal: 10 }}>Timing Name</Text>
1045
- <View
1046
- style={{
1047
- flexDirection: 'row',
1048
- borderWidth: 1,
1049
- borderColor: 'lightgrey',
1050
- width: Dimensions.get('screen').width * 0.45,
1051
- justifyContent: 'flex-start',
1052
- alignItems: 'center',
1053
- borderRadius: 5,
1054
- height: Dimensions.get('screen').height * 0.040,
1055
- backgroundColor: '#fff', elevation: 3,
1056
-
1057
- }}>
1058
-
1059
- <TextInput
1060
- editable={true} // To scroll data , Editable is checked in onChangeText props
1061
- keyboardType={'default'}
1062
- placeholder={'Description...'}
1063
- placeholderTextColor={'lightgrey'}
1064
- onChangeText={changevalue =>
1065
- setDescription(changevalue)
1066
- }
1067
- scrollEnabled
1068
- style={{
1069
- textAlignVertical: 'center',
1070
- width: '80%',
1071
- marginLeft: '1%',
1072
- padding: 0,
1073
- height: '100%',
1074
- fontSize: normalize(14),
1075
- }}
1076
- >{description}</TextInput>
1077
- </View>
1078
- </View>
1079
-
1080
- </View>
1081
- {switchRefresh ?
1082
- <View keyboardShouldPersistTaps={'handled'} style={{ flex: 1 }}>
1083
- <ScrollView style={{ marginBottom: normalize(40) }} keyboardShouldPersistTaps={'handled'}>
1084
- {timingsArray != null && timingsArray != undefined && visibility ?
1085
- timingsArray.map((item, i) => {
1086
- return (
1087
- <View key={i}
1088
- style={{
1089
- margin: normalize(1),
1090
- marginRight: normalize(0),
1091
- marginLeft: normalize(5),
1092
- marginTop: normalize(5),
1093
- marginBottom: normalize(5),
1094
- flexDirection: 'row',
1095
- alignItems: 'center', backgroundColor: '#fff',
1096
- }}>
1097
- <View style={{}}>
1098
- <View style={{ flexDirection: 'row', alignItems: 'center', paddingLeft: normalize(5) }}>
1099
- {/* <Text>{props.completeData != undefined &&
1100
- props.completeData.timingdata[0].timings != undefined &&
1101
- props.completeData.timingdata[0].timings.timingcategoryname != undefined ? props.completeData.timingdata[0].timings.timingcategoryname : data.timingcategoryname}</Text> */}
1102
-
1103
- {/* {props.completeData != undefined &&
1104
- props.completeData.timingdata[0].timings != undefined &&
1105
- props.completeData.timingdata[0].timings.timingcategorycode == 4
1106
- || category.categorycode == 4 ? */}
1107
- <View>
1108
- {item.dosage != undefined &&
1109
- item.dosage[0] != undefined &&
1110
- item.dosage[0].specifictime ?
1111
- <Text
1112
- style={{ fontSize: normalize(8), marginTop: 2, fontWeight: 'bold', color: 'black' }}>
1113
- {getSlotName(item.timingslotname, item.dosage[0], item)}
1114
- </Text> :
1115
- <Text
1116
- style={{ fontSize: normalize(8), marginTop: 2, fontWeight: 'bold', color: 'black' }}>
1117
- {item.timingslotname}
1118
- </Text>}
1119
- </View>
1120
- {/* : null} */}
1121
-
1122
- {item.dosage != undefined &&
1123
- item.dosage[0] != undefined &&
1124
- item.dosage[0].specifictime != undefined &&
1125
- item.dosage[0].specifictime ?
1126
- <Text
1127
- style={{ fontSize: normalize(10), marginTop: 2, fontWeight: 'bold', color: 'red' }}>
1128
- {' @ '}{item.dosage[0].timeprovided}
1129
- </Text> : null}
1130
- </View>
1131
-
1132
- <View
1133
- style={{ flexDirection: 'row', alignItems: 'center' }}>
1134
- <SDropDownDosage
1135
- dropdownapi={'emr/emrcommonget/rnladropdown 10'}
1136
- dropdowndata={item.dosage[0].usagename}
1137
- completeData={item}
1138
- iconName={'time'}
1139
- cornerKey={item.bgcolor}
1140
- // disabled={item.data[0].usagename != null && i != 0 ? true : false}
1141
- onChangeData={val => (
1142
- val == undefined
1143
- ? null
1144
- : getDosageTiming(item, val)
1145
- )}
1146
- onChangeDosage={val => (
1147
- val == undefined
1148
- ? null
1149
- : AddNewDosage(item, val)
1150
- )}
1151
- onDeleteData={val => (
1152
- val == undefined
1153
- ? null
1154
- : deleteDosageTimings(item, val)
1155
- )}
1156
- editable={item.usagename != 0 && item.usagename != undefined && item.usagename != '' ? false : true}
1157
- widthArr={Dimensions.get('screen').width * 0.40}
1158
- refreshCount={val =>
1159
- val == undefined ? null : setRefresh(refresh + 1)
1160
- }
1161
- editStatus={val =>
1162
- val == undefined ? null : console.log(val)
1163
- }
1164
- />
1165
- </View>
1166
- </View>
1167
-
1168
- {switchRefresh ?
1169
- <STimingSwitch key={i}
1170
- data={item.dosage != undefined && item.dosage[0].specifictime != undefined
1171
- && item.dosage[0].specifictime ? getArrayTimingSwitchSpecificTime(item.timingslotname, item.dosage[0], item)
1172
- : getArrayTimingSwitch(item.timingslotname, item.dosage[0])}
1173
- callBack={val =>
1174
- val == undefined ? null : (item.timingslotname = val.slotname,
1175
- item.timingslotfrom = val.timingslotfrom,
1176
- item.timingslotto = val.timingslotto,
1177
- item.timingslot = val.timingslot,
1178
- setRefresh(refresh + 1))
1179
- } /> : null}
1180
-
1181
- {i != 0 ?
1182
- <View style={{ position: 'absolute', right: normalize(20), top: normalize(5) }}>
1183
- <TouchableOpacity onPress={() => removetiming(item, i)}>
1184
- <FontAwesome5 name="trash" color="red" size={normalize(15)} />
1185
- </TouchableOpacity>
1186
- </View> : null}
1187
- </View>
1188
- );
1189
- })
1190
- : null}
1191
-
1192
- {isLoading ?
1193
- <View style={{
1194
- flex: 1, width: '100%', justifyContent: 'center',
1195
- backgroundColor: 'transparent', borderRadius: 10,
1196
- }}>
1197
- <SearchLoader />
1198
- </View> : null}
1199
-
1200
- {timingsArray != null && timingsArray != undefined ?
1201
- timingsArray.map((item, i) => {
1202
- return (
1203
- item.dosage != undefined && item.dosage[0].usagename != undefined && item.dosage[0].usagename != '' ?
1204
- <PreviewDosage data={item} arrayData={category} key={i} /> : null
1205
- );
1206
- }) : null}
1207
-
1208
- </ScrollView>
1209
- {timingsArray != null && timingsArray != undefined ?
1210
- <View
1211
- style={{
1212
- zIndex: 1,
1213
- width: '100%',
1214
- justifyContent: 'flex-start',
1215
- alignItems: 'center',
1216
- flexDirection: 'row',
1217
- height: normalize(32),
1218
- marginTop: normalize(10),
1219
- marginBottom: normalize(10),
1220
- }}>
1221
-
1222
- {[{ 'displaytext': 'Save', 'size': 10, 'iconname': 'save', 'selected': false, 'visibility': savevisibility ? true : false, 'iconsize': 20, 'functionid': 'SS01' },
1223
- { 'displaytext': 'Edit', 'size': 10, 'iconname': 'edit', 'selected': false, 'visibility': !savevisibility ? true : false, 'iconsize': 20, 'functionid': 'SS03' },
1224
- { 'displaytext': 'Parameter', 'size': 10, 'iconname': 'plus', 'selected': false, 'visibility': true, 'iconsize': 20, 'functionid': 'SS02' }]
1225
- .map((item, i) => {
1226
- return (
1227
- item.visibility ?
1228
- <View key={i} style={{ paddingLeft: normalize(5) }}>
1229
- <CAwesomeButton
1230
- data={{
1231
- ...item,
1232
- 'shadowcolor': '#eaf2ff',
1233
- 'iconcolor': Global.AppTheme.primary_color,
1234
- 'fontcolor': Global.AppTheme.primary_color,
1235
- }}
1236
- callBack={val => val == undefined ? null : getFooterIconClick(item)}
1237
- />
1238
- </View> : null);
1239
- })}
1240
- </View> : null}
1241
- </View> : null}
1242
- </View >
1243
- );
1244
- }
1245
-
1246
- function getFooterIconClick(key) {
1247
- switch (key.functionid) {
1248
- case 'SS01': SaveTimings();
1249
- break;
1250
- case 'SS02': ADDNEWROW();
1251
- break;
1252
- case 'SS03': AddNewTimings();
1253
- break;
1254
- }
1255
- }
1256
-
1257
- function removetiming(params, index) {
1258
- if (params.homrcodetimingdetail != undefined
1259
- && params.homrcodetimingdetail != null) {
1260
- const objWithIdIndex = timingsArray.findIndex((obj) => obj.timingslot === params.timingslot);
1261
- var output = {};
1262
- output.groups = {};
1263
- output.groups.procedurename = 'homrtimingdetaildelete';
1264
- output.groups.hosumrclassificationnature = hosumrclassificationnature;
1265
- output.groups.deleteArray = [timingsArray[objWithIdIndex]];
1266
-
1267
- let buttonapi = APIURL + 'commondelete/RnCommonDelete';
1268
- console.log('deletebuttonapi', buttonapi);
1269
- console.log('delete outputttttttttttttRRRRRRRRRRRRRRRRRRRRR', JSON.stringify(output));
1270
- setIsLoading(true);
1271
- NetworkServiceCall('post', buttonapi, output)
1272
- .then(function (response) {
1273
- console.log('RESPONSEEEEE>>>>>>>>>>>>>>>>TIMING DELETE', JSON.stringify(response));
1274
- if (response.httpstatus == 200) {
1275
- if (objWithIdIndex > -1) {
1276
- timingsArray.splice(objWithIdIndex, 1);
1277
- }
1278
- setswitchRefresh(false);
1279
- setTimeout(() => {
1280
- setswitchRefresh(true);
1281
- });
1282
- setIsLoading(false);
1283
- }
1284
- else {
1285
- setIsLoading(false);
1286
- notifyMessage('Timing Delete Error', 2);
1287
- }
1288
- });
1289
- } else {
1290
- timingsArray.splice(index, 1);
1291
- setswitchRefresh(false);
1292
- setTimeout(() => {
1293
- setswitchRefresh(true);
1294
- });
1295
- }
1296
- }
1297
-
1298
- function getSlotName(key, dosage, params) {
1299
- var Arr = [{
1300
- 'timingslot': 1,
1301
- 'slotname': 'MORNING',
1302
- 'timingslotfrom': '4:00 AM',
1303
- 'timingslotto': '11:00 AM',
1304
- 'selected': false,
1305
- }, {
1306
- 'timingslot': 2,
1307
- 'slotname': 'NOON',
1308
- 'timingslotfrom': '11:00 AM',
1309
- 'timingslotto': '4:00 PM',
1310
- 'selected': false,
1311
- }, {
1312
- 'timingslot': 3,
1313
- 'slotname': 'EVENING',
1314
- 'timingslotfrom': '4:00 PM',
1315
- 'timingslotto': '6:00 PM',
1316
- 'selected': false,
1317
- }, {
1318
- 'timingslot': 4,
1319
- 'slotname': 'NIGHT',
1320
- 'timingslotfrom': '6:00 PM',
1321
- 'timingslotto': '11:30 PM',
1322
- 'selected': false,
1323
- }];
1324
-
1325
- if (dosage.specifictime) {
1326
- // var xyz = Arr.map((item) => {
1327
- // var format = 'hh:mm:ss'
1328
- // var time = moment(convertTime12to24(dosage.timeprovided), format),
1329
- // beforeTime = moment(convertTime12to24(item.timingslotfrom), format),
1330
- // afterTime = moment(convertTime12to24(item.timingslotto), format);
1331
- // if (time.isBetween(beforeTime, afterTime)) {
1332
- // item.selected = true
1333
- // params.timingslotname = item.slotname
1334
- // params.timingslot = item.timingslot
1335
- // console.log('is between', time)
1336
- // } else {
1337
- // console.log('is not between', time)
1338
- // item.selected = false
1339
- // }
1340
- // return item
1341
- // })
1342
-
1343
- var xyz = Arr.map((item) => {
1344
- var format = 'hh:mm:ss';
1345
- var time = moment(convertTime12to24(dosage.timeprovided), format),
1346
- beforeTime = moment(convertTime12to24(item.timingslotfrom), format),
1347
- afterTime = moment(convertTime12to24(item.timingslotto), format);
1348
-
1349
- // Declare params as a separate object if needed
1350
- let updatedParams = { ...params }; // Make a shallow copy of params
1351
-
1352
- if (time.isBetween(beforeTime, afterTime)) {
1353
- item.selected = true;
1354
- updatedParams.timingslotname = item.slotname; // Update the copy of params
1355
- updatedParams.timingslot = item.timingslot;
1356
- console.log('is between', time);
1357
- } else {
1358
- console.log('is not between', time);
1359
- item.selected = false;
1360
- }
1361
-
1362
- // Return the updated item
1363
- return { ...item, updatedParams };
1364
- });
1365
-
1366
- }
1367
- return key;
1368
- }
1369
-
1370
- function getArrayTimingSwitchSpecificTime(key, dosage, params) {
1371
- var Arr = [{
1372
- 'timingslot': 1,
1373
- 'slotname': 'MORNING',
1374
- 'timingslotfrom': '4:00 AM',
1375
- 'timingslotto': '11:00 AM',
1376
- 'selected': false,
1377
- }, {
1378
- 'timingslot': 2,
1379
- 'slotname': 'NOON',
1380
- 'timingslotfrom': '11:00 AM',
1381
- 'timingslotto': '4:00 PM',
1382
- 'selected': false,
1383
- }, {
1384
- 'timingslot': 3,
1385
- 'slotname': 'EVENING',
1386
- 'timingslotfrom': '4:00 PM',
1387
- 'timingslotto': '6:00 PM',
1388
- 'selected': false,
1389
- }, {
1390
- 'timingslot': 4,
1391
- 'slotname': 'NIGHT',
1392
- 'timingslotfrom': '6:00 PM',
1393
- 'timingslotto': '10:00 PM',
1394
- 'selected': false,
1395
- }];
1396
-
1397
- if (dosage.specifictime) {
1398
- var xyz = Arr.map((item) => {
1399
- var format = 'hh:mm:ss';
1400
- var time = moment(convertTime12to24(dosage.timeprovided), format),
1401
- beforeTime = moment(convertTime12to24(item.timingslotfrom), format),
1402
- afterTime = moment(convertTime12to24(item.timingslotto), format);
1403
- if (time.isBetween(beforeTime, afterTime)) {
1404
- item.selected = true;
1405
- // console.log('is between')
1406
- params.timingslotname = item.slotname;
1407
- params.timingslot = item.timingslot;
1408
- } else {
1409
- // console.log('is not between')
1410
- item.selected = false;
1411
- }
1412
- return item;
1413
- });
1414
- }
1415
- return xyz;
1416
- }
1417
-
1418
- function getArrayTimingSwitch(key, dosage) {
1419
- var Arr = [{
1420
- 'timingslot': 1,
1421
- 'slotname': 'MORNING',
1422
- 'timingslotfrom': '4:00 AM',
1423
- 'timingslotto': '11:00 AM',
1424
- 'selected': false,
1425
- }, {
1426
- 'timingslot': 2,
1427
- 'slotname': 'NOON',
1428
- 'timingslotfrom': '11:00 AM',
1429
- 'timingslotto': '4:00 PM',
1430
- 'selected': false,
1431
- }, {
1432
- 'timingslot': 3,
1433
- 'slotname': 'EVENING',
1434
- 'timingslotfrom': '4:00 PM',
1435
- 'timingslotto': '6:00 PM',
1436
- 'selected': false,
1437
- }, {
1438
- 'timingslot': 4,
1439
- 'slotname': 'NIGHT',
1440
- 'timingslotfrom': '6:00 PM',
1441
- 'timingslotto': '10:00 PM',
1442
- 'selected': false,
1443
- }];
1444
-
1445
- // if (key != undefined && key != "") {
1446
- // const arr2 = key.split(',');
1447
- // Arr.forEach(item1 => {
1448
- // var itemFromArr2 = arr2.find(item2 => item2 == item1.slotname);
1449
-
1450
- // if (itemFromArr2) {
1451
- // item1.selected = true;
1452
- // }
1453
- // })
1454
- // }
1455
-
1456
- var foundIndex = Arr.findIndex(x => x.slotname == key);
1457
- if (foundIndex > -1) {
1458
- Arr[foundIndex].selected = true;
1459
- }
1460
- return Arr;
1461
- }
1462
-
1463
- function ADDNEWROW() {
1464
- timingsArray.push(
1465
- {
1466
- 'timingslot': 1,
1467
- 'timingslotname': 'MORNING',
1468
- 'timingslotfrom': '',
1469
- 'timingslotto': '',
1470
- 'usagename': '',
1471
- 'editstatus': false,
1472
- 'dosage': [
1473
- {
1474
- 'volume': 0,
1475
- 'unit': '',
1476
- 'intake': '0',
1477
- 'usagename': '',
1478
- 'usagetype': 0,
1479
- 'patientdescription': '',
1480
- 'consultantdescription': '',
1481
- 'medicationdescription': '',
1482
- 'patientdescriptionlocalfont': '',
1483
- 'remarks': '',
1484
- 'description': '',
1485
- 'intakedisplay': 'NA',
1486
- },
1487
- ],
1488
- }
1489
- );
1490
-
1491
- setRefresh(refresh + 1);
1492
- }
1493
-
1494
- function deleteDosageTimings(params, val, fullitem) {
1495
- params.usagename = '';
1496
- params.hosumrusage = 0;
1497
- val.dosage = [{
1498
- 'timingslot': 1,
1499
- 'timingslotname': 'EARLY MORNING',
1500
- 'volume': 0,
1501
- 'unit': '',
1502
- 'intake': '0',
1503
- 'usagename': '',
1504
- 'usagetype': 0,
1505
- 'specifictime': false,
1506
- 'timeprovided': '',
1507
- 'patientdescription': '',
1508
- 'consultantdescription': '',
1509
- 'medicationdescription': '',
1510
- 'patientdescriptionlocalfont': '',
1511
- 'remarks': '',
1512
- 'description': '',
1513
- 'intakedisplay': 'NA',
1514
- }];
1515
- params.selected = false;
1516
- params.editstatus = false;
1517
- setswitchRefresh(false);
1518
- setTimeout(() => {
1519
- setswitchRefresh(true);
1520
- });
1521
- }
1522
-
1523
- function getDosageTiming(params, val, fullitem) {
1524
- var usagename = val.usagename != undefined ? val.usagename : val.displayvalue;
1525
- params.editstatus = true;
1526
- params.dosage = [val];
1527
- params.usagename = val.displayvalue;
1528
- params.dosage[0].usagename = usagename;
1529
- setswitchRefresh(false);
1530
- setTimeout(() => {
1531
- setswitchRefresh(true);
1532
- });
1533
- }
1534
-
1535
- function AddNewDosage(params, val, fullitem) {
1536
- params.editstatus = true;
1537
- params.dosage = [{
1538
- ...val,
1539
- 'specifictime': params.specifictime,
1540
- }];
1541
- params.usagename = val.displayvalue;
1542
- setswitchRefresh(false);
1543
- setTimeout(() => {
1544
- setswitchRefresh(true);
1545
- });
1546
- }
1547
-
1548
- function getPopupContainerStyle() {
1549
- return {
1550
- position: 'absolute',
1551
- bottom: 0,
1552
- top: Dimensions.get('screen').height * 0.17,
1553
- width: Dimensions.get('screen').width,
1554
- borderRadius: 20,
1555
- borderWidth: 2,
1556
- borderColor: '#e0e0e0',
1557
- paddingHorizontal: normalize(5),
1558
- };
1559
- }
1560
- }
1561
-
1562
- const layoutstyles = StyleSheet.create({
1563
- lefticon_container: {
1564
- marginLeft: '2%',
1565
- },
1566
- textinput_view: {
1567
- flex: 1,
1568
- paddingLeft: '1%',
1569
- },
1570
- overlay_screen_listview_container: {
1571
- justifyContent: 'center',
1572
- marginBottom: 10,
1573
- },
1574
- overlay_searchTextbox_View: {
1575
- width: '96%',
1576
-
1577
- },
1578
- overlay_screen_heading_text: {
1579
- ...ComponentStyles.popup_heading,
1580
- width: '100%',
1581
- },
1582
- overlay_screen_container: {
1583
- width: '100%',
1584
- },
1585
- });