@os1-platform/dispatch-mobile 2.0.8 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dispatch-mobile.podspec +35 -0
- package/ios/DispatchSdk-Bridging-Header.h +3 -0
- package/ios/DispatchSdk.m +9 -0
- package/ios/DispatchSdk.swift +8 -0
- package/ios/DispatchSdk.xcodeproj/project.pbxproj +317 -0
- package/ios/EventEmitter.swift +21 -0
- package/ios/EventsConstant.swift +13 -0
- package/ios/RNEventEmitter.m +15 -0
- package/ios/RNEventEmitter.swift +24 -0
- package/lib/commonjs/components/dispatch/DispatchExecNavigator.js +3 -4
- package/lib/commonjs/components/dispatch/DispatchExecNavigator.js.map +1 -1
- package/lib/commonjs/components/executiontasks/cancellation/CancelET.js +13 -8
- package/lib/commonjs/components/executiontasks/cancellation/CancelET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/captureInput/CaptureText.js +3 -4
- package/lib/commonjs/components/executiontasks/captureInput/CaptureText.js.map +1 -1
- package/lib/commonjs/components/executiontasks/deliver/DeliverET.js +3 -4
- package/lib/commonjs/components/executiontasks/deliver/DeliverET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/deliver/DeliverETInput.js.map +1 -1
- package/lib/commonjs/components/executiontasks/deliver/SLDeliverET.js +100 -24
- package/lib/commonjs/components/executiontasks/deliver/SLDeliverET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/display/DisplayModalET.js +7 -8
- package/lib/commonjs/components/executiontasks/display/DisplayModalET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/doodle/SignatureET.js +36 -13
- package/lib/commonjs/components/executiontasks/doodle/SignatureET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/dropCash/DropCashET.js +3 -4
- package/lib/commonjs/components/executiontasks/dropCash/DropCashET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/dropCash/SLDropCash.js +6 -7
- package/lib/commonjs/components/executiontasks/dropCash/SLDropCash.js.map +1 -1
- package/lib/commonjs/components/executiontasks/forms/FormGenerator.js +5 -6
- package/lib/commonjs/components/executiontasks/forms/FormGenerator.js.map +1 -1
- package/lib/commonjs/components/executiontasks/forms/widgets/DateTimeWidget.js +4 -5
- package/lib/commonjs/components/executiontasks/forms/widgets/DateTimeWidget.js.map +1 -1
- package/lib/commonjs/components/executiontasks/forms/widgets/DropdownWidget.js +3 -4
- package/lib/commonjs/components/executiontasks/forms/widgets/DropdownWidget.js.map +1 -1
- package/lib/commonjs/components/executiontasks/forms/widgets/QRBarcodeScannerWidget.js +3 -4
- package/lib/commonjs/components/executiontasks/forms/widgets/QRBarcodeScannerWidget.js.map +1 -1
- package/lib/commonjs/components/executiontasks/forms/widgets/TimeRangeSelector.js +3 -4
- package/lib/commonjs/components/executiontasks/forms/widgets/TimeRangeSelector.js.map +1 -1
- package/lib/commonjs/components/executiontasks/httpRequest/HttpRequestET.js +3 -4
- package/lib/commonjs/components/executiontasks/httpRequest/HttpRequestET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/imageCapture/CaptureUtils.js +136 -22
- package/lib/commonjs/components/executiontasks/imageCapture/CaptureUtils.js.map +1 -1
- package/lib/commonjs/components/executiontasks/imageCapture/ImageCapture.js +8 -8
- package/lib/commonjs/components/executiontasks/imageCapture/ImageCapture.js.map +1 -1
- package/lib/commonjs/components/executiontasks/payments/PaymentStyles.js +6 -7
- package/lib/commonjs/components/executiontasks/payments/PaymentStyles.js.map +1 -1
- package/lib/commonjs/components/executiontasks/payments/completePayment/CompletePaymentET.js +5 -6
- package/lib/commonjs/components/executiontasks/payments/completePayment/CompletePaymentET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/payments/init/InitPaymentET.js +3 -4
- package/lib/commonjs/components/executiontasks/payments/init/InitPaymentET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/payments/processPayment/ProcessPaymentET.js +3 -4
- package/lib/commonjs/components/executiontasks/payments/processPayment/ProcessPaymentET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/pickup/PickpSchema.js.map +1 -1
- package/lib/commonjs/components/executiontasks/pickup/PickupET.js +3 -4
- package/lib/commonjs/components/executiontasks/pickup/PickupET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/pickup/SLPickupET.js +84 -14
- package/lib/commonjs/components/executiontasks/pickup/SLPickupET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scan/ScanET.js +14 -15
- package/lib/commonjs/components/executiontasks/scan/ScanET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scan/ScanSchema.js +1 -2
- package/lib/commonjs/components/executiontasks/scan/ScanSchema.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scan/constants.js +6 -12
- package/lib/commonjs/components/executiontasks/scan/constants.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scan/interfaces.js +4 -8
- package/lib/commonjs/components/executiontasks/scan/interfaces.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scan/sub_components/CScanner.js +4 -5
- package/lib/commonjs/components/executiontasks/scan/sub_components/CScanner.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scan/sub_components/ERDropDown.js +5 -6
- package/lib/commonjs/components/executiontasks/scan/sub_components/ERDropDown.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scan/sub_components/SummaryPage.js +8 -9
- package/lib/commonjs/components/executiontasks/scan/sub_components/SummaryPage.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scan/utils.js +2 -2
- package/lib/commonjs/components/executiontasks/scan/utils.js.map +1 -1
- package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPET.js +8 -9
- package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPSchema.js +1 -2
- package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPSchema.js.map +1 -1
- package/lib/commonjs/components/executiontasks/validateOTP/constants.js +6 -12
- package/lib/commonjs/components/executiontasks/validateOTP/constants.js.map +1 -1
- package/lib/commonjs/components/executiontasks/validateOTP/sub-components/OTPInput.js +5 -6
- package/lib/commonjs/components/executiontasks/validateOTP/sub-components/OTPInput.js.map +1 -1
- package/lib/commonjs/components/executiontasks/validateOTP/utils.js +2 -2
- package/lib/commonjs/components/executiontasks/validateOTP/utils.js.map +1 -1
- package/lib/commonjs/components/executiontasks/verifyLocation/GeofenceUtils.js +2 -2
- package/lib/commonjs/components/executiontasks/verifyLocation/GeofenceUtils.js.map +1 -1
- package/lib/commonjs/components/executiontasks/verifyLocation/VerifyLocationET.js +3 -4
- package/lib/commonjs/components/executiontasks/verifyLocation/VerifyLocationET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/verifyOtp/VerifyOtpET.js +3 -4
- package/lib/commonjs/components/executiontasks/verifyOtp/VerifyOtpET.js.map +1 -1
- package/lib/commonjs/components/widgets/AlertDisplay.js +14 -9
- package/lib/commonjs/components/widgets/AlertDisplay.js.map +1 -1
- package/lib/commonjs/components/widgets/CancelOrderDialog.js +5 -6
- package/lib/commonjs/components/widgets/CancelOrderDialog.js.map +1 -1
- package/lib/commonjs/components/widgets/Card.js +2 -3
- package/lib/commonjs/components/widgets/Card.js.map +1 -1
- package/lib/commonjs/components/widgets/GoBackModal.js +1 -2
- package/lib/commonjs/components/widgets/GoBackModal.js.map +1 -1
- package/lib/commonjs/components/widgets/IconButton.js +1 -2
- package/lib/commonjs/components/widgets/IconButton.js.map +1 -1
- package/lib/commonjs/components/widgets/ModalWidget.js +3 -4
- package/lib/commonjs/components/widgets/ModalWidget.js.map +1 -1
- package/lib/commonjs/components/widgets/ProgressDialog.js +2 -3
- package/lib/commonjs/components/widgets/ProgressDialog.js.map +1 -1
- package/lib/commonjs/components/widgets/SearchBar.js +1 -2
- package/lib/commonjs/components/widgets/SearchBar.js.map +1 -1
- package/lib/commonjs/components/widgets/SnackBarCustom.js +3 -5
- package/lib/commonjs/components/widgets/SnackBarCustom.js.map +1 -1
- package/lib/commonjs/components/widgets/SplitTextInput.js +3 -4
- package/lib/commonjs/components/widgets/SplitTextInput.js.map +1 -1
- package/lib/commonjs/components/widgets/TabsComponent.js +3 -4
- package/lib/commonjs/components/widgets/TabsComponent.js.map +1 -1
- package/lib/commonjs/config/DispatchSDKConfig.js +1 -2
- package/lib/commonjs/config/DispatchSDKConfig.js.map +1 -1
- package/lib/commonjs/constants/apiConstants.js +2 -4
- package/lib/commonjs/constants/apiConstants.js.map +1 -1
- package/lib/commonjs/constants/constants.js +11 -22
- package/lib/commonjs/constants/constants.js.map +1 -1
- package/lib/commonjs/constants/statuscode.js +1 -2
- package/lib/commonjs/constants/statuscode.js.map +1 -1
- package/lib/commonjs/errors/ErrorCodes.js +7 -14
- package/lib/commonjs/errors/ErrorCodes.js.map +1 -1
- package/lib/commonjs/events/EventDispatcher.js +5 -3
- package/lib/commonjs/events/EventDispatcher.js.map +1 -1
- package/lib/commonjs/events/EventListener.js +1 -2
- package/lib/commonjs/events/EventListener.js.map +1 -1
- package/lib/commonjs/events/constants.js +1 -2
- package/lib/commonjs/events/constants.js.map +1 -1
- package/lib/commonjs/events/index.js +1 -2
- package/lib/commonjs/events/index.js.map +1 -1
- package/lib/commonjs/icons/ScanIcon.js +1 -2
- package/lib/commonjs/icons/ScanIcon.js.map +1 -1
- package/lib/commonjs/icons/circleMark.svg +3 -0
- package/lib/commonjs/icons/file.js +1 -2
- package/lib/commonjs/icons/file.js.map +1 -1
- package/lib/commonjs/index.js +8 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/locale/Str.js +3 -3
- package/lib/commonjs/locale/Str.js.map +1 -1
- package/lib/commonjs/locale/i18n.js +6 -3
- package/lib/commonjs/locale/i18n.js.map +1 -1
- package/lib/commonjs/manager/dispatch/DispatchStateContainer.js +5 -3
- package/lib/commonjs/manager/dispatch/DispatchStateContainer.js.map +1 -1
- package/lib/commonjs/manager/dispatchCodes/EventCodeContainer.js +2 -0
- package/lib/commonjs/manager/dispatchCodes/EventCodeContainer.js.map +1 -1
- package/lib/commonjs/manager/dispatchCodes/EventCodeRepo.js +4 -2
- package/lib/commonjs/manager/dispatchCodes/EventCodeRepo.js.map +1 -1
- package/lib/commonjs/manager/dispatchCodes/ReasonCodeContainer.js +4 -2
- package/lib/commonjs/manager/dispatchCodes/ReasonCodeContainer.js.map +1 -1
- package/lib/commonjs/manager/dispatchCodes/ReasonCodeRepo.js +4 -2
- package/lib/commonjs/manager/dispatchCodes/ReasonCodeRepo.js.map +1 -1
- package/lib/commonjs/manager/location/LocationManager.js +7 -4
- package/lib/commonjs/manager/location/LocationManager.js.map +1 -1
- package/lib/commonjs/manager/sdk/DispatchSDKManager.js +4 -2
- package/lib/commonjs/manager/sdk/DispatchSDKManager.js.map +1 -1
- package/lib/commonjs/manager/sdk/DispatchSdkCache.js +2 -0
- package/lib/commonjs/manager/sdk/DispatchSdkCache.js.map +1 -1
- package/lib/commonjs/manager/sdk/callbacksHandler.js +1 -2
- package/lib/commonjs/manager/sdk/callbacksHandler.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/AppSyncManager.js +4 -2
- package/lib/commonjs/manager/syncmanager/AppSyncManager.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/DBConfig.js +15 -26
- package/lib/commonjs/manager/syncmanager/DBConfig.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/NativeSyncManager.js +1 -2
- package/lib/commonjs/manager/syncmanager/NativeSyncManager.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/constants.js +5 -10
- package/lib/commonjs/manager/syncmanager/constants.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/database.js +2 -2
- package/lib/commonjs/manager/syncmanager/database.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/document/DocumentHttpClient.js +5 -4
- package/lib/commonjs/manager/syncmanager/document/DocumentHttpClient.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/document/DocumentManager.js +4 -2
- package/lib/commonjs/manager/syncmanager/document/DocumentManager.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/document/DocumentSyncManager.js +4 -2
- package/lib/commonjs/manager/syncmanager/document/DocumentSyncManager.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/events/ETEventsManager.js +15 -3
- package/lib/commonjs/manager/syncmanager/events/ETEventsManager.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/events/EventsSyncManager.js +4 -2
- package/lib/commonjs/manager/syncmanager/events/EventsSyncManager.js.map +1 -1
- package/lib/commonjs/models/DispatchModels.js +1 -2
- package/lib/commonjs/models/DispatchModels.js.map +1 -1
- package/lib/commonjs/models/execTasks/ETConfig.js +6 -12
- package/lib/commonjs/models/execTasks/ETConfig.js.map +1 -1
- package/lib/commonjs/models/fcm.js.map +1 -1
- package/lib/commonjs/models/sdk.js +1 -2
- package/lib/commonjs/models/sdk.js.map +1 -1
- package/lib/commonjs/native/signature/SignatureCapture.js +1 -2
- package/lib/commonjs/native/signature/SignatureCapture.js.map +1 -1
- package/lib/commonjs/network/GraphQLClient.js +48 -4
- package/lib/commonjs/network/GraphQLClient.js.map +1 -1
- package/lib/commonjs/network/Queries.js +5 -10
- package/lib/commonjs/network/Queries.js.map +1 -1
- package/lib/commonjs/res/strings.js +1 -2
- package/lib/commonjs/res/strings.js.map +1 -1
- package/lib/commonjs/resources/Login.js +1 -2
- package/lib/commonjs/resources/Login.js.map +1 -1
- package/lib/commonjs/resources/network.js +1 -2
- package/lib/commonjs/resources/network.js.map +1 -1
- package/lib/commonjs/styles/SdkColors.js +2 -4
- package/lib/commonjs/styles/SdkColors.js.map +1 -1
- package/lib/commonjs/styles/executionTasks/CommonStyles.js +6 -10
- package/lib/commonjs/styles/executionTasks/CommonStyles.js.map +1 -1
- package/lib/commonjs/ui/screens/CancellationScreen.js +3 -4
- package/lib/commonjs/ui/screens/CancellationScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/CaptureInputScreen.js +5 -5
- package/lib/commonjs/ui/screens/CaptureInputScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/CompleteObjectiveScreen.js +3 -4
- package/lib/commonjs/ui/screens/CompleteObjectiveScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/DeliverScreen.js +12 -5
- package/lib/commonjs/ui/screens/DeliverScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/DisplayScreen.js +3 -4
- package/lib/commonjs/ui/screens/DisplayScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/DoodleScreen.js +5 -5
- package/lib/commonjs/ui/screens/DoodleScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/DropCashScreen.js +5 -5
- package/lib/commonjs/ui/screens/DropCashScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FormsScreen.js +3 -4
- package/lib/commonjs/ui/screens/FormsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/GeofenceScreen.js +3 -4
- package/lib/commonjs/ui/screens/GeofenceScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/HttpRequestScreen.js +1 -2
- package/lib/commonjs/ui/screens/HttpRequestScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ImageCaptureScreen.js +3 -4
- package/lib/commonjs/ui/screens/ImageCaptureScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PaymentScreen.js +6 -6
- package/lib/commonjs/ui/screens/PaymentScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PickupScreen.js +7 -5
- package/lib/commonjs/ui/screens/PickupScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ScanScreen.js +3 -4
- package/lib/commonjs/ui/screens/ScanScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/StartWorkFlowScreen.js +8 -7
- package/lib/commonjs/ui/screens/StartWorkFlowScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ValidateOTPScreen.js +3 -4
- package/lib/commonjs/ui/screens/ValidateOTPScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/WithBaseDispatchScreen.js +4 -4
- package/lib/commonjs/ui/screens/WithBaseDispatchScreen.js.map +1 -1
- package/lib/commonjs/ui/uiConfig/RouteParams.js +1 -2
- package/lib/commonjs/ui/uiConfig/RouteParams.js.map +1 -1
- package/lib/commonjs/utils/ApiUtils.js +2 -4
- package/lib/commonjs/utils/ApiUtils.js.map +1 -1
- package/lib/commonjs/utils/Logger.js +10 -9
- package/lib/commonjs/utils/Logger.js.map +1 -1
- package/lib/commonjs/utils/NetworkUtil.js +1 -2
- package/lib/commonjs/utils/NetworkUtil.js.map +1 -1
- package/lib/commonjs/utils/SdkUtils.js +12 -8
- package/lib/commonjs/utils/SdkUtils.js.map +1 -1
- package/lib/commonjs/utils/SyncManagerUtils.js +2 -2
- package/lib/commonjs/utils/SyncManagerUtils.js.map +1 -1
- package/lib/commonjs/utils/fcm/FCM.js +3 -4
- package/lib/commonjs/utils/fcm/FCM.js.map +1 -1
- package/lib/commonjs/utils/fcm/FcmUtils.js +14 -2
- package/lib/commonjs/utils/fcm/FcmUtils.js.map +1 -1
- package/lib/commonjs/utils/helper.js +1 -2
- package/lib/commonjs/utils/helper.js.map +1 -1
- package/lib/commonjs/utils/hooks/useModal.js +3 -4
- package/lib/commonjs/utils/hooks/useModal.js.map +1 -1
- package/lib/commonjs/utils/hooks/useTimer.js +1 -2
- package/lib/commonjs/utils/hooks/useTimer.js.map +1 -1
- package/lib/commonjs/utils/loginHelper.js +1 -2
- package/lib/commonjs/utils/loginHelper.js.map +1 -1
- package/lib/commonjs/utils/storage.js +71 -13
- package/lib/commonjs/utils/storage.js.map +1 -1
- package/lib/module/components/dispatch/DispatchExecNavigator.js.map +1 -1
- package/lib/module/components/executiontasks/cancellation/CancelET.js +11 -5
- package/lib/module/components/executiontasks/cancellation/CancelET.js.map +1 -1
- package/lib/module/components/executiontasks/deliver/DeliverETInput.js.map +1 -1
- package/lib/module/components/executiontasks/deliver/SLDeliverET.js +99 -21
- package/lib/module/components/executiontasks/deliver/SLDeliverET.js.map +1 -1
- package/lib/module/components/executiontasks/display/DisplayModalET.js +5 -5
- package/lib/module/components/executiontasks/display/DisplayModalET.js.map +1 -1
- package/lib/module/components/executiontasks/doodle/SignatureET.js +34 -10
- package/lib/module/components/executiontasks/doodle/SignatureET.js.map +1 -1
- package/lib/module/components/executiontasks/dropCash/SLDropCash.js +4 -4
- package/lib/module/components/executiontasks/dropCash/SLDropCash.js.map +1 -1
- package/lib/module/components/executiontasks/forms/FormGenerator.js +3 -3
- package/lib/module/components/executiontasks/forms/FormGenerator.js.map +1 -1
- package/lib/module/components/executiontasks/forms/widgets/DateTimeWidget.js +1 -1
- package/lib/module/components/executiontasks/forms/widgets/DateTimeWidget.js.map +1 -1
- package/lib/module/components/executiontasks/imageCapture/CaptureUtils.js +131 -18
- package/lib/module/components/executiontasks/imageCapture/CaptureUtils.js.map +1 -1
- package/lib/module/components/executiontasks/imageCapture/ImageCapture.js +3 -3
- package/lib/module/components/executiontasks/imageCapture/ImageCapture.js.map +1 -1
- package/lib/module/components/executiontasks/payments/PaymentStyles.js +6 -6
- package/lib/module/components/executiontasks/payments/PaymentStyles.js.map +1 -1
- package/lib/module/components/executiontasks/payments/completePayment/CompletePaymentET.js +3 -3
- package/lib/module/components/executiontasks/payments/completePayment/CompletePaymentET.js.map +1 -1
- package/lib/module/components/executiontasks/pickup/PickpSchema.js.map +1 -1
- package/lib/module/components/executiontasks/pickup/SLPickupET.js +82 -11
- package/lib/module/components/executiontasks/pickup/SLPickupET.js.map +1 -1
- package/lib/module/components/executiontasks/scan/ScanET.js +12 -12
- package/lib/module/components/executiontasks/scan/ScanET.js.map +1 -1
- package/lib/module/components/executiontasks/scan/sub_components/CScanner.js +2 -2
- package/lib/module/components/executiontasks/scan/sub_components/CScanner.js.map +1 -1
- package/lib/module/components/executiontasks/scan/sub_components/ERDropDown.js +3 -3
- package/lib/module/components/executiontasks/scan/sub_components/ERDropDown.js.map +1 -1
- package/lib/module/components/executiontasks/scan/sub_components/SummaryPage.js +6 -6
- package/lib/module/components/executiontasks/scan/sub_components/SummaryPage.js.map +1 -1
- package/lib/module/components/executiontasks/scan/utils.js.map +1 -1
- package/lib/module/components/executiontasks/validateOTP/ValidateOTPET.js +6 -6
- package/lib/module/components/executiontasks/validateOTP/ValidateOTPET.js.map +1 -1
- package/lib/module/components/executiontasks/validateOTP/sub-components/OTPInput.js +3 -3
- package/lib/module/components/executiontasks/validateOTP/sub-components/OTPInput.js.map +1 -1
- package/lib/module/components/widgets/AlertDisplay.js +12 -7
- package/lib/module/components/widgets/AlertDisplay.js.map +1 -1
- package/lib/module/components/widgets/CancelOrderDialog.js +3 -3
- package/lib/module/components/widgets/CancelOrderDialog.js.map +1 -1
- package/lib/module/components/widgets/Card.js +1 -1
- package/lib/module/components/widgets/Card.js.map +1 -1
- package/lib/module/components/widgets/ModalWidget.js +3 -3
- package/lib/module/components/widgets/ModalWidget.js.map +1 -1
- package/lib/module/components/widgets/ProgressDialog.js +2 -2
- package/lib/module/components/widgets/ProgressDialog.js.map +1 -1
- package/lib/module/components/widgets/SnackBarCustom.js +2 -2
- package/lib/module/components/widgets/SnackBarCustom.js.map +1 -1
- package/lib/module/events/EventDispatcher.js +5 -2
- package/lib/module/events/EventDispatcher.js.map +1 -1
- package/lib/module/icons/circleMark.svg +3 -0
- package/lib/module/index.js +2 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/locale/Str.js +2 -1
- package/lib/module/locale/Str.js.map +1 -1
- package/lib/module/locale/i18n.js +5 -1
- package/lib/module/locale/i18n.js.map +1 -1
- package/lib/module/manager/dispatch/DispatchStateContainer.js +3 -1
- package/lib/module/manager/dispatch/DispatchStateContainer.js.map +1 -1
- package/lib/module/manager/dispatchCodes/EventCodeContainer.js +2 -0
- package/lib/module/manager/dispatchCodes/EventCodeContainer.js.map +1 -1
- package/lib/module/manager/dispatchCodes/EventCodeRepo.js +2 -0
- package/lib/module/manager/dispatchCodes/EventCodeRepo.js.map +1 -1
- package/lib/module/manager/dispatchCodes/ReasonCodeContainer.js +2 -0
- package/lib/module/manager/dispatchCodes/ReasonCodeContainer.js.map +1 -1
- package/lib/module/manager/dispatchCodes/ReasonCodeRepo.js +2 -0
- package/lib/module/manager/dispatchCodes/ReasonCodeRepo.js.map +1 -1
- package/lib/module/manager/location/LocationManager.js +2 -0
- package/lib/module/manager/location/LocationManager.js.map +1 -1
- package/lib/module/manager/sdk/DispatchSDKManager.js +2 -0
- package/lib/module/manager/sdk/DispatchSDKManager.js.map +1 -1
- package/lib/module/manager/sdk/DispatchSdkCache.js +2 -0
- package/lib/module/manager/sdk/DispatchSdkCache.js.map +1 -1
- package/lib/module/manager/syncmanager/AppSyncManager.js +2 -0
- package/lib/module/manager/syncmanager/AppSyncManager.js.map +1 -1
- package/lib/module/manager/syncmanager/DBConfig.js +1 -0
- package/lib/module/manager/syncmanager/DBConfig.js.map +1 -1
- package/lib/module/manager/syncmanager/document/DocumentManager.js +2 -0
- package/lib/module/manager/syncmanager/document/DocumentManager.js.map +1 -1
- package/lib/module/manager/syncmanager/document/DocumentSyncManager.js +2 -0
- package/lib/module/manager/syncmanager/document/DocumentSyncManager.js.map +1 -1
- package/lib/module/manager/syncmanager/events/ETEventsManager.js +13 -1
- package/lib/module/manager/syncmanager/events/ETEventsManager.js.map +1 -1
- package/lib/module/manager/syncmanager/events/EventsSyncManager.js +2 -0
- package/lib/module/manager/syncmanager/events/EventsSyncManager.js.map +1 -1
- package/lib/module/models/fcm.js.map +1 -1
- package/lib/module/network/GraphQLClient.js +48 -3
- package/lib/module/network/GraphQLClient.js.map +1 -1
- package/lib/module/ui/screens/CaptureInputScreen.js +2 -1
- package/lib/module/ui/screens/CaptureInputScreen.js.map +1 -1
- package/lib/module/ui/screens/DeliverScreen.js +9 -1
- package/lib/module/ui/screens/DeliverScreen.js.map +1 -1
- package/lib/module/ui/screens/DoodleScreen.js +2 -1
- package/lib/module/ui/screens/DoodleScreen.js.map +1 -1
- package/lib/module/ui/screens/DropCashScreen.js +2 -2
- package/lib/module/ui/screens/DropCashScreen.js.map +1 -1
- package/lib/module/ui/screens/PaymentScreen.js +3 -2
- package/lib/module/ui/screens/PaymentScreen.js.map +1 -1
- package/lib/module/ui/screens/PickupScreen.js +4 -1
- package/lib/module/ui/screens/PickupScreen.js.map +1 -1
- package/lib/module/ui/screens/StartWorkFlowScreen.js +6 -4
- package/lib/module/ui/screens/StartWorkFlowScreen.js.map +1 -1
- package/lib/module/ui/screens/WithBaseDispatchScreen.js +1 -0
- package/lib/module/ui/screens/WithBaseDispatchScreen.js.map +1 -1
- package/lib/module/utils/Logger.js +2 -0
- package/lib/module/utils/Logger.js.map +1 -1
- package/lib/module/utils/SdkUtils.js +11 -7
- package/lib/module/utils/SdkUtils.js.map +1 -1
- package/lib/module/utils/fcm/FcmUtils.js +11 -0
- package/lib/module/utils/fcm/FcmUtils.js.map +1 -1
- package/lib/module/utils/storage.js +69 -10
- package/lib/module/utils/storage.js.map +1 -1
- package/lib/typescript/components/executiontasks/deliver/DeliverETInput.d.ts +4 -0
- package/lib/typescript/components/executiontasks/payments/PaymentStyles.d.ts +4 -5
- package/lib/typescript/components/executiontasks/pickup/PickpSchema.d.ts +1 -0
- package/lib/typescript/components/widgets/SnackBarCustom.d.ts +1 -1
- package/lib/typescript/index.d.ts +2 -2
- package/lib/typescript/locale/Str.d.ts +1 -0
- package/lib/typescript/manager/syncmanager/DBConfig.d.ts +2 -1
- package/lib/typescript/models/fcm.d.ts +3 -0
- package/lib/typescript/utils/fcm/FcmUtils.d.ts +2 -1
- package/lib/typescript/utils/storage.d.ts +3 -2
- package/package.json +21 -7
- package/src/@types/assets/index.d.ts +6 -0
- package/src/components/dispatch/DispatchExecNavigator.tsx +273 -0
- package/src/components/executiontasks/CompletedWFSchema.ts +24 -0
- package/src/components/executiontasks/ExecutionTasksIndex.ts +137 -0
- package/src/components/executiontasks/cancellation/CancelET.tsx +281 -0
- package/src/components/executiontasks/cancellation/CancellationSchema.ts +30 -0
- package/src/components/executiontasks/captureInput/CaptureInputSchema.ts +52 -0
- package/src/components/executiontasks/captureInput/CaptureText.tsx +172 -0
- package/src/components/executiontasks/captureInput/utils.ts +9 -0
- package/src/components/executiontasks/deliver/DeliverET.tsx +124 -0
- package/src/components/executiontasks/deliver/DeliverETInput.ts +51 -0
- package/src/components/executiontasks/deliver/SLDeliverET.tsx +515 -0
- package/src/components/executiontasks/display/DisplayModalET.tsx +174 -0
- package/src/components/executiontasks/display/DisplaySchema.ts +29 -0
- package/src/components/executiontasks/doodle/SignatureET.tsx +320 -0
- package/src/components/executiontasks/doodle/SignatureSchema.ts +51 -0
- package/src/components/executiontasks/dropCash/DropCashET.tsx +145 -0
- package/src/components/executiontasks/dropCash/DropCashSchema.ts +22 -0
- package/src/components/executiontasks/dropCash/SLDropCash.tsx +286 -0
- package/src/components/executiontasks/forms/FormGenerator.tsx +282 -0
- package/src/components/executiontasks/forms/FormSchema.ts +29 -0
- package/src/components/executiontasks/forms/widgets/DateTimeWidget.tsx +144 -0
- package/src/components/executiontasks/forms/widgets/DropdownWidget.tsx +52 -0
- package/src/components/executiontasks/forms/widgets/QRBarcodeScannerWidget.tsx +158 -0
- package/src/components/executiontasks/forms/widgets/TimeRangeSelector.tsx +38 -0
- package/src/components/executiontasks/httpRequest/HttpEtUtils.ts +49 -0
- package/src/components/executiontasks/httpRequest/HttpRequestET.tsx +59 -0
- package/src/components/executiontasks/httpRequest/HttpRequestETSchema.ts +42 -0
- package/src/components/executiontasks/imageCapture/CaptureSchema.ts +93 -0
- package/src/components/executiontasks/imageCapture/CaptureUtils.ts +326 -0
- package/src/components/executiontasks/imageCapture/ImageCapture.tsx +363 -0
- package/src/components/executiontasks/payments/PaymentStyles.ts +93 -0
- package/src/components/executiontasks/payments/PaymentUtils.ts +7 -0
- package/src/components/executiontasks/payments/completePayment/CompletePaymentET.tsx +237 -0
- package/src/components/executiontasks/payments/completePayment/CompletePaymentSchema.ts +23 -0
- package/src/components/executiontasks/payments/init/InitPaymentET.tsx +247 -0
- package/src/components/executiontasks/payments/init/InitPaymentSchema.ts +37 -0
- package/src/components/executiontasks/payments/processPayment/ProcessPaymentET.tsx +272 -0
- package/src/components/executiontasks/payments/processPayment/ProcessPaymentSchema.ts +38 -0
- package/src/components/executiontasks/pickup/PickpSchema.ts +29 -0
- package/src/components/executiontasks/pickup/PickupET.tsx +126 -0
- package/src/components/executiontasks/pickup/SLPickupET.tsx +370 -0
- package/src/components/executiontasks/scan/ScanET.tsx +1059 -0
- package/src/components/executiontasks/scan/ScanSchema.ts +121 -0
- package/src/components/executiontasks/scan/constants.ts +6 -0
- package/src/components/executiontasks/scan/interfaces.ts +109 -0
- package/src/components/executiontasks/scan/modalConstant.ts +120 -0
- package/src/components/executiontasks/scan/sub_components/CScanner.tsx +107 -0
- package/src/components/executiontasks/scan/sub_components/DropDownUtils.ts +119 -0
- package/src/components/executiontasks/scan/sub_components/ERDropDown.tsx +134 -0
- package/src/components/executiontasks/scan/sub_components/SummaryPage.tsx +1296 -0
- package/src/components/executiontasks/scan/utils.ts +1108 -0
- package/src/components/executiontasks/validateOTP/ValidateOTPET.tsx +436 -0
- package/src/components/executiontasks/validateOTP/ValidateOTPSchema.ts +68 -0
- package/src/components/executiontasks/validateOTP/constants.ts +24 -0
- package/src/components/executiontasks/validateOTP/sub-components/OTPInput.tsx +83 -0
- package/src/components/executiontasks/validateOTP/utils.ts +180 -0
- package/src/components/executiontasks/verifyInput/VerifyInputSchema.ts +49 -0
- package/src/components/executiontasks/verifyLocation/GeofenceUtils.ts +55 -0
- package/src/components/executiontasks/verifyLocation/VerifyLocSchema.ts +56 -0
- package/src/components/executiontasks/verifyLocation/VerifyLocationET.tsx +69 -0
- package/src/components/executiontasks/verifyOtp/VerifyOtpET.tsx +96 -0
- package/src/components/executiontasks/verifyOtp/VerifyOtpSchema.ts +27 -0
- package/src/components/utils/index.ts +18 -0
- package/src/components/widgets/AlertDisplay.tsx +38 -0
- package/src/components/widgets/CancelOrderDialog.tsx +112 -0
- package/src/components/widgets/Card.tsx +99 -0
- package/src/components/widgets/GoBackModal.tsx +49 -0
- package/src/components/widgets/IconButton.tsx +32 -0
- package/src/components/widgets/ModalWidget.tsx +157 -0
- package/src/components/widgets/ProgressDialog.tsx +54 -0
- package/src/components/widgets/SearchBar.tsx +71 -0
- package/src/components/widgets/SnackBarCustom.tsx +212 -0
- package/src/components/widgets/SplitTextInput.tsx +116 -0
- package/src/components/widgets/TabsComponent.tsx +84 -0
- package/src/components/widgets/Toaster.ts +8 -0
- package/src/config/DispatchSDKConfig.ts +4 -0
- package/src/constants/apiConstants.ts +11 -0
- package/src/constants/constants.ts +12 -0
- package/src/constants/statuscode.ts +8 -0
- package/src/errors/BaseError.ts +16 -0
- package/src/errors/ErrorCodes.ts +38 -0
- package/src/events/EventDispatcher.ts +22 -0
- package/src/events/EventListener.ts +14 -0
- package/src/events/constants.ts +7 -0
- package/src/events/index.ts +3 -0
- package/src/events/interface.ts +1 -0
- package/src/icons/ScanIcon.tsx +24 -0
- package/src/icons/circleMark.svg +3 -0
- package/src/icons/file.tsx +24 -0
- package/src/icons/interface.ts +5 -0
- package/src/index.tsx +80 -0
- package/src/locale/Str.ts +13 -0
- package/src/locale/en.json +6 -0
- package/src/locale/i18n.ts +22 -0
- package/src/locale/util.ts +20 -0
- package/src/manager/dispatch/DispatchStateContainer.tsx +842 -0
- package/src/manager/dispatchCodes/EventCodeContainer.ts +75 -0
- package/src/manager/dispatchCodes/EventCodeRepo.ts +82 -0
- package/src/manager/dispatchCodes/ReasonCodeContainer.ts +121 -0
- package/src/manager/dispatchCodes/ReasonCodeRepo.ts +90 -0
- package/src/manager/dispatchCodes/reasonCodes.json +137 -0
- package/src/manager/jobRemoval/JobRemovalManager.ts +21 -0
- package/src/manager/location/LocationManager.ts +77 -0
- package/src/manager/sdk/DispatchSDKManager.ts +99 -0
- package/src/manager/sdk/DispatchSdkCache.ts +47 -0
- package/src/manager/sdk/callbacksHandler.ts +25 -0
- package/src/manager/syncmanager/AppSyncManager.ts +187 -0
- package/src/manager/syncmanager/DBConfig.ts +181 -0
- package/src/manager/syncmanager/NativeSyncManager.ts +14 -0
- package/src/manager/syncmanager/constants.ts +5 -0
- package/src/manager/syncmanager/database.ts +93 -0
- package/src/manager/syncmanager/document/DocumentHttpClient.ts +111 -0
- package/src/manager/syncmanager/document/DocumentManager.ts +143 -0
- package/src/manager/syncmanager/document/DocumentSyncManager.ts +233 -0
- package/src/manager/syncmanager/document/models.ts +4 -0
- package/src/manager/syncmanager/events/ETEventsManager.ts +647 -0
- package/src/manager/syncmanager/events/EventsGraphQLClient.ts +0 -0
- package/src/manager/syncmanager/events/EventsSyncManager.ts +490 -0
- package/src/manager/syncmanager/events/SyncHttpClient.ts +202 -0
- package/src/models/DispatchModels.ts +97 -0
- package/src/models/ReasonCodes.ts +12 -0
- package/src/models/auth.ts +43 -0
- package/src/models/execTasks/ETBaseModels.ts +113 -0
- package/src/models/execTasks/ETConfig.ts +94 -0
- package/src/models/execution.ts +9 -0
- package/src/models/fcm.ts +6 -0
- package/src/models/sdk.ts +35 -0
- package/src/native/signature/SignatureCapture.tsx +110 -0
- package/src/network/GraphQLClient.ts +147 -0
- package/src/network/NetworkClient.ts +58 -0
- package/src/network/NetworkUtils.ts +41 -0
- package/src/network/Queries.ts +46 -0
- package/src/network/client.ts +61 -0
- package/src/res/strings.ts +1 -0
- package/src/resources/Login.ts +36 -0
- package/src/resources/network.ts +13 -0
- package/src/styles/SdkColors.ts +24 -0
- package/src/styles/executionTasks/CommonStyles.ts +188 -0
- package/src/ui/screens/CancellationScreen.tsx +144 -0
- package/src/ui/screens/CaptureInputScreen.tsx +79 -0
- package/src/ui/screens/CompleteObjectiveScreen.tsx +72 -0
- package/src/ui/screens/DeliverScreen.tsx +117 -0
- package/src/ui/screens/DisplayScreen.tsx +52 -0
- package/src/ui/screens/DoodleScreen.tsx +84 -0
- package/src/ui/screens/DropCashScreen.tsx +113 -0
- package/src/ui/screens/ETScreensIndex.ts +35 -0
- package/src/ui/screens/FormsScreen.tsx +164 -0
- package/src/ui/screens/GeofenceScreen.tsx +54 -0
- package/src/ui/screens/HttpRequestScreen.tsx +47 -0
- package/src/ui/screens/ImageCaptureScreen.tsx +77 -0
- package/src/ui/screens/PaymentScreen.tsx +191 -0
- package/src/ui/screens/PickupScreen.tsx +85 -0
- package/src/ui/screens/ScanScreen.tsx +159 -0
- package/src/ui/screens/StartWorkFlowScreen.tsx +233 -0
- package/src/ui/screens/ValidateOTPScreen.tsx +62 -0
- package/src/ui/screens/WithBaseDispatchScreen.tsx +33 -0
- package/src/ui/uiConfig/RouteParams.ts +28 -0
- package/src/utils/ApiUtils.ts +157 -0
- package/src/utils/ExecTaskUtils.ts +214 -0
- package/src/utils/Logger.ts +110 -0
- package/src/utils/NetworkUtil.ts +50 -0
- package/src/utils/SdkUtils.ts +155 -0
- package/src/utils/SyncManagerUtils.ts +223 -0
- package/src/utils/fcm/FCM.ts +118 -0
- package/src/utils/fcm/FcmUtils.ts +130 -0
- package/src/utils/helper.ts +24 -0
- package/src/utils/hooks/useModal.tsx +67 -0
- package/src/utils/hooks/useTimer.ts +44 -0
- package/src/utils/loginHelper.ts +51 -0
- package/src/utils/storage.ts +292 -0
- package/src/utils/test.json +17 -0
- package/src/utils/utils.ts +30 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
- package/android/gradlew +0 -185
- package/android/gradlew.bat +0 -89
|
@@ -0,0 +1,1296 @@
|
|
|
1
|
+
import { View, Text, Dimensions, Platform } from 'react-native';
|
|
2
|
+
import React, { useState, useEffect } from 'react';
|
|
3
|
+
import { Button } from 'react-native-paper';
|
|
4
|
+
import { Entypo } from '@expo/vector-icons';
|
|
5
|
+
import {
|
|
6
|
+
CommonStyles,
|
|
7
|
+
Fonts,
|
|
8
|
+
} from '../../../../styles/executionTasks/CommonStyles';
|
|
9
|
+
import {
|
|
10
|
+
DisplaySummary,
|
|
11
|
+
ListItem,
|
|
12
|
+
PROCEED_STATUS,
|
|
13
|
+
SummaryPageTabs,
|
|
14
|
+
} from '../interfaces';
|
|
15
|
+
import { StyleSheet } from 'react-native';
|
|
16
|
+
import { TouchableOpacity } from 'react-native';
|
|
17
|
+
import ERDropDown, { ercItem } from './ERDropDown';
|
|
18
|
+
import { getErcDropDownItems } from './DropDownUtils';
|
|
19
|
+
import { ERCode, ScannerInput, ScannerOutput } from '../ScanSchema';
|
|
20
|
+
import SdkColors, { ColorTheme } from '../../../../styles/SdkColors';
|
|
21
|
+
import {
|
|
22
|
+
BaseDataProvider,
|
|
23
|
+
DataProvider,
|
|
24
|
+
LayoutProvider,
|
|
25
|
+
RecyclerListView,
|
|
26
|
+
} from 'recyclerlistview';
|
|
27
|
+
import SnackBarCustom, { SnackBarType } from '../../../widgets/SnackBarCustom';
|
|
28
|
+
import TabsComponent, { Tab } from '../../../widgets/TabsComponent';
|
|
29
|
+
import Card from '../../../widgets/Card';
|
|
30
|
+
import {
|
|
31
|
+
addScans,
|
|
32
|
+
filterERCItems,
|
|
33
|
+
getScanData,
|
|
34
|
+
getTabCount,
|
|
35
|
+
removeScan,
|
|
36
|
+
} from '../utils';
|
|
37
|
+
import { AntDesign } from '@expo/vector-icons';
|
|
38
|
+
import ModalWidget from '../../../widgets/ModalWidget';
|
|
39
|
+
import SearchBar from '../../../widgets/SearchBar';
|
|
40
|
+
import { debounce } from 'lodash';
|
|
41
|
+
import { RouteParams } from '../../../../ui/uiConfig/RouteParams';
|
|
42
|
+
import { IDispatchExecutor } from '@os1-platform/platform-coreos-execution-engine-sdk';
|
|
43
|
+
import FileIcon from '../../../../icons/file';
|
|
44
|
+
|
|
45
|
+
const dimensionsForScreen = Dimensions.get('screen');
|
|
46
|
+
|
|
47
|
+
const createNewDataProvider = () => {
|
|
48
|
+
return new DataProvider((r1, r2) => r1.scanId !== r2.scanId);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
interface SummaryPageProps {
|
|
52
|
+
shipmentCount: { scannedCount: number; totalCount: number };
|
|
53
|
+
updateShipmentCount: (
|
|
54
|
+
scannedCountChanged: number,
|
|
55
|
+
totalCountChanged: number,
|
|
56
|
+
type?: 'SCAN' | 'REMOVE'
|
|
57
|
+
) => any;
|
|
58
|
+
handleSubmitET: (
|
|
59
|
+
status: PROCEED_STATUS,
|
|
60
|
+
count: number,
|
|
61
|
+
erc?: {
|
|
62
|
+
ec: string;
|
|
63
|
+
rc: string;
|
|
64
|
+
}
|
|
65
|
+
) => void;
|
|
66
|
+
ercSelector: ERCode[];
|
|
67
|
+
eventCodeItems: ercItem[];
|
|
68
|
+
scanProps: ScannerInput;
|
|
69
|
+
mergedScanETOutput: ScannerOutput;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const INITIAL_TABS = [
|
|
73
|
+
{ title: SummaryPageTabs.ALL, count: 0 },
|
|
74
|
+
{ title: SummaryPageTabs.PENDING, count: 0 },
|
|
75
|
+
{ title: SummaryPageTabs.DELIVERED, count: 0 },
|
|
76
|
+
{ title: SummaryPageTabs.UNDELIVERED, count: 0 },
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
const INITIAL_SEARCH_PARAMS = {
|
|
80
|
+
hasNextPage: true,
|
|
81
|
+
offset: 0,
|
|
82
|
+
limit: 10,
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const SummaryPage = (props: SummaryPageProps) => {
|
|
86
|
+
const [snackBar, setSnackBar] = useState({
|
|
87
|
+
show: false,
|
|
88
|
+
type: SnackBarType.SUCCESS,
|
|
89
|
+
message: '',
|
|
90
|
+
});
|
|
91
|
+
const [tabs, setTabs] = useState(INITIAL_TABS);
|
|
92
|
+
|
|
93
|
+
// START: Modal Handling for Summary Page
|
|
94
|
+
|
|
95
|
+
const [showUnscannedShipmentModal, setShowUnscannedShipmentModal] =
|
|
96
|
+
useState(false);
|
|
97
|
+
const [showERCModal, setShowERCModal] = useState(false);
|
|
98
|
+
const [showRemoveShipmentModal, setShowRemoveShipmentModal] = useState(false);
|
|
99
|
+
|
|
100
|
+
const [selectedEventCode, setSelectedEventCode] = useState<ercItem>();
|
|
101
|
+
const [selectedReason, setSelectedReason] = useState<ercItem>(); // reason code from ercSelector
|
|
102
|
+
const [reasonItems, setReasonItems] = useState<ercItem[]>(); // list of reason codes
|
|
103
|
+
const [editedReasonItems, setEditedReasonItems] = useState<ercItem[]>(); // list of reason codes
|
|
104
|
+
let { scannedCount, totalCount } = props.shipmentCount;
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
props.ercSelector &&
|
|
107
|
+
(async () => {
|
|
108
|
+
setSelectedEventCode(props.eventCodeItems[0]);
|
|
109
|
+
setEditedEventCode(props.eventCodeItems[0]);
|
|
110
|
+
})();
|
|
111
|
+
}, [props.eventCodeItems]);
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
selectedEventCode?.code &&
|
|
114
|
+
(async () => {
|
|
115
|
+
let response = await getErcDropDownItems(
|
|
116
|
+
'REASON',
|
|
117
|
+
props.ercSelector || [],
|
|
118
|
+
selectedEventCode?.code
|
|
119
|
+
);
|
|
120
|
+
if (response.length) {
|
|
121
|
+
setReasonItems(response);
|
|
122
|
+
setSelectedReason(response[0]);
|
|
123
|
+
} else {
|
|
124
|
+
setReasonItems([]);
|
|
125
|
+
setSelectedReason(undefined);
|
|
126
|
+
}
|
|
127
|
+
})();
|
|
128
|
+
}, [selectedEventCode?.code]);
|
|
129
|
+
|
|
130
|
+
const renderActionButtons = () => {
|
|
131
|
+
return (
|
|
132
|
+
<View
|
|
133
|
+
style={{ borderTopWidth: 1, borderTopColor: '#E0E3EB', padding: 10 }}
|
|
134
|
+
>
|
|
135
|
+
<Button
|
|
136
|
+
labelStyle={CommonStyles.nextButtonLabel}
|
|
137
|
+
style={CommonStyles.nextButton}
|
|
138
|
+
uppercase={false}
|
|
139
|
+
onPress={() => {
|
|
140
|
+
if (scannedCount < totalCount) {
|
|
141
|
+
setShowUnscannedShipmentModal(true);
|
|
142
|
+
} else {
|
|
143
|
+
props.handleSubmitET(PROCEED_STATUS.DELIVER_NOW, tabs[1].count);
|
|
144
|
+
}
|
|
145
|
+
}}
|
|
146
|
+
>
|
|
147
|
+
{`Proceed`}
|
|
148
|
+
</Button>
|
|
149
|
+
</View>
|
|
150
|
+
);
|
|
151
|
+
};
|
|
152
|
+
// END: Modal Handling for Summary Page
|
|
153
|
+
|
|
154
|
+
// START: Summary List Handling
|
|
155
|
+
const [searchParams, setSearchParams] = useState(INITIAL_SEARCH_PARAMS);
|
|
156
|
+
const [dataProvider, setDataProvider] = React.useState<BaseDataProvider>(
|
|
157
|
+
createNewDataProvider()
|
|
158
|
+
);
|
|
159
|
+
const _layoutProvider = new LayoutProvider(
|
|
160
|
+
(index: any) => 0,
|
|
161
|
+
(type: any, dim: any) => {
|
|
162
|
+
dim.width = dimensionsForScreen.width / 1;
|
|
163
|
+
dim.height = 180; //dimensionsForScreen.height / 1;
|
|
164
|
+
}
|
|
165
|
+
);
|
|
166
|
+
const [activeTab, setActiveTab] = useState(SummaryPageTabs.PENDING);
|
|
167
|
+
const [scanList, setScanList] = useState<DisplaySummary[]>([]);
|
|
168
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
169
|
+
const [isLoadingMore, setIsLoadingMore] = useState(false);
|
|
170
|
+
const [showEditModal, setShowEditModal] = useState(false);
|
|
171
|
+
const [selectedEditItem, setSelectedEditItem] = useState<ListItem>();
|
|
172
|
+
const [editedEventCode, setEditedEventCode] = useState<ercItem>();
|
|
173
|
+
const [editedReason, setEditedReason] = useState<ercItem>(); // reason code from ercSelector
|
|
174
|
+
const [selectedItems, setSelectedItems] = useState<{
|
|
175
|
+
[id: string]: ListItem;
|
|
176
|
+
}>({});
|
|
177
|
+
const [searchText, setSearchText] = useState('');
|
|
178
|
+
const [searchQuery, setSearchQuery] = React.useState('');
|
|
179
|
+
const [isSearchCleared, setIsSearchCleared] = React.useState<boolean>(false);
|
|
180
|
+
const [isRemoved, setIsRemoved] = useState(false);
|
|
181
|
+
const onChangeSearch = (query: string) => {
|
|
182
|
+
setSearchQuery((oldQuery) => {
|
|
183
|
+
if (oldQuery.length > 1 && query.length === 0) {
|
|
184
|
+
setIsSearchCleared(true);
|
|
185
|
+
}
|
|
186
|
+
// RESET Search Params
|
|
187
|
+
setSearchParams(INITIAL_SEARCH_PARAMS);
|
|
188
|
+
return query;
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
const debouncedChangeSearch = debounce(onChangeSearch, 500);
|
|
192
|
+
|
|
193
|
+
const updateScanList = async (query: string = '') => {
|
|
194
|
+
try {
|
|
195
|
+
if (searchParams.hasNextPage) {
|
|
196
|
+
const { data: result, totalCount } = await getScanData(
|
|
197
|
+
activeTab,
|
|
198
|
+
props.scanProps,
|
|
199
|
+
searchParams.limit,
|
|
200
|
+
searchParams.offset,
|
|
201
|
+
query
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
if (query) {
|
|
205
|
+
setSearchParams((searchParams) => ({
|
|
206
|
+
hasNextPage: Boolean(
|
|
207
|
+
totalCount - (searchParams.offset + searchParams.limit) > 0
|
|
208
|
+
),
|
|
209
|
+
offset: searchParams.offset + result.length,
|
|
210
|
+
limit: searchParams.limit,
|
|
211
|
+
}));
|
|
212
|
+
setScanList((scanList) => {
|
|
213
|
+
const updatedScanList = result;
|
|
214
|
+
setDataProvider((dataProvider) => {
|
|
215
|
+
return createNewDataProvider().cloneWithRows(updatedScanList);
|
|
216
|
+
});
|
|
217
|
+
return updatedScanList;
|
|
218
|
+
});
|
|
219
|
+
} else {
|
|
220
|
+
setSearchParams((searchParams) => ({
|
|
221
|
+
hasNextPage: Boolean(
|
|
222
|
+
totalCount - (searchParams.offset + searchParams.limit) > 0
|
|
223
|
+
),
|
|
224
|
+
offset: searchParams.offset + result.length,
|
|
225
|
+
limit: searchParams.limit,
|
|
226
|
+
}));
|
|
227
|
+
setScanList((scanList: DisplaySummary[]) => {
|
|
228
|
+
let updatedScanList: DisplaySummary[] = [];
|
|
229
|
+
if (isSearchCleared) updatedScanList = [...result];
|
|
230
|
+
else updatedScanList = dataProvider.getAllData().concat(result);
|
|
231
|
+
|
|
232
|
+
setIsSearchCleared(false);
|
|
233
|
+
setDataProvider((dataProvider) => {
|
|
234
|
+
if (dataProvider)
|
|
235
|
+
return dataProvider.cloneWithRows(updatedScanList);
|
|
236
|
+
else return dataProvider;
|
|
237
|
+
});
|
|
238
|
+
return updatedScanList;
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
} catch (error) {
|
|
243
|
+
} finally {
|
|
244
|
+
props.scanProps.showProgress(false);
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
useEffect(() => {
|
|
249
|
+
(async () => {
|
|
250
|
+
const count = await getTabCount(props.scanProps);
|
|
251
|
+
setTabs([
|
|
252
|
+
{ title: SummaryPageTabs.ALL, count: count[SummaryPageTabs.ALL] },
|
|
253
|
+
{
|
|
254
|
+
title: SummaryPageTabs.PENDING,
|
|
255
|
+
count: count[SummaryPageTabs.PENDING],
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
title: SummaryPageTabs.DELIVERED,
|
|
259
|
+
count: count[SummaryPageTabs.DELIVERED],
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
title: SummaryPageTabs.UNDELIVERED,
|
|
263
|
+
count: count[SummaryPageTabs.UNDELIVERED],
|
|
264
|
+
},
|
|
265
|
+
]);
|
|
266
|
+
})();
|
|
267
|
+
}, []);
|
|
268
|
+
|
|
269
|
+
useEffect(() => {
|
|
270
|
+
(async () => {
|
|
271
|
+
props.scanProps.showProgress(true);
|
|
272
|
+
|
|
273
|
+
setIsLoading(true);
|
|
274
|
+
await updateScanList(searchQuery);
|
|
275
|
+
setIsLoading(false);
|
|
276
|
+
|
|
277
|
+
props.scanProps.showProgress(false);
|
|
278
|
+
|
|
279
|
+
if (isRemoved) setIsRemoved(false);
|
|
280
|
+
})();
|
|
281
|
+
}, [isRemoved, activeTab, searchQuery]);
|
|
282
|
+
|
|
283
|
+
useEffect(() => {
|
|
284
|
+
editedEventCode?.code &&
|
|
285
|
+
(async () => {
|
|
286
|
+
let response = await getErcDropDownItems(
|
|
287
|
+
'REASON',
|
|
288
|
+
props.ercSelector || [],
|
|
289
|
+
editedEventCode?.code
|
|
290
|
+
);
|
|
291
|
+
if (response.length) {
|
|
292
|
+
// setReasonItems(response);
|
|
293
|
+
setEditedReasonItems(response);
|
|
294
|
+
setEditedReason(response[0]);
|
|
295
|
+
} else {
|
|
296
|
+
// setReasonItems([]);
|
|
297
|
+
setEditedReasonItems([]);
|
|
298
|
+
setEditedReason(undefined);
|
|
299
|
+
}
|
|
300
|
+
})();
|
|
301
|
+
}, [editedEventCode?.code]);
|
|
302
|
+
|
|
303
|
+
// Triggered when the user reaches the end of the list
|
|
304
|
+
const onEndReached = async () => {
|
|
305
|
+
if (searchParams.hasNextPage === false || searchQuery.length > 0) return;
|
|
306
|
+
|
|
307
|
+
// Fetch more data when the user reaches the end of the list
|
|
308
|
+
setIsLoadingMore(true);
|
|
309
|
+
await updateScanList();
|
|
310
|
+
setIsLoadingMore(false);
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
const renderEditERCModal = () => {
|
|
314
|
+
return (
|
|
315
|
+
<ModalWidget
|
|
316
|
+
showModal={showEditModal}
|
|
317
|
+
contentContainerStyle={{ marginStart: 40, marginEnd: 40 }}
|
|
318
|
+
title={{ label: 'Update' }}
|
|
319
|
+
renderChildren={() => {
|
|
320
|
+
return (
|
|
321
|
+
<View style={{ marginHorizontal: 16, marginBottom: 20 }}>
|
|
322
|
+
<View style={{ marginBottom: 16 }}>
|
|
323
|
+
<ERDropDown
|
|
324
|
+
title={'Event'}
|
|
325
|
+
style={{ height: 50 }}
|
|
326
|
+
selectedReason={editedEventCode}
|
|
327
|
+
items={props.eventCodeItems}
|
|
328
|
+
onItemChange={(eventItem: ercItem | null) => {
|
|
329
|
+
if (eventItem !== null) setEditedEventCode(eventItem);
|
|
330
|
+
}}
|
|
331
|
+
/>
|
|
332
|
+
</View>
|
|
333
|
+
<View style={{ marginVertical: 20 }}>
|
|
334
|
+
<ERDropDown
|
|
335
|
+
title={'Reason'}
|
|
336
|
+
style={{ height: 50 }}
|
|
337
|
+
selectedReason={editedReason}
|
|
338
|
+
disabled={
|
|
339
|
+
!editedReasonItems || !editedReasonItems?.length
|
|
340
|
+
? true
|
|
341
|
+
: false
|
|
342
|
+
}
|
|
343
|
+
items={editedReasonItems ?? []}
|
|
344
|
+
onItemChange={(reasonItem: ercItem | null) => {
|
|
345
|
+
if (reasonItem !== null) setEditedReason(reasonItem);
|
|
346
|
+
}}
|
|
347
|
+
/>
|
|
348
|
+
</View>
|
|
349
|
+
</View>
|
|
350
|
+
);
|
|
351
|
+
}}
|
|
352
|
+
buttonStyle={modalStyles.buttonStyles}
|
|
353
|
+
primaryButton={{
|
|
354
|
+
label: 'Update',
|
|
355
|
+
styles: { ...modalStyles.editERCButton, marginStart: 5 },
|
|
356
|
+
onPress: async () => {
|
|
357
|
+
const scan = selectedEditItem;
|
|
358
|
+
|
|
359
|
+
props.scanProps.showProgress(true);
|
|
360
|
+
if (scan && editedEventCode && editedEventCode.code) {
|
|
361
|
+
// UPDATE OUTPUT
|
|
362
|
+
|
|
363
|
+
try {
|
|
364
|
+
const {
|
|
365
|
+
status,
|
|
366
|
+
message,
|
|
367
|
+
type,
|
|
368
|
+
data: scanResult,
|
|
369
|
+
} = await addScans(
|
|
370
|
+
scan.scanId,
|
|
371
|
+
props.scanProps,
|
|
372
|
+
props.mergedScanETOutput,
|
|
373
|
+
props.eventCodeItems,
|
|
374
|
+
editedEventCode,
|
|
375
|
+
editedReason
|
|
376
|
+
);
|
|
377
|
+
if (status === true) {
|
|
378
|
+
// UPDATE COUNT OF TABS
|
|
379
|
+
const count = await getTabCount(props.scanProps);
|
|
380
|
+
setTabs([
|
|
381
|
+
{
|
|
382
|
+
title: SummaryPageTabs.ALL,
|
|
383
|
+
count: count[SummaryPageTabs.ALL],
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
title: SummaryPageTabs.PENDING,
|
|
387
|
+
count: count[SummaryPageTabs.PENDING],
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
title: SummaryPageTabs.DELIVERED,
|
|
391
|
+
count: count[SummaryPageTabs.DELIVERED],
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
title: SummaryPageTabs.UNDELIVERED,
|
|
395
|
+
count: count[SummaryPageTabs.UNDELIVERED],
|
|
396
|
+
},
|
|
397
|
+
]);
|
|
398
|
+
|
|
399
|
+
// UPDATE THE Count
|
|
400
|
+
props.updateShipmentCount(
|
|
401
|
+
scanResult.shipmentCount.scannedCount,
|
|
402
|
+
scanResult.shipmentCount.totalCount
|
|
403
|
+
);
|
|
404
|
+
|
|
405
|
+
if (activeTab === SummaryPageTabs.ALL) {
|
|
406
|
+
setScanList((scanList) => {
|
|
407
|
+
const updatedScanList = [...scanList];
|
|
408
|
+
updatedScanList[scan.index] = {
|
|
409
|
+
scanId: scan.scanId,
|
|
410
|
+
orderId: scan.orderId || '--',
|
|
411
|
+
clientName: scan.clientName || '--',
|
|
412
|
+
eventCode: editedEventCode.text,
|
|
413
|
+
reasonCode: editedReason?.text || '--',
|
|
414
|
+
prefixedMergedObjectiveId:
|
|
415
|
+
scan.prefixedMergedObjectiveId,
|
|
416
|
+
lastStatus: scan.lastStatus,
|
|
417
|
+
};
|
|
418
|
+
setDataProvider((dataProvider) => {
|
|
419
|
+
if (dataProvider)
|
|
420
|
+
return dataProvider.cloneWithRows(updatedScanList);
|
|
421
|
+
else return dataProvider;
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
return updatedScanList;
|
|
425
|
+
});
|
|
426
|
+
} else if (activeTab === SummaryPageTabs.PENDING) {
|
|
427
|
+
setSearchParams({
|
|
428
|
+
...searchParams,
|
|
429
|
+
offset: searchParams.offset - 1,
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
setScanList((scanList) => {
|
|
433
|
+
let updatedScanList = dataProvider.getAllData();
|
|
434
|
+
updatedScanList = updatedScanList.filter(
|
|
435
|
+
(scanItem) => scanItem.scanId !== scan.scanId
|
|
436
|
+
);
|
|
437
|
+
// updatedScanList.splice(scan.index, 1);
|
|
438
|
+
|
|
439
|
+
setDataProvider((dataProvider) => {
|
|
440
|
+
if (dataProvider)
|
|
441
|
+
return dataProvider.cloneWithRows(updatedScanList);
|
|
442
|
+
else return dataProvider;
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
return updatedScanList;
|
|
446
|
+
});
|
|
447
|
+
} else if (activeTab === SummaryPageTabs.DELIVERED) {
|
|
448
|
+
setScanList((scanList) => {
|
|
449
|
+
let updatedScanList = dataProvider.getAllData();
|
|
450
|
+
const successEvent = Boolean(editedEventCode.success);
|
|
451
|
+
if (successEvent) {
|
|
452
|
+
updatedScanList[scan.index] = {
|
|
453
|
+
scanId: scan.scanId,
|
|
454
|
+
orderId: scan.orderId || '--',
|
|
455
|
+
clientName: scan.clientName || '--',
|
|
456
|
+
eventCode: editedEventCode.text,
|
|
457
|
+
reasonCode: editedReason?.text || '--',
|
|
458
|
+
prefixedMergedObjectiveId:
|
|
459
|
+
scan.prefixedMergedObjectiveId,
|
|
460
|
+
lastStatus: scan.lastStatus,
|
|
461
|
+
};
|
|
462
|
+
} else {
|
|
463
|
+
setSearchParams({
|
|
464
|
+
...searchParams,
|
|
465
|
+
offset: searchParams.offset - 1,
|
|
466
|
+
});
|
|
467
|
+
updatedScanList = updatedScanList.filter(
|
|
468
|
+
(scanItem) => scanItem.scanId !== scan.scanId
|
|
469
|
+
);
|
|
470
|
+
}
|
|
471
|
+
setDataProvider((dataProvider) => {
|
|
472
|
+
if (dataProvider)
|
|
473
|
+
return dataProvider.cloneWithRows(updatedScanList);
|
|
474
|
+
else return dataProvider;
|
|
475
|
+
});
|
|
476
|
+
|
|
477
|
+
return updatedScanList;
|
|
478
|
+
});
|
|
479
|
+
} else if (activeTab === SummaryPageTabs.UNDELIVERED) {
|
|
480
|
+
setScanList((scanList) => {
|
|
481
|
+
let updatedScanList = dataProvider.getAllData();
|
|
482
|
+
const successEvent = Boolean(editedEventCode.success);
|
|
483
|
+
if (!successEvent) {
|
|
484
|
+
updatedScanList[scan.index] = {
|
|
485
|
+
scanId: scan.scanId,
|
|
486
|
+
orderId: scan.orderId || '--',
|
|
487
|
+
clientName: scan.clientName || '--',
|
|
488
|
+
eventCode: editedEventCode.text,
|
|
489
|
+
reasonCode: editedReason?.text || '--',
|
|
490
|
+
prefixedMergedObjectiveId:
|
|
491
|
+
scan.prefixedMergedObjectiveId,
|
|
492
|
+
lastStatus: scan.lastStatus,
|
|
493
|
+
};
|
|
494
|
+
} else {
|
|
495
|
+
setSearchParams({
|
|
496
|
+
...searchParams,
|
|
497
|
+
offset: searchParams.offset - 1,
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
updatedScanList = updatedScanList.filter(
|
|
501
|
+
(scanItem) => scanItem.scanId !== scan.scanId
|
|
502
|
+
);
|
|
503
|
+
}
|
|
504
|
+
setDataProvider((dataProvider) => {
|
|
505
|
+
if (dataProvider)
|
|
506
|
+
return dataProvider.cloneWithRows(updatedScanList);
|
|
507
|
+
else return dataProvider;
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
return updatedScanList;
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
setSnackBar({
|
|
515
|
+
show: true,
|
|
516
|
+
message:
|
|
517
|
+
scan.eventCode !== '--'
|
|
518
|
+
? `#${scan.scanId}\nShipment updated successfully!`
|
|
519
|
+
: message,
|
|
520
|
+
type,
|
|
521
|
+
});
|
|
522
|
+
} else {
|
|
523
|
+
setSnackBar({
|
|
524
|
+
show: true,
|
|
525
|
+
message,
|
|
526
|
+
type,
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
} catch (error) {
|
|
530
|
+
setSnackBar({
|
|
531
|
+
show: true,
|
|
532
|
+
message: 'Some error occurred',
|
|
533
|
+
type: SnackBarType.FAILURE,
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
} else {
|
|
537
|
+
setSnackBar({
|
|
538
|
+
show: true,
|
|
539
|
+
message: 'Some error occurred',
|
|
540
|
+
type: SnackBarType.FAILURE,
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
// RESET KEYS
|
|
545
|
+
props.scanProps.showProgress(false);
|
|
546
|
+
setSelectedEditItem(undefined);
|
|
547
|
+
setShowEditModal(false);
|
|
548
|
+
return;
|
|
549
|
+
},
|
|
550
|
+
}}
|
|
551
|
+
secondaryButton={{
|
|
552
|
+
label: 'Cancel',
|
|
553
|
+
styles: { ...modalStyles.editERCButton, marginEnd: 5 },
|
|
554
|
+
onPress: () => {
|
|
555
|
+
setShowEditModal(false);
|
|
556
|
+
setSelectedEditItem(undefined);
|
|
557
|
+
},
|
|
558
|
+
}}
|
|
559
|
+
/>
|
|
560
|
+
);
|
|
561
|
+
};
|
|
562
|
+
|
|
563
|
+
const renderUnscannedShipmentModal = () => {
|
|
564
|
+
return (
|
|
565
|
+
<ModalWidget
|
|
566
|
+
showModal={showUnscannedShipmentModal}
|
|
567
|
+
title={{ label: 'Pending Shipments' }}
|
|
568
|
+
subTitle={{
|
|
569
|
+
label: `You still have ${tabs[1].count} unscanned shipment!`,
|
|
570
|
+
styles: { textAlign: 'center' },
|
|
571
|
+
}}
|
|
572
|
+
primaryButton={{
|
|
573
|
+
label: 'Continue without Scanning',
|
|
574
|
+
styles: modalStyles.primaryButtonStyles,
|
|
575
|
+
onPress: () => {
|
|
576
|
+
props.handleSubmitET(PROCEED_STATUS.DELIVER_LATER, tabs[1].count);
|
|
577
|
+
},
|
|
578
|
+
}}
|
|
579
|
+
secondaryButton={{
|
|
580
|
+
label: `Keep Scanning`,
|
|
581
|
+
styles: modalStyles.secondaryButtonStyles,
|
|
582
|
+
onPress: () => setShowUnscannedShipmentModal(false),
|
|
583
|
+
}}
|
|
584
|
+
// OLD CODE: When you wanted to update Undelivered shipments with a particular ERC got removed after: https://dev.azure.com/DelhiveryPlatform/Solutions/_workitems/edit/15669
|
|
585
|
+
// secondaryButton={{
|
|
586
|
+
// label: `Mark as Undelivered`,
|
|
587
|
+
// styles: modalStyles.secondaryButtonStyles,
|
|
588
|
+
// onPress: () => {
|
|
589
|
+
// setShowUnscannedShipmentModal(false);
|
|
590
|
+
// setShowERCModal(true);
|
|
591
|
+
// },
|
|
592
|
+
// }}
|
|
593
|
+
// renderAdditionalButtons={() => {
|
|
594
|
+
// return (
|
|
595
|
+
// <TouchableOpacity
|
|
596
|
+
// style={{
|
|
597
|
+
// marginBottom: 16,
|
|
598
|
+
// height: 40,
|
|
599
|
+
// borderRadius: 6,
|
|
600
|
+
// justifyContent: 'center',
|
|
601
|
+
// alignItems: 'center',
|
|
602
|
+
// }}
|
|
603
|
+
// onPress={() => setShowUnscannedShipmentModal(false)}
|
|
604
|
+
// >
|
|
605
|
+
// <Text
|
|
606
|
+
// style={[
|
|
607
|
+
// CommonStyles.cancelButtonLabel,
|
|
608
|
+
// { color: SdkColors[ColorTheme.LIGHT].primaryButton },
|
|
609
|
+
// ]}
|
|
610
|
+
// >
|
|
611
|
+
// Continue Scanning
|
|
612
|
+
// </Text>
|
|
613
|
+
// </TouchableOpacity>
|
|
614
|
+
// );
|
|
615
|
+
// }}
|
|
616
|
+
/>
|
|
617
|
+
);
|
|
618
|
+
};
|
|
619
|
+
|
|
620
|
+
const renderERCModal = () => {
|
|
621
|
+
return (
|
|
622
|
+
<ModalWidget
|
|
623
|
+
showModal={showERCModal}
|
|
624
|
+
contentContainerStyle={{ marginStart: 40, marginEnd: 40 }}
|
|
625
|
+
title={{ label: 'Mark as Undelivered' }}
|
|
626
|
+
subTitle={{
|
|
627
|
+
label: `The shipments shall be updated with the following:`,
|
|
628
|
+
}}
|
|
629
|
+
renderChildren={() => {
|
|
630
|
+
return (
|
|
631
|
+
<View style={{ marginHorizontal: 16, marginBottom: 20 }}>
|
|
632
|
+
<View style={{ marginBottom: 16 }}>
|
|
633
|
+
<ERDropDown
|
|
634
|
+
title={'Event'}
|
|
635
|
+
style={{ height: 50 }}
|
|
636
|
+
selectedReason={selectedEventCode}
|
|
637
|
+
items={filterERCItems(props.eventCodeItems, 'FAILURE')}
|
|
638
|
+
onItemChange={(eventItem: ercItem | null) => {
|
|
639
|
+
if (eventItem !== null) setSelectedEventCode(eventItem);
|
|
640
|
+
}}
|
|
641
|
+
/>
|
|
642
|
+
</View>
|
|
643
|
+
<View style={{ marginVertical: 20 }}>
|
|
644
|
+
<ERDropDown
|
|
645
|
+
title={'Reason'}
|
|
646
|
+
style={{ height: 50 }}
|
|
647
|
+
selectedReason={selectedReason}
|
|
648
|
+
disabled={!reasonItems || !reasonItems?.length ? true : false}
|
|
649
|
+
items={reasonItems ?? []}
|
|
650
|
+
onItemChange={(reasonItem: ercItem | null) => {
|
|
651
|
+
if (reasonItem !== null) setSelectedReason(reasonItem);
|
|
652
|
+
}}
|
|
653
|
+
/>
|
|
654
|
+
</View>
|
|
655
|
+
</View>
|
|
656
|
+
);
|
|
657
|
+
}}
|
|
658
|
+
buttonStyle={{ zIndex: -1 }}
|
|
659
|
+
primaryButton={{
|
|
660
|
+
label: 'Proceed',
|
|
661
|
+
styles: modalStyles.primaryButtonStyles,
|
|
662
|
+
onPress: () => {
|
|
663
|
+
props.handleSubmitET(PROCEED_STATUS.DELIVER_NOW, tabs[1].count, {
|
|
664
|
+
ec: selectedEventCode?.code || '',
|
|
665
|
+
rc: selectedReason?.code || '',
|
|
666
|
+
});
|
|
667
|
+
setShowERCModal(false);
|
|
668
|
+
},
|
|
669
|
+
}}
|
|
670
|
+
secondaryButton={{
|
|
671
|
+
label: `Cancel`,
|
|
672
|
+
styles: modalStyles.secondaryButtonStyles,
|
|
673
|
+
onPress: () => {
|
|
674
|
+
setShowERCModal(false);
|
|
675
|
+
},
|
|
676
|
+
}}
|
|
677
|
+
/>
|
|
678
|
+
);
|
|
679
|
+
};
|
|
680
|
+
|
|
681
|
+
const renderRemoveShipmentModal = () => {
|
|
682
|
+
return (
|
|
683
|
+
<ModalWidget
|
|
684
|
+
showModal={showRemoveShipmentModal}
|
|
685
|
+
contentContainerStyle={{ marginStart: 40, marginEnd: 40 }}
|
|
686
|
+
title={{ label: 'Remove Shipment' }}
|
|
687
|
+
subTitle={{
|
|
688
|
+
label: `${
|
|
689
|
+
Object.keys(selectedItems).length > 1
|
|
690
|
+
? `Are you sure you want to remove the ${
|
|
691
|
+
Object.keys(selectedItems).length
|
|
692
|
+
} shipments?`
|
|
693
|
+
: 'Are you sure you want to remove this shipment?'
|
|
694
|
+
}`,
|
|
695
|
+
styles: modalStyles.subTitleStyles,
|
|
696
|
+
}}
|
|
697
|
+
primaryButton={{
|
|
698
|
+
label: 'Proceed to Remove',
|
|
699
|
+
styles: modalStyles.primaryButtonStyles,
|
|
700
|
+
onPress: async () => {
|
|
701
|
+
props.scanProps.showProgress(true);
|
|
702
|
+
|
|
703
|
+
const prefixedMergedObjectiveId =
|
|
704
|
+
props.scanProps.route.params[RouteParams.ROOT_META_DATA]
|
|
705
|
+
.prefixedMergedObjectiveId;
|
|
706
|
+
|
|
707
|
+
try {
|
|
708
|
+
// REMOVE SCAN
|
|
709
|
+
await removeScan(
|
|
710
|
+
props.scanProps.taskName || '',
|
|
711
|
+
Object.keys(selectedItems),
|
|
712
|
+
props.scanProps.route,
|
|
713
|
+
props.mergedScanETOutput
|
|
714
|
+
);
|
|
715
|
+
|
|
716
|
+
// UPDATE THE Count
|
|
717
|
+
props.updateShipmentCount(
|
|
718
|
+
-Object.keys(selectedItems).length,
|
|
719
|
+
0,
|
|
720
|
+
'REMOVE'
|
|
721
|
+
);
|
|
722
|
+
|
|
723
|
+
// UPDATE COUNT OF TABS
|
|
724
|
+
const count = await getTabCount(props.scanProps);
|
|
725
|
+
|
|
726
|
+
setSearchParams({
|
|
727
|
+
...searchParams,
|
|
728
|
+
offset: searchParams.offset - Object.keys(selectedItems).length,
|
|
729
|
+
});
|
|
730
|
+
|
|
731
|
+
// RESET SCAN LIST
|
|
732
|
+
setScanList((scanList: any) => {
|
|
733
|
+
let updatedScanList: any;
|
|
734
|
+
const itemsRemoved: string[] = [];
|
|
735
|
+
|
|
736
|
+
if (activeTab === SummaryPageTabs.ALL) {
|
|
737
|
+
updatedScanList = [...scanList];
|
|
738
|
+
|
|
739
|
+
Object.keys(selectedItems).forEach((scanId) => {
|
|
740
|
+
const item = selectedItems[scanId]; // returns Display Summary with Index
|
|
741
|
+
|
|
742
|
+
if (
|
|
743
|
+
item.prefixedMergedObjectiveId !==
|
|
744
|
+
prefixedMergedObjectiveId ||
|
|
745
|
+
item.lastStatus ===
|
|
746
|
+
IDispatchExecutor.ExecutionStatus.COMPLETED_FAILURE
|
|
747
|
+
) {
|
|
748
|
+
itemsRemoved.push(item.scanId);
|
|
749
|
+
} else {
|
|
750
|
+
updatedScanList[item.index] = {
|
|
751
|
+
scanId: item.scanId,
|
|
752
|
+
orderId: item.orderId || '--',
|
|
753
|
+
clientName: item.clientName || '--',
|
|
754
|
+
eventCode: '--',
|
|
755
|
+
reasonCode: '--',
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
});
|
|
759
|
+
} else if (
|
|
760
|
+
activeTab === SummaryPageTabs.DELIVERED ||
|
|
761
|
+
activeTab === SummaryPageTabs.UNDELIVERED
|
|
762
|
+
) {
|
|
763
|
+
const indexes = Object.keys(selectedItems).map((scanId) => {
|
|
764
|
+
const item: any = selectedItems[scanId];
|
|
765
|
+
return item.index;
|
|
766
|
+
});
|
|
767
|
+
updatedScanList = scanList.filter(
|
|
768
|
+
(value: any, index: number) => !indexes.includes(index)
|
|
769
|
+
);
|
|
770
|
+
} else {
|
|
771
|
+
updatedScanList = scanList;
|
|
772
|
+
}
|
|
773
|
+
setDataProvider((dataProvider: any) => {
|
|
774
|
+
return dataProvider.cloneWithRows(updatedScanList);
|
|
775
|
+
});
|
|
776
|
+
|
|
777
|
+
setTabs([
|
|
778
|
+
{
|
|
779
|
+
title: SummaryPageTabs.ALL,
|
|
780
|
+
count: count[SummaryPageTabs.ALL],
|
|
781
|
+
},
|
|
782
|
+
{
|
|
783
|
+
title: SummaryPageTabs.PENDING,
|
|
784
|
+
count: count[SummaryPageTabs.PENDING],
|
|
785
|
+
},
|
|
786
|
+
{
|
|
787
|
+
title: SummaryPageTabs.DELIVERED,
|
|
788
|
+
count: count[SummaryPageTabs.DELIVERED],
|
|
789
|
+
},
|
|
790
|
+
{
|
|
791
|
+
title: SummaryPageTabs.UNDELIVERED,
|
|
792
|
+
count: count[SummaryPageTabs.UNDELIVERED],
|
|
793
|
+
},
|
|
794
|
+
]);
|
|
795
|
+
|
|
796
|
+
// RESET MODAL
|
|
797
|
+
setShowRemoveShipmentModal(false);
|
|
798
|
+
|
|
799
|
+
// RESET SELECTED ITEMS
|
|
800
|
+
setSelectedItems({});
|
|
801
|
+
|
|
802
|
+
updatedScanList = updatedScanList.filter(
|
|
803
|
+
(scan: DisplaySummary) => !itemsRemoved.includes(scan.scanId)
|
|
804
|
+
);
|
|
805
|
+
|
|
806
|
+
setDataProvider((dataProvider) => {
|
|
807
|
+
if (dataProvider)
|
|
808
|
+
return dataProvider.cloneWithRows(updatedScanList);
|
|
809
|
+
else return dataProvider;
|
|
810
|
+
});
|
|
811
|
+
|
|
812
|
+
return updatedScanList;
|
|
813
|
+
});
|
|
814
|
+
|
|
815
|
+
// RESET MODAL
|
|
816
|
+
setShowRemoveShipmentModal(false);
|
|
817
|
+
|
|
818
|
+
// RESET SELECTED ITEMS
|
|
819
|
+
setSelectedItems({});
|
|
820
|
+
|
|
821
|
+
// RESET Loader
|
|
822
|
+
props.scanProps.showProgress(false);
|
|
823
|
+
|
|
824
|
+
// Show Success Message
|
|
825
|
+
setSnackBar({
|
|
826
|
+
show: true,
|
|
827
|
+
message: 'Selected items removed successfully!',
|
|
828
|
+
type: SnackBarType.SUCCESS,
|
|
829
|
+
});
|
|
830
|
+
} catch (error) {
|
|
831
|
+
// RESET MODAL
|
|
832
|
+
setShowRemoveShipmentModal(false);
|
|
833
|
+
|
|
834
|
+
setSnackBar({
|
|
835
|
+
show: true,
|
|
836
|
+
message: 'Some error occurred',
|
|
837
|
+
type: SnackBarType.FAILURE,
|
|
838
|
+
});
|
|
839
|
+
} finally {
|
|
840
|
+
props.scanProps.showProgress(false);
|
|
841
|
+
}
|
|
842
|
+
},
|
|
843
|
+
}}
|
|
844
|
+
secondaryButton={{
|
|
845
|
+
label: `Cancel`,
|
|
846
|
+
styles: modalStyles.secondaryButtonStyles,
|
|
847
|
+
onPress: () => {
|
|
848
|
+
setShowRemoveShipmentModal(false);
|
|
849
|
+
},
|
|
850
|
+
}}
|
|
851
|
+
/>
|
|
852
|
+
);
|
|
853
|
+
};
|
|
854
|
+
|
|
855
|
+
const rowRenderer = (_: any, scan: DisplaySummary, index: number) => {
|
|
856
|
+
const prefixedMergedObjectiveId =
|
|
857
|
+
props.scanProps.route.params[RouteParams.ROOT_META_DATA]
|
|
858
|
+
.prefixedMergedObjectiveId;
|
|
859
|
+
|
|
860
|
+
return (
|
|
861
|
+
<Card
|
|
862
|
+
key={scan.scanId}
|
|
863
|
+
title={`#${scan.scanId}`}
|
|
864
|
+
renderAdditionalHeader={() => {
|
|
865
|
+
if (
|
|
866
|
+
scan.prefixedMergedObjectiveId &&
|
|
867
|
+
prefixedMergedObjectiveId !== scan.prefixedMergedObjectiveId
|
|
868
|
+
)
|
|
869
|
+
return (
|
|
870
|
+
<AntDesign name="exclamationcircleo" size={16} color="#EA580C" />
|
|
871
|
+
);
|
|
872
|
+
else return <></>;
|
|
873
|
+
}}
|
|
874
|
+
Body={
|
|
875
|
+
<View style={{ marginVertical: 10 }}>
|
|
876
|
+
<Text style={styles.cardField}>
|
|
877
|
+
<Text style={styles.cardFieldSubText}>Order ID:</Text>{' '}
|
|
878
|
+
{scan.orderId}
|
|
879
|
+
</Text>
|
|
880
|
+
<Text style={styles.cardField}>
|
|
881
|
+
<Text style={styles.cardFieldSubText}>Client Name:</Text>
|
|
882
|
+
{scan.clientName}
|
|
883
|
+
</Text>
|
|
884
|
+
<Text style={styles.cardField}>
|
|
885
|
+
<Text style={styles.cardFieldSubText}>Event:</Text>{' '}
|
|
886
|
+
{scan.eventCode}
|
|
887
|
+
</Text>
|
|
888
|
+
<Text>
|
|
889
|
+
<Text style={styles.cardFieldSubText}>Reason:</Text>
|
|
890
|
+
{scan.reasonCode || ''}
|
|
891
|
+
</Text>
|
|
892
|
+
</View>
|
|
893
|
+
}
|
|
894
|
+
editConfig={{
|
|
895
|
+
onEdit: (props: any) => {
|
|
896
|
+
if (selectedItems && Object.keys(selectedItems).length > 1) {
|
|
897
|
+
setSnackBar({
|
|
898
|
+
show: true,
|
|
899
|
+
message: 'Cannot Edit Multiple Items',
|
|
900
|
+
type: SnackBarType.FAILURE,
|
|
901
|
+
});
|
|
902
|
+
} else {
|
|
903
|
+
setSelectedItems({});
|
|
904
|
+
setShowEditModal(true);
|
|
905
|
+
setSelectedEditItem({ ...props, index });
|
|
906
|
+
}
|
|
907
|
+
},
|
|
908
|
+
props: scan,
|
|
909
|
+
}}
|
|
910
|
+
selectConfig={{
|
|
911
|
+
isSelected: selectedItems[scan.scanId] ? true : false,
|
|
912
|
+
onSelect: (props: DisplaySummary) => {
|
|
913
|
+
setSelectedItems((selectedItems) => {
|
|
914
|
+
// Unselect
|
|
915
|
+
if (selectedItems[props.scanId]) {
|
|
916
|
+
const _selectedItems = { ...selectedItems };
|
|
917
|
+
delete _selectedItems[props.scanId];
|
|
918
|
+
return _selectedItems;
|
|
919
|
+
} else {
|
|
920
|
+
return {
|
|
921
|
+
...selectedItems,
|
|
922
|
+
[props.scanId]: { ...props, index },
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
});
|
|
926
|
+
},
|
|
927
|
+
props: scan,
|
|
928
|
+
}}
|
|
929
|
+
/>
|
|
930
|
+
);
|
|
931
|
+
};
|
|
932
|
+
|
|
933
|
+
const renderBody = (currentTab: string) => {
|
|
934
|
+
return (
|
|
935
|
+
<View style={{ flex: 1 }}>
|
|
936
|
+
<View style={styles.searchBar}>
|
|
937
|
+
<SearchBar
|
|
938
|
+
searchText={searchText}
|
|
939
|
+
setSearchText={setSearchText}
|
|
940
|
+
placeholder="Shipment ID"
|
|
941
|
+
onChangeSearch={(searchText) => debouncedChangeSearch(searchText)}
|
|
942
|
+
onClear={() => {
|
|
943
|
+
setSearchQuery(() => {
|
|
944
|
+
setIsSearchCleared(true);
|
|
945
|
+
setSearchParams(INITIAL_SEARCH_PARAMS);
|
|
946
|
+
return '';
|
|
947
|
+
});
|
|
948
|
+
}}
|
|
949
|
+
/>
|
|
950
|
+
</View>
|
|
951
|
+
{!isLoading && scanList && scanList.length > 0 ? (
|
|
952
|
+
<RecyclerListView
|
|
953
|
+
layoutProvider={_layoutProvider}
|
|
954
|
+
dataProvider={dataProvider}
|
|
955
|
+
rowRenderer={(type: any, scanData: any, index: number) =>
|
|
956
|
+
rowRenderer(type, scanData, index)
|
|
957
|
+
}
|
|
958
|
+
onEndReached={async () => await onEndReached()}
|
|
959
|
+
onEndReachedThreshold={0.5}
|
|
960
|
+
renderFooter={() => {
|
|
961
|
+
return (
|
|
962
|
+
<>
|
|
963
|
+
{isLoadingMore ? (
|
|
964
|
+
<Text
|
|
965
|
+
style={{
|
|
966
|
+
padding: 10,
|
|
967
|
+
fontWeight: 'bold',
|
|
968
|
+
textAlign: 'center',
|
|
969
|
+
}}
|
|
970
|
+
>
|
|
971
|
+
Loading
|
|
972
|
+
</Text>
|
|
973
|
+
) : null}
|
|
974
|
+
</>
|
|
975
|
+
);
|
|
976
|
+
}}
|
|
977
|
+
/>
|
|
978
|
+
) : null}
|
|
979
|
+
{!isLoading && scanList.length === 0 ? (
|
|
980
|
+
<View
|
|
981
|
+
style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}
|
|
982
|
+
>
|
|
983
|
+
<FileIcon />
|
|
984
|
+
<Text
|
|
985
|
+
style={{
|
|
986
|
+
color: '#3D445C',
|
|
987
|
+
fontFamily:
|
|
988
|
+
Platform.OS === 'android'
|
|
989
|
+
? Fonts.IBMPlexSans_500Medium
|
|
990
|
+
: 'IBMPlexSans-Medium',
|
|
991
|
+
fontStyle: 'normal',
|
|
992
|
+
fontWeight: '500',
|
|
993
|
+
fontSize: 16,
|
|
994
|
+
marginTop: 24,
|
|
995
|
+
}}
|
|
996
|
+
>{`You do not have any ${activeTab.toLowerCase()} shipments`}</Text>
|
|
997
|
+
{activeTab === SummaryPageTabs.PENDING ? (
|
|
998
|
+
<Text
|
|
999
|
+
style={{
|
|
1000
|
+
color: '#525B7A',
|
|
1001
|
+
fontFamily:
|
|
1002
|
+
Platform.OS === 'android'
|
|
1003
|
+
? Fonts.IBMPlexSans_400Regular
|
|
1004
|
+
: 'IBMPlexSans-Regular',
|
|
1005
|
+
fontStyle: 'normal',
|
|
1006
|
+
fontWeight: '400',
|
|
1007
|
+
fontSize: 14,
|
|
1008
|
+
}}
|
|
1009
|
+
>
|
|
1010
|
+
You can proceed to the next step now
|
|
1011
|
+
</Text>
|
|
1012
|
+
) : null}
|
|
1013
|
+
</View>
|
|
1014
|
+
) : null}
|
|
1015
|
+
</View>
|
|
1016
|
+
);
|
|
1017
|
+
};
|
|
1018
|
+
|
|
1019
|
+
const renderTabItem = (tab: Tab) => {
|
|
1020
|
+
return (
|
|
1021
|
+
<View style={styles.tabItem}>
|
|
1022
|
+
<View style={styles.tabText}>
|
|
1023
|
+
<Text
|
|
1024
|
+
style={activeTab === tab.title ? { color: '#5B80F7' } : {}}
|
|
1025
|
+
>{`${tab.title}`}</Text>
|
|
1026
|
+
</View>
|
|
1027
|
+
<View
|
|
1028
|
+
style={
|
|
1029
|
+
activeTab !== tab.title
|
|
1030
|
+
? styles.tabCount
|
|
1031
|
+
: [styles.tabCount, { backgroundColor: '#ECF0FF' }]
|
|
1032
|
+
}
|
|
1033
|
+
>
|
|
1034
|
+
<Text>{`${tab.count}`}</Text>
|
|
1035
|
+
</View>
|
|
1036
|
+
</View>
|
|
1037
|
+
);
|
|
1038
|
+
};
|
|
1039
|
+
// END: Summary List Handling
|
|
1040
|
+
|
|
1041
|
+
return (
|
|
1042
|
+
<>
|
|
1043
|
+
{renderERCModal()}
|
|
1044
|
+
{renderUnscannedShipmentModal()}
|
|
1045
|
+
{renderEditERCModal()}
|
|
1046
|
+
{renderRemoveShipmentModal()}
|
|
1047
|
+
<View style={{ flex: 1 }}>
|
|
1048
|
+
<TabsComponent
|
|
1049
|
+
tabs={tabs}
|
|
1050
|
+
initialTab={tabs[1]}
|
|
1051
|
+
onTabChange={(currentTab: string) => {
|
|
1052
|
+
if (activeTab === currentTab) {
|
|
1053
|
+
return;
|
|
1054
|
+
}
|
|
1055
|
+
// @ts-ignore
|
|
1056
|
+
setActiveTab((activeTab) => {
|
|
1057
|
+
// RESET Search TEXT
|
|
1058
|
+
setSearchText('');
|
|
1059
|
+
setSearchQuery('');
|
|
1060
|
+
|
|
1061
|
+
// RESET SEARCH PARAMS
|
|
1062
|
+
setSearchParams(INITIAL_SEARCH_PARAMS);
|
|
1063
|
+
|
|
1064
|
+
// RESET SCAN LIST
|
|
1065
|
+
setScanList((scanList: any) => {
|
|
1066
|
+
const updatedScanList: any = [];
|
|
1067
|
+
setDataProvider((dataProvider) => {
|
|
1068
|
+
if (dataProvider)
|
|
1069
|
+
return dataProvider.cloneWithRows(updatedScanList);
|
|
1070
|
+
else return dataProvider;
|
|
1071
|
+
});
|
|
1072
|
+
return updatedScanList;
|
|
1073
|
+
});
|
|
1074
|
+
|
|
1075
|
+
// RESET SELECTED ITEMS
|
|
1076
|
+
setSelectedItems({});
|
|
1077
|
+
|
|
1078
|
+
return currentTab;
|
|
1079
|
+
});
|
|
1080
|
+
}}
|
|
1081
|
+
renderTabItem={renderTabItem}
|
|
1082
|
+
renderBody={renderBody}
|
|
1083
|
+
/>
|
|
1084
|
+
</View>
|
|
1085
|
+
<View style={{ justifyContent: 'flex-end' }}>
|
|
1086
|
+
<SnackBarCustom
|
|
1087
|
+
type={snackBar.type}
|
|
1088
|
+
message={`${snackBar.message}`}
|
|
1089
|
+
visible={snackBar.show}
|
|
1090
|
+
onDismiss={() => {
|
|
1091
|
+
setSnackBar({
|
|
1092
|
+
show: false,
|
|
1093
|
+
message: '',
|
|
1094
|
+
type: SnackBarType.SUCCESS,
|
|
1095
|
+
});
|
|
1096
|
+
}}
|
|
1097
|
+
customBottom={20}
|
|
1098
|
+
/>
|
|
1099
|
+
</View>
|
|
1100
|
+
{!selectedItems || Object.keys(selectedItems).length === 0 ? (
|
|
1101
|
+
<View style={styles.bottomView}>{renderActionButtons()}</View>
|
|
1102
|
+
) : null}
|
|
1103
|
+
{selectedItems &&
|
|
1104
|
+
Object.keys(selectedItems).length &&
|
|
1105
|
+
activeTab !== SummaryPageTabs.PENDING ? (
|
|
1106
|
+
<View style={styles.removeBtnContainer}>
|
|
1107
|
+
<View
|
|
1108
|
+
style={{
|
|
1109
|
+
flexDirection: 'row',
|
|
1110
|
+
alignItems: 'center',
|
|
1111
|
+
marginLeft: 10,
|
|
1112
|
+
}}
|
|
1113
|
+
>
|
|
1114
|
+
<TouchableOpacity
|
|
1115
|
+
onPress={() => setSelectedItems({})}
|
|
1116
|
+
style={styles.removeSelection}
|
|
1117
|
+
>
|
|
1118
|
+
<Entypo name="cross" size={24} color="#3D445C" />
|
|
1119
|
+
</TouchableOpacity>
|
|
1120
|
+
<Text>{`${Object.keys(selectedItems).length} Selected`}</Text>
|
|
1121
|
+
</View>
|
|
1122
|
+
<Button
|
|
1123
|
+
labelStyle={CommonStyles.mainExitButtonLabel}
|
|
1124
|
+
style={[CommonStyles.mainExitButton, styles.removeBtn]}
|
|
1125
|
+
onPress={() => {
|
|
1126
|
+
if (canRemove(selectedItems)) setShowRemoveShipmentModal(true);
|
|
1127
|
+
else {
|
|
1128
|
+
setSnackBar({
|
|
1129
|
+
show: true,
|
|
1130
|
+
message: 'Cannot Remove unscanned shipment(s)',
|
|
1131
|
+
type: SnackBarType.FAILURE,
|
|
1132
|
+
});
|
|
1133
|
+
}
|
|
1134
|
+
}}
|
|
1135
|
+
>
|
|
1136
|
+
Remove
|
|
1137
|
+
</Button>
|
|
1138
|
+
</View>
|
|
1139
|
+
) : null}
|
|
1140
|
+
</>
|
|
1141
|
+
);
|
|
1142
|
+
};
|
|
1143
|
+
|
|
1144
|
+
export default SummaryPage;
|
|
1145
|
+
|
|
1146
|
+
const styles = StyleSheet.create({
|
|
1147
|
+
bottomView: {
|
|
1148
|
+
paddingBottom: 16,
|
|
1149
|
+
justifyContent: 'flex-end',
|
|
1150
|
+
marginVertical: 10,
|
|
1151
|
+
marginHorizontal: 16,
|
|
1152
|
+
},
|
|
1153
|
+
modalContent: {
|
|
1154
|
+
marginStart: 60,
|
|
1155
|
+
marginEnd: 60,
|
|
1156
|
+
flex: 1,
|
|
1157
|
+
marginBottom: 60,
|
|
1158
|
+
},
|
|
1159
|
+
modalView: {
|
|
1160
|
+
backgroundColor: 'white',
|
|
1161
|
+
padding: 15,
|
|
1162
|
+
borderRadius: 9,
|
|
1163
|
+
},
|
|
1164
|
+
titleText: {
|
|
1165
|
+
justifyContent: 'center',
|
|
1166
|
+
fontFamily:
|
|
1167
|
+
Platform.OS === 'android'
|
|
1168
|
+
? Fonts.IBMPlexSans_600SemiBold
|
|
1169
|
+
: 'IBMPlexSans-SemiBold',
|
|
1170
|
+
fontStyle: 'normal',
|
|
1171
|
+
fontSize: 14,
|
|
1172
|
+
lineHeight: 20,
|
|
1173
|
+
textAlign: 'center',
|
|
1174
|
+
color: '#111111',
|
|
1175
|
+
marginBottom: 10,
|
|
1176
|
+
},
|
|
1177
|
+
subText: {
|
|
1178
|
+
justifyContent: 'center',
|
|
1179
|
+
fontFamily:
|
|
1180
|
+
Platform.OS === 'android'
|
|
1181
|
+
? Fonts.IBMPlexSans_400Regular
|
|
1182
|
+
: 'IBMPlexSans-Regular',
|
|
1183
|
+
fontStyle: 'normal',
|
|
1184
|
+
fontSize: 14,
|
|
1185
|
+
letterSpacing: 0.25,
|
|
1186
|
+
lineHeight: 20,
|
|
1187
|
+
textAlign: 'center',
|
|
1188
|
+
color: '#000000',
|
|
1189
|
+
marginBottom: 10,
|
|
1190
|
+
},
|
|
1191
|
+
bottomButtons: {
|
|
1192
|
+
justifyContent: 'space-between',
|
|
1193
|
+
flexDirection: 'row',
|
|
1194
|
+
marginTop: 8,
|
|
1195
|
+
},
|
|
1196
|
+
unscannedShipmentModalSubText: {
|
|
1197
|
+
justifyContent: 'center',
|
|
1198
|
+
fontFamily:
|
|
1199
|
+
Platform.OS === 'android'
|
|
1200
|
+
? Fonts.IBMPlexSans_400Regular
|
|
1201
|
+
: 'IBMPlexSans-Regular',
|
|
1202
|
+
fontStyle: 'normal',
|
|
1203
|
+
fontSize: 14,
|
|
1204
|
+
letterSpacing: 0.25,
|
|
1205
|
+
lineHeight: 20,
|
|
1206
|
+
color: '#000000',
|
|
1207
|
+
marginBottom: 10,
|
|
1208
|
+
},
|
|
1209
|
+
tabItem: {
|
|
1210
|
+
// width: 200,
|
|
1211
|
+
flexDirection: 'row',
|
|
1212
|
+
justifyContent: 'center',
|
|
1213
|
+
alignItems: 'center',
|
|
1214
|
+
paddingVertical: 5,
|
|
1215
|
+
marginHorizontal: 10,
|
|
1216
|
+
},
|
|
1217
|
+
activeTab: {
|
|
1218
|
+
borderBottomWidth: 2,
|
|
1219
|
+
borderBottomColor: 'blue',
|
|
1220
|
+
},
|
|
1221
|
+
tabText: {
|
|
1222
|
+
fontSize: 16,
|
|
1223
|
+
fontWeight: '400',
|
|
1224
|
+
color: '#3D445C',
|
|
1225
|
+
marginRight: 12,
|
|
1226
|
+
},
|
|
1227
|
+
tabCount: {
|
|
1228
|
+
borderRadius: 50,
|
|
1229
|
+
backgroundColor: '#E0E3EB',
|
|
1230
|
+
paddingHorizontal: 15,
|
|
1231
|
+
textAlign: 'center',
|
|
1232
|
+
},
|
|
1233
|
+
removeBtnContainer: {
|
|
1234
|
+
borderTopWidth: 1,
|
|
1235
|
+
borderTopColor: '#E0E3EB',
|
|
1236
|
+
padding: 10,
|
|
1237
|
+
flexDirection: 'row',
|
|
1238
|
+
alignItems: 'center',
|
|
1239
|
+
justifyContent: 'space-between',
|
|
1240
|
+
},
|
|
1241
|
+
removeSelection: {
|
|
1242
|
+
marginRight: 20,
|
|
1243
|
+
},
|
|
1244
|
+
removeBtn: {
|
|
1245
|
+
marginRight: 10,
|
|
1246
|
+
},
|
|
1247
|
+
searchBar: {
|
|
1248
|
+
marginTop: 16,
|
|
1249
|
+
},
|
|
1250
|
+
cardField: {
|
|
1251
|
+
marginBottom: 8,
|
|
1252
|
+
},
|
|
1253
|
+
cardFieldSubText: {
|
|
1254
|
+
color: '#A3AAC2',
|
|
1255
|
+
},
|
|
1256
|
+
});
|
|
1257
|
+
|
|
1258
|
+
const modalStyles = StyleSheet.create({
|
|
1259
|
+
primaryButtonStyles: {
|
|
1260
|
+
marginTop: 16,
|
|
1261
|
+
height: 40,
|
|
1262
|
+
borderRadius: 6,
|
|
1263
|
+
justifyContent: 'center',
|
|
1264
|
+
alignItems: 'center',
|
|
1265
|
+
},
|
|
1266
|
+
secondaryButtonStyles: {
|
|
1267
|
+
marginVertical: 16,
|
|
1268
|
+
height: 40,
|
|
1269
|
+
borderRadius: 6,
|
|
1270
|
+
justifyContent: 'center',
|
|
1271
|
+
alignItems: 'center',
|
|
1272
|
+
},
|
|
1273
|
+
subTitleStyles: { textAlign: 'center' },
|
|
1274
|
+
buttonStyles: {
|
|
1275
|
+
justifyContent: 'space-between',
|
|
1276
|
+
flexDirection: 'row-reverse',
|
|
1277
|
+
marginTop: 20,
|
|
1278
|
+
zIndex: -1,
|
|
1279
|
+
},
|
|
1280
|
+
editERCButton: {
|
|
1281
|
+
justifyContent: 'center',
|
|
1282
|
+
alignItems: 'center',
|
|
1283
|
+
flex: 1,
|
|
1284
|
+
height: 40,
|
|
1285
|
+
borderRadius: 6,
|
|
1286
|
+
},
|
|
1287
|
+
});
|
|
1288
|
+
|
|
1289
|
+
function canRemove(scans: { [scanId: string]: DisplaySummary }): boolean {
|
|
1290
|
+
for (const scanId in scans) {
|
|
1291
|
+
const item = scans[scanId];
|
|
1292
|
+
if (item.eventCode && item.eventCode !== '--') continue;
|
|
1293
|
+
else return false;
|
|
1294
|
+
}
|
|
1295
|
+
return true;
|
|
1296
|
+
}
|