|
|
|
@@ -29,26 +29,27 @@ export function ExportPanel() {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div data-testid="admin-tab-exports" className="p-4 md:p-6 bg-surface border border-slate-800 rounded-3xl space-y-4 md:space-y-6">
|
|
|
|
<div data-testid="admin-tab-exports" className="bg-surface/50 border border-slate-800/50 rounded-[2.5rem] p-4 md:p-6 flex flex-col shadow-2xl transition-all h-full">
|
|
|
|
<header className="flex items-center gap-3">
|
|
|
|
<div className="flex items-center gap-3 mb-4 md:mb-6">
|
|
|
|
<div className="p-3 md:p-4 bg-indigo-500/10 rounded-2xl text-indigo-400 border border-indigo-500/20 shadow-xl shadow-indigo-500/5">
|
|
|
|
<div className="w-10 h-10 rounded-xl bg-indigo-500/10 flex items-center justify-center text-indigo-400 border border-indigo-500/20">
|
|
|
|
<FileDown size={28} className="md:w-8 md:h-8" />
|
|
|
|
<FileDown size={20} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<h2 className="text-xl md:text-2xl font-normal text-white">Export & Reports</h2>
|
|
|
|
<h2 className="text-xl font-normal text-white tracking-tight">Export & Reports</h2>
|
|
|
|
<p className="text-[10px] md:text-xs text-muted font-normal tracking-tight mt-0.5">
|
|
|
|
<p className="text-[10px] md:text-xs text-muted font-normal tracking-tight">Download system snapshots and action logs</p>
|
|
|
|
Download inventory snapshots and audit trails
|
|
|
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</header>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div className="grid md:grid-cols-2 gap-4">
|
|
|
|
<div className="grid md:grid-cols-2 gap-4">
|
|
|
|
{/* Inventory Snapshot Section */}
|
|
|
|
{/* Inventory Snapshot Section */}
|
|
|
|
<div className="p-4 bg-slate-800/40 border border-slate-800 rounded-2xl space-y-4">
|
|
|
|
<div className="p-4 bg-background/40 border border-slate-800/40 rounded-2xl hover:border-primary/20 transition-all group flex flex-col justify-between">
|
|
|
|
<div>
|
|
|
|
<div className="mb-4">
|
|
|
|
<h3 className="text-sm font-normal text-secondary">Inventory Snapshot</h3>
|
|
|
|
<h3 className="text-sm font-normal text-secondary flex items-center gap-2">
|
|
|
|
<p className="text-xs text-muted mt-0.5">
|
|
|
|
<FileSpreadsheet size={14} className="text-primary" />
|
|
|
|
Export current inventory state with all item details
|
|
|
|
Inventory Snapshot
|
|
|
|
|
|
|
|
</h3>
|
|
|
|
|
|
|
|
<p className="text-xs text-muted mt-1 leading-relaxed">
|
|
|
|
|
|
|
|
Export current inventory state with all item details and locations.
|
|
|
|
</p>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
@@ -56,38 +57,31 @@ export function ExportPanel() {
|
|
|
|
<button
|
|
|
|
<button
|
|
|
|
onClick={() => handleExportSnapshot("csv")}
|
|
|
|
onClick={() => handleExportSnapshot("csv")}
|
|
|
|
disabled={isLoading}
|
|
|
|
disabled={isLoading}
|
|
|
|
className="bg-surface border border-slate-800 hover:border-primary/50 hover:bg-slate-800/50 text-white font-normal py-2.5 px-3 rounded-xl transition-all active:scale-[0.98] disabled:opacity-50 disabled:pointer-events-none flex items-center justify-center gap-2 text-xs focus-visible:ring-2 focus-visible:ring-primary focus-visible:outline-none group"
|
|
|
|
className="bg-surface border border-slate-800 hover:text-primary hover:border-primary/30 rounded-xl py-2 px-3 text-xs font-normal text-white transition-all active:scale-[0.98] disabled:opacity-50 flex items-center justify-center gap-2"
|
|
|
|
aria-label="Export inventory snapshot as CSV"
|
|
|
|
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{isLoading ? (
|
|
|
|
{isLoading ? <Loader2 size={12} className="animate-spin" /> : <FileText size={12} />}
|
|
|
|
<Loader2 size={16} className="animate-spin text-primary" />
|
|
|
|
CSV
|
|
|
|
) : (
|
|
|
|
|
|
|
|
<FileText size={16} className="text-blue-400 group-hover:text-blue-300 transition-colors" />
|
|
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
<span>CSV</span>
|
|
|
|
|
|
|
|
</button>
|
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
<button
|
|
|
|
onClick={() => handleExportSnapshot("xlsx")}
|
|
|
|
onClick={() => handleExportSnapshot("xlsx")}
|
|
|
|
disabled={isLoading}
|
|
|
|
disabled={isLoading}
|
|
|
|
className="bg-surface border border-slate-800 hover:border-primary/50 hover:bg-slate-800/50 text-white font-normal py-2.5 px-3 rounded-xl transition-all active:scale-[0.98] disabled:opacity-50 disabled:pointer-events-none flex items-center justify-center gap-2 text-xs focus-visible:ring-2 focus-visible:ring-primary focus-visible:outline-none group"
|
|
|
|
className="bg-surface border border-slate-800 hover:text-emerald-400 hover:border-emerald-500/30 rounded-xl py-2 px-3 text-xs font-normal text-white transition-all active:scale-[0.98] disabled:opacity-50 flex items-center justify-center gap-2"
|
|
|
|
aria-label="Export inventory snapshot as Excel"
|
|
|
|
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{isLoading ? (
|
|
|
|
{isLoading ? <Loader2 size={12} className="animate-spin" /> : <FileSpreadsheet size={12} />}
|
|
|
|
<Loader2 size={16} className="animate-spin text-primary" />
|
|
|
|
Excel
|
|
|
|
) : (
|
|
|
|
|
|
|
|
<FileSpreadsheet size={16} className="text-emerald-400 group-hover:text-emerald-300 transition-colors" />
|
|
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
<span>Excel</span>
|
|
|
|
|
|
|
|
</button>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
{/* Audit Trail Section */}
|
|
|
|
{/* Audit Trail Section */}
|
|
|
|
<div className="p-4 bg-slate-800/40 border border-slate-800 rounded-2xl space-y-4">
|
|
|
|
<div className="p-4 bg-background/40 border border-slate-800/40 rounded-2xl hover:border-primary/20 transition-all group flex flex-col justify-between">
|
|
|
|
<div>
|
|
|
|
<div className="mb-4">
|
|
|
|
<h3 className="text-sm font-normal text-secondary">Audit Trail</h3>
|
|
|
|
<h3 className="text-sm font-normal text-secondary flex items-center gap-2">
|
|
|
|
<p className="text-xs text-muted mt-0.5">
|
|
|
|
<FileText size={14} className="text-indigo-400" />
|
|
|
|
Complete log of system actions and changes
|
|
|
|
Audit Trail
|
|
|
|
|
|
|
|
</h3>
|
|
|
|
|
|
|
|
<p className="text-xs text-muted mt-1 leading-relaxed">
|
|
|
|
|
|
|
|
Complete history of system actions, changes, and user operations.
|
|
|
|
</p>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
@@ -95,37 +89,27 @@ export function ExportPanel() {
|
|
|
|
<button
|
|
|
|
<button
|
|
|
|
onClick={() => handleExportAuditTrail("csv")}
|
|
|
|
onClick={() => handleExportAuditTrail("csv")}
|
|
|
|
disabled={isLoading}
|
|
|
|
disabled={isLoading}
|
|
|
|
className="bg-surface border border-slate-800 hover:border-primary/50 hover:bg-slate-800/50 text-white font-normal py-2.5 px-3 rounded-xl transition-all active:scale-[0.98] disabled:opacity-50 disabled:pointer-events-none flex items-center justify-center gap-2 text-xs focus-visible:ring-2 focus-visible:ring-primary focus-visible:outline-none group"
|
|
|
|
className="bg-surface border border-slate-800 hover:text-primary hover:border-primary/30 rounded-xl py-2 px-3 text-xs font-normal text-white transition-all active:scale-[0.98] disabled:opacity-50 flex items-center justify-center gap-2"
|
|
|
|
aria-label="Export audit trail as CSV"
|
|
|
|
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{isLoading ? (
|
|
|
|
{isLoading ? <Loader2 size={12} className="animate-spin" /> : <FileText size={12} />}
|
|
|
|
<Loader2 size={16} className="animate-spin text-primary" />
|
|
|
|
CSV
|
|
|
|
) : (
|
|
|
|
|
|
|
|
<FileText size={16} className="text-blue-400 group-hover:text-blue-300 transition-colors" />
|
|
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
<span>CSV</span>
|
|
|
|
|
|
|
|
</button>
|
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
<button
|
|
|
|
onClick={() => handleExportAuditTrail("xlsx")}
|
|
|
|
onClick={() => handleExportAuditTrail("xlsx")}
|
|
|
|
disabled={isLoading}
|
|
|
|
disabled={isLoading}
|
|
|
|
className="bg-surface border border-slate-800 hover:border-primary/50 hover:bg-slate-800/50 text-white font-normal py-2.5 px-3 rounded-xl transition-all active:scale-[0.98] disabled:opacity-50 disabled:pointer-events-none flex items-center justify-center gap-2 text-xs focus-visible:ring-2 focus-visible:ring-primary focus-visible:outline-none group"
|
|
|
|
className="bg-surface border border-slate-800 hover:text-emerald-400 hover:border-emerald-500/30 rounded-xl py-2 px-3 text-xs font-normal text-white transition-all active:scale-[0.98] disabled:opacity-50 flex items-center justify-center gap-2"
|
|
|
|
aria-label="Export audit trail as Excel"
|
|
|
|
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{isLoading ? (
|
|
|
|
{isLoading ? <Loader2 size={12} className="animate-spin" /> : <FileSpreadsheet size={12} />}
|
|
|
|
<Loader2 size={16} className="animate-spin text-primary" />
|
|
|
|
Excel
|
|
|
|
) : (
|
|
|
|
|
|
|
|
<FileSpreadsheet size={16} className="text-emerald-400 group-hover:text-emerald-300 transition-colors" />
|
|
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
<span>Excel</span>
|
|
|
|
|
|
|
|
</button>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
{error && (
|
|
|
|
{error && (
|
|
|
|
<div className="p-3 bg-rose-500/10 border border-rose-500/20 rounded-xl text-rose-500 text-[10px] flex items-center gap-2 animate-in fade-in zoom-in duration-300">
|
|
|
|
<div className="mt-4 p-3 bg-rose-500/10 border border-rose-500/20 rounded-xl text-rose-500 text-[10px] flex items-center gap-2 animate-in slide-in-from-top-2 duration-300">
|
|
|
|
<div className="w-1.5 h-1.5 bg-rose-500 rounded-full animate-pulse" />
|
|
|
|
<div className="w-1.5 h-1.5 bg-rose-500 rounded-full animate-pulse" />
|
|
|
|
<span className="font-normal">Error: {error}</span>
|
|
|
|
<span className="font-normal truncate">Error: {error}</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|