@os1-platform/dispatch-mobile 2.1.1 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/lib/commonjs/components/executiontasks/deliver/DeliverETInput.js.map +1 -1
  2. package/lib/commonjs/components/executiontasks/deliver/SLDeliverET.js +9 -4
  3. package/lib/commonjs/components/executiontasks/deliver/SLDeliverET.js.map +1 -1
  4. package/lib/commonjs/components/executiontasks/doodle/SignatureET.js +78 -36
  5. package/lib/commonjs/components/executiontasks/doodle/SignatureET.js.map +1 -1
  6. package/lib/commonjs/components/executiontasks/doodle/SignatureSchema.js.map +1 -1
  7. package/lib/commonjs/components/executiontasks/dropCash/DropCashSchema.js.map +1 -1
  8. package/lib/commonjs/components/executiontasks/dropCash/SLDropCash.js +1 -1
  9. package/lib/commonjs/components/executiontasks/dropCash/SLDropCash.js.map +1 -1
  10. package/lib/commonjs/components/executiontasks/forms/FormGenerator.js +1 -1
  11. package/lib/commonjs/components/executiontasks/forms/FormGenerator.js.map +1 -1
  12. package/lib/commonjs/components/executiontasks/forms/FormSchema.js.map +1 -1
  13. package/lib/commonjs/components/executiontasks/imageCapture/CaptureSchema.js.map +1 -1
  14. package/lib/commonjs/components/executiontasks/imageCapture/CaptureUtils.js +2 -3
  15. package/lib/commonjs/components/executiontasks/imageCapture/CaptureUtils.js.map +1 -1
  16. package/lib/commonjs/components/executiontasks/imageCapture/ImageCapture.js +223 -127
  17. package/lib/commonjs/components/executiontasks/imageCapture/ImageCapture.js.map +1 -1
  18. package/lib/commonjs/components/executiontasks/imageCapture/camera.svg +3 -0
  19. package/lib/commonjs/components/executiontasks/imageCapture/circle-xmark.svg +5 -0
  20. package/lib/commonjs/components/executiontasks/payments/completePayment/CompletePaymentET.js +1 -1
  21. package/lib/commonjs/components/executiontasks/payments/completePayment/CompletePaymentET.js.map +1 -1
  22. package/lib/commonjs/components/executiontasks/payments/completePayment/CompletePaymentSchema.js.map +1 -1
  23. package/lib/commonjs/components/executiontasks/payments/init/InitPaymentET.js +1 -1
  24. package/lib/commonjs/components/executiontasks/payments/init/InitPaymentET.js.map +1 -1
  25. package/lib/commonjs/components/executiontasks/payments/init/InitPaymentSchema.js.map +1 -1
  26. package/lib/commonjs/components/executiontasks/payments/processPayment/ProcessPaymentET.js +1 -1
  27. package/lib/commonjs/components/executiontasks/payments/processPayment/ProcessPaymentET.js.map +1 -1
  28. package/lib/commonjs/components/executiontasks/payments/processPayment/ProcessPaymentSchema.js.map +1 -1
  29. package/lib/commonjs/components/executiontasks/pickup/PickpSchema.js.map +1 -1
  30. package/lib/commonjs/components/executiontasks/pickup/SLPickupET.js +1 -1
  31. package/lib/commonjs/components/executiontasks/pickup/SLPickupET.js.map +1 -1
  32. package/lib/commonjs/constants/constants.js +1 -1
  33. package/lib/commonjs/constants/constants.js.map +1 -1
  34. package/lib/commonjs/index.js +7 -0
  35. package/lib/commonjs/index.js.map +1 -1
  36. package/lib/commonjs/locale/Str.js +3 -1
  37. package/lib/commonjs/locale/Str.js.map +1 -1
  38. package/lib/commonjs/locale/en.json +2 -1
  39. package/lib/commonjs/locale/i18n.js +5 -1
  40. package/lib/commonjs/locale/i18n.js.map +1 -1
  41. package/lib/commonjs/manager/syncmanager/DBConfig.js +1 -1
  42. package/lib/commonjs/manager/syncmanager/DBConfig.js.map +1 -1
  43. package/lib/commonjs/styles/executionTasks/CommonStyles.js +2 -1
  44. package/lib/commonjs/styles/executionTasks/CommonStyles.js.map +1 -1
  45. package/lib/commonjs/ui/screens/DeliverScreen.js +24 -5
  46. package/lib/commonjs/ui/screens/DeliverScreen.js.map +1 -1
  47. package/lib/commonjs/ui/screens/DoodleScreen.js +22 -1
  48. package/lib/commonjs/ui/screens/DoodleScreen.js.map +1 -1
  49. package/lib/commonjs/ui/screens/DropCashScreen.js +24 -5
  50. package/lib/commonjs/ui/screens/DropCashScreen.js.map +1 -1
  51. package/lib/commonjs/ui/screens/FormsScreen.js +22 -1
  52. package/lib/commonjs/ui/screens/FormsScreen.js.map +1 -1
  53. package/lib/commonjs/ui/screens/ImageCaptureScreen.js +24 -5
  54. package/lib/commonjs/ui/screens/ImageCaptureScreen.js.map +1 -1
  55. package/lib/commonjs/ui/screens/PaymentScreen.js +25 -4
  56. package/lib/commonjs/ui/screens/PaymentScreen.js.map +1 -1
  57. package/lib/commonjs/ui/screens/PickupScreen.js +31 -5
  58. package/lib/commonjs/ui/screens/PickupScreen.js.map +1 -1
  59. package/lib/commonjs/utils/helper.js +46 -3
  60. package/lib/commonjs/utils/helper.js.map +1 -1
  61. package/lib/module/components/executiontasks/deliver/DeliverETInput.js.map +1 -1
  62. package/lib/module/components/executiontasks/deliver/SLDeliverET.js +9 -4
  63. package/lib/module/components/executiontasks/deliver/SLDeliverET.js.map +1 -1
  64. package/lib/module/components/executiontasks/doodle/SignatureET.js +78 -36
  65. package/lib/module/components/executiontasks/doodle/SignatureET.js.map +1 -1
  66. package/lib/module/components/executiontasks/doodle/SignatureSchema.js.map +1 -1
  67. package/lib/module/components/executiontasks/dropCash/DropCashSchema.js.map +1 -1
  68. package/lib/module/components/executiontasks/dropCash/SLDropCash.js +1 -1
  69. package/lib/module/components/executiontasks/dropCash/SLDropCash.js.map +1 -1
  70. package/lib/module/components/executiontasks/forms/FormGenerator.js +1 -1
  71. package/lib/module/components/executiontasks/forms/FormGenerator.js.map +1 -1
  72. package/lib/module/components/executiontasks/forms/FormSchema.js.map +1 -1
  73. package/lib/module/components/executiontasks/imageCapture/CaptureSchema.js.map +1 -1
  74. package/lib/module/components/executiontasks/imageCapture/CaptureUtils.js +2 -3
  75. package/lib/module/components/executiontasks/imageCapture/CaptureUtils.js.map +1 -1
  76. package/lib/module/components/executiontasks/imageCapture/ImageCapture.js +226 -130
  77. package/lib/module/components/executiontasks/imageCapture/ImageCapture.js.map +1 -1
  78. package/lib/module/components/executiontasks/imageCapture/camera.svg +3 -0
  79. package/lib/module/components/executiontasks/imageCapture/circle-xmark.svg +5 -0
  80. package/lib/module/components/executiontasks/payments/completePayment/CompletePaymentET.js +1 -1
  81. package/lib/module/components/executiontasks/payments/completePayment/CompletePaymentET.js.map +1 -1
  82. package/lib/module/components/executiontasks/payments/completePayment/CompletePaymentSchema.js.map +1 -1
  83. package/lib/module/components/executiontasks/payments/init/InitPaymentET.js +1 -1
  84. package/lib/module/components/executiontasks/payments/init/InitPaymentET.js.map +1 -1
  85. package/lib/module/components/executiontasks/payments/init/InitPaymentSchema.js.map +1 -1
  86. package/lib/module/components/executiontasks/payments/processPayment/ProcessPaymentET.js +1 -1
  87. package/lib/module/components/executiontasks/payments/processPayment/ProcessPaymentET.js.map +1 -1
  88. package/lib/module/components/executiontasks/payments/processPayment/ProcessPaymentSchema.js.map +1 -1
  89. package/lib/module/components/executiontasks/pickup/PickpSchema.js.map +1 -1
  90. package/lib/module/components/executiontasks/pickup/SLPickupET.js +1 -1
  91. package/lib/module/components/executiontasks/pickup/SLPickupET.js.map +1 -1
  92. package/lib/module/constants/constants.js +1 -1
  93. package/lib/module/constants/constants.js.map +1 -1
  94. package/lib/module/index.js +2 -0
  95. package/lib/module/index.js.map +1 -1
  96. package/lib/module/locale/Str.js +3 -1
  97. package/lib/module/locale/Str.js.map +1 -1
  98. package/lib/module/locale/en.json +2 -1
  99. package/lib/module/locale/i18n.js +5 -1
  100. package/lib/module/locale/i18n.js.map +1 -1
  101. package/lib/module/manager/syncmanager/DBConfig.js +1 -1
  102. package/lib/module/manager/syncmanager/DBConfig.js.map +1 -1
  103. package/lib/module/styles/executionTasks/CommonStyles.js +2 -1
  104. package/lib/module/styles/executionTasks/CommonStyles.js.map +1 -1
  105. package/lib/module/ui/screens/DeliverScreen.js +24 -5
  106. package/lib/module/ui/screens/DeliverScreen.js.map +1 -1
  107. package/lib/module/ui/screens/DoodleScreen.js +22 -1
  108. package/lib/module/ui/screens/DoodleScreen.js.map +1 -1
  109. package/lib/module/ui/screens/DropCashScreen.js +25 -5
  110. package/lib/module/ui/screens/DropCashScreen.js.map +1 -1
  111. package/lib/module/ui/screens/FormsScreen.js +22 -1
  112. package/lib/module/ui/screens/FormsScreen.js.map +1 -1
  113. package/lib/module/ui/screens/ImageCaptureScreen.js +24 -5
  114. package/lib/module/ui/screens/ImageCaptureScreen.js.map +1 -1
  115. package/lib/module/ui/screens/PaymentScreen.js +25 -4
  116. package/lib/module/ui/screens/PaymentScreen.js.map +1 -1
  117. package/lib/module/ui/screens/PickupScreen.js +31 -5
  118. package/lib/module/ui/screens/PickupScreen.js.map +1 -1
  119. package/lib/module/utils/helper.js +46 -4
  120. package/lib/module/utils/helper.js.map +1 -1
  121. package/lib/typescript/components/executiontasks/deliver/DeliverETInput.d.ts +1 -0
  122. package/lib/typescript/components/executiontasks/doodle/SignatureSchema.d.ts +1 -0
  123. package/lib/typescript/components/executiontasks/dropCash/DropCashSchema.d.ts +1 -0
  124. package/lib/typescript/components/executiontasks/forms/FormSchema.d.ts +1 -0
  125. package/lib/typescript/components/executiontasks/imageCapture/CaptureSchema.d.ts +1 -0
  126. package/lib/typescript/components/executiontasks/imageCapture/CaptureUtils.d.ts +6 -1
  127. package/lib/typescript/components/executiontasks/imageCapture/ImageCapture.d.ts +1 -2
  128. package/lib/typescript/components/executiontasks/payments/completePayment/CompletePaymentSchema.d.ts +1 -0
  129. package/lib/typescript/components/executiontasks/payments/init/InitPaymentSchema.d.ts +1 -0
  130. package/lib/typescript/components/executiontasks/payments/processPayment/ProcessPaymentSchema.d.ts +1 -0
  131. package/lib/typescript/components/executiontasks/pickup/PickpSchema.d.ts +1 -0
  132. package/lib/typescript/constants/constants.d.ts +1 -1
  133. package/lib/typescript/index.d.ts +2 -0
  134. package/lib/typescript/locale/Str.d.ts +2 -0
  135. package/lib/typescript/manager/syncmanager/DBConfig.d.ts +1 -1
  136. package/lib/typescript/styles/executionTasks/CommonStyles.d.ts +1 -0
  137. package/lib/typescript/utils/helper.d.ts +4 -3
  138. package/package.json +4 -5
  139. package/src/components/executiontasks/deliver/DeliverETInput.ts +1 -0
  140. package/src/components/executiontasks/deliver/SLDeliverET.tsx +13 -6
  141. package/src/components/executiontasks/doodle/SignatureET.tsx +48 -43
  142. package/src/components/executiontasks/doodle/SignatureSchema.ts +1 -0
  143. package/src/components/executiontasks/dropCash/DropCashSchema.ts +1 -0
  144. package/src/components/executiontasks/dropCash/SLDropCash.tsx +4 -4
  145. package/src/components/executiontasks/forms/FormGenerator.tsx +4 -3
  146. package/src/components/executiontasks/forms/FormSchema.ts +1 -0
  147. package/src/components/executiontasks/imageCapture/CaptureSchema.ts +1 -0
  148. package/src/components/executiontasks/imageCapture/CaptureUtils.ts +4 -9
  149. package/src/components/executiontasks/imageCapture/ImageCapture.tsx +279 -185
  150. package/src/components/executiontasks/imageCapture/camera.svg +3 -0
  151. package/src/components/executiontasks/imageCapture/circle-xmark.svg +5 -0
  152. package/src/components/executiontasks/payments/completePayment/CompletePaymentET.tsx +2 -1
  153. package/src/components/executiontasks/payments/completePayment/CompletePaymentSchema.ts +1 -0
  154. package/src/components/executiontasks/payments/init/InitPaymentET.tsx +2 -3
  155. package/src/components/executiontasks/payments/init/InitPaymentSchema.ts +1 -0
  156. package/src/components/executiontasks/payments/processPayment/ProcessPaymentET.tsx +3 -2
  157. package/src/components/executiontasks/payments/processPayment/ProcessPaymentSchema.ts +1 -0
  158. package/src/components/executiontasks/pickup/PickpSchema.ts +1 -0
  159. package/src/components/executiontasks/pickup/SLPickupET.tsx +5 -3
  160. package/src/constants/constants.ts +1 -1
  161. package/src/index.tsx +4 -2
  162. package/src/locale/Str.ts +3 -1
  163. package/src/locale/en.json +2 -1
  164. package/src/locale/i18n.ts +5 -1
  165. package/src/manager/syncmanager/DBConfig.ts +1 -1
  166. package/src/styles/executionTasks/CommonStyles.ts +1 -0
  167. package/src/ui/screens/DeliverScreen.tsx +27 -8
  168. package/src/ui/screens/DoodleScreen.tsx +25 -2
  169. package/src/ui/screens/DropCashScreen.tsx +27 -8
  170. package/src/ui/screens/FormsScreen.tsx +23 -1
  171. package/src/ui/screens/ImageCaptureScreen.tsx +29 -11
  172. package/src/ui/screens/PaymentScreen.tsx +32 -10
  173. package/src/ui/screens/PickupScreen.tsx +35 -8
  174. package/src/utils/helper.ts +47 -4
@@ -1,65 +1,41 @@
1
- import React, {
2
- useCallback,
3
- useEffect,
4
- useState,
5
- useLayoutEffect,
6
- } from 'react';
7
- import {
8
- BackHandler,
9
- FlatList,
10
- Image,
11
- Platform,
12
- StyleSheet,
13
- Text,
14
- View,
15
- } from 'react-native';
16
- import type { CaptureInput, ImageData } from './CaptureSchema';
1
+ import React, { useCallback, useEffect, useState, useLayoutEffect } from 'react';
2
+ import { BackHandler, FlatList, Image, Platform, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
17
3
  import * as CaptureUtils from './CaptureUtils';
18
4
  import { getCaptureOutput } from './CaptureUtils';
19
5
  import { showToast } from '../../widgets/Toaster';
20
6
  import SdkColors, { ColorTheme } from '../../../styles/SdkColors';
21
- import Icon from 'react-native-vector-icons/MaterialIcons';
22
- import {
23
- CommonStyles,
24
- Fonts,
25
- } from '../../../styles/executionTasks/CommonStyles';
7
+ import Icon from 'react-native-vector-icons/Feather';
8
+ import Iconn from 'react-native-vector-icons/MaterialIcons';
9
+ import { CommonStyles, Fonts } from '../../../styles/executionTasks/CommonStyles';
26
10
  import { getBaseETResponse } from '../../../utils/ExecTaskUtils';
27
- import {
28
- EntityCode,
29
- ExecutionTaskID,
30
- } from '../../../models/execTasks/ETConfig';
11
+ import { EntityCode, ExecutionTaskID } from '../../../models/execTasks/ETConfig';
31
12
  import { getEventCodeByET } from '../../../manager/dispatchCodes/EventCodeContainer';
32
13
  import { GO_BACK_EVENT_CODE } from '../../../constants/constants';
33
- import { Button, Modal, Portal, Provider } from 'react-native-paper';
14
+ import { Button, Provider } from 'react-native-paper';
34
15
  import Logger, { LOG_TYPE } from '../../../utils/Logger';
35
16
  import { hasGoBackConnector } from '../../../components/utils';
36
17
  import GoBackModal from '../../../components/widgets/GoBackModal';
37
18
  import { useFocusEffect } from '@react-navigation/native';
19
+ import Circle from "./circle-xmark.svg"
38
20
 
39
- const ImageItem = ({ item, onPress }: { item: ImageData; onPress: any }) => (
40
- <View style={{ marginEnd: 8 }}>
41
- <Image source={{ uri: item.path }} style={styles.image} />
42
- <Icon
43
- onPress={onPress}
44
- name="highlight-remove"
45
- color={'red'}
46
- size={32}
47
- style={{
48
- position: 'absolute',
49
- right: 5,
50
- top: 5,
51
- }}
52
- />
53
- </View>
54
- );
21
+ import CameraIcon from "./camera.svg"
55
22
 
56
- const ImageCapture = (props: CaptureInput) => {
57
- const [images, setImages] = useState<Array<ImageData>>([]);
23
+ const ImageCapture = (props: any) => {
24
+ let numberOfImagesToCapture: any;
25
+ if (props.captureMode == "SINGLE") {
26
+ numberOfImagesToCapture = 1;
27
+ } else if (props.captureMode === 'MULTI' && props.captureCountLimit && props.captureCountLimit > 0) {
28
+ numberOfImagesToCapture = props.captureCountLimit;
29
+ }
30
+
31
+ const [images, setImages] = useState([]);
32
+ const [imagesDummy, setImagesDummy] = useState<any[]>([]);
58
33
  const [showCapture, setShowCapture] = useState(true);
59
34
  const [disableProceed, setDisableProceed] = useState(false);
60
35
  const [showBackModal, setShowBackModal] = useState(false);
36
+ const [buttonProceed, setButtonProceed] = useState(false);
37
+ const [numColumns, setNumColumns] = useState(numberOfImagesToCapture <= 2 ? 1 : 2);
61
38
 
62
- // Handle back-button click
63
39
  useFocusEffect(
64
40
  React.useCallback(() => {
65
41
  const onBackPress = () => {
@@ -85,7 +61,7 @@ const ImageCapture = (props: CaptureInput) => {
85
61
  title: props.title,
86
62
  headerLeft: () => {
87
63
  return (
88
- <Icon
64
+ <Iconn
89
65
  onPress={() => {
90
66
  if (
91
67
  props.taskMeta?.enableGoBack &&
@@ -107,6 +83,121 @@ const ImageCapture = (props: CaptureInput) => {
107
83
  });
108
84
  }, [props.navigation, props.title]);
109
85
 
86
+ useEffect(() => {
87
+
88
+ if (images.length === 0) {
89
+ let arr: any = [];
90
+ for (let i = 0; i < numberOfImagesToCapture; i++) {
91
+ arr.push({ path: '' });
92
+ }
93
+ setImages(arr);
94
+ }
95
+ }, [images]);
96
+
97
+
98
+ interface ImageItemProps {
99
+ item: { path: string };
100
+ index: number;
101
+ onPress: () => void;
102
+ }
103
+
104
+ const ImageItem: React.FC<ImageItemProps> = ({ item, index, onPress }) => {
105
+
106
+ return (
107
+ <View
108
+ style={{
109
+ width: numColumns == 2 ? '43%' : '88%',
110
+ height: numColumns == 2 ? 160 : numberOfImagesToCapture == 1 ? 336 : 180,
111
+ backgroundColor: 'white',
112
+ alignItems: 'center',
113
+ alignSelf: 'center',
114
+ borderWidth: 1,
115
+ borderColor: '#A3AAC2',
116
+ borderStyle: 'dashed',
117
+ borderRadius: 3,
118
+ marginTop: '6%',
119
+ marginStart: numColumns == 2 ? 17 : numberOfImagesToCapture == 1 ? 0 : 0,
120
+ }}
121
+ >
122
+ <View
123
+ style={{
124
+ alignItems: 'center',
125
+ width: '80%',
126
+ height: '98%',
127
+ borderRadius: 3,
128
+ }}
129
+ >
130
+ {imagesDummy?.length > index && imagesDummy[index]?.path ? null : (
131
+ <TouchableOpacity
132
+ onPress={onPress}>
133
+ <View
134
+ style={{
135
+ marginTop:
136
+ numColumns === 2 ? '32%' : numberOfImagesToCapture === 1 ? '50%' : '20%',
137
+ }}
138
+ >
139
+ <CameraIcon />
140
+ </View>
141
+ </TouchableOpacity>
142
+
143
+ )}
144
+ <Button
145
+ onPress={() => captureImage(index)}
146
+ uppercase={false}
147
+ labelStyle={[
148
+ {
149
+ fontFamily: Fonts.IBMPlexSans_500Medium,
150
+ fontStyle: 'normal',
151
+ fontWeight: 'normal',
152
+ fontSize: 14,
153
+ letterSpacing: 0.25,
154
+ color: '#5B80F7',
155
+ },
156
+ ]}
157
+ >
158
+ {imagesDummy?.length > index && imagesDummy[index]?.path ? null : 'Click Photo'}
159
+ </Button>
160
+ <Image
161
+ source={{
162
+ uri: imagesDummy?.length > index ? imagesDummy[index]?.path : item?.path,
163
+ }}
164
+ style={{
165
+ height: numColumns == 2 ? '75%' : numberOfImagesToCapture == 1 ? '85%' : '85%',
166
+ width: numColumns == 2 ? '105%' : '118%',
167
+ borderRadius: 10,
168
+ bottom:
169
+ numColumns == 2 ? '6%' : numberOfImagesToCapture == 1 ? '2%' : '11%',
170
+ }}
171
+ />
172
+ <TouchableOpacity
173
+ onPress={onPress}
174
+ style={{
175
+ position: 'absolute',
176
+ top: numColumns == 2 ? '17%' : '9%',
177
+ marginRight: '2%',
178
+ }}
179
+ >
180
+ {imagesDummy?.length > index && imagesDummy[index]?.path && (
181
+ <View
182
+ style={{
183
+ width: 25,
184
+ height: 25,
185
+ backgroundColor: 'white',
186
+ borderRadius: 15,
187
+ alignItems: 'center',
188
+ justifyContent: 'center',
189
+ marginLeft: numColumns == 2 ? '78%' : '96%',
190
+ }}
191
+ >
192
+ <Circle />
193
+ </View>
194
+ )}
195
+ </TouchableOpacity>
196
+ </View>
197
+ </View>
198
+ );
199
+ };
200
+
110
201
  const renderModal = () => {
111
202
  return (
112
203
  <GoBackModal
@@ -133,26 +224,11 @@ const ImageCapture = (props: CaptureInput) => {
133
224
  const handleSubmit = async () => {
134
225
  try {
135
226
  setDisableProceed(true);
136
- if (images.length > 0) {
137
- if (
138
- props.additionalMultiConfig?.minCaptureCount === 'N' &&
139
- images.length < props.captureCount
140
- ) {
141
- showToast(
142
- `Min ${props.captureCount} image(s) required to be captured.`
143
- );
144
- return;
145
- }
146
- if (
147
- props.captureMode === 'MULTI' &&
148
- props.captureCountLimit &&
149
- props.captureCountLimit > 0 &&
150
- images.length > CaptureUtils.getMaxImagesCount(props)
151
- ) {
152
- showToast(`Max ${props.captureCountLimit} image(s) allowed.`);
153
- return;
154
- }
155
- props.onSubmitET(await getCaptureOutput(images, props));
227
+ let imagesArray = imagesDummy.filter(item => item != null && item.path != null && item.path.length != 0);
228
+ console.log('imagesArray:', JSON.stringify(imagesArray));
229
+
230
+ if (imagesArray.length > 0) {
231
+ props.onSubmitET(await getCaptureOutput(imagesArray, props));
156
232
  } else {
157
233
  showToast('No Images captured');
158
234
  }
@@ -164,144 +240,134 @@ const ImageCapture = (props: CaptureInput) => {
164
240
  }
165
241
  };
166
242
 
167
- useEffect(() => {
168
- if (props.captureMode === 'SINGLE') {
169
- if (images.length > 0) {
170
- setShowCapture(false);
171
- } else setShowCapture(true);
172
- } else if (
173
- props.captureMode === 'MULTI' &&
174
- props.captureCountLimit &&
175
- props.captureCountLimit > 0
176
- ) {
177
- if (images.length === CaptureUtils.getMaxImagesCount(props)) {
178
- setShowCapture(false);
179
- } else setShowCapture(true);
180
- } else {
181
- if (images.length > 0) {
182
- setShowCapture(true);
183
- }
184
- }
185
- }, [images, props, showCapture]);
243
+ // useEffect(() => {
244
+ // if (props.captureMode === 'SINGLE') {
245
+ // if (images.length > 0) {
246
+ // setShowCapture(false);
247
+ // } else setShowCapture(true);
248
+ // } else if (
249
+ // props.captureMode === 'MULTI' &&
250
+ // props.captureCountLimit &&
251
+ // props.captureCountLimit > 0
252
+ // ) {
253
+ // if (images.length === CaptureUtils.getMaxImagesCount(props)) {
254
+ // setShowCapture(false);
255
+ // } else setShowCapture(true);
256
+ // } else {
257
+ // if (images.length > 0) {
258
+ // setShowCapture(true);
259
+ // }
260
+ // }
261
+ // }, [images, props, showCapture]);
186
262
 
187
- const captureImage = useCallback(async () => {
188
- if (!showCapture) {
189
- showToast(`Max Image Limit reached`);
190
- return;
191
- }
263
+ const captureImage = useCallback(async (index) => {
264
+ // // if (!showCapture) {
265
+ // // showToast(`Max Image Limit reached`);
266
+ // // return;
267
+ // // }
268
+ // console.log("captureImage", CaptureUtils);
192
269
  let imageDataResponse = await CaptureUtils.captureImage(
193
270
  props.resolution.breadth,
194
271
  props.resolution.length,
195
272
  props.fileSizeLimit
196
273
  );
274
+
197
275
  if (imageDataResponse != null) {
198
- setImages((prevState) => {
199
- return [
200
- ...prevState,
201
- {
202
- id: CaptureUtils.getImagesFileName(), // @ts-ignore
203
- path: imageDataResponse.uri,
204
- url: '',
205
- timestamp: Date.now(),
206
- },
207
- ];
208
- });
276
+ setButtonProceed(true);
277
+
278
+ let imgArray = [];
279
+ imgArray = imagesDummy;
280
+ imgArray[index] = {
281
+ id: CaptureUtils.getImagesFileName(),
282
+ // @ts-ignore
283
+ path: imageDataResponse.uri,
284
+ url: '',
285
+ timestamp: Date.now(),
286
+ };
287
+ setImagesDummy([...imgArray])
288
+ console.log("images211:", JSON.stringify(imgArray));
289
+
290
+ }
291
+ }, [props.resolution.breadth, props.resolution.length, props.fileSizeLimit]);
292
+
293
+
294
+ const deleteImage = async (index: any) => {
295
+ let imageDummyArray = [];
296
+ imageDummyArray = imagesDummy
297
+ imageDummyArray[index].path = ""
298
+ setImagesDummy([...imageDummyArray])
299
+
300
+ let initialProceedValue = false;
301
+ for (let i = 0; i < imageDummyArray.length; i++) {
302
+ if (imageDummyArray[i]?.path) {
303
+ initialProceedValue = true
304
+ }
209
305
  }
210
- }, [props, showCapture]);
306
+ setButtonProceed(initialProceedValue);
211
307
 
212
- const deleteImage = async (imageData: ImageData) => {
213
308
  try {
214
- let filteredImages = await CaptureUtils.deleteImage(imageData, images);
215
- setImages(filteredImages);
309
+ // setImagesDummy(filteredImages);
310
+ // setButtonProceed(false);
216
311
  } catch (err: any) {
217
- Logger.getInstance().logEvent(
218
- 'deleteImageError',
219
- err.message,
220
- LOG_TYPE.SDK_ERROR
221
- );
222
- return;
312
+ Logger.getInstance().logEvent('deleteImageError', err.message, LOG_TYPE.SDK_ERROR);
313
+ console.error("Error updating state after deletion:", err);
223
314
  }
224
315
  };
225
316
 
226
- const renderItem = ({ item }: { item: ImageData }) => {
317
+ const renderItem = ({ item, index }: { item: any; index: any }) => {
227
318
  return (
228
319
  <ImageItem
229
320
  item={item}
321
+ index={index}
230
322
  onPress={async () => {
231
- await deleteImage(item);
323
+ await deleteImage(index);
232
324
  }}
233
325
  />
234
326
  );
235
327
  };
328
+
236
329
  return (
237
330
  <Provider>
238
331
  {renderModal()}
239
332
  <View style={CommonStyles.mainContainer}>
240
333
  {props.message && (
241
334
  <View style={styles.etMessageView}>
242
- <Text style={styles.etMessage}>{props.message}</Text>
335
+ <Text style={styles.etMessage}>
336
+ Take a photo of the shipments. Please ensure the items are clearly visible.
337
+ </Text>
243
338
  </View>
244
339
  )}
245
- <View style={styles.imageEtContainer}>
246
- {images.length === 0 && (
247
- <Icon name={'photo-camera'} size={24} color={'#666666'} />
248
- )}
249
- {images.length > 0 && (
250
- <FlatList
251
- horizontal
252
- data={images}
253
- renderItem={renderItem}
254
- keyExtractor={(item) => item.id}
255
- />
256
- )}
257
- <Button
258
- onPress={() => captureImage()}
259
- uppercase={false}
260
- labelStyle={[
261
- {
262
- fontFamily:
263
- Platform.OS === 'android'
264
- ? Fonts.IBMPlexSans_400Regular
265
- : 'IBMPlexSans-Regular',
266
- fontStyle: 'normal',
267
- fontWeight: 'normal',
268
- fontSize: 14,
269
- alignItems: 'center',
270
- textAlign: 'center',
271
- letterSpacing: 0.25,
272
- color: SdkColors[ColorTheme.LIGHT].primaryButton,
273
- },
274
- ]}
275
- >
276
- {images.length > 0 ? 'Click more' : 'Click Picture'}
277
- </Button>
340
+ <View
341
+ style={{
342
+ backgroundColor: 'white',
343
+ width: 360,
344
+ height: numColumns == 2 ? '82%' : numberOfImagesToCapture == 1 ? '63%' : '70%',
345
+ alignSelf: 'center',
346
+ marginTop: '5%',
347
+ borderRadius: 7,
348
+ borderColor: '#E0E3EB',
349
+ borderWidth: 0.5,
350
+ }}
351
+ >
352
+ <FlatList
353
+ data={images}
354
+ numColumns={numColumns}
355
+ renderItem={renderItem}
356
+ keyExtractor={(item) => item?.id}
357
+ contentContainerStyle={{ paddingBottom: '30%' }}
358
+ />
278
359
  </View>
279
- <View style={[CommonStyles.bottom, { marginStart: 10, marginEnd: 10 }]}>
280
- <Button
281
- disabled={disableProceed}
282
- style={CommonStyles.nextButton}
283
- mode="contained"
284
- labelStyle={CommonStyles.nextButtonLabel}
285
- onPress={async () => {
286
- await handleSubmit();
287
- }}
288
- >
289
- Proceed
290
- </Button>
291
- <Button
292
- style={[CommonStyles.cancelButton, { marginTop: 10 }]}
360
+ <View style={styles.bottomButtons}>
361
+ {(props.isSelfLoop == false) && <Button
362
+ style={[CommonStyles.cancelButton, { flexGrow: 1, marginStart: '3%' }]}
293
363
  mode="outlined"
294
- labelStyle={CommonStyles.cancelButtonLabel}
364
+ labelStyle={[CommonStyles.cancelButtonLabel, { textTransform: 'capitalize' }]}
295
365
  onPress={async () => {
296
366
  props.onSubmitET({
297
367
  ...(await getBaseETResponse(
298
368
  EntityCode.IMAGE_CAPTURE,
299
369
  false,
300
- getEventCodeByET(
301
- ExecutionTaskID.IMAGE_CAPTURE,
302
- false,
303
- props.applicableReasons?.failure
304
- ),
370
+ getEventCodeByET(ExecutionTaskID.IMAGE_CAPTURE, false, props.applicableReasons?.failure),
305
371
  '',
306
372
  props.mergedObjectiveId,
307
373
  ExecutionTaskID.IMAGE_CAPTURE
@@ -311,6 +377,29 @@ const ImageCapture = (props: CaptureInput) => {
311
377
  >
312
378
  Cancel
313
379
  </Button>
380
+ }
381
+ <Button
382
+ labelStyle={{
383
+ color: buttonProceed ? '#ffff' : '#A3AAC2',
384
+ fontFamily: Fonts.IBMPlexSans_500Medium,
385
+ fontSize: 14,
386
+ lineHeight: 20,
387
+ textAlign: 'center',
388
+ textTransform: 'capitalize',
389
+ }}
390
+ style={{
391
+ flexGrow: 1,
392
+ marginHorizontal: '3%',
393
+ backgroundColor: buttonProceed ? '#5B80F7' : '#E0E3EB',
394
+ }}
395
+ disabled={!buttonProceed}
396
+ mode="contained"
397
+ onPress={async () => {
398
+ await handleSubmit();
399
+ }}
400
+ >
401
+ Proceed
402
+ </Button>
314
403
  </View>
315
404
  </View>
316
405
  </Provider>
@@ -318,46 +407,51 @@ const ImageCapture = (props: CaptureInput) => {
318
407
  };
319
408
 
320
409
  const styles = StyleSheet.create({
410
+
321
411
  imageEtContainer: {
322
412
  display: 'flex',
323
413
  marginStart: 16,
324
414
  marginEnd: 16,
325
415
  borderWidth: 1,
326
- borderColor: 'rgba(0, 0, 0, 0.1)',
416
+ borderColor: '#A3AAC2',
327
417
  padding: 10,
328
418
  marginTop: 15,
329
419
  borderStyle: 'dashed',
330
420
  backgroundColor: '#FFFFFF',
331
421
  alignItems: 'center',
332
422
  justifyContent: 'center',
333
- height: 300,
423
+ height: 370,
424
+ borderRadius: 5
334
425
  },
335
- image: {
336
- height: 250,
337
- width: 200,
426
+
427
+ bottomButtons: {
428
+ width: "100%",
429
+ justifyContent: "space-between",
430
+ flexDirection: 'row',
431
+ backgroundColor: "white",
432
+ paddingVertical: 12,
433
+ bottom: 0,
434
+ position: "absolute",
435
+ borderTopColor: "#A3AAC2",
436
+ borderTopWidth: 0.5
338
437
  },
339
438
  etMessage: {
340
- textAlign: 'center',
439
+ // textAlign: 'center',
341
440
  fontStyle: 'normal',
342
- fontWeight: '600',
343
- fontSize: 18,
441
+ fontWeight: '400',
442
+ fontSize: 16,
344
443
  display: 'flex',
345
444
  alignItems: 'center',
346
- letterSpacing: 0.25,
347
445
  color: '#000000',
348
- fontFamily:
349
- Platform.OS === 'android'
350
- ? Fonts.IBMPlexSans_600SemiBold
351
- : 'IBMPlexSans-SemiBold',
446
+ fontFamily: Fonts.IBMPlexSans_400Regular
352
447
  },
353
448
  etMessageView: {
354
- marginTop: 14,
355
- paddingStart: 40,
356
- paddingEnd: 40,
449
+ marginTop: 17,
450
+ paddingStart: 17,
357
451
  paddingTop: 15,
358
452
  paddingBottom: 15,
359
- backgroundColor: '#ffffff',
360
- },
453
+ backgroundColor: '#ffffff'
454
+ }
361
455
  });
362
456
 
363
457
  export default ImageCapture;
@@ -0,0 +1,3 @@
1
+ <svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M18 3.75H15.1875L14.8571 2.8707C14.4922 1.89648 13.5586 1.25 12.5156 1.25H8.48438C7.44141 1.25 6.51172 1.89492 6.14453 2.86914L5.8125 3.75H3C1.61914 3.75 0.5 4.87109 0.5 6.25V16.25C0.5 17.6309 1.61914 18.75 3 18.75H18C19.3809 18.75 20.5 17.6309 20.5 16.25V6.25C20.5 4.87109 19.3789 3.75 18 3.75ZM19.25 16.25C19.25 16.9375 18.6875 17.5 18 17.5H3C2.3125 17.5 1.75 16.9375 1.75 16.25V6.25C1.75 5.5625 2.3125 5 3 5H6.68164L7.31094 3.31328C7.49219 2.82422 7.92578 2.5 8.48047 2.5H12.5156C13.0375 2.5 13.5043 2.82426 13.6867 3.31328L14.3203 5H18C18.6875 5 19.25 5.5625 19.25 6.25V16.25ZM10.5 6.5625C7.91406 6.5625 5.8125 8.66406 5.8125 11.25C5.8125 13.8359 7.91211 15.9375 10.5 15.9375C13.0879 15.9375 15.1875 13.8379 15.1875 11.25C15.1875 8.66211 13.0898 6.5625 10.5 6.5625ZM10.5 14.6875C8.60547 14.6875 7.0625 13.1445 7.0625 11.25C7.0625 9.35547 8.60547 7.8125 10.5 7.8125C12.3945 7.8125 13.9375 9.35547 13.9375 11.25C13.9375 13.1445 12.3945 14.6875 10.5 14.6875Z" fill="#525B7A"/>
3
+ </svg>
@@ -0,0 +1,5 @@
1
+ <svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g id="FA-Icon/Light/circle-xmark">
3
+ <path id="Vector" d="M11.0512 6.34874C10.8559 6.15381 10.5393 6.15381 10.3443 6.34874L8.69804 7.99239L7.05117 6.34874C6.85586 6.15381 6.53929 6.15381 6.34429 6.34874C6.14929 6.54367 6.14898 6.85961 6.34429 7.05423L7.99179 8.69727L6.34492 10.3409C6.14961 10.5359 6.14961 10.8518 6.34492 11.0464C6.54011 11.2412 6.85648 11.2415 7.05179 11.0464L8.69804 9.40214L10.3446 11.0455C10.5398 11.2403 10.8562 11.2405 11.0515 11.0455C11.2468 10.8506 11.2468 10.5346 11.0515 10.34L9.40429 8.69727L11.0509 7.05392C11.248 6.86024 11.248 6.54211 11.0512 6.34874ZM8.69804 0.712891C4.27929 0.712891 0.698044 4.28715 0.698044 8.69727C0.698044 13.1074 4.27929 16.6816 8.69804 16.6816C13.1168 16.6816 16.698 13.1074 16.698 8.69727C16.698 4.28715 13.1168 0.712891 8.69804 0.712891ZM8.69804 15.6836C4.83867 15.6836 1.69804 12.5491 1.69804 8.69727C1.69804 4.84543 4.83867 1.71094 8.69804 1.71094C12.5574 1.71094 15.698 4.84543 15.698 8.69727C15.698 12.5491 12.5574 15.6836 8.69804 15.6836Z" fill="#DC2626"/>
4
+ </g>
5
+ </svg>
@@ -171,7 +171,7 @@ const CompletePaymentET = (props: CompletePaymentInput) => {
171
171
  >
172
172
  Continue
173
173
  </Button>
174
- <Button
174
+ {(props.isSelfLoop == false) && <Button
175
175
  labelStyle={CommonStyles.cancelButtonLabel}
176
176
  style={[CommonStyles.cancelButton, { marginTop: 10 }]}
177
177
  mode={'outlined'}
@@ -199,6 +199,7 @@ const CompletePaymentET = (props: CompletePaymentInput) => {
199
199
  >
200
200
  Cancel
201
201
  </Button>
202
+ }
202
203
  </View>
203
204
  </Modal>
204
205
  </View>
@@ -8,6 +8,7 @@ import type {
8
8
  import type { ETAmount } from '../init/InitPaymentSchema';
9
9
 
10
10
  export type CompletePaymentInput = BaseETRequest & {
11
+ isSelfLoop: boolean;
11
12
  paymentMode: string;
12
13
  expectedAmount: ETAmount;
13
14
  collectedAmount: ETAmount;
@@ -14,8 +14,6 @@ import { CommonStyles } from '../../../../styles/executionTasks/CommonStyles';
14
14
  import { showToast } from '../../../widgets/Toaster';
15
15
  import {
16
16
  Button,
17
- Modal,
18
- Portal,
19
17
  Provider,
20
18
  RadioButton,
21
19
  } from 'react-native-paper';
@@ -172,7 +170,7 @@ const InitPaymentET = (props: InitPaymentInput) => {
172
170
  marginEnd: 10,
173
171
  }}
174
172
  >
175
- <Button
173
+ {(props.isSelfLoop == false) && <Button
176
174
  style={[
177
175
  CommonStyles.cancelButton,
178
176
  {
@@ -203,6 +201,7 @@ const InitPaymentET = (props: InitPaymentInput) => {
203
201
  >
204
202
  Cancel
205
203
  </Button>
204
+ }
206
205
  <Button
207
206
  disabled={disableNext}
208
207
  style={[
@@ -12,6 +12,7 @@ import type {
12
12
  export type AllowedModes = 'CASH' | 'UPI' | 'PAYMENT_LINK';
13
13
 
14
14
  export type InitPaymentInput = BaseETRequest & {
15
+ isSelfLoop: boolean;
15
16
  amount: ETAmount;
16
17
  allowedModes: string[];
17
18
  onSubmitET: (output: InitPaymentOutput) => void;