From 06209c136789597f1615820859dd76f65e427fa4 Mon Sep 17 00:00:00 2001
From: Aaditya Jaiswal
Date: Thu, 12 Mar 2026 15:34:19 +0530
Subject: [PATCH] Implemnetd csv and email templates
---
.gitignore | 4 +
.../Form16AdminConfig/Form16AdminConfig.tsx | 80 ++-------
.../request-detail/Form16QuickActions.tsx | 156 ++++--------------
src/services/form16Api.ts | 12 --
4 files changed, 54 insertions(+), 198 deletions(-)
diff --git a/.gitignore b/.gitignore
index 4e0fff0..bd9b4cc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -45,3 +45,7 @@ coverage
.turbo
*.tsbuildinfo
+
+FORM16_SAP_ACTUAL_IMPLEMENTATION_ANALYSIS.txt
+FORM16_SAP_FIELDS_ONLY.txt
+form16_use_cases_report.txt
diff --git a/src/components/admin/Form16AdminConfig/Form16AdminConfig.tsx b/src/components/admin/Form16AdminConfig/Form16AdminConfig.tsx
index ede5bf2..3b91765 100644
--- a/src/components/admin/Form16AdminConfig/Form16AdminConfig.tsx
+++ b/src/components/admin/Form16AdminConfig/Form16AdminConfig.tsx
@@ -351,31 +351,11 @@ export function Form16AdminConfig() {
26AS data added
- Sent to: RE users who can view 26AS, and separately to all dealers. When: As soon as new 26AS data is uploaded.
+ Sent to: RE users who can view 26AS. When: As soon as new 26AS data is uploaded.
+
+
+ Notification messages use a fixed system template and cannot be edited here.
-
-
- Message to RE users
-
-
- Message to dealers
-
-
Placeholders: [Name], [Request ID]
-
Sent to: The dealer who submitted the Form 16. When: Immediately after their submission is matched with 26AS and a credit note is generated.
-
+
+ Notification message is fixed in the system configuration.
+
Sent to: The dealer who submitted. When: When their submission fails (e.g. value mismatch with 26AS, duplicate, or validation error) so they can correct and resubmit.
-
+
+ Notification message is fixed in the system configuration.
+
-
+
+ Alert message content is fixed and managed by the system.
+
-
+
+ Reminder message content is fixed and managed by the system.
+
(null);
const [loading, setLoading] = useState(true);
- const [actionLoading, setActionLoading] = useState<'cancel' | 'resubmit' | 'credit' | null>(null);
- const [generateCnOpen, setGenerateCnOpen] = useState(false);
- const [generateCnAmount, setGenerateCnAmount] = useState('');
+ const [actionLoading, setActionLoading] = useState<'cancel' | 'resubmit' | null>(null);
const form16 = request?.form16Submission;
const hasSubmission = !!form16;
const hasCreditNote = !!creditNote && creditNote.status !== 'withdrawn';
- const suggestedAmount = form16?.tdsAmount != null ? Number(form16.tdsAmount) : undefined;
useEffect(() => {
if (!requestId) {
@@ -91,115 +77,41 @@ export function Form16QuickActions({ requestId, request, onRefresh }: Form16Quic
}
};
- const handleGenerateCreditNote = async () => {
- const amount = parseFloat(generateCnAmount);
- if (!requestId || Number.isNaN(amount) || amount <= 0) {
- toast.error('Enter a valid amount to generate credit note');
- return;
- }
- setActionLoading('credit');
- try {
- await generateForm16CreditNoteManually(requestId, amount);
- setGenerateCnOpen(false);
- setGenerateCnAmount('');
- toast.success('Credit note generated (manually approved)');
- const note = await getCreditNoteByRequestId(requestId);
- setCreditNote(note ? { id: typeof note.id === 'number' ? note.id : Number(note.id), status: note.status || '' } : null);
- onRefresh?.();
- } catch (e) {
- toast.error(e instanceof Error ? e.message : 'Failed to generate credit note');
- } finally {
- setActionLoading(null);
- }
- };
-
if (loading || !hasSubmission || hasCreditNote) return null;
return (
- <>
-
-
-
-
- Form 16 actions
-
-
- View the document in the Documents tab. Cancel submission, mark resubmission needed, or generate credit note (e.g. when OCR was partial).
-
-
-
-
- {actionLoading === 'cancel' ? : }
- Cancel submission
-
-
- {actionLoading === 'resubmit' ? : }
- Resubmission needed
-
- {
- setGenerateCnAmount(suggestedAmount != null ? String(suggestedAmount) : '');
- setGenerateCnOpen(true);
- }}
- disabled={!!actionLoading}
- >
- {actionLoading === 'credit' ? : }
- Generate credit note
-
-
-
-
-
-
-
- Generate credit note (manual)
-
- Enter the amount for the credit note. This will mark the Form 16 as manually approved.
-
-
-
-
-
Amount (₹)
-
setGenerateCnAmount(e.target.value)}
- />
- {suggestedAmount != null && (
-
Suggested from submission TDS amount: ₹{suggestedAmount.toLocaleString('en-IN')}
- )}
-
-
-
- setGenerateCnOpen(false)} disabled={!!actionLoading}>
- Cancel
-
-
- {actionLoading === 'credit' ? : null}
- Generate credit note
-
-
-
-
- >
+
+
+
+
+ Form 16 actions
+
+
+ View the document in the Documents tab. Cancel submission or mark resubmission needed.
+
+
+
+
+ {actionLoading === 'cancel' ? : }
+ Cancel submission
+
+
+ {actionLoading === 'resubmit' ? : }
+ Resubmission needed
+
+
+
);
}
diff --git a/src/services/form16Api.ts b/src/services/form16Api.ts
index 9bce723..f34c4a9 100644
--- a/src/services/form16Api.ts
+++ b/src/services/form16Api.ts
@@ -132,18 +132,6 @@ export async function setForm16ResubmissionNeeded(requestId: string): Promise {
- const { data } = await apiClient.post<{ data?: { creditNote?: Form16CreditNoteItem }; creditNote?: Form16CreditNoteItem }>(
- `/form16/requests/${encodeURIComponent(requestId)}/generate-credit-note`,
- { amount }
- );
- const payload = data?.data ?? data;
- const creditNote = payload?.creditNote;
- if (!creditNote) throw new Error('Credit note not returned');
- return { creditNote };
-}
-
/** Get a single credit note by id with dealer info and dealer transaction history. */
export interface CreditNoteDetailResponse {
creditNote: Form16CreditNoteItem & { submission?: { submittedDate?: string | null } };