'use client'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Badge } from '@/components/ui/badge'; import { Label } from '@/components/ui/label'; import { Monitor, Info, Network, HardDrive, Shield, Wifi, XCircle } from 'lucide-react'; import { format } from 'date-fns'; import { DattoRMMDevice } from '@/lib/types/datto-rmm'; import { lookupDeviceBySerial, formatDeviceInfo } from '@/lib/utils/device-lookup'; interface RMMTabProps { device?: DattoRMMDevice; } export function RMMTab({ device }: RMMTabProps) { if (!device) { return (

No RMM data available for this device

); } return ( RMM Device Information
{/* Basic Information */}

Basic Information

{device.hostname}

{device.description || '-'}

{device.serialNumber || '-'}

{device.deviceType?.type || '-'}

{device.online ? ( Online ) : ( Offline )} {device.rebootRequired && ( Reboot Required )}
{/* Network Information */}

Network Information

{device.intIpAddress || '-'}

{device.extIpAddress || '-'}

{device.macAddresses && device.macAddresses.length > 0 ? ( device.macAddresses.map((mac, i) => (
{mac}
)) ) : ( '-' )}

{device.domain || '-'}

{device.lastSeen ? format(new Date(device.lastSeen), 'MMM d, yyyy h:mm a') : '-'}

{device.lastLoggedInUser || '-'}

{/* System Information */}

System Information

{device.operatingSystem || '-'}

{device.a64Bit !== undefined && ( {device.a64Bit ? '64-bit' : '32-bit'} )}

{device.deviceType?.category || '-'}

{(() => { if (device.manufacturer) return device.manufacturer; const deviceInfo = lookupDeviceBySerial(device.serialNumber); return deviceInfo?.manufacturer || '-'; })()}

{(() => { if (device.model) return device.model; const deviceInfo = lookupDeviceBySerial(device.serialNumber); return deviceInfo?.estimatedModel || deviceInfo?.modelFamily || '-'; })()}

{!device.model && device.serialNumber && (

Estimated from serial: {device.serialNumber}

)}

{device.cpuName || '-'} {device.cpuCores ? `(${device.cpuCores} cores)` : ''}

{device.memory ? `${(device.memory / 1024).toFixed(2)} GB` : '-'}

{device.diskSize ? `${(device.diskSize / (1024 * 1024 * 1024)).toFixed(2)} GB` : '-'}

{device.displayVersion || device.cagVersion || '-'}

{device.lastReboot ? format(new Date(device.lastReboot), 'MMM d, yyyy h:mm a') : '-'}

{device.creationDate ? format(new Date(device.creationDate), 'MMM d, yyyy') : '-'}

{device.warrantyDate && (

{format(new Date(device.warrantyDate), 'MMM d, yyyy')}

)}
{/* Security Information */}

Security Information

{device.antivirus?.antivirusProduct || 'Not detected'}

{device.antivirus?.antivirusStatus && ( {device.antivirus.antivirusStatus.replace(/([A-Z])/g, ' $1').trim()} )}
{device.patchManagement?.patchStatus && ( {device.patchManagement.patchStatus.replace(/([A-Z])/g, ' $1').trim()} )}

Pending

{device.patchManagement?.patchesApprovedPending || 0}

Installed

{device.patchManagement?.patchesInstalled || 0}

Not Approved

{device.patchManagement?.patchesNotApproved || 0}

); }