@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.
- package/index.d.ts +66 -0
- package/index.js +3 -7
- package/package.json +3 -2
- package/src/Alerts/AAlert.js +4 -4
- package/src/Alerts/AAlertIOS.js +3 -3
- package/src/{common → Common}/NetworkServiceCall.js +1 -1
- package/src/CommonStyle/CommonTheme.js +11 -0
- package/src/CommonStyle/ComponentFunctions.js +632 -0
- package/src/CommonStyle/PopupStyle.js +146 -0
- package/src/CommonStyle/commonStyle.js +93 -0
- package/src/CommonStyle/componentStyle.js +545 -0
- package/src/CommonStyle/optionListStyles.js +175 -0
- package/src/Components/ByProductPage.js +200 -0
- package/src/Components/CDropDownListNew.js +153 -0
- package/src/Components/CSupplierList.js +88 -0
- package/src/Components/CVerificationCard.js +2822 -0
- package/src/Components/CustomButton.js +67 -0
- package/src/Components/CustomCard.js +127 -0
- package/src/Components/CustomTextInput.js +47 -0
- package/src/Components/EquipmentPage.js +313 -0
- package/src/Components/FilterInput.Copy.js +723 -0
- package/src/Components/FilterInput.js +569 -0
- package/src/Components/HSubHeading.js +68 -0
- package/src/Components/HeaderCard.js +40 -0
- package/src/Components/MoreOptionsScreen.js +251 -0
- package/src/Components/NonSwipableProductCard.js +226 -0
- package/src/Components/NonSwipableSupplierCard.js +348 -0
- package/src/Components/ProductCard.js +1336 -0
- package/src/Components/QualityProductCard.js +1059 -0
- package/src/Components/RateProductCard.js +1452 -0
- package/src/Components/RawMaterial.js +261 -0
- package/src/Components/SDropDownEdited.js +549 -0
- package/src/Components/SDropDownNew.js +529 -0
- package/src/Components/SHelpDescription.js +147 -0
- package/src/Components/STextInputNew.js +510 -0
- package/src/Components/SearchProductCard.js +470 -0
- package/src/Components/StageByProduct.js +199 -0
- package/src/Components/SupplierCard.js +243 -0
- package/src/Components/SupplierInvoiceCard.js +405 -0
- package/src/Components/SwipableSupplierCard.js +136 -0
- package/src/Components/TagTemplate.js +74 -0
- package/src/Components/WrappedComponent.js +25 -0
- package/src/Custom/CBooking.js +944 -0
- package/src/Custom/CBookingPostpone.js +1822 -0
- package/src/Custom/CCalendar.js +560 -0
- package/src/Custom/CCard.js +880 -0
- package/src/Custom/CDetailCard.js +205 -0
- package/src/Custom/CHelpImage.js +52 -0
- package/src/Custom/CReport.js +569 -0
- package/src/Custom/CScrollView.js +73 -0
- package/src/Custom/CSignature.js +112 -0
- package/src/Custom/CSliderMenu.js +339 -0
- package/src/Custom/CSupplierCard.js +99 -0
- package/src/Custom/CTemplateCard.js +438 -0
- package/src/Custom/CTokenAllocation.js +1402 -0
- package/src/Custom/CTokenListOverlay.js +122 -0
- package/src/Custom/CWardStatus.js +444 -0
- package/src/Custom/Charts/CBarChart.js +218 -0
- package/src/Custom/Charts/CDashBoardList.js +133 -0
- package/src/Custom/Charts/CDashBoardTable.js +172 -0
- package/src/Custom/Charts/CLineChart.js +193 -0
- package/src/Custom/Charts/CPieChart.js +186 -0
- package/src/Custom/Loader.js +182 -0
- package/src/Custom/OUserView.js +1121 -0
- package/src/Custom/PreviewDosage.js +115 -0
- package/src/Custom/SearchLoader.js +32 -0
- package/src/Custom/TableComponent/CActivityTable.js +707 -0
- package/src/Custom/TableComponent/CMoreButtonTable.js +197 -0
- package/src/Custom/TableComponent/CTable.js +185 -0
- package/src/Custom/TableComponent/CTextBody.js +40 -0
- package/src/Custom/TableComponent/CTextHeader.js +17 -0
- package/src/Custom/TableComponent/PreviewPrescriptionNew.js +1011 -0
- package/src/Custom/TableComponent/SDropdownTable.js +491 -0
- package/src/Custom/TableComponent/TagTable.js +1200 -0
- package/src/CustomComponents/CAddColumn.js +140 -0
- package/src/CustomComponents/CAssessmentDelete.js +307 -0
- package/src/CustomComponents/CAwesomeButton.js +83 -0
- package/src/CustomComponents/CAwesomeMoreButton.js +54 -0
- package/src/CustomComponents/CBackHandler.js +273 -0
- package/src/CustomComponents/CCalendar.js +243 -0
- package/src/CustomComponents/CCommentOverlay.js +202 -0
- package/src/CustomComponents/CComments.js +162 -0
- package/src/CustomComponents/CContainerView.js +24 -0
- package/src/CustomComponents/CCustomTextInput.js +336 -0
- package/src/CustomComponents/CDetailView.js +40 -0
- package/src/CustomComponents/CDropDownList.js +153 -0
- package/src/CustomComponents/CDropdownSelect.js +555 -0
- package/src/CustomComponents/CFooterView.js +42 -0
- package/src/CustomComponents/CImagePickerSave.js +316 -0
- package/src/CustomComponents/CModalOverlay.js +91 -0
- package/src/CustomComponents/CNetworkStatus.js +327 -0
- package/src/CustomComponents/CNotesInstructions.js +1000 -0
- package/src/CustomComponents/COverlay.js +81 -0
- package/src/CustomComponents/CRemarks.js +176 -0
- package/src/CustomComponents/CRowAdd.js +143 -0
- package/src/CustomComponents/CSummaryDropDown.js +327 -0
- package/src/CustomComponents/CText.js +9 -0
- package/src/CustomComponents/CVectorIcon.js +34 -0
- package/src/CustomComponents/HtmlContentViewer.js +65 -0
- package/src/CustomComponents/PdfContentViewer.js +90 -0
- package/src/CustomComponents/SDropDownDosage.js +1087 -0
- package/src/CustomComponents/SwipableProductCard.js +246 -0
- package/src/CustomComponents/SwipableProductImageCard.js +254 -0
- package/src/CustomComponents/WorkOrderDetails.js +1216 -0
- package/src/CustomComponents/WorkOrderDetailsPage.js +1213 -0
- package/src/HOC/ConfirmOverlay.js +2 -2
- package/src/HOC/HMoreButton.js +1 -1
- package/src/HOC/HNatureHeading.js +1 -1
- package/src/HOC/HShadowButton.js +1 -1
- package/src/HOC/HShadowCountButton.js +1 -1
- package/src/Json/Chart.json +818 -0
- package/src/Json/Consultation.json +622 -0
- package/src/Json/CreditBill.json +490 -0
- package/src/Json/Dropdown.json +216 -0
- package/src/Json/DropdownConsultation.json +228 -0
- package/src/Json/DynamicReports.json +623 -0
- package/src/Json/Footer.json +79 -0
- package/src/Media/AudioScreen.js +2 -7
- package/src/Media/CCaptureImageWithoutEdit.js +1 -1
- package/src/Media/CImageGallery.js +2 -2
- package/src/Media/CSingleImage.js +2 -2
- package/src/Media/CVideoPlay.js +1 -1
- package/src/Media/DocumentScreen.js +2 -7
- package/src/Media/DrawingScreen.js +2 -6
- package/src/Media/ImageScreen.js +2 -6
- package/src/Media/RecordAudio.js +1 -1
- package/src/Media/VideoScreen.js +2 -7
- package/src/Navigation/PageNavigation.js +224 -0
- package/src/Navigation/useFocusEffect.js +2 -0
- package/src/Navigation/useFocusEffect.native.js +1 -0
- package/src/Navigation/useFocusEffect.web.js +1 -0
- package/src/Navigation/useIsFocused.js +1 -0
- package/src/Navigation/useIsFocused.native.js +1 -0
- package/src/Navigation/useIsFocused.web.js +1 -0
- package/src/Navigation/useNavigation.js +2 -0
- package/src/Navigation/useNavigation.native.js +1 -0
- package/src/Navigation/useNavigation.web.js +1 -0
- package/src/Screens/CMedications.js +528 -0
- package/src/Screens/CWebViewGallery.js +203 -0
- package/src/Screens/ChartScan.js +279 -0
- package/src/Screens/ChartScreenNew.js +1579 -0
- package/src/Screens/Consultation.js +1500 -0
- package/src/Screens/Dashboard.js +778 -0
- package/src/Screens/FileExplorer.js +288 -0
- package/src/Screens/Footer.js +340 -0
- package/src/Screens/ForgotPassword.js +288 -0
- package/src/Screens/HeaderBlock.js +353 -0
- package/src/Screens/Login.js +328 -0
- package/src/Screens/Notification.js +149 -0
- package/src/Screens/OcrScreen.js +20 -0
- package/src/Screens/PdfPreview.js +507 -0
- package/src/Screens/RegistrationDetails.js +467 -0
- package/src/Screens/SearchScreen.js +582 -0
- package/src/Screens/Splash.js +788 -0
- package/src/Screens/SwipeLeftView.js +1867 -0
- package/src/StaticComponents/SDatePickerLabel.js +1 -1
- package/src/StaticComponents/SDatePickerNew.js +1 -1
- package/src/StaticComponents/SDateTimePickerNew.js +2 -2
- package/src/StaticComponents/SDropDownGenerate.js +3 -3
- package/src/StaticComponents/SDropDownHoc.js +4 -4
- package/src/StaticComponents/SDropDownIcon.js +1 -1
- package/src/StaticComponents/SMenuBox.js +2 -2
- package/src/StaticComponents/SSearch.js +2 -2
- package/src/StaticComponents/STextInput.js +1 -1
- package/src/StaticComponents/STimePicker.js +1 -1
- package/src/StaticComponents/STimingDropDownNew.js +2 -6
- package/src/StaticComponents/STimingSwitch.js +1 -1
- package/src/layout/CContainerView.js +1 -1
- package/src/layout/CDetailView.js +3 -3
- package/src/layout/HeaderBlock.js +5 -5
- package/src/layout/INVLoginLayout.js +3 -4
- package/src/layout/Loader.js +2 -2
- package/src/HOC/HAbsolute.js +0 -56
- package/src/HOC/HDiscontinue.js +0 -105
- package/src/HOC/HOverlay.js +0 -99
- package/src/layout/FooterBlock.js +0 -821
- /package/src/{common → Common}/ErrorBoundary.tsx +0 -0
- /package/src/{common → Common}/Icons.js +0 -0
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
import React, { useState, useEffect, useCallback, useMemo } from 'react';
|
|
2
|
+
import { Text, View, TouchableOpacity, FlatList, StyleSheet, ActivityIndicator, TextInput, TouchableWithoutFeedback, Dimensions, } from 'react-native';
|
|
3
|
+
import { Global } from '../../../../../src/Common/Global';
|
|
4
|
+
import { normalize } from '../CommonStyle/componentStyle';
|
|
5
|
+
import SCheckBox from '../StaticComponents/SCheckBox';
|
|
6
|
+
import { debounce } from 'lodash';
|
|
7
|
+
import { SwipeRow } from 'react-native-swipe-list-view';
|
|
8
|
+
import NetworkServiceCall from '../Common/NetworkServiceCall';
|
|
9
|
+
import HOCIcons from '../HOC/HOCIcons';
|
|
10
|
+
import CCommentOverlay from '../CustomComponents/CCommentOverlay';
|
|
11
|
+
import { isBNU, isBNUL, isNU } from '../CommonStyle/ComponentFunctions';
|
|
12
|
+
import moment from 'moment';
|
|
13
|
+
import CTextHeader from '../Custom/TableComponent/CTextHeader';
|
|
14
|
+
|
|
15
|
+
const CMedications = ({ data: initialData, callback }) => {
|
|
16
|
+
|
|
17
|
+
const navigation = useNavigation();
|
|
18
|
+
const [data, setData] = useState(initialData); // Tab state
|
|
19
|
+
const [medicationData, setMedicationData] = useState([]); // Fetched data
|
|
20
|
+
const [loading, setLoading] = useState(true); // Loading state
|
|
21
|
+
const [refresh, setRefresh] = useState(0)
|
|
22
|
+
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
|
|
25
|
+
const fetchData = async () => {
|
|
26
|
+
|
|
27
|
+
setLoading(true);
|
|
28
|
+
try {
|
|
29
|
+
const buttonapi = initialData.item.profilecontent[0].prescriptionmedicationurl;
|
|
30
|
+
console.log('useeffect buttonapi', buttonapi);
|
|
31
|
+
const response = await NetworkServiceCall('get', buttonapi, '');
|
|
32
|
+
if (response.httpstatus === 200 && response.data?.medicationdata) {
|
|
33
|
+
// console.log('response', JSON.stringify(response));
|
|
34
|
+
setMedicationData(response.data.medicationdata);
|
|
35
|
+
}
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.error('Error fetching medication data:', error);
|
|
38
|
+
} finally {
|
|
39
|
+
setLoading(false);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
fetchData();
|
|
44
|
+
}, []);
|
|
45
|
+
|
|
46
|
+
const handleCheckboxChange = (checked, sectionIndex, category, itemIndex) => {
|
|
47
|
+
|
|
48
|
+
setMedicationData(prevData => {
|
|
49
|
+
const updatedData = prevData.map((section, secIndex) => {
|
|
50
|
+
if (secIndex !== sectionIndex) return section;
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
...section,
|
|
54
|
+
[category]: section[category].map((item, idx) =>
|
|
55
|
+
idx === itemIndex ? { ...item, status: checked } : item,
|
|
56
|
+
),
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Group selected items and send back via callback
|
|
61
|
+
const groupedSelectedItems = updatedData.map(section => {
|
|
62
|
+
const grouped = {};
|
|
63
|
+
Object.keys(section).forEach(cat => {
|
|
64
|
+
if (Array.isArray(section[cat])) {
|
|
65
|
+
const selectedItems = section[cat].filter(item => item.status);
|
|
66
|
+
if (selectedItems.length > 0) {
|
|
67
|
+
grouped[cat] = selectedItems;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
return grouped;
|
|
72
|
+
}).filter(group => Object.keys(group).length > 0);
|
|
73
|
+
|
|
74
|
+
callback?.({
|
|
75
|
+
'savetype': category,
|
|
76
|
+
'array': groupedSelectedItems
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
return updatedData;
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const handleRemarkChange = useMemo(() => debounce((remark, sectionIndex, category, itemIndex) => {
|
|
84
|
+
setMedicationData(prevData =>
|
|
85
|
+
prevData.map((section, secIndex) => {
|
|
86
|
+
if (secIndex !== sectionIndex) return section;
|
|
87
|
+
return {
|
|
88
|
+
...section,
|
|
89
|
+
[category]: section[category].map((item, idx) =>
|
|
90
|
+
idx === itemIndex ?
|
|
91
|
+
{
|
|
92
|
+
...item,
|
|
93
|
+
remark
|
|
94
|
+
}
|
|
95
|
+
: item,
|
|
96
|
+
),
|
|
97
|
+
};
|
|
98
|
+
}),
|
|
99
|
+
);
|
|
100
|
+
}, 500),
|
|
101
|
+
[],
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
const handleTabChange = async index => {
|
|
105
|
+
|
|
106
|
+
setLoading(true);
|
|
107
|
+
setData(prevData => {
|
|
108
|
+
const updatedata = {
|
|
109
|
+
...prevData,
|
|
110
|
+
item: {
|
|
111
|
+
...prevData.item,
|
|
112
|
+
medication: prevData.item.medication.map((val, i) => ({
|
|
113
|
+
...val,
|
|
114
|
+
selected: i === index,
|
|
115
|
+
})),
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
return updatedata
|
|
119
|
+
});
|
|
120
|
+
callback?.([]);
|
|
121
|
+
|
|
122
|
+
const buttonapi = index == 0 /* PRESCRIPTION */ ? data.item.profilecontent[0].prescriptionmedicationurl : index == 1 /* PATIENT SERVICE */ ? data.item.profilecontent[0].psmedicationurl : index == 2 /* DIET */ ? data.item.profilecontent[0].dietmedicationurl : '';
|
|
123
|
+
console.log('handleTabChange', index, buttonapi);
|
|
124
|
+
const response = await NetworkServiceCall('get', buttonapi, '');
|
|
125
|
+
if (response.httpstatus === 200 && response.data?.medicationdata) {
|
|
126
|
+
setMedicationData(response.data.medicationdata);
|
|
127
|
+
}
|
|
128
|
+
setLoading(false);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const renderEachMedication = useCallback(({ item, category, sectionIndex, itemIndex }) => (
|
|
132
|
+
|
|
133
|
+
// console.log(' prescription PatientService diet', JSON.stringify(category)),
|
|
134
|
+
|
|
135
|
+
<SwipeRow
|
|
136
|
+
key={`swipe-row-${sectionIndex}-${itemIndex}`}
|
|
137
|
+
swipeToOpenPercent={1}
|
|
138
|
+
swipeToClosePercent={1}
|
|
139
|
+
leftOpenValue={normalize(190)}
|
|
140
|
+
rightOpenValue={- normalize(100)}
|
|
141
|
+
>
|
|
142
|
+
|
|
143
|
+
{/* Swipe back (hidden) view */}
|
|
144
|
+
<View style={{
|
|
145
|
+
borderWidth: 0.5,
|
|
146
|
+
borderColor: 'lightgrey',
|
|
147
|
+
flexDirection: 'row',
|
|
148
|
+
backgroundColor: 'white',
|
|
149
|
+
justifyContent: 'space-between'
|
|
150
|
+
}}>
|
|
151
|
+
<TouchableOpacity
|
|
152
|
+
style={{
|
|
153
|
+
justifyContent: 'center',
|
|
154
|
+
alignItems: 'center',
|
|
155
|
+
height: '100%',
|
|
156
|
+
backgroundColor: Global.AppTheme.primary_color
|
|
157
|
+
}}
|
|
158
|
+
onPress={() => (
|
|
159
|
+
navigation.navigate('CHistoryScreen', {
|
|
160
|
+
data: item,
|
|
161
|
+
screentype: 1,
|
|
162
|
+
link: item.historyurl
|
|
163
|
+
}),
|
|
164
|
+
(Global.PatientDetails = {
|
|
165
|
+
...data.item,
|
|
166
|
+
medication: null
|
|
167
|
+
})
|
|
168
|
+
)}>
|
|
169
|
+
<HOCIcons.Icons
|
|
170
|
+
icongroup={5}
|
|
171
|
+
size={normalize(25)}
|
|
172
|
+
name={'notes-medical'}
|
|
173
|
+
color={'white'}
|
|
174
|
+
style={{ paddingHorizontal: normalize(3) }}
|
|
175
|
+
/>
|
|
176
|
+
<Text style={{ color: 'white', fontWeight: 'normal', fontSize: normalize(8), textAlign: 'center', paddingHorizontal: normalize(4) }}>{category}{" History"}</Text>
|
|
177
|
+
</TouchableOpacity>
|
|
178
|
+
<TouchableOpacity
|
|
179
|
+
style={{
|
|
180
|
+
justifyContent: 'center',
|
|
181
|
+
alignItems: 'center',
|
|
182
|
+
height: '100%',
|
|
183
|
+
backgroundColor: Global.AppTheme.primary_color
|
|
184
|
+
}}
|
|
185
|
+
onPress={() => {
|
|
186
|
+
(navigation.navigate('CHistoryScreen', {
|
|
187
|
+
data: item,
|
|
188
|
+
screentype: 2,
|
|
189
|
+
link: item.medicationhistoryurl
|
|
190
|
+
}),
|
|
191
|
+
(Global.PatientDetails = {
|
|
192
|
+
...data.item,
|
|
193
|
+
medication: null
|
|
194
|
+
}))
|
|
195
|
+
}}
|
|
196
|
+
>
|
|
197
|
+
<HOCIcons.Icons
|
|
198
|
+
icongroup={3}
|
|
199
|
+
size={normalize(25)}
|
|
200
|
+
name={'text-box-check-outline'}
|
|
201
|
+
color={'white'}
|
|
202
|
+
style={{ paddingHorizontal: normalize(3) }}
|
|
203
|
+
/>
|
|
204
|
+
<Text style={{ color: 'white', fontWeight: 'normal', fontSize: normalize(8), textAlign: 'center', paddingHorizontal: normalize(4) }}>{"Medication History"}</Text>
|
|
205
|
+
</TouchableOpacity>
|
|
206
|
+
</View >
|
|
207
|
+
|
|
208
|
+
{/* Visible medication item */}
|
|
209
|
+
< TouchableWithoutFeedback >
|
|
210
|
+
<View style={styles.medicationContainer}>
|
|
211
|
+
<View style={{ flexDirection: 'row', width: '100%', }}>
|
|
212
|
+
<View style={{ borderWidth: 0.5, borderColor: 'grey', width: '55%', justifyContent: 'center', alignItems: 'flex-start' }}>
|
|
213
|
+
<View style={{ flexDirection: 'row' }}>
|
|
214
|
+
<SCheckBox
|
|
215
|
+
data={{ value: item.status }}
|
|
216
|
+
callBack={value => handleCheckboxChange(value, sectionIndex, category, itemIndex)}
|
|
217
|
+
/>
|
|
218
|
+
<View style={{ flex: 1, borderWidth: 0, justifyContent: 'center', alignItems: 'center' }}>
|
|
219
|
+
<Text adjustsFontSizeToFit numberOfLines={3} style={{ fontSize: normalize(10), textAlign: 'left', fontWeight: 'bold', color: Global.AppTheme.primary_color }}>
|
|
220
|
+
{item.product || 'N/A'}
|
|
221
|
+
</Text>
|
|
222
|
+
</View>
|
|
223
|
+
</View>
|
|
224
|
+
<View style={{ borderTopWidth: 0, borderColor: 'grey', width: '100%', flexDirection: 'row', alignItems: 'center', marginVertical: normalize(5) }}>
|
|
225
|
+
<HOCIcons.Icons
|
|
226
|
+
icongroup={10}
|
|
227
|
+
size={normalize(10)}
|
|
228
|
+
name={'info'}
|
|
229
|
+
color={'grey'}
|
|
230
|
+
style={{ paddingHorizontal: normalize(3) }}
|
|
231
|
+
/>
|
|
232
|
+
<Text adjustsFontSizeToFit numberOfLines={3} style={{ fontSize: normalize(9), color: 'black', fontWeight: 'bold' }}>
|
|
233
|
+
{" "}{item.description || 'No description'}
|
|
234
|
+
</Text>
|
|
235
|
+
</View>
|
|
236
|
+
</View>
|
|
237
|
+
<View style={{ borderWidth: 0.5, borderColor: 'grey', width: '25%', justifyContent: 'center', alignItems: 'flex-start' }}>
|
|
238
|
+
<Text style={{ fontSize: normalize(10), color: 'black', fontWeight: 'bold', textAlign: 'left', paddingLeft: normalize(5) }}>{" "}{item.medicationdate || ' '}</Text>
|
|
239
|
+
<Text style={{ fontSize: normalize(10), color: 'black', fontWeight: 'bold', textAlign: 'left', paddingLeft: normalize(5) }}>{" "}{moment(item.medicinetime, 'HH:mm:ss').format('h:mm A') || ' '}</Text>
|
|
240
|
+
</View>
|
|
241
|
+
<View style={{ borderWidth: 0.5, borderColor: 'grey', width: '20%', justifyContent: 'center', alignItems: 'center' }}>
|
|
242
|
+
<View style={{
|
|
243
|
+
width: '100%',
|
|
244
|
+
height: 'auto',
|
|
245
|
+
justifyContent: 'center',
|
|
246
|
+
alignItems: 'center',
|
|
247
|
+
borderWidth: 0
|
|
248
|
+
}}>
|
|
249
|
+
<TouchableOpacity
|
|
250
|
+
onPress={() => {
|
|
251
|
+
item.remarksoverlay = !item.remarksoverlay;
|
|
252
|
+
setRefresh(refresh + 1);
|
|
253
|
+
}}
|
|
254
|
+
style={{
|
|
255
|
+
backgroundColor: 'white',
|
|
256
|
+
elevation: 0,
|
|
257
|
+
borderWidth: 0,
|
|
258
|
+
borderRadius: 0,
|
|
259
|
+
borderColor: 'lightgrey',
|
|
260
|
+
flexDirection: 'row',
|
|
261
|
+
alignItems: 'center',
|
|
262
|
+
justifyContent: 'flex-start',
|
|
263
|
+
width: '100%',
|
|
264
|
+
height: 'auto'
|
|
265
|
+
}}>
|
|
266
|
+
<HOCIcons.MaterialCommunityIcons
|
|
267
|
+
name={'comment'}
|
|
268
|
+
size={normalize(10)}
|
|
269
|
+
color={Global.AppTheme.primary_color}
|
|
270
|
+
style={{
|
|
271
|
+
paddingHorizontal: normalize(3)
|
|
272
|
+
}}
|
|
273
|
+
/>
|
|
274
|
+
<Text adjustsFontSizeToFit numberOfLines={1} style={{ paddingRight: normalize(3), fontSize: normalize(8), color: 'black', fontWeight: 'bold' }}>{isNU(item.remark) ? item.remark : null}</Text>
|
|
275
|
+
</TouchableOpacity>
|
|
276
|
+
{item.remarksoverlay ?
|
|
277
|
+
<CCommentOverlay
|
|
278
|
+
disabled={false}
|
|
279
|
+
icon={{
|
|
280
|
+
'name': 'badge-account',
|
|
281
|
+
'icongroup': 3,
|
|
282
|
+
'size': normalize(15),
|
|
283
|
+
'style': {
|
|
284
|
+
marginHorizontal: normalize(10)
|
|
285
|
+
}
|
|
286
|
+
}}
|
|
287
|
+
footericon={{
|
|
288
|
+
'name': 'select1',
|
|
289
|
+
'icongroup': 1,
|
|
290
|
+
'color': Global.AppTheme.primary_color,
|
|
291
|
+
'size': normalize(25),
|
|
292
|
+
'style': {
|
|
293
|
+
marginHorizontal: normalize(10)
|
|
294
|
+
}
|
|
295
|
+
}}
|
|
296
|
+
footerbuttontext={'Select'}
|
|
297
|
+
heading={'REMARKS'}
|
|
298
|
+
overlaystyle={{
|
|
299
|
+
borderRadius: 10,
|
|
300
|
+
height: Dimensions.get('window').height * 0.38,
|
|
301
|
+
borderWidth: 0,
|
|
302
|
+
borderColor: 'darkblue',
|
|
303
|
+
alignSelf: 'center',
|
|
304
|
+
width: Dimensions.get('screen').width * 1,
|
|
305
|
+
alignItems: 'center',
|
|
306
|
+
justifyContent: 'flex-start',
|
|
307
|
+
padding: 0,
|
|
308
|
+
backgroundColor: 'transparent',
|
|
309
|
+
position: 'absolute',
|
|
310
|
+
bottom: 0
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
}}
|
|
314
|
+
data={isNU(item.remark) ? item.remark : null}
|
|
315
|
+
callback={val => {
|
|
316
|
+
// console.log('callback from overlay');
|
|
317
|
+
}}
|
|
318
|
+
onsavecallback={val => {
|
|
319
|
+
handleRemarkChange(val, sectionIndex, category, itemIndex)
|
|
320
|
+
// item.remark = val;
|
|
321
|
+
item.remarksoverlay = false;
|
|
322
|
+
setRefresh(refresh + 1);
|
|
323
|
+
}}
|
|
324
|
+
OverlayClose={val => {
|
|
325
|
+
item.remarksoverlay = !item.remarksoverlay;
|
|
326
|
+
// item.remarksoverlay = false;
|
|
327
|
+
setRefresh(refresh + 1);
|
|
328
|
+
}}
|
|
329
|
+
/>
|
|
330
|
+
: null}
|
|
331
|
+
</View>
|
|
332
|
+
</View>
|
|
333
|
+
</View>
|
|
334
|
+
</View>
|
|
335
|
+
</TouchableWithoutFeedback >
|
|
336
|
+
</SwipeRow >
|
|
337
|
+
),
|
|
338
|
+
[],
|
|
339
|
+
);
|
|
340
|
+
|
|
341
|
+
const renderMedicationList = useCallback((sectionIndex, category, medications) => (
|
|
342
|
+
|
|
343
|
+
<View key={category}>
|
|
344
|
+
{/* {isBNUL(medicationData) ? */}
|
|
345
|
+
<View style={{ flexDirection: 'row', width: '100%' }}>
|
|
346
|
+
<View style={{ width: '55%' }}>
|
|
347
|
+
<CTextHeader
|
|
348
|
+
text={'Medication'}
|
|
349
|
+
widthArr={'100%'}
|
|
350
|
+
bgColor={"lightgrey"}
|
|
351
|
+
color={Global.AppTheme.primary_color}
|
|
352
|
+
borderColor={'lightgrey'}
|
|
353
|
+
marginHorizontal={normalize(2)}
|
|
354
|
+
borderRadius={1}
|
|
355
|
+
elevation={2}
|
|
356
|
+
/>
|
|
357
|
+
</View>
|
|
358
|
+
<View style={{ width: '25%' }}>
|
|
359
|
+
<CTextHeader
|
|
360
|
+
text={'Date & Time'}
|
|
361
|
+
widthArr={'100%'}
|
|
362
|
+
bgColor={"lightgrey"}
|
|
363
|
+
color={Global.AppTheme.primary_color}
|
|
364
|
+
borderColor={'lightgrey'}
|
|
365
|
+
marginHorizontal={normalize(2)}
|
|
366
|
+
borderRadius={1}
|
|
367
|
+
elevation={2}
|
|
368
|
+
/>
|
|
369
|
+
</View>
|
|
370
|
+
<View style={{ width: '20%' }}>
|
|
371
|
+
<CTextHeader
|
|
372
|
+
text={'Remarks'}
|
|
373
|
+
widthArr={'100%'}
|
|
374
|
+
bgColor={"lightgrey"}
|
|
375
|
+
color={Global.AppTheme.primary_color}
|
|
376
|
+
borderColor={'lightgrey'}
|
|
377
|
+
marginHorizontal={normalize(2)}
|
|
378
|
+
borderRadius={1}
|
|
379
|
+
elevation={2}
|
|
380
|
+
/>
|
|
381
|
+
</View>
|
|
382
|
+
</View>
|
|
383
|
+
{/* : null} */}
|
|
384
|
+
{medications.map((item, itemIndex) =>
|
|
385
|
+
renderEachMedication({ item, category, sectionIndex, itemIndex }),
|
|
386
|
+
)}
|
|
387
|
+
</View>
|
|
388
|
+
),
|
|
389
|
+
[],
|
|
390
|
+
);
|
|
391
|
+
|
|
392
|
+
return (
|
|
393
|
+
<View style={styles.container}>
|
|
394
|
+
<View style={styles.card}>
|
|
395
|
+
|
|
396
|
+
<View style={styles.tabContainer}>
|
|
397
|
+
{data?.item?.medication?.map((val, i) => (
|
|
398
|
+
<TouchableOpacity
|
|
399
|
+
key={i}
|
|
400
|
+
onPress={() => handleTabChange(i)}
|
|
401
|
+
style={[styles.tab, val.selected && styles.selectedTab]}>
|
|
402
|
+
<Text style={styles.tabText}>{" "}{val.name}</Text>
|
|
403
|
+
</TouchableOpacity>
|
|
404
|
+
))}
|
|
405
|
+
</View>
|
|
406
|
+
|
|
407
|
+
{loading ? (
|
|
408
|
+
<View style={styles.loadingContainer}>
|
|
409
|
+
<ActivityIndicator
|
|
410
|
+
size="large"
|
|
411
|
+
color={Global.AppTheme.primary_color}
|
|
412
|
+
/>
|
|
413
|
+
</View>
|
|
414
|
+
) : (
|
|
415
|
+
<View>
|
|
416
|
+
{isBNUL(medicationData) ?
|
|
417
|
+
<FlatList
|
|
418
|
+
data={medicationData}
|
|
419
|
+
keyExtractor={(item, index) => `section-${item.id || index}`}
|
|
420
|
+
contentContainerStyle={styles.contentContainer}
|
|
421
|
+
showsVerticalScrollIndicator={true}
|
|
422
|
+
renderItem={({ item, index }) => {
|
|
423
|
+
// if (!data?.item?.medication?.[0]?.selected) return null;
|
|
424
|
+
return (
|
|
425
|
+
<View>
|
|
426
|
+
{Object.keys(item).map(category =>
|
|
427
|
+
renderMedicationList(index, category, item[category]),
|
|
428
|
+
)}
|
|
429
|
+
</View>
|
|
430
|
+
);
|
|
431
|
+
}}
|
|
432
|
+
/>
|
|
433
|
+
: null}
|
|
434
|
+
</View>
|
|
435
|
+
|
|
436
|
+
)}
|
|
437
|
+
</View>
|
|
438
|
+
</View>
|
|
439
|
+
);
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
const styles = StyleSheet.create({
|
|
443
|
+
container: { padding: 5 },
|
|
444
|
+
card: {
|
|
445
|
+
backgroundColor: 'white',
|
|
446
|
+
borderRadius: normalize(5),
|
|
447
|
+
borderWidth: 1,
|
|
448
|
+
borderColor: '#ddd',
|
|
449
|
+
shadowColor: '#000',
|
|
450
|
+
shadowOffset: { width: 0, height: 2 },
|
|
451
|
+
shadowOpacity: 0.05,
|
|
452
|
+
shadowRadius: 4,
|
|
453
|
+
elevation: 2,
|
|
454
|
+
},
|
|
455
|
+
tabContainer: {
|
|
456
|
+
flexDirection: 'row',
|
|
457
|
+
justifyContent: 'space-around',
|
|
458
|
+
borderWidth: 0
|
|
459
|
+
},
|
|
460
|
+
tab: {
|
|
461
|
+
borderWidth: 0.5,
|
|
462
|
+
borderColor: 'lightgrey',
|
|
463
|
+
flex: 1,
|
|
464
|
+
paddingVertical: normalize(5),
|
|
465
|
+
// paddingHorizontal: normalize(15)
|
|
466
|
+
},
|
|
467
|
+
selectedTab: {
|
|
468
|
+
backgroundColor: '#e6f0ff',
|
|
469
|
+
borderBottomWidth: 3,
|
|
470
|
+
borderColor: Global.AppTheme.primary_color,
|
|
471
|
+
},
|
|
472
|
+
tabText: {
|
|
473
|
+
fontSize: 10,
|
|
474
|
+
fontWeight: '600',
|
|
475
|
+
color: '#444'
|
|
476
|
+
},
|
|
477
|
+
contentContainer: { padding: 5 },
|
|
478
|
+
medicationContainer: {
|
|
479
|
+
// padding: ,
|
|
480
|
+
// marginVertical: 1,
|
|
481
|
+
backgroundColor: '#ffffff',
|
|
482
|
+
borderWidth: 0,
|
|
483
|
+
borderColor: 'lightgrey',
|
|
484
|
+
// margin: normalize(4)
|
|
485
|
+
},
|
|
486
|
+
medicationRow: {
|
|
487
|
+
flexDirection: 'row',
|
|
488
|
+
justifyContent: 'space-between',
|
|
489
|
+
marginBottom: 1,
|
|
490
|
+
},
|
|
491
|
+
highlightedText: { fontWeight: '600' },
|
|
492
|
+
highlightedValue: { fontWeight: 'bold', color: Global.AppTheme.primary_color },
|
|
493
|
+
remarkInput: { borderColor: '#ddd', borderWidth: 1, padding: 5 },
|
|
494
|
+
swipeRowBack: {
|
|
495
|
+
borderWidth: 0.5,
|
|
496
|
+
borderColor: 'lightgrey',
|
|
497
|
+
// margin: normalize(4),
|
|
498
|
+
flexDirection: 'row',
|
|
499
|
+
justifyContent: 'space-between',
|
|
500
|
+
backgroundColor: '#f8f8f8',
|
|
501
|
+
// height: 80,
|
|
502
|
+
alignItems: 'center',
|
|
503
|
+
// paddingHorizontal: 15,
|
|
504
|
+
},
|
|
505
|
+
swipeButton: {
|
|
506
|
+
justifyContent: 'center',
|
|
507
|
+
alignItems: 'center',
|
|
508
|
+
width: 75,
|
|
509
|
+
height: '100%',
|
|
510
|
+
},
|
|
511
|
+
completeButton: {
|
|
512
|
+
backgroundColor: Global.AppTheme.primary_color,
|
|
513
|
+
},
|
|
514
|
+
deleteButton: {
|
|
515
|
+
backgroundColor: Global.AppTheme.primary_color,
|
|
516
|
+
},
|
|
517
|
+
swipeButtonText: {
|
|
518
|
+
color: '#fff',
|
|
519
|
+
fontWeight: 'bold',
|
|
520
|
+
},
|
|
521
|
+
loadingContainer: {
|
|
522
|
+
flex: 1,
|
|
523
|
+
justifyContent: 'center',
|
|
524
|
+
alignItems: 'center',
|
|
525
|
+
},
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
export default CMedications;
|