Files
KAFM-Project/components/dashboard/workplace/visitorManagement.tsx

123 lines
4.5 KiB
TypeScript

import { useState } from 'react';
import {
Star,
ShieldCheck,
Activity,
Clock,
BarChart2,
Plus
} from "lucide-react";
import Button from "@/components/common/button";
import StatCard from "@/components/common/dashStatCard";
import InfoBanner from "@/components/common/infoBanner";
import FilterTabs from '@/components/common/roundedFilters';
import { visitorFilters } from '@/constants/constant';
import Table from '@/components/common/dataTable';
import { visitorheaders, visitorrows } from '@/constants/tabledata';
export default function VistiorManagementPortal() {
const [activeFilter, setActiveFilter] = useState<string>('All');
return (
<div className="my-15 text-slate-100 font-sans">
{/* --- HEADER SECTION --- */}
<div className="flex flex-col md:flex-row md:items-start md:justify-between gap-4 mb-6">
<div>
<div className="flex items-center gap-2 text-[12px] font-bold tracking-widest text-slate-500 uppercase font-mono">
<span className="text-teal-400">Apple One HQ Tower</span>
<span className="text-gray-600"></span>
<span className="text-gray-400">Workplace</span>
<span className="text-gray-600"></span>
<span className="text-gray-400">Visitors</span>
</div>
<h1 className="text-2xl font-bold text-white tracking-tight mt-2">
Visitor management
</h1>
<p className="text-sm font-medium text-slate-400 mt-2 max-w-xl leading-relaxed">
Pre-registration, QR / OTP check-in, host notifications and on-site visitor tracking with a full audit trail.
</p>
</div>
{/* --- HEADER BUTTONS --- */}
<div className="flex items-center gap-3 self-start md:mt-10">
<Button className="bg-[#0b1727] hover:bg-slate-800/60 text-slate-200 border border-slate-800 text-xs px-4 py-2 rounded-lg flex items-center gap-2 font-semibold transition-colors">
<BarChart2 className="w-4 h-4 text-slate-300" />
<span>Scan QR</span>
</Button>
<Button className="bg-teal-400 hover:bg-teal-300 text-slate-950 font-bold text-xs px-4 py-2 rounded-lg flex items-center gap-2 transition-colors">
<Plus className="w-4 h-4 stroke-[3]" />
<span>Pre Register</span>
</Button>
</div>
</div>
{/* --- STAT CARDS --- */}
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 mb-6">
{/* Active vendors */}
<StatCard
variant="icon"
title="Active vendors"
value="6"
icon={Star}
badgeText="contracted"
badgeClassName="text-slate-400 lowercase font-mono"
iconContainerClassName="bg-cyan-950/40 border-cyan-800/30 text-cyan-400"
/>
{/* Avg SLA adherence */}
<StatCard
variant="icon"
title="Avg SLA adherence"
value="93%"
icon={ShieldCheck}
badgeText="this month"
badgeClassName="text-teal-400 lowercase font-mono font-medium"
iconContainerClassName="bg-emerald-950/60 border-emerald-800/40 text-emerald-400"
/>
{/* Open field jobs */}
<StatCard
variant="icon"
title="Open field jobs"
value="12"
icon={Activity}
badgeText="in progress"
badgeClassName="text-cyan-400 lowercase font-mono"
iconContainerClassName="bg-blue-950/50 border-blue-800/30 text-blue-400"
/>
{/* Avg response time */}
<StatCard
variant="icon"
title="Avg response time"
value="2.7h"
icon={Clock}
badgeText="to site"
badgeClassName="text-slate-400 lowercase font-mono"
iconContainerClassName="bg-amber-950/40 border-amber-800/30 text-amber-500"
/>
</div>
{/* --- STATUS PILL FILTERS --- */}
<div className="mb-6">
<FilterTabs
options={visitorFilters}
activeFilter={activeFilter}
onChange={setActiveFilter}
/>
</div>
<Table headers={visitorheaders} rows={visitorrows}/>
<div className="mb-10 mt-10">
<InfoBanner
boldText="Flow:"
normalText="host pre-registers → visitor receives QR + OTP → reception scans for check-in (ID & photo captured) → host notified → auto check-out on exit. Denied visitors are held on a site watchlist."
/>
</div>
</div>
);
}