mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-09-30 06:53:12 +00:00
The queue Amount column, the detail modal and the reject/revoke dialogs showed requestedNTE (the resulting NTE total) while the decision toasts showed delta (the increase), so a work order with an existing NTE named two different figures for one request. Route every surface through one upliftAmount helper that returns the increase, matching the prototype's single uplift amount, and show it on both Approve buttons.
43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
import { RejectDialog } from "@/app/(protected)/uplifts/_components/reject-dialog";
|
|
import { RevokeDialog } from "@/app/(protected)/uplifts/_components/revoke-dialog";
|
|
import { upliftAmount } from "@/domain/uplifts/utils/uplift-amount";
|
|
import type { useUpliftApprovalController } from "@/domain/uplifts/use-cases/use-uplift-approval-controller";
|
|
|
|
export type UpliftApprovalController = ReturnType<typeof useUpliftApprovalController>;
|
|
|
|
function woFallbackNumber(target: UpliftApprovalController["rejectTarget"]): string {
|
|
return target?.woNumber || String(target?.workOrderId ?? "");
|
|
}
|
|
|
|
export function UpliftDecisionDialogs({ controller }: { controller: UpliftApprovalController }) {
|
|
const {
|
|
rejectTarget,
|
|
revokeTarget,
|
|
rejectPending,
|
|
revokePending,
|
|
handleRejectConfirm,
|
|
handleRevokeConfirm,
|
|
closeReject,
|
|
closeRevoke,
|
|
} = controller;
|
|
return (
|
|
<>
|
|
<RejectDialog
|
|
open={rejectTarget != null}
|
|
amount={rejectTarget ? upliftAmount(rejectTarget) : undefined}
|
|
woNumber={woFallbackNumber(rejectTarget)}
|
|
onClose={closeReject}
|
|
onConfirm={handleRejectConfirm}
|
|
isPending={rejectPending}
|
|
/>
|
|
<RevokeDialog
|
|
open={revokeTarget != null}
|
|
amount={revokeTarget ? upliftAmount(revokeTarget) : undefined}
|
|
woNumber={woFallbackNumber(revokeTarget)}
|
|
onClose={closeRevoke}
|
|
onConfirm={handleRevokeConfirm}
|
|
isPending={revokePending}
|
|
/>
|
|
</>
|
|
);
|
|
}
|