<!--
  We need to show command logs, chat logs, trade logs and name changes
-->
<div class="row">
  <div class="col-md-4">
    <div class="panel panel-flat">
      <div class="panel-heading">
        <h6 class="panel-title">Latest Commands</h6>
        <div class="heading-elements">
          @define $count = 0
          @foreach (AppDatabasePlusChatlog::where('user_id', $result->id)->orderBy('id', 'DESC')->get() as $chat)
            @define $res = substr($chat->message, 0, 1)
            @if ($res == ':')
              @define $count = $count + 1
            @endif
          @endforeach
          <span class="badge badge-success heading-text">{{ number_format($count, 0) }}</span>
        </div>
      </div>
      <ul class="media-list media-list-linked pb-5">
        @define $initial = 0
        @foreach (AppDatabasePlusChatlog::where('user_id', $result->id)->orderBy('id', 'DESC')->get() as $chat)
          @define $res = substr($chat->message, 0, 1)
          @if ($res == ':')
            @define $initial = $initial + 1
            @if ($initial <= 25)
              <li class="media">
                <a href="#" class="media-link">
                  <div class="media-left"><img src="https://www.habbo.com/habbo-imaging/avatarimage?figure={{ $result->look }}&headonly=1" class="img-circle" alt=""></div>
                  <div class="media-body">
                    @define $cut = substr($chat->message, 0, 25)
                    <span class="media-heading text-semibold">{{ $cut }}</span>
                    <span class="media-annotation"><b>Room:</b> {{ AppDatabasePlusRooms::where('id', $chat->room_id)->value('caption') }}</span>
                  </div>
                  </a>
                </li>
              @endif
            @endif
          @endforeach
        </ul>
      </div>
    </div>
    <div class="col-md-4">
      <div class="panel panel-flat">
        <div class="panel-heading">
          <h6 class="panel-title">Latest Messages</h6>
          <div class="heading-elements">
            @define $count = 0
            @foreach (AppDatabasePlusChatlog::where('user_id', $result->id)->orderBy('id', 'DESC')->get() as $chat)
              @define $res = substr($chat->message, 0, 1)
              @if ($res != ':')
                @define $count = $count + 1
              @endif
            @endforeach
            <span class="badge badge-success heading-text">{{ number_format($count, 0) }}</span>
          </div>
        </div>
        <ul class="media-list media-list-linked pb-5">
          @define $initial = 0
          @foreach (AppDatabasePlusChatlog::where('user_id', $result->id)->orderBy('id', 'DESC')->get() as $chat)
            @define $res = substr($chat->message, 0, 1)
            @if ($res != ':')
              @define $initial = $initial + 1
              @if ($initial <= 25)
                <li class="media">
                  <a href="#" class="media-link">
                    <div class="media-left"><img src="https://www.habbo.com/habbo-imaging/avatarimage?figure={{ $result->look }}&headonly=1" class="img-circle" alt=""></div>
                    <div class="media-body">
                      @define $cut = substr($chat->message, 0, 25)
                      <span class="media-heading text-semibold">{{ $cut }}</span>
                      <span class="media-annotation"><b>Room:</b> {{ AppDatabasePlusRooms::where('id', $chat->room_id)->value('caption') }}</span>
                    </div>
                    </a>
                  </li>
                @endif
              @endif
            @endforeach
          </ul>
        </div>
      </div>
      <div class="col-md-4">
        <div class="panel panel-flat">
          <div class="panel-heading">
            <h6 class="panel-title">Latest Trades</h6>
            <div class="heading-elements">
              @define $count = 0
              @foreach (AppDatabasePlusTradelog::where('1id', $result->id)->orderBy('id', 'DESC')->get() as $trade)
                @define $count = $count + 1
              @endforeach
              <span class="badge badge-success heading-text">{{ number_format($count, 0) }}</span>
            </div>
          </div>
          <ul class="media-list media-list-linked pb-5">
            @define $initial = 0
            @foreach (AppDatabasePlusTradelog::where('1id', $result->id)->orderBy('id', 'DESC')->get() as $trade)
              @define $initial = $initial + 1
              @if ($initial <= 25)
                <li class="media">
                  <a href="#" class="media-link">
                    <div class="media-left"><img src="https://www.habbo.com/habbo-imaging/avatarimage?figure={{ $result->look }}&headonly=1" class="img-circle" alt=""></div>
                    <div class="media-body">
                    @define $partner = $trade["2id"]
                    <span class="media-heading text-semibold">Initiated trade with <b>{{ AppDatabasePlusUsers::where('id', $partner)->value('username') }}</b></span>
                    <span class="media-annotation"><b>God this is fucking dumb</span>
                  </div>
                </a>
              </li>
            @endif
          @endforeach
        </ul>
      </div>
    </div>
  </div>