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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/index.d.ts +2 -66
  2. package/index.js +1 -66
  3. package/package.json +1 -1
  4. package/src/Alerts/AAlert.js +0 -137
  5. package/src/Alerts/AAlertIOS.js +0 -97
  6. package/src/Alerts/ABlink.js +0 -40
  7. package/src/Common/Icons.js +0 -49
  8. package/src/Common/NetworkServiceCall.js +0 -265
  9. package/src/CommonStyle/CommonTheme.js +0 -11
  10. package/src/CommonStyle/ComponentFunctions.js +0 -632
  11. package/src/CommonStyle/PopupStyle.js +0 -146
  12. package/src/CommonStyle/commonStyle.js +0 -93
  13. package/src/CommonStyle/componentStyle.js +0 -545
  14. package/src/CommonStyle/optionListStyles.js +0 -175
  15. package/src/Components/ByProductPage.js +0 -200
  16. package/src/Components/CDropDownListNew.js +0 -153
  17. package/src/Components/CSupplierList.js +0 -88
  18. package/src/Components/CVerificationCard.js +0 -2822
  19. package/src/Components/CustomButton.js +0 -67
  20. package/src/Components/CustomCard.js +0 -127
  21. package/src/Components/CustomTextInput.js +0 -47
  22. package/src/Components/EquipmentPage.js +0 -313
  23. package/src/Components/FilterInput.Copy.js +0 -723
  24. package/src/Components/FilterInput.js +0 -569
  25. package/src/Components/HSubHeading.js +0 -68
  26. package/src/Components/HeaderCard.js +0 -40
  27. package/src/Components/MoreOptionsScreen.js +0 -251
  28. package/src/Components/NonSwipableProductCard.js +0 -226
  29. package/src/Components/NonSwipableSupplierCard.js +0 -348
  30. package/src/Components/ProductCard.js +0 -1336
  31. package/src/Components/QualityProductCard.js +0 -1059
  32. package/src/Components/RateProductCard.js +0 -1452
  33. package/src/Components/RawMaterial.js +0 -261
  34. package/src/Components/SDropDownEdited.js +0 -549
  35. package/src/Components/SDropDownNew.js +0 -529
  36. package/src/Components/SHelpDescription.js +0 -147
  37. package/src/Components/STextInputNew.js +0 -510
  38. package/src/Components/SearchProductCard.js +0 -470
  39. package/src/Components/StageByProduct.js +0 -199
  40. package/src/Components/SupplierCard.js +0 -243
  41. package/src/Components/SupplierInvoiceCard.js +0 -405
  42. package/src/Components/SwipableSupplierCard.js +0 -136
  43. package/src/Components/TagTemplate.js +0 -74
  44. package/src/Components/WrappedComponent.js +0 -25
  45. package/src/Custom/CBooking.js +0 -944
  46. package/src/Custom/CBookingPostpone.js +0 -1822
  47. package/src/Custom/CCalendar.js +0 -560
  48. package/src/Custom/CCard.js +0 -880
  49. package/src/Custom/CDetailCard.js +0 -205
  50. package/src/Custom/CHelpImage.js +0 -52
  51. package/src/Custom/CReport.js +0 -569
  52. package/src/Custom/CScrollView.js +0 -73
  53. package/src/Custom/CSignature.js +0 -112
  54. package/src/Custom/CSliderMenu.js +0 -339
  55. package/src/Custom/CSupplierCard.js +0 -99
  56. package/src/Custom/CTemplateCard.js +0 -438
  57. package/src/Custom/CTokenAllocation.js +0 -1402
  58. package/src/Custom/CTokenListOverlay.js +0 -122
  59. package/src/Custom/CWardStatus.js +0 -444
  60. package/src/Custom/Charts/CBarChart.js +0 -218
  61. package/src/Custom/Charts/CDashBoardList.js +0 -133
  62. package/src/Custom/Charts/CDashBoardTable.js +0 -172
  63. package/src/Custom/Charts/CLineChart.js +0 -193
  64. package/src/Custom/Charts/CPieChart.js +0 -186
  65. package/src/Custom/Loader.js +0 -182
  66. package/src/Custom/OUserView.js +0 -1121
  67. package/src/Custom/PreviewDosage.js +0 -115
  68. package/src/Custom/SearchLoader.js +0 -32
  69. package/src/Custom/TableComponent/CActivityTable.js +0 -707
  70. package/src/Custom/TableComponent/CMoreButtonTable.js +0 -197
  71. package/src/Custom/TableComponent/CTable.js +0 -185
  72. package/src/Custom/TableComponent/CTextBody.js +0 -40
  73. package/src/Custom/TableComponent/CTextHeader.js +0 -17
  74. package/src/Custom/TableComponent/PreviewPrescriptionNew.js +0 -1011
  75. package/src/Custom/TableComponent/SDropdownTable.js +0 -491
  76. package/src/Custom/TableComponent/TagTable.js +0 -1200
  77. package/src/CustomComponents/CAddColumn.js +0 -140
  78. package/src/CustomComponents/CAssessmentDelete.js +0 -307
  79. package/src/CustomComponents/CAwesomeButton.js +0 -83
  80. package/src/CustomComponents/CAwesomeMoreButton.js +0 -54
  81. package/src/CustomComponents/CBackHandler.js +0 -273
  82. package/src/CustomComponents/CCalendar.js +0 -243
  83. package/src/CustomComponents/CCommentOverlay.js +0 -202
  84. package/src/CustomComponents/CComments.js +0 -162
  85. package/src/CustomComponents/CContainerView.js +0 -24
  86. package/src/CustomComponents/CCustomTextInput.js +0 -336
  87. package/src/CustomComponents/CDetailView.js +0 -40
  88. package/src/CustomComponents/CDropDownList.js +0 -153
  89. package/src/CustomComponents/CDropdownSelect.js +0 -555
  90. package/src/CustomComponents/CFooterView.js +0 -42
  91. package/src/CustomComponents/CImagePickerSave.js +0 -316
  92. package/src/CustomComponents/CModalOverlay.js +0 -91
  93. package/src/CustomComponents/CNetworkStatus.js +0 -327
  94. package/src/CustomComponents/CNotesInstructions.js +0 -1000
  95. package/src/CustomComponents/COverlay.js +0 -81
  96. package/src/CustomComponents/CRemarks.js +0 -176
  97. package/src/CustomComponents/CRowAdd.js +0 -143
  98. package/src/CustomComponents/CSummaryDropDown.js +0 -327
  99. package/src/CustomComponents/CText.js +0 -9
  100. package/src/CustomComponents/CVectorIcon.js +0 -34
  101. package/src/CustomComponents/HtmlContentViewer.js +0 -65
  102. package/src/CustomComponents/PdfContentViewer.js +0 -90
  103. package/src/CustomComponents/SDropDownDosage.js +0 -1087
  104. package/src/CustomComponents/SwipableProductCard.js +0 -246
  105. package/src/CustomComponents/SwipableProductImageCard.js +0 -254
  106. package/src/CustomComponents/WorkOrderDetails.js +0 -1216
  107. package/src/CustomComponents/WorkOrderDetailsPage.js +0 -1213
  108. package/src/HOC/ConfirmOverlay.js +0 -192
  109. package/src/HOC/HHeading.js +0 -70
  110. package/src/HOC/HMoreButton.js +0 -88
  111. package/src/HOC/HNatureHeading.js +0 -402
  112. package/src/HOC/HOCIcons.js +0 -80
  113. package/src/HOC/HOverlayCentered.js +0 -140
  114. package/src/HOC/HShadowButton.js +0 -45
  115. package/src/HOC/HShadowCountButton.js +0 -82
  116. package/src/HOC/OptionOverlay.js +0 -48
  117. package/src/Json/Chart.json +0 -818
  118. package/src/Json/Consultation.json +0 -622
  119. package/src/Json/CreditBill.json +0 -490
  120. package/src/Json/Dropdown.json +0 -216
  121. package/src/Json/DropdownConsultation.json +0 -228
  122. package/src/Json/DynamicReports.json +0 -623
  123. package/src/Json/Footer.json +0 -79
  124. package/src/Media/AudioScreen.js +0 -342
  125. package/src/Media/BarcodeScan.js +0 -145
  126. package/src/Media/CAudioPlay.js +0 -228
  127. package/src/Media/CCaptureImageWithoutEdit.js +0 -330
  128. package/src/Media/CImageGallery.js +0 -289
  129. package/src/Media/CImageZoom.js +0 -82
  130. package/src/Media/CSingleImage.js +0 -391
  131. package/src/Media/CSketchCanvas.js +0 -76
  132. package/src/Media/CVideoPlay.js +0 -31
  133. package/src/Media/DocumentScreen.js +0 -362
  134. package/src/Media/DrawingScreen.js +0 -578
  135. package/src/Media/ImageScreen.js +0 -309
  136. package/src/Media/RecordAudio.js +0 -250
  137. package/src/Media/RecordVideo.js +0 -223
  138. package/src/Media/VideoScreen.js +0 -378
  139. package/src/Navigation/PageNavigation.js +0 -224
  140. package/src/Navigation/useFocusEffect.js +0 -2
  141. package/src/Navigation/useFocusEffect.native.js +0 -1
  142. package/src/Navigation/useFocusEffect.web.js +0 -1
  143. package/src/Navigation/useIsFocused.js +0 -1
  144. package/src/Navigation/useIsFocused.native.js +0 -1
  145. package/src/Navigation/useIsFocused.web.js +0 -1
  146. package/src/Navigation/useNavigation.js +0 -2
  147. package/src/Navigation/useNavigation.native.js +0 -1
  148. package/src/Navigation/useNavigation.web.js +0 -1
  149. package/src/Screens/CMedications.js +0 -528
  150. package/src/Screens/CWebViewGallery.js +0 -203
  151. package/src/Screens/ChartScan.js +0 -279
  152. package/src/Screens/ChartScreenNew.js +0 -1579
  153. package/src/Screens/Consultation.js +0 -1500
  154. package/src/Screens/Dashboard.js +0 -778
  155. package/src/Screens/FileExplorer.js +0 -288
  156. package/src/Screens/Footer.js +0 -340
  157. package/src/Screens/ForgotPassword.js +0 -288
  158. package/src/Screens/HeaderBlock.js +0 -353
  159. package/src/Screens/Login.js +0 -328
  160. package/src/Screens/Notification.js +0 -149
  161. package/src/Screens/OcrScreen.js +0 -20
  162. package/src/Screens/PdfPreview.js +0 -507
  163. package/src/Screens/RegistrationDetails.js +0 -467
  164. package/src/Screens/SearchScreen.js +0 -582
  165. package/src/Screens/Splash.js +0 -788
  166. package/src/Screens/SwipeLeftView.js +0 -1867
  167. package/src/StaticComponents/SAlphabet.js +0 -47
  168. package/src/StaticComponents/SCheckBox.js +0 -42
  169. package/src/StaticComponents/SDatePicker.js +0 -208
  170. package/src/StaticComponents/SDatePickerLabel.js +0 -253
  171. package/src/StaticComponents/SDatePickerNew.js +0 -258
  172. package/src/StaticComponents/SDateTimePickerNew.js +0 -381
  173. package/src/StaticComponents/SDropDownGenerate.js +0 -450
  174. package/src/StaticComponents/SDropDownHoc.js +0 -636
  175. package/src/StaticComponents/SDropDownIcon.js +0 -500
  176. package/src/StaticComponents/SMenuBox.js +0 -131
  177. package/src/StaticComponents/SOverlay.js +0 -177
  178. package/src/StaticComponents/SOverlayTextInput.js +0 -109
  179. package/src/StaticComponents/SSearch.js +0 -438
  180. package/src/StaticComponents/SSearchBar.js +0 -53
  181. package/src/StaticComponents/SSpeedDial.js +0 -303
  182. package/src/StaticComponents/STextInput.js +0 -289
  183. package/src/StaticComponents/STextInputProps.js +0 -36
  184. package/src/StaticComponents/STimePicker.js +0 -171
  185. package/src/StaticComponents/STimingDropDownNew.js +0 -1585
  186. package/src/StaticComponents/STimingSwitch.js +0 -34
  187. package/src/layout/CContainerView.js +0 -21
  188. package/src/layout/CDetailView.js +0 -81
  189. package/src/layout/HeaderBlock.js +0 -353
  190. package/src/layout/INVLoginLayout.js +0 -657
  191. package/src/layout/Loader.js +0 -176
@@ -1,47 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { View, Text, FlatList, Dimensions, TouchableOpacity } from 'react-native';
3
- import { normalize } from '../CommonStyle/componentStyle';
4
-
5
- export default function SAlphabet(props) {
6
- const [alphaindex, setAlphaIndex] = useState(0);
7
- return (
8
- <View style={{
9
- // height: Dimensions.get('window').height * 0.6,
10
- marginBottom: Dimensions.get('window').height * 0.01,
11
- }}>
12
- <FlatList
13
- data={['#', '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', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '.']}
14
- renderItem={renderAlphabet}
15
- style={{ paddingBottom: 20 }}
16
- contentContainerStyle={{ alignItems: 'center' }}
17
- keyExtractor={(item, index) => 'key' + index}
18
- initialNumToRender={50}
19
- maxToRenderPerBatch={100}
20
- />
21
- </View>
22
- );
23
-
24
- function renderAlphabet({ index, item }) {
25
-
26
- return (
27
- <TouchableOpacity style={{
28
- width: normalize(25), alignItems: 'center', paddingVertical: 2, borderRadius: normalize(40) / 2,
29
- backgroundColor: index == alphaindex ? '#8162fc' : 'white',
30
- }}
31
- onPress={() => getAlphabetData(item, index)}>
32
- <Text style={{
33
- color: index == alphaindex ? 'white' : 'black',
34
- fontWeight: index == alphaindex ? 'bold' : 'normal',
35
- }}>{item}</Text>
36
- </TouchableOpacity>
37
- );
38
- }
39
-
40
- function getAlphabetData(alpha, index) {
41
- setAlphaIndex(index);
42
- props.callBack != undefined ? props.callBack({
43
- 'alpha': alpha,
44
- 'index': index,
45
- }) : null;
46
- }
47
- }
@@ -1,42 +0,0 @@
1
- import React from 'react';
2
- import { View, TouchableOpacity } from 'react-native';
3
- import AntDesign from 'react-native-vector-icons/AntDesign';
4
- import { normalize } from '../CommonStyle/componentStyle';
5
- import CText from '../CustomComponents/CText';
6
-
7
- const SCheckBox = (props) => {
8
- // Normalize value to boolean for rendering
9
- const checked = Number(props.data?.value) === 1;
10
-
11
- const handlePress = () => {
12
- if (props.callBack) {
13
- // Toggle and send back numeric value (0 or 1)
14
- const newValue = checked ? 0 : 1;
15
- props.callBack(newValue);
16
- }
17
- };
18
-
19
- return (
20
- <View style={{ flexDirection: 'row', alignItems: 'center' }}>
21
- {props.data?.displaytext && (
22
- <CText style={{ color: 'black', fontSize: normalize(14) }}>
23
- {props.data.displaytext}
24
- </CText>
25
- )}
26
-
27
- <TouchableOpacity
28
- onPress={handlePress}
29
- disabled={props.disabled ?? false}
30
- style={{ paddingHorizontal: 5 }}
31
- >
32
- <AntDesign
33
- name={checked ? 'checksquare' : 'checksquareo'}
34
- size={normalize(props.data?.size ?? 20)}
35
- color={checked ? 'darkblue' : 'grey'}
36
- />
37
- </TouchableOpacity>
38
- </View>
39
- );
40
- };
41
-
42
- export default SCheckBox;
@@ -1,208 +0,0 @@
1
- import React, { useState, useEffect } from 'react';
2
- import { View, TouchableOpacity, Platform, Text } from 'react-native';
3
- import DateTimePicker from '@react-native-community/datetimepicker';
4
- import CText from '../CustomComponents/CText';
5
- import FontAwesome5 from 'react-native-vector-icons/FontAwesome5';
6
- import { normalize } from '../CommonStyle/componentStyle';
7
- import moment from 'moment';
8
-
9
- export default function SDatePicker(props) {
10
- // Initialize date state: normalize incoming passingDate to 12:00 AM
11
- const [date, setDate] = useState(
12
- props.passingDate
13
- ? moment(props.passingDate).startOf('day').toDate()
14
- : moment().startOf('day').toDate()
15
- );
16
-
17
- const [data, setData] = useState(props.data ?? {});
18
- const [mode, setMode] = useState('date');
19
- const [show, setShow] = useState(false);
20
-
21
- // Handle date change for native platforms
22
- const onNativeChange = (event, selectedDate) => {
23
- const currentDate = selectedDate
24
- ? moment(selectedDate).startOf('day').toDate() // normalize to 12:00 AM
25
- : date;
26
-
27
- setShow(Platform.OS === 'ios');
28
- setDate(currentDate);
29
-
30
- setData(prevData => ({ ...prevData, value: currentDate }));
31
-
32
- if (props.onChangeData) {
33
- // return formatted string: "YYYY-MM-DD HH:mm:ss.SSS"
34
- const formatted = moment(currentDate).format('YYYY-MM-DD HH:mm:ss.SSS');
35
- props.onChangeData(formatted);
36
- }
37
- };
38
-
39
- // Handle date change for web platform
40
- const onWebChange = (e) => {
41
- const value = e.target.value;
42
- if (!value) {return;}
43
-
44
- const selectedDate = new Date(value + 'T00:00:00');
45
- if (isNaN(selectedDate.getTime())) {return;}
46
-
47
- setDate(selectedDate);
48
- setData(prevData => ({ ...prevData, value: selectedDate }));
49
-
50
- if (props.onChangeData) {
51
- const formatted = moment(selectedDate).format('YYYY-MM-DD HH:mm:ss.SSS');
52
- props.onChangeData(formatted);
53
- }
54
- };
55
-
56
- const showMode = (currentMode) => {
57
- setShow(true);
58
- setMode(currentMode);
59
- };
60
-
61
- const showDatepicker = () => {
62
- showMode('date');
63
- };
64
-
65
- // Get web input value in YYYY-MM-DD format
66
- const getWebInputValue = () => {
67
- if (!(date instanceof Date) || isNaN(date.getTime())) {return '';}
68
- return date.toISOString().split('T')[0];
69
- };
70
-
71
- // Web-specific render
72
- if (Platform.OS === 'web') {
73
- return (
74
- <View style={{ borderWidth: 0, width: data.itemwidth ?? '100%' }}>
75
- <View style={{ marginTop: normalize(0), paddingHorizontal: 0, borderWidth: 0 }}>
76
- {props.table !== true && (
77
- <CText
78
- style={{
79
- fontSize: normalize(11),
80
- paddingHorizontal: normalize(5),
81
- color: 'black',
82
- borderWidth: 0,
83
- height: normalize(16),
84
- }}
85
- >
86
- {props.required && <Text style={{ color: 'red', fontSize: normalize(13), fontWeight: 'bold' }}>* </Text>}
87
- {data.displaytext ?? 'Date'}
88
- </CText>
89
- )}
90
- <View style={{ elevation: props.table !== true ? 3 : 0 }}>
91
- <View style={{
92
- flexDirection: 'row',
93
- backgroundColor: data.backgroundColor ?? '#fff',
94
- height: data.height ?? normalize(35),
95
- borderColor: 'lightgrey',
96
- borderWidth: props.table !== true ? 1 : 0,
97
- borderRadius: 5,
98
- alignItems: 'center',
99
- marginHorizontal: normalize(1),
100
- justifyContent: props.table !== true ? 'flex-start' : 'center',
101
- }}>
102
- <FontAwesome5
103
- name="calendar-alt"
104
- size={normalize(15)}
105
- color={data.iconcolor ?? 'darkblue'}
106
- style={{ paddingHorizontal: 5, width: normalize(25) }}
107
- />
108
- <input
109
- type="date"
110
- value={getWebInputValue()}
111
- onChange={onWebChange}
112
- disabled={props.disabled}
113
- min={props.minDate ? moment(props.minDate).format('YYYY-MM-DD') : undefined}
114
- max={props.maxDate ? moment(props.maxDate).format('YYYY-MM-DD') : undefined}
115
- style={{
116
- flex: 1,
117
- height: '100%',
118
- border: 'none',
119
- backgroundColor: 'transparent',
120
- fontSize: normalize(12),
121
- color: 'black',
122
- fontWeight: 'bold',
123
- outline: 'none',
124
- paddingLeft: normalize(5),
125
- }}
126
- />
127
- {/* Display text for web (hidden by default, shown when no input) */}
128
- {!date && (
129
- <CText style={{
130
- fontSize: normalize(12),
131
- color: 'black',
132
- fontWeight: 'bold',
133
- position: 'absolute',
134
- left: normalize(30),
135
- pointerEvents: 'none',
136
- }}>
137
- {moment(date).format('DD-MM-YYYY')}
138
- </CText>
139
- )}
140
- </View>
141
- </View>
142
- </View>
143
- </View>
144
- );
145
- }
146
-
147
- // Native platforms (iOS/Android) render
148
- return (
149
- <View style={{ borderWidth: 0, width: data.itemwidth ?? '100%' }}>
150
- <View style={{ marginTop: normalize(0), paddingHorizontal: 0, borderWidth: 0 }}>
151
- {props.table !== true && (
152
- <CText
153
- style={{
154
- fontSize: normalize(11),
155
- paddingHorizontal: normalize(5),
156
- color: 'black',
157
- borderWidth: 0,
158
- height: normalize(16),
159
- }}
160
- >
161
- {props.required && <Text style={{ color: 'red', fontSize: normalize(13), fontWeight: 'bold' }}>* </Text>}
162
- {data.displaytext ?? 'Date'}
163
- </CText>
164
- )}
165
- <View style={{ elevation: props.table !== true ? 3 : 0 }}>
166
- <TouchableOpacity
167
- disabled={props.disabled}
168
- onPress={showDatepicker}
169
- style={{
170
- flexDirection: 'row',
171
- backgroundColor: data.backgroundColor ?? '#fff',
172
- height: data.height ?? normalize(35),
173
- borderColor: 'lightgrey',
174
- borderWidth: props.table !== true ? 1 : 0,
175
- borderRadius: 5,
176
- alignItems: 'center',
177
- marginHorizontal: normalize(1),
178
- justifyContent: props.table !== true ? 'flex-start' : 'center',
179
- }}
180
- >
181
- <FontAwesome5
182
- name="calendar-alt"
183
- size={normalize(15)}
184
- color={data.iconcolor ?? 'darkblue'}
185
- style={{ paddingHorizontal: 5, width: normalize(25) }}
186
- />
187
- <CText style={{ fontSize: normalize(12), color: 'black', fontWeight: 'bold' }}>
188
- {moment(date).format('DD-MM-YYYY')}
189
- </CText>
190
- </TouchableOpacity>
191
- </View>
192
- </View>
193
-
194
- {show && (
195
- <DateTimePicker
196
- testID="dateTimePicker"
197
- value={date}
198
- mode={mode}
199
- is24Hour={true}
200
- display="default"
201
- onChange={onNativeChange}
202
- maximumDate={props.maxDate ?? new Date('2050-01-01')}
203
- minimumDate={props.minDate ?? undefined}
204
- />
205
- )}
206
- </View>
207
- );
208
- }
@@ -1,253 +0,0 @@
1
- import React, { useState, useRef } from 'react';
2
- import { View, TouchableOpacity, Platform, Dimensions, Text } from 'react-native';
3
- import DateTimePicker from '@react-native-community/datetimepicker';
4
- import CText from '../CustomComponents/CText';
5
- import FontAwesome5 from 'react-native-vector-icons/FontAwesome5';
6
- import { normalize } from '../CommonStyle/componentStyle';
7
- import moment from 'moment';
8
- import { Global } from '../../../../../src/Common/Global';
9
- import { isNU, ValueCheck } from '../CommonStyle/ComponentFunctions';
10
- import HOCIcons from '../HOC/HOCIcons';
11
-
12
- export default function SDatePickerLabel(props) {
13
- const [data, setData] = useState(props.data != undefined ? props.data : {});
14
- const [date, setDate] = useState(props.passingDate != undefined ? new Date(props.passingDate) : new Date());
15
- const [minimumdate, setMinimumDate] = useState(isNU(props.minimumdate) ? new Date(props.minimumdate) : new Date());
16
- const [mode, setMode] = useState('date');
17
- const [show, setShow] = useState(false);
18
-
19
- const webInputRef = useRef(null);
20
-
21
- // Handle date change for native platforms
22
- const onNativeChange = (event, selectedDate) => {
23
- setShow(Platform.OS === 'ios');
24
-
25
- if (event && event.type == 'set') {
26
- const currentDate = selectedDate || date;
27
- setDate(currentDate);
28
- setData({ ...data, ['value']: currentDate });
29
-
30
- if (props.onChangeData) {
31
- props.onChangeData(currentDate);
32
- }
33
-
34
- console.log('onChangeData', currentDate);
35
- }
36
- };
37
-
38
- // Handle date change for web platform
39
- const onWebChange = (e) => {
40
- const value = e.target.value;
41
- if (!value) {return;}
42
-
43
- const selectedDate = new Date(value + 'T00:00:00');
44
- if (isNaN(selectedDate.getTime())) {return;}
45
-
46
- setDate(selectedDate);
47
- setData({ ...data, ['value']: selectedDate });
48
-
49
- if (props.onChangeData) {
50
- props.onChangeData(selectedDate);
51
- }
52
-
53
- console.log('onChangeData web', selectedDate);
54
- };
55
-
56
- // Get minimum date for web input
57
- const getWebMinDate = () => {
58
- if (!isNU(props.minimumdate) && minimumdate instanceof Date) {
59
- return minimumdate.toISOString().split('T')[0];
60
- }
61
- return undefined;
62
- };
63
-
64
- // Get web input value in YYYY-MM-DD format
65
- const getWebInputValue = () => {
66
- if (!(date instanceof Date) || isNaN(date.getTime())) {return '';}
67
- return date.toISOString().split('T')[0];
68
- };
69
-
70
- const showMode = (currentMode) => {
71
- setShow(true);
72
- setMode(currentMode);
73
- };
74
-
75
- const showDatepicker = () => {
76
- showMode('date');
77
- };
78
-
79
- // Focus web input when icon is clicked
80
- const handleWebIconClick = () => {
81
- if (webInputRef.current && !props.disabled) {
82
- webInputRef.current.focus();
83
- webInputRef.current.showPicker?.(); // This works in modern browsers
84
- }
85
- };
86
-
87
- // Web-specific render
88
- if (Platform.OS === 'web') {
89
- return (
90
- <View style={{
91
- width: data.itemwidth != undefined ? data.itemwidth : Dimensions.get('screen').width * 0.5,
92
- borderWidth: 0,
93
- }}>
94
- {props.disableplaceholder && isNU(props.table) ?
95
- <Text
96
- style={{
97
- borderWidth: 0,
98
- fontSize: normalize(9),
99
- color: 'black',
100
- }}
101
- >
102
- {data.displaytext != undefined ? data.displaytext : 'Date'}
103
- </Text>
104
- : null}
105
-
106
- <View style={props.pickerstyle ?
107
- props.pickerstyle :
108
- {
109
- flexDirection: 'row',
110
- backgroundColor: '#fff',
111
- width: ValueCheck(props.width) ? props.width : null,
112
- borderColor: 'lightgrey',
113
- borderWidth: props.table != undefined && props.table != true ? 1 : 0,
114
- borderRadius: 5,
115
- alignItems: 'center',
116
- height: normalize(30),
117
- elevation: props.table != undefined && props.table != true ? 3 : 0,
118
- justifyContent: props.table != undefined && props.table != true ? 'flex-start' : 'flex-start',
119
- }}
120
- > <div
121
- onClick={handleWebIconClick}
122
- style={{ cursor: props.disabled ? 'not-allowed' : 'pointer' }}
123
- >
124
- {props.icon ?
125
-
126
- <HOCIcons.Icons
127
- icongroup={isNU(props.icon.icongroup) ? props.icon.icongroup : 5}
128
- name={props.icon.name}
129
- size={props.icon.size}
130
- style={props.iconstyle}
131
- />
132
- :
133
- <FontAwesome5
134
- name={'calendar-alt'}
135
- size={normalize(15)}
136
- color={Global.AppTheme.primary_color}
137
- style={{ width: normalize(25) }}
138
- />
139
- }
140
- </div>
141
-
142
- {/* Hidden HTML date input */}
143
- <input
144
- ref={webInputRef}
145
- type="date"
146
- value={getWebInputValue()}
147
- onChange={onWebChange}
148
- // min={getWebMinDate()}
149
- disabled={props.disabled}
150
- style={{
151
- flex: 1,
152
- height: '100%',
153
- border: 'none',
154
- backgroundColor: 'transparent',
155
- fontSize: normalize(14),
156
- color: 'black',
157
- fontWeight: 'bold',
158
- outline: 'none',
159
- paddingLeft: normalize(5),
160
- opacity: 0,
161
- position: 'absolute',
162
- width: '100%',
163
- left: normalize(25),
164
- cursor: props.disabled ? 'not-allowed' : 'pointer',
165
- }}
166
- />
167
-
168
- {/* Display text that shows the formatted date */}
169
- <Text style={props.textstyle ? props.textstyle : {
170
- fontSize: normalize(14),
171
- color: 'black',
172
- fontWeight: 'bold',
173
- marginLeft: normalize(5),
174
- pointerEvents: 'none',
175
- userSelect: 'none',
176
- }}>
177
- {moment(date).format('DD-MM-YYYY')}
178
- </Text>
179
- </View>
180
- </View>
181
- );
182
- }
183
-
184
- // Native platforms (iOS/Android) render
185
- return (
186
- <View style={{
187
- width: data.itemwidth != undefined ? data.itemwidth : Dimensions.get('screen').width * 0.5,
188
- borderWidth: 0,
189
- }}>
190
- {props.disableplaceholder && isNU(props.table) ?
191
- <Text
192
- style={{
193
- borderWidth: 0,
194
- fontSize: normalize(9),
195
- color: 'black',
196
- }}
197
- >
198
- {data.displaytext != undefined ? data.displaytext : 'Date'}
199
- </Text>
200
- : null}
201
-
202
- <TouchableOpacity
203
- disabled={props.disabled ? true : false}
204
- onPress={() => showDatepicker()}
205
- style={props.pickerstyle ?
206
- props.pickerstyle :
207
- {
208
- flexDirection: 'row',
209
- backgroundColor: '#fff',
210
- width: ValueCheck(props.width) ? props.width : null,
211
- borderColor: 'lightgrey',
212
- borderWidth: props.table != undefined && props.table != true ? 1 : 0,
213
- borderRadius: 5,
214
- alignItems: 'center',
215
- height: normalize(30),
216
- elevation: props.table != undefined && props.table != true ? 3 : 0,
217
- justifyContent: props.table != undefined && props.table != true ? 'flex-start' : 'flex-start',
218
- }}
219
- >
220
- {props.icon ?
221
- <HOCIcons.Icons
222
- icongroup={isNU(props.icon.icongroup) ? props.icon.icongroup : 5}
223
- name={props.icon.name}
224
- size={props.icon.size}
225
- style={props.iconstyle}
226
- />
227
- :
228
- <FontAwesome5
229
- name={'calendar-alt'}
230
- size={normalize(15)}
231
- color={Global.AppTheme.primary_color}
232
- style={{ width: normalize(25) }}
233
- />
234
- }
235
- <Text style={props.textstyle ? props.textstyle : { fontSize: normalize(14), color: 'black', fontWeight: 'bold' }}>
236
- {moment(date).format('DD-MM-YYYY')}
237
- </Text>
238
- </TouchableOpacity>
239
-
240
- {show && (
241
- <DateTimePicker
242
- minimumDate={isNU(props.minimumdate) ? minimumdate : null}
243
- testID={'dateTimePicker'}
244
- value={date}
245
- mode={'date'}
246
- is24Hour={true}
247
- display="default"
248
- onChange={onNativeChange}
249
- />
250
- )}
251
- </View>
252
- );
253
- }