{{define "theme-daynight/service"}}

<!DOCTYPE html>
<html lang="{{.Conf.Language}}">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>{{.Title}}</title>
    <link rel="shortcut icon" type="image/png" href="/static/logo.svg?v20210804" />
    <link rel="stylesheet" href="/static/theme-daynight/css/service.css?v202108042286" />
    <link rel="stylesheet" href="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-y/mdui/1.0.2/css/mdui.min.css"/>
    <link href="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-y/font-awesome/6.0.0/css/all.min.css" rel="stylesheet" />
    <script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-y/jquery/3.6.0/jquery.min.js"></script>

    {{if ts .CustomCode}}
    {{.CustomCode|safe}}
    {{end}}
  </head>

  <body data-theme="light" data-gridlist="list">
    <article>
      <header>
        <section class="nav-bar clearfix">
          <figure class="logo">
            <a href="/">
              <svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="0 0 88 88">
                <g>
                  <path fill="#1d71b8" d="M81.46,20.89l-.26.26-9.71,9.71h0l-9.41,9.4-9.56,9.56,0,0L43,59.36l0,0,0,0-9.58-9.58-9.46-9.47-9.77,9.77L3.36,61A43.92,43.92,0,0,1,0,45.2v0L14.35,30.81l6-6,3.52-3.52,9.57,9.58L43,40.29l0,0,9.55-9.55L63,20.22a30.47,30.47,0,0,0-26.69-5.69L25.75,4A44,44,0,0,1,72.64,10.6,44.36,44.36,0,0,1,81.46,20.89Z" />
                  <path fill="#36a9e1" d="M88,44A44,44,0,0,1,10.58,72.66L20.21,63a30.45,30.45,0,0,0,54.06-15.6L87,34.68A44.15,44.15,0,0,1,88,44Z" />
                </g>
              </svg>
            </a>
            <a href="/">{{.Conf.Site.Brand}}</a>
          </figure>
            <div class="icon-container">
              <div class="row cf">
                <div class="three col">
                  <div class="hamburger" id="hamburger-icon"><span class="line"></span><span class="line"></span><span class="line"></span></div>
                </div>
              </div>
            </div>
            <nav class="nav-menu">
              <ul>
                <li><a href="/">{{tr "Home"}}</a></li>
                <li><a href="/service">{{tr "Services"}}</a></li>
                <li><a href="/network">{{tr "NetworkSpiter"}}</a></li>
                {{if .Admin}}
                <li><a href="/server">{{tr "AdminPanel"}}</a></li>
                {{else}}
                <li><a href="/login">{{tr "Login"}}</a></li>
                {{end}}
              </ul>
            </nav>
        </section>
      </header>

      <main>
        <section class="monitor-header">
          <h2>{{tr "Status"}}</h2>
          <h4>{{tr "30DaysOnline"}}</h4>
        </section>
        <section class="monitor-container">
          {{range $service := .Services}}
          <section class="monitor-info-container">
            <div class="monitor-state">
              <span class="monitor-state-dot {{className (divU64 $service.CurrentUp (addU64 $service.CurrentUp $service.CurrentDown))}}"></span>
              <span class="monitor-state-text">{{statusName (divU64 $service.CurrentUp (addU64 $service.CurrentUp $service.CurrentDown))}}</span>
            </div>
            <div class="monitor-name">{{$service.Monitor.Name}}</div>
            <div class="monitor-uptime">{{$service.TotalUptime|float32f}}%</div>

            <div class="corner-container">
              {{range $i,$d := $service.Delay}}
              <div class="corner {{className (div (index $service.Up $i) (add (index $service.Up $i) (index $service.Down $i)))}}" aria-expanded="false">
                <ul class="sub-content">
                  <li>{{dayBefore $i}}</li>
                  <li>{{float32f (div (index $service.Up $i) (add (index $service.Up $i) (index $service.Down $i)))}}%</li>
                  <li>{{float32f $d}}ms</li>
                </ul>
              </div>
              {{end}}
            </div>
          </section>
            {{end}}
        </section>
        {{if .CycleTransferStats}}
    <h2 class="mdui-m-t-5 mdui-text-center">{{tr "CycleTransferStats"}}</h2>
    <div class="mdui-table-fluid">
      <table class="mdui-table mdui-table-hoverable">
        <thead>
          <tr>
            <th class="mdui-text-center">ID</th>
            <th class="mdui-text-center">{{tr "Rules"}}</th>
            <th class="mdui-text-center">{{tr "Server"}}</th>
            <th class="mdui-text-center">{{tr "From"}}</th>
            <th class="mdui-text-center">{{tr "To"}}</th>
            <th class="mdui-text-center">MAX</th>
            <th class="mdui-text-center">MIN</th>
            <th class="mdui-text-center">{{tr "NextCheck"}}</th>
            <th class="mdui-text-center">{{tr "CurrentUsage"}}</th>
            <th class='mdui-text-center' style='padding: 0px 31px 0px 31px;'>{{tr "Transleft"}}</th>
          </tr>
        </thead>
        <tbody>
          {{range $id, $stats := .CycleTransferStats}}
          {{range $innerId, $transfer := $stats.Transfer}}
          {{$TransLeftPercent := TransLeftPercent (UintToFloat $transfer) (UintToFloat $stats.Max)}}
          <tr>
            <td class="mdui-text-center">{{$id}}</td>
            <td class="mdui-text-center">{{$stats.Name}}</td>
            <td class="mdui-text-center">{{index $stats.ServerName $innerId}}</td>
            <td class="mdui-text-center">{{$stats.From|tf}}</td>
            <td class="mdui-text-center">{{$stats.To|tf}}</td>
            <td class="mdui-text-center">{{$stats.Max|bf}}</td>
            <td class="mdui-text-center">{{$stats.Min|bf}}</td>
            <td class="mdui-text-center">{{(index $stats.NextUpdate $innerId)|sft}}</td>
            <td class="mdui-text-center">{{$transfer|bf}}</td>
            <td class="mdui-text-center">{{TransLeft $stats.Max $transfer}} / {{$TransLeftPercent}} %</td>
          </tr>
          {{end}}
          {{end}}
        </tbody>
      </table>
    </div>
    {{end}}
      </main>
      
      <div class="sidebar-container">
        <ul>
          <li><i class="fas fa-sun" title='{{tr "LightMode"}}'></i><span>{{tr "LightMode"}}</span></li>
          <li><i class="fas fa-moon" title='{{tr "DarkMode"}}'></i><span>{{tr "DarkMode"}}</span></li>
          <li><i class="fas fa-th" title='{{tr "GridLayout"}}'></i><span>{{tr "GridLayout"}}</span></li>
          <li><i class="fas fa-list-ul" title='{{tr "ListLayout"}}'></i><span>{{tr "ListLayout"}}</span></li>
        </ul>
      </div>

      <section class="service-mobile-toggle">
        <ul>
          <li><i class="fas fa-plus"></i></li>
          <li>
            <label class="switcher">
              <input type="checkbox" name="service-theme" id="dark-light" />
              <div>
                <i class="fas fa-adjust"></i>
              </div>
            </label>
          </li>
          <li>
            <label class="switcher">
              <input type="checkbox" name="service-grid" id="grid-list" checked/>
              <div>
                <i class="fas fa-grip-horizontal"></i>
              </div>
            </label>
          </li>
        </ul>
      </section>

      <footer>
        <div class="footer-container">
          <div>
            <a href="https://github.com/naiba/nezha" target="_blank">Powered by {{tr "NezhaMonitoring"}} · {{.Version}}</a>
            <p>
              &copy;
              <span id="copyright-date"
                ><script>
                  document.getElementById("copyright-date").appendChild(document.createTextNode(new Date().getFullYear()));
                </script></span
              >
              · <a href="https://blog.jackiesung.com" target="_blank">Theme designed by Jackie Sung</a>
            </p>
          </div>
        </div>
      </footer>
      
      <!-- Back to top button -->
      <a id="back-to-top"></a>
    </article>

    <script src="/static/theme-daynight/js/service.js?v202102012266"></script>

  </body>
</html>
{{end}}
