feat(rfa): complete RFA Approval Refactor - all 9 phases (T001-T080)
Phase 1-2: Setup, SQL schema, enums, queue constants, base entities
Phase 3 (US1): ReviewTeam, ReviewTeamMember, ReviewTask, TaskCreationService
Phase 4 (US2): ResponseCode, ResponseCodeRule, ImplicationsService, NotificationTriggerService
Phase 5 (US3): Delegation entity, CircularDetectionService, DelegationService/Controller/Module
Phase 6 (US4): ReminderRule, SchedulerService, EscalationService, ReminderProcessor, ReminderModule
Phase 7 (US5): DistributionMatrix, DistributionRecipient, ApprovalListenerService (Strangler),
TransmittalCreatorService, DistributionProcessor, DistributionModule
Phase 8 (US6): MatrixManagementService, InheritanceService (global→project override)
Phase 9 (Polish): AggregateStatusService, ConsensusService, VetoOverrideService,
ParallelGatewayHandler, review-validators, optimistic locking in completeReview,
test stubs (unit/integration/e2e), jest.config.js updated for tests/ directory
Frontend: ReviewTaskInbox, ParallelProgress, VetoOverrideDialog, DelegationForm,
DelegatedBadge, MatrixEditor, ProjectOverrideManager, DistributionStatus,
ReminderHistory, ResponseCodeSelector, CodeImplications, CompleteReviewForm,
ReviewTeamForm, ReviewTeamSelector, TeamMemberManager
Closes #1
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
'use client';
|
||||
|
||||
// File: components/distribution/DistributionStatus.tsx
|
||||
// แสดงสถานะ Distribution ของ RFA หลังอนุมัติ (T060)
|
||||
import React from 'react';
|
||||
import { CheckCircle2, Clock, SendHorizonal, Users } from 'lucide-react';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
|
||||
type DistributionStatus = 'PENDING' | 'PROCESSING' | 'COMPLETED' | 'FAILED';
|
||||
|
||||
interface DistributionRecord {
|
||||
publicId: string;
|
||||
status: DistributionStatus;
|
||||
transmittalCount: number;
|
||||
recipientCount: number;
|
||||
processedAt?: string;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
interface DistributionStatusProps {
|
||||
rfaPublicId: string;
|
||||
distribution?: DistributionRecord;
|
||||
isLoading?: boolean;
|
||||
}
|
||||
|
||||
const STATUS_CONFIG: Record<
|
||||
DistributionStatus,
|
||||
{ label: string; variant: 'default' | 'secondary' | 'destructive' | 'outline'; icon: React.ElementType }
|
||||
> = {
|
||||
PENDING: { label: 'Queued', variant: 'outline', icon: Clock },
|
||||
PROCESSING: { label: 'Processing', variant: 'secondary', icon: Clock },
|
||||
COMPLETED: { label: 'Distributed', variant: 'default', icon: CheckCircle2 },
|
||||
FAILED: { label: 'Failed', variant: 'destructive', icon: Clock },
|
||||
};
|
||||
|
||||
export function DistributionStatus({ rfaPublicId: _rfaPublicId, distribution, isLoading }: DistributionStatusProps) {
|
||||
if (isLoading) {
|
||||
return <div className="text-sm text-muted-foreground">Checking distribution status...</div>;
|
||||
}
|
||||
|
||||
if (!distribution) {
|
||||
return (
|
||||
<div className="flex items-center gap-2 text-sm text-muted-foreground">
|
||||
<Clock className="h-4 w-4" />
|
||||
<span>Awaiting approval for distribution</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const config = STATUS_CONFIG[distribution.status];
|
||||
const Icon = config.icon;
|
||||
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader className="pb-2">
|
||||
<div className="flex items-center justify-between">
|
||||
<CardTitle className="text-sm font-medium">Distribution Status</CardTitle>
|
||||
<Badge variant={config.variant} className="gap-1">
|
||||
<Icon className="h-3 w-3" />
|
||||
{config.label}
|
||||
</Badge>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent className="pt-0">
|
||||
<div className="flex items-center gap-4 text-sm">
|
||||
<div className="flex items-center gap-1 text-muted-foreground">
|
||||
<SendHorizonal className="h-3.5 w-3.5" />
|
||||
<span>{distribution.transmittalCount} Transmittal(s)</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-1 text-muted-foreground">
|
||||
<Users className="h-3.5 w-3.5" />
|
||||
<span>{distribution.recipientCount} Recipient(s)</span>
|
||||
</div>
|
||||
{distribution.processedAt && (
|
||||
<span className="text-xs text-muted-foreground">
|
||||
{new Date(distribution.processedAt).toLocaleDateString('th-TH')}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{distribution.error && (
|
||||
<p className="mt-1 text-xs text-destructive">{distribution.error}</p>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user