{{define "resources"}}
<div class="card">
  <div class="section-title">
    <div>
      <h2>资源状态</h2>
      <div class="muted small">统一维护人脸库与通用资源，设备侧只显示当前版本与同步状态。</div>
    </div>
  </div>
  <div class="model-summary">
    <div class="summary-item"><div class="summary-label">人脸库版本</div><div class="summary-value">统一管理</div><div class="summary-hint">由平台集中维护与发布</div></div>
    <div class="summary-item"><div class="summary-label">通用资源</div><div class="summary-value">统一管理</div><div class="summary-hint">标定、字典与业务资源统一维护</div></div>
    <div class="summary-item"><div class="summary-label">设备资源状态</div><div class="summary-value">{{len .Devices}}</div><div class="summary-hint">纳管设备资源版本覆盖</div></div>
    <div class="summary-item"><div class="summary-label">同步方式</div><div class="summary-value">任务下发</div><div class="summary-hint">与设备分配、模型同步一致</div></div>
  </div>
</div>

<div class="card">
  <h2>设备资源状态</h2>
  <div class="table-wrap" style="margin-top:10px">
    <table>
      <thead>
        <tr><th>节点</th><th>状态</th><th>管理地址</th><th>人脸库版本</th><th>资源状态</th></tr>
      </thead>
      <tbody>
        {{range .Devices}}
        <tr>
          <td>
            <a class="mono" href="/ui/devices/{{.DeviceID}}">{{if .DeviceName}}{{.DeviceName}}{{else}}{{.DeviceID}}{{end}}</a>
            <div class="muted small mono">{{.DeviceID}}</div>
          </td>
          <td>{{if .Online}}<span class="pill ok">在线</span>{{else}}<span class="pill bad">离线</span>{{end}}</td>
          <td class="mono">{{.IP}}:{{.AgentPort}}</td>
          <td class="mono">待上报</td>
          <td>{{if .Online}}<span class="pill warn">待同步</span>{{else}}<span class="pill bad">设备离线</span>{{end}}</td>
        </tr>
        {{else}}
        <tr><td colspan="5" class="muted">暂无设备。请先在“设备”页扫描或手动添加。</td></tr>
        {{end}}
      </tbody>
    </table>
  </div>
</div>
{{end}}
