@jescon-technologies/react-native-ui-kit 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +66 -0
- package/index.js +0 -4
- package/package.json +3 -2
- package/src/Alerts/AAlert.js +3 -3
- 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/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,67 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TouchableOpacity, View, Text } from 'react-native';
|
|
3
|
+
import { Icons } from '@jescon-technologies/react-native-ui-kit';;
|
|
4
|
+
import { notifyMessage } from '../CommonStyle/ComponentFunctions';
|
|
5
|
+
import { normalize } from '../CommonStyle/componentStyle';
|
|
6
|
+
|
|
7
|
+
export default function CustomButton({ data, callBack }) {
|
|
8
|
+
return (
|
|
9
|
+
<TouchableOpacity
|
|
10
|
+
style={{
|
|
11
|
+
borderRadius: data.borderRadius != undefined ? data.borderRadius : 10,
|
|
12
|
+
borderWidth: data.borderWidth != undefined ? data.borderWidth : 1,
|
|
13
|
+
height: normalize(data.height != undefined ? data.height : 40),
|
|
14
|
+
width: normalize(data.width != undefined ? data.width : 58),
|
|
15
|
+
backgroundColor: data.shadowcolor != undefined ? data.shadowcolor : '#f7efef',
|
|
16
|
+
borderColor: data.bordercolor != undefined ? data.bordercolor : 'lightblue',
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
justifyContent: 'center',
|
|
19
|
+
padding: data.padding != undefined ? data.padding : 5,
|
|
20
|
+
shadowColor: '#000',
|
|
21
|
+
shadowOpacity: 0.2,
|
|
22
|
+
shadowRadius: 2,
|
|
23
|
+
shadowOffset: { width: 0, height: 2 },
|
|
24
|
+
}}
|
|
25
|
+
onPress={() =>
|
|
26
|
+
data.functionid != undefined ? callBack(data) : notifyMessage('Incorporate soon')
|
|
27
|
+
}
|
|
28
|
+
disabled={data.disabled != undefined ? data.disabled : false}
|
|
29
|
+
>
|
|
30
|
+
<View style={{ alignItems: 'center', justifyContent: 'center' }}>
|
|
31
|
+
{data.count ? <View style={{
|
|
32
|
+
position: 'absolute', right: normalize(10), top: normalize(-5), backgroundColor: 'white',
|
|
33
|
+
alignItems: 'center', borderRadius: 20, width: normalize(15), borderWidth: 0.5, zIndex: 10,
|
|
34
|
+
}}>
|
|
35
|
+
|
|
36
|
+
<Text style={{ color: 'black', fontSize: normalize(11), fontWeight: 'bold' }}>{data.countValue || 0}</Text>
|
|
37
|
+
</View> : null}
|
|
38
|
+
{data.iconname ? (
|
|
39
|
+
<Icons.FontAwesome5
|
|
40
|
+
name={data.iconname != undefined ? data.iconname : 'file'}
|
|
41
|
+
color={data.iconcolor != undefined ? data.iconcolor : 'white'}
|
|
42
|
+
size={data.iconsize != undefined ? normalize(data.iconsize) : normalize(20)}
|
|
43
|
+
/>
|
|
44
|
+
) : (
|
|
45
|
+
<Icons.MaterialIcons
|
|
46
|
+
name={data.icon != undefined ? data.icon : 'file'}
|
|
47
|
+
color={data.iconcolor != undefined ? data.iconcolor : 'white'}
|
|
48
|
+
size={data.iconsize != undefined ? normalize(data.iconsize) : normalize(20)}
|
|
49
|
+
/>
|
|
50
|
+
)}
|
|
51
|
+
<Text
|
|
52
|
+
numberOfLines={1}
|
|
53
|
+
style={{
|
|
54
|
+
width: normalize(50),
|
|
55
|
+
color: data.fontcolor != undefined ? data.fontcolor : '#fff',
|
|
56
|
+
textAlign: data.textAlign != undefined ? data.textAlign : 'center',
|
|
57
|
+
fontSize: data.size != undefined ? normalize(data.size) : normalize(10),
|
|
58
|
+
fontWeight: data.fontWeight != undefined ? data.fontWeight : 'normal',
|
|
59
|
+
marginTop: 5,
|
|
60
|
+
}}
|
|
61
|
+
>
|
|
62
|
+
{data.displaytext != undefined ? data.displaytext : ''}
|
|
63
|
+
</Text>
|
|
64
|
+
</View>
|
|
65
|
+
</TouchableOpacity>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { View, Text, StyleSheet, Image, TouchableOpacity, ScrollView } from 'react-native';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { Icons } from '@jescon-technologies/react-native-ui-kit';;
|
|
5
|
+
import { APIURL } from '../../../../../src/Common/apiConstants';
|
|
6
|
+
|
|
7
|
+
const CustomCard = ({ item, onCardPress }) => {
|
|
8
|
+
// console.log('////////////////////////////////////////#############', item)
|
|
9
|
+
const [expanded, setExpanded] = useState(false);
|
|
10
|
+
return (
|
|
11
|
+
// <View style={{ backgroundColor: item?.backgroundColor != undefined ? item.backgroundColor : '#e1e3e1', borderRadius: 12, position: 'relative', padding: 10 }}>
|
|
12
|
+
<View>
|
|
13
|
+
{/* <TouchableOpacity style={{ backgroundColor: '#e1e3e1', borderRadius: 12, position: 'relative', padding: 10 }} onPress={() => { */}
|
|
14
|
+
<TouchableOpacity style={{ backgroundColor: item?.backgroundColor != undefined ? item.backgroundColor : '#e1e3e1', borderRadius: 12, position: 'relative', padding: 10 }} onPress={() => {
|
|
15
|
+
onCardPress(item);
|
|
16
|
+
}}>
|
|
17
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between', paddingBottom: 3 }}>
|
|
18
|
+
<View style={{ flexDirection: 'row' }}>
|
|
19
|
+
{/* Image container */}
|
|
20
|
+
<View style={styles.imageContainer}>
|
|
21
|
+
<Image
|
|
22
|
+
source={
|
|
23
|
+
item.imageUrl
|
|
24
|
+
? { uri: item.imageUrl }
|
|
25
|
+
: item.description === 'M'
|
|
26
|
+
? {uri: `${APIURL}file/getCommonFile/image/Male(2).png`} : {uri: `${APIURL}file/getCommonFile/image/FemaleI(1).png`}
|
|
27
|
+
}
|
|
28
|
+
style={styles.image}
|
|
29
|
+
/>
|
|
30
|
+
|
|
31
|
+
</View>
|
|
32
|
+
<View>
|
|
33
|
+
<Text style={{ color: item?.fontcolor != undefined ? item.fontcolor : '#094485', fontWeight: item?.fonttype != undefined ? item.fonttype : 'bold', fontSize: 15 }}>{item.name}</Text>
|
|
34
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between', width: 90 }}>
|
|
35
|
+
<Text style={{ fontWeight: '500', fontSize: 13, color: '#000' }}>{item.description}</Text>
|
|
36
|
+
<Text style={{ fontWeight: '500', fontSize: 13, color: '#000' }}>{item.detail}</Text>
|
|
37
|
+
</View>
|
|
38
|
+
</View>
|
|
39
|
+
</View>
|
|
40
|
+
<View>
|
|
41
|
+
<Text style={{ color: item?.fontcolor != undefined ? item.fontcolor : '#094485', fontWeight: item?.fonttype != undefined ? item.fonttype : 'bold', fontSize: 15 }}>{item.id}</Text>
|
|
42
|
+
<View style={{ position: 'absolute', bottom: 5, right: 5 }}>
|
|
43
|
+
<TouchableOpacity
|
|
44
|
+
style={{
|
|
45
|
+
height: 30, width: 30, justifyContent: 'center', alignItems: 'center',
|
|
46
|
+
borderRadius: 15, backgroundColor: 'lightgrey',
|
|
47
|
+
}}
|
|
48
|
+
onPress={() => setExpanded(!expanded)}
|
|
49
|
+
>
|
|
50
|
+
<Icons.FontAwesome5
|
|
51
|
+
name={expanded ? 'chevron-up' : 'chevron-down'}
|
|
52
|
+
size={14}
|
|
53
|
+
color="darkblue"
|
|
54
|
+
/>
|
|
55
|
+
</TouchableOpacity>
|
|
56
|
+
</View>
|
|
57
|
+
</View>
|
|
58
|
+
</View>
|
|
59
|
+
</TouchableOpacity>
|
|
60
|
+
{
|
|
61
|
+
expanded && <View style={{ height: 180 }}>
|
|
62
|
+
<ScrollView style={{ paddingHorizontal: 10 }} nestedScrollEnabled={true}>
|
|
63
|
+
{
|
|
64
|
+
item.expandedcontent.map((exp, i) => (
|
|
65
|
+
// <View key={i + 1} style={{ flexDirection: 'row', padding: 5 }}>
|
|
66
|
+
// <Text style={{ color: 'gray' }}>{exp.expandlabel} : </Text>
|
|
67
|
+
// <Text style={{ fontWeight: '500', fontSize: 15, color: '#000' }}>{exp.expanddata}</Text>
|
|
68
|
+
// </View>
|
|
69
|
+
<View
|
|
70
|
+
key={i + 1}
|
|
71
|
+
style={{
|
|
72
|
+
backgroundColor: '#ffffff',
|
|
73
|
+
borderRadius: 5,
|
|
74
|
+
paddingVertical: 5,
|
|
75
|
+
paddingHorizontal: 12,
|
|
76
|
+
marginVertical: 2,
|
|
77
|
+
borderWidth: 1,
|
|
78
|
+
borderColor: '#ddd',
|
|
79
|
+
flexDirection: 'row',
|
|
80
|
+
alignItems: 'center',
|
|
81
|
+
justifyContent: 'space-between',
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
<Text
|
|
85
|
+
style={{
|
|
86
|
+
color: 'gray',
|
|
87
|
+
fontSize: 14,
|
|
88
|
+
marginRight: 5,
|
|
89
|
+
}}
|
|
90
|
+
>
|
|
91
|
+
{exp.expandlabel} :
|
|
92
|
+
</Text>
|
|
93
|
+
<Text
|
|
94
|
+
style={{
|
|
95
|
+
fontWeight: '500',
|
|
96
|
+
fontSize: 15,
|
|
97
|
+
color: '#000',
|
|
98
|
+
}}
|
|
99
|
+
>
|
|
100
|
+
{exp.expanddata}
|
|
101
|
+
</Text>
|
|
102
|
+
</View>
|
|
103
|
+
))
|
|
104
|
+
}
|
|
105
|
+
</ScrollView>
|
|
106
|
+
</View>
|
|
107
|
+
}
|
|
108
|
+
</View>
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const styles = StyleSheet.create({
|
|
113
|
+
imageContainer: {
|
|
114
|
+
marginRight: 10,
|
|
115
|
+
borderRadius: 50,
|
|
116
|
+
overflow: 'hidden',
|
|
117
|
+
},
|
|
118
|
+
image: {
|
|
119
|
+
width: 60,
|
|
120
|
+
height: 60,
|
|
121
|
+
borderRadius: 50,
|
|
122
|
+
borderWidth: 1,
|
|
123
|
+
resizeMode: 'contain',
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
export default CustomCard;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { TextInput, StyleSheet } from 'react-native';
|
|
3
|
+
|
|
4
|
+
const CustomTextInput = ({
|
|
5
|
+
inputRef,
|
|
6
|
+
style,
|
|
7
|
+
placeholder,
|
|
8
|
+
placeholderTextColor = 'gray',
|
|
9
|
+
value,
|
|
10
|
+
onChangeText,
|
|
11
|
+
onSubmitEditing,
|
|
12
|
+
keyboardType = 'default',
|
|
13
|
+
}) => {
|
|
14
|
+
const [localValue, setLocalValue] = useState(value);
|
|
15
|
+
|
|
16
|
+
const handleChangeText = (text) => {
|
|
17
|
+
setLocalValue(text);
|
|
18
|
+
if (onChangeText) {
|
|
19
|
+
onChangeText(text);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<TextInput
|
|
25
|
+
ref={inputRef}
|
|
26
|
+
style={[styles.input, style]}
|
|
27
|
+
placeholder={placeholder}
|
|
28
|
+
placeholderTextColor={placeholderTextColor || 'gray'}
|
|
29
|
+
value={localValue}
|
|
30
|
+
onChangeText={handleChangeText}
|
|
31
|
+
onSubmitEditing={onSubmitEditing}
|
|
32
|
+
keyboardType={keyboardType}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const styles = StyleSheet.create({
|
|
38
|
+
input: {
|
|
39
|
+
padding: 10,
|
|
40
|
+
borderColor: '#ccc',
|
|
41
|
+
borderWidth: 1,
|
|
42
|
+
borderRadius: 5,
|
|
43
|
+
color: 'black',
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export default CustomTextInput;
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import {View, Text, Dimensions, ScrollView} from 'react-native';
|
|
2
|
+
import React, {useContext, useEffect, useState} from 'react';
|
|
3
|
+
import { NetworkServiceCall } from '@jescon-technologies/react-native-ui-kit';
|
|
4
|
+
import {notifyMessage} from '../CommonStyle/ComponentFunctions';
|
|
5
|
+
import ContextBio from '../ContextAPI/ContextBio';
|
|
6
|
+
import {normalize} from '../CommonStyle/componentStyle';
|
|
7
|
+
import Loader from '../Custom/Loader';
|
|
8
|
+
import SDropDownNew from '../Components/SDropDownNew';
|
|
9
|
+
|
|
10
|
+
import CTextHeader from '../Custom/TableComponent/CTextHeader';
|
|
11
|
+
import { APIURL } from '../../../../../src/Common/apiConstants';
|
|
12
|
+
|
|
13
|
+
const EquipmentPage = props => {
|
|
14
|
+
const {argument} = props;
|
|
15
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
16
|
+
const {invoiceData, setInvoiceData} = useContext(ContextBio);
|
|
17
|
+
|
|
18
|
+
// const data =
|
|
19
|
+
// invoiceData.workOrder[argument.workOrderIndex].details[
|
|
20
|
+
// argument.detailIndex
|
|
21
|
+
// ];
|
|
22
|
+
|
|
23
|
+
const data = invoiceData?.workOrder[argument.workOrderIndex]?.details[argument.detailIndex]?.workorderequipment;
|
|
24
|
+
|
|
25
|
+
console.log('dataaaaaaaaaaaaaa',data);
|
|
26
|
+
|
|
27
|
+
// useEffect for API call
|
|
28
|
+
// useEffect(() => {
|
|
29
|
+
// getData();
|
|
30
|
+
// }, []);
|
|
31
|
+
|
|
32
|
+
// Function for fetch data from API
|
|
33
|
+
function getData() {
|
|
34
|
+
setIsLoading(true);
|
|
35
|
+
let buttonapi = `${APIURL}invget/invcommonget/rnintrworkorderequipment ${argument.argument}`;
|
|
36
|
+
console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>', buttonapi);
|
|
37
|
+
NetworkServiceCall('get', buttonapi).then(function (response) {
|
|
38
|
+
if (response.httpstatus == 200) {
|
|
39
|
+
// setData(response.data.data);
|
|
40
|
+
if (invoiceData.EquipmentUpdate != true) {
|
|
41
|
+
setInvoiceData(prevData => {
|
|
42
|
+
const updatedWorkOrder = prevData.workOrder.map((item, index) => {
|
|
43
|
+
if (index === argument.workOrderIndex) {
|
|
44
|
+
const updatedDetails = item.details.map(
|
|
45
|
+
(detail, detailIndex) => {
|
|
46
|
+
if (detailIndex === argument.detailIndex) {
|
|
47
|
+
return {...detail, equipment: response.data.data};
|
|
48
|
+
}
|
|
49
|
+
return detail;
|
|
50
|
+
},
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
return {...item, details: updatedDetails};
|
|
54
|
+
}
|
|
55
|
+
return item;
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
...prevData,
|
|
60
|
+
workOrder: updatedWorkOrder,
|
|
61
|
+
EditStatus: true,
|
|
62
|
+
EquipmentUpdate: true,
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
setIsLoading(false);
|
|
67
|
+
console.log(
|
|
68
|
+
'RESPONSEEEEEEEEEEE FROM CONSULTATTION22222222',
|
|
69
|
+
JSON.stringify(response.data.data),
|
|
70
|
+
);
|
|
71
|
+
} else {
|
|
72
|
+
notifyMessage('Data Not Found.....');
|
|
73
|
+
setIsLoading(false);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
// getLoading(v => setIsLoading(false));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function handleEquipmentDropdownChange(
|
|
80
|
+
workOrderIndex,
|
|
81
|
+
detailIndex,
|
|
82
|
+
equipmentIndex,
|
|
83
|
+
value,
|
|
84
|
+
datavalue,
|
|
85
|
+
displayvalue,
|
|
86
|
+
) {
|
|
87
|
+
// Clone the workOrder data to ensure immutability
|
|
88
|
+
const updatedWorkOrders = [...invoiceData.workOrder];
|
|
89
|
+
|
|
90
|
+
// Clone the details array for the specific workOrder at workOrderIndex
|
|
91
|
+
const updatedDetails = [...updatedWorkOrders[workOrderIndex].details];
|
|
92
|
+
|
|
93
|
+
// Clone the equipment array inside the specific detail at detailIndex
|
|
94
|
+
const updatedEquipment = [...updatedDetails[detailIndex].workorderequipment];
|
|
95
|
+
|
|
96
|
+
// Update the specific equipment inside the equipment array at equipmentIndex
|
|
97
|
+
updatedEquipment[equipmentIndex] = {
|
|
98
|
+
...updatedEquipment[equipmentIndex],
|
|
99
|
+
[datavalue]: value.datavalue,
|
|
100
|
+
[displayvalue]: value.displayvalue,
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// Update the details with the modified equipment array
|
|
104
|
+
updatedDetails[detailIndex] = {
|
|
105
|
+
...updatedDetails[detailIndex],
|
|
106
|
+
workorderequipment: updatedEquipment,
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// Update the workOrder with the modified details array
|
|
110
|
+
updatedWorkOrders[workOrderIndex] = {
|
|
111
|
+
...updatedWorkOrders[workOrderIndex],
|
|
112
|
+
details: updatedDetails,
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
// Update the state with the modified workOrder data
|
|
116
|
+
setInvoiceData(prevState => ({
|
|
117
|
+
...prevState,
|
|
118
|
+
workOrder: updatedWorkOrders,
|
|
119
|
+
EditStatus: true,
|
|
120
|
+
}));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
console.log('invoicedata', JSON.stringify(invoiceData));
|
|
125
|
+
}, [invoiceData]);
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<View style={{width: Dimensions.get('screen').width * 0.95}}>
|
|
129
|
+
{/* Container for the page title */}
|
|
130
|
+
<View
|
|
131
|
+
style={{
|
|
132
|
+
borderWidth: 0,
|
|
133
|
+
justifyContent: 'center',
|
|
134
|
+
alignItems: 'center',
|
|
135
|
+
marginTop: normalize(5),
|
|
136
|
+
marginVertical: normalize(5),
|
|
137
|
+
alignSelf: 'center',
|
|
138
|
+
}}>
|
|
139
|
+
<Text
|
|
140
|
+
style={{
|
|
141
|
+
fontSize: normalize(14),
|
|
142
|
+
fontWeight: 'bold',
|
|
143
|
+
color: '#094485',
|
|
144
|
+
}}>
|
|
145
|
+
Equipment
|
|
146
|
+
</Text>
|
|
147
|
+
</View>
|
|
148
|
+
{
|
|
149
|
+
isLoading ? (
|
|
150
|
+
<View
|
|
151
|
+
style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
|
|
152
|
+
<Loader />
|
|
153
|
+
</View>
|
|
154
|
+
) : (
|
|
155
|
+
<ScrollView horizontal={true} style={{marginVertical: normalize(3)}}>
|
|
156
|
+
<View>
|
|
157
|
+
{
|
|
158
|
+
// Table header section
|
|
159
|
+
data != undefined && data != null ? (
|
|
160
|
+
<View style={{flexDirection: 'row'}}>
|
|
161
|
+
<CTextHeader
|
|
162
|
+
text={'Classification Nature'}
|
|
163
|
+
fontSize={10}
|
|
164
|
+
widthArr={Dimensions.get('screen').width * 0.45}
|
|
165
|
+
bgColor={'rgba(184, 184, 191,0.3)'}
|
|
166
|
+
color={'#094485'}
|
|
167
|
+
borderColor={'lightgrey'}
|
|
168
|
+
marginHorizontal={normalize(2)}
|
|
169
|
+
borderRadius={5}
|
|
170
|
+
elevation={0}
|
|
171
|
+
/>
|
|
172
|
+
<CTextHeader
|
|
173
|
+
text={'Product'}
|
|
174
|
+
fontSize={10}
|
|
175
|
+
widthArr={Dimensions.get('screen').width * 0.49}
|
|
176
|
+
bgColor={'rgba(184, 184, 191,0.3)'}
|
|
177
|
+
color={'#094485'}
|
|
178
|
+
borderColor={'lightgrey'}
|
|
179
|
+
marginHorizontal={normalize(2)}
|
|
180
|
+
borderRadius={5}
|
|
181
|
+
elevation={0}
|
|
182
|
+
/>
|
|
183
|
+
</View>
|
|
184
|
+
) : null
|
|
185
|
+
}
|
|
186
|
+
{data != undefined && data != null
|
|
187
|
+
? data.map((item, i) => (
|
|
188
|
+
<View
|
|
189
|
+
key={i}
|
|
190
|
+
style={{
|
|
191
|
+
flexDirection: 'row',
|
|
192
|
+
}}>
|
|
193
|
+
{/* Classification nature */}
|
|
194
|
+
<View
|
|
195
|
+
style={{
|
|
196
|
+
borderWidth: 1,
|
|
197
|
+
borderColor: 'lightgrey',
|
|
198
|
+
elevation: 0,
|
|
199
|
+
borderRadius: 5,
|
|
200
|
+
width: Dimensions.get('screen').width * 0.455,
|
|
201
|
+
paddingTop: 5,
|
|
202
|
+
paddingBottom: 5,
|
|
203
|
+
height: Dimensions.get('screen').height * 0.056,
|
|
204
|
+
alignItems: 'flex-start',
|
|
205
|
+
justifyContent: 'center',
|
|
206
|
+
paddingHorizontal: normalize(10),
|
|
207
|
+
}}>
|
|
208
|
+
<Text
|
|
209
|
+
style={{
|
|
210
|
+
fontWeight: 'bold',
|
|
211
|
+
color: 'black',
|
|
212
|
+
fontSize: normalize(10),
|
|
213
|
+
}}>
|
|
214
|
+
{item.classificationnaturename}
|
|
215
|
+
</Text>
|
|
216
|
+
</View>
|
|
217
|
+
{/* Dropdown */}
|
|
218
|
+
<SDropDownNew
|
|
219
|
+
// iconName={"boxes"}
|
|
220
|
+
widthArr={Dimensions.get('screen').width * 0.49}
|
|
221
|
+
heightArr={Dimensions.get('screen').height * 0.056}
|
|
222
|
+
fontSize={normalize(10)}
|
|
223
|
+
fontWeight={'bold'}
|
|
224
|
+
dropdowndata={item.productname || ''}
|
|
225
|
+
dropdownapi={`invget/invcommonget/rnddinsuproductarg ${item.insuclassificationnature}`}
|
|
226
|
+
dropdownPort={false}
|
|
227
|
+
// multiselect={true}
|
|
228
|
+
onChangeData={val => {
|
|
229
|
+
handleEquipmentDropdownChange(
|
|
230
|
+
argument.workOrderIndex,
|
|
231
|
+
argument.detailIndex,
|
|
232
|
+
i,
|
|
233
|
+
val,
|
|
234
|
+
'insuproduct',
|
|
235
|
+
'productname',
|
|
236
|
+
);
|
|
237
|
+
}}
|
|
238
|
+
editable={true}
|
|
239
|
+
// dropdownarray={Dropdown.packing}
|
|
240
|
+
refreshCount={
|
|
241
|
+
val => console.log(val)
|
|
242
|
+
// val == undefined ? setRefresh(refresh + 1) : null
|
|
243
|
+
}
|
|
244
|
+
/>
|
|
245
|
+
</View>
|
|
246
|
+
))
|
|
247
|
+
: null}
|
|
248
|
+
</View>
|
|
249
|
+
</ScrollView>
|
|
250
|
+
)
|
|
251
|
+
// data.equipment != undefined && data.equipment != null ? (
|
|
252
|
+
// data.equipment.map((item, i) => (
|
|
253
|
+
// <View
|
|
254
|
+
// key={i}
|
|
255
|
+
// style={{
|
|
256
|
+
// backgroundColor: '#fff',
|
|
257
|
+
// padding: 15,
|
|
258
|
+
// marginBottom: 10,
|
|
259
|
+
// borderRadius: 8,
|
|
260
|
+
// borderWidth: 1,
|
|
261
|
+
// borderColor: '#ddd',
|
|
262
|
+
// shadowColor: '#000',
|
|
263
|
+
// shadowOffset: {width: 0, height: 2},
|
|
264
|
+
// shadowOpacity: 0.1,
|
|
265
|
+
// shadowRadius: 5,
|
|
266
|
+
// elevation: 3,
|
|
267
|
+
// flexDirection: 'row',
|
|
268
|
+
// justifyContent: 'space-between',
|
|
269
|
+
// alignItems: 'center',
|
|
270
|
+
// width: Dimensions.get('screen').width * 0.89,
|
|
271
|
+
// }}>
|
|
272
|
+
// <Text style={{fontSize: 14, color: '#333', marginBottom: 5}}>
|
|
273
|
+
// {/* <Text style={{fontWeight: 'bold'}}>Classification Nature: </Text> */}
|
|
274
|
+
// {item.classificationnaturename}
|
|
275
|
+
// </Text>
|
|
276
|
+
// <SDropDownNew
|
|
277
|
+
// // iconName={"boxes"}
|
|
278
|
+
// widthArr={Dimensions.get('screen').width * 0.4}
|
|
279
|
+
// heightArr={Dimensions.get('screen').height * 0.05}
|
|
280
|
+
// dropdowndata={''}
|
|
281
|
+
// dropdownapi={`invget/invcommonget/rnddinsuproductarg ${item.insuclassificationnature}`}
|
|
282
|
+
// dropdownPort={true}
|
|
283
|
+
// // multiselect={true}
|
|
284
|
+
// onChangeData={val => {
|
|
285
|
+
// handleEquipmentDropdownChange(
|
|
286
|
+
// argument.workOrderIndex,
|
|
287
|
+
// argument.detailIndex,
|
|
288
|
+
// i,
|
|
289
|
+
// val,
|
|
290
|
+
// 'insuproduct',
|
|
291
|
+
// 'productname',
|
|
292
|
+
// )
|
|
293
|
+
// }}
|
|
294
|
+
// editable={true}
|
|
295
|
+
// // dropdownarray={Dropdown.packing}
|
|
296
|
+
// refreshCount={
|
|
297
|
+
// val => console.log(val)
|
|
298
|
+
// // val == undefined ? setRefresh(refresh + 1) : null
|
|
299
|
+
// }
|
|
300
|
+
// />
|
|
301
|
+
// {/* <Text style={{fontSize: 14, color: '#333', marginBottom: 5}}>
|
|
302
|
+
// <Text style={{fontWeight: 'bold'}}>Product: </Text>
|
|
303
|
+
// {item.productname || 'Product name'}
|
|
304
|
+
// </Text> */}
|
|
305
|
+
// </View>
|
|
306
|
+
// ))
|
|
307
|
+
// ) : null
|
|
308
|
+
}
|
|
309
|
+
</View>
|
|
310
|
+
);
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
export default EquipmentPage;
|