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

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 (178) hide show
  1. package/index.d.ts +66 -0
  2. package/index.js +3 -7
  3. package/package.json +3 -2
  4. package/src/Alerts/AAlert.js +4 -4
  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/RecordAudio.js +1 -1
  127. package/src/Media/VideoScreen.js +2 -7
  128. package/src/Navigation/PageNavigation.js +224 -0
  129. package/src/Navigation/useFocusEffect.js +2 -0
  130. package/src/Navigation/useFocusEffect.native.js +1 -0
  131. package/src/Navigation/useFocusEffect.web.js +1 -0
  132. package/src/Navigation/useIsFocused.js +1 -0
  133. package/src/Navigation/useIsFocused.native.js +1 -0
  134. package/src/Navigation/useIsFocused.web.js +1 -0
  135. package/src/Navigation/useNavigation.js +2 -0
  136. package/src/Navigation/useNavigation.native.js +1 -0
  137. package/src/Navigation/useNavigation.web.js +1 -0
  138. package/src/Screens/CMedications.js +528 -0
  139. package/src/Screens/CWebViewGallery.js +203 -0
  140. package/src/Screens/ChartScan.js +279 -0
  141. package/src/Screens/ChartScreenNew.js +1579 -0
  142. package/src/Screens/Consultation.js +1500 -0
  143. package/src/Screens/Dashboard.js +778 -0
  144. package/src/Screens/FileExplorer.js +288 -0
  145. package/src/Screens/Footer.js +340 -0
  146. package/src/Screens/ForgotPassword.js +288 -0
  147. package/src/Screens/HeaderBlock.js +353 -0
  148. package/src/Screens/Login.js +328 -0
  149. package/src/Screens/Notification.js +149 -0
  150. package/src/Screens/OcrScreen.js +20 -0
  151. package/src/Screens/PdfPreview.js +507 -0
  152. package/src/Screens/RegistrationDetails.js +467 -0
  153. package/src/Screens/SearchScreen.js +582 -0
  154. package/src/Screens/Splash.js +788 -0
  155. package/src/Screens/SwipeLeftView.js +1867 -0
  156. package/src/StaticComponents/SDatePickerLabel.js +1 -1
  157. package/src/StaticComponents/SDatePickerNew.js +1 -1
  158. package/src/StaticComponents/SDateTimePickerNew.js +2 -2
  159. package/src/StaticComponents/SDropDownGenerate.js +3 -3
  160. package/src/StaticComponents/SDropDownHoc.js +4 -4
  161. package/src/StaticComponents/SDropDownIcon.js +1 -1
  162. package/src/StaticComponents/SMenuBox.js +2 -2
  163. package/src/StaticComponents/SSearch.js +2 -2
  164. package/src/StaticComponents/STextInput.js +1 -1
  165. package/src/StaticComponents/STimePicker.js +1 -1
  166. package/src/StaticComponents/STimingDropDownNew.js +2 -6
  167. package/src/StaticComponents/STimingSwitch.js +1 -1
  168. package/src/layout/CContainerView.js +1 -1
  169. package/src/layout/CDetailView.js +3 -3
  170. package/src/layout/HeaderBlock.js +5 -5
  171. package/src/layout/INVLoginLayout.js +3 -4
  172. package/src/layout/Loader.js +2 -2
  173. package/src/HOC/HAbsolute.js +0 -56
  174. package/src/HOC/HDiscontinue.js +0 -105
  175. package/src/HOC/HOverlay.js +0 -99
  176. package/src/layout/FooterBlock.js +0 -821
  177. /package/src/{common → Common}/ErrorBoundary.tsx +0 -0
  178. /package/src/{common → Common}/Icons.js +0 -0
@@ -0,0 +1,1000 @@
1
+ import React, { useState, useEffect, useContext, memo } from 'react';
2
+ import { Text, View, StyleSheet, TouchableOpacity, TextInput, ScrollView, ActivityIndicator, Dimensions } from 'react-native';
3
+ import { colors } from '../CommonStyle/commonStyle';
4
+ import ComponentStyles, { normalize } from '../CommonStyle/componentStyle';
5
+ import popupStyles, { getPopupHeadingOptionText, getPopupTextAreaContainer, getPopupTextAreaChildContainer, getPopupTextAreaStyle } from '../CommonStyle/PopupStyle';
6
+ import CMultiSelect from './CMultiSelect';
7
+ import { APIURL } from '../../../../../src/Common/apiConstants';
8
+ import Entypo from 'react-native-vector-icons/Entypo';
9
+ import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
10
+ import { Global } from '../../../../../src/Common/Global';
11
+ import { getLoading, isBNUL, isNU, isNUQ, notifyMessage, ValueCheck } from '../CommonStyle/ComponentFunctions';
12
+ import { Icons } from '@jescon-technologies/react-native-ui-kit';;
13
+ import CAwesomeButton from './CAwesomeButton';
14
+ import Loader from '../Custom/Loader';
15
+ import STimingSwitch from '../StaticComponents/STimingSwitch';
16
+ import EmrResponseComponentContext from '../Handlers/emrResponseComponentContext';
17
+ import HOCIcons from '../HOC/HOCIcons';
18
+
19
+ function CNotesInstructions(props) {
20
+
21
+ const { responseJSON, setResponseJSON } = useContext(EmrResponseComponentContext);
22
+ const [displayText, setDisplayText] = useState(true);
23
+ const { width, height } = Dimensions.get('window');
24
+ const [data, setData] = useState(props.data);
25
+
26
+ const [isShow, setIsShow] = useState(false);
27
+ const [additionalNote, setAdditionalNote] = useState();
28
+ const [isMsgShow, setIsMsgShow] = useState(false);
29
+ const [msg, setMsg] = useState();
30
+ const [stage, setStage] = useState(2); // FAV
31
+ const [displayData, setDisplayData] = useState([]);
32
+ const [isLoading, setIsLoading] = useState(false);
33
+ const [refresh, setRefresh] = useState(0);
34
+ const [checked, setChecked] = useState(false);
35
+ const [editStatus, setEditStatus] = useState(false);
36
+
37
+ const defaultdata = {
38
+ editstatus: false,
39
+ editmode: false,
40
+ favorite: false,
41
+ savetext: '',
42
+ savecode: 0,
43
+ temptext: '',
44
+ deletestatus: false,
45
+ };
46
+
47
+ const [createMode, setCreateMode] = useState(defaultdata);
48
+
49
+ useEffect(() => {
50
+ NotesInstructionRetrieve();
51
+ }, []);
52
+
53
+
54
+ // useEffect(() => {
55
+ // setData(props.data)
56
+ // if (props.primarydata && props.primarydata.datavalue != 0 && props.primarydata.displayvalue != null) {
57
+ // setStage(3)
58
+ // setAdditionalNote(props.primarydata.displayvalue)
59
+ // }
60
+ // else {
61
+ // setStage(2);
62
+ // }
63
+ // if (props.data.key == 2) {
64
+ // setStage(3)
65
+ // }
66
+ // else {
67
+ // NotesInstructionRetrieve()
68
+ // }
69
+ // }, []);
70
+
71
+ function removeSelected() {
72
+ if (data.name == 'Notes') {
73
+ var temp = data.NotesArray;
74
+ var indexX = temp.findIndex(sitem => sitem.datavalue === props.primarydata.datavalue);
75
+ temp.splice(indexX, 1);
76
+ setData({ ...data, ['NotesArray']: temp });
77
+ }
78
+ else if (data.name == 'Instructions') {
79
+ var temp = data.InstructionsArray;
80
+ var indexX = temp.findIndex(sitem => sitem.datavalue === props.primarydata.datavalue);
81
+ temp.splice(indexX, 1);
82
+ setData({ ...data, ['InstructionsArray']: temp });
83
+ }
84
+ }
85
+
86
+ function NotesInstructionRetrieve() {
87
+
88
+ setStage(2);
89
+ setIsLoading(true);
90
+ let nature = "'" + data.nature + "'" + ',' + Global.userData.suuser;
91
+
92
+ let api = props.data.buttonapi != undefined ? props.data.buttonapi : props.selectionapi;
93
+
94
+ console.log('api........',props.data.buttonapi);
95
+
96
+ const splitArray = api.split(',');
97
+
98
+ splitArray.push(nature);
99
+
100
+ let savebuttonapi = splitArray.join();
101
+
102
+ let buttonapi = props.data.name == 'Notes' || props.data.name == 'Instructions' ? savebuttonapi : props.data.buttonapi;
103
+
104
+ var tempString = [];
105
+
106
+ let saveapi;
107
+
108
+ if (props.data.name == 'Notes' || props.data.name == 'Instructions') {
109
+
110
+ props.data.name == 'Notes' ?
111
+ isBNUL(data.NotesArray) ? data.NotesArray.map((item, i) => {
112
+ tempString.push(item.datavalue);
113
+ }) : null
114
+ : props.data.name == 'Instructions' ?
115
+ isBNUL(data.InstructionsArray) ? data.InstructionsArray.map((item, i) => {
116
+ tempString.push(item.datavalue);
117
+ }) : null
118
+ : null;
119
+
120
+ // var ValueString = tempString.length > 0 ? tempString.toString() : '0';
121
+ var ValueString = '0';
122
+
123
+ const splitApi = buttonapi.split(',');
124
+
125
+ splitApi[1] = "'" + ValueString + "'";
126
+
127
+ saveapi = splitApi.join();
128
+
129
+ }
130
+ else {
131
+ props.data.name == 'Infection Control' ?
132
+ isBNUL(data.infectioncontrol) ? data.infectioncontrol.map((data, i) => {
133
+ tempString.push(data.datavalue);
134
+ })
135
+ : null
136
+ : null;
137
+ // var ValueString = tempString.length > 0 ? tempString.toString() : '0';
138
+ var ValueString = '0';
139
+ saveapi = buttonapi + " '" + ValueString + "'";
140
+ }
141
+ setDisplayData([]);
142
+ console.log('NotesInstructionRetrieve.....................', JSON.stringify(APIURL + saveapi));
143
+
144
+ NetworkServiceCall('get', APIURL + saveapi, '').then(function (response) {
145
+ if (response.httpstatus == 200) {
146
+ setDisplayData(response.data.data);
147
+ setDisplayText(true);
148
+ setIsLoading(false);
149
+
150
+ } else {
151
+ setDisplayData(null);
152
+ setDisplayText(false);
153
+ setIsLoading(false);
154
+
155
+ }
156
+ });
157
+
158
+ getLoading(v => setIsLoading(false));
159
+
160
+ }
161
+
162
+ function getArray(params) {
163
+ // console.log("PARAMSSSSSSSSSSSSSS JSONNNNNNNNNNNNN",JSON.stringify(params))
164
+ switch (params.name) {
165
+ case 'Notes': return params.NotesArray != undefined ? params.NotesArray : [];
166
+ case 'Instructions': return params.InstructionsArray != undefined ? params.InstructionsArray : [];
167
+ }
168
+ }
169
+
170
+ function RetrieveAll() {
171
+
172
+ setStage(4);
173
+ setIsLoading(true);
174
+ let nature = "'" + data.nature + "'" + ',' + Global.userData.suuser;
175
+
176
+ let api = data.buttonapi != undefined ? data.buttonapi : props.selectionapi;
177
+ console.log('apiiiiiiiiiiiiiiii', JSON.stringify(api));
178
+
179
+ const splitArray = api.split(',');
180
+ splitArray.push(nature);
181
+ let savebuttonapi = splitArray.join();
182
+ console.log('RetrieveAll..............', JSON.stringify(APIURL + savebuttonapi));
183
+ setDisplayData([]);
184
+
185
+ NetworkServiceCall('get', APIURL + savebuttonapi, '')
186
+ .then(function (response) {
187
+ if (response.httpstatus == 200
188
+ && response.data != undefined
189
+ && response.data.data != undefined
190
+ && response.data.data.length > 0) {
191
+
192
+ // if (ValueCheck(props.data) && props.data.length > 0) {
193
+ // var results = response.data.data.map((item) => {
194
+ // getArray(props.data).map((xxx) => {
195
+ // if (item.datavalue == xxx.datavalue) {
196
+ // item.selected = true
197
+ // }
198
+ // })
199
+ // })
200
+ // }
201
+
202
+ setDisplayData(response.data.data);
203
+ setDisplayText(false);
204
+ setIsLoading(false);
205
+
206
+ } else {
207
+ setDisplayData(null);
208
+ setDisplayText(true);
209
+ setIsLoading(false);
210
+ }
211
+ });
212
+
213
+ getLoading(v => setIsLoading(false));
214
+
215
+ }
216
+
217
+ function saveInfectionControl() {
218
+ var tempString = [];
219
+ data.infectioncontrol &&
220
+ data.infectioncontrol != null &&
221
+ data.infectioncontrol != undefined &&
222
+ data.infectioncontrol.length > 0
223
+ ? data.infectioncontrol.map((data, i) => {
224
+ tempString.push(data.datavalue);
225
+ })
226
+ : null;
227
+ var ValueString = tempString.length > 0 ? tempString.toString() : '0';
228
+ // if (ValueString != null && ValueString != undefined) {
229
+ setIsLoading(true);
230
+ let buttonapi =
231
+ 'emrinstructions/updateinfectioncontrol/' +
232
+ data.homrpatientchart +
233
+ '/' +
234
+ ValueString;
235
+ NetworkServiceCall('get', APIURL + buttonapi, '').then(function (
236
+ response,
237
+ ) {
238
+ if (response.httpstatus == 200) {
239
+ props.visibility(false);
240
+ notifyMessage('Data Saved!!!', 1);
241
+ setIsLoading(false);
242
+ } else {
243
+ props.visibility(false);
244
+ setIsLoading(false);
245
+ //alert("Request Failed!")
246
+ notifyMessage('Data Not Saved!!!', 2);
247
+ }
248
+ });
249
+
250
+ getLoading(v => setIsLoading(false));
251
+ // }
252
+ }
253
+
254
+ function saveData(deletestatus) {
255
+
256
+ if (isNUQ(createMode.savetext)) {
257
+
258
+ let url = APIURL + 'commontemplatesave/RnCommonTemplateSave';
259
+
260
+ let dataset1 = {
261
+ groups: {
262
+ hosumrclassificationnature: props.arguments,
263
+ notesinstruction: createMode.savetext,
264
+ nature: createMode.favorite ? 'G' : data.nature,
265
+ editstatus: deletestatus ? 3 : createMode.editmode ? 2 : 1, // 1 insertion, 2 - updation , 3 - deletion
266
+ datavalue: createMode.editmode ? createMode.savecode : 0,
267
+ noteorinstruction: data.name == 'Notes' ? 1 : 2,
268
+ suuser: Global.userData.suuser,
269
+ // editstatus: editStatus ? 1 : 0,
270
+ },
271
+ };
272
+
273
+ let dataset2 = {
274
+ infectioncontroldetail: {
275
+ code: 0,
276
+ suavailability: 1,
277
+ infectioncontrol: createMode.savetext,
278
+ informationmode: 11111,
279
+ communicationmode: 11111,
280
+ remarks: 'Infection Control Added',
281
+ flag: 1,
282
+ suuser: Global.userData.suuser,
283
+ },
284
+ };
285
+
286
+ var params = data.name == 'Notes' || data.name == 'Instructions' ? dataset1 : dataset2;
287
+
288
+ setIsLoading(true);
289
+ params.groups.procedurename = data.name == 'Notes' ? 'hosumrnotes1' : 'hosumrinstruction1';
290
+
291
+ console.log('saveData', JSON.stringify(params, null, 2));
292
+ console.log('url...............', url);
293
+
294
+ NetworkServiceCall('post', url, params).then(function (response) {
295
+ if (response.httpstatus == 200) {
296
+
297
+ if (createMode.favorite) { // favourite turned on
298
+ setStage(2); // FAV Screen
299
+ NotesInstructionRetrieve();
300
+ }
301
+ else {
302
+ setStage(4); // ALL Screen
303
+ RetrieveAll();
304
+ }
305
+
306
+ } else {
307
+
308
+ setIsLoading(false);
309
+ setIsMsgShow(true);
310
+ setMsg(response.data.alertdata.alertMessage);
311
+ setTimeout(() => {
312
+ setIsMsgShow(false);
313
+ }, 2000);
314
+
315
+ }
316
+ });
317
+ getLoading(v => setIsLoading(false));
318
+
319
+ } else {
320
+
321
+ setIsMsgShow(true);
322
+ setMsg('Null cannot be save...Please type');
323
+ setTimeout(() => {
324
+ setIsMsgShow(false);
325
+ }, 2000);
326
+ }
327
+ Global.EditStatus = 1;
328
+ responseJSON.consultationEdit.editStatus = true;
329
+ }
330
+
331
+ function deSelectItem(item) {
332
+
333
+ console.log('>>>>>>>>>>>>>>>>>>>>>>>>>INS', JSON.stringify(displayData));
334
+
335
+ Global.EditStatus = 1;
336
+ responseJSON.consultationEdit.editStatus = true;
337
+ // props.IconColour(true);
338
+ var tempString = [];
339
+ var ValueString = '';
340
+ if (data.name == 'Notes') {
341
+ var temp = data.NotesArray;
342
+ var indexX = temp.findIndex(sitem => sitem.datavalue === item.datavalue);
343
+ temp.splice(indexX, 1);
344
+ setData({ ...data, ['NotesArray']: temp });
345
+ var tempArray = ValueCheck(displayData) ? displayData : [];
346
+ var indexXX = tempArray.findIndex(
347
+ sitem => sitem.datavalue === item.datavalue,
348
+ );
349
+ indexXX != -1 ? (tempArray[indexXX].selected = false) : null;
350
+ setDisplayData(tempArray);
351
+ data.NotesArray &&
352
+ data.NotesArray.map((data, i) => {
353
+ tempString.push(data.datavalue);
354
+ var str = tempString.join();
355
+ ValueString = str.toString();
356
+ });
357
+ data.value = ValueString;
358
+ setData({ ...data, ['value']: ValueString });
359
+ } else if (data.name == 'Instructions') {
360
+ var temp = data.InstructionsArray;
361
+ var indexX = temp.findIndex(sitem => sitem.datavalue === item.datavalue);
362
+ temp.splice(indexX, 1);
363
+ setData({ ...data, ['InstructionsArray']: temp });
364
+ var tempArray = ValueCheck(displayData) ? displayData : [];
365
+ var indexXX = tempArray.findIndex(
366
+ sitem => sitem.datavalue === item.datavalue,
367
+ );
368
+ indexXX != -1 ? (tempArray[indexXX].selected = false) : null;
369
+ setDisplayData(tempArray);
370
+ data.InstructionsArray &&
371
+ data.InstructionsArray.map((data, i) => {
372
+ tempString.push(data.datavalue);
373
+ var str = tempString.join();
374
+ ValueString = str.toString();
375
+ });
376
+ data.value = ValueString;
377
+ setData({ ...data, ['value']: ValueString });
378
+ } else {
379
+ var temp = data.infectioncontrol;
380
+ var indexX = temp.findIndex(sitem => sitem.datavalue === item.datavalue);
381
+ temp.splice(indexX, 1);
382
+ setData({ ...data, ['infectioncontrol']: temp });
383
+ var tempArray = ValueCheck(displayData) ? displayData : [];
384
+ if (tempArray != null && tempArray != undefined) {
385
+ var indexXX = tempArray.findIndex(
386
+ sitem => sitem.datavalue === item.datavalue,
387
+ );
388
+ indexXX != -1 ? (tempArray[indexXX].selected = false) : null;
389
+ setDisplayData(tempArray);
390
+ }
391
+ data.infectioncontrol &&
392
+ data.infectioncontrol.map((data, i) => {
393
+ tempString.push(data.datavalue);
394
+ var str = tempString.join();
395
+ ValueString = str.toString();
396
+ });
397
+ data.value = ValueString;
398
+ setData({ ...data, ['value']: ValueString });
399
+ }
400
+ }
401
+
402
+ function getcontainerStyle() {
403
+ return {
404
+ ...layoutstyles.component_container,
405
+ borderWidth: 0,
406
+ paddingTop: height * 0.005,
407
+ paddingBottom: height * 0.005,
408
+ };
409
+ }
410
+
411
+ function ForIConColor(val) {
412
+ props.IconColour(true);
413
+ }
414
+
415
+ function displaySelectedItems(data) {
416
+ //TO display Selected Items
417
+ let displaydata =
418
+ data.NotesArray && data.NotesArray.length > 0
419
+ ? data.NotesArray
420
+ : data.InstructionsArray &&
421
+ data.InstructionsArray.length > 0
422
+ ? data.InstructionsArray
423
+ : data.infectioncontrol;
424
+ // let displaydata = data.InstructionsArray
425
+ return (
426
+ <View style={{}}>
427
+ <View style={layoutstyles.display_selectedItems_container}>
428
+ {
429
+ // data.NotesArray && data.NotesArray.map((block, i) => {
430
+ displaydata &&
431
+ displaydata.map((block, i) => {
432
+ // if(block.displayvalue != null && block.displayvalue != undefined){
433
+ return (
434
+ <View key={i}>
435
+ <View style={{ width: '90%', flexDirection: 'row' }}>
436
+
437
+ <View style={{
438
+ borderWidth: 0.5, width: Dimensions.get('screen').width - normalize(44), marginBottom: normalize(5), borderRadius: normalize(7),
439
+ paddingHorizontal: normalize(0), flexDirection: 'row', alignItems: 'center',
440
+ }}>
441
+
442
+ <Icons.FontAwesome5
443
+ name="dot-circle"
444
+ color={Global.AppTheme.primary_color}
445
+ size={normalize(15)}
446
+ style={{ paddingHorizontal: normalize(5) }}
447
+ />
448
+
449
+ <Text style={{ textAlign: 'left', width: '90%' }}>
450
+ {block.displayvalue}
451
+ </Text>
452
+ </View>
453
+
454
+ <View style={layoutstyles.display_selectedItems_view}>
455
+ <TouchableOpacity
456
+ style={layoutstyles.close_Image_View}
457
+ onPress={() => deSelectItem(block)}>
458
+ <View style={layoutstyles.close_Image}>
459
+ <Icons.Entypo
460
+ name="trash"
461
+ color="red"
462
+ size={normalize(15)}
463
+ />
464
+ </View>
465
+ </TouchableOpacity>
466
+ </View>
467
+ </View>
468
+ </View>
469
+ );
470
+ // }
471
+ })
472
+ }
473
+ </View>
474
+ </View>
475
+ );
476
+ }
477
+
478
+
479
+
480
+ function getAllTabFunctions(key) {
481
+ switch (key) {
482
+ case 'CNI01':
483
+ saveData(false);
484
+ break;
485
+ case 'CNI02':
486
+
487
+ // setAdditionalNote('');
488
+ setCreateMode(prevstate => {
489
+ const updatejson = {
490
+ ...prevstate,
491
+ savetext: '',
492
+ };
493
+ return updatejson;
494
+ });
495
+ break;
496
+ case 'CNI03':
497
+ saveData(true);
498
+ break;
499
+ }
500
+ }
501
+
502
+ function MainOnPress(item) {
503
+
504
+ if (item.stage == 2) {
505
+ NotesInstructionRetrieve();
506
+ }
507
+ else if (item.stage == 4) {
508
+ RetrieveAll();
509
+ }
510
+ else if (item.stage == 3) {
511
+ setCreateMode(defaultdata);
512
+ setStage(3);
513
+ }
514
+ }
515
+
516
+ return (
517
+ <View style={{ flex: 1, width: '100%', borderWidth: 0 }}>
518
+ <Text style={{ alignSelf: 'center', fontSize: normalize(12), fontWeight: 'bold', marginBottom: normalize(2), color: Global.AppTheme.primary_color }}>
519
+ {ValueCheck(responseJSON) &&
520
+ ValueCheck(responseJSON.consultationEdit) &&
521
+ ValueCheck(responseJSON.consultationEdit.heading) ?
522
+ responseJSON.consultationEdit.heading : ''}
523
+ {' '}
524
+ {ValueCheck(data) && ValueCheck(data.name) ? data.name.toUpperCase() : data.name}
525
+ </Text>
526
+ <View
527
+ style={{
528
+ width: '100%',
529
+ borderRadius: 5,
530
+ height: normalize(45),
531
+ flexDirection: 'row',
532
+ alignItems: 'center',
533
+ justifyContent: 'space-evenly',
534
+ marginVertical: normalize(5),
535
+ }}>
536
+ {[{
537
+ 'display': 'FAV',
538
+ 'stage': 2,
539
+ 'color': '#eaf2ff',
540
+ 'iconname': 'heart',
541
+ 'shadowcolor': '#fff',
542
+ },
543
+ {
544
+ 'display': ValueCheck(data) && ValueCheck(data.name) ? data.name.toUpperCase() : data.name,
545
+ 'stage': 4,
546
+ 'color': '#eaf2ff',
547
+ 'iconname': 'menu',
548
+ 'shadowcolor': '#fff',
549
+ },
550
+ {
551
+ 'display': 'CREATE',
552
+ 'stage': 3,
553
+ 'color': '#eaf2ff',
554
+ 'iconname': 'add-to-list',
555
+ 'shadowcolor': '#fff',
556
+ },
557
+ ].map((item, i) => {
558
+ return (
559
+ <TouchableOpacity
560
+ key={i}
561
+ onPress={() => {
562
+ MainOnPress(item);
563
+ }}
564
+ style={{
565
+ borderRadius: 7,
566
+ borderWidth: 1,
567
+ height: normalize(40),
568
+ width: normalize(55),
569
+ backgroundColor: stage == item.stage ? item.color : '#fff',
570
+ borderColor: stage == item.stage ? '#eaf2ff' : Global.AppTheme.primary_color,
571
+ alignItems: 'center',
572
+ justifyContent: 'center',
573
+ padding: 0,
574
+ elevation: 2,
575
+ shadowColor: '#000',
576
+ shadowOffset: { width: 0, height: 2 },
577
+ shadowOpacity: 0.1,
578
+ shadowRadius: 2,
579
+ }}
580
+ >
581
+ <View style={{
582
+ flex: 1,
583
+ alignItems: 'center',
584
+ justifyContent: 'center',
585
+ }}>
586
+ <Icons.Entypo
587
+ name={item.iconname}
588
+ style={{ paddingRight: 0 }}
589
+ color={Global.AppTheme.primary_color}
590
+ size={normalize(20)}
591
+ />
592
+ <Text adjustsFontSizeToFit numberOfLines={1} style={{
593
+ color: Global.AppTheme.primary_color,
594
+ fontSize: normalize(10),
595
+ fontWeight: stage == item.stage ? 'bold' : 'normal',
596
+ textAlign: 'center',
597
+ }}>
598
+ {item.display}
599
+ </Text>
600
+ </View>
601
+ </TouchableOpacity>
602
+ );
603
+ })}
604
+ </View>
605
+
606
+ <View style={{ flex: 1, borderWidth: 0 }}>
607
+ {stage == 2 ? ( // FAV
608
+
609
+ <View style={{ flex: 1, borderWidth: 0 }}>
610
+ {isBNUL(displayData) ?
611
+ <CMultiSelect
612
+ component={data}
613
+ searchableData={displayData}
614
+ singlecallBack={(i, items) => {
615
+ setDisplayData(prevstate => {
616
+ const updatejson = [...prevstate];
617
+
618
+ const findindex = updatejson.findIndex(item => item.datavalue === items.datavalue);
619
+
620
+ updatejson[findindex] = {
621
+ ...updatejson[findindex],
622
+ selected: !updatejson[findindex].selected,
623
+ };
624
+ return updatejson;
625
+ });
626
+ }}
627
+ selectCallBack={(val) => {
628
+ props.notesSelectCallBack(displayData);
629
+ props.visibility(false);
630
+ }}
631
+ editCallBack={(val) => {
632
+
633
+ let prevcodearray = displayData.filter((i, k) => { return i.selected ? { ...i } : undefined; });
634
+ let prevcode = isBNUL(prevcodearray) ? prevcodearray[0] : null;
635
+
636
+ setCreateMode(prevstate => {
637
+ const updatejson = {
638
+ ...prevstate,
639
+ editmode: true,
640
+ editstatus: false,
641
+ favorite: stage == 2 ? true : false,
642
+ savetext: isNU(prevcode) ? prevcode.displayvalue : '',
643
+ savecode: isNU(prevcode) ? prevcode.datavalue : '',
644
+ temptext: isNU(prevcode) ? prevcode.displayvalue : '',
645
+ };
646
+ return updatejson;
647
+ });
648
+ setStage(3);
649
+ }}
650
+ />
651
+ : null}
652
+ </View>
653
+
654
+ ) : stage == 3 ? ( // CREATE
655
+
656
+ <View style={{ flex: 1 }}>
657
+ <ScrollView keyboardShouldPersistTaps="handled">
658
+ <View style={{}}>
659
+ {/* <ScrollView
660
+ keyboardShouldPersistTaps="handled"
661
+ style={{ flex: 1 }}
662
+ contentContainerStyle={{
663
+ alignItems: 'center',
664
+ justifyContent: 'center',
665
+ }}>
666
+ {(
667
+ data.NotesArray &&
668
+ data.NotesArray != null &&
669
+ data.NotesArray != undefined
670
+ ) ||
671
+ (
672
+ data.InstructionsArray &&
673
+ data.InstructionsArray != null &&
674
+ data.InstructionsArray != undefined
675
+ ) ||
676
+ (
677
+ data.infectioncontrol &&
678
+ data.infectioncontrol != null &&
679
+ data.infectioncontrol != undefined
680
+ ) ? (
681
+ displaySelectedItems(props.data)
682
+ ) : (
683
+ <View style={{ paddingTop: 50 }}>
684
+ <Text style={[ComponentStyles.no_data_found_text]}>
685
+ No data..Please Add {data.name}{' '}
686
+ </Text>
687
+ </View>
688
+ )}
689
+ </ScrollView> */}
690
+
691
+ <View
692
+ style={{
693
+ position: 'absolute',
694
+ bottom: normalize(-5),
695
+ width: '100%',
696
+ justifyContent: 'center',
697
+ alignItems: 'center',
698
+ }}>
699
+ {props.data.name == 'Infection Control' ? (
700
+ <TouchableOpacity style={{
701
+ justifyContent: 'center',
702
+ borderRadius: 10,
703
+ alignItems: 'center',
704
+ paddingHorizontal: normalize(10),
705
+ }}
706
+ onPress={() => saveInfectionControl()}
707
+ >
708
+ <View style={{
709
+ flexDirection: 'column',
710
+ backgroundColor: '#f7f4f4',
711
+ borderRadius: 10,
712
+ paddingHorizontal: normalize(5),
713
+ paddingVertical: normalize(0),
714
+ alignItems: 'center',
715
+ }}>
716
+ <Entypo
717
+ name="save"
718
+ color={Global.AppTheme.primary_color}
719
+ size={normalize(20)}
720
+ />
721
+ <Text
722
+ style={{
723
+ fontSize: normalize(11),
724
+ color: Global.AppTheme.primary_color,
725
+ fontWeight: 'bold',
726
+ }}>
727
+ {' '}
728
+ {'Save'}
729
+ </Text>
730
+ </View>
731
+ </TouchableOpacity>
732
+ ) : null}
733
+ </View>
734
+ </View>
735
+
736
+ <View style={{ flex: 1, alignSelf: 'center' }}>
737
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', borderWidth: 0 }}>
738
+ <Text style={{ fontWeight: '300', fontSize: normalize(12), color: 'black', borderWidth: 0, flex: 1 }}>
739
+ {createMode.editmode ? 'Edit' : 'Create'}
740
+ {' '}
741
+ {ValueCheck(data) && ValueCheck(data.name) ? data.name.slice(0, -1) : null}
742
+ {' '}
743
+ {createMode.editmode && isNUQ(createMode.temptext) ?
744
+ <Text style={{ fontWeight: '400' }}>
745
+ {' - '}{createMode.temptext}
746
+ </Text>
747
+ : null}
748
+ </Text>
749
+ <View style={{ flexDirection: 'row', alignSelf: 'flex-start' }}>
750
+ {data.name == 'Notes' || data.name == 'Instructions' ? (
751
+ <TouchableOpacity
752
+ onPress={() => {
753
+ setCreateMode(prevstate => {
754
+ const updatejson = {
755
+ ...prevstate,
756
+ favorite: !prevstate.favorite,
757
+ editstatus: true,
758
+ };
759
+ return updatejson;
760
+ });
761
+ }}
762
+ style={{
763
+ width: normalize(40),
764
+ justifyContent: 'center',
765
+ alignItems: 'center',
766
+ }}>
767
+ <HOCIcons.Fontisto
768
+ name={createMode.favorite ? 'toggle-on' : 'toggle-off'}
769
+ size={normalize(30)}
770
+ color={createMode.favorite ? 'green' : '#646464'}
771
+ // style={{ textAlign: 'center', borderWidth: 0, }}
772
+ />
773
+ <Text numberOfLines={1} adjustsFontSizeToFit style={{ bottom: normalize(-3), position: 'absolute', color: Global.AppTheme.primary_color, fontSize: normalize(9), textAlign: 'center', fontWeight: 'bold' }}>Favourite</Text>
774
+ </TouchableOpacity>
775
+ ) : null}
776
+ </View>
777
+ </View>
778
+
779
+ {isLoading ? null : (
780
+ isMsgShow ?
781
+ <Text style={ComponentStyles.errorMsgText}>
782
+ {msg}
783
+ </Text> : null
784
+ )}
785
+ <View
786
+ style={{
787
+ flexDirection: 'row',
788
+ borderWidth: 0.7,
789
+ borderColor: 'black',
790
+ width: '90%',
791
+ justifyContent: 'flex-start',
792
+ alignItems: 'center',
793
+ borderRadius: 7,
794
+ marginBottom: height * 0.003,
795
+ height: height * 0.30,
796
+ backgroundColor: '#fff',
797
+ marginTop: normalize(5),
798
+ }}>
799
+ <TextInput
800
+ placeholder={'Type Here'}
801
+ keyboardType={'default'}
802
+ multiline={true}
803
+ numberOfLines={5}
804
+ placeholderTextColor={'lightgray'}
805
+ onChangeText={changevalue =>
806
+
807
+ setCreateMode(prevstate => {
808
+ const updatejson = {
809
+ ...prevstate,
810
+ editstatus: true,
811
+ savetext: changevalue,
812
+ };
813
+ return updatejson;
814
+ })
815
+ }
816
+ value={createMode.savetext}
817
+ style={getPopupTextAreaStyle(width, height)}
818
+ />
819
+ </View>
820
+ </View>
821
+ </ScrollView>
822
+
823
+ <View style={{ flexDirection: 'row' }}>
824
+ {[
825
+ {
826
+ 'displaytext': 'Save',
827
+ 'fontcolor': Global.AppTheme.primary_color,
828
+ 'shadowcolor': '#fff',
829
+ 'size': 10,
830
+ 'iconname': 'save',
831
+ 'iconcolor': Global.AppTheme.primary_color,
832
+ 'selected': false,
833
+ 'visibility': createMode.editstatus && isNUQ(createMode.savetext) ? true : false,
834
+ 'iconsize': 20,
835
+ 'functionid': 'CNI01',
836
+ },
837
+ {
838
+ 'displaytext': 'Delete',
839
+ 'fontcolor': 'red',
840
+ 'shadowcolor': '#fff',
841
+ 'size': 10,
842
+ 'iconname': 'trash-alt',
843
+ 'iconcolor': Global.AppTheme.primary_color,
844
+ 'selected': false,
845
+ 'visibility': createMode.editmode ? true : false,
846
+ 'iconsize': 20,
847
+ 'functionid': 'CNI03',
848
+ },
849
+ {
850
+ 'displaytext': 'Clear',
851
+ 'fontcolor': Global.AppTheme.primary_color,
852
+ 'shadowcolor': '#fff',
853
+ 'size': 10,
854
+ 'iconname': 'eraser',
855
+ 'iconcolor': Global.AppTheme.primary_color,
856
+ 'selected': false,
857
+ 'visibility': isNUQ(createMode.savetext) ? true : false,
858
+ 'iconsize': 20,
859
+ 'functionid': 'CNI02',
860
+ },
861
+ ].map((item, i) => {
862
+ return item.visibility ?
863
+ (
864
+ <View key={i} style={{ borderRadius: normalize(10), paddingLeft: normalize(10) }}>
865
+ <CAwesomeButton
866
+ data={item}
867
+ callBack={val => val == undefined ? null : getAllTabFunctions(item.functionid)}
868
+ />
869
+ </View>)
870
+ : null;
871
+ })}
872
+ </View>
873
+ </View>
874
+
875
+ ) : stage == 4 ? ( // ALL
876
+
877
+ <View style={{ borderWidth: 0, flex: 1 }}>
878
+ {isBNUL(displayData) ?
879
+ <CMultiSelect
880
+ component={data}
881
+ searchableData={displayData}
882
+ singlecallBack={(i, items) => {
883
+ setDisplayData(prevstate => {
884
+ const updatejson = [...prevstate];
885
+
886
+ const findindex = updatejson.findIndex(item => item.datavalue === items.datavalue);
887
+
888
+ updatejson[findindex] = {
889
+ ...updatejson[findindex],
890
+ selected: !updatejson[findindex].selected,
891
+ };
892
+ return updatejson;
893
+ });
894
+ }}
895
+ selectCallBack={(val) => {
896
+ props.notesSelectCallBack(displayData);
897
+ props.visibility(false);
898
+ }}
899
+ editCallBack={(val) => {
900
+
901
+ let prevcodearray = displayData.filter((i, k) => { return i.selected ? { ...i } : undefined; });
902
+ let prevcode = isBNUL(prevcodearray) ? prevcodearray[0] : null;
903
+
904
+ setCreateMode(prevstate => {
905
+ const updatejson = {
906
+ ...prevstate,
907
+ editstatus: false,
908
+ editmode: true,
909
+ favorite: stage == 2 ? true : false,
910
+ savetext: isNU(prevcode) ? prevcode.displayvalue : '',
911
+ savecode: isNU(prevcode) ? prevcode.datavalue : '',
912
+ temptext: isNU(prevcode) ? prevcode.displayvalue : '',
913
+ };
914
+ return updatejson;
915
+ });
916
+
917
+ setStage(3);
918
+ }}
919
+ />
920
+ : null}
921
+ </View>
922
+
923
+ )
924
+ : null}
925
+ </View>
926
+ {isLoading ?
927
+ <Loader displaytext={true} />
928
+ : null}
929
+ </View>
930
+ );
931
+
932
+ }
933
+ export default memo(CNotesInstructions);
934
+
935
+ const layoutstyles = StyleSheet.create({
936
+ display_selectedItems_container: {
937
+ flexDirection: 'row',
938
+ flexWrap: 'wrap',
939
+ overflow: 'hidden',
940
+ },
941
+ component_container: {
942
+ flexDirection: 'row',
943
+ borderWidth: 0.5,
944
+ borderColor: colors.color_componentBordercolor,
945
+ borderRadius: 7,
946
+ margin: 2,
947
+ marginRight: 5,
948
+ // backgroundColor:'red'
949
+ },
950
+ display_selectedItems_view: {
951
+ padding: 2,
952
+ justifyContent: 'center',
953
+ },
954
+ close_Image_View: {
955
+ width: '100%',
956
+ alignItems: 'flex-end',
957
+ },
958
+ close_Image: {
959
+ width: normalize(22),
960
+ height: normalize(22),
961
+ justifyContent: 'center',
962
+ borderRadius: 90,
963
+ borderColor: 'black',
964
+ },
965
+ display_selectedItems_Text: {
966
+ fontSize: normalize(14),
967
+ color: colors.color_componentText,
968
+ textAlign: 'justify',
969
+ },
970
+ });
971
+
972
+ {
973
+ /**
974
+ To select the Notes or Instructions
975
+ Stage 1- To Display selected items
976
+ stage 2- To list the Items
977
+ stage 3- can add a new item
978
+ {
979
+ "display": "FAV",
980
+ "stage": 2,
981
+ "color": "#eaf2ff",
982
+ "iconname": "heart",
983
+ "shadowcolor": "#fff"
984
+ },
985
+ {
986
+ "display": "ALL",
987
+ "stage": 4,
988
+ "color": "#eaf2ff",
989
+ "iconname": "menu",
990
+ "shadowcolor": "#fff"
991
+ },
992
+ {
993
+ "display": "CREATE",
994
+ "stage": 3,
995
+ "color": "#eaf2ff",
996
+ "iconname": "add-to-list",
997
+ "shadowcolor": "#fff"
998
+ }
999
+ */
1000
+ }