Files
KAFM-Project/components/dashboard/operations/request.tsx

259 lines
6.8 KiB
TypeScript

import { useState } from 'react';
import { Plus } from 'lucide-react';
import Button from "@/components/common/button";
import LocationTable from '@/components/common/dataTable';
import NavigationTabs from '@/components/common/tabs';
import { Reqeusttabs,statusFilters } from '@/constants/constant';
import FilterTabs from '@/components/common/roundedFilters';
import Table from '@/components/common/dataTable';
const StatusBadge = ({
text,
color,
}: {
text: string;
color: string;
}) => (
<span
className={`inline-flex items-center gap-1 rounded-full px-3 py-1 text-[10px] font-semibold uppercase tracking-wider whitespace-nowrap ${color}`}
>
<span className="h-1.5 w-1.5 rounded-full bg-current" />
{text}
</span>
);
const headers = [
"Request No.",
"Department",
"Issue",
"Location",
"Assignee",
"Source",
"Status",
];
const rows = [
[
<span className="font-semibold text-[#2EE6C5]">TFM/AP/2026/1009</span>,
"Electrical",
"Lighting out",
"Block 1 · G",
"ME Local",
<span className="font-mono">Line</span>,
<StatusBadge
text="Overdue"
color="bg-red-500/15 text-red-400"
/>,
],
[
<span className="font-semibold text-[#2EE6C5]">TFM/AP/2026/1016</span>,
"HVAC",
"AHU not cooling",
"Lobby · 1",
"Dhananjay T.",
<span className="font-mono">Walk-in</span>,
<StatusBadge
text="Registered"
color="bg-blue-500/15 text-blue-400"
/>,
],
[
<span className="font-semibold text-[#2EE6C5]">TFM/AP/2026/1023</span>,
"HVAC",
"Thermostat fault",
"Block 1 · 1",
"ME Local",
<span className="font-mono">Mobile app</span>,
<StatusBadge
text="Assigned"
color="bg-blue-500/15 text-blue-400"
/>,
],
[
<span className="font-semibold text-[#2EE6C5]">TFM/AP/2026/1030</span>,
"HVAC",
"Thermostat fault",
"Block 1 · 1",
"Dhananjay T.",
<span className="font-mono">Mobile app</span>,
<StatusBadge
text="Working"
color="bg-amber-500/15 text-amber-400"
/>,
],
[
<span className="font-semibold text-[#2EE6C5]">TFM/AP/2026/1037</span>,
"Civil",
"Glass break",
"Block 1 · 1",
"Local Helpdesk",
<span className="font-mono">Walk-in</span>,
<StatusBadge
text="Completed"
color="bg-emerald-500/15 text-emerald-400"
/>,
],
[
<span className="font-semibold text-[#2EE6C5]">TFM/AP/2026/1044</span>,
"HVAC",
"Chiller alarm",
"Block 1 · 1",
"Dhananjay T.",
<span className="font-mono">Mobile app</span>,
<StatusBadge
text="Overdue"
color="bg-red-500/15 text-red-400"
/>,
],
[
<span className="font-semibold text-[#2EE6C5]">TFM/AP/2026/1051</span>,
"Plumbing",
"Water leakage",
"Lobby · 1",
"Local Helpdesk",
<span className="font-mono">Walk-in</span>,
<StatusBadge
text="Registered"
color="bg-blue-500/15 text-blue-400"
/>,
],
[
<span className="font-semibold text-[#2EE6C5]">TFM/AP/2026/1058</span>,
"Civil",
"Glass break",
"Block 2 · 2",
"Dhananjay T.",
<span className="font-mono">Walk-in</span>,
<StatusBadge
text="Assigned"
color="bg-blue-500/15 text-blue-400"
/>,
],
[
<span className="font-semibold text-[#2EE6C5]">TFM/AP/2026/1065</span>,
"Civil",
"Ceiling crack",
"Lobby · G",
"ME Local",
<span className="font-mono">Line</span>,
<StatusBadge
text="Working"
color="bg-amber-500/15 text-amber-400"
/>,
],
[
<span className="font-semibold text-[#2EE6C5]">TFM/AP/2026/1072</span>,
"Plumbing",
"Water leakage",
"Block 2 · G",
"TECH Local",
<span className="font-mono">Line</span>,
<StatusBadge
text="Completed"
color="bg-emerald-500/15 text-emerald-400"
/>,
],
[
<span className="font-semibold text-[#2EE6C5]">TFM/AP/2026/1079</span>,
"Electrical",
"DB switch fault",
"Tower A · 1",
"TECH Local",
<span className="font-mono">Mobile app</span>,
<StatusBadge
text="Overdue"
color="bg-red-500/15 text-red-400"
/>,
],
[
<span className="font-semibold text-[#2EE6C5]">TFM/AP/2026/1086</span>,
"HVAC",
"AHU not cooling",
"Lobby · 3",
"TECH Local",
<span className="font-mono">Walk-in</span>,
<StatusBadge
text="Registered"
color="bg-blue-500/15 text-blue-400"
/>,
],
];
export default function ServiceRequestsPortal() {
const [activeTab, setActiveTab] = useState<string>('TFM Requests');
const [activeFilter, setActiveFilter] = useState<string>('All');
return (
<div className="my-15 text-slate-100 max-w-7xl mx-auto 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-[10px] font-bold tracking-widest text-slate-500 uppercase font-mono">
<span className="text-teal-400">Apple One HQ Tower</span>
<span></span>
<span>Operations</span>
<span></span>
<span>Requests</span>
</div>
<h1 className="text-2xl font-bold text-white tracking-tight mt-2">
Service requests
</h1>
<p className="text-sm font-medium text-slate-400 mt-2 max-w-xl leading-relaxed">
TFM helpdesk tickets, engineering breakdowns, and auto-generated recurring complaints one request lifecycle.
</p>
</div>
</div>
{/* --- NAVIGATION TABS & TOP ACTION BUTTONS --- */}
<div className="flex flex-col
md:flex-row md:items-center justify-between
border-b border-slate-800/80 mb-4 gap-4">
{/* Navigation Tabs */}
<NavigationTabs
tabs={Reqeusttabs}
activeTab={activeTab}
onTabChange={setActiveTab}
className="mb-6"
/>
{/* Action Buttons */}
<div className="flex items-center gap-3 pb-3 md:pb-0">
<Button className="flex items-center gap-2 bg-[#0b1727] hover:bg-slate-800/60 text-slate-200 border border-slate-800 rounded-lg px-4 py-2 text-xs font-semibold transition-colors">
<span>Export</span>
</Button>
<Button className="flex items-center gap-2 bg-teal-400 hover:bg-teal-300 text-slate-950 font-bold rounded-lg px-4 py-2 text-xs transition-colors">
<Plus size={16} className="stroke-[3]" />
<span>New request</span>
</Button>
</div>
</div>
{/* --- STATUS PILL FILTERS --- */}
<FilterTabs
options={statusFilters}
activeFilter={activeFilter}
onChange={setActiveFilter}
/>
<div className='mt-5'>
<Table headers={headers} rows={rows}/>
</div>
</div>
);
}