@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,1452 +0,0 @@
1
- import { View, Text, TouchableOpacity, Dimensions, Platform } from 'react-native';
2
- import React, { useContext, useEffect, useMemo, useState, useCallback } from 'react';
3
- import { normalize } from '../CommonStyle/componentStyle';
4
- import { Icons } from '@jescon-technologies/react-native-ui-kit';;
5
- import { useNavigation } from '../Navigation/useNavigation';
6
-
7
- import SOverlay from '../StaticComponents/SOverlay';
8
- import { ScrollView, TouchableWithoutFeedback } from 'react-native';
9
- import CTextHeader from '../Custom/TableComponent/CTextHeader';
10
- import ContextBio from '../ContextAPI/ContextBio';
11
- import SCheckBox from '../StaticComponents/SCheckBox';
12
- import { Global } from '../../../../../src/Common/Global';
13
- import STextInputNew from './STextInputNew';
14
- import { SwipeRow } from 'react-native-swipe-list-view';
15
- import { CButtonShadow, isNUQ, notifyMessage } from '../CommonStyle/ComponentFunctions';
16
- import HOCIcons from '../HOC/HOCIcons';
17
- import { APIURL } from '../../../../../src/Common/apiConstants';
18
-
19
- const RateProductCard = ({
20
- sectionIndex,
21
- productIndex,
22
- setData,
23
- ratedata,
24
- supplierName,
25
- invoiceNumber,
26
- setRefreshView,
27
- props,
28
- selectall,
29
- setSelectAll,
30
- setIsLoading,
31
- }) => {
32
- const {
33
- responseJSON,
34
- setResponseJSON,
35
- verifyData,
36
- invoiceData,
37
- setInvoiceData,
38
- } = useContext(ContextBio);
39
-
40
- const [verify, setVerify] = useState(0);
41
- const navigation = useNavigation();
42
- const [FilesData, setFilesData] = useState({
43
- savedaudio: [],
44
- saveddoc: [],
45
- savedimages: [],
46
- savedvideo: [],
47
- });
48
-
49
- // Get the current item directly from invoiceData - this ensures real-time updates
50
- const item = invoiceData?.data?.[sectionIndex]?.productdetail?.[productIndex];
51
-
52
- if (!item) {
53
- return null;
54
- }
55
-
56
- function groupExpand(item) {
57
- handleProductInputChange(
58
- sectionIndex,
59
- productIndex,
60
- !item.groupexpand,
61
- 'groupexpand'
62
- );
63
- setVerify(verify + 1);
64
- }
65
-
66
- const totalQuantity = useMemo(() => {
67
- return item?.batchdetail?.reduce(
68
- (sum, batch) => sum + (Number(batch.packingno) || 0),
69
- 0,
70
- );
71
- }, [item?.batchdetail]);
72
-
73
- const totalProductAmount = useMemo(() => {
74
- if (!item?.batchdetail) {
75
- return 0;
76
- }
77
-
78
- return item.batchdetail.reduce((sum, batch) => {
79
- const batchActual = parseFloat(ActualAmount(batch));
80
- return sum + (isNaN(batchActual) ? 0 : batchActual);
81
- }, 0);
82
- }, [item?.batchdetail]);
83
-
84
- useEffect(() => {
85
- if (selectall != undefined && selectall != null) {
86
- handleSelectAllProducts(selectall);
87
- }
88
- }, [selectall]);
89
-
90
- function navigationTo(
91
- params,
92
- flag,
93
- batchname,
94
- batchcode,
95
- ratedata,
96
- item,
97
- batchIndex,
98
- ) {
99
- let freeproductdetails = {
100
- componentname: 'CFreeChargeandDiscount',
101
- product: params,
102
- batchname: batchname,
103
- flag: flag,
104
- batchcode: batchcode,
105
- productdetails: item,
106
- ratedata: ratedata,
107
- productIndex: productIndex,
108
- batchIndex: batchIndex,
109
- };
110
- setResponseJSON({
111
- ...responseJSON,
112
- freeproductdetails: freeproductdetails,
113
- });
114
- navigation.navigate('BiodataEdit', {
115
- data: freeproductdetails,
116
- });
117
- }
118
-
119
- function navigationToCharge(
120
- data,
121
- flag,
122
- product,
123
- array,
124
- productcode,
125
- screen,
126
- supplier,
127
- invoicenumber,
128
- ratedata,
129
- item,
130
- batchIndex,
131
- ) {
132
- const suoptiondetail = props.suoptiondetail;
133
-
134
- let chargeanddiscount = {
135
- componentname: 'CChargeAndDiscountTable',
136
- data: data,
137
- flag: flag,
138
- product: product,
139
- array: array,
140
- suoptiondetail: suoptiondetail,
141
- screen: screen,
142
- productcode: productcode,
143
- suppliername: supplier,
144
- invoicenumber: invoicenumber,
145
- productdetail: item,
146
- ratedata: ratedata,
147
- productIndex: productIndex,
148
- batchIndex: batchIndex,
149
- };
150
- setResponseJSON({
151
- ...responseJSON,
152
- chargeanddiscount: chargeanddiscount,
153
- });
154
- navigation.navigate('BiodataEdit', {
155
- data: chargeanddiscount,
156
- });
157
- }
158
-
159
- function InvoiceAmount(params) {
160
- function isValidNumber(value) {
161
- return (
162
- value !== null && value !== undefined && value !== '' && !isNaN(value)
163
- );
164
- }
165
-
166
- if (!params || !Array.isArray(params.productdetail)) {
167
- return '0.00';
168
- }
169
-
170
- const sumOfArray = params?.productdetail?.map(product => {
171
- return product.actualamount !== undefined &&
172
- product.actualamount !== null &&
173
- product.actualamount !== '' &&
174
- !isNaN(product.actualamount)
175
- ? parseFloat(product.actualamount)
176
- : 0;
177
- });
178
-
179
- params.actualamount = sumOfArray
180
- .reduce((partialSum, amount) => partialSum + amount, 0)
181
- .toFixed(2);
182
-
183
- const actualAmount =
184
- params.actualamount !== undefined &&
185
- params.actualamount !== null &&
186
- params.actualamount !== '' &&
187
- !isNaN(params.actualamount)
188
- ? parseFloat(params.actualamount)
189
- : 0;
190
-
191
- const invoiceCharge =
192
- params.invoicecharge !== undefined &&
193
- params.invoicecharge !== null &&
194
- params.invoicecharge !== '' &&
195
- !isNaN(params.invoicecharge)
196
- ? parseFloat(params.invoicecharge)
197
- : 0;
198
-
199
- const invoiceDiscount =
200
- params.invoicediscount !== undefined &&
201
- params.invoicediscount !== null &&
202
- params.invoicediscount !== '' &&
203
- !isNaN(params.invoicediscount)
204
- ? parseFloat(params.invoicediscount)
205
- : 0;
206
-
207
- const freeCharge = params?.invoicefree?.reduce(
208
- (sum, charge) => sum + charge.productcharge,
209
- 0,
210
- );
211
- const freeProductCharge = isValidNumber(freeCharge)
212
- ? parseFloat(freeCharge)
213
- : 0;
214
-
215
- params.invoiceamount = (
216
- actualAmount +
217
- invoiceCharge -
218
- invoiceDiscount
219
- ).toFixed(2);
220
-
221
- return params.invoiceamount;
222
- }
223
-
224
- function getLength(params) {
225
- let arraylength =
226
- params != undefined && params != null && params != '' ? params.length : 0;
227
- return arraylength;
228
- }
229
-
230
- // PURE calculation functions - no state updates
231
- function TotalChargeSum(params) {
232
- if (!Array.isArray(params)) {
233
- return '0.00';
234
- }
235
-
236
- const sumofarray = params?.map(charge => {
237
- return charge.productcharge != undefined &&
238
- charge.productcharge != null &&
239
- charge.productcharge != '' &&
240
- !isNaN(charge.productcharge)
241
- ? parseFloat(charge.productcharge) * (parseFloat(charge.packingno) || 1)
242
- : 0;
243
- });
244
-
245
- const totalCharge = sumofarray.reduce((partialSum, a) => partialSum + a, 0);
246
-
247
- return totalCharge.toFixed(2);
248
- }
249
-
250
- // PURE calculation functions - no state updates
251
- function TotalDiscountSum(params) {
252
- if (!Array.isArray(params)) {
253
- return '0.00';
254
- }
255
-
256
- const sumofarray = params?.map(charge => {
257
- return charge.productdiscount != undefined &&
258
- charge.productdiscount != null &&
259
- charge.productdiscount != '' &&
260
- !isNaN(charge.productdiscount)
261
- ? parseFloat(charge.productdiscount) * parseFloat(charge.packingno)
262
- : 0;
263
- });
264
-
265
- const totalDiscount = sumofarray.reduce(
266
- (partialSum, a) => partialSum + a,
267
- 0,
268
- );
269
-
270
- return totalDiscount.toFixed(2);
271
- }
272
-
273
- function handleSelectAllProducts(val) {
274
- const updatedData = JSON.parse(JSON.stringify(invoiceData.data));
275
-
276
- updatedData.forEach(section => {
277
- section.productdetail = section.productdetail.map(product => {
278
- product.productverify = val;
279
-
280
- if (Array.isArray(product.batchdetail)) {
281
- product.batchdetail = product.batchdetail.map(batch => ({
282
- ...batch,
283
- batchverify: val,
284
- }));
285
- }
286
-
287
- return product;
288
- });
289
- });
290
-
291
- setInvoiceData(prevState => ({
292
- ...prevState,
293
- data: updatedData,
294
- EditStatus: true,
295
- }));
296
- }
297
-
298
- function handleProductInputChange(sectionIndex, productIndex, val, field) {
299
- const updatedData = JSON.parse(JSON.stringify(invoiceData.data));
300
-
301
- let product = updatedData[sectionIndex].productdetail[productIndex];
302
-
303
- product[field] = val;
304
-
305
- if (field === 'productverify' && Array.isArray(product.batchdetail)) {
306
- product.batchdetail = product.batchdetail.map(batch => ({
307
- ...batch,
308
- batchverify: val,
309
- }));
310
- }
311
-
312
- if (
313
- field === 'productqualityverify' &&
314
- Array.isArray(product.batchdetail)
315
- ) {
316
- product.batchdetail = product.batchdetail.map(batch => ({
317
- ...batch,
318
- batchqualityverify: val,
319
- }));
320
- }
321
-
322
- updatedData[sectionIndex].productdetail[productIndex] = product;
323
-
324
- setInvoiceData(prevState => ({
325
- ...prevState,
326
- data: updatedData,
327
- EditStatus: true,
328
- }));
329
- }
330
-
331
- const handleBatchDetailInputChange = useCallback(
332
- (sectionIndex, productIndex, batchIndex, val, field) => {
333
- setInvoiceData(prevState => {
334
- const data = prevState?.data ?? [];
335
- if (!Array.isArray(data[sectionIndex]?.productdetail)) {
336
- return prevState;
337
- }
338
-
339
- const section = { ...data[sectionIndex] };
340
- const product = { ...section.productdetail[productIndex] };
341
- const batchdetail = [...(product.batchdetail || [])];
342
- const batch = { ...batchdetail[batchIndex], [field]: val };
343
-
344
- const rate = Number(batch.rate) || 0;
345
- const discount = Number(batch.productdiscount) || 0;
346
- const charge = Number(batch.productcharge) || 0;
347
- const packing = Number(batch.packingno) || 0;
348
- batch.actualamount = Number((rate - discount + charge) * packing).toFixed(2);
349
-
350
- batchdetail[batchIndex] = batch;
351
- product.batchdetail = batchdetail;
352
-
353
- product.totalamount = Number(
354
- batchdetail.reduce(
355
- (sum, b) => sum + (Number(b.actualamount) || 0),
356
- 0,
357
- ),
358
- ).toFixed(2);
359
-
360
- const updatedProducts = [...section.productdetail];
361
- updatedProducts[productIndex] = product;
362
- section.productdetail = updatedProducts;
363
-
364
- const updatedData = [...data];
365
- updatedData[sectionIndex] = section;
366
-
367
- return {
368
- ...prevState,
369
- data: updatedData,
370
- EditStatus: true,
371
- };
372
- });
373
- },
374
- [setInvoiceData],
375
- );
376
-
377
- function handleBatchTotalChange(
378
- sectionIndex,
379
- productIndex,
380
- batchIndex,
381
- totaldiscount,
382
- totalcharge,
383
- ) {
384
- console.log(
385
- 'handleBatchDetailInputChange called with values:',
386
- JSON.stringify(totalcharge),
387
- );
388
- setInvoiceData(prevState => {
389
- const updatedData = [...prevState.data];
390
-
391
- const updatedSection = {
392
- ...updatedData[sectionIndex],
393
- productdetail: [...updatedData[sectionIndex].productdetail],
394
- };
395
-
396
- const updatedProductDetail = {
397
- ...updatedSection.productdetail[productIndex],
398
- batchdetail: [
399
- ...updatedSection.productdetail[productIndex].batchdetail,
400
- ],
401
- };
402
-
403
- const updatedBatchDetail = {
404
- ...updatedProductDetail.batchdetail[batchIndex],
405
- batchinvoicediscount: totaldiscount,
406
- batchinvoicecharge: totalcharge,
407
- };
408
-
409
- updatedProductDetail.batchdetail[batchIndex] = updatedBatchDetail;
410
-
411
- updatedSection.productdetail[productIndex] = updatedProductDetail;
412
-
413
- updatedData[sectionIndex] = updatedSection;
414
-
415
- return {
416
- ...prevState,
417
- data: updatedData,
418
- EditStatus: true,
419
- };
420
- });
421
- }
422
-
423
- // PURE calculation - no state updates
424
- const calculateTotalAmount = useCallback((batchdetail) => {
425
- if (!batchdetail || !Array.isArray(batchdetail)) {
426
- return '0.00';
427
- }
428
-
429
- const totalAmountSum = batchdetail
430
- .reduce((sum, charge) => {
431
- const packingno = parseFloat(charge.packingno) || 0;
432
- const rate = parseFloat(charge.rate) || 0;
433
- return sum + (packingno * rate);
434
- }, 0)
435
- .toFixed(2);
436
-
437
- return isNaN(totalAmountSum) ? '0.00' : totalAmountSum;
438
- }, []);
439
-
440
- // Update data when batch details change - moved to useEffect
441
- useEffect(() => {
442
- if (!item?.batchdetail) {return;}
443
-
444
- let needsUpdate = false;
445
- const updatedBatchDetail = item.batchdetail.map(charge => {
446
- const packingno = parseFloat(charge.packingno) || 0;
447
- const rate = parseFloat(charge.rate) || 0;
448
- const calculatedTotalAmount = (packingno * rate).toFixed(2);
449
-
450
- if (charge.totalamount !== calculatedTotalAmount) {
451
- needsUpdate = true;
452
- }
453
-
454
- return {
455
- ...charge,
456
- totalamount: calculatedTotalAmount,
457
- };
458
- });
459
-
460
- if (needsUpdate) {
461
- const totalAmountSum = updatedBatchDetail
462
- .reduce((sum, charge) => sum + parseFloat(charge.totalamount), 0)
463
- .toFixed(2);
464
-
465
- setInvoiceData(prevState => {
466
- const updatedData = JSON.parse(JSON.stringify(prevState.data));
467
- updatedData[sectionIndex].productdetail[productIndex].batchdetail = updatedBatchDetail;
468
- updatedData[sectionIndex].productdetail[productIndex].totalamount = totalAmountSum;
469
-
470
- return {
471
- ...prevState,
472
- data: updatedData,
473
- };
474
- });
475
- }
476
- }, [item?.batchdetail?.length, sectionIndex, productIndex, setInvoiceData]);
477
-
478
- function ActualAmount(batchDetail) {
479
- if (!batchDetail) {
480
- return '0.00';
481
- }
482
-
483
- const rate = Number(batchDetail.rate) || 0;
484
- const discount = Number(batchDetail.productdiscount) || 0;
485
- const charge = Number(batchDetail.productcharge) || 0;
486
- const packing = Number(batchDetail.packingno) || 0;
487
-
488
- const calculatedActualAmount = (rate - discount + charge) * packing;
489
- return Number.isFinite(calculatedActualAmount)
490
- ? calculatedActualAmount.toFixed(2)
491
- : '0.00';
492
- }
493
- // PURE calculation - no state updates
494
- const calculateTotalActualAmount = useCallback((batchdetail) => {
495
- if (!batchdetail || !Array.isArray(batchdetail)) {
496
- return '0.00';
497
- }
498
-
499
- const totalActualAmountSum = batchdetail
500
- .reduce((sum, batch) => {
501
- const rate = Number(batch.rate) || 0;
502
- const discount = Number(batch.productdiscount) || 0;
503
- const charge = Number(batch.productcharge) || 0;
504
- const packing = Number(batch.packingno) || 0;
505
- return sum + ((rate - discount + charge) * packing);
506
- }, 0)
507
- .toFixed(2);
508
-
509
- return isNaN(totalActualAmountSum) ? '0.00' : totalActualAmountSum;
510
- }, []);
511
-
512
- // Update data when batch details change for actual amounts - moved to useEffect
513
- useEffect(() => {
514
- if (!item?.batchdetail) {return;}
515
-
516
- let needsUpdate = false;
517
- const updatedBatchDetail = item.batchdetail.map(batch => {
518
- const rate = Number(batch.rate) || 0;
519
- const discount = Number(batch.productdiscount) || 0;
520
- const charge = Number(batch.productcharge) || 0;
521
- const packing = Number(batch.packingno) || 0;
522
- const calculatedActualAmount = ((rate - discount + charge) * packing).toFixed(2);
523
-
524
- if (batch.totalactualamount !== calculatedActualAmount) {
525
- needsUpdate = true;
526
- }
527
-
528
- return {
529
- ...batch,
530
- totalactualamount: calculatedActualAmount,
531
- };
532
- });
533
-
534
- if (needsUpdate) {
535
- const totalActualAmountSum = updatedBatchDetail
536
- .reduce((sum, batch) => sum + parseFloat(batch.totalactualamount), 0)
537
- .toFixed(2);
538
-
539
- setInvoiceData(prevState => {
540
- const updatedData = JSON.parse(JSON.stringify(prevState.data));
541
- updatedData[sectionIndex].productdetail[productIndex].batchdetail = updatedBatchDetail;
542
- updatedData[sectionIndex].productdetail[productIndex].totalactualamount = totalActualAmountSum;
543
-
544
- return {
545
- ...prevState,
546
- data: updatedData,
547
- };
548
- });
549
- }
550
- }, [item?.batchdetail, sectionIndex, productIndex, setInvoiceData]);
551
-
552
- function handleUpdateMedia(sectionIndex, productIndex, batchIndex, val) {
553
- const updatedData = [...invoiceData.data];
554
-
555
- const section = updatedData[sectionIndex];
556
- const product = section.productdetail[productIndex];
557
-
558
- const currentBatch = product.batchdetail[batchIndex];
559
-
560
- section.productdetail[productIndex].batchdetail[batchIndex] = {
561
- ...currentBatch,
562
- media: [val],
563
- };
564
-
565
- setInvoiceData(prevState => ({
566
- ...prevState,
567
- data: updatedData,
568
- EditStatus: true,
569
- }));
570
- }
571
-
572
- const checkProduct = (products) => {
573
- for (let product of products.batchdetail) {
574
- if (!product.rate || !product.mrp) {
575
- notifyMessage(
576
- 'Please enter both Rate and MRP for all products before proceeding.'
577
- );
578
- return;
579
- }
580
- }
581
-
582
- setIsLoading(true);
583
-
584
- const groups = {
585
- option: 'rnintrpusellingpricecheck',
586
- userdata: Global.userData,
587
- purchasedata: products,
588
- };
589
-
590
- const dataset = { groups };
591
- console.log('SAVE DATA--------------------------------', JSON.stringify(dataset));
592
-
593
- if (!groups.purchasedata) {
594
- notifyMessage('No data to Verify');
595
- setIsLoading(false);
596
- return;
597
- }
598
-
599
- const buttonApi = `${APIURL}invsave/FlCommonSave`;
600
- console.log('API URL-----------------------------', buttonApi);
601
-
602
- NetworkServiceCall('post', buttonApi, dataset)
603
- .then((response) => {
604
- console.log('RESPONSE SAVE:', JSON.stringify(response));
605
-
606
- if (response.httpstatus === 200) {
607
- const isVerified = response.data.code > 1;
608
-
609
- handleProductInputChange(
610
- sectionIndex,
611
- productIndex,
612
- isVerified,
613
- 'checkproduct'
614
- );
615
-
616
- if (isVerified) {
617
- notifyMessage('Data Verified!!!!!');
618
- } else {
619
- notifyMessage('Data Not Verified!!!!!');
620
- setIsLoading(false);
621
- }
622
- } else {
623
- notifyMessage('Verification Failed!!!!! Network Error');
624
- setIsLoading(false);
625
- }
626
- })
627
- .catch((error) => {
628
- console.error('Network Error:', error);
629
- notifyMessage('Network Error Occurred');
630
- setIsLoading(false);
631
- })
632
- .finally(() => {
633
- setIsLoading(false);
634
- });
635
- };
636
-
637
- return item != undefined ? (
638
- <View>
639
- <SwipeRow
640
- leftOpenValue={190}
641
- rightOpenValue={-190}
642
- swipeToClosePercent={10}
643
- swipeToOpenPercent={10}
644
- >
645
- <View
646
- style={{
647
- flexDirection: 'row',
648
- justifyContent: 'flex-start',
649
- alignItems: 'center',
650
- paddingHorizontal: normalize(10),
651
- marginBottom: normalize(7),
652
- marginVertical: 5,
653
- borderLeftWidth: normalize(10),
654
- borderLeftColor: isNUQ(item?.color) ? item?.color : '#870808',
655
- backgroundColor: item?.checkproduct ? '#c4ffc6ff' : '#faeeeb',
656
- marginHorizontal: normalize(10),
657
- borderRadius: normalize(5),
658
- }}>
659
- <TouchableOpacity
660
- style={{
661
- marginLeft: normalize(5),
662
- }}
663
- onPress={() => {
664
- navigation.navigate('CPurchaseDetails', {
665
- productCode:
666
- invoiceData?.data[sectionIndex]?.productdetail[productIndex]
667
- ?.insuproduct,
668
- });
669
- }}>
670
- <View
671
- style={{
672
- backgroundColor: '#f4f5ae',
673
- justifyContent: 'center',
674
- alignItems: 'center',
675
- ...CButtonShadow(),
676
- borderRadius: normalize(5),
677
- paddingHorizontal: normalize(3),
678
- paddingVertical: normalize(5),
679
- height: normalize(38),
680
- width: normalize(38),
681
- }}>
682
- <HOCIcons.Entypo
683
- name={'info-with-circle'}
684
- size={normalize(20)}
685
- color={Global.AppTheme.primary_color}
686
- />
687
- <Text
688
- numberOfLines={1}
689
- style={{
690
- fontSize: normalize(8),
691
- fontWeight: 'bold',
692
- color: Global.AppTheme.primary_color,
693
- }}>
694
- Details
695
- </Text>
696
- </View>
697
- </TouchableOpacity>
698
- <TouchableOpacity
699
- style={{
700
- marginLeft: normalize(5),
701
- }}
702
- onPress={() => {
703
- navigation.navigate('CSupplierList', {
704
- productCode: item?.insuproduct,
705
- });
706
- }}>
707
- <View
708
- style={{
709
- backgroundColor: '#aef5b4',
710
- justifyContent: 'center',
711
- alignItems: 'center',
712
- ...CButtonShadow(),
713
- borderRadius: normalize(5),
714
- paddingHorizontal: normalize(3),
715
- paddingVertical: normalize(5),
716
- height: normalize(38),
717
- width: normalize(38),
718
- }}>
719
- <HOCIcons.MaterialCommunityIcons
720
- name={'human-dolly'}
721
- size={normalize(20)}
722
- color={Global.AppTheme.primary_color}
723
- />
724
- <Text
725
- numberOfLines={1}
726
- style={{
727
- fontSize: normalize(8),
728
- fontWeight: 'bold',
729
- color: Global.AppTheme.primary_color,
730
- }}>
731
- Supplier
732
- </Text>
733
- </View>
734
- </TouchableOpacity>
735
- </View>
736
-
737
- <TouchableOpacity
738
- onPress={() => groupExpand(item)}
739
- style={{
740
- padding: normalize(5),
741
- marginVertical: 5,
742
- borderLeftWidth: normalize(10),
743
- borderLeftColor: isNUQ(item?.color) ? item?.color : '#870808',
744
- backgroundColor: item?.checkproduct ? '#c4ffc6ff' : '#faeeeb',
745
- marginHorizontal: normalize(10),
746
- marginBottom: normalize(10),
747
- borderRadius: normalize(5),
748
- shadowColor: Global.AppTheme.primary_color,
749
- shadowOffset: { width: 4, height: 4 },
750
- shadowOpacity: 0.6,
751
- shadowRadius: 10,
752
- elevation: 8,
753
- ...CButtonShadow(),
754
- }}>
755
- <View>
756
- <View
757
- style={{
758
- alignItems: 'center',
759
- flexDirection: 'row',
760
- justifyContent:
761
- verifyData != true ? 'flex-start' : 'space-between',
762
- padding: normalize(2),
763
- }}>
764
- <Icons.FontAwesome5
765
- name={'box-open'}
766
- size={normalize(19)}
767
- color={'#094485'}
768
- />
769
- <Text
770
- adjustsFontSizeToFit
771
- numberOfLines={2}
772
- style={{
773
- fontWeight: 'bold',
774
- marginLeft: normalize(5),
775
- fontSize: normalize(13),
776
- color: '#094485',
777
- marginHorizontal: normalize(5),
778
- marginLeft: normalize(20),
779
- maxWidth: '75%',
780
- }}>
781
- {item.purchaseproduct}
782
- </Text>
783
-
784
- {verifyData === true ? (
785
- <SCheckBox
786
- data={{ value: item.productverify, size: 20 }}
787
- callBack={val => {
788
- handleProductInputChange(
789
- sectionIndex,
790
- productIndex,
791
- val,
792
- 'productverify',
793
- );
794
- }}
795
- />
796
- ) : null}
797
- </View>
798
-
799
- <View
800
- style={{ justifyContent: 'space-between', flexDirection: 'row' }}>
801
- <Text
802
- adjustsFontSizeToFit
803
- numberOfLines={2}
804
- style={{
805
- color: '#094485',
806
- fontWeight: '500',
807
- fontSize: normalize(10),
808
- }}>
809
- TOTAL QUANTITY :<Text>{totalQuantity}</Text>
810
- </Text>
811
- <Text
812
- style={{
813
- color: '#094485',
814
- fontWeight: '500',
815
- fontSize: normalize(10),
816
- }}>
817
- TOTAL AMOUNT :{' '}
818
- <Text>
819
- {verifyData !== true
820
- ? Number(totalProductAmount || 0).toFixed(2)
821
- : Number(item.actualamount).toFixed(2)}
822
- </Text>
823
- </Text>
824
- </View>
825
- </View>
826
- </TouchableOpacity>
827
- </SwipeRow>
828
-
829
- {item.groupexpand == true ? (
830
- <View
831
- style={{
832
- paddingHorizontal: normalize(5),
833
- marginHorizontal: normalize(10),
834
- marginBottom: normalize(10),
835
- }}>
836
- {verifyData != true ? (
837
- <View
838
- style={{
839
- justifyContent: 'flex-end',
840
- alignItems: 'center',
841
- flexDirection: 'row',
842
- }}>
843
- <TouchableOpacity>
844
- <SOverlay
845
- iconcolor={'#094485'}
846
- size={16}
847
- value={item.ratenotes}
848
- onChangeText={val => {
849
- handleProductInputChange(
850
- sectionIndex,
851
- productIndex,
852
- val,
853
- 'ratenotes',
854
- );
855
- }}
856
- />
857
- </TouchableOpacity>
858
- </View>
859
- ) : null}
860
-
861
- <ScrollView
862
- horizontal={true}
863
- showsHorizontalScrollIndicator={true}
864
- keyboardShouldPersistTaps="handled"
865
- style={{ marginVertical: normalize(3) }}>
866
- <View
867
- style={{
868
- flex: 1,
869
- marginTop: 0,
870
- marginVertical: normalize(3),
871
- alignSelf: 'center',
872
- }}>
873
- <View style={{ flexDirection: 'row' }} />
874
-
875
- {item?.batchdetail?.map((batchdata, i) => {
876
- return (
877
- <View
878
- key={i}
879
- style={{
880
- flexDirection: 'row',
881
- marginTop: normalize(1),
882
- backgroundColor: 'white',
883
- }}>
884
- <View>
885
- <CTextHeader
886
- text={'BATCH'}
887
- widthArr={Dimensions.get('screen').width * 0.26}
888
- bgColor={'rgba(184, 184, 191,0.3)'}
889
- color={'#094485'}
890
- borderColor={'lightgrey'}
891
- marginHorizontal={normalize(2)}
892
- borderRadius={5}
893
- elevation={0}
894
- />
895
- <STextInputNew
896
- data={{
897
- borderWidth: 1,
898
- borderColor: 'lightgrey',
899
- elevation: 0,
900
- borderRadius: 5,
901
- fontWeight: 'bold',
902
- color: 'black',
903
- itemwidth: Dimensions.get('screen').width * 0.26,
904
- paddingTop: 5,
905
- paddingBottom: 5,
906
- height: Dimensions.get('screen').height * 0.055,
907
- textAlign: 'center',
908
- marginTop: normalize(2),
909
- marginHorizontal: normalize(2),
910
- value: batchdata.batch,
911
- editable: false,
912
- }}
913
- />
914
- </View>
915
-
916
- <View>
917
- <CTextHeader
918
- text={'RATE'}
919
- widthArr={Dimensions.get('screen').width * 0.26}
920
- bgColor={'rgba(184, 184, 191,0.3)'}
921
- color={'#094485'}
922
- borderColor={'lightgrey'}
923
- marginHorizontal={normalize(2)}
924
- borderRadius={5}
925
- elevation={0}
926
- />
927
- <STextInputNew
928
- data={{
929
- borderWidth: 1,
930
- borderColor: 'lightgrey',
931
- elevation: 0,
932
- borderRadius: 5,
933
- fontWeight: 'bold',
934
- color: 'black',
935
- itemwidth: Dimensions.get('screen').width * 0.26,
936
- paddingTop: 5,
937
- paddingBottom: 5,
938
- height: Dimensions.get('screen').height * 0.055,
939
- textAlign: 'center',
940
- marginTop: normalize(2),
941
- marginHorizontal: normalize(2),
942
- value:
943
- verifyData != true
944
- ? batchdata.rate
945
- : Number(batchdata.rate).toFixed(2),
946
- editable: verifyData != true ? true : false,
947
- }}
948
- callBack={val => {
949
- if (val != undefined) {
950
- handleBatchDetailInputChange(
951
- sectionIndex,
952
- productIndex,
953
- i,
954
- val,
955
- 'rate',
956
- );
957
- }
958
- }}
959
- keyboardType={'numeric'}
960
- />
961
- </View>
962
-
963
- <View>
964
- <CTextHeader
965
- text={'MRP'}
966
- widthArr={Dimensions.get('screen').width * 0.26}
967
- bgColor={'rgba(184, 184, 191,0.3)'}
968
- color={'#094485'}
969
- borderColor={'lightgrey'}
970
- marginHorizontal={normalize(2)}
971
- borderRadius={5}
972
- elevation={0}
973
- />
974
- <STextInputNew
975
- data={{
976
- borderWidth: 1,
977
- borderColor: 'lightgrey',
978
- elevation: 0,
979
- borderRadius: 5,
980
- fontWeight: 'bold',
981
- color: 'black',
982
- itemwidth: Dimensions.get('screen').width * 0.26,
983
- paddingTop: 5,
984
- paddingBottom: 5,
985
- height: Dimensions.get('screen').height * 0.055,
986
- textAlign: 'center',
987
- marginTop: normalize(2),
988
- marginHorizontal: normalize(2),
989
- value:
990
- verifyData != true
991
- ? batchdata.mrp
992
- : Number(batchdata.mrp).toFixed(2) || 0,
993
- editable: verifyData != true ? true : false,
994
- }}
995
- callBack={val => {
996
- if (val != undefined) {
997
- handleBatchDetailInputChange(
998
- sectionIndex,
999
- productIndex,
1000
- i,
1001
- val,
1002
- 'mrp',
1003
- );
1004
- }
1005
- }}
1006
- keyboardType={'numeric'}
1007
- />
1008
- </View>
1009
-
1010
- <View>
1011
- <CTextHeader
1012
- text={'DISCOUNT'}
1013
- widthArr={Dimensions.get('screen').width * 0.26}
1014
- bgColor={'rgba(184, 184, 191,0.3)'}
1015
- color={'#094485'}
1016
- borderColor={'lightgrey'}
1017
- marginHorizontal={normalize(2)}
1018
- borderRadius={5}
1019
- elevation={0}
1020
- />
1021
- <TouchableWithoutFeedback
1022
- onPress={() => {
1023
- if (verifyData != true) {
1024
- navigationToCharge(
1025
- batchdata,
1026
- false,
1027
- item.purchaseproduct,
1028
- batchdata.productchargedisccount,
1029
- item.insuproduct,
1030
- 2,
1031
- supplierName,
1032
- invoiceNumber,
1033
- ratedata,
1034
- item,
1035
- i,
1036
- );
1037
- }
1038
- }}>
1039
- <Text
1040
- style={{
1041
- borderWidth: 1,
1042
- borderColor: 'lightgrey',
1043
- elevation: 0,
1044
- borderRadius: 5,
1045
- fontWeight: 'bold',
1046
- color: 'black',
1047
- width: Dimensions.get('screen').width * 0.26,
1048
- paddingTop: normalize(14),
1049
- paddingBottom: normalize(10),
1050
- height: Dimensions.get('screen').height * 0.057,
1051
- textAlign: 'center',
1052
- fontSize: normalize(11),
1053
- }}>
1054
- {verifyData != true
1055
- ? Number(batchdata.productdiscount).toFixed(2)
1056
- : Number(batchdata.productdiscount).toFixed(2)}
1057
- </Text>
1058
- </TouchableWithoutFeedback>
1059
- </View>
1060
-
1061
- <View>
1062
- <CTextHeader
1063
- text={'CHARGE'}
1064
- widthArr={Dimensions.get('screen').width * 0.26}
1065
- bgColor={'rgba(184, 184, 191,0.3)'}
1066
- color={'#094485'}
1067
- borderColor={'lightgrey'}
1068
- marginHorizontal={normalize(2)}
1069
- borderRadius={5}
1070
- elevation={0}
1071
- />
1072
- <TouchableWithoutFeedback
1073
- onPress={() => {
1074
- if (verifyData != true) {
1075
- navigationToCharge(
1076
- batchdata,
1077
- false,
1078
- item.purchaseproduct,
1079
- batchdata.productchargedisccount,
1080
- item.insuproduct,
1081
- 1,
1082
- supplierName,
1083
- invoiceNumber,
1084
- ratedata,
1085
- item,
1086
- i,
1087
- );
1088
- }
1089
- }}>
1090
- <Text
1091
- style={{
1092
- borderWidth: 1,
1093
- borderColor: 'lightgrey',
1094
- elevation: 0,
1095
- borderRadius: 5,
1096
- fontWeight: 'bold',
1097
- color: 'black',
1098
- width: Dimensions.get('screen').width * 0.26,
1099
- paddingTop: normalize(14),
1100
- paddingBottom: normalize(10),
1101
- height: Dimensions.get('screen').height * 0.057,
1102
- textAlign: 'center',
1103
- fontSize: normalize(11),
1104
- }}>
1105
- {Number(batchdata.productcharge).toFixed(2)}
1106
- </Text>
1107
- </TouchableWithoutFeedback>
1108
- </View>
1109
-
1110
- <View>
1111
- <CTextHeader
1112
- text={'ACTUAL AMOUNT'}
1113
- widthArr={Dimensions.get('screen').width * 0.26}
1114
- bgColor={'rgba(184, 184, 191,0.3)'}
1115
- color={'#094485'}
1116
- borderColor={'lightgrey'}
1117
- marginHorizontal={normalize(2)}
1118
- borderRadius={5}
1119
- elevation={0}
1120
- />
1121
- <View
1122
- style={{
1123
- borderWidth: 1,
1124
- borderColor: 'lightgrey',
1125
- elevation: 0,
1126
- borderRadius: 5,
1127
- width: Dimensions.get('screen').width * 0.26,
1128
- paddingTop: 5,
1129
- paddingBottom: 5,
1130
- height: Dimensions.get('screen').height * 0.057,
1131
- alignItems: 'flex-start',
1132
- justifyContent: 'center',
1133
- }}>
1134
- <Text
1135
- adjustsFontSizeToFit
1136
- numberOfLines={2}
1137
- style={{
1138
- fontWeight: 'bold',
1139
- color: 'black',
1140
- fontSize: normalize(11),
1141
- paddingHorizontal: normalize(10),
1142
- }}>
1143
- {verifyData != true
1144
- ? ActualAmount(batchdata)
1145
- : Number(batchdata.actualamount).toFixed(2)}
1146
- </Text>
1147
- </View>
1148
- </View>
1149
-
1150
- <View>
1151
- <CTextHeader
1152
- text={'MEDIA'}
1153
- fontSize={10}
1154
- widthArr={Dimensions.get('screen').width * 0.26}
1155
- bgColor={'rgba(184, 184, 191,0.3)'}
1156
- color={'#094485'}
1157
- borderColor={'lightgrey'}
1158
- marginHorizontal={normalize(2)}
1159
- borderRadius={5}
1160
- elevation={0}
1161
- />
1162
- <View
1163
- style={{
1164
- width: Dimensions.get('screen').width * 0.26,
1165
- height: Dimensions.get('screen').height * 0.056,
1166
- justifyContent: 'center',
1167
- alignItems: 'center',
1168
- borderWidth: 1,
1169
- borderRadius: 5,
1170
- borderColor: 'lightgrey',
1171
- }}>
1172
- <TouchableOpacity
1173
- style={{ marginHorizontal: normalize(5) }}
1174
- onPress={() => {
1175
- if (Platform.OS !== 'web') {
1176
- navigation.navigate('FileExplorer', {
1177
- visibility: 0,
1178
- data: invoiceData.data[
1179
- sectionIndex
1180
- ].productdetail[productIndex].batchdetail[
1181
- i
1182
- ].media.map(item => ({
1183
- ...item,
1184
- savedimages: Array.isArray(item.savedimages)
1185
- ? item.savedimages
1186
- : item.savedimages?.split(',') || [],
1187
- savedvideo: Array.isArray(item.savedvideo)
1188
- ? item.savedvideo
1189
- : item.savedvideo?.split(',') || [],
1190
- savedaudio: Array.isArray(item.savedaudio)
1191
- ? item.savedaudio
1192
- : item.savedaudio?.split(',') || [],
1193
- savedpdf: Array.isArray(item.savedpdf)
1194
- ? item.savedpdf
1195
- : item.savedpdf?.split(',') || [],
1196
- })),
1197
- callBack: val => {
1198
- setFilesData(val);
1199
- handleUpdateMedia(
1200
- sectionIndex,
1201
- productIndex,
1202
- i,
1203
- val,
1204
- );
1205
- },
1206
- });
1207
- }
1208
- }}>
1209
- <Icons.FontAwesome5
1210
- name="play"
1211
- color="#094485"
1212
- size={normalize(15)}
1213
- />
1214
- </TouchableOpacity>
1215
- </View>
1216
- </View>
1217
-
1218
- {verifyData === true ? (
1219
- <View>
1220
- <CTextHeader
1221
- text={'VERIFY'}
1222
- widthArr={Dimensions.get('screen').width * 0.26}
1223
- bgColor={'rgba(184, 184, 191,0.3)'}
1224
- color={'#094485'}
1225
- borderColor={'lightgrey'}
1226
- marginHorizontal={normalize(2)}
1227
- borderRadius={5}
1228
- elevation={0}
1229
- />
1230
- <View
1231
- style={{
1232
- width: Dimensions.get('screen').width * 0.26,
1233
- height: Dimensions.get('screen').height * 0.055,
1234
- justifyContent: 'center',
1235
- alignItems: 'center',
1236
- borderWidth: 1,
1237
- borderRadius: 5,
1238
- borderColor: 'lightgrey',
1239
- }}>
1240
- <SCheckBox
1241
- data={{ value: batchdata.batchverify, size: 20 }}
1242
- callBack={val => {
1243
- handleBatchDetailInputChange(
1244
- sectionIndex,
1245
- productIndex,
1246
- i,
1247
- val,
1248
- 'batchverify',
1249
- );
1250
- }}
1251
- />
1252
- </View>
1253
- </View>
1254
- ) : null}
1255
-
1256
- <View>
1257
- <CTextHeader
1258
- text={''}
1259
- widthArr={Dimensions.get('screen').width * 0.3}
1260
- bgColor={'rgba(184, 184, 191,0.3)'}
1261
- color={'#094485'}
1262
- borderColor={'white'}
1263
- marginHorizontal={normalize(2)}
1264
- borderRadius={5}
1265
- elevation={0}
1266
- />
1267
- <View
1268
- style={{
1269
- borderWidth: 0,
1270
- alignItems: 'flex-start',
1271
- justifyContent: 'center',
1272
- marginTop: normalize(15),
1273
- }}>
1274
- <TouchableOpacity
1275
- style={{ marginHorizontal: normalize(5) }}
1276
- onPress={() => {
1277
- navigationTo(
1278
- item.purchaseproduct,
1279
- false,
1280
- batchdata.batch,
1281
- batchdata.batchcode,
1282
- ratedata,
1283
- item,
1284
- i,
1285
- );
1286
- }}>
1287
- <View
1288
- style={{
1289
- position: 'absolute',
1290
- right: normalize(-5),
1291
- top: normalize(-10),
1292
- backgroundColor: 'white',
1293
- alignItems: 'center',
1294
- borderRadius: 20,
1295
- width: normalize(15),
1296
- borderWidth: 0.5,
1297
- }}>
1298
- <Text
1299
- style={{
1300
- color: 'black',
1301
- fontSize: normalize(11),
1302
- fontWeight: 'bold',
1303
- }}>
1304
- {getLength(batchdata.productfree)}
1305
- </Text>
1306
- </View>
1307
- <Icons.FontAwesome5
1308
- name="cart-arrow-down"
1309
- color="#094485"
1310
- size={normalize(15)}
1311
- />
1312
- </TouchableOpacity>
1313
- </View>
1314
- </View>
1315
- </View>
1316
- );
1317
- })}
1318
- </View>
1319
- </ScrollView>
1320
-
1321
- <View
1322
- style={{
1323
- height: normalize(30),
1324
- borderWidth: 0,
1325
- width: '100%',
1326
- marginVertical: normalize(5),
1327
- backgroundColor: 'rgba(184, 184, 191,0.3)',
1328
- }}>
1329
- <View
1330
- style={{ justifyContent: 'space-between', flexDirection: 'row' }}>
1331
- <View
1332
- style={{ borderWidth: 0, alignItems: 'center', width: '20%' }}>
1333
- <Text
1334
- adjustsFontSizeToFit
1335
- numberOfLines={2}
1336
- style={{
1337
- color: '#094485',
1338
- fontWeight: 'bold',
1339
- fontSize: normalize(12),
1340
- width: '100%',
1341
- textAlign: 'center',
1342
- }}>
1343
- {verifyData != true
1344
- ? calculateTotalAmount(item.batchdetail)
1345
- : Number(item.totalamount).toFixed(2)}
1346
- </Text>
1347
- <Text
1348
- adjustsFontSizeToFit
1349
- style={{
1350
- color: '#094485',
1351
- fontWeight: '500',
1352
- fontSize: normalize(8),
1353
- borderWidth: 0,
1354
- width: '100%',
1355
- textAlign: 'center',
1356
- }}>
1357
- TOTAL AMOUNT
1358
- </Text>
1359
- </View>
1360
- <View
1361
- style={{ borderWidth: 0, alignItems: 'center', width: '20%' }}>
1362
- <Text
1363
- adjustsFontSizeToFit
1364
- numberOfLines={2}
1365
- style={{
1366
- color: '#094485',
1367
- fontWeight: 'bold',
1368
- fontSize: normalize(12),
1369
- width: '100%',
1370
- textAlign: 'center',
1371
- }}>
1372
- {TotalDiscountSum(item.batchdetail, item)}
1373
- </Text>
1374
- <Text
1375
- adjustsFontSizeToFit
1376
- style={{
1377
- color: '#094485',
1378
- fontWeight: '500',
1379
- fontSize: normalize(8),
1380
- borderWidth: 0,
1381
- width: '100%',
1382
- textAlign: 'center',
1383
- }}>
1384
- TOTAL DISCOUNT
1385
- </Text>
1386
- </View>
1387
- <View
1388
- style={{ borderWidth: 0, alignItems: 'center', width: '20%' }}>
1389
- <Text
1390
- adjustsFontSizeToFit
1391
- numberOfLines={2}
1392
- style={{
1393
- color: '#094485',
1394
- fontWeight: 'bold',
1395
- fontSize: normalize(12),
1396
- width: '100%',
1397
- textAlign: 'center',
1398
- }}>
1399
- {TotalChargeSum(item.batchdetail, item)}
1400
- </Text>
1401
- <Text
1402
- adjustsFontSizeToFit
1403
- style={{
1404
- color: '#094485',
1405
- fontWeight: '500',
1406
- fontSize: normalize(8),
1407
- borderWidth: 0,
1408
- width: '100%',
1409
- textAlign: 'center',
1410
- }}>
1411
- TOTAL CHARGE
1412
- </Text>
1413
- </View>
1414
- <View
1415
- style={{ borderWidth: 0, alignItems: 'center', width: '20%' }}>
1416
- <Text
1417
- adjustsFontSizeToFit
1418
- numberOfLines={2}
1419
- style={{
1420
- color: '#094485',
1421
- fontWeight: 'bold',
1422
- fontSize: normalize(12),
1423
- width: '100%',
1424
- textAlign: 'center',
1425
- }}>
1426
- {verifyData != true
1427
- ? calculateTotalActualAmount(item.batchdetail)
1428
- : Number(item.actualamount).toFixed(2)}
1429
- </Text>
1430
- <Text
1431
- adjustsFontSizeToFit
1432
- style={{
1433
- color: '#094485',
1434
- fontWeight: '500',
1435
- fontSize: normalize(8),
1436
- borderWidth: 0,
1437
- width: '100%',
1438
- textAlign: 'center',
1439
- }}>
1440
- ACTUAL AMOUNT
1441
- </Text>
1442
- </View>
1443
- </View>
1444
- </View>
1445
- </View>
1446
- ) : null}
1447
- </View>
1448
- ) : null;
1449
- };
1450
-
1451
- // Remove React.memo - export the component directly without memoization
1452
- export default RateProductCard;