typescript issues for build resolvded
This commit is contained in:
parent
a4f9962c38
commit
636dc4a1c5
@ -54,7 +54,6 @@ import { WorkNotesTab } from './components/tabs/WorkNotesTab';
|
||||
import { SummaryTab } from './components/tabs/SummaryTab';
|
||||
import { IOTab } from './components/tabs/IOTab';
|
||||
import { isClaimManagementRequest } from '@/utils/claimRequestUtils';
|
||||
import { determineUserRole } from '@/utils/claimDataMapper';
|
||||
import { QuickActionsSidebar } from './components/QuickActionsSidebar';
|
||||
import { RequestDetailModals } from './components/RequestDetailModals';
|
||||
import { RequestDetailProps } from './types/requestDetail.types';
|
||||
|
||||
@ -364,7 +364,9 @@ export function QuickActionsSidebar({
|
||||
<ProcessDetailsCard
|
||||
ioDetails={claimSidebarData.claimRequest.ioDetails}
|
||||
dmsDetails={claimSidebarData.claimRequest.dmsDetails}
|
||||
claimAmount={claimSidebarData.claimRequest.claimAmount}
|
||||
claimAmount={{
|
||||
amount: claimSidebarData.claimRequest.claimAmount.closed || claimSidebarData.claimRequest.claimAmount.estimated || 0,
|
||||
}}
|
||||
estimatedBudgetBreakdown={claimSidebarData.claimRequest.proposalDetails?.costBreakup}
|
||||
closedExpensesBreakdown={claimSidebarData.claimRequest.activityInfo?.closedExpensesBreakdown}
|
||||
visibility={claimSidebarData.visibility}
|
||||
|
||||
@ -138,7 +138,7 @@ export function ActivityInformationCard({ activityInfo, className }: ActivityInf
|
||||
Closed Expenses Breakdown
|
||||
</label>
|
||||
<div className="bg-blue-50 border border-blue-200 rounded-lg p-3 space-y-2">
|
||||
{activityInfo.closedExpensesBreakdown.map((item, index) => (
|
||||
{activityInfo.closedExpensesBreakdown.map((item: { description: string; amount: number }, index: number) => (
|
||||
<div key={index} className="flex justify-between items-center text-sm">
|
||||
<span className="text-gray-700">{item.description}</span>
|
||||
<span className="font-medium text-gray-900">
|
||||
@ -150,7 +150,7 @@ export function ActivityInformationCard({ activityInfo, className }: ActivityInf
|
||||
<span className="font-semibold text-gray-900">Total</span>
|
||||
<span className="font-bold text-blue-600">
|
||||
{formatCurrency(
|
||||
activityInfo.closedExpensesBreakdown.reduce((sum, item) => sum + item.amount, 0)
|
||||
activityInfo.closedExpensesBreakdown.reduce((sum: number, item: { description: string; amount: number }) => sum + item.amount, 0)
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -51,7 +51,7 @@ export function CreditNoteSAPModal({
|
||||
dealerInfo,
|
||||
activityName,
|
||||
requestNumber,
|
||||
requestId,
|
||||
requestId: _requestId,
|
||||
dueDate,
|
||||
}: CreditNoteSAPModalProps) {
|
||||
const [downloading, setDownloading] = useState(false);
|
||||
|
||||
@ -52,7 +52,7 @@ export function DealerCompletionDocumentsModal({
|
||||
onSubmit,
|
||||
dealerName = 'Jaipur Royal Enfield',
|
||||
activityName = 'Activity',
|
||||
requestId,
|
||||
requestId: _requestId,
|
||||
}: DealerCompletionDocumentsModalProps) {
|
||||
const [activityCompletionDate, setActivityCompletionDate] = useState('');
|
||||
const [numberOfParticipants, setNumberOfParticipants] = useState('');
|
||||
|
||||
@ -48,7 +48,7 @@ export function DealerProposalSubmissionModal({
|
||||
onSubmit,
|
||||
dealerName = 'Jaipur Royal Enfield',
|
||||
activityName = 'Activity',
|
||||
requestId,
|
||||
requestId: _requestId,
|
||||
}: DealerProposalSubmissionModalProps) {
|
||||
const [proposalDocument, setProposalDocument] = useState<File | null>(null);
|
||||
const [costItems, setCostItems] = useState<CostItem[]>([
|
||||
@ -135,12 +135,13 @@ export function DealerProposalSubmissionModal({
|
||||
}
|
||||
|
||||
// Calculate final completion date if using days mode
|
||||
let finalCompletionDate = expectedCompletionDate;
|
||||
let finalCompletionDate: string = expectedCompletionDate || '';
|
||||
if (timelineMode === 'days' && numberOfDays) {
|
||||
const days = parseInt(numberOfDays);
|
||||
const date = new Date();
|
||||
date.setDate(date.getDate() + days);
|
||||
finalCompletionDate = date.toISOString().split('T')[0];
|
||||
const isoString = date.toISOString();
|
||||
finalCompletionDate = isoString.split('T')[0] as string;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@ -40,7 +40,7 @@ export function DeptLeadIOApprovalModal({
|
||||
onApprove,
|
||||
onReject,
|
||||
requestTitle,
|
||||
requestId,
|
||||
requestId: _requestId,
|
||||
}: DeptLeadIOApprovalModalProps) {
|
||||
const [actionType, setActionType] = useState<'approve' | 'reject'>('approve');
|
||||
const [ioNumber, setIoNumber] = useState('');
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
* Uses modular card components for flexible rendering based on role and request state
|
||||
*/
|
||||
|
||||
import { useState } from 'react';
|
||||
import {
|
||||
ActivityInformationCard,
|
||||
DealerInformationCard,
|
||||
@ -16,7 +15,6 @@ import {
|
||||
mapToClaimManagementRequest,
|
||||
determineUserRole,
|
||||
getRoleBasedVisibility,
|
||||
type ClaimManagementRequest,
|
||||
type RequestRole,
|
||||
} from '@/utils/claimDataMapper';
|
||||
|
||||
@ -30,11 +28,11 @@ interface ClaimManagementOverviewTabProps {
|
||||
}
|
||||
|
||||
export function ClaimManagementOverviewTab({
|
||||
request,
|
||||
request: _request,
|
||||
apiRequest,
|
||||
currentUserId,
|
||||
isInitiator,
|
||||
onEditClaimAmount,
|
||||
isInitiator: _isInitiator,
|
||||
onEditClaimAmount: _onEditClaimAmount,
|
||||
className = '',
|
||||
}: ClaimManagementOverviewTabProps) {
|
||||
// Check if this is a claim management request
|
||||
|
||||
@ -160,7 +160,7 @@ export function ClaimManagementWorkflowTab({
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="space-y-4">
|
||||
{steps.map((step, index) => (
|
||||
{steps.map((step) => (
|
||||
<div
|
||||
key={step.stepNumber}
|
||||
className={`relative p-5 rounded-lg border-2 transition-all ${getStepBorderColor(step.status)}`}
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
* - Dealer-specific workflow steps
|
||||
*/
|
||||
|
||||
import { useState, useMemo, useEffect } from 'react';
|
||||
import { useState, useEffect } from 'react';
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Button } from '@/components/ui/button';
|
||||
@ -21,8 +21,8 @@ import { DeptLeadIOApprovalModal } from '../modals/DeptLeadIOApprovalModal';
|
||||
import { DealerCompletionDocumentsModal } from '../modals/DealerCompletionDocumentsModal';
|
||||
import { CreditNoteSAPModal } from '../modals/CreditNoteSAPModal';
|
||||
import { toast } from 'sonner';
|
||||
import { submitProposal, updateIODetails, submitCompletion, updateEInvoice, updateCreditNote } from '@/services/dealerClaimApi';
|
||||
import { getWorkflowDetails, approveLevel, rejectLevel, updateWorkflow } from '@/services/workflowApi';
|
||||
import { submitProposal, updateIODetails, submitCompletion, updateEInvoice } from '@/services/dealerClaimApi';
|
||||
import { getWorkflowDetails, approveLevel, rejectLevel } from '@/services/workflowApi';
|
||||
import { uploadDocument } from '@/services/documentApi';
|
||||
import { createWorkNoteMultipart } from '@/services/workflowApi';
|
||||
|
||||
@ -153,7 +153,7 @@ export function DealerClaimWorkflowTab({
|
||||
request,
|
||||
user,
|
||||
isInitiator,
|
||||
onSkipApprover,
|
||||
onSkipApprover: _onSkipApprover,
|
||||
onRefresh
|
||||
}: DealerClaimWorkflowTabProps) {
|
||||
const [showProposalModal, setShowProposalModal] = useState(false);
|
||||
@ -357,8 +357,6 @@ export function DealerClaimWorkflowTab({
|
||||
});
|
||||
const currentStep = activeStep ? activeStep.step : (request?.currentStep || 1);
|
||||
|
||||
const completedCount = workflowSteps.filter(s => s.status === 'approved').length;
|
||||
|
||||
// Check if current user is the dealer (for steps 1 and 5)
|
||||
const userEmail = (user as any)?.email?.toLowerCase() || '';
|
||||
const dealerEmail = (
|
||||
@ -370,14 +368,6 @@ export function DealerClaimWorkflowTab({
|
||||
);
|
||||
const isDealer = dealerEmail && userEmail === dealerEmail;
|
||||
|
||||
// Check if current user is the approver for each step based on logged-in email
|
||||
const getStepApproverEmail = (stepNumber: number) => {
|
||||
const level = approvalFlow.find((l: any) =>
|
||||
(l.step || l.levelNumber || l.level_number) === stepNumber
|
||||
);
|
||||
return (level?.approverEmail || '').toLowerCase();
|
||||
};
|
||||
|
||||
// Check if current user is the approver for the current step
|
||||
const currentApprovalLevel = approvalFlow.find((level: any) =>
|
||||
(level.step || level.levelNumber || level.level_number) === currentStep
|
||||
@ -823,7 +813,6 @@ export function DealerClaimWorkflowTab({
|
||||
// Step is active if it's pending or in_progress and matches currentStep
|
||||
const isActive = (step.status === 'pending' || step.status === 'in_progress') && step.step === currentStep;
|
||||
const isCompleted = step.status === 'approved';
|
||||
const isWaiting = step.status === 'waiting';
|
||||
|
||||
// Debug logging for Step 1
|
||||
if (step.step === 1) {
|
||||
|
||||
31
src/pages/RequestDetail/types/claimManagement.types.ts
Normal file
31
src/pages/RequestDetail/types/claimManagement.types.ts
Normal file
@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Claim Management TypeScript interfaces
|
||||
* Types for Claim Management request components
|
||||
*/
|
||||
|
||||
export interface ClaimActivityInfo {
|
||||
activityName: string;
|
||||
activityType: string;
|
||||
requestedDate?: string;
|
||||
location: string;
|
||||
period?: {
|
||||
startDate: string;
|
||||
endDate: string;
|
||||
};
|
||||
estimatedBudget?: number;
|
||||
closedExpenses?: number;
|
||||
closedExpensesBreakdown?: Array<{
|
||||
description: string;
|
||||
amount: number;
|
||||
}>;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface DealerInfo {
|
||||
dealerCode: string;
|
||||
dealerName: string;
|
||||
email?: string;
|
||||
phone?: string;
|
||||
address?: string;
|
||||
}
|
||||
|
||||
@ -275,7 +275,7 @@ export async function listClosedByMe(params: { page?: number; limit?: number; se
|
||||
};
|
||||
}
|
||||
|
||||
export async function getWorkflowDetails(requestId: string, workflowType?: string) {
|
||||
export async function getWorkflowDetails(requestId: string, _workflowType?: string) {
|
||||
const res = await apiClient.get(`/workflows/${requestId}/details`);
|
||||
return res.data?.data || res.data;
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@ export interface RoleVisibility {
|
||||
*/
|
||||
export function mapToClaimManagementRequest(
|
||||
apiRequest: any,
|
||||
currentUserId: string
|
||||
_currentUserId: string
|
||||
): ClaimManagementRequest | null {
|
||||
try {
|
||||
if (!isClaimManagementRequest(apiRequest)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user