diff --git a/apps/Frontend/src/components/claims/claim-form.tsx b/apps/Frontend/src/components/claims/claim-form.tsx
index 720777f..08ead2a 100644
--- a/apps/Frontend/src/components/claims/claim-form.tsx
+++ b/apps/Frontend/src/components/claims/claim-form.tsx
@@ -299,12 +299,17 @@ export function ClaimForm({
}, []);
// 1st Button workflow - Mass Health Button Handler
- const handleMHSubmit = async () => {
+ const handleMHSubmit = async (
+ formToUse?: ClaimFormData & { uploadedFiles?: File[] }
+ ) => {
+ // Use the passed form, or fallback to current state
+ const f = formToUse ?? form;
+
// 0. Validate required fields
const missingFields: string[] = [];
- if (!form.memberId?.trim()) missingFields.push("Member ID");
- if (!form.dateOfBirth?.trim()) missingFields.push("Date of Birth");
+ if (!f.memberId?.trim()) missingFields.push("Member ID");
+ if (!f.dateOfBirth?.trim()) missingFields.push("Date of Birth");
if (!patient?.firstName?.trim()) missingFields.push("First Name");
if (missingFields.length > 0) {
@@ -319,7 +324,7 @@ export function ClaimForm({
// 1. Create or update appointment
const appointmentData = {
patientId: patientId,
- date: serviceDate,
+ date: f.serviceDate,
staffId: staff?.id,
};
const appointmentId = await onHandleAppointmentSubmit(appointmentData);
@@ -343,10 +348,10 @@ export function ClaimForm({
// 3. Create Claim(if not)
// Filter out empty service lines (empty procedureCode)
- const filteredServiceLines = form.serviceLines.filter(
+ const filteredServiceLines = f.serviceLines.filter(
(line) => line.procedureCode.trim() !== ""
);
- const { uploadedFiles, insuranceSiteKey, ...formToCreateClaim } = form;
+ const { uploadedFiles, insuranceSiteKey, ...formToCreateClaim } = f;
// build claimFiles metadata from uploadedFiles (only filename + mimeType)
const claimFilesMeta: ClaimFileMeta[] = (uploadedFiles || []).map((f) => ({
@@ -366,7 +371,7 @@ export function ClaimForm({
// 4. sending form data to selenium service
onHandleForMHSelenium({
- ...form,
+ ...f,
serviceLines: filteredServiceLines,
staffId: Number(staff?.id),
patientId: patientId,
@@ -450,6 +455,22 @@ export function ClaimForm({
onClose();
};
+ const applyComboAndThenMH = async (
+ comboId: keyof typeof PROCEDURE_COMBOS
+ ) => {
+ const nextForm = applyComboToForm(
+ form,
+ comboId,
+ patient?.dateOfBirth ?? "",
+ { replaceAll: true, lineDate: form.serviceDate }
+ );
+
+ setForm(nextForm);
+ setTimeout(() => scrollToLine(0), 0);
+
+ await handleMHSubmit(nextForm);
+ };
+
return (
@@ -544,82 +565,105 @@ export function ClaimForm({
Service Lines
-
- {/* Service Date */}
-
-
-
-
-
-
-
- {
- onServiceDateChange(date);
- }}
- onClose={() => setServiceDateOpen(false)}
- />
-
-
- {/* Treating doctor */}
-
-