fix: fix remote browser socket connection and related updates
This commit is contained in:
@@ -402,6 +402,9 @@ export function ClaimForm({
|
||||
setForm((prev) => ({
|
||||
...prev,
|
||||
serviceLines: mappedLines,
|
||||
...(data.appointmentFiles?.length
|
||||
? { claimFiles: data.appointmentFiles }
|
||||
: {}),
|
||||
}));
|
||||
|
||||
// Restore NPI provider from saved procedures
|
||||
@@ -1094,6 +1097,10 @@ export function ClaimForm({
|
||||
: null;
|
||||
|
||||
try {
|
||||
const attachments = form.uploadedFiles?.length
|
||||
? await uploadAttachmentsToLocalFolder(form.uploadedFiles)
|
||||
: [];
|
||||
|
||||
const res = await apiRequest("POST", "/api/appointment-procedures/save-for-appointment", {
|
||||
appointmentId,
|
||||
patientId,
|
||||
@@ -1104,16 +1111,42 @@ export function ClaimForm({
|
||||
toothNumber: l.toothNumber || null,
|
||||
toothSurface: l.toothSurface || null,
|
||||
})),
|
||||
attachments,
|
||||
});
|
||||
const data = await res.json();
|
||||
if (!data.success) throw new Error("Failed to save procedures");
|
||||
toast({ title: "Procedures saved", description: `${data.count} procedure(s) saved.` });
|
||||
const attachMsg = attachments.length ? ` and ${attachments.length} attachment(s)` : "";
|
||||
toast({ title: "Procedures saved", description: `${data.count} procedure(s)${attachMsg} saved.` });
|
||||
onClose();
|
||||
} catch (err: any) {
|
||||
toast({ title: "Save failed", description: err?.message ?? "Failed to save procedures.", variant: "destructive" });
|
||||
}
|
||||
};
|
||||
|
||||
// Same as handleProceduresSave but also resets any existing submitted claim so
|
||||
// batch-column will treat this appointment as needing a new submission.
|
||||
const handleProceduresUpdate = async () => {
|
||||
if (!appointmentId) return;
|
||||
try {
|
||||
await apiRequest("POST", "/api/claims/reset-for-resubmit", { appointmentId });
|
||||
} catch {
|
||||
// Non-fatal: if reset fails we still save procedures
|
||||
}
|
||||
await handleProceduresSave();
|
||||
};
|
||||
|
||||
// Marks the claim for this appointment as VOID so batch-column will always skip it.
|
||||
const handleProceduresVoid = async () => {
|
||||
if (!appointmentId) return;
|
||||
try {
|
||||
await apiRequest("POST", "/api/claims/void-for-appointment", { appointmentId });
|
||||
toast({ title: "Claim voided", description: "This appointment will be skipped when claiming for the column." });
|
||||
onClose();
|
||||
} catch (err: any) {
|
||||
toast({ title: "Void failed", description: err?.message ?? "Failed to void claim.", variant: "destructive" });
|
||||
}
|
||||
};
|
||||
|
||||
// for direct combo button.
|
||||
const applyComboAndThenMH = async (
|
||||
comboId: keyof typeof PROCEDURE_COMBOS,
|
||||
@@ -1720,15 +1753,29 @@ export function ClaimForm({
|
||||
{proceduresOnly ? "Save Procedures" : "Insurance Carriers"}
|
||||
</h3>
|
||||
{proceduresOnly ? (
|
||||
/* ── Select Procedures mode: Save only ── */
|
||||
<div className="flex justify-center">
|
||||
/* ── Select Procedures mode ── */
|
||||
<div className="flex justify-center gap-3">
|
||||
<Button
|
||||
className="w-48"
|
||||
className="w-40"
|
||||
variant="default"
|
||||
onClick={handleProceduresSave}
|
||||
>
|
||||
Save Procedures
|
||||
</Button>
|
||||
<Button
|
||||
className="w-40"
|
||||
variant="secondary"
|
||||
onClick={handleProceduresUpdate}
|
||||
>
|
||||
Update & Resubmit
|
||||
</Button>
|
||||
<Button
|
||||
className="w-28"
|
||||
variant="destructive"
|
||||
onClick={handleProceduresVoid}
|
||||
>
|
||||
Void
|
||||
</Button>
|
||||
</div>
|
||||
) : (
|
||||
/* ── Insurance Claim mode: submit buttons, no Save ── */
|
||||
|
||||
Reference in New Issue
Block a user