{% extends "admin/base.html" %}

{% block content %}

<!-- Page Heading -->
<div class="d-sm-flex align-items-center justify-content-between mb-4">
    <h1 class="h3 mb-0 text-gray-800">{{_("Dashboard",2)}}</h1>
</div>

<!-- Content Row -->
<div class="row">

    <!-- Earnings (Monthly) Card Example -->
    <div class="col-xl-3 col-md-6 mb-4">
        <div class="card border-left-primary shadow h-100 py-2">
            <div class="card-body">
                <div class="row no-gutters align-items-center">
                    <div class="col mr-2">
                        <div class="text-xs font-weight-bold text-primary text-uppercase mb-1">{{_("Total Users",2)}}</div>
                        <div class="h5 mb-0 font-weight-bold ">{{ users_count }}</div>
                    </div>
                    <div class="col-auto">
                        <i class="fas fa-users fa-2x text-gray-300"></i>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Earnings (Monthly) Card Example -->
    <div class="col-xl-3 col-md-6 mb-4">
        <div class="card border-left-success shadow h-100 py-2">
            <div class="card-body">
                <div class="row no-gutters align-items-center">
                    <div class="col mr-2">
                        <div class="text-xs font-weight-bold text-success text-uppercase mb-1">{{_("Total Private Chats",2)}}</div>
                        <div class="h5 mb-0 font-weight-bold ">{{ private_chats_count }}</div>
                    </div>
                    <div class="col-auto">
                        <i class="fas fa-comment-dots fa-2x text-gray-300"></i>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Earnings (Monthly) Card Example -->
    <div class="col-xl-3 col-md-6 mb-4">
        <div class="card border-left-info shadow h-100 py-2">
            <div class="card-body">
                <div class="row no-gutters align-items-center">
                    <div class="col mr-2">
                        <div class="text-xs font-weight-bold text-info text-uppercase mb-1">{{_("Total Group Chats",2)}}</div>
                        <div class="row no-gutters align-items-center">
                            <div class="col-auto">
                                <div class="h5 mb-0 mr-3 font-weight-bold ">{{ group_chats_count }}</div>
                            </div>

                        </div>
                    </div>
                    <div class="col-auto">
                        <i class="fas fa-comments fa-2x text-gray-300"></i>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Pending Requests Card Example -->
    <div class="col-xl-3 col-md-6 mb-4">
        <div class="card border-left-warning shadow h-100 py-2">
            <div class="card-body">
                <div class="row no-gutters align-items-center">
                    <div class="col mr-2">
                        <div class="text-xs font-weight-bold text-warning text-uppercase mb-1">{{_("Total Chat Rooms",2)}}</div>
                        <div class="h5 mb-0 font-weight-bold ">{{ chatroom_count }}</div>
                    </div>
                    <div class="col-auto">
                        <i class="fas fa-person-booth fa-2x text-gray-300"></i>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<!-- Content Row -->
<div class="row mt-3 mb-4">

    <!-- Content Column -->
    <div class="col-lg-6 col-lg-6">
        <!-- Color System -->
        <div class="row">
            <div class="col-lg-6">
                <div class="card text-white shadow mb-3">
                    <div class="card-body">
                        {{_("Create Chat Room",2)}}
                        <div class="text-white-50 small">&nbsp;</div>
                        <a href="{{ url('dashboard-chatroom-edit') }}" class="btn btn-sm btn-success btn-icon-split">
                            <span class="icon text-white-50">
                              <i class="fas fa-flag"></i>
                            </span>
                            <span class="text">{{_("Create Chat Room",2)}}</span>
                        </a>
                    </div>
                </div>
            </div>
            <div class="col-lg-6 ">
                <div class="card text-white shadow mb-3">
                    <div class="card-body">
                        {{_("Add New User",2)}}
                        <div class="text-white-50 small">&nbsp;</div>
                        <a href="{{  url('dashboard-user-add') }}" class="btn btn-sm btn-primary btn-icon-split">
                            <span class="icon text-white-50">
                              <i class="fas fa-user"></i>
                            </span>
                            <span class="text">{{_("Add New User",2)}}</span>
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="col-lg-6 d-none d-lg-block">
        <div class="card text-white shadow mb-3">
            <div id="clock" class="dark">
    			<div class="display">
    				<div class="weekdays"></div>
    				<div class="ampm"></div>
    				<div class="alarm"></div>
    				<div class="digits"></div>
    			</div>
    		</div>
        </div>
    </div>

</div>


<div class="row">
    <div class="col-md-6">
        <div class="card shadow mb-4">
            <div class="card-header py-3">
                <h6 class="m-0 font-weight-bold text-primary">{{_("Latest Members",2)}}</h6>
            </div>
            <div class="card-body table-responsive">
                <table class="table table-bordered">
                    <thead>
                        <tr>
                            <th>{{_("Name",2)}}</th>
                            <th>{{_("Email",2)}}</th>
                            <th width="20%"></th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for latest_user in latest_users %}
                            <tr>
                                <td>{{ latest_user.first_name }} {{ latest_user.last_name }}</td>
                                <td>{{ latest_user.email }}</td>
                                <td><a class="btn btn-xs btn-success" href="{{  url('dashboard-user-view') }}?user={{latest_user.id}}"><i class="fas fa-eye"></i> {{_("View",2)}}</a></td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
          </div>
    </div>

    <div class="col-md-6">
        <div class="card shadow mb-4">
            <div class="card-header py-3">
                <h6 class="m-0 font-weight-bold text-primary">{{_("Latest Chat Rooms",2)}}</h6>
            </div>
            <div class="card-body table-responsive">
                <table class="table table-bordered">
                    <thead>
                        <tr>
                            <th>{{_("Name",2)}}</th>
                            <th>{{_("Joiners",2)}}</th>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for latest_room in latest_rooms %}
                            <tr>
                                <td>{{ latest_room.name }}</td>
                                <td>{{ latest_room.users_count }}</td>
                                <td class="nowrap">
                                    <a target="_blank" class="btn btn-xs btn-success" href="{{  url('chat-room', {'chatroomslug':latest_room.slug}) }}"><i class="fas fa-eye"></i></a>
                                    <a href="{{  url('dashboard-chatroom-edit') }}?edit_room={{latest_room.id}}"  data-toggle="tooltip" data-placement="top" title='{{_("Edit Chat Room",2)}}' class="edit-chatroom btn btn-info btn-xs" data-edit-id="{{ latest_room.id }}" >
                                        <i class="fas fa-edit"></i>
                                    </a>
                                    <a href="{{  url('dashboard-chatroom-users') }}?room={{latest_room.id}}"  data-toggle="tooltip" data-placement="top" title='{{_("Room Users",2)}}' class="edit-chatroom btn btn-success btn-xs" data-edit-id="{{ latest_room.id }}" >
                                        <i class="fas fa-users"></i>
                                    </a>
                                    <a href="javascript:void(0)" class="btn btn-warning btn-xs delete-chats" id="{{latest_room.id}}" title='{{_("Delete all Chats",2)}}' ><i class="fas fa-trash-restore"></i></a>
                                    {% if ((SETTINGS['single_room_mode'] != 1) or ((SETTINGS['single_room_mode'] == 1) and (SETTINGS['default_room_slug'] != latest_room.slug)))  %}
                                    <a href="javascript:void(0)" class="btn btn-danger btn-xs delete-chatroom" id="{{latest_room.id}}"><i class="fas fa-trash"></i></a>
                                    {% endif %}
                                </td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
          </div>
    </div>

</div>

{% endblock %}
