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