fix(print): enable full multi-page report printing, unconstrain viewport scrollbars, and add executive hospital letterhead

This commit is contained in:
Antigravity
2026-11-19 14:43:24 +05:30
parent 7b4f52db75
commit b98528d3e3
4 changed files with 196 additions and 52 deletions
+100 -1
View File
@@ -39,7 +39,7 @@ import {
} from "@/api/ai";
import { categoriesApi, departmentsApi } from "@/api/masters";
import { useAuthStore } from "@/hooks/useAuth";
import { formatINR } from "@/lib/format";
import { formatDateTime, formatINR } from "@/lib/format";
import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
@@ -527,6 +527,64 @@ export function AIReportPage() {
return (
<div className="space-y-6">
{/* Print-Only Official Hospital Letterhead & Scope */}
<div className="print-only mb-4 border-b-2 border-[#102C52] pb-3">
<div className="flex items-start justify-between">
<div className="flex items-center gap-3.5">
<img
src="/logo.jpg"
alt="XYZ Hospital"
className="h-14 w-14 object-contain"
/>
<div>
<div className="text-base font-extrabold text-[#102C52] tracking-tight">
XYZ HOSPITAL
</div>
<div className="text-[11px] font-semibold text-gray-800">
NABH Accredited Tertiary Care Hospital &bull; Department of Clinical Engineering
</div>
<div className="text-[10px] text-gray-500">
27, Sadashiv Peth, Pune, Maharashtra 411030 &bull; Tel: +91 20 6609 6000
</div>
</div>
</div>
<div className="text-right text-[10px] text-gray-600 space-y-0.5 border-l border-gray-200 pl-3">
<div className="font-bold text-[#102C52] uppercase tracking-wider">
Executive AI &amp; Cost Analysis
</div>
<div>
<strong>Ref:</strong> XYZ-BME-AI-REP
</div>
<div>
<strong>Date:</strong> {formatDateTime(new Date().toISOString())} IST
</div>
{user?.name && (
<div>
<strong>Generated by:</strong> {user.name} ({user.role?.replace(/_/g, " ").toUpperCase()})
</div>
)}
</div>
</div>
{/* Print Filter / Scope summary bar */}
<div className="mt-2.5 pt-2 border-t border-gray-200 flex flex-wrap items-center justify-between text-[10px] text-gray-700 bg-gray-50 px-3 py-1.5 rounded">
<div className="flex items-center gap-4 flex-wrap">
<div>
<span className="text-gray-500">Analysis:</span>{" "}
<strong>AI Report &amp; Cost Analysis</strong>
</div>
<div>
<span className="text-gray-500">Period:</span>{" "}
<strong>{period.toUpperCase()}</strong>
</div>
<div>
<span className="text-gray-500">Summary Mode:</span>{" "}
<strong>{statusChipLabel}</strong>
</div>
</div>
</div>
</div>
{/* Header + Mode Segmented Toggle + Status Chip */}
<div className="flex flex-wrap items-start justify-between gap-3">
<div>
@@ -1545,6 +1603,47 @@ export function AIReportPage() {
All figures are calculated deterministically from hospital records. Summaries are advisory only and never replace clinical or administrative sign-off.
</span>
</div>
{/* Hospital Tripartite Sign-off Block (Print / PDF Only) */}
<div className="print-only mt-8 pt-4 border-t-2 border-gray-300 print-break-inside-avoid">
<div className="flex items-center justify-between text-[10px] font-bold uppercase tracking-wider text-gray-700 mb-4">
<span>Hospital Engineering Audit &amp; Verification Sign-off (NABH Chapter FMS)</span>
<span>XYZ Hospital</span>
</div>
<div className="grid grid-cols-3 gap-5 text-[10px]">
<div className="border border-gray-300 rounded p-3 space-y-4 bg-gray-50/50">
<div className="font-bold text-gray-800">1. PREPARED BY</div>
<div className="h-9 border-b border-dashed border-gray-400"></div>
<div className="space-y-0.5 text-gray-600">
<div>Name: {user?.name || "Biomedical Engineer"}</div>
<div>Role: {user?.role?.replace(/_/g, " ").toUpperCase() || "BIOMEDICAL"}</div>
<div>Date: {new Date().toLocaleDateString("en-IN")}</div>
</div>
</div>
<div className="border border-gray-300 rounded p-3 space-y-4 bg-gray-50/50">
<div className="font-bold text-gray-800">2. VERIFIED BY</div>
<div className="h-9 border-b border-dashed border-gray-400"></div>
<div className="space-y-0.5 text-gray-600">
<div>Name: __________________________</div>
<div>Role: HOD / Biomedical In-Charge</div>
<div>Date: ____ / ____ / ________</div>
</div>
</div>
<div className="border border-gray-300 rounded p-3 space-y-4 bg-gray-50/50">
<div className="font-bold text-gray-800">3. APPROVED BY</div>
<div className="h-9 border-b border-dashed border-gray-400"></div>
<div className="space-y-0.5 text-gray-600">
<div>Name: __________________________</div>
<div>Role: Medical Superintendent / Director</div>
<div>Date: ____ / ____ / ________</div>
</div>
</div>
</div>
<div className="mt-4 pt-2 border-t border-gray-200 text-[9px] text-gray-500 flex items-center justify-between">
<span>Official Hospital Record &bull; XYZ Hospital &bull; Confidential &bull; Retain for 7 Years</span>
<span>AMS Portal Generated &bull; NABH Compliant</span>
</div>
</div>
</div>
);
}