phase-0: scaffold backend and frontend shell

This commit is contained in:
Atharv1705
2026-11-12 12:12:15 +05:30
commit cb2f48620c
67 changed files with 9125 additions and 0 deletions
+66
View File
@@ -0,0 +1,66 @@
import { DataTable } from "@/components/DataTable";
import { ColumnDef } from "@tanstack/react-table";
import { Badge } from "@/components/ui/badge";
interface MockAsset {
code: string;
name: string;
department: string;
status: string;
category: string;
}
const MOCK_DATA: MockAsset[] = [
{ code: "PHRC-ICU-0001", name: "Ventilator", department: "ICU", status: "In Service", category: "Life Support" },
{ code: "PHRC-ICU-0002", name: "Patient Monitor", department: "ICU", status: "Under Repair", category: "Monitoring" },
{ code: "PHRC-OT-0001", name: "Anaesthesia Machine", department: "Operation Theatre", status: "In Service", category: "Life Support" },
{ code: "PHRC-RAD-0001", name: "CT Scanner", department: "Radiology", status: "In Service", category: "Imaging" },
{ code: "PHRC-RAD-0002", name: "X-Ray Unit", department: "Radiology", status: "Out of Service", category: "Imaging" },
{ code: "PHRC-EM-0001", name: "Defibrillator", department: "Emergency", status: "In Service", category: "Life Support" },
{ code: "PHRC-PATH-0001", name: "Centrifuge", department: "Pathology", status: "In Service", category: "Laboratory" },
{ code: "PHRC-DIAL-0001", name: "Dialysis Machine", department: "Dialysis", status: "In Service", category: "Dialysis" },
];
const STATUS_VARIANTS: Record<string, "success" | "danger" | "warning" | "outline"> = {
"In Service": "success",
"Under Repair": "danger",
"Out of Service": "warning",
Condemned: "outline",
};
const columns: ColumnDef<MockAsset, unknown>[] = [
{ accessorKey: "code", header: "Asset Code", enableColumnFilter: true },
{ accessorKey: "name", header: "Equipment Name", enableColumnFilter: true },
{ accessorKey: "category", header: "Category", enableColumnFilter: true },
{ accessorKey: "department", header: "Department", enableColumnFilter: true },
{
accessorKey: "status",
header: "Status",
enableColumnFilter: true,
cell: ({ getValue }) => {
const v = getValue() as string;
return <Badge variant={STATUS_VARIANTS[v] ?? "default"}>{v}</Badge>;
},
},
];
export function DataTableDemoPage() {
return (
<div className="space-y-4">
<div>
<h1 className="text-2xl font-bold text-gray-900">Phase 0 — DataTable Demo</h1>
<p className="text-gray-500 mt-1 text-sm">
Mock asset data demonstrating column filters, sort, pagination, column visibility, and CSV export.
Every list in the app will use this component.
</p>
</div>
<DataTable
data={MOCK_DATA}
columns={columns}
globalFilterPlaceholder="Search assets..."
exportFilename="assets-demo"
emptyMessage="No assets found."
/>
</div>
);
}
+75
View File
@@ -0,0 +1,75 @@
// Stub pages — replaced phase by phase
import { Link } from "react-router-dom";
interface StubProps {
title: string;
phase: number;
description?: string;
children?: React.ReactNode;
}
function StubPage({ title, phase, description, children }: StubProps) {
return (
<div className="max-w-lg mx-auto mt-16 text-center">
<div className="inline-flex items-center justify-center w-16 h-16 rounded-full bg-blue-50 mb-4">
<span className="text-2xl">🏗️</span>
</div>
<h2 className="text-xl font-semibold text-gray-800 mb-2">{title}</h2>
{description && <p className="text-gray-500 text-sm mb-4">{description}</p>}
<div className="inline-flex items-center gap-2 bg-amber-50 border border-amber-200 text-amber-700 px-4 py-2 rounded-full text-sm font-medium">
Coming in Phase {phase}
</div>
{children}
</div>
);
}
export const DashboardPage = () => (
<StubPage title="Dashboard" phase={6} description="KPI cards, charts, and needs-attention panel.">
<div className="mt-6">
<Link
to="/demo"
className="inline-flex items-center gap-1 text-sm font-medium text-[#1e3a8a] hover:underline"
>
Open Phase 0 DataTable Demo →
</Link>
</div>
</StubPage>
);
export const AssetsPage = () => (
<StubPage title="Asset Register" phase={2} description="60+ assets with column filters and detail tabs." />
);
export const ComplaintsPage = () => (
<StubPage
title="Breakdown & Complaint Register"
phase={3}
description="Full complaint lifecycle with response time and downtime tracking."
/>
);
export const PMPage = () => (
<StubPage title="Preventive Maintenance" phase={4} description="PM schedules and calendar view." />
);
export const CalibrationPage = () => (
<StubPage title="Calibration" phase={4} description="Calibration plans and records with due-date alerts." />
);
export const ContractsPage = () => (
<StubPage title="Contracts & Warranty" phase={5} description="AMC/CMC contracts and warranty tracking." />
);
export const InsurancePage = () => (
<StubPage title="Insurance" phase={5} description="Insurance policies with expiry alerts." />
);
export const DemoEquipmentPage = () => (
<StubPage title="Demo Equipment Register" phase={5} description="Demo equipment tracking with overdue returns." />
);
export const VisitsPage = () => (
<StubPage title="Department Visits" phase={5} description="Daily department visit reports." />
);
export const ReportsPage = () => (
<StubPage title="Reports & Exports" phase={7} description="8 reports with Excel export." />
);
export const NotificationsPage = () => (
<StubPage title="Notifications" phase={6} description="In-app alerts and notification centre." />
);
export const SettingsPage = () => (
<StubPage title="Settings" phase={1} description="Configurable lead days, downtime rules, and system settings." />
);