-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[ENG-887] Fix internal and external delivery batch failure and refine supply delivery limit UI #16661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
[ENG-887] Fix internal and external delivery batch failure and refine supply delivery limit UI #16661
Changes from 1 commit
8af2fcc
6b395a5
5914505
88ca1a9
79db63c
d5a0115
e0520a1
90f9e34
9432850
2692ceb
77d07d2
0ba9bea
5392e1a
a1b51bc
66c7c29
78188be
9445a5c
e09e007
dcc43a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,8 @@ import { useMemo, useState } from "react"; | |
| import { Trans, useTranslation } from "react-i18next"; | ||
| import { toast } from "sonner"; | ||
|
|
||
| import careConfig from "@careConfig"; | ||
|
|
||
| import CareIcon from "@/CAREUI/icons/CareIcon"; | ||
| import ConfirmActionDialog from "@/components/Common/ConfirmActionDialog"; | ||
| import Page from "@/components/Common/Page"; | ||
|
|
@@ -252,6 +254,9 @@ export function DeliveryOrderShow({ | |
| }); | ||
| const { open: isSidebarOpen } = useSidebar(); | ||
|
|
||
| const exceedsUpsertLimit = | ||
| selectedDeliveries.length > careConfig.maxDatapointsPerUpsert; | ||
|
|
||
|
NikhilA8606 marked this conversation as resolved.
Outdated
|
||
| const { data: deliveryOrder, isLoading } = useQuery({ | ||
| queryKey: ["deliveryOrders", deliveryOrderId], | ||
| queryFn: query(deliveryOrderApi.retrieveDeliveryOrder, { | ||
|
|
@@ -288,6 +293,7 @@ export function DeliveryOrderShow({ | |
| queryClient.invalidateQueries({ | ||
| queryKey: ["supplyDeliveries", deliveryOrderId], | ||
| }); | ||
| setSelectedDeliveries([]); | ||
| toast.success(t("supply_deliveries_updated_successfully")); | ||
| }, | ||
| onError: (_error) => { | ||
|
|
@@ -362,7 +368,6 @@ export function DeliveryOrderShow({ | |
| upsertSupplyDeliveries({ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| datapoints: selectedSupplyDeliveries, | ||
| }); | ||
|
NikhilA8606 marked this conversation as resolved.
|
||
| setSelectedDeliveries([]); | ||
| } | ||
|
|
||
| function handleMarkAsDamaged() { | ||
|
|
@@ -388,7 +393,6 @@ export function DeliveryOrderShow({ | |
| upsertSupplyDeliveries({ | ||
| datapoints: selectedSupplyDeliveries, | ||
| }); | ||
| setSelectedDeliveries([]); | ||
| } | ||
|
|
||
| function handleSubmitDialog() { | ||
|
|
@@ -411,7 +415,6 @@ export function DeliveryOrderShow({ | |
| upsertSupplyDeliveries({ | ||
| datapoints: selectedSupplyDeliveries, | ||
| }); | ||
| setSelectedDeliveries([]); | ||
| setConfirmDialog((prev) => ({ ...prev, open: false })); | ||
| } | ||
|
|
||
|
|
@@ -578,7 +581,8 @@ export function DeliveryOrderShow({ | |
| disabled={ | ||
| isUpsertingDeliveries || | ||
| isUpdating || | ||
| selectedDeliveries.length !== 0 | ||
| selectedDeliveries.length !== 0 || | ||
| exceedsUpsertLimit | ||
|
NikhilA8606 marked this conversation as resolved.
Outdated
NikhilA8606 marked this conversation as resolved.
Outdated
NikhilA8606 marked this conversation as resolved.
Outdated
NikhilA8606 marked this conversation as resolved.
Outdated
|
||
| } | ||
| > | ||
| {isUpdating ? t("updating") : t("mark_as_completed")} | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.