@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,1336 +0,0 @@
1
- import { View, Text, Dimensions, TouchableOpacity, FlatList } from 'react-native';
2
- import React, { useCallback, useContext, useEffect, useState, useMemo } from 'react';
3
- import ContextBio from '../ContextAPI/ContextBio';
4
- import { normalize } from '../CommonStyle/componentStyle';
5
- import { useNavigation } from '../Navigation/useNavigation';
6
-
7
- //gggggggggggggggggggggggggggggggggggg
8
- import CTextHeader from '../Custom/TableComponent/CTextHeader';
9
- import { ScrollView, TouchableWithoutFeedback } from 'react-native';
10
- import SDropDownNew from '../Components/SDropDownNew';
11
-
12
- import { Icons } from '@jescon-technologies/react-native-ui-kit';;
13
- import {
14
- CButtonShadow,
15
- isNUQ,
16
- notifyMessage,
17
- } from '../CommonStyle/ComponentFunctions';
18
- import SCheckBox from '../StaticComponents/SCheckBox';
19
- import SOverlay from '../StaticComponents/SOverlay';
20
- import { Global } from '../../../../../src/Common/Global';
21
- import STextInputNew from './STextInputNew';
22
- import { SwipeRow } from 'react-native-swipe-list-view';
23
- import HOCIcons from '../HOC/HOCIcons';
24
-
25
- const BatchRow = ({
26
- batchdata,
27
- idx,
28
- sectionIndex,
29
- productIndex,
30
- orderIndex,
31
- verifyData,
32
- updateData,
33
- supplierdata,
34
- productdata,
35
- item,
36
- onBatchUpdate,
37
- onBatchDelete,
38
- onNavigation,
39
- onMediaUpdate,
40
- onBatchVerify,
41
- onFreeQuantityUpdate,
42
- }) => {
43
- const { setSearchSelect } = useContext(ContextBio);
44
- const navigation = useNavigation();
45
- const [recievedQuantity, setRecievedQuantity] = useState(batchdata.quantity || 0);
46
- const [FilesData, setFilesData] = useState({
47
- savedaudio: [],
48
- saveddoc: [],
49
- savedimages: [],
50
- savedvideo: [],
51
- savedpdf: [],
52
- });
53
-
54
- // Update local state when batchdata changes
55
- useEffect(() => {
56
- setRecievedQuantity(batchdata.quantity || 0);
57
- }, [batchdata.quantity]);
58
-
59
- const handleQuantityChange = (val) => {
60
- const numVal = Number(val);
61
- setRecievedQuantity(numVal);
62
- onBatchUpdate('quantity', sectionIndex, productIndex, orderIndex, idx, numVal);
63
- };
64
-
65
- const handleFreeQuantityChange = (val) => {
66
- onFreeQuantityUpdate(sectionIndex, productIndex, orderIndex, idx, val);
67
- };
68
-
69
- const handleBatchNameChange = (val) => {
70
- onBatchUpdate('batchname', sectionIndex, productIndex, orderIndex, idx, val.replace(/\s/g, ''));
71
- };
72
-
73
- const handlePackingChange = (val) => {
74
- onBatchUpdate('packing', sectionIndex, productIndex, orderIndex, idx, val);
75
- };
76
-
77
- const handleVerifyChange = (val) => {
78
- onBatchVerify(sectionIndex, productIndex, orderIndex, idx, val);
79
- };
80
-
81
- const handleMediaChange = (val) => {
82
- setFilesData(val);
83
- onMediaUpdate(sectionIndex, productIndex, orderIndex, idx, val);
84
- };
85
-
86
- const handleDelete = () => {
87
- onBatchDelete(sectionIndex, productIndex, orderIndex, idx);
88
- };
89
-
90
- const handleNavigation = () => {
91
- if (!(updateData === true && batchdata.flag === 3)) {
92
- onNavigation(false, batchdata.batchname, batchdata.batchcode, item.productname, orderIndex, idx);
93
- }
94
- };
95
-
96
- const getLength = (params) => {
97
- if (!Array.isArray(params) || params.length === 0) {
98
- return 0;
99
- }
100
-
101
- const lastItem = params[params.length - 1];
102
- if (lastItem?.insuproductfree === 0 || lastItem?.insuproductfree === '') {
103
- return params.length - 1;
104
- }
105
-
106
- return params.length;
107
- };
108
-
109
- const isEditable = !(verifyData === true || (updateData === true && batchdata.flag === 3));
110
-
111
- const freeProductsCount = getLength(batchdata.productquantityentry);
112
- const totalQuantity = Number(batchdata?.totalquantity) || 0;
113
-
114
- const packingQuantity = batchdata.packingquantity != undefined &&
115
- batchdata.packingquantity != null &&
116
- batchdata.packingquantity != '' &&
117
- !isNaN(batchdata.packingquantity)
118
- ? Number(batchdata.packingquantity).toFixed(0)
119
- : '';
120
-
121
- return (
122
- <View
123
- style={{
124
- flexDirection: 'row',
125
- marginTop: normalize(1.5),
126
- backgroundColor: 'white',
127
- }}>
128
- {verifyData !== true && updateData === true && batchdata.flag === 3 && (
129
- <View
130
- style={{
131
- height: 1,
132
- backgroundColor: 'red',
133
- width: '100%',
134
- marginVertical: 10,
135
- position: 'absolute',
136
- zIndex: 999,
137
- top: 12,
138
- }}
139
- />
140
- )}
141
-
142
- {/* Delete Column */}
143
- <View>
144
- {verifyData !== true && (
145
- <CTextHeader
146
- text={''}
147
- widthArr={Dimensions.get('screen').width * 0.036}
148
- bgColor={'rgba(184, 184, 191,0.3)'}
149
- color={'#094485'}
150
- borderColor={'white'}
151
- marginHorizontal={normalize(2)}
152
- borderRadius={5}
153
- elevation={0}
154
- />
155
- )}
156
- {verifyData !== true && (
157
- <TouchableOpacity
158
- style={{
159
- elevation: 0,
160
- borderRadius: 5,
161
- fontWeight: 'bold',
162
- color: 'black',
163
- width: Dimensions.get('screen').width * 0.036,
164
- paddingTop: 5,
165
- paddingBottom: 5,
166
- height: Dimensions.get('screen').height * 0.055,
167
- textAlign: 'center',
168
- marginTop: normalize(2),
169
- marginHorizontal: normalize(3),
170
- justifyContent: 'center',
171
- alignItems: 'center',
172
- }}
173
- onPress={handleDelete}>
174
- <Icons.FontAwesome5
175
- name="trash"
176
- color="#094485"
177
- size={normalize(13)}
178
- />
179
- </TouchableOpacity>
180
- )}
181
- </View>
182
-
183
- {/* Batch Name */}
184
- <View>
185
- <CTextHeader
186
- text={'BATCH'}
187
- fontSize={10}
188
- text2={verifyData !== true ? '*' : ''}
189
- color2={verifyData !== true ? 'red' : ''}
190
- fontSize2={11}
191
- widthArr={Dimensions.get('screen').width * 0.26}
192
- bgColor={'rgba(184, 184, 191,0.3)'}
193
- color={'#094485'}
194
- borderColor={'lightgrey'}
195
- marginHorizontal={normalize(2)}
196
- borderRadius={5}
197
- elevation={0}
198
- />
199
- <STextInputNew
200
- data={{
201
- borderWidth: 1,
202
- value: batchdata.batchname,
203
- borderColor: 'lightgrey',
204
- elevation: 0,
205
- borderRadius: 5,
206
- fontWeight: 'bold',
207
- color: 'black',
208
- itemwidth: Dimensions.get('screen').width * 0.26,
209
- paddingTop: 5,
210
- paddingBottom: 5,
211
- height: Dimensions.get('screen').height * 0.054,
212
- textAlign: 'center',
213
- marginTop: normalize(2),
214
- marginHorizontal: normalize(2),
215
- editable: verifyData === true ? false : isEditable,
216
- }}
217
- callBack={handleBatchNameChange}
218
- />
219
- </View>
220
-
221
- {/* Packing */}
222
- <View>
223
- <CTextHeader
224
- text={'PACKING'}
225
- fontSize={10}
226
- text2={verifyData !== true ? '*' : ''}
227
- color2={verifyData !== true ? 'red' : ''}
228
- fontSize2={11}
229
- widthArr={Dimensions.get('screen').width * 0.26}
230
- bgColor={'rgba(184, 184, 191,0.3)'}
231
- color={'#094485'}
232
- borderColor={'lightgrey'}
233
- marginHorizontal={normalize(2)}
234
- borderRadius={5}
235
- elevation={0}
236
- />
237
- <TouchableWithoutFeedback
238
- onPress={() => {
239
- if (verifyData !== true) {
240
- setSearchSelect(3);
241
- }
242
- }}>
243
- <SDropDownNew
244
- fontSize={normalize(11)}
245
- fontWeight={'bold'}
246
- widthArr={Dimensions.get('screen').width * 0.26}
247
- heightArr={Dimensions.get('screen').height * 0.056}
248
- dropdowndata={
249
- updateData === true
250
- ? batchdata.packing
251
- : batchdata.dropdowndata?.[0]?.displayvalue || batchdata.packing
252
- }
253
- dropdownapi={
254
- 'invget/invcommonget/rndddwdropdownselect 1,' +
255
- 22401 +
256
- ',' +
257
- Global.userData.susectiondetail +
258
- ',' +
259
- Global.userData.suuser +
260
- ',' +
261
- supplierdata.insusupplier +
262
- ',' +
263
- productdata.insuproduct +
264
- ',1'
265
- }
266
- onChangeData={handlePackingChange}
267
- editable={true}
268
- disabled={!isEditable}
269
- refreshCount={val =>
270
- val == undefined
271
- ? setRefresh(refresh + 1)
272
- : null
273
- }
274
- />
275
- </TouchableWithoutFeedback>
276
- </View>
277
-
278
- {/* Packing Quantity */}
279
- <View>
280
- <CTextHeader
281
- text={'PACKING QUANTITY'}
282
- fontSize={10}
283
- widthArr={Dimensions.get('screen').width * 0.26}
284
- bgColor={'rgba(184, 184, 191,0.3)'}
285
- color={'#094485'}
286
- borderColor={'lightgrey'}
287
- marginHorizontal={normalize(2)}
288
- borderRadius={5}
289
- elevation={0}
290
- />
291
- <STextInputNew
292
- data={{
293
- borderWidth: 1,
294
- borderColor: 'lightgrey',
295
- elevation: 0,
296
- borderRadius: 5,
297
- fontWeight: 'bold',
298
- color: 'black',
299
- itemwidth: Dimensions.get('screen').width * 0.26,
300
- paddingTop: 5,
301
- paddingBottom: 5,
302
- height: Dimensions.get('screen').height * 0.054,
303
- textAlign: 'center',
304
- marginTop: normalize(2),
305
- marginHorizontal: normalize(2),
306
- value: packingQuantity,
307
- editable: false,
308
- }}
309
- fontWeight={'bold'}
310
- fontSize={normalize(11)}
311
- />
312
- </View>
313
-
314
- {/* Quantity */}
315
- <View>
316
- <CTextHeader
317
- text={'QUANTITY'}
318
- fontSize={10}
319
- text2={verifyData !== true ? '*' : ''}
320
- color2={verifyData !== true ? 'red' : ''}
321
- fontSize2={11}
322
- widthArr={Dimensions.get('screen').width * 0.26}
323
- bgColor={'rgba(184, 184, 191,0.3)'}
324
- color={'#094485'}
325
- borderColor={'lightgrey'}
326
- marginHorizontal={normalize(2)}
327
- borderRadius={5}
328
- elevation={0}
329
- />
330
- <STextInputNew
331
- data={{
332
- borderWidth: 1,
333
- borderColor: 'lightgrey',
334
- elevation: 0,
335
- borderRadius: 5,
336
- fontWeight: 'bold',
337
- color: recievedQuantity > batchdata.orderquantity ? 'red' : 'black',
338
- itemwidth: Dimensions.get('screen').width * 0.26,
339
- paddingTop: 5,
340
- paddingBottom: 5,
341
- height: Dimensions.get('screen').height * 0.054,
342
- textAlign: 'center',
343
- marginTop: normalize(2),
344
- marginHorizontal: normalize(2),
345
- value: batchdata.quantity,
346
- editable: isEditable,
347
- }}
348
- callBack={handleQuantityChange}
349
- keyboardType={'numeric'}
350
- />
351
- </View>
352
-
353
- {/* Total Quantity */}
354
- <View>
355
- <CTextHeader
356
- text={'TOTAL QUANTITY'}
357
- fontSize={10}
358
- widthArr={Dimensions.get('screen').width * 0.26}
359
- bgColor={'rgba(184, 184, 191,0.3)'}
360
- color={'#094485'}
361
- borderColor={'lightgrey'}
362
- marginHorizontal={normalize(2)}
363
- borderRadius={5}
364
- elevation={0}
365
- />
366
- <View
367
- style={{
368
- borderWidth: 1,
369
- borderColor: 'lightgrey',
370
- elevation: 0,
371
- borderRadius: 5,
372
- width: Dimensions.get('screen').width * 0.26,
373
- paddingTop: 5,
374
- paddingBottom: 5,
375
- height: Dimensions.get('screen').height * 0.056,
376
- alignItems: 'flex-start',
377
- justifyContent: 'center',
378
- paddingHorizontal: normalize(10),
379
- }}>
380
- <Text
381
- style={{
382
- fontWeight: 'bold',
383
- color: 'black',
384
- fontSize: normalize(11),
385
- }}>
386
- {totalQuantity}
387
- </Text>
388
- </View>
389
- </View>
390
-
391
- {/* Free Quantity */}
392
- <View>
393
- <CTextHeader
394
- text={'FREE QUANTITY'}
395
- fontSize={10}
396
- widthArr={Dimensions.get('screen').width * 0.26}
397
- bgColor={'rgba(184, 184, 191,0.3)'}
398
- color={'#094485'}
399
- borderColor={'lightgrey'}
400
- marginHorizontal={normalize(2)}
401
- borderRadius={5}
402
- elevation={0}
403
- />
404
- <STextInputNew
405
- data={{
406
- borderWidth: 1,
407
- borderColor: 'lightgrey',
408
- elevation: 0,
409
- borderRadius: 5,
410
- fontWeight: 'bold',
411
- color: 'black',
412
- itemwidth: Dimensions.get('screen').width * 0.26,
413
- paddingTop: 5,
414
- paddingBottom: 5,
415
- height: Dimensions.get('screen').height * 0.054,
416
- textAlign: 'center',
417
- marginTop: normalize(2),
418
- marginHorizontal: normalize(2),
419
- value: batchdata.freequantity,
420
- editable: isEditable,
421
- }}
422
- callBack={handleFreeQuantityChange}
423
- keyboardType={'numeric'}
424
- />
425
- </View>
426
-
427
- {/* Media */}
428
- <View>
429
- <CTextHeader
430
- text={'MEDIA'}
431
- fontSize={10}
432
- widthArr={Dimensions.get('screen').width * 0.26}
433
- bgColor={'rgba(184, 184, 191,0.3)'}
434
- color={'#094485'}
435
- borderColor={'lightgrey'}
436
- marginHorizontal={normalize(2)}
437
- borderRadius={5}
438
- elevation={0}
439
- />
440
- <View
441
- style={{
442
- width: Dimensions.get('screen').width * 0.26,
443
- height: Dimensions.get('screen').height * 0.056,
444
- justifyContent: 'center',
445
- alignItems: 'center',
446
- borderWidth: 1,
447
- borderRadius: 5,
448
- borderColor: 'lightgrey',
449
- }}>
450
- <TouchableOpacity
451
- style={{ marginHorizontal: normalize(5) }}
452
- onPress={() => {
453
- navigation.navigate('FileExplorer', {
454
- visibility: 0,
455
- data: batchdata.media?.map(item => ({
456
- ...item,
457
- savedimages: item.savedimages ? item.savedimages.split(',') : [],
458
- savedvideo: item.savedvideo ? item.savedvideo.split(',') : [],
459
- savedaudio: item.savedaudio ? item.savedaudio.split(',') : [],
460
- savedpdf: item.savedpdf ? item.saveddoc.split(',') : [],
461
- })) || [],
462
- callBack: handleMediaChange,
463
- });
464
- }}>
465
- <Icons.FontAwesome5
466
- name="play"
467
- color="#094485"
468
- size={normalize(15)}
469
- />
470
- </TouchableOpacity>
471
- </View>
472
- </View>
473
-
474
- {/* Verify Checkbox */}
475
- {verifyData === true && (
476
- <View>
477
- <CTextHeader
478
- text={'VERIFY'}
479
- widthArr={Dimensions.get('screen').width * 0.26}
480
- bgColor={'rgba(184, 184, 191,0.3)'}
481
- color={'#094485'}
482
- borderColor={'lightgrey'}
483
- marginHorizontal={normalize(2)}
484
- borderRadius={5}
485
- elevation={0}
486
- />
487
- <View
488
- style={{
489
- width: Dimensions.get('screen').width * 0.26,
490
- height: Dimensions.get('screen').height * 0.056,
491
- justifyContent: 'center',
492
- alignItems: 'center',
493
- borderWidth: 1,
494
- borderRadius: 5,
495
- borderColor: 'lightgrey',
496
- }}>
497
- <SCheckBox
498
- data={{
499
- value: batchdata.batchverify,
500
- size: 20,
501
- }}
502
- callBack={handleVerifyChange}
503
- />
504
- </View>
505
- </View>
506
- )}
507
-
508
- {/* Free Products */}
509
- <View>
510
- <CTextHeader
511
- text={''}
512
- widthArr={Dimensions.get('screen').width * 0.3}
513
- bgColor={'rgba(184, 184, 191,0.3)'}
514
- color={'#094485'}
515
- borderColor={'white'}
516
- marginHorizontal={normalize(2)}
517
- borderRadius={5}
518
- elevation={0}
519
- />
520
- <View
521
- style={{
522
- borderWidth: 0,
523
- alignItems: 'flex-start',
524
- justifyContent: 'center',
525
- height: Dimensions.get('screen').height * 0.056,
526
- }}>
527
- <TouchableOpacity
528
- style={{ marginHorizontal: normalize(5) }}
529
- onPress={handleNavigation}>
530
- <View
531
- style={{
532
- position: 'absolute',
533
- right: normalize(-5),
534
- top: normalize(-10),
535
- backgroundColor: 'white',
536
- alignItems: 'center',
537
- borderRadius: 20,
538
- width: normalize(15),
539
- borderWidth: 0.5,
540
- }}>
541
- <Text
542
- style={{
543
- color: 'black',
544
- fontSize: normalize(11),
545
- fontWeight: 'bold',
546
- }}>
547
- {freeProductsCount}
548
- </Text>
549
- </View>
550
- <Icons.FontAwesome5
551
- name="cart-arrow-down"
552
- color="#094485"
553
- size={normalize(15)}
554
- />
555
- </TouchableOpacity>
556
- </View>
557
- </View>
558
- </View>
559
- );
560
- };
561
-
562
- const OrderSection = ({
563
- productdata,
564
- i,
565
- sectionIndex,
566
- productIndex,
567
- verifyData,
568
- updateData,
569
- supplierdata,
570
- item,
571
- onProductNoteUpdate,
572
- onOrderDelete,
573
- onAddRow,
574
- onBatchUpdate,
575
- onBatchDelete,
576
- onNavigation,
577
- onMediaUpdate,
578
- onBatchVerify,
579
- onFreeQuantityUpdate,
580
- }) => {
581
- const renderBatchItem = ({ item: batchdata, index }) => (
582
- <BatchRow
583
- batchdata={batchdata}
584
- idx={index}
585
- sectionIndex={sectionIndex}
586
- productIndex={productIndex}
587
- orderIndex={i}
588
- verifyData={verifyData}
589
- updateData={updateData}
590
- supplierdata={supplierdata}
591
- productdata={productdata}
592
- item={item}
593
- onBatchUpdate={onBatchUpdate}
594
- onBatchDelete={onBatchDelete}
595
- onNavigation={onNavigation}
596
- onMediaUpdate={onMediaUpdate}
597
- onBatchVerify={onBatchVerify}
598
- onFreeQuantityUpdate={onFreeQuantityUpdate}
599
- />
600
- );
601
-
602
- const batchKeyExtractor = (batch, index) =>
603
- `${sectionIndex}-${productIndex}-${i}-${index}-${batch.batchcode || index}`;
604
-
605
- return (
606
- <View
607
- key={i}
608
- style={{
609
- paddingHorizontal: normalize(5),
610
- marginHorizontal: normalize(10),
611
- marginBottom: normalize(10),
612
- }}>
613
- <View
614
- style={{
615
- justifyContent: 'space-between',
616
- alignItems: 'center',
617
- flexDirection: 'row',
618
- }}>
619
- <Text
620
- style={{
621
- fontWeight: '500',
622
- fontSize: normalize(10),
623
- color: '#094485',
624
- width: '70%',
625
- }}>
626
- ORDER DETAILS : {productdata.purchaseorderno}
627
- </Text>
628
-
629
- {verifyData !== true && (
630
- <TouchableOpacity style={{ marginHorizontal: normalize(5) }}>
631
- <SOverlay
632
- size={16}
633
- iconcolor={'#094485'}
634
- value={''}
635
- onChangeText={val => {
636
- onProductNoteUpdate(sectionIndex, productIndex, i, val);
637
- }}
638
- />
639
- </TouchableOpacity>
640
- )}
641
- {verifyData !== true && (
642
- <TouchableOpacity
643
- style={{
644
- elevation: 0,
645
- borderRadius: 5,
646
- fontWeight: 'bold',
647
- color: 'black',
648
- width: Dimensions.get('screen').width * 0.036,
649
- paddingTop: 5,
650
- paddingBottom: 5,
651
- height: Dimensions.get('screen').height * 0.055,
652
- textAlign: 'center',
653
- marginTop: normalize(2),
654
- marginHorizontal: normalize(3),
655
- justifyContent: 'center',
656
- alignItems: 'center',
657
- }}
658
- onPress={() => onOrderDelete(sectionIndex, productIndex, i, productdata.intrpuorderdetail)}>
659
- <Icons.FontAwesome5
660
- name="trash"
661
- color="#094485"
662
- size={normalize(13)}
663
- />
664
- </TouchableOpacity>
665
- )}
666
- </View>
667
-
668
- <ScrollView
669
- horizontal={true}
670
- showsHorizontalScrollIndicator={true}
671
- keyboardShouldPersistTaps="handled"
672
- style={{ marginVertical: normalize(3) }}>
673
- <View
674
- style={{
675
- flex: 1,
676
- marginTop: 0,
677
- marginVertical: normalize(3),
678
- alignSelf: 'center',
679
- }}>
680
- <FlatList
681
- nestedScrollEnabled
682
- data={productdata?.batchdetails}
683
- renderItem={renderBatchItem}
684
- keyExtractor={batchKeyExtractor}
685
- initialNumToRender={6}
686
- maxToRenderPerBatch={10}
687
- windowSize={7}
688
- removeClippedSubviews={true}
689
- updateCellsBatchingPeriod={50}
690
- />
691
- </View>
692
- </ScrollView>
693
-
694
- {/* Add new batch */}
695
- {verifyData !== true && (
696
- <View
697
- style={{
698
- flexDirection: 'row',
699
- alignItems: 'center',
700
- justifyContent: 'flex-end',
701
- }}>
702
- <TouchableOpacity
703
- onPress={() => {
704
- if (productdata.flag != 3) {
705
- const lastBatch = productdata.batchdetails[productdata.batchdetails.length - 1];
706
- if (lastBatch?.batchname && lastBatch.batchname !== '') {
707
- onAddRow(sectionIndex, productIndex, i);
708
- } else if (productdata.batchdetails.length === 0) {
709
- onAddRow(sectionIndex, productIndex, i);
710
- } else {
711
- notifyMessage('Please fill out last row data');
712
- }
713
- } else {
714
- notifyMessage('Order deleted');
715
- }
716
- }}>
717
- <Icons.MaterialIcons
718
- name={'playlist-add'}
719
- color="#094485"
720
- size={normalize(20)}
721
- />
722
- </TouchableOpacity>
723
- </View>
724
- )}
725
- </View>
726
- );
727
- };
728
-
729
- const ProductCard = ({
730
- sectionIndex,
731
- productIndex,
732
- supplierdata,
733
- props,
734
- selectall,
735
- setSelectAll,
736
- }) => {
737
- const {
738
- responseJSON,
739
- setResponseJSON,
740
- updateData,
741
- verifyData,
742
- setSearchSelect,
743
- invoiceData,
744
- setInvoiceData,
745
- } = useContext(ContextBio);
746
-
747
- const navigation = useNavigation();
748
- const [refresh, setRefresh] = useState(0);
749
-
750
- const item = invoiceData.data[sectionIndex]?.productdetail[productIndex];
751
-
752
- useEffect(() => {
753
- if (selectall !== undefined && selectall != null) {
754
- console.log('Applying select all: true to index', productIndex);
755
- handleProductVerify(sectionIndex, productIndex, selectall);
756
- }
757
- }, [selectall]);
758
-
759
- // Update local state when invoiceData changes
760
- useEffect(() => {
761
- setRefresh(prev => prev + 1);
762
- }, [invoiceData]);
763
-
764
- // Optimized data update functions
765
- const updateInvoiceData = (updater) => {
766
- setInvoiceData(prevState => ({
767
- ...prevState,
768
- data: updater(prevState.data),
769
- EditStatus: true,
770
- }));
771
- };
772
-
773
- // Navigation function
774
- const navigationTo = (flag, batchname, batchcode, productname, purchaseIndex, batchIndex) => {
775
- const freeproductdetails = {
776
- componentname: 'CFreeProductTable',
777
- productname: productname,
778
- batchname: batchname,
779
- batchcode: batchcode,
780
- suoptiondetail: props.suoptiondetail,
781
- flag: flag,
782
- verification: verifyData,
783
- productIndex: productIndex,
784
- purchaseIndex: purchaseIndex,
785
- batchIndex: batchIndex,
786
- };
787
-
788
- setResponseJSON({
789
- ...responseJSON,
790
- freeproductdetails: freeproductdetails,
791
- });
792
-
793
- navigation.navigate('BiodataEdit', {
794
- data: freeproductdetails,
795
- });
796
- };
797
-
798
- // Batch operations
799
- const handleBatchUpdate = (field, sectionIndex, productIndex, orderIndex, batchIndex, val) => {
800
- updateInvoiceData(prevData => {
801
- const updatedData = [...prevData];
802
- const batch = updatedData[sectionIndex].productdetail[productIndex].purchaseorderdetail[orderIndex].batchdetails[batchIndex];
803
-
804
- let updates = {};
805
- switch (field) {
806
- case 'batchname':
807
- updates = {
808
- batchname: val,
809
- batchcode: batchIndex,
810
- flag: updateData === true && batch.flag !== 3 ? 2 : batch.flag !== 3 ? 1 : batch.flag,
811
- };
812
- break;
813
- case 'quantity':
814
- updates = {
815
- quantity: Number(val),
816
- totalquantity: batch.totalquantity !== undefined ? Number(val) * batch.packingquantity : batch.orderquantity,
817
- flag: updateData && batch.flag !== 3 ? 2 : batch.flag !== 3 ? 1 : batch.flag,
818
- };
819
- break;
820
- case 'packing':
821
- updates = {
822
- dropdowndata: [val],
823
- packingquantity: val.packingqty,
824
- insupacking: val.datavalue,
825
- totalquantity: batch.totalquantity !== undefined ? (batch.quantity || 1) * val.packingqty : batch.orderquantity,
826
- flag: updateData && batch.flag !== 3 ? 2 : batch.flag !== 3 ? 1 : batch.flag,
827
- };
828
- break;
829
- default:
830
- return prevData;
831
- }
832
-
833
- updatedData[sectionIndex].productdetail[productIndex].purchaseorderdetail[orderIndex].batchdetails[batchIndex] = {
834
- ...batch,
835
- ...updates,
836
- };
837
-
838
- return updatedData;
839
- });
840
- };
841
-
842
- const handleFreeQuantityUpdate = (sectionIndex, productIndex, orderIndex, batchIndex, val) => {
843
- updateInvoiceData(prevData => {
844
- const updatedData = [...prevData];
845
- const batch = updatedData[sectionIndex].productdetail[productIndex].purchaseorderdetail[orderIndex].batchdetails[batchIndex];
846
-
847
- updatedData[sectionIndex].productdetail[productIndex].purchaseorderdetail[orderIndex].batchdetails[batchIndex] = {
848
- ...batch,
849
- freequantity: Number(val),
850
- flag: updateData && batch.flag !== 3 ? 2 : batch.flag !== 3 ? 1 : batch.flag,
851
- };
852
-
853
- return updatedData;
854
- });
855
- };
856
-
857
- const handleBatchVerify = (sectionIndex, productIndex, orderIndex, batchIndex, val) => {
858
- updateInvoiceData(prevData => {
859
- const updatedData = [...prevData];
860
- updatedData[sectionIndex].productdetail[productIndex].purchaseorderdetail[orderIndex].batchdetails[batchIndex].batchverify = val;
861
- return updatedData;
862
- });
863
- };
864
-
865
- const handleMediaUpdate = (sectionIndex, productIndex, orderIndex, batchIndex, val) => {
866
- updateInvoiceData(prevData => {
867
- const updatedData = [...prevData];
868
- updatedData[sectionIndex].productdetail[productIndex].purchaseorderdetail[orderIndex].batchdetails[batchIndex].media = [val];
869
- return updatedData;
870
- });
871
- };
872
-
873
- const handleBatchDelete = (sectionIndex, productIndex, orderIndex, batchIndex) => {
874
- if (updateData === true) {
875
- updateInvoiceData(prevData => {
876
- const updatedData = [...prevData];
877
- updatedData[sectionIndex].productdetail[productIndex].purchaseorderdetail[orderIndex].batchdetails[batchIndex].flag = 3;
878
- return updatedData;
879
- });
880
- } else {
881
- updateInvoiceData(prevData => {
882
- const updatedData = [...prevData];
883
- updatedData[sectionIndex].productdetail[productIndex].purchaseorderdetail[orderIndex].batchdetails.splice(batchIndex, 1);
884
- return updatedData;
885
- });
886
- }
887
- };
888
-
889
- // Product operations
890
- const handleProductVerify = (sectionIndex, productIndex, val) => {
891
- updateInvoiceData(prevData => {
892
- const updatedData = [...prevData];
893
- const product = updatedData[sectionIndex].productdetail[productIndex];
894
-
895
- const updatedPurchaseOrders = product.purchaseorderdetail?.map(po => ({
896
- ...po,
897
- batchdetails: po.batchdetails?.map(batch => ({
898
- ...batch,
899
- batchverify: val,
900
- })) || [],
901
- })) || [];
902
-
903
- updatedData[sectionIndex].productdetail[productIndex] = {
904
- ...product,
905
- productverify: val,
906
- purchaseorderdetail: updatedPurchaseOrders,
907
- };
908
-
909
- return updatedData;
910
- });
911
- };
912
-
913
- const groupExpand = (sectionIndex, productIndex) => {
914
- if (item.flag === 3) {return;}
915
-
916
- updateInvoiceData(prevData => {
917
- const updatedData = [...prevData];
918
- updatedData[sectionIndex].productdetail[productIndex].groupexpand =
919
- !updatedData[sectionIndex].productdetail[productIndex].groupexpand;
920
- return updatedData;
921
- });
922
- };
923
-
924
- const handleDeleteProduct = (sectionIndex, productIndex) => {
925
- if (updateData === true) {
926
- updateInvoiceData(prevData => {
927
- const updatedData = [...prevData];
928
- updatedData[sectionIndex].productdetail[productIndex] = {
929
- ...updatedData[sectionIndex].productdetail[productIndex],
930
- flag: 3,
931
- groupexpand: false,
932
- };
933
- return updatedData;
934
- });
935
- } else {
936
- updateInvoiceData(prevData => {
937
- const updatedData = [...prevData];
938
- updatedData[sectionIndex].productdetail.splice(productIndex, 1);
939
- return updatedData;
940
- });
941
- }
942
- };
943
-
944
- // Order operations
945
- const handleProductNoteUpdate = (sectionIndex, productIndex, orderIndex, val) => {
946
- updateInvoiceData(prevData => {
947
- const updatedData = [...prevData];
948
- updatedData[sectionIndex].productdetail[productIndex].purchaseorderdetail[orderIndex].productnote = val;
949
- return updatedData;
950
- });
951
- };
952
-
953
- const handleOrderDelete = (sectionIndex, productIndex, orderIndex, productIdToRemove) => {
954
- if (updateData !== true) {
955
- updateInvoiceData(prevData => {
956
- const updatedData = [...prevData];
957
- updatedData[sectionIndex].productdetail[productIndex].purchaseorderdetail =
958
- updatedData[sectionIndex].productdetail[productIndex].purchaseorderdetail.filter(
959
- product => product.intrpuorderdetail !== productIdToRemove
960
- );
961
- return updatedData;
962
- });
963
- } else {
964
- updateInvoiceData(prevData => {
965
- const updatedData = [...prevData];
966
- const purchaseOrder = updatedData[sectionIndex].productdetail[productIndex].purchaseorderdetail[orderIndex];
967
-
968
- updatedData[sectionIndex].productdetail[productIndex].purchaseorderdetail[orderIndex] = {
969
- ...purchaseOrder,
970
- flag: 3,
971
- batchdetails: purchaseOrder.batchdetails.map(batch => ({
972
- ...batch,
973
- flag: 3,
974
- })),
975
- };
976
- return updatedData;
977
- });
978
- }
979
- };
980
-
981
- const addRow = (sectionIndex, productIndex, orderIndex) => {
982
- updateInvoiceData(prevData => {
983
- const updatedData = [...prevData];
984
- const purchaseOrder = updatedData[sectionIndex].productdetail[productIndex].purchaseorderdetail[orderIndex];
985
-
986
- const getQuantity = (data) => {
987
- const totalQuantity = data.reduce((sum, item) => sum + (item.quantity || 0), 0);
988
- const invoicePackingNo = data[0]?.invoicepackingno || 0;
989
- return invoicePackingNo - totalQuantity;
990
- };
991
-
992
- const newBatchDetail = {
993
- batchname: null,
994
- insuproduct: null,
995
- invoicepackingno: getQuantity(purchaseOrder.batchdetails),
996
- insupacking: null,
997
- intrpudetail: null,
998
- freeproductquantity: null,
999
- ddinsupacking: null,
1000
- packingquantity: null,
1001
- quantity: 0,
1002
- totalquantity: null,
1003
- orderquantity: getQuantity(purchaseOrder.batchdetails),
1004
- imageurl: null,
1005
- productnotes: null,
1006
- productinstruction: null,
1007
- dropdowndata: {
1008
- datavalue: 1,
1009
- displayvalue: '1 NOS',
1010
- selected: 1,
1011
- },
1012
- productquantityentry: [
1013
- {
1014
- id: 0,
1015
- insuproduct: 0,
1016
- insuproductfree: 0,
1017
- ddinsupacking: 'invget/invcommonget/rndddwdropdownselect 1,22401,8,3,5,0,1',
1018
- ddinsuproduct: 'invget/invcommonget/rndddwdropdownselect 3,0,0,0,0,0,0',
1019
- ismodified: 0,
1020
- insuproductfreename: null,
1021
- packing: null,
1022
- customer: 0,
1023
- spare: 0,
1024
- quantitynumber: 0,
1025
- batchname: null,
1026
- },
1027
- ],
1028
- };
1029
-
1030
- updatedData[sectionIndex].productdetail[productIndex].purchaseorderdetail[orderIndex].batchdetails = [
1031
- ...purchaseOrder.batchdetails,
1032
- newBatchDetail,
1033
- ];
1034
-
1035
- return updatedData;
1036
- });
1037
- };
1038
-
1039
- // Quantity calculations - recalculated on every render
1040
- const quantityData = (() => {
1041
- if (!item || !item.purchaseorderdetail) {return { totalPacking: 0, totalFree: 0, totalQuantity: 0 };}
1042
-
1043
- let totalPacking = 0;
1044
- let totalFree = 0;
1045
-
1046
- item.purchaseorderdetail.forEach(purchaseOrder => {
1047
- purchaseOrder.batchdetails.forEach(batchdata => {
1048
- // Add quantity
1049
- if (batchdata.quantity != null && !isNaN(batchdata.quantity)) {
1050
- totalPacking += Number(batchdata.quantity);
1051
- }
1052
-
1053
- // Add free quantity
1054
- if (batchdata.freequantity) {
1055
- totalFree += Number(batchdata.freequantity);
1056
- }
1057
-
1058
- // Add free products from productquantityentry
1059
- batchdata?.productquantityentry?.forEach(freeProduct => {
1060
- if (freeProduct.insuproductfree !== 0) {
1061
- totalFree += 1;
1062
- }
1063
- });
1064
- });
1065
- });
1066
-
1067
- const totalQuantity = totalPacking + totalFree;
1068
-
1069
- return { totalPacking, totalFree, totalQuantity };
1070
- })();
1071
-
1072
- // Swipe actions
1073
- const renderLeftActions = () => (
1074
- <View
1075
- style={{
1076
- // justifyContent: 'flex-start',
1077
- // alignItems: 'center',
1078
- // borderTopLeftRadius: 10,
1079
- // borderBottomLeftRadius: 10,
1080
- flexDirection: 'row',
1081
- marginTop: normalize(10),
1082
- paddingHorizontal: normalize(10),
1083
- // marginBottom: normalize(7),
1084
- }}>
1085
- <TouchableOpacity
1086
- style={{ marginLeft: normalize(5) }}
1087
- onPress={() => {
1088
- navigation.navigate('CPurchaseDetails', {
1089
- supplierCode: supplierdata?.insusupplier,
1090
- productCode: item?.insuproduct,
1091
- });
1092
- }}>
1093
- <View
1094
- style={{
1095
- backgroundColor: '#f4f5ae',
1096
- justifyContent: 'center',
1097
- alignItems: 'center',
1098
- ...CButtonShadow(),
1099
- borderRadius: normalize(5),
1100
- paddingHorizontal: normalize(3),
1101
- paddingVertical: normalize(5),
1102
- height: normalize(30),
1103
- width: normalize(30),
1104
- }}>
1105
- <HOCIcons.Entypo
1106
- name={'info-with-circle'}
1107
- size={normalize(20)}
1108
- color={Global.AppTheme.primary_color}
1109
- />
1110
- <Text
1111
- numberOfLines={1}
1112
- style={{
1113
- fontSize: normalize(8),
1114
- fontWeight: 'bold',
1115
- color: Global.AppTheme.primary_color,
1116
- }}>
1117
- Details
1118
- </Text>
1119
- </View>
1120
- </TouchableOpacity>
1121
-
1122
- <TouchableOpacity
1123
- style={{ marginLeft: normalize(5) }}
1124
- onPress={() => {
1125
- navigation.navigate('CSupplierList', {
1126
- productCode: item?.insuproduct,
1127
- });
1128
- }}>
1129
- <View
1130
- style={{
1131
- backgroundColor: '#aef5b4',
1132
- justifyContent: 'center',
1133
- alignItems: 'center',
1134
- ...CButtonShadow(),
1135
- borderRadius: normalize(5),
1136
- paddingHorizontal: normalize(3),
1137
- paddingVertical: normalize(5),
1138
- height: normalize(30),
1139
- width: normalize(30),
1140
- }}>
1141
- <HOCIcons.MaterialCommunityIcons
1142
- name={'human-dolly'}
1143
- size={normalize(20)}
1144
- color={Global.AppTheme.primary_color}
1145
- />
1146
- <Text
1147
- numberOfLines={1}
1148
- style={{
1149
- fontSize: normalize(8),
1150
- fontWeight: 'bold',
1151
- color: Global.AppTheme.primary_color,
1152
- }}>
1153
- Supplier
1154
- </Text>
1155
- </View>
1156
- </TouchableOpacity>
1157
- </View>
1158
- );
1159
-
1160
- const renderRightActions = () => (
1161
- <View
1162
- style={{
1163
- justifyContent: 'flex-start',
1164
- alignItems: 'center',
1165
- borderTopLeftRadius: 10,
1166
- borderBottomLeftRadius: 10,
1167
- flexDirection: 'row',
1168
- paddingHorizontal: normalize(10),
1169
- marginBottom: normalize(7),
1170
- }}>
1171
- {/* Add right actions if needed */}
1172
- </View>
1173
- );
1174
-
1175
- if (!item) {return null;}
1176
-
1177
- return (
1178
- <View>
1179
- {/* Item card section */}
1180
- <SwipeRow
1181
- disableLeftSwipe={false}
1182
- disableRightSwipe={false}
1183
- leftOpenValue={190}
1184
- rightOpenValue={-190}
1185
- swipeToClosePercent={10}
1186
- swipeToOpenPercent={10}
1187
- >
1188
- {/* Hidden Row (Swipe Actions) */}
1189
- <View style={{
1190
- borderWidth: 0,
1191
- flexDirection: 'row',
1192
- justifyContent: 'space-between',
1193
- minHeight: normalize(70),
1194
- }}>
1195
- <View style={{ flex: 1, alignItems: 'flex-start' }}>
1196
- {renderLeftActions && renderLeftActions()}
1197
- </View>
1198
- <View style={{ flex: 1, alignItems: 'flex-end' }}>
1199
- {renderRightActions && renderRightActions()}
1200
- </View>
1201
- </View>
1202
-
1203
- {/* Main Content */}
1204
- <TouchableOpacity
1205
- onPress={() => groupExpand(sectionIndex, productIndex)}
1206
- style={{
1207
- padding: normalize(5),
1208
- marginVertical: 5,
1209
- borderLeftWidth: normalize(10),
1210
- borderLeftColor: isNUQ(item?.color) ? item?.color : '#870808',
1211
- backgroundColor: '#faeeeb',
1212
- marginHorizontal: normalize(10),
1213
- marginBottom: normalize(10),
1214
- borderRadius: normalize(5),
1215
- shadowColor: Global.AppTheme.primary_color,
1216
- shadowOffset: { width: 4, height: 4 },
1217
- shadowOpacity: 0.6,
1218
- shadowRadius: 10,
1219
- elevation: 8,
1220
- ...CButtonShadow(),
1221
- }}>
1222
- <View>
1223
- {/* Top section with hand icon, product name and delete icon and checkbox for verify screen */}
1224
- <View
1225
- style={{
1226
- alignItems: 'center',
1227
- flexDirection: 'row',
1228
- justifyContent: 'space-between',
1229
- padding: normalize(2),
1230
- }}>
1231
- <Icons.FontAwesome5
1232
- name={'box-open'}
1233
- size={normalize(19)}
1234
- color={'#094485'}
1235
- />
1236
- <Text
1237
- adjustsFontSizeToFit
1238
- numberOfLines={2}
1239
- style={{
1240
- fontWeight: 'bold',
1241
- marginLeft: normalize(5),
1242
- fontSize: normalize(13),
1243
- color: '#094485',
1244
- marginHorizontal: normalize(5),
1245
- width: '60%',
1246
- }}>
1247
- {item.productname}
1248
- </Text>
1249
- {verifyData === true ? (
1250
- <SCheckBox
1251
- data={{ value: item.productverify, size: 20 }}
1252
- callBack={val => {
1253
- handleProductVerify(sectionIndex, productIndex, val);
1254
- }}
1255
- />
1256
- ) : item.flag === 3 ? (
1257
- <Text style={{ color: 'red' }}>Deleted</Text>
1258
- ) : (
1259
- <TouchableOpacity
1260
- onPress={() => {
1261
- handleDeleteProduct(sectionIndex, productIndex);
1262
- }}>
1263
- <Icons.FontAwesome5
1264
- name={'trash'}
1265
- size={normalize(16)}
1266
- color={'#094485'}
1267
- />
1268
- </TouchableOpacity>
1269
- )}
1270
- </View>
1271
-
1272
- {/* Bottom section with quantity and total quantity */}
1273
- <View style={{ justifyContent: 'space-between', flexDirection: 'row' }}>
1274
- <Text
1275
- adjustsFontSizeToFit
1276
- numberOfLines={2}
1277
- style={{
1278
- color: '#094485',
1279
- fontWeight: '500',
1280
- fontSize: normalize(10),
1281
- }}>
1282
- QUANTITY : {quantityData.totalPacking}
1283
- </Text>
1284
- <Text
1285
- style={{
1286
- color: '#094485',
1287
- fontWeight: '500',
1288
- fontSize: normalize(10),
1289
- }}>
1290
- FREE QUANTITY : {quantityData.totalFree}
1291
- </Text>
1292
- <Text
1293
- style={{
1294
- color: '#094485',
1295
- fontWeight: '500',
1296
- fontSize: normalize(10),
1297
- }}>
1298
- TOTAL QUANTITY : {quantityData.totalQuantity}
1299
- </Text>
1300
- </View>
1301
- </View>
1302
- </TouchableOpacity>
1303
- </SwipeRow>
1304
-
1305
- {/* Item card expanded section */}
1306
- {item.groupexpand && item.purchaseorderdetail && (
1307
- <View>
1308
- {item.purchaseorderdetail.map((productdata, i) => (
1309
- <OrderSection
1310
- key={`${sectionIndex}-${productIndex}-${i}-${productdata.intrpuorderdetail}`}
1311
- productdata={productdata}
1312
- i={i}
1313
- sectionIndex={sectionIndex}
1314
- productIndex={productIndex}
1315
- verifyData={verifyData}
1316
- updateData={updateData}
1317
- supplierdata={supplierdata}
1318
- item={item}
1319
- onProductNoteUpdate={handleProductNoteUpdate}
1320
- onOrderDelete={handleOrderDelete}
1321
- onAddRow={addRow}
1322
- onBatchUpdate={handleBatchUpdate}
1323
- onBatchDelete={handleBatchDelete}
1324
- onNavigation={navigationTo}
1325
- onMediaUpdate={handleMediaUpdate}
1326
- onBatchVerify={handleBatchVerify}
1327
- onFreeQuantityUpdate={handleFreeQuantityUpdate}
1328
- />
1329
- ))}
1330
- </View>
1331
- )}
1332
- </View>
1333
- );
1334
- };
1335
-
1336
- export default ProductCard;