Files
smart-crop-ui/crop-x/src/app/(app)/central-config/tenant/enterprise-info/components/AuditStatusAlert.tsx

57 lines
1.9 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use client';
import React from 'react';
import { Card } from '@/components/ui/card';
import { Badge } from '@/components/ui/badge';
import { Enterprise, AuditStatus } from '../types';
interface AuditStatusAlertProps {
enterprise: Enterprise;
}
export function AuditStatusAlert({ enterprise }: AuditStatusAlertProps) {
const getAuditStatusBadge = (status: AuditStatus) => {
switch (status) {
case 'pending':
return <Badge className="bg-yellow-100 text-yellow-700"></Badge>;
case 'approved':
return <Badge className="bg-green-100 text-green-700"></Badge>;
case 'rejected':
return <Badge className="bg-red-100 text-red-700"></Badge>;
default:
return <Badge>{status}</Badge>;
}
};
return (
<Card className={`p-4 ${
enterprise.auditStatus === 'pending' ? 'bg-yellow-50 border-yellow-200' :
enterprise.auditStatus === 'rejected' ? 'bg-red-50 border-red-200' :
'bg-green-50 border-green-200'
}`}>
<div className="flex items-center justify-between">
<div>
<div className="flex items-center gap-2">
<span></span>
{getAuditStatusBadge(enterprise.auditStatus)}
</div>
{enterprise.auditStatus === 'rejected' && enterprise.auditReason && (
<p className="text-sm text-red-700 mt-2">
{enterprise.auditReason}
</p>
)}
{enterprise.auditStatus === 'pending' && (
<p className="text-sm text-yellow-700 mt-2">
</p>
)}
</div>
{enterprise.auditTime && (
<div className="text-sm text-muted-foreground">
{new Date(enterprise.auditTime).toLocaleString('zh-CN')}
</div>
)}
</div>
</Card>
);
}