All Screens in Operations are added
This commit is contained in:
16
app/dashboard/operations/energy/page.tsx
Normal file
16
app/dashboard/operations/energy/page.tsx
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
import EnergyPortal from "@/components/dashboard/energy";
|
||||||
|
|
||||||
|
|
||||||
|
export default function InventoryPage() {
|
||||||
|
return (
|
||||||
|
|
||||||
|
|
||||||
|
<div className="p-8 mx-3">
|
||||||
|
<EnergyPortal/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
import InventoryPortal from "@/components/dashboard/inventory";
|
||||||
|
export default function InventoryPage() {
|
||||||
|
return (
|
||||||
|
|
||||||
|
|
||||||
|
<div className="p-8 mx-3">
|
||||||
|
<InventoryPortal/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
16
app/dashboard/operations/vendorFieldService/page.tsx
Normal file
16
app/dashboard/operations/vendorFieldService/page.tsx
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
import VendorServicePortal from "@/components/dashboard/vendorService";
|
||||||
|
|
||||||
|
|
||||||
|
export default function InventoryPage() {
|
||||||
|
return (
|
||||||
|
|
||||||
|
|
||||||
|
<div className="p-8 mx-3">
|
||||||
|
<VendorServicePortal/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
16
app/dashboard/operations/workPermit/page.tsx
Normal file
16
app/dashboard/operations/workPermit/page.tsx
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
import WorkPermitPortal from "@/components/dashboard/workpermit";
|
||||||
|
|
||||||
|
|
||||||
|
export default function InventoryPage() {
|
||||||
|
return (
|
||||||
|
|
||||||
|
|
||||||
|
<div className="p-8 mx-3">
|
||||||
|
<WorkPermitPortal/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
0
app/dashboard/workplace/meetingRoom/page.tsx
Normal file
0
app/dashboard/workplace/meetingRoom/page.tsx
Normal file
0
app/dashboard/workplace/visitorManagement/page.tsx
Normal file
0
app/dashboard/workplace/visitorManagement/page.tsx
Normal file
0
app/dashboard/workplace/workspace/page.tsx
Normal file
0
app/dashboard/workplace/workspace/page.tsx
Normal file
237
components/dashboard/energy.tsx
Normal file
237
components/dashboard/energy.tsx
Normal file
@@ -0,0 +1,237 @@
|
|||||||
|
import {
|
||||||
|
Package,
|
||||||
|
AlertTriangle,
|
||||||
|
Activity,
|
||||||
|
FileText,
|
||||||
|
LayoutGrid,
|
||||||
|
Plus
|
||||||
|
} from "lucide-react";
|
||||||
|
import Button from "@/utils/button";
|
||||||
|
import StatCard from "@/utils/dashStatCard";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export default function EnergyPortal() {
|
||||||
|
const metersList = [
|
||||||
|
{
|
||||||
|
meter: "MTR-1",
|
||||||
|
name: "Electricity main 1",
|
||||||
|
location: "Pump room",
|
||||||
|
type: "Electricity",
|
||||||
|
mf: "1",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
meter: "MTR-2",
|
||||||
|
name: "Water main 2",
|
||||||
|
location: "Main LT panel",
|
||||||
|
type: "Water",
|
||||||
|
mf: "10",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
meter: "MTR-3",
|
||||||
|
name: "Diesel main 3",
|
||||||
|
location: "DG room",
|
||||||
|
type: "Diesel",
|
||||||
|
mf: "100",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
meter: "MTR-4",
|
||||||
|
name: "Electricity main 4",
|
||||||
|
location: "Block riser",
|
||||||
|
type: "Electricity",
|
||||||
|
mf: "1",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
meter: "MTR-5",
|
||||||
|
name: "Water main 5",
|
||||||
|
location: "DG room",
|
||||||
|
type: "Water",
|
||||||
|
mf: "1",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const latestReadings = [
|
||||||
|
{
|
||||||
|
meter: "MTR-1",
|
||||||
|
prev: "40.00",
|
||||||
|
current: "58.00",
|
||||||
|
cons: "18.0",
|
||||||
|
uom: "kWh",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
meter: "MTR-2",
|
||||||
|
prev: "49.00",
|
||||||
|
current: "69.00",
|
||||||
|
cons: "200.0",
|
||||||
|
uom: "kL",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
meter: "MTR-3",
|
||||||
|
prev: "58.00",
|
||||||
|
current: "80.00",
|
||||||
|
cons: "2200.0",
|
||||||
|
uom: "L",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
meter: "MTR-4",
|
||||||
|
prev: "67.00",
|
||||||
|
current: "91.00",
|
||||||
|
cons: "24.0",
|
||||||
|
uom: "kWh",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
meter: "MTR-5",
|
||||||
|
prev: "76.00",
|
||||||
|
current: "102.00",
|
||||||
|
cons: "26.0",
|
||||||
|
uom: "kL",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="text-slate-100 mt-15 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>Energy</span>
|
||||||
|
</div>
|
||||||
|
<h1 className="text-2xl font-bold text-white tracking-tight mt-2">
|
||||||
|
Meters & readings
|
||||||
|
</h1>
|
||||||
|
<p className="text-sm font-medium text-slate-400 mt-2 max-w-xl leading-relaxed">
|
||||||
|
Meter master with QR identification and reading capture. Consumption is reading
|
||||||
|
× multiplication factor.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* --- HEADER BUTTONS --- */}
|
||||||
|
<div className="flex items-center gap-2 self-start md:mt-10">
|
||||||
|
<Button className="bg-slate-800/80 hover:bg-slate-800 text-white border border-slate-700/60 text-xs px-3 py-2 rounded-md flex items-center gap-2 font-medium">
|
||||||
|
Print QR
|
||||||
|
</Button>
|
||||||
|
<Button className="bg-teal-400 hover:bg-teal-500 text-slate-950 font-semibold text-xs px-3 py-2 rounded-md transition-colors">
|
||||||
|
Add reading
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{/* --- TABLES GRID (SIDE-BY-SIDE) --- */}
|
||||||
|
<div className="grid grid-cols-1 xl:grid-cols-2 gap-2 items-start">
|
||||||
|
|
||||||
|
{/* LEFT TABLE: METER MASTER */}
|
||||||
|
<div className="bg-[#0b1329] border border-slate-800/80 rounded-lg overflow-hidden">
|
||||||
|
<div className="flex items-center justify-between px-3 py-2 border-b border-slate-800/80">
|
||||||
|
<h2 className="text-base font-semibold text-white">Meter master</h2>
|
||||||
|
<span className="text-xs font-mono text-slate-500">5 meters</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="">
|
||||||
|
<table className="w-full h-full text-left text-sm">
|
||||||
|
<thead>
|
||||||
|
<tr className="border-b border-slate-800/60 text-[11px] font-bold uppercase tracking-wider text-slate-400">
|
||||||
|
<th className="py-3 px-4">Meter</th>
|
||||||
|
<th className="py-3 px-4">Name</th>
|
||||||
|
<th className="py-3 px-4">Location</th>
|
||||||
|
<th className="py-3 px-4">Type</th>
|
||||||
|
<th className="py-3 px-4">MF</th>
|
||||||
|
<th className="py-3 px-4 text-right"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody className="divide-y divide-slate-800/40">
|
||||||
|
{metersList.map((row, index) => {
|
||||||
|
return (
|
||||||
|
<tr
|
||||||
|
key={index}
|
||||||
|
className="transition-colors hover:bg-slate-800/30"
|
||||||
|
>
|
||||||
|
<td className="py-3 px-4 font-mono text-teal-400 font-semibold text-xs whitespace-nowrap">
|
||||||
|
{row.meter}
|
||||||
|
</td>
|
||||||
|
<td className="py-3 px-4 font-semibold text-slate-100 whitespace-nowrap">
|
||||||
|
{row.name}
|
||||||
|
</td>
|
||||||
|
<td className="py-3 px-4 text-slate-300 font-medium whitespace-nowrap">
|
||||||
|
{row.location}
|
||||||
|
</td>
|
||||||
|
<td className="py-3 px-4 text-slate-300 font-medium whitespace-nowrap">
|
||||||
|
{row.type}
|
||||||
|
</td>
|
||||||
|
<td className="py-3 px-4 font-semibold text-slate-200 whitespace-nowrap">
|
||||||
|
{row.mf}
|
||||||
|
</td>
|
||||||
|
<td className="py-3 px-4 text-right">
|
||||||
|
<div className="flex items-center justify-end gap-1.5">
|
||||||
|
<button className="px-2.5 py-1 text-xs font-medium text-slate-300 bg-slate-800/50 hover:bg-slate-800 border border-slate-700/50 rounded transition-colors">
|
||||||
|
Reading
|
||||||
|
</button>
|
||||||
|
<button className="px-2.5 py-1 text-xs font-medium text-slate-300 bg-slate-800/50 hover:bg-slate-800 border border-slate-700/50 rounded transition-colors">
|
||||||
|
QR
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* RIGHT TABLE: LATEST READINGS */}
|
||||||
|
<div className="bg-[#0b1329] border border-slate-800/80 rounded-lg overflow-hidden">
|
||||||
|
<div className="flex items-center justify-between px-6 py-4 border-b border-slate-800/80">
|
||||||
|
<h2 className="text-base font-semibold text-white">Latest readings</h2>
|
||||||
|
<span className="text-xs font-mono text-slate-500 lowercase">
|
||||||
|
tap a meter for history
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<table className="w-full h-full text-left text-sm">
|
||||||
|
<thead>
|
||||||
|
<tr className="border-b border-slate-800/60 text-[11px] font-bold uppercase tracking-wider text-slate-400">
|
||||||
|
<th className="py-3 px-4">Meter</th>
|
||||||
|
<th className="py-3 px-4">Prev</th>
|
||||||
|
<th className="py-3 px-4">Current</th>
|
||||||
|
<th className="py-3 px-4">Cons.</th>
|
||||||
|
<th className="py-3 px-4">UOM</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody className="divide-y divide-slate-800/40">
|
||||||
|
{latestReadings.map((row, index) => (
|
||||||
|
<tr key={index} className="hover:bg-slate-800/30 transition-colors">
|
||||||
|
<td className="py-3 px-4 font-mono text-teal-400 font-medium text-xs whitespace-nowrap">
|
||||||
|
{row.meter}
|
||||||
|
</td>
|
||||||
|
<td className="py-3 px-4 text-slate-300 text-xs font-medium whitespace-nowrap">
|
||||||
|
{row.prev}
|
||||||
|
</td>
|
||||||
|
<td className="py-3 px-4 text-slate-300 text-xs font-medium whitespace-nowrap">
|
||||||
|
{row.current}
|
||||||
|
</td>
|
||||||
|
<td className="py-3 px-4 font-semibold text-teal-400 text-xs whitespace-nowrap">
|
||||||
|
{row.cons}
|
||||||
|
</td>
|
||||||
|
<td className="py-3 px-4 font-semibold text-slate-100 text-xs whitespace-nowrap">
|
||||||
|
{row.uom}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,153 +1,397 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import {
|
|
||||||
Target,
|
|
||||||
AlertTriangle,
|
|
||||||
Clock,
|
|
||||||
ShieldCheck,
|
|
||||||
Search,
|
|
||||||
QrCode,
|
|
||||||
Plus,
|
|
||||||
Download,
|
|
||||||
Upload
|
|
||||||
} from 'lucide-react';
|
|
||||||
import Button from "@/utils/button";
|
|
||||||
import StatCard from "@/utils/dashStatCard";
|
|
||||||
import LocationTable from '../../utils/table';
|
|
||||||
import NavigationTabs from '@/utils/tabs';
|
|
||||||
import { equipmentTabs } from '@/constants/constant';
|
|
||||||
|
|
||||||
export default function EquipmentPortal() {
|
import {
|
||||||
const [activeTab, setActiveTab] = useState<string>('Site-Wise Equipment');
|
|
||||||
|
Pencil,
|
||||||
|
|
||||||
|
Menu,
|
||||||
|
|
||||||
|
ShieldCheck,
|
||||||
|
|
||||||
|
QrCode,
|
||||||
|
|
||||||
|
Power,
|
||||||
|
|
||||||
|
Check,
|
||||||
|
|
||||||
|
Sparkles,
|
||||||
|
|
||||||
|
} from 'lucide-react';
|
||||||
|
|
||||||
|
import { mockData } from '@/constants/constant';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export default function LocationTable(){
|
||||||
|
|
||||||
|
const [selectedIds, setSelectedIds] = useState<string[]>(['1']); // Row 1 selected by default (teal indicator bar)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const toggleSelectAll = () => {
|
||||||
|
|
||||||
|
if (selectedIds.length === mockData.length) {
|
||||||
|
|
||||||
|
setSelectedIds([]);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
setSelectedIds(mockData.map((row) => row.id));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const toggleSelectRow = (id: string) => {
|
||||||
|
|
||||||
|
setSelectedIds((prev) =>
|
||||||
|
|
||||||
|
prev.includes(id) ? prev.filter((item) => item !== id) : [...prev, id]
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
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>Equipment</span>
|
|
||||||
</div>
|
|
||||||
<h1 className="text-2xl font-bold text-white tracking-tight mt-2">
|
|
||||||
Equipment & maintenance
|
|
||||||
</h1>
|
|
||||||
<p className="text-sm font-medium text-slate-400 mt-2 max-w-xl leading-relaxed">
|
|
||||||
Asset register, preventive (PPM) and contract (AMC) maintenance, scoped to the active tenant.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
<div className="w-full bg-[#071321] text-slate-300 rounded-xl overflow-hidden border border-slate-800/80 shadow-2xl relative font-sans">
|
||||||
|
|
||||||
{/* Navigation Tabs */}
|
<div className="overflow-x-auto">
|
||||||
<NavigationTabs
|
|
||||||
tabs={equipmentTabs}
|
|
||||||
activeTab={activeTab}
|
|
||||||
onTabChange={setActiveTab}
|
|
||||||
className="mb-6"
|
|
||||||
/>
|
|
||||||
{/* --- STAT CARDS --- */}
|
|
||||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 mb-6">
|
|
||||||
{/* Total Equipment */}
|
|
||||||
<StatCard
|
|
||||||
variant="icon"
|
|
||||||
title="Total equipment"
|
|
||||||
value="8"
|
|
||||||
icon={Target}
|
|
||||||
badgeText="4 groups"
|
|
||||||
badgeClassName="text-slate-400 lowercase font-mono"
|
|
||||||
iconContainerClassName="bg-cyan-950/40 border-cyan-800/30 text-cyan-400"
|
|
||||||
/>
|
|
||||||
|
|
||||||
{/* Critical Assets */}
|
<table className="w-full text-left text-xs border-collapse">
|
||||||
<StatCard
|
|
||||||
variant="icon"
|
|
||||||
title="Critical assets"
|
|
||||||
value="3"
|
|
||||||
icon={AlertTriangle}
|
|
||||||
badgeText="priority"
|
|
||||||
badgeClassName="text-rose-400 lowercase font-mono"
|
|
||||||
iconContainerClassName="bg-rose-950/40 border-rose-800/30 text-rose-400"
|
|
||||||
/>
|
|
||||||
|
|
||||||
{/* PPM Attention */}
|
{/* TABLE HEADER */}
|
||||||
<StatCard
|
|
||||||
variant="icon"
|
|
||||||
title="PPM attention"
|
|
||||||
value="5"
|
|
||||||
icon={Clock}
|
|
||||||
badgeText="due / overdue"
|
|
||||||
badgeClassName="text-amber-400 lowercase font-mono"
|
|
||||||
iconContainerClassName="bg-amber-950/40 border-amber-800/30 text-amber-400"
|
|
||||||
/>
|
|
||||||
|
|
||||||
{/* On Plan */}
|
<thead>
|
||||||
<StatCard
|
|
||||||
variant="icon"
|
<tr className="border-b border-slate-800/90 text-[11px] font-bold tracking-wider text-slate-500 uppercase font-mono">
|
||||||
title="On plan"
|
|
||||||
value="3"
|
<th className="py-4 px-4 w-12 text-center">
|
||||||
icon={ShieldCheck}
|
|
||||||
badgeText="healthy"
|
|
||||||
badgeClassName="text-emerald-400 lowercase font-mono"
|
|
||||||
iconContainerClassName="bg-emerald-950/40 border-emerald-800/30 text-emerald-400"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* --- ROW 2: SEARCH, FILTERS & ACTION BUTTONS --- */}
|
|
||||||
<div className="flex flex-col md:flex-row items-center justify-between gap-4 mb-8">
|
|
||||||
{/* Search & Select Filters */}
|
|
||||||
<div className="flex flex-1 flex-wrap items-center gap-3 w-full md:w-auto">
|
|
||||||
{/* Search Bar */}
|
|
||||||
<div className="relative flex-1 min-w-[240px] max-w-md">
|
|
||||||
<Search size={18} className="absolute left-3 top-1/2 -translate-y-1/2 text-slate-400" />
|
|
||||||
<input
|
<input
|
||||||
type="text"
|
|
||||||
placeholder="Search code, name, block, provider..."
|
type="checkbox"
|
||||||
className="w-full bg-[#0b1727] border border-slate-800 rounded-lg pl-9 pr-4 py-2 text-xs text-slate-200 placeholder-slate-500 focus:outline-none focus:border-teal-500/50 transition-colors"
|
|
||||||
|
checked={selectedIds.length === mockData.length}
|
||||||
|
|
||||||
|
onChange={toggleSelectAll}
|
||||||
|
|
||||||
|
className="rounded border-slate-700 bg-slate-900/80 text-teal-400 focus:ring-0 focus:ring-offset-0 cursor-pointer accent-teal-400 h-3.5 w-3.5"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
</th>
|
||||||
|
|
||||||
|
<th className="py-4 px-3 font-mono">BLOCK</th>
|
||||||
|
|
||||||
|
<th className="py-4 px-3 font-mono">FLOOR</th>
|
||||||
|
|
||||||
|
<th className="py-4 px-3 font-mono">ZONE</th>
|
||||||
|
|
||||||
|
<th className="py-4 px-3 font-mono">DEPARTMENT</th>
|
||||||
|
|
||||||
|
<th className="py-4 px-3 font-mono">LOCATION</th>
|
||||||
|
|
||||||
|
<th className="py-4 px-3 font-mono">WINDOW</th>
|
||||||
|
|
||||||
|
<th className="py-4 px-3 font-mono">TAT</th>
|
||||||
|
|
||||||
|
<th className="py-4 px-3 font-mono">SCHED.</th>
|
||||||
|
|
||||||
|
<th className="py-4 px-3 font-mono">APPROVAL</th>
|
||||||
|
|
||||||
|
<th className="py-4 px-3 font-mono">STATUS</th>
|
||||||
|
|
||||||
|
<th className="py-4 px-4 font-mono text-right pr-6">ACTIONS</th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{/* TABLE BODY */}
|
||||||
|
|
||||||
|
<tbody className="divide-y divide-slate-800/50">
|
||||||
|
|
||||||
|
{mockData.map((row) => {
|
||||||
|
|
||||||
|
const isSelected = selectedIds.includes(row.id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
|
||||||
|
<tr
|
||||||
|
|
||||||
|
key={row.id}
|
||||||
|
|
||||||
|
className={`group relative transition-colors ${
|
||||||
|
|
||||||
|
isSelected
|
||||||
|
|
||||||
|
? 'bg-[#0e2238]/60 hover:bg-[#122942]/80'
|
||||||
|
|
||||||
|
: 'hover:bg-slate-800/30'
|
||||||
|
|
||||||
|
}`}
|
||||||
|
|
||||||
|
>
|
||||||
|
|
||||||
|
{/* Left Selection Indicator Bar (for Row 1 / Selected Rows) */}
|
||||||
|
|
||||||
|
<td className="py-3 px-4 text-center relative">
|
||||||
|
|
||||||
|
{isSelected && (
|
||||||
|
|
||||||
|
<span className="absolute left-0 top-0 bottom-0 w-[3px] bg-teal-400 rounded-r" />
|
||||||
|
|
||||||
|
)}
|
||||||
|
|
||||||
|
<input
|
||||||
|
|
||||||
|
type="checkbox"
|
||||||
|
|
||||||
|
checked={isSelected}
|
||||||
|
|
||||||
|
onChange={() => toggleSelectRow(row.id)}
|
||||||
|
|
||||||
|
className="rounded border-slate-700 bg-slate-900/80 text-teal-400 focus:ring-0 focus:ring-offset-0 cursor-pointer accent-teal-400 h-3.5 w-3.5"
|
||||||
|
|
||||||
|
/>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{/* Block */}
|
||||||
|
|
||||||
|
<td className="py-3 px-3 font-semibold text-slate-100 whitespace-nowrap">
|
||||||
|
|
||||||
|
{row.block}
|
||||||
|
|
||||||
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{/* Floor */}
|
||||||
|
|
||||||
|
<td className="py-3 px-3 font-medium text-slate-200">
|
||||||
|
|
||||||
|
{row.floor}
|
||||||
|
|
||||||
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{/* Zone */}
|
||||||
|
|
||||||
|
<td className="py-3 px-3 font-medium text-slate-300">
|
||||||
|
|
||||||
|
{row.zone}
|
||||||
|
|
||||||
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{/* Department */}
|
||||||
|
|
||||||
|
<td className="py-3 px-3 font-semibold text-slate-200 whitespace-nowrap">
|
||||||
|
|
||||||
|
{row.department}
|
||||||
|
|
||||||
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{/* Location */}
|
||||||
|
|
||||||
|
<td className="py-3 px-3 font-extrabold text-white whitespace-nowrap">
|
||||||
|
|
||||||
|
{row.location}
|
||||||
|
|
||||||
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{/* Window */}
|
||||||
|
|
||||||
|
<td className="py-3 px-3 font-mono text-slate-400 text-[11px] whitespace-nowrap">
|
||||||
|
|
||||||
|
{row.window}
|
||||||
|
|
||||||
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{/* TAT */}
|
||||||
|
|
||||||
|
<td className="py-3 px-3 font-mono text-slate-200 font-medium">
|
||||||
|
|
||||||
|
{row.tat}
|
||||||
|
|
||||||
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{/* Sched */}
|
||||||
|
|
||||||
|
<td className="py-3 px-3 font-mono text-slate-200 font-medium">
|
||||||
|
|
||||||
|
{row.sched}
|
||||||
|
|
||||||
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{/* Approval */}
|
||||||
|
|
||||||
|
<td className="py-3 px-3 whitespace-nowrap">
|
||||||
|
|
||||||
|
{row.approval ? (
|
||||||
|
|
||||||
|
<span className="inline-flex items-center gap-1.5 text-emerald-400 font-semibold">
|
||||||
|
|
||||||
|
<Check size={14} className="stroke-[3]" />
|
||||||
|
|
||||||
|
<span>Yes</span>
|
||||||
|
|
||||||
|
</span>
|
||||||
|
|
||||||
|
) : (
|
||||||
|
|
||||||
|
<span className="text-slate-500 font-mono">——</span>
|
||||||
|
|
||||||
|
)}
|
||||||
|
|
||||||
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{/* Status Badge */}
|
||||||
|
|
||||||
|
<td className="py-3 px-3 whitespace-nowrap">
|
||||||
|
|
||||||
|
{row.status === 'ACTIVE' ? (
|
||||||
|
|
||||||
|
<span className="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[10px] font-bold font-mono tracking-wider bg-emerald-950/80 border border-emerald-800/40 text-emerald-400">
|
||||||
|
|
||||||
|
<span className="h-1.5 w-1.5 rounded-full bg-emerald-400"></span>
|
||||||
|
|
||||||
|
ACTIVE
|
||||||
|
|
||||||
|
</span>
|
||||||
|
|
||||||
|
) : (
|
||||||
|
|
||||||
|
<span className="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[10px] font-bold font-mono tracking-wider bg-slate-800/80 border border-slate-700/50 text-slate-400">
|
||||||
|
|
||||||
|
<span className="h-1.5 w-1.5 rounded-full bg-slate-400"></span>
|
||||||
|
|
||||||
|
INACTIVE
|
||||||
|
|
||||||
|
</span>
|
||||||
|
|
||||||
|
)}
|
||||||
|
|
||||||
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{/* Action Icon Buttons */}
|
||||||
|
|
||||||
|
<td className="py-3 px-4 text-right whitespace-nowrap pr-6">
|
||||||
|
|
||||||
|
<div className="inline-flex items-center gap-1.5">
|
||||||
|
|
||||||
|
<button
|
||||||
|
|
||||||
|
title="Edit"
|
||||||
|
|
||||||
|
className="p-1.5 rounded-md bg-[#0b1b2d] hover:bg-slate-700/60 border border-slate-800 text-slate-400 hover:text-slate-200 transition-colors"
|
||||||
|
|
||||||
|
>
|
||||||
|
|
||||||
|
<Pencil size={13} />
|
||||||
|
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
|
||||||
|
title="Options"
|
||||||
|
|
||||||
|
className="p-1.5 rounded-md bg-[#0b1b2d] hover:bg-slate-700/60 border border-slate-800 text-slate-400 hover:text-slate-200 transition-colors"
|
||||||
|
|
||||||
|
>
|
||||||
|
|
||||||
|
<Menu size={13} />
|
||||||
|
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
|
||||||
|
title="Security"
|
||||||
|
|
||||||
|
className="p-1.5 rounded-md bg-[#0b1b2d] hover:bg-slate-700/60 border border-slate-800 text-slate-400 hover:text-slate-200 transition-colors"
|
||||||
|
|
||||||
|
>
|
||||||
|
|
||||||
|
<ShieldCheck size={13} />
|
||||||
|
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
|
||||||
|
title="QR Code"
|
||||||
|
|
||||||
|
className="p-1.5 rounded-md bg-[#0b1b2d] hover:bg-slate-700/60 border border-slate-800 text-slate-400 hover:text-slate-200 transition-colors"
|
||||||
|
|
||||||
|
>
|
||||||
|
|
||||||
|
<QrCode size={13} />
|
||||||
|
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
|
||||||
|
title="Toggle Power"
|
||||||
|
|
||||||
|
className="p-1.5 rounded-md bg-[#0b1b2d] hover:bg-slate-700/60 border border-slate-800 text-slate-400 hover:text-slate-200 transition-colors"
|
||||||
|
|
||||||
|
>
|
||||||
|
|
||||||
|
<Power size={13} />
|
||||||
|
|
||||||
|
</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Groups Dropdown */}
|
</td>
|
||||||
<select className="bg-[#0b1727] border border-slate-800 rounded-lg px-4 py-2 text-xs font-semibold text-slate-200 cursor-pointer focus:outline-none focus:border-teal-500/50 transition-all">
|
|
||||||
<option value="all">All groups</option>
|
|
||||||
<option value="group 1">HVAC</option>
|
|
||||||
|
|
||||||
<option value="group 1">Electrical</option>
|
</tr>
|
||||||
<option value="group 3">Plumbing</option>
|
|
||||||
<option value="group 4">Fire</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Action Buttons */}
|
|
||||||
<div className="flex items-center gap-3 w-full md:w-auto justify-end">
|
|
||||||
<Button className="flex items-center gap-2 bg-[#0b1727] hover:bg-slate-800/60 text-slate-200 border border-slate-800 rounded-lg px-3.5 py-2 text-xs font-semibold transition-colors">
|
|
||||||
<QrCode size={15} />
|
|
||||||
<span>All QR</span>
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<Button className="flex items-center gap-2 bg-[#0b1727] hover:bg-slate-800/60 text-slate-200 border border-slate-800 rounded-lg px-3.5 py-2 text-xs font-semibold transition-colors">
|
|
||||||
<Download size={15} />
|
|
||||||
<span>Download</span>
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<Button className="flex items-center gap-2 bg-[#0b1727] hover:bg-slate-800/60 text-slate-200 border border-slate-800 rounded-lg px-3.5 py-2 text-xs font-semibold transition-colors">
|
|
||||||
<Upload size={15} />
|
|
||||||
<span>Bulk upload</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>Add equipment</span>
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<LocationTable />
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
})}
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import Button from "@/utils/button";
|
import Button from "@/utils/button";
|
||||||
import StatCard from "@/utils/dashStatCard";
|
import StatCard from "@/utils/dashStatCard";
|
||||||
import LocationTable from '../../utils/table';
|
import LocationTable from '@/utils/dataTable';
|
||||||
import NavigationTabs from '@/utils/tabs';
|
import NavigationTabs from '@/utils/tabs';
|
||||||
import { helpdeskTtabs } from '@/constants/constant';
|
import { helpdeskTtabs } from '@/constants/constant';
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,456 @@
|
|||||||
|
import {
|
||||||
|
Package,
|
||||||
|
AlertTriangle,
|
||||||
|
Activity,
|
||||||
|
FileText,
|
||||||
|
LayoutGrid,
|
||||||
|
Plus
|
||||||
|
} from "lucide-react";
|
||||||
|
import Button from "@/utils/button";
|
||||||
|
import StatCard from "@/utils/dashStatCard";
|
||||||
|
import InfoBanner from "@/utils/infoBanner";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export default function InventoryPortal() {
|
||||||
|
const stockItems = [
|
||||||
|
{
|
||||||
|
item: "Cooling tower fan belt",
|
||||||
|
group: "HVAC",
|
||||||
|
store: "Block Store",
|
||||||
|
min: 5,
|
||||||
|
presentValue: 8,
|
||||||
|
unit: "Gallon",
|
||||||
|
status: "COMPLETED",
|
||||||
|
isHighlighted: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
item: "Air filter 24×24",
|
||||||
|
group: "HVAC",
|
||||||
|
store: "Block Store",
|
||||||
|
min: 5,
|
||||||
|
presentValue: 2,
|
||||||
|
unit: "Nos",
|
||||||
|
status: "OVERDUE",
|
||||||
|
isHighlighted: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
item: "MCB 32A",
|
||||||
|
group: "Electrical",
|
||||||
|
store: "Block Store",
|
||||||
|
min: 5,
|
||||||
|
presentValue: 8,
|
||||||
|
unit: "Nos",
|
||||||
|
status: "COMPLETED",
|
||||||
|
isHighlighted: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
item: "Contactor 40A",
|
||||||
|
group: "Electrical",
|
||||||
|
store: "Block Store",
|
||||||
|
min: 2,
|
||||||
|
presentValue: 2,
|
||||||
|
unit: "Nos",
|
||||||
|
status: "OVERDUE",
|
||||||
|
isHighlighted: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
item: "PVC pipe 1\"",
|
||||||
|
group: "Plumbing",
|
||||||
|
store: "Main Store",
|
||||||
|
min: 3,
|
||||||
|
presentValue: 0,
|
||||||
|
unit: "Mtr",
|
||||||
|
status: "OVERDUE",
|
||||||
|
isHighlighted: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
item: "Submersible pump seal",
|
||||||
|
group: "Plumbing",
|
||||||
|
store: "Main Store",
|
||||||
|
min: 3,
|
||||||
|
presentValue: 2,
|
||||||
|
unit: "Nos",
|
||||||
|
status: "OVERDUE",
|
||||||
|
isHighlighted: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
item: "Refrigerant R410a",
|
||||||
|
group: "HVAC",
|
||||||
|
store: "Block Store",
|
||||||
|
min: 5,
|
||||||
|
presentValue: 0,
|
||||||
|
unit: "Kg",
|
||||||
|
status: "OVERDUE",
|
||||||
|
isHighlighted: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const consumptionLedger = [
|
||||||
|
{
|
||||||
|
txn: "TXN-5200",
|
||||||
|
item: "Cooling tower fan belt",
|
||||||
|
type: "Consume",
|
||||||
|
qty: "2 Gallon",
|
||||||
|
jobCard: "026/1009",
|
||||||
|
date: "Jun 20, 2026",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
txn: "TXN-5201",
|
||||||
|
item: "MCB 32A",
|
||||||
|
type: "Consume",
|
||||||
|
qty: "1 Nos",
|
||||||
|
jobCard: "026/1016",
|
||||||
|
date: "Jun 21, 2026",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
txn: "TXN-5202",
|
||||||
|
item: "Air filter 24×24",
|
||||||
|
type: "Receipt",
|
||||||
|
qty: "10 Nos",
|
||||||
|
jobCard: "—",
|
||||||
|
date: "Jun 22, 2026",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
txn: "TXN-5203",
|
||||||
|
item: "Submersible pump seal",
|
||||||
|
type: "Consume",
|
||||||
|
qty: "1 Nos",
|
||||||
|
jobCard: "026/1023",
|
||||||
|
date: "Jun 23, 2026",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
txn: "TXN-5204",
|
||||||
|
item: "Air filter 24×24",
|
||||||
|
type: "Consume",
|
||||||
|
qty: "3 Nos",
|
||||||
|
jobCard: "026/1030",
|
||||||
|
date: "Jun 24, 2026",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
txn: "TXN-5205",
|
||||||
|
item: "PVC pipe 1\"",
|
||||||
|
type: "Receipt",
|
||||||
|
qty: "20 Mtr",
|
||||||
|
jobCard: "—",
|
||||||
|
date: "Jun 25, 2026",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
txn: "TXN-5406",
|
||||||
|
item: "Cooling tower fan belt",
|
||||||
|
type: "Consume",
|
||||||
|
qty: "2 Gallon",
|
||||||
|
jobCard: "026/1009",
|
||||||
|
date: "Jun 7, 2026",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
txn: "TXN-5407",
|
||||||
|
item: "MCB 32A",
|
||||||
|
type: "Consume",
|
||||||
|
qty: "1 Nos",
|
||||||
|
jobCard: "026/1016",
|
||||||
|
date: "Jun 7, 2026",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
txn: "TXN-5200",
|
||||||
|
item: "Cooling tower fan belt",
|
||||||
|
type: "Consume",
|
||||||
|
qty: "2 Gallon",
|
||||||
|
jobCard: "026/1009",
|
||||||
|
date: "Jun 20, 2026",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
txn: "TXN-5201",
|
||||||
|
item: "MCB 32A",
|
||||||
|
type: "Consume",
|
||||||
|
qty: "1 Nos",
|
||||||
|
jobCard: "026/1016",
|
||||||
|
date: "Jun 21, 2026",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
txn: "TXN-5202",
|
||||||
|
item: "Air filter 24×24",
|
||||||
|
type: "Receipt",
|
||||||
|
qty: "10 Nos",
|
||||||
|
jobCard: "—",
|
||||||
|
date: "Jun 22, 2026",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
txn: "TXN-5203",
|
||||||
|
item: "Submersible pump seal",
|
||||||
|
type: "Consume",
|
||||||
|
qty: "1 Nos",
|
||||||
|
jobCard: "026/1023",
|
||||||
|
date: "Jun 23, 2026",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
txn: "TXN-5204",
|
||||||
|
item: "Air filter 24×24",
|
||||||
|
type: "Consume",
|
||||||
|
qty: "3 Nos",
|
||||||
|
jobCard: "026/1030",
|
||||||
|
date: "Jun 24, 2026",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
txn: "TXN-5205",
|
||||||
|
item: "PVC pipe 1\"",
|
||||||
|
type: "Receipt",
|
||||||
|
qty: "20 Mtr",
|
||||||
|
jobCard: "—",
|
||||||
|
date: "Jun 25, 2026",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
txn: "TXN-5406",
|
||||||
|
item: "Cooling tower fan belt",
|
||||||
|
type: "Consume",
|
||||||
|
qty: "2 Gallon",
|
||||||
|
jobCard: "026/1009",
|
||||||
|
date: "Jun 7, 2026",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
txn: "TXN-5407",
|
||||||
|
item: "MCB 32A",
|
||||||
|
type: "Consume",
|
||||||
|
qty: "1 Nos",
|
||||||
|
jobCard: "026/1016",
|
||||||
|
date: "Jun 7, 2026",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
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-[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>Inventory</span>
|
||||||
|
</div>
|
||||||
|
<h1 className="text-2xl font-bold text-white tracking-tight mt-2">
|
||||||
|
Inventory & stock
|
||||||
|
</h1>
|
||||||
|
<p className="text-sm font-medium text-slate-400 mt-2 max-w-xl leading-relaxed">
|
||||||
|
Stock master with receipt / consume transactions. Consumption posts back to the
|
||||||
|
originating request job card; items at or below minimum are flagged for reorder.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* --- HEADER BUTTONS --- */}
|
||||||
|
<div className="flex items-center gap-2 self-start md:mt-10">
|
||||||
|
<Button className="bg-slate-800/80 hover:bg-slate-800 text-white border border-slate-700/60 text-xs px-3 py-2 rounded-md flex items-center gap-2 font-medium">
|
||||||
|
<LayoutGrid className="w-4 h-4 text-slate-400" />
|
||||||
|
Bulk upload
|
||||||
|
</Button>
|
||||||
|
<Button className="bg-slate-800/80 hover:bg-slate-800 text-white border border-slate-700/60 text-xs px-3 py-2 rounded-md flex items-center gap-2 font-medium">
|
||||||
|
<Plus className="w-4 h-4 text-slate-400" />
|
||||||
|
Add item
|
||||||
|
</Button>
|
||||||
|
<Button className="bg-teal-400 hover:bg-teal-500 text-slate-950 font-semibold text-xs px-3 py-2 rounded-md transition-colors">
|
||||||
|
Receive stock
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* --- STAT CARDS --- */}
|
||||||
|
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 mb-6">
|
||||||
|
{/* Stock items */}
|
||||||
|
<StatCard
|
||||||
|
variant="icon"
|
||||||
|
title="Stock items"
|
||||||
|
value="7"
|
||||||
|
icon={Package}
|
||||||
|
badgeText="tracked"
|
||||||
|
badgeClassName="text-slate-400 lowercase font-mono"
|
||||||
|
iconContainerClassName="bg-blue-950/40 border-blue-800/30 text-blue-400"
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* Below minimum */}
|
||||||
|
<StatCard
|
||||||
|
variant="icon"
|
||||||
|
title="Below minimum"
|
||||||
|
value="5"
|
||||||
|
icon={AlertTriangle}
|
||||||
|
badgeText="reorder"
|
||||||
|
badgeClassName="text-rose-400 lowercase font-mono"
|
||||||
|
iconContainerClassName="bg-rose-950/40 border-rose-800/30 text-rose-400"
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* Units consumed */}
|
||||||
|
<StatCard
|
||||||
|
variant="icon"
|
||||||
|
title="Units consumed"
|
||||||
|
value="17"
|
||||||
|
icon={Activity}
|
||||||
|
badgeText="this month"
|
||||||
|
badgeClassName="text-slate-400 lowercase font-mono"
|
||||||
|
iconContainerClassName="bg-amber-950/40 border-amber-800/30 text-amber-400"
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* Posted to requests */}
|
||||||
|
<StatCard
|
||||||
|
variant="icon"
|
||||||
|
title="Posted to requests"
|
||||||
|
value="10"
|
||||||
|
icon={FileText}
|
||||||
|
badgeText="linked"
|
||||||
|
badgeClassName="text-emerald-400 lowercase font-mono"
|
||||||
|
iconContainerClassName="bg-emerald-950/40 border-emerald-800/30 text-emerald-400"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* --- TABLES GRID (SIDE-BY-SIDE) --- */}
|
||||||
|
<div className="grid grid-cols-1 xl:grid-cols-2 gap-6 items-start">
|
||||||
|
|
||||||
|
{/* LEFT TABLE: STOCK MASTER */}
|
||||||
|
<div className="bg-[#0b1329] border border-slate-800/80 rounded-lg overflow-hidden">
|
||||||
|
<div className="flex items-center justify-between px-6 py-4 border-b border-slate-800/80">
|
||||||
|
<h2 className="text-base font-semibold text-white">Stock master</h2>
|
||||||
|
<span className="text-xs font-mono text-slate-500">7 items</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Corrected column layout and removed horizontal scrollbar to align with the right UI. */}
|
||||||
|
<div className="">
|
||||||
|
<table className="w-full h-full text-left text-sm">
|
||||||
|
<thead>
|
||||||
|
<tr className="border-b border-slate-800/60 text-[11px] font-bold uppercase tracking-wider text-slate-400">
|
||||||
|
<th className="py-3 px-4">Item</th>
|
||||||
|
<th className="py-3 px-4">Group</th>
|
||||||
|
<th className="py-3 px-4">Store</th>
|
||||||
|
<th className="py-3 px-4">Min</th>
|
||||||
|
<th className="py-3 px-4">Present</th>
|
||||||
|
<th className="py-3 px-4">Status</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody className="divide-y divide-slate-800/40">
|
||||||
|
{stockItems.map((row, index) => {
|
||||||
|
const isOverdue = row.status === "OVERDUE";
|
||||||
|
return (
|
||||||
|
<tr
|
||||||
|
key={index}
|
||||||
|
className={`transition-colors relative ${
|
||||||
|
row.isHighlighted
|
||||||
|
? "bg-[#0e2238]"
|
||||||
|
: "hover:bg-slate-800/30"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
<td className="py-3 px-4 font-semibold text-slate-100 relative">
|
||||||
|
{row.isHighlighted && (
|
||||||
|
<div className="absolute left-0 top-0 bottom-0 w-[3px] bg-teal-400" />
|
||||||
|
)}
|
||||||
|
{row.item}
|
||||||
|
</td>
|
||||||
|
<td className="py-3 px-4 text-slate-300 font-medium whitespace-nowrap">
|
||||||
|
{row.group}
|
||||||
|
</td>
|
||||||
|
<td className="py-3 px-4 text-slate-300 font-medium whitespace-nowrap">
|
||||||
|
{row.store}
|
||||||
|
</td>
|
||||||
|
<td className="py-3 px-4 text-slate-300 font-medium whitespace-nowrap">
|
||||||
|
{row.min}
|
||||||
|
</td>
|
||||||
|
<td className="py-3 px-4 font-semibold whitespace-nowrap">
|
||||||
|
<span className={isOverdue ? "text-rose-400" : "text-white"}>
|
||||||
|
{row.presentValue}{" "}
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
className={`font-mono text-xs ${
|
||||||
|
isOverdue ? "text-rose-400" : "text-slate-300"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{row.unit}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td className="py-3 px-4">
|
||||||
|
{row.status === "COMPLETED" ? (
|
||||||
|
<span className="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[10px] font-bold tracking-wider bg-emerald-950/60 text-emerald-400 border border-emerald-800/30">
|
||||||
|
<span className="w-1.5 h-1.5 rounded-full bg-emerald-400"></span>
|
||||||
|
COMPLETED
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
|
<span className="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[10px] font-bold tracking-wider bg-rose-950/40 text-rose-400 border border-rose-900/30">
|
||||||
|
<span className="w-1.5 h-1.5 rounded-full bg-rose-400"></span>
|
||||||
|
OVERDUE
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* RIGHT TABLE: CONSUMPTION LEDGER */}
|
||||||
|
<div className="bg-[#0b1329] border border-slate-800/80 rounded-lg overflow-hidden">
|
||||||
|
<div className="flex items-center justify-between px-6 py-4 border-b border-slate-800/80">
|
||||||
|
<h2 className="text-base font-semibold text-white">Consumption ledger</h2>
|
||||||
|
<span className="text-xs font-mono text-slate-500 lowercase">
|
||||||
|
posts back to job card
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<table className="w-full h-full text-left text-sm">
|
||||||
|
<thead>
|
||||||
|
<tr className="border-b border-slate-800/60 text-[11px] font-bold uppercase tracking-wider text-slate-400">
|
||||||
|
<th className="py-3 px-4">Txn</th>
|
||||||
|
<th className="py-3 px-4">Item</th>
|
||||||
|
<th className="py-3 px-4">Type</th>
|
||||||
|
<th className="py-3 px-4">Qty</th>
|
||||||
|
<th className="py-3 px-4">Job Card</th>
|
||||||
|
<th className="py-3 px-4">Date</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody className="divide-y divide-slate-800/40">
|
||||||
|
{consumptionLedger.map((row, index) => (
|
||||||
|
<tr key={index} className="hover:bg-slate-800/30 transition-colors">
|
||||||
|
<td className="py-3 px-4 font-mono text-teal-400 font-medium text-xs whitespace-nowrap">
|
||||||
|
{row.txn}
|
||||||
|
</td>
|
||||||
|
<td className="py-3 px-4 font-semibold text-slate-100 max-w-[140px]">
|
||||||
|
{row.item}
|
||||||
|
</td>
|
||||||
|
<td className="py-3 px-4 whitespace-nowrap">
|
||||||
|
{row.type === "Consume" ? (
|
||||||
|
<span className="inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-amber-950/40 text-amber-300 border border-amber-800/30">
|
||||||
|
<span className="w-1.5 h-1.5 rounded-full bg-amber-400"></span>
|
||||||
|
Consume
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
|
<span className="inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-950/40 text-blue-300 border border-blue-800/30">
|
||||||
|
<span className="w-1.5 h-1.5 rounded-full bg-blue-400"></span>
|
||||||
|
Receipt
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</td>
|
||||||
|
<td className="py-3 px-4 font-medium text-slate-200 whitespace-nowrap">
|
||||||
|
{row.qty}
|
||||||
|
</td>
|
||||||
|
<td className="py-3 px-4 font-mono text-teal-400 text-xs whitespace-nowrap">
|
||||||
|
{row.jobCard}
|
||||||
|
</td>
|
||||||
|
<td className="py-3 px-4 text-slate-300 text-xs font-medium whitespace-nowrap">
|
||||||
|
{row.date}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div className="mb-10 mt-10">
|
||||||
|
<InfoBanner
|
||||||
|
boldText="Post back:"
|
||||||
|
normalText="consuming a spare against a TFM request decrements stock and writes a transaction onto that request's job card (shared item, UOM and store masters) — visible in Reports → Stock Consumption and on the request history."
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { Plus } from 'lucide-react';
|
import { Plus } from 'lucide-react';
|
||||||
import Button from "@/utils/button";
|
import Button from "@/utils/button";
|
||||||
import LocationTable from '@/utils/table';
|
import LocationTable from '@/utils/dataTable';
|
||||||
import NavigationTabs from '@/utils/tabs';
|
import NavigationTabs from '@/utils/tabs';
|
||||||
import { Reqeusttabs,statusFilters } from '@/constants/constant';
|
import { Reqeusttabs,statusFilters } from '@/constants/constant';
|
||||||
import FilterTabs from '@/utils/roundedFilters';
|
import FilterTabs from '@/utils/roundedFilters';
|
||||||
|
|||||||
331
components/dashboard/vendorService.tsx
Normal file
331
components/dashboard/vendorService.tsx
Normal file
@@ -0,0 +1,331 @@
|
|||||||
|
import { useState } from 'react';
|
||||||
|
import {
|
||||||
|
Star,
|
||||||
|
ShieldCheck,
|
||||||
|
Activity,
|
||||||
|
Clock,
|
||||||
|
BarChart2,
|
||||||
|
Plus
|
||||||
|
} from "lucide-react";
|
||||||
|
import Button from "@/utils/button";
|
||||||
|
import StatCard from "@/utils/dashStatCard";
|
||||||
|
import InfoBanner from "@/utils/infoBanner";
|
||||||
|
|
||||||
|
export default function VendorServicePortal() {
|
||||||
|
const vendorData = [
|
||||||
|
{
|
||||||
|
name: "Voltas Ltd",
|
||||||
|
id: "CTR-700",
|
||||||
|
scope: "HVAC AMC & breakdown",
|
||||||
|
rating: "4.6",
|
||||||
|
sla: "95%",
|
||||||
|
slaColor: "text-emerald-400",
|
||||||
|
response: "4.0h",
|
||||||
|
openJobs: "2",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Blue Star",
|
||||||
|
id: "CTR-701",
|
||||||
|
scope: "Chiller & VRV service",
|
||||||
|
rating: "4.1",
|
||||||
|
sla: "88%",
|
||||||
|
slaColor: "text-amber-400",
|
||||||
|
response: "1.2h",
|
||||||
|
openJobs: "2",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Sterling FM",
|
||||||
|
id: "CTR-702",
|
||||||
|
scope: "Integrated FM / soft services",
|
||||||
|
rating: "3.4",
|
||||||
|
sla: "94%",
|
||||||
|
slaColor: "text-emerald-400",
|
||||||
|
response: "2.4h",
|
||||||
|
openJobs: "4",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "OTIS Elevators",
|
||||||
|
id: "CTR-704",
|
||||||
|
scope: "Elevator AMC",
|
||||||
|
rating: "4.8",
|
||||||
|
sla: "95%",
|
||||||
|
slaColor: "text-emerald-400",
|
||||||
|
response: "2.8h",
|
||||||
|
openJobs: "—",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Sodexo",
|
||||||
|
id: "CTR-705",
|
||||||
|
scope: "Soft services & cafeteria",
|
||||||
|
rating: "4.3",
|
||||||
|
sla: "90%",
|
||||||
|
slaColor: "text-amber-400",
|
||||||
|
response: "2.8h",
|
||||||
|
openJobs: "1",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "In-house team",
|
||||||
|
id: "—",
|
||||||
|
scope: "Day-to-day maintenance",
|
||||||
|
rating: "4.0",
|
||||||
|
sla: "93%",
|
||||||
|
slaColor: "text-amber-400",
|
||||||
|
response: "3.2h",
|
||||||
|
openJobs: "3",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const fieldCrewData = [
|
||||||
|
{
|
||||||
|
initials: "RK",
|
||||||
|
name: "Ravi Kumar",
|
||||||
|
role: "M&E Technician • Chiller plant",
|
||||||
|
status: "ON-SITE",
|
||||||
|
statusType: "onsite",
|
||||||
|
time: "6.4h today",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
initials: "SI",
|
||||||
|
name: "Sana Iqbal",
|
||||||
|
role: "HVAC Engineer • AHU room L7",
|
||||||
|
status: "ON-SITE",
|
||||||
|
statusType: "onsite",
|
||||||
|
time: "6.1h today",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
initials: "MD",
|
||||||
|
name: "Mohan D.",
|
||||||
|
role: "Electrician • En route",
|
||||||
|
status: "EN-ROUTE",
|
||||||
|
statusType: "enroute",
|
||||||
|
time: "—",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
initials: "LN",
|
||||||
|
name: "Lakshmi N.",
|
||||||
|
role: "Housekeeping Lead • Lobby + L2",
|
||||||
|
status: "ON-SITE",
|
||||||
|
statusType: "onsite",
|
||||||
|
time: "6.7h today",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
initials: "AP",
|
||||||
|
name: "Arjun P.",
|
||||||
|
role: "Plumber • Off-site",
|
||||||
|
status: "OFF-SITE",
|
||||||
|
statusType: "offsite",
|
||||||
|
time: "—",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
initials: "FR",
|
||||||
|
name: "Fatima R.",
|
||||||
|
role: "BMS Operator • Control room",
|
||||||
|
status: "ON-SITE",
|
||||||
|
statusType: "onsite",
|
||||||
|
time: "7.6h today",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
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-[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>Vendors</span>
|
||||||
|
</div>
|
||||||
|
<h1 className="text-2xl font-bold text-white tracking-tight mt-2">
|
||||||
|
Vendor & field service
|
||||||
|
</h1>
|
||||||
|
<p className="text-sm font-medium text-slate-400 mt-2 max-w-xl leading-relaxed">
|
||||||
|
Vendor performance scorecards and live field-crew status in one view — SLA adherence, response times and job dispatch across your service partners.
|
||||||
|
</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>SLA report</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>Dispatch job</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>
|
||||||
|
|
||||||
|
{/* --- TABLES GRID (SIDE-BY-SIDE) --- */}
|
||||||
|
<div className="grid grid-cols-1 xl:grid-cols-3 gap-6 items-start">
|
||||||
|
|
||||||
|
{/* LEFT TABLE: VENDOR SCORECARD */}
|
||||||
|
<div className="xl:col-span-2 bg-[#0b1329] border border-slate-800/80 rounded-lg overflow-hidden">
|
||||||
|
<div className="flex items-center justify-between px-6 py-4 border-b border-slate-800/80">
|
||||||
|
<h2 className="text-base font-semibold text-white">Vendor scorecard</h2>
|
||||||
|
<span className="text-xs font-mono text-slate-500 lowercase">
|
||||||
|
SLA • rating • jobs
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="overflow-x-auto">
|
||||||
|
<table className="w-full text-left text-sm">
|
||||||
|
<thead>
|
||||||
|
<tr className="border-b border-slate-800/60 text-[11px] font-bold uppercase tracking-wider text-slate-400">
|
||||||
|
<th className="py-3 px-6">Vendor</th>
|
||||||
|
<th className="py-3 px-4">Scope</th>
|
||||||
|
<th className="py-3 px-4">Rating</th>
|
||||||
|
<th className="py-3 px-4">SLA</th>
|
||||||
|
<th className="py-3 px-4">Response</th>
|
||||||
|
<th className="py-3 px-6">Open</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody className="divide-y divide-slate-800/40">
|
||||||
|
{vendorData.map((row, index) => (
|
||||||
|
<tr key={index} className="hover:bg-slate-800/30 transition-colors">
|
||||||
|
<td className="py-4 px-6">
|
||||||
|
<div className="font-semibold text-slate-100">{row.name}</div>
|
||||||
|
<div className="text-xs font-mono text-slate-500 mt-0.5">{row.id}</div>
|
||||||
|
</td>
|
||||||
|
<td className="py-4 px-4 text-slate-300 font-medium whitespace-nowrap">
|
||||||
|
{row.scope}
|
||||||
|
</td>
|
||||||
|
<td className="py-4 px-4 font-medium text-slate-200 whitespace-nowrap">
|
||||||
|
<div className="flex items-center gap-1">
|
||||||
|
<span>{row.rating}</span>
|
||||||
|
<Star className="w-3.5 h-3.5 fill-amber-400 text-amber-400" />
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td className={`py-4 px-4 font-semibold whitespace-nowrap ${row.slaColor}`}>
|
||||||
|
{row.sla}
|
||||||
|
</td>
|
||||||
|
<td className="py-4 px-4 text-slate-300 font-medium whitespace-nowrap">
|
||||||
|
{row.response}
|
||||||
|
</td>
|
||||||
|
<td className="py-4 px-6 font-semibold text-blue-400 whitespace-nowrap">
|
||||||
|
{row.openJobs}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* RIGHT TABLE: FIELD CREW • LIVE */}
|
||||||
|
<div className="bg-[#0b1329] border border-slate-800/80 rounded-lg overflow-hidden">
|
||||||
|
<div className="flex items-center justify-between px-6 py-4 border-b border-slate-800/80">
|
||||||
|
<h2 className="text-base font-semibold text-white">Field crew • live</h2>
|
||||||
|
<span className="text-xs font-mono text-slate-500 lowercase">
|
||||||
|
4 on site
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="p-4 space-y-3">
|
||||||
|
{fieldCrewData.map((crew, index) => {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
key={index}
|
||||||
|
className="flex items-center justify-between p-3 rounded-lg bg-[#0d1835]/50 hover:bg-slate-800/30 transition-colors border border-slate-800/40"
|
||||||
|
>
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
|
<div className="w-9 h-9 rounded-lg bg-teal-950/60 border border-teal-800/30 text-teal-400 text-xs font-bold flex items-center justify-center shrink-0">
|
||||||
|
{crew.initials}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div className="font-semibold text-slate-100 text-sm">{crew.name}</div>
|
||||||
|
<div className="text-xs text-slate-400 mt-0.5">{crew.role}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="text-right shrink-0">
|
||||||
|
{crew.statusType === "onsite" && (
|
||||||
|
<span className="inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-[10px] font-bold tracking-wider bg-emerald-950/60 text-emerald-400 border border-emerald-800/30">
|
||||||
|
<span className="w-1.5 h-1.5 rounded-full bg-emerald-400"></span>
|
||||||
|
{crew.status}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
{crew.statusType === "enroute" && (
|
||||||
|
<span className="inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-[10px] font-bold tracking-wider bg-amber-950/60 text-amber-400 border border-amber-800/30">
|
||||||
|
<span className="w-1.5 h-1.5 rounded-full bg-amber-400"></span>
|
||||||
|
{crew.status}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
{crew.statusType === "offsite" && (
|
||||||
|
<span className="inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-[10px] font-bold tracking-wider bg-slate-800/80 text-slate-400 border border-slate-700/50">
|
||||||
|
<span className="w-1.5 h-1.5 rounded-full bg-slate-500"></span>
|
||||||
|
{crew.status}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
<div className="text-[11px] font-mono text-slate-500 mt-1">
|
||||||
|
{crew.time}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="mb-10 mt-10">
|
||||||
|
<InfoBanner
|
||||||
|
boldText="Closes the loop:"
|
||||||
|
normalText="a breached SLA or new request dispatches a field job to the right crew, tracks response-to-site time, and feeds completion back into the vendor scorecard — the vendor-facing half of the help desk."
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
352
components/dashboard/workpermit.tsx
Normal file
352
components/dashboard/workpermit.tsx
Normal file
@@ -0,0 +1,352 @@
|
|||||||
|
import { useState } from 'react';
|
||||||
|
import { Plus, ShieldCheck, Clock, Check, AlertTriangle, QrCode, FileText, Eye } from 'lucide-react';
|
||||||
|
import Button from "@/utils/button";
|
||||||
|
import { workPermitFilters } from '@/constants/constant';
|
||||||
|
import FilterTabs from '@/utils/roundedFilters';
|
||||||
|
import StatCard from '@/utils/dashStatCard';
|
||||||
|
import InfoBanner from '@/utils/infoBanner';
|
||||||
|
|
||||||
|
export default function WorkPermitPortal() {
|
||||||
|
const [activeTab, setActiveTab] = useState<string>('TFM Requests');
|
||||||
|
const [activeFilter, setActiveFilter] = useState<string>('All');
|
||||||
|
|
||||||
|
// Permit Data matching the UI
|
||||||
|
const permitsData = [
|
||||||
|
{
|
||||||
|
permit: "PTW-2663",
|
||||||
|
workingType: "Work at Height",
|
||||||
|
location: "Atrium void",
|
||||||
|
contractor: "Blue Star",
|
||||||
|
validityDate: "Jun 26, 2026",
|
||||||
|
validityTime: "08:30–17:00",
|
||||||
|
crew: 2,
|
||||||
|
status: "ACTIVE",
|
||||||
|
actionText: "Close out",
|
||||||
|
isHighlighted: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
permit: "PTW-2664",
|
||||||
|
workingType: "Electrical Isolation",
|
||||||
|
location: "STP wet well",
|
||||||
|
contractor: "Sterling FM",
|
||||||
|
validityDate: "Jun 26, 2026",
|
||||||
|
validityTime: "09:00–13:00",
|
||||||
|
crew: 3,
|
||||||
|
status: "SUBMITTED",
|
||||||
|
actionText: "Approve",
|
||||||
|
isHighlighted: true, // Row with highlight bar
|
||||||
|
},
|
||||||
|
{
|
||||||
|
permit: "PTW-2665",
|
||||||
|
workingType: "Confined Space",
|
||||||
|
location: "DG yard",
|
||||||
|
contractor: "In-house team",
|
||||||
|
validityDate: "Jun 26, 2026",
|
||||||
|
validityTime: "14:00–18:00",
|
||||||
|
crew: 4,
|
||||||
|
status: "APPROVED",
|
||||||
|
actionText: "Activate",
|
||||||
|
isHighlighted: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
permit: "PTW-2666",
|
||||||
|
workingType: "Hot Work",
|
||||||
|
location: "Roof terrace",
|
||||||
|
contractor: "Voltas Ltd",
|
||||||
|
validityDate: "Jun 25, 2026",
|
||||||
|
validityTime: "08:00–12:00",
|
||||||
|
crew: 5,
|
||||||
|
status: "EXPIRED",
|
||||||
|
hasViewIconOnly: true,
|
||||||
|
isHighlighted: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
permit: "PTW-2667",
|
||||||
|
workingType: "Work at Height",
|
||||||
|
location: "LT panel room",
|
||||||
|
contractor: "Blue Star",
|
||||||
|
validityDate: "Jun 25, 2026",
|
||||||
|
validityTime: "10:00–16:00",
|
||||||
|
crew: 2,
|
||||||
|
status: "CLOSED",
|
||||||
|
hasViewIconOnly: true,
|
||||||
|
isHighlighted: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
permit: "PTW-2668",
|
||||||
|
workingType: "Electrical Isolation",
|
||||||
|
location: "Chiller plant",
|
||||||
|
contractor: "Sterling FM",
|
||||||
|
validityDate: "Jun 26, 2026",
|
||||||
|
validityTime: "11:00–15:00",
|
||||||
|
crew: 3,
|
||||||
|
status: "REJECTED",
|
||||||
|
hasViewIconOnly: true,
|
||||||
|
isHighlighted: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
permit: "PTW-2726",
|
||||||
|
workingType: "Work at Height",
|
||||||
|
location: "Atrium void",
|
||||||
|
contractor: "Blue Star",
|
||||||
|
validityDate: "Jun 26, 2026",
|
||||||
|
validityTime: "08:30–17:00",
|
||||||
|
crew: 2,
|
||||||
|
status: "DRAFT",
|
||||||
|
actionText: "Submit",
|
||||||
|
isHighlighted: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const renderStatusBadge = (status: string) => {
|
||||||
|
switch (status) {
|
||||||
|
case "ACTIVE":
|
||||||
|
return (
|
||||||
|
<span className="inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-[10px] font-bold tracking-wider bg-emerald-950/60 text-emerald-400 border border-emerald-800/40">
|
||||||
|
<span className="w-1.5 h-1.5 rounded-full bg-emerald-400"></span>
|
||||||
|
ACTIVE
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
case "SUBMITTED":
|
||||||
|
return (
|
||||||
|
<span className="inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-[10px] font-bold tracking-wider bg-amber-950/50 text-amber-300 border border-amber-800/40">
|
||||||
|
<span className="w-1.5 h-1.5 rounded-full bg-amber-400"></span>
|
||||||
|
SUBMITTED
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
case "APPROVED":
|
||||||
|
return (
|
||||||
|
<span className="inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-[10px] font-bold tracking-wider bg-blue-950/60 text-blue-400 border border-blue-800/40">
|
||||||
|
<span className="w-1.5 h-1.5 rounded-full bg-blue-400"></span>
|
||||||
|
APPROVED
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
case "EXPIRED":
|
||||||
|
return (
|
||||||
|
<span className="inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-[10px] font-bold tracking-wider bg-rose-950/40 text-rose-400 border border-rose-900/30">
|
||||||
|
<span className="w-1.5 h-1.5 rounded-full bg-rose-400"></span>
|
||||||
|
EXPIRED
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
case "CLOSED":
|
||||||
|
return (
|
||||||
|
<span className="inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-[10px] font-bold tracking-wider bg-slate-800/80 text-slate-400 border border-slate-700/50">
|
||||||
|
<span className="w-1.5 h-1.5 rounded-full bg-slate-400"></span>
|
||||||
|
CLOSED
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
case "REJECTED":
|
||||||
|
return (
|
||||||
|
<span className="inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-[10px] font-bold tracking-wider bg-rose-950/40 text-rose-400 border border-rose-900/30">
|
||||||
|
<span className="w-1.5 h-1.5 rounded-full bg-rose-400"></span>
|
||||||
|
REJECTED
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
case "DRAFT":
|
||||||
|
return (
|
||||||
|
<span className="inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-[10px] font-bold tracking-wider bg-slate-800/80 text-slate-400 border border-slate-700/50">
|
||||||
|
<span className="w-1.5 h-1.5 rounded-full bg-slate-400"></span>
|
||||||
|
DRAFT
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
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-[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>Work Permit</span>
|
||||||
|
</div>
|
||||||
|
<h1 className="text-2xl font-bold text-white tracking-tight mt-2">
|
||||||
|
Permit to Work
|
||||||
|
</h1>
|
||||||
|
<p className="text-sm font-medium text-slate-400 mt-2 max-w-xl leading-relaxed">
|
||||||
|
A controlled permit-to-work lifecycle — request, risk review, approval, activation and close-out — per site and hazard type. QR-driven on the floor.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Action Buttons */}
|
||||||
|
<div className="flex items-center gap-3 self-start md:mt-10">
|
||||||
|
<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">
|
||||||
|
<QrCode size={16} />
|
||||||
|
<span>Scan QR</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 permit</span>
|
||||||
|
</Button>
|
||||||
|
</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-6 gap-4">
|
||||||
|
{/* Navigation tabs component if needed */}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* --- STAT CARDS --- */}
|
||||||
|
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 mb-6">
|
||||||
|
{/* Active on site */}
|
||||||
|
<StatCard
|
||||||
|
variant="icon"
|
||||||
|
title="Active on site"
|
||||||
|
value="2"
|
||||||
|
icon={ShieldCheck}
|
||||||
|
badgeText="live"
|
||||||
|
badgeClassName="text-teal-400 font-mono font-medium"
|
||||||
|
iconContainerClassName="bg-emerald-950/60 border-emerald-800/40 text-emerald-400"
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* Awaiting approval */}
|
||||||
|
<StatCard
|
||||||
|
variant="icon"
|
||||||
|
title="Awaiting approval"
|
||||||
|
value="3"
|
||||||
|
icon={Clock}
|
||||||
|
badgeText="action due"
|
||||||
|
badgeClassName="text-amber-500 font-mono font-medium"
|
||||||
|
iconContainerClassName="bg-amber-950/40 border-amber-800/30 text-amber-500"
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* Approved · ready */}
|
||||||
|
<StatCard
|
||||||
|
variant="icon"
|
||||||
|
title="Approved · ready"
|
||||||
|
value="1"
|
||||||
|
icon={Check}
|
||||||
|
badgeText="to activate"
|
||||||
|
badgeClassName="text-slate-400 font-mono"
|
||||||
|
iconContainerClassName="bg-blue-950/50 border-blue-800/30 text-blue-400"
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* Expired · breach */}
|
||||||
|
<StatCard
|
||||||
|
variant="icon"
|
||||||
|
title="Expired · breach"
|
||||||
|
value="1"
|
||||||
|
icon={AlertTriangle}
|
||||||
|
badgeText="escalate"
|
||||||
|
badgeClassName="text-rose-400 font-mono font-medium"
|
||||||
|
iconContainerClassName="bg-rose-950/50 border-rose-800/30 text-rose-400"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* --- STATUS PILL FILTERS --- */}
|
||||||
|
<div className="mb-6">
|
||||||
|
<FilterTabs
|
||||||
|
options={workPermitFilters}
|
||||||
|
activeFilter={activeFilter}
|
||||||
|
onChange={setActiveFilter}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* --- PERMIT TABLE SECTION --- */}
|
||||||
|
<div className="bg-[#0b1329] border border-slate-800/80 rounded-lg overflow-x-auto">
|
||||||
|
<table className="w-full text-left text-sm">
|
||||||
|
<thead>
|
||||||
|
<tr className="border-b border-slate-800/80 text-[11px] font-bold uppercase tracking-wider text-slate-400">
|
||||||
|
<th className="py-3 px-4">Permit</th>
|
||||||
|
<th className="py-3 px-4">Working Type</th>
|
||||||
|
<th className="py-3 px-4">Location</th>
|
||||||
|
<th className="py-3 px-4">Contractor</th>
|
||||||
|
<th className="py-3 px-4">Validity</th>
|
||||||
|
<th className="py-3 px-4">Crew</th>
|
||||||
|
<th className="py-3 px-4">Status</th>
|
||||||
|
<th className="py-3 px-4 text-right"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody className="divide-y divide-slate-800/40">
|
||||||
|
{permitsData.map((row, index) => (
|
||||||
|
<tr
|
||||||
|
key={index}
|
||||||
|
className={`transition-colors relative ${
|
||||||
|
row.isHighlighted ? "bg-[#0e2238]" : "hover:bg-slate-800/30"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{/* Permit ID */}
|
||||||
|
<td className="py-4 px-4 font-mono text-teal-400 font-medium text-xs whitespace-nowrap relative">
|
||||||
|
{row.isHighlighted && (
|
||||||
|
<div className="absolute left-0 top-0 bottom-0 w-[3px] bg-teal-400" />
|
||||||
|
)}
|
||||||
|
{row.permit}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
{/* Working Type */}
|
||||||
|
<td className="py-4 px-4 font-semibold text-slate-100 whitespace-nowrap">
|
||||||
|
{row.workingType}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
{/* Location */}
|
||||||
|
<td className="py-4 px-4 text-slate-300 font-medium whitespace-nowrap">
|
||||||
|
{row.location}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
{/* Contractor */}
|
||||||
|
<td className="py-4 px-4 text-slate-300 font-medium whitespace-nowrap">
|
||||||
|
{row.contractor}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
{/* Validity */}
|
||||||
|
<td className="py-4 px-4 whitespace-nowrap">
|
||||||
|
<div className="text-xs text-slate-300 font-medium">{row.validityDate}</div>
|
||||||
|
<div className="text-[11px] font-mono text-slate-500">{row.validityTime}</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
{/* Crew */}
|
||||||
|
<td className="py-4 px-4 text-slate-300 font-medium whitespace-nowrap">
|
||||||
|
{row.crew}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
{/* Status Badge */}
|
||||||
|
<td className="py-4 px-4 whitespace-nowrap">
|
||||||
|
{renderStatusBadge(row.status)}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
{/* Actions */}
|
||||||
|
<td className="py-4 px-4 text-right whitespace-nowrap">
|
||||||
|
<div className="flex items-center justify-end gap-2">
|
||||||
|
{row.hasViewIconOnly ? (
|
||||||
|
<div className="flex flex-col gap-1">
|
||||||
|
<button className="p-1.5 text-slate-400 hover:text-white bg-slate-800/40 hover:bg-slate-800 rounded border border-slate-700/50 transition-colors">
|
||||||
|
<FileText size={14} />
|
||||||
|
</button>
|
||||||
|
<button className="p-1.5 text-slate-400 hover:text-white bg-slate-800/40 hover:bg-slate-800 rounded border border-slate-700/50 transition-colors">
|
||||||
|
<Eye size={14} />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="flex flex-col items-center gap-1">
|
||||||
|
<button className="p-1.5 text-slate-400 hover:text-white bg-slate-800/40 hover:bg-slate-800 rounded border border-slate-700/50 transition-colors">
|
||||||
|
<FileText size={14} />
|
||||||
|
</button>
|
||||||
|
<button className="text-teal-400 hover:text-teal-300 text-xs font-semibold hover:underline">
|
||||||
|
{row.actionText}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="mb-10 mt-10">
|
||||||
|
<InfoBanner
|
||||||
|
boldText="Compliance:"
|
||||||
|
normalText="a permit must be Approved before work starts and Closed on completion. Permits past their validity window auto-flag as Expired for safety escalation."
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -216,6 +216,16 @@ export const Reqeusttabs: string[] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
export const workPermitFilters = [
|
||||||
|
{ label: 'All', count: 10 },
|
||||||
|
{ label: 'Awaiting', count: 3 },
|
||||||
|
{ label: 'Approved', count: 1},
|
||||||
|
{ label: 'Active', count: 2 },
|
||||||
|
{ label: 'Closed', count: 1 },
|
||||||
|
{ label: 'Expired', count: 1 },
|
||||||
|
{ label: 'Rejected', count: 1 },
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
// Data model interface
|
// Data model interface
|
||||||
|
|
||||||
@@ -233,3 +243,4 @@ export const Reqeusttabs: string[] = [
|
|||||||
{ id: '9', block: 'Block 2', floor: '3', zone: 'Z1', department: 'Inspection work', location: 'Gym', window: '06:00–17:30', tat: '20m', sched: 8, approval: true, status: 'INACTIVE' },
|
{ id: '9', block: 'Block 2', floor: '3', zone: 'Z1', department: 'Inspection work', location: 'Gym', window: '06:00–17:30', tat: '20m', sched: 8, approval: true, status: 'INACTIVE' },
|
||||||
{ id: '10', block: 'Block 1', floor: 'G', zone: 'Z1', department: 'HVAC', location: 'Lobby', window: '08:00–18:00', tat: '30m', sched: 4, approval: false, status: 'ACTIVE' },
|
{ id: '10', block: 'Block 1', floor: 'G', zone: 'Z1', department: 'HVAC', location: 'Lobby', window: '08:00–18:00', tat: '30m', sched: 4, approval: false, status: 'ACTIVE' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -102,3 +102,16 @@ export interface InfoBannerProps {
|
|||||||
boldText?: string;
|
boldText?: string;
|
||||||
normalText?: string;
|
normalText?: string;
|
||||||
}
|
}
|
||||||
|
export interface TableRowData {
|
||||||
|
id: string;
|
||||||
|
block: string;
|
||||||
|
floor: string;
|
||||||
|
zone: string;
|
||||||
|
department: string;
|
||||||
|
location: string;
|
||||||
|
window: string;
|
||||||
|
tat: string;
|
||||||
|
sched: number;
|
||||||
|
approval: boolean;
|
||||||
|
status: 'ACTIVE' | 'INACTIVE';
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,199 +1,397 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|
||||||
Pencil,
|
Pencil,
|
||||||
|
|
||||||
Menu,
|
Menu,
|
||||||
|
|
||||||
ShieldCheck,
|
ShieldCheck,
|
||||||
|
|
||||||
QrCode,
|
QrCode,
|
||||||
|
|
||||||
Power,
|
Power,
|
||||||
|
|
||||||
Check,
|
Check,
|
||||||
|
|
||||||
Sparkles,
|
Sparkles,
|
||||||
|
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
|
|
||||||
import { mockData } from '@/constants/constant';
|
import { mockData } from '@/constants/constant';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default function LocationTable(){
|
export default function LocationTable(){
|
||||||
|
|
||||||
const [selectedIds, setSelectedIds] = useState<string[]>(['1']); // Row 1 selected by default (teal indicator bar)
|
const [selectedIds, setSelectedIds] = useState<string[]>(['1']); // Row 1 selected by default (teal indicator bar)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const toggleSelectAll = () => {
|
const toggleSelectAll = () => {
|
||||||
|
|
||||||
if (selectedIds.length === mockData.length) {
|
if (selectedIds.length === mockData.length) {
|
||||||
|
|
||||||
setSelectedIds([]);
|
setSelectedIds([]);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
setSelectedIds(mockData.map((row) => row.id));
|
setSelectedIds(mockData.map((row) => row.id));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const toggleSelectRow = (id: string) => {
|
const toggleSelectRow = (id: string) => {
|
||||||
|
|
||||||
setSelectedIds((prev) =>
|
setSelectedIds((prev) =>
|
||||||
|
|
||||||
prev.includes(id) ? prev.filter((item) => item !== id) : [...prev, id]
|
prev.includes(id) ? prev.filter((item) => item !== id) : [...prev, id]
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
<div className="w-full bg-[#071321] text-slate-300 rounded-xl overflow-hidden border border-slate-800/80 shadow-2xl relative font-sans">
|
<div className="w-full bg-[#071321] text-slate-300 rounded-xl overflow-hidden border border-slate-800/80 shadow-2xl relative font-sans">
|
||||||
|
|
||||||
<div className="overflow-x-auto">
|
<div className="overflow-x-auto">
|
||||||
|
|
||||||
<table className="w-full text-left text-xs border-collapse">
|
<table className="w-full text-left text-xs border-collapse">
|
||||||
|
|
||||||
{/* TABLE HEADER */}
|
{/* TABLE HEADER */}
|
||||||
|
|
||||||
<thead>
|
<thead>
|
||||||
|
|
||||||
<tr className="border-b border-slate-800/90 text-[11px] font-bold tracking-wider text-slate-500 uppercase font-mono">
|
<tr className="border-b border-slate-800/90 text-[11px] font-bold tracking-wider text-slate-500 uppercase font-mono">
|
||||||
|
|
||||||
<th className="py-4 px-4 w-12 text-center">
|
<th className="py-4 px-4 w-12 text-center">
|
||||||
|
|
||||||
<input
|
<input
|
||||||
|
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
|
|
||||||
checked={selectedIds.length === mockData.length}
|
checked={selectedIds.length === mockData.length}
|
||||||
|
|
||||||
onChange={toggleSelectAll}
|
onChange={toggleSelectAll}
|
||||||
|
|
||||||
className="rounded border-slate-700 bg-slate-900/80 text-teal-400 focus:ring-0 focus:ring-offset-0 cursor-pointer accent-teal-400 h-3.5 w-3.5"
|
className="rounded border-slate-700 bg-slate-900/80 text-teal-400 focus:ring-0 focus:ring-offset-0 cursor-pointer accent-teal-400 h-3.5 w-3.5"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
<th className="py-4 px-3 font-mono">BLOCK</th>
|
<th className="py-4 px-3 font-mono">BLOCK</th>
|
||||||
|
|
||||||
<th className="py-4 px-3 font-mono">FLOOR</th>
|
<th className="py-4 px-3 font-mono">FLOOR</th>
|
||||||
|
|
||||||
<th className="py-4 px-3 font-mono">ZONE</th>
|
<th className="py-4 px-3 font-mono">ZONE</th>
|
||||||
|
|
||||||
<th className="py-4 px-3 font-mono">DEPARTMENT</th>
|
<th className="py-4 px-3 font-mono">DEPARTMENT</th>
|
||||||
|
|
||||||
<th className="py-4 px-3 font-mono">LOCATION</th>
|
<th className="py-4 px-3 font-mono">LOCATION</th>
|
||||||
|
|
||||||
<th className="py-4 px-3 font-mono">WINDOW</th>
|
<th className="py-4 px-3 font-mono">WINDOW</th>
|
||||||
|
|
||||||
<th className="py-4 px-3 font-mono">TAT</th>
|
<th className="py-4 px-3 font-mono">TAT</th>
|
||||||
|
|
||||||
<th className="py-4 px-3 font-mono">SCHED.</th>
|
<th className="py-4 px-3 font-mono">SCHED.</th>
|
||||||
|
|
||||||
<th className="py-4 px-3 font-mono">APPROVAL</th>
|
<th className="py-4 px-3 font-mono">APPROVAL</th>
|
||||||
|
|
||||||
<th className="py-4 px-3 font-mono">STATUS</th>
|
<th className="py-4 px-3 font-mono">STATUS</th>
|
||||||
|
|
||||||
<th className="py-4 px-4 font-mono text-right pr-6">ACTIONS</th>
|
<th className="py-4 px-4 font-mono text-right pr-6">ACTIONS</th>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{/* TABLE BODY */}
|
{/* TABLE BODY */}
|
||||||
|
|
||||||
<tbody className="divide-y divide-slate-800/50">
|
<tbody className="divide-y divide-slate-800/50">
|
||||||
|
|
||||||
{mockData.map((row) => {
|
{mockData.map((row) => {
|
||||||
|
|
||||||
const isSelected = selectedIds.includes(row.id);
|
const isSelected = selectedIds.includes(row.id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
<tr
|
<tr
|
||||||
|
|
||||||
key={row.id}
|
key={row.id}
|
||||||
|
|
||||||
className={`group relative transition-colors ${
|
className={`group relative transition-colors ${
|
||||||
|
|
||||||
isSelected
|
isSelected
|
||||||
|
|
||||||
? 'bg-[#0e2238]/60 hover:bg-[#122942]/80'
|
? 'bg-[#0e2238]/60 hover:bg-[#122942]/80'
|
||||||
|
|
||||||
: 'hover:bg-slate-800/30'
|
: 'hover:bg-slate-800/30'
|
||||||
|
|
||||||
}`}
|
}`}
|
||||||
|
|
||||||
>
|
>
|
||||||
|
|
||||||
{/* Left Selection Indicator Bar (for Row 1 / Selected Rows) */}
|
{/* Left Selection Indicator Bar (for Row 1 / Selected Rows) */}
|
||||||
|
|
||||||
<td className="py-3 px-4 text-center relative">
|
<td className="py-3 px-4 text-center relative">
|
||||||
|
|
||||||
{isSelected && (
|
{isSelected && (
|
||||||
|
|
||||||
<span className="absolute left-0 top-0 bottom-0 w-[3px] bg-teal-400 rounded-r" />
|
<span className="absolute left-0 top-0 bottom-0 w-[3px] bg-teal-400 rounded-r" />
|
||||||
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<input
|
<input
|
||||||
|
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
|
|
||||||
checked={isSelected}
|
checked={isSelected}
|
||||||
|
|
||||||
onChange={() => toggleSelectRow(row.id)}
|
onChange={() => toggleSelectRow(row.id)}
|
||||||
|
|
||||||
className="rounded border-slate-700 bg-slate-900/80 text-teal-400 focus:ring-0 focus:ring-offset-0 cursor-pointer accent-teal-400 h-3.5 w-3.5"
|
className="rounded border-slate-700 bg-slate-900/80 text-teal-400 focus:ring-0 focus:ring-offset-0 cursor-pointer accent-teal-400 h-3.5 w-3.5"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{/* Block */}
|
{/* Block */}
|
||||||
|
|
||||||
<td className="py-3 px-3 font-semibold text-slate-100 whitespace-nowrap">
|
<td className="py-3 px-3 font-semibold text-slate-100 whitespace-nowrap">
|
||||||
|
|
||||||
{row.block}
|
{row.block}
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{/* Floor */}
|
{/* Floor */}
|
||||||
|
|
||||||
<td className="py-3 px-3 font-medium text-slate-200">
|
<td className="py-3 px-3 font-medium text-slate-200">
|
||||||
|
|
||||||
{row.floor}
|
{row.floor}
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{/* Zone */}
|
{/* Zone */}
|
||||||
|
|
||||||
<td className="py-3 px-3 font-medium text-slate-300">
|
<td className="py-3 px-3 font-medium text-slate-300">
|
||||||
|
|
||||||
{row.zone}
|
{row.zone}
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{/* Department */}
|
{/* Department */}
|
||||||
|
|
||||||
<td className="py-3 px-3 font-semibold text-slate-200 whitespace-nowrap">
|
<td className="py-3 px-3 font-semibold text-slate-200 whitespace-nowrap">
|
||||||
|
|
||||||
{row.department}
|
{row.department}
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{/* Location */}
|
{/* Location */}
|
||||||
|
|
||||||
<td className="py-3 px-3 font-extrabold text-white whitespace-nowrap">
|
<td className="py-3 px-3 font-extrabold text-white whitespace-nowrap">
|
||||||
|
|
||||||
{row.location}
|
{row.location}
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{/* Window */}
|
{/* Window */}
|
||||||
|
|
||||||
<td className="py-3 px-3 font-mono text-slate-400 text-[11px] whitespace-nowrap">
|
<td className="py-3 px-3 font-mono text-slate-400 text-[11px] whitespace-nowrap">
|
||||||
|
|
||||||
{row.window}
|
{row.window}
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{/* TAT */}
|
{/* TAT */}
|
||||||
|
|
||||||
<td className="py-3 px-3 font-mono text-slate-200 font-medium">
|
<td className="py-3 px-3 font-mono text-slate-200 font-medium">
|
||||||
|
|
||||||
{row.tat}
|
{row.tat}
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{/* Sched */}
|
{/* Sched */}
|
||||||
|
|
||||||
<td className="py-3 px-3 font-mono text-slate-200 font-medium">
|
<td className="py-3 px-3 font-mono text-slate-200 font-medium">
|
||||||
|
|
||||||
{row.sched}
|
{row.sched}
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{/* Approval */}
|
{/* Approval */}
|
||||||
|
|
||||||
<td className="py-3 px-3 whitespace-nowrap">
|
<td className="py-3 px-3 whitespace-nowrap">
|
||||||
|
|
||||||
{row.approval ? (
|
{row.approval ? (
|
||||||
|
|
||||||
<span className="inline-flex items-center gap-1.5 text-emerald-400 font-semibold">
|
<span className="inline-flex items-center gap-1.5 text-emerald-400 font-semibold">
|
||||||
|
|
||||||
<Check size={14} className="stroke-[3]" />
|
<Check size={14} className="stroke-[3]" />
|
||||||
|
|
||||||
<span>Yes</span>
|
<span>Yes</span>
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
) : (
|
) : (
|
||||||
|
|
||||||
<span className="text-slate-500 font-mono">——</span>
|
<span className="text-slate-500 font-mono">——</span>
|
||||||
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{/* Status Badge */}
|
{/* Status Badge */}
|
||||||
|
|
||||||
<td className="py-3 px-3 whitespace-nowrap">
|
<td className="py-3 px-3 whitespace-nowrap">
|
||||||
|
|
||||||
{row.status === 'ACTIVE' ? (
|
{row.status === 'ACTIVE' ? (
|
||||||
|
|
||||||
<span className="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[10px] font-bold font-mono tracking-wider bg-emerald-950/80 border border-emerald-800/40 text-emerald-400">
|
<span className="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[10px] font-bold font-mono tracking-wider bg-emerald-950/80 border border-emerald-800/40 text-emerald-400">
|
||||||
|
|
||||||
<span className="h-1.5 w-1.5 rounded-full bg-emerald-400"></span>
|
<span className="h-1.5 w-1.5 rounded-full bg-emerald-400"></span>
|
||||||
|
|
||||||
ACTIVE
|
ACTIVE
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
) : (
|
) : (
|
||||||
|
|
||||||
<span className="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[10px] font-bold font-mono tracking-wider bg-slate-800/80 border border-slate-700/50 text-slate-400">
|
<span className="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[10px] font-bold font-mono tracking-wider bg-slate-800/80 border border-slate-700/50 text-slate-400">
|
||||||
|
|
||||||
<span className="h-1.5 w-1.5 rounded-full bg-slate-400"></span>
|
<span className="h-1.5 w-1.5 rounded-full bg-slate-400"></span>
|
||||||
|
|
||||||
INACTIVE
|
INACTIVE
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{/* Action Icon Buttons */}
|
{/* Action Icon Buttons */}
|
||||||
|
|
||||||
<td className="py-3 px-4 text-right whitespace-nowrap pr-6">
|
<td className="py-3 px-4 text-right whitespace-nowrap pr-6">
|
||||||
|
|
||||||
<div className="inline-flex items-center gap-1.5">
|
<div className="inline-flex items-center gap-1.5">
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
|
||||||
title="Edit"
|
title="Edit"
|
||||||
|
|
||||||
className="p-1.5 rounded-md bg-[#0b1b2d] hover:bg-slate-700/60 border border-slate-800 text-slate-400 hover:text-slate-200 transition-colors"
|
className="p-1.5 rounded-md bg-[#0b1b2d] hover:bg-slate-700/60 border border-slate-800 text-slate-400 hover:text-slate-200 transition-colors"
|
||||||
|
|
||||||
>
|
>
|
||||||
|
|
||||||
<Pencil size={13} />
|
<Pencil size={13} />
|
||||||
|
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
|
||||||
title="Options"
|
title="Options"
|
||||||
|
|
||||||
className="p-1.5 rounded-md bg-[#0b1b2d] hover:bg-slate-700/60 border border-slate-800 text-slate-400 hover:text-slate-200 transition-colors"
|
className="p-1.5 rounded-md bg-[#0b1b2d] hover:bg-slate-700/60 border border-slate-800 text-slate-400 hover:text-slate-200 transition-colors"
|
||||||
|
|
||||||
>
|
>
|
||||||
|
|
||||||
<Menu size={13} />
|
<Menu size={13} />
|
||||||
|
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
|
||||||
title="Security"
|
title="Security"
|
||||||
|
|
||||||
className="p-1.5 rounded-md bg-[#0b1b2d] hover:bg-slate-700/60 border border-slate-800 text-slate-400 hover:text-slate-200 transition-colors"
|
className="p-1.5 rounded-md bg-[#0b1b2d] hover:bg-slate-700/60 border border-slate-800 text-slate-400 hover:text-slate-200 transition-colors"
|
||||||
|
|
||||||
>
|
>
|
||||||
|
|
||||||
<ShieldCheck size={13} />
|
<ShieldCheck size={13} />
|
||||||
|
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
|
||||||
title="QR Code"
|
title="QR Code"
|
||||||
|
|
||||||
className="p-1.5 rounded-md bg-[#0b1b2d] hover:bg-slate-700/60 border border-slate-800 text-slate-400 hover:text-slate-200 transition-colors"
|
className="p-1.5 rounded-md bg-[#0b1b2d] hover:bg-slate-700/60 border border-slate-800 text-slate-400 hover:text-slate-200 transition-colors"
|
||||||
|
|
||||||
>
|
>
|
||||||
|
|
||||||
<QrCode size={13} />
|
<QrCode size={13} />
|
||||||
|
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
|
||||||
title="Toggle Power"
|
title="Toggle Power"
|
||||||
|
|
||||||
className="p-1.5 rounded-md bg-[#0b1b2d] hover:bg-slate-700/60 border border-slate-800 text-slate-400 hover:text-slate-200 transition-colors"
|
className="p-1.5 rounded-md bg-[#0b1b2d] hover:bg-slate-700/60 border border-slate-800 text-slate-400 hover:text-slate-200 transition-colors"
|
||||||
|
|
||||||
>
|
>
|
||||||
|
|
||||||
<Power size={13} />
|
<Power size={13} />
|
||||||
|
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
})}
|
})}
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user