<!DOCTYPE html>
<html lang="en" class="h-full">

<head>
  <meta charset="UTF-8">
  <title>好友列表</title>

  <link href="assets/css/daisyui-4.4.14-full.min.css" rel="stylesheet" type="text/css"/>
  <link href="assets/css/index.css" rel="stylesheet" type="text/css"/>

  <script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio,line-clamp"></script>
  <script src="https://cdn.bootcdn.net/ajax/libs/axios/1.5.0/axios.min.js"></script>

  <script src="assets/js/index.js"></script>
</head>

<body class="h-full">
<div class="min-h-full">
  {{ template "head.html" "friend" }}

  <main class="-mt-32">
    <div class="mx-auto max-w-7xl px-4 pb-12 sm:px-6 lg:px-8">
      <div class="rounded-lg bg-white px-5 py-6 shadow sm:px-6 text-2xl">
        <ul role="list" class="grid grid-cols-1 gap-x-6 gap-y-8 lg:grid-cols-3 xl:gap-x-8">
          {{ range .friends }}
          <li class="overflow-hidden rounded-xl border border-gray-200">
            <div class="flex items-center gap-x-4 border-b border-gray-900/5 bg-gray-50 p-6">
              <img src="assets/img/status-{{ if eq .IsOk true }}ok{{else}}fail{{end}}.png" alt="Tuple" class="h-12 w-12 flex-none rounded-lg bg-white object-cover ring-1 ring-gray-900/10">
              <div class="flex-1">
                <div class="text-sm font-medium leading-6 text-gray-900">{{ .Nickname }}</div>
                {{ template "flagTag" .IsOk }}
              </div>
            </div>
            <dl class="-my-3 divide-y divide-gray-100 px-6 py-4 text-sm leading-6">
              <div class="flex justify-between gap-x-4 py-3">
                <dt class="text-gray-500">原始微信Id<br/>微信号</dt>
                <dd>
                  <div class="text-gray-700">{{ .Wxid }}</div>
                  {{ if not (eq .CustomAccount "") }}
                  <div class="truncate text-gray-500">{{ .CustomAccount }}</div>
                  {{end}}
                </dd>
              </div>
              <div class="flex justify-between gap-x-4 py-3">
                <dt class="text-gray-500">最后活跃时间</dt>
                <dd class="flex items-start gap-x-2">
                  <div class="font-medium text-gray-900">
                    {{ if eq .LastActive.IsNil true }}
                    无数据
                    {{ else }}
                    <time datetime="{{ .LastActive }}">{{ .LastActive }}</time>
                    {{ end }}
                  </div>
                </dd>
              </div>

              <div class="flex justify-between gap-x-4 py-3">
                <dt class="text-gray-500">AI</dt>
                <dd class="flex items-start gap-x-2">
                  {{ template "ai" . }}
                </dd>
              </div>
              {{ if eq .EnableAi true }}
              <div class="flex justify-between gap-x-4 py-3">
                <dt class="text-gray-500 mt-2">AI模型</dt>
                <dd class="flex items-start gap-x-2">
                  <label>
                    <select class="block w-full rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-green-600 sm:text-sm sm:leading-6" onchange="aiModelChange(event, {{.Wxid}})">
                      {{$useModel := .AiModel}}
                      {{ range $.aiModels }}
                      <option value="{{.Model}}" {{ if eq $useModel .Model}}selected{{ end }}>
                        {{.Name}}
                      </option>
                      {{ end }}
                    </select>
                  </label>
                </dd>
              </div>
              {{ end }}

              <div class="flex justify-between gap-x-4 py-3">
                <dt class="text-gray-500">早报</dt>
                <dd class="flex items-start gap-x-2">
                  {{ template "news" . }}
                </dd>
              </div>

              <div class="flex justify-between gap-x-4 py-3">
                <dt class="text-gray-500">指令</dt>
                <dd class="flex items-start gap-x-2">
                  {{ template "command" . }}
                </dd>
              </div>

            </dl>
          </li>
          {{ end }}
        </ul>

      </div>
    </div>
  </main>

  {{ template "footer.html" }}
</div>
</body>

</html>