{{define "title"}}Friends of {{.User.Username}}{{end}}
{{define "content"}}
<div class="container">
    {{$Root := .}}
    <section class="hero is-link is-bold">
        <div class="hero-body">
            <div class="container">
                <h1 class="title">
                    <i class="fa fa-user-group mr-2"></i>
                    Friends of {{.User.Username}}
                </h1>
            </div>
        </div>
    </section>

    <div class="block p-4">
        <div class="tabs is-boxed mb-0">
            <ul>
                <li>
                    <a href="/u/{{.User.Username}}">
                        <span class="icon is-small">
                            <i class="fa fa-user"></i>
                        </span>
                        <span>Profile</span>
                    </a>
                </li>
                <li>
                    <a href="/photo/u/{{.User.Username}}">
                        <span class="icon is-small">
                            <i class="fa fa-image"></i>
                        </span>
                        <span>
                            Photos
                            {{if .PhotoCount}}<span class="tag is-link is-light ml-1">{{.PhotoCount}}</span>{{end}}
                        </span>
                    </a>
                </li>
                <li>
                    <a href="/notes/u/{{.User.Username}}">
                        <span class="icon is-small">
                            <i class="fa fa-pen-to-square"></i>
                        </span>
                        <span>
                            Notes
                            {{if .NoteCount}}<span class="tag is-link is-light ml-1">{{.NoteCount}}</span>{{end}}
                        </span>
                    </a>
                </li>
                <li class="is-active">
                    <a href="/friends/u/{{.User.Username}}">
                        <span class="icon is-small">
                            <i class="fa fa-user-group"></i>
                        </span>
                        <span>
                            Friends
                            {{if .FriendCount}}<span class="tag is-link is-light ml-1">{{.FriendCount}}</span>{{end}}
                        </span>
                    </a>
                </li>
            </ul>
        </div>
    </div>

    <div class="p-4">

        <div class="block">
            Found {{.Pager.Total}} friend{{Pluralize64 .Pager.Total}}
            (page {{.Pager.Page}} of {{.Pager.Pages}}).
        </div>

        <div class="block">
            {{SimplePager .Pager}}
        </div>

        <div class="columns is-multiline">

            {{range .Friends}}
            <div class="column is-half-tablet is-one-third-desktop">

                <form action="/friends/add" method="POST">
                    {{InputCSRF}}
                    <input type="hidden" name="username" value="{{.Username}}">

                    <div class="card">
                        <div class="card-content">
                            <div class="media block">
                                <div class="media-left">
                                    {{template "avatar-64x64" .}}

                                    <!-- Friendship badge -->
                                    {{if $Root.FriendMap.Get .ID}}
                                    <div class="has-text-centered">
                                        <span class="is-size-7 has-text-warning-dark">
                                            <i class="fa fa-user-group" title="Friends"></i>
                                            Friends
                                        </span>
                                    </div>
                                    {{end}}
                                </div>
                                <div class="media-content">
                                    <p class="title is-4">
                                        <a href="/u/{{.Username}}" class="has-text-dark">
                                            {{if ne .Status "active"}}
                                                <del>{{.NameOrUsername}}</del>
                                            {{else}}
                                                {{.NameOrUsername}}
                                            {{end}}
                                            {{if and $Root.CurrentUser.IsInnerCircle .InnerCircle}}
                                                <img src="/static/img/circle-16.png">
                                            {{end}}
                                        </a>
                                        {{if eq .Visibility "private"}}
                                            <sup class="fa fa-mask is-size-7" title="Private Profile"></sup>
                                        {{end}}
                                    </p>
                                    <p class="subtitle is-6 mb-2">
                                        <span class="icon"><i class="fa fa-user"></i></span>
                                        <a href="/u/{{.Username}}">{{.Username}}</a>
                                    </p>
                                    {{if .GetProfileField "city"}}
                                    <p class="subtitle is-6 mb-2">
                                        {{.GetProfileField "city"}}
                                    </p>
                                    {{end}}
                                    <p class="subtitle is-7 mb-2">
                                        {{if or (ne .GetDisplayAge "n/a")}}
                                        <span class="mr-2">{{.GetDisplayAge}}</span>
                                        {{end}}

                                        {{if .GetProfileField "gender"}}
                                        <span class="mr-2">{{.GetProfileField "gender"}}</span>
                                        {{end}}

                                        {{if .GetProfileField "pronouns"}}
                                        <span class="mr-2">{{.GetProfileField "pronouns"}}</span>
                                        {{end}}

                                        {{if .GetProfileField "orientation"}}
                                        <span class="mr-2">{{.GetProfileField "orientation"}}</span>
                                        {{end}}
                                    </p>
                                </div>
                            </div><!-- media-block -->
                        </div>
                    </div>

                </form>

            </div>
            {{end}}<!-- range .Friends -->
        </div>

        <div class="block">
            {{SimplePager .Pager}}
        </div>

    </div>
</div>
{{end}}
