99 lines
5.2 KiB
TypeScript
99 lines
5.2 KiB
TypeScript
import { DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
|
|
import { useTranslation } from 'react-i18next';
|
|
import { GitBranch, MapPin, Phone, Mail, Globe, Hash, Building2, Lock } from 'lucide-react';
|
|
interface ViewBranchProps {
|
|
branch: any;
|
|
}
|
|
export default function View({ branch }: ViewBranchProps) {
|
|
const { t } = useTranslation();
|
|
return (
|
|
<DialogContent className="max-w-2xl max-h-[90vh] overflow-y-auto p-0" onOpenAutoFocus={(e) => e.preventDefault()}>
|
|
<DialogHeader className="px-6 pt-6 pb-4 border-b">
|
|
<div className="flex items-center gap-3">
|
|
<div className="p-2 bg-primary/10 rounded-lg">
|
|
<GitBranch className="h-5 w-5 text-primary" />
|
|
</div>
|
|
<DialogTitle className="text-xl font-semibold">{t('Branch Details')}</DialogTitle>
|
|
</div>
|
|
</DialogHeader>
|
|
<div className="px-6 py-4 pb-6 space-y-4">
|
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
<div>
|
|
<label className="text-sm font-medium text-gray-500 flex items-center gap-2">
|
|
<Building2 className="h-4 w-4" />
|
|
{t('Branch Name')}
|
|
</label>
|
|
<p className="mt-1 text-sm font-medium text-gray-900">{branch.name || '-'}</p>
|
|
</div>
|
|
<div>
|
|
<label className="text-sm font-medium text-gray-500 flex items-center gap-2">
|
|
<Mail className="h-4 w-4" />
|
|
{t('Email')}
|
|
</label>
|
|
<p className="mt-1 text-sm font-medium text-gray-900">{branch.email || '-'}</p>
|
|
</div>
|
|
</div>
|
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
<div>
|
|
<label className="text-sm font-medium text-gray-500 flex items-center gap-2">
|
|
<Phone className="h-4 w-4" />
|
|
{t('Phone')}
|
|
</label>
|
|
<p className="mt-1 text-sm font-medium text-gray-900">{branch.phone || '-'}</p>
|
|
</div>
|
|
<div>
|
|
<label className="text-sm font-medium text-gray-500 flex items-center gap-2">
|
|
<Lock className="h-4 w-4" />
|
|
{t('Status')}
|
|
</label>
|
|
<p className="mt-1">
|
|
<span className={`inline-flex items-center rounded-md px-2 py-1 text-xs font-medium ${branch.status === 'active' ? 'bg-green-50 text-green-700 ring-1 ring-inset ring-green-600/20' : 'bg-red-50 text-red-700 ring-1 ring-inset ring-red-600/20'}`}>
|
|
{branch.status === 'active' ? t('Active') : t('Inactive')}
|
|
</span>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
<div>
|
|
<label className="text-sm font-medium text-gray-500 flex items-center gap-2">
|
|
<Building2 className="h-4 w-4" />
|
|
{t('City')}
|
|
</label>
|
|
<p className="mt-1 text-sm font-medium text-gray-900">{branch.city || '-'}</p>
|
|
</div>
|
|
<div>
|
|
<label className="text-sm font-medium text-gray-500 flex items-center gap-2">
|
|
<MapPin className="h-4 w-4" />
|
|
{t('State/Province')}
|
|
</label>
|
|
<p className="mt-1 text-sm font-medium text-gray-900">{branch.state || '-'}</p>
|
|
</div>
|
|
</div>
|
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
<div>
|
|
<label className="text-sm font-medium text-gray-500 flex items-center gap-2">
|
|
<Globe className="h-4 w-4" />
|
|
{t('Country')}
|
|
</label>
|
|
<p className="mt-1 text-sm font-medium text-gray-900">{branch.country || '-'}</p>
|
|
</div>
|
|
<div>
|
|
<label className="text-sm font-medium text-gray-500 flex items-center gap-2">
|
|
<Hash className="h-4 w-4" />
|
|
{t('ZIP/Postal Code')}
|
|
</label>
|
|
<p className="mt-1 text-sm font-medium text-gray-900">{branch.zip_code || '-'}</p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<label className="text-sm font-medium text-gray-500 flex items-center gap-2">
|
|
<MapPin className="h-4 w-4" />
|
|
{t('Address')}
|
|
</label>
|
|
<p className="mt-1 text-sm font-medium text-gray-900">{branch.address || '-'}</p>
|
|
</div>
|
|
</div>
|
|
</DialogContent>
|
|
);
|
|
}
|