chore(approvals): drop dead handleApprovePartial

Task 2 collapsed the list's per-row "Approve partial" button into
the new "Approve & send" button, which routes through review-approve
on the server. The list no longer calls the legacy partial-approve
endpoint, but handleApprovePartial was left in the page file because
the plan's Step 3 only covered handleApprove replacement. Remove it.

The /api/v1/quotes/[id]/partial-approve endpoint itself is unchanged
(it's still used by other parts of the app).

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Dave 2026-08-27 00:55:00 +02:00
parent a499329a4e
commit 911c6f7496

View file

@ -264,42 +264,6 @@ export default function ApprovalsPage() {
void ensureOutboundAttachments(quoteId);
};
/**
* Approve a partial quote. Marks priced items as
* `approved_in_batch`, flips status to `partial_approved`, then
* the rep still needs to send the email from the quote detail
* page (the existing approve modal flow). We do NOT send from
* here because the partial flow is more complex (operator
* needs to compose subject/body for the email) and reusing the
* existing modal keeps the partial path consistent with the
* full one.
*
* Surface: toast tells the rep "open the quote to send the
* partial" and the rep clicks the quote to continue.
*/
const handleApprovePartial = async (id: string) => {
setActionLoading(id);
try {
const res = await fetch(
`/api/v1/quotes/${id}/partial-approve`,
{ method: "POST" }
);
if (!res.ok) {
const err = (await res.json().catch(() => ({}))) as { error?: string };
throw new Error(err.error || `Partial approve failed (HTTP ${res.status})`);
}
const data = (await res.json()) as { itemsMarked?: number };
toast.success(
`${data.itemsMarked ?? 0} items marked approved — open the quote to send the email.`
);
fetchApprovals();
} catch (err: unknown) {
toast.error(err instanceof Error ? err.message : "Failed to partial-approve");
} finally {
setActionLoading("");
}
};
const handleReject = async () => {
if (!rejectId) return;
setActionLoading(rejectId);