credit note detail now is showin in the request detail screen
This commit is contained in:
parent
2a5fef6b45
commit
684b75702b
@ -31,6 +31,7 @@ interface DMSDetails {
|
|||||||
ackNo?: string;
|
ackNo?: string;
|
||||||
ackDate?: string;
|
ackDate?: string;
|
||||||
signedInvoiceUrl?: string;
|
signedInvoiceUrl?: string;
|
||||||
|
creditNoteWfmData?: any[];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ClaimAmountDetails {
|
interface ClaimAmountDetails {
|
||||||
@ -99,6 +100,7 @@ export function ProcessDetailsCard({
|
|||||||
const hasContent =
|
const hasContent =
|
||||||
(visibility.showIODetails && ioDetails) ||
|
(visibility.showIODetails && ioDetails) ||
|
||||||
(visibility.showDMSDetails && dmsDetails) ||
|
(visibility.showDMSDetails && dmsDetails) ||
|
||||||
|
(dmsDetails?.creditNoteWfmData && dmsDetails.creditNoteWfmData.length > 0) ||
|
||||||
(visibility.showClaimAmount && claimAmount && claimAmount.amount !== undefined && claimAmount.amount !== null) ||
|
(visibility.showClaimAmount && claimAmount && claimAmount.amount !== undefined && claimAmount.amount !== null) ||
|
||||||
(estimatedBudgetBreakdown && estimatedBudgetBreakdown.length > 0) ||
|
(estimatedBudgetBreakdown && estimatedBudgetBreakdown.length > 0) ||
|
||||||
(closedExpensesBreakdown && closedExpensesBreakdown.length > 0);
|
(closedExpensesBreakdown && closedExpensesBreakdown.length > 0);
|
||||||
@ -227,6 +229,32 @@ export function ProcessDetailsCard({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{/* Credit Note Validation */}
|
||||||
|
{dmsDetails?.creditNoteWfmData && dmsDetails.creditNoteWfmData.length > 0 && (
|
||||||
|
<div className="bg-white rounded-lg p-3 border border-pink-200">
|
||||||
|
<div className="flex items-center gap-2 mb-2">
|
||||||
|
<Receipt className="w-4 h-4 text-pink-600" />
|
||||||
|
<Label className="text-xs font-semibold text-pink-900 uppercase tracking-wide">
|
||||||
|
Credit Note Validation
|
||||||
|
</Label>
|
||||||
|
</div>
|
||||||
|
<div className="space-y-2">
|
||||||
|
{dmsDetails.creditNoteWfmData.map((cn: any, idx: number) => (
|
||||||
|
<div key={idx} className="bg-pink-50 p-2 rounded border border-pink-100 text-[10px]">
|
||||||
|
<div className="flex justify-between mb-1 text-pink-900">
|
||||||
|
<span className="font-semibold break-words flex-1 pr-2">Credit Note No: {cn.DOC_NO || 'N/A'}</span>
|
||||||
|
<span className={`px-1.5 py-0.5 rounded-sm text-white font-medium self-start whitespace-nowrap ${cn.MSG_TYP === 'E' ? 'bg-red-500' : 'bg-green-500'}`}>
|
||||||
|
{cn.MSG_TYP === 'E' ? 'Error' : (cn.MSG_TYP === 'S' ? 'Success' : cn.MSG_TYP || 'Unknown')}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div className="text-gray-500 mb-0.5">Txn: {cn.TRNS_UNIQ_NO || 'N/A'}</div>
|
||||||
|
<div className="text-gray-700 break-words font-medium">{cn.MESSAGE || 'No Message'}</div>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* Claim Amount */}
|
{/* Claim Amount */}
|
||||||
{visibility.showClaimAmount && claimAmount && (
|
{visibility.showClaimAmount && claimAmount && (
|
||||||
<div className="bg-white rounded-lg p-3 border border-green-200">
|
<div className="bg-white rounded-lg p-3 border border-green-200">
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import { useState, useEffect, useMemo, useCallback } from 'react';
|
|||||||
import workflowApi, { getPauseDetails } from '@/services/workflowApi';
|
import workflowApi, { getPauseDetails } from '@/services/workflowApi';
|
||||||
import apiClient from '@/services/authApi';
|
import apiClient from '@/services/authApi';
|
||||||
import { getSocket } from '@/utils/socket';
|
import { getSocket } from '@/utils/socket';
|
||||||
|
import { isClaimManagementRequest } from '@/utils/claimRequestUtils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom Hook: useRequestDetails
|
* Custom Hook: useRequestDetails
|
||||||
@ -239,8 +240,18 @@ export function useRequestDetails(
|
|||||||
let completionDetails = null;
|
let completionDetails = null;
|
||||||
let internalOrder = null;
|
let internalOrder = null;
|
||||||
let internalOrders = [];
|
let internalOrders = [];
|
||||||
|
let creditNoteWfmData = null;
|
||||||
|
|
||||||
|
if (isClaimManagementRequest(wf)) {
|
||||||
|
// Fetch Credit Note independently
|
||||||
|
try {
|
||||||
|
const cnResponse = await apiClient.get(`/dealer-claims/${wf.requestId}/credit-note-wfm`);
|
||||||
|
const responseData = cnResponse.data ?? cnResponse;
|
||||||
|
creditNoteWfmData = Array.isArray(responseData?.data) ? responseData.data : (Array.isArray(responseData) ? responseData : []);
|
||||||
|
} catch (cnError) {
|
||||||
|
console.warn('[useRequestDetails] Error fetching credit note WFM data:', cnError);
|
||||||
|
}
|
||||||
|
|
||||||
if (wf.workflowType === 'CLAIM_MANAGEMENT' || wf.templateType === 'claim-management') {
|
|
||||||
try {
|
try {
|
||||||
const claimResponse = await apiClient.get(`/dealer-claims/${wf.requestId}`);
|
const claimResponse = await apiClient.get(`/dealer-claims/${wf.requestId}`);
|
||||||
|
|
||||||
@ -264,6 +275,7 @@ export function useRequestDetails(
|
|||||||
(claimDetails as any).invoice = invoice;
|
(claimDetails as any).invoice = invoice;
|
||||||
(claimDetails as any).creditNote = creditNote;
|
(claimDetails as any).creditNote = creditNote;
|
||||||
(claimDetails as any).completionExpenses = completionExpenses;
|
(claimDetails as any).completionExpenses = completionExpenses;
|
||||||
|
(claimDetails as any).creditNoteWfmData = creditNoteWfmData;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extracted details processed
|
// Extracted details processed
|
||||||
@ -333,6 +345,7 @@ export function useRequestDetails(
|
|||||||
budgetTracking: (claimDetails as any)?.budgetTracking || null,
|
budgetTracking: (claimDetails as any)?.budgetTracking || null,
|
||||||
invoice: claimDetails?.invoice || (claimDetails as any)?.invoice || null,
|
invoice: claimDetails?.invoice || (claimDetails as any)?.invoice || null,
|
||||||
creditNote: (claimDetails as any)?.creditNote || null,
|
creditNote: (claimDetails as any)?.creditNote || null,
|
||||||
|
creditNoteWfmData: creditNoteWfmData || (claimDetails as any)?.creditNoteWfmData || null,
|
||||||
completionExpenses: (claimDetails as any)?.completionExpenses || null,
|
completionExpenses: (claimDetails as any)?.completionExpenses || null,
|
||||||
templateType: wf.templateType || wf.template_type,
|
templateType: wf.templateType || wf.template_type,
|
||||||
form16Submission: details.form16Submission || null,
|
form16Submission: details.form16Submission || null,
|
||||||
@ -523,8 +536,18 @@ export function useRequestDetails(
|
|||||||
let completionDetails = null;
|
let completionDetails = null;
|
||||||
let internalOrder = null;
|
let internalOrder = null;
|
||||||
let internalOrders = [];
|
let internalOrders = [];
|
||||||
|
let creditNoteWfmData = null;
|
||||||
|
|
||||||
|
if (isClaimManagementRequest(wf)) {
|
||||||
|
// Fetch Credit Note independently
|
||||||
|
try {
|
||||||
|
const cnResponse = await apiClient.get(`/dealer-claims/${wf.requestId}/credit-note-wfm`);
|
||||||
|
const responseData = cnResponse.data ?? cnResponse;
|
||||||
|
creditNoteWfmData = Array.isArray(responseData?.data) ? responseData.data : (Array.isArray(responseData) ? responseData : []);
|
||||||
|
} catch (cnError) {
|
||||||
|
console.warn('[useRequestDetails] Error fetching credit note WFM data:', cnError);
|
||||||
|
}
|
||||||
|
|
||||||
if (wf.workflowType === 'CLAIM_MANAGEMENT' || wf.templateType === 'claim-management') {
|
|
||||||
try {
|
try {
|
||||||
const claimResponse = await apiClient.get(`/dealer-claims/${wf.requestId}`);
|
const claimResponse = await apiClient.get(`/dealer-claims/${wf.requestId}`);
|
||||||
|
|
||||||
@ -547,6 +570,7 @@ export function useRequestDetails(
|
|||||||
(claimDetails as any).invoice = invoice;
|
(claimDetails as any).invoice = invoice;
|
||||||
(claimDetails as any).creditNote = creditNote;
|
(claimDetails as any).creditNote = creditNote;
|
||||||
(claimDetails as any).completionExpenses = completionExpenses;
|
(claimDetails as any).completionExpenses = completionExpenses;
|
||||||
|
(claimDetails as any).creditNoteWfmData = creditNoteWfmData;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initial load - Extracted details processed
|
// Initial load - Extracted details processed
|
||||||
@ -603,6 +627,7 @@ export function useRequestDetails(
|
|||||||
budgetTracking: (claimDetails as any)?.budgetTracking || null,
|
budgetTracking: (claimDetails as any)?.budgetTracking || null,
|
||||||
invoice: (claimDetails as any)?.invoice || null,
|
invoice: (claimDetails as any)?.invoice || null,
|
||||||
creditNote: (claimDetails as any)?.creditNote || null,
|
creditNote: (claimDetails as any)?.creditNote || null,
|
||||||
|
creditNoteWfmData: creditNoteWfmData || (claimDetails as any)?.creditNoteWfmData || null,
|
||||||
completionExpenses: (claimDetails as any)?.completionExpenses || null,
|
completionExpenses: (claimDetails as any)?.completionExpenses || null,
|
||||||
templateType: wf.templateType || wf.template_type,
|
templateType: wf.templateType || wf.template_type,
|
||||||
form16Submission: details.form16Submission || null,
|
form16Submission: details.form16Submission || null,
|
||||||
|
|||||||
@ -95,6 +95,7 @@ export interface ClaimManagementRequest {
|
|||||||
ackDate?: string;
|
ackDate?: string;
|
||||||
signedInvoiceUrl?: string;
|
signedInvoiceUrl?: string;
|
||||||
taxBreakdown?: any;
|
taxBreakdown?: any;
|
||||||
|
creditNoteWfmData?: any[];
|
||||||
};
|
};
|
||||||
|
|
||||||
// Claim Amount
|
// Claim Amount
|
||||||
@ -298,6 +299,7 @@ export function mapToClaimManagementRequest(
|
|||||||
ackDate: invoice.ackDate || claimDetails.ackDate,
|
ackDate: invoice.ackDate || claimDetails.ackDate,
|
||||||
signedInvoiceUrl: invoice.signedInvoiceUrl || claimDetails.signedInvoiceUrl,
|
signedInvoiceUrl: invoice.signedInvoiceUrl || claimDetails.signedInvoiceUrl,
|
||||||
taxBreakdown: invoice.taxBreakdown || claimDetails.taxBreakdown,
|
taxBreakdown: invoice.taxBreakdown || claimDetails.taxBreakdown,
|
||||||
|
creditNoteWfmData: apiRequest.creditNoteWfmData || claimDetails.creditNoteWfmData || [],
|
||||||
};
|
};
|
||||||
|
|
||||||
// Map claim amounts
|
// Map claim amounts
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user