Files

250 lines
11 KiB
TypeScript

"use client";
import { useState } from "react";
import { Plus, } from "lucide-react";
import Button from "@/components/common/button";
import { blocks, floors, zones } from "@/constants/constant";
export default function MasterDataPortal() {
const [activeTab, setActiveTab] = useState("Block / Floor / Zone");
// Sample data for the hierarchy cards
return (
<div className=" text-slate-100 font-sans my-15">
{/* --- BREADCRUMB --- */}
<div className="flex items-center gap-2 text-[12px] font-bold tracking-widest text-emerald-400 uppercase font-mono">
<span>APPLE ONE HQ TOWER</span>
<span className="text-slate-600"></span>
<span className="text-slate-400">CONFIGURE</span>
<span className="text-slate-600"></span>
<span className="text-slate-400">MASTER DATA</span>
</div>
{/* --- PAGE HEADER --- */}
<h1 className="text-3xl font-bold text-white tracking-tight mt-1">
Master data
</h1>
<p className="text-sm font-medium text-slate-400 mt-2 max-w-2xl leading-relaxed">
Every transactional module reads from these masters keep them complete and
they cascade across equipment, requests, budgets, training and reports.
</p>
{/* --- CATEGORY BUTTONS / TABS --- */}
<div className="mt-6 space-y-4">
{/* Row 1: Site & Location, Assets, Operations, Finance */}
<div className="flex flex-wrap gap-6 items-start text-xs font-semibold">
{/* SITE & LOCATION */}
<div className="flex flex-col gap-1.5">
<span className="text-[10px] uppercase font-mono tracking-wider text-slate-500 font-bold">
SITE & LOCATION
</span>
<Button
onClick={() => setActiveTab("Block / Floor / Zone")}
className={`px-3 py-1.5 rounded-lg border text-xs font-semibold transition-all ${
activeTab === "Block / Floor / Zone"
? "bg-[#0b2926] text-emerald-400 border-emerald-500/80 shadow-[0_0_12px_rgba(16,185,129,0.15)]"
: "bg-[#0c1622] text-slate-300 border-slate-800 hover:border-slate-700"
}`}
>
Block / Floor / Zone
</Button>
</div>
{/* ASSETS */}
<div className="flex flex-col gap-1.5">
<span className="text-[10px] uppercase font-mono tracking-wider text-slate-500 font-bold">
ASSETS
</span>
<div className="flex flex-wrap gap-2">
{["Manufacturer", "Service Provider", "Criticality"].map((item) => (
<Button
key={item}
onClick={() => setActiveTab(item)}
className={`px-3 py-1.5 rounded-lg border text-xs transition-all ${
activeTab === item
? "bg-[#0b2926] text-emerald-400 border-emerald-500/80"
: "bg-[#0c1622] text-slate-300 border-slate-800/80 hover:bg-slate-800/50"
}`}
>
{item}
</Button>
))}
</div>
</div>
{/* OPERATIONS */}
<div className="flex flex-col gap-1.5">
<span className="text-[10px] uppercase font-mono tracking-wider text-slate-500 font-bold">
OPERATIONS
</span>
<div className="flex flex-wrap gap-2">
{["Service Type", "Unit", "Store", "Partners"].map((item) => (
<Button
key={item}
onClick={() => setActiveTab(item)}
className={`px-3 py-1.5 rounded-lg border text-xs transition-all ${
activeTab === item
? "bg-[#0b2926] text-emerald-400 border-emerald-500/80"
: "bg-[#0c1622] text-slate-300 border-slate-800/80 hover:bg-slate-800/50"
}`}
>
{item}
</Button>
))}
</div>
</div>
{/* FINANCE */}
<div className="flex flex-col gap-1.5">
<span className="text-[10px] uppercase font-mono tracking-wider text-slate-500 font-bold">
FINANCE
</span>
<div className="flex flex-wrap gap-2">
{["Budget Category", "Budget Type"].map((item) => (
<Button
key={item}
onClick={() => setActiveTab(item)}
className={`px-3 py-1.5 rounded-lg border text-xs transition-all ${
activeTab === item
? "bg-[#0b2926] text-emerald-400 border-emerald-500/80"
: "bg-[#0c1622] text-slate-300 border-slate-800/80 hover:bg-slate-800/50"
}`}
>
{item}
</Button>
))}
</div>
</div>
</div>
{/* Row 2: People */}
<div className="flex flex-col gap-1.5">
<span className="text-[10px] uppercase font-mono tracking-wider text-slate-500 font-bold">
PEOPLE
</span>
<div>
<Button
onClick={() => setActiveTab("Course")}
className={`px-3 py-1.5 rounded-lg border text-xs font-semibold transition-all ${
activeTab === "Course"
? "bg-[#0b2926] text-emerald-400 border-emerald-500/80"
: "bg-[#0c1622] text-slate-300 border-slate-800/80 hover:bg-slate-800/50"
}`}
>
Course
</Button>
</div>
</div>
</div>
{/* --- INFO BANNER --- */}
<div className="mt-6 bg-[#081524] border border-teal-800/50 rounded-xl p-4 text-xs text-slate-300 leading-relaxed">
<span className="font-bold text-white">Within a site:</span> sites themselves are defined in{" "}
<span className="font-semibold text-slate-100">Administration Sites</span> (with geofence).
Here you manage the Block / Floor / Zone hierarchy <em className="italic">inside</em> the active
site reused by Equipment, Desks, Requests and Floor plans.
</div>
{/* --- ACTION BUTTON --- */}
<div className="flex justify-end mt-6">
<button className="bg-[#2dd4bf] hover:bg-teal-300 text-slate-950 font-bold text-xs px-4 py-2.5 rounded-lg flex items-center gap-2 transition-all shadow-md">
<span>Generate QR</span>
</button>
</div>
{/* --- HIERARCHY CARDS GRID --- */}
<div className="grid grid-cols-1 md:grid-cols-3 gap-5 mt-4">
{/* Block Column */}
<div className="bg-[#0b1623]/90 border border-slate-800/90 rounded-xl p-5 flex flex-col justify-between shadow-sm">
<div>
<div className="flex items-center justify-between border-b border-slate-800/60 pb-3 mb-3">
<h3 className="text-sm font-bold text-white">Block</h3>
<span className="text-xs font-mono text-slate-500">{blocks.length}</span>
</div>
<div className="space-y-3">
{blocks.map((item, idx) => (
<div key={idx} className="flex items-center justify-between text-xs py-1">
<span className="font-medium text-slate-200">{item}</span>
<div className="flex items-center gap-3">
<span className="flex items-center gap-1 text-[10px] font-mono font-bold text-emerald-400 uppercase tracking-wider">
<span className="w-1.5 h-1.5 rounded-full bg-emerald-400"></span> ACTIVE
</span>
<button className="text-[11px] text-slate-400 border border-slate-800 bg-slate-900/60 hover:bg-slate-800 px-2.5 py-1 rounded-md transition-colors">
Remove
</button>
</div>
</div>
))}
</div>
</div>
<button className="mt-6 flex items-center gap-1.5 text-xs font-bold text-emerald-400 hover:text-emerald-300 transition-colors w-fit">
<Plus className="w-3.5 h-3.5 stroke-[3]" />
<span>Add block</span>
</button>
</div>
{/* Floor Column */}
<div className="bg-[#0b1623]/90 border border-slate-800/90 rounded-xl p-5 flex flex-col justify-between shadow-sm">
<div>
<div className="flex items-center justify-between border-b border-slate-800/60 pb-3 mb-3">
<h3 className="text-sm font-bold text-white">Floor</h3>
<span className="text-xs font-mono text-slate-500">{floors.length}</span>
</div>
<div className="space-y-3">
{floors.map((item, idx) => (
<div key={idx} className="flex items-center justify-between text-xs py-1">
<span className="font-medium text-slate-200">{item}</span>
<div className="flex items-center gap-3">
<span className="flex items-center gap-1 text-[10px] font-mono font-bold text-emerald-400 uppercase tracking-wider">
<span className="w-1.5 h-1.5 rounded-full bg-emerald-400"></span> ACTIVE
</span>
<Button className="text-[11px] text-slate-400 border border-slate-800 bg-slate-900/60 hover:bg-slate-800 px-2.5 py-1 rounded-md transition-colors">
Remove
</Button>
</div>
</div>
))}
</div>
</div>
<Button className="mt-6 flex items-center gap-1.5 text-xs font-bold text-emerald-400 hover:text-emerald-300 transition-colors w-fit">
<Plus className="w-3.5 h-3.5 stroke-[3]" />
<span>Add floor</span>
</Button>
</div>
{/* Zone Column */}
<div className="bg-[#0b1623]/90 border border-slate-800/90 rounded-xl p-5 flex flex-col justify-between shadow-sm">
<div>
<div className="flex items-center justify-between border-b border-slate-800/60 pb-3 mb-3">
<h3 className="text-sm font-bold text-white">Zone</h3>
<span className="text-xs font-mono text-slate-500">{zones.length}</span>
</div>
<div className="space-y-3">
{zones.map((item, idx) => (
<div key={idx} className="flex items-center justify-between text-xs py-1">
<span className="font-medium text-slate-200">{item}</span>
<div className="flex items-center gap-3">
<span className="flex items-center gap-1 text-[10px] font-mono font-bold text-emerald-400 uppercase tracking-wider">
<span className="w-1.5 h-1.5 rounded-full bg-emerald-400"></span> ACTIVE
</span>
<Button className="text-[11px] text-slate-400 border border-slate-800 bg-slate-900/60 hover:bg-slate-800 px-2.5 py-1 rounded-md transition-colors">
Remove
</Button>
</div>
</div>
))}
</div>
</div>
<Button className="mt-6 flex items-center gap-1.5 text-xs font-bold text-emerald-400 hover:text-emerald-300 transition-colors w-fit">
<Plus className="w-3.5 h-3.5 stroke-[3]" />
<span>Add zone</span>
</Button>
</div>
</div>
</div>
);
}