{{define "recognition"}}
<div class="card">
  <div class="section-title">
    <div>
      <h2>识别配置</h2>
      <div class="muted small">管理识别方案、视频通道、模板参数和推理配置。</div>
    </div>
    <a class="btn ghost" href="/ui/templates">模板库</a>
  </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">配置 RTSP、模型路径和输出</div></div>
    <div class="summary-item"><div class="summary-label">模板参数</div><div class="summary-value">{{len .Templates}}</div><div class="summary-hint">来自本地模板目录</div></div>
    <div class="summary-item"><div class="summary-label">预览变更</div><div class="summary-value">Plan</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></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>
            <div class="actions">
              <a class="btn ghost" href="/ui/devices/{{.DeviceID}}/config-friendly">编辑视频通道</a>
              <a class="btn ghost" href="/ui/devices/{{.DeviceID}}/config-ui">高级 JSON</a>
            </div>
          </td>
        </tr>
        {{else}}
        <tr><td colspan="4" class="muted">暂无设备。请先在“新增设备”页扫描或手动添加。</td></tr>
        {{end}}
      </tbody>
    </table>
  </div>
</div>
{{end}}
