Skip to content
This repository
tree: 57dd893490
Fetching contributors…

Cannot retrieve contributors at this time

file 180 lines (158 sloc) 5.896 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
{% extends 'dashboard/layout.html' %}
{% load currency_filters %}
{% block body_class %}users{% endblock %}

{% block title %}
User {{ user.email }} | {{ block.super }}
{% endblock %}

{% block breadcrumbs %}
<ul class="breadcrumb">
    <li>
        <a href="{% url dashboard:index %}">Dashboard</a>
        <span class="divider">/</span>
    </li>
    <li>
        <a href="{% url dashboard:users-index %}">Users</a>
        <span class="divider">/</span>
    </li>
<li class="active"><a href=".">#{{ user.id }}</a></li>
</ul>
{% endblock %}

{% block header %}
    <div class="page-header">
<h1>User #{{ user.id }} - {{ user.email }}</h1>
    </div>
{% endblock header %}

{% block dashboard_content %}
{% with user=object %}
<div class="row-fluid">
    <div class="span3">
        <h2>General</h2>
        <div id="user_details" class="well well-info">
            <ul>
                <li>Email: {{ user.email }}</li>
                <li>First name: {{ user.first_name }}</li>
                <li>Last name: {{ user.last_name }}</li>
                <li>This user is <strong>{% if user.is_active %}active{% else %}inactive{% endif %}</strong></li>
                {% if user.is_superuser %}
                <li><strong>Superuser</strong></li>
                {% endif %}
            </ul>
        </div>
    </div>

    <div class="span9">
        <h2>Detailed information</h2>
        <div id="user_order_details" class="row-fluid">
            <div class="span4">
                <div class="well well-info">
                    <h3>General</h3>
                    <ul>
                        <li>Last login: {{ user.last_login }}</li>
                        <li>Date joined: {{ user.date_joined }}</li>
                        <li>Number of viewed products: {{ user.userrecord.num_product_views }}</li>
                    </ul>
                </div>
            </div>

            <div class="span4">
                <div class="well well-info">
                    <h3>Orders</h3>
                    <ul>
                        <li>Number of orders: {{ user.userrecord.num_orders }}</li>
                        <li>Number of ordered items: {{ user.userrecord.num_order_items }}</li>
                        <li>Total spent: {{ user.userrecord.total_spent|currency }}</li>
                        <li>Date of last order: {{ user.userrecord.date_last_order }}</li>
                    </ul>
                </div>
            </div>

            <div class="span4">
                <div class="well well-info">
                    <h3>Reviews</h3>
                    <ul>
                        <li>Number of reviews: {{ user.reviews.count }}</li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>


<div class="tabbable dashboard">
<ul class="nav nav-tabs">
<li class="active"><a href="#user_orders" data-toggle="tab">Orders</a></li>
<li><a href="#user_addresses" data-toggle="tab">Addresses</a></li>
<li><a href="#user_reviews" data-toggle="tab">Reviews</a></li>
</ul>

<div class="tab-content">
        <div id="user_orders" class="tab-pane active">
            <h2>Orders</h2>
            {% if user.orders.count %}
             <table class="table table-striped table-bordered">
                 <tr>
                     <th>Order Number</th>
                     <th>Num items</th>
                     <th>Total value</th>
                     <th>Date placed</th>
                     <th>Status</th>
                     <th></th>
                 </tr>
                 {% for order in user.orders.all %}
                 <tr>
                     <td>{{ order.number }}</td>
                     <td>{{ order.num_items }}</td>
                     <td>{{ order.basket_total_incl_tax|currency }}</td>
                     <td>{{ order.date_placed|date:"d/m/y H:s" }}</td>
                     <td>{{ order.status }}</td>
                     <td><a href="{% url dashboard:order-detail order.number %}" class="btn btn-info">View</a></td>
                 </tr>
                 {% endfor %}
             </table>
            {% else %}
                <p>This user has not placed any orders yet.</p>
            {% endif %}
        </div>

        <div id="user_addresses" class="tab-pane">
            <h2>Addresses</h2>
            <div class="row-fluid">
         {% for address in user.addresses.all %}
                {% if forloop.counter|divisibleby:5 %}
                </div><div class="row-fluid">
                {% endif %}

                <div class="span3">
             <div class="well well-info">
             {% for field in address.active_address_fields %}
             {{ field }}<br/>
             {% endfor %}
             </div>
             </div>

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

        <div id="user_reviews" class="tab-pane">
            <div class="sub-header">
                <h2>Reviews</h2>
            </div>
            {% if user.reviews.count %}
            <table class="table table-striped table-bordered">
                <tr>
                    <th>Product ID</th>
                    <th>Score</th>
                    <th>Title</th>
                    <th>Body</th>
                    <th>Date created</th>
                </tr>
                {% for review in user.reviews.all %}
                <tr>
                    <td>{{ review.product_id }}</td>
                    <td>{{ review.score }}</td>
                    <td>{{ review.title }}</td>
                    <td>{{ review.body }}</td>
                    <td>{{ review.date_created }}</td>
                </tr>
                {% endfor %}
            </table>
            {% else %}
            <p>This user has not written any reviews yet.</p>
            {% endif %}
        </div>

    </div>
</div>







{% endwith %}
{% endblock dashboard_content %}
Something went wrong with that request. Please try again.