{% extends 'base.html' %}
{%block title %} bigsansar - dashboard {% endblock %}

{% block head %}
{% load static %}
<link rel="stylesheet" href="{% static 'style.css' %}">
{% endblock %}

{% block body %}
{% include 'admin/nav.html' %}

<div class="container">
    <div class="main-body">

        {% if messages %}
        {% for message in messages %}
        {% if message.tags %}
        <div class="alert alert-{{ message.tags }} alert-dismissible fade show" role="alert">
            {{ message }}
            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
            </button>
        </div>
        {% endif %}
        {% endfor %}
        {% endif %}
        <!-- Breadcrumb -->

        

        <!-- /Breadcrumb -->

        <div class="row gutters-sm">
            <div class="col-md-4 mb-3">
                <div class="card">
                    <div class="card-body">
                        <div class="d-flex flex-column align-items-center text-center">
                            <img src="https://bootdey.com/img/Content/avatar/avatar7.png" alt="Admin" class="rounded-circle" width="150">
                            <div class="mt-3">
                                <h4>{{ request.user }}</h4>
                                <p class="text-muted font-size-sm">{{ request.user.userinfo.address }}</p>
	                            
                            </div>
                        </div>
                    </div>
                </div>
                <div class="card mt-3">
                    <ul class="list-group list-group-flush">
                        <li class="list-group-item d-flex justify-content-between align-items-center flex-wrap">
                            <h6 class="mb-0">Registerd on</h6>
                            <span class="text-secondary">{{ request.user.date_joined }}</span>
                        </li>
                        <li class="list-group-item d-flex justify-content-between align-items-center flex-wrap">
                            <h6 class="mb-0">Last login</h6>
                            <span class="text-secondary">{{ request.user.last_login }}</span>
                        </li>
                        <li class="list-group-item d-flex justify-content-between align-items-center flex-wrap">
                            <h6 class="mb-0">Login IP</h6>
                            <span class="text-secondary">{{ ip }}</span>
                        </li>
                        <li class="list-group-item d-flex justify-content-between align-items-center flex-wrap">
                            <h6 class="mb-0">IP Location</h6>
                            <span class="text-secondary">{{ geo.country }}</span>
                        </li>
                        <li class="list-group-item d-flex justify-content-between align-items-center flex-wrap">
                            <h6 class="mb-0">Browser</h6>
                            <span class="text-secondary">{{ browser }}</span>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="col-md-8">
                <div class="card mb-3">
                    <div class="card-body">
                        <div class="row">
                            <div class="col-sm-3">
                                <h6 class="mb-0">First Name</h6>
                            </div>
                            <div class="col-sm-9 text-secondary">
                                {{ request.user.first_name }}
                            </div>
                        </div>
                        <hr>
                        <div class="row">
                            <div class="col-sm-3">
                                <h6 class="mb-0">Last Name</h6>
                            </div>
                            <div class="col-sm-9 text-secondary">
                                {{ request.user.last_name }}
                            </div>
                        </div>
                        <hr>
                        <div class="row">
                            <div class="col-sm-3">
                                <h6 class="mb-0">Email</h6>
                            </div>
                            <div class="col-sm-9 text-secondary">
                                {{ request.user.email }}
                            </div>
                        </div>
                        <hr>
                        <div class="row">
                            <div class="col-sm-3">
                                <h6 class="mb-0">Phone</h6>
                            </div>
                            <div class="col-sm-9 text-secondary">
                                {{ request.user.userinfo.phone }}
                            </div>
                        </div>
                        <hr>
                        <div class="row">
                            <div class="col-sm-3">
                                <h6 class="mb-0">Address</h6>
                            </div>
                            <div class="col-sm-9 text-secondary">
                                {{ request.user.userinfo.address }}
                            </div>
                        </div>
                        <hr>
                        <div class="row">
                            <div class="col-sm-12">
                                <a class="btn btn-info " href="/admin/account/edit">Edit</a>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="row gutters-sm">
                    <div class="col-sm-6 mb-3">
                        <div class="card h-100">
                            <div class="card-body">
                                <table class='table table-borderless'>
                                    <tr>
                                        <th class='text-left'>
                                            <h6 class="d-flex align-items-center mb-3">
                                                <i class="material-icons text-info me-2">assignment</i>
                                                Project Status
                                            </h6>
                                        </th>
                                        {% if user.is_staff %}
                                        <th class='text-right'>
                                            <a href='/admin/domain/create' class='btn btn-primary btn-sm' role='button'><b>+ New</b></a>
                                        </th>
                                        {% else %}

                                        {% endif %}
                                    </tr>
                                </table>
                                <hr/>

                                {% for domains in domains %}
                                
									<table class='table table-borderless'>

										<tr>
											<th style="text-align:left">
												<a href="/admin/domain/manage/{{ domains.id }}" style="text-decoration:none;">{{ domains.domain }}</a>
											</th>
											<th style="text-align:right">
												<a href="http://{{ domains.domain }}" target="_blank"><i class="fa fa-eye" aria-hidden="true"></i></a>
<!--												<a href="/domain/manage/{{ host.id }}/pages/{{ page.id }}/delete"> <i class="fa fa-trash" aria-hidden="true"></i> </a>-->
											</th>

										</tr>

									</table>
									<hr/>
                                {% endfor %}
	                            
	                            <nav aria-label="Page navigation example">
									<ul class="pagination justify-content-center">
										{% if domains.has_previous %}
											<li class="page-item"><a class="page-link" href="?page=1">First</a></li>
											<li class="page-item">
												<a href="?page={{ domains.previous_page_number }}" class="page-link">Previous</a>
											</li>
										{% endif %}

										{% if domains.has_next %}
											<li class="page-item"><a class="page-link" href="?page={{ domains.next_page_number }}">Next</a></li>
											<li class="page-item">
												<a class="page-link" href="?page={{ domains.paginator.num_pages }}">Last</a>
											</li>
										{% endif %}
									</ul>
									<p style="text-align:center" >
                                        Page {{ domains.number }} of {{ domains.paginator.num_pages }}.
                                    </p>
								</nav>

                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 mb-3">
                        <div class="card h-100">
                            <div class="card-body">
                                <table class='table table-borderless'>
                                    <tr>
                                        <th class='text-left'>
                                            <h6 class="d-flex align-items-center mb-3">
                                                <i class="material-icons text-info me-2">Bigsansar</i>New Update
                                            </h6>
                                        </th>
                                        {% if user.is_superuser %}
                                        <th class='text-right'>
                                            <a href='/admin/notify/update' class='btn btn-primary btn-sm' role='button'><b>+ New</b></a>
                                        {% else %}

                                        {% endif %}
                                        </th>
                                    </tr>
                                </table>
                                <hr/>
                                {% for update in blog %}

                                <small><a style="text-decoration:none;" href="{{ update.url }}" target="_blank">{{ update.title }}</a></small><hr/>

                                {% endfor %}
                            </div>
                        </div>
                    </div>
                </div>



            </div>
        </div>

    </div>
</div>

{% endblock %}