profile.html 5 KB
Newer Older
1
{% extends 'layouts/base.html' %}
2
{% comment %} {% load website_extras %} {% endcomment %}
3
4

{% block title %}
5
SRCT Bookshare • {{ student.user.first_name }} {{ student.user.last_name }}
6
7
8
9
{% endblock %}

{% block content %}

10
11
{% load gravatar %}

12
13
{% load trades_extras %}

14
<div class="page-header" id="banner">
15
  <legend>
16
  <div class="row">
17
18
19
20
21
22
23
    <div class="col-md-1">
      <img class="img-circle img-responsive" src="{% gravatar_url student.user.email 75 %}">
    </div>
    <div class="col-lg-7 col-md-6">
      <h2><strong>{{ student.user.first_name }} {{ student.user.last_name }}</strong></h2>
    </div>
    <div class="col-lg-2 col-md-3">
24
      {% comment %}
25
26
27
28
29
30
31
32
33
      {% if student.rating %}
        <h3><a href="#students-ratings-history">
        <i class="fa fa-star"></i>
        <i class="fa fa-star"></i>
        <i class="fa fa-star"></i>
        <i class="fa fa-star-o"></i>
        <i class="fa fa-star-o"></i>
        </h3></a>
      {% else %}
34
        <em>{{ student.user.first_name }} has no ratings yet.</em>
35
      {% endif %}
36
      {% endcomment %}
37
38
39
    </div>
    <div class="col-md-2">
      <h3><a href="mailto:{{ student.user.email }}"><i class="fa fa-envelope"></i> {{ student.user.username }}</a></h3>
40
41
    </div>
  </div>
42
  </legend>
43
44
</div>

45

46
47
<div class="row">
  <div class="col-md-12">
48
49
    {% if student.user == request.user %}
    <legend><h3>Listings <small>(<a href="{% url 'create_listing' %}">Create</a>)</small></h3></legend>
50
51
52
53
54
    {% else %}
    <h3>Listings</h3>
    {% endif %}

    {% if listings %}
55
56
57
    <div class="table-responsive">
      <table class="table table-bordered table-hover">
        <thead>
58
59
          <th class="col-md-2 text-center"><h4>ISBN</h4></th>
          <th class="col-md-8 text-center"><h4>Title</h4></th>
60
61
          <th class="col-md-1 text-center"><h4>Price</h4></th>
          <th class="col-md-1 text-center"><h4>
62
63
64
65
            {% if student.user == request.user %}
            Action
            {% else %}
            Status
66
            {% endif %}</h4></th>
67
68
69
70
        </thead>
        {% for listing in listings %}
        <tbody>
          <tr>
71
72
73
            <td class="text-center"><h5>{{ listing.isbn }}</h5></td>
            <td class="text-center"><h5><a href="{{ listing.get_absolute_url }}">{{ listing.title }}</h5></a></td>
            <td class="text-center"><h5>
74
75
              {% if listing.sold %}
                ${{ listing.finalPrice }}
76
              {% else %}
77
                ${{ listing.price }}
78
              {% endif %}
79
80
            </h5></td>
            <td class="text-center"><h5>
81
82
              {% if listing.sold %}
                <span class="label label-danger">Sold</span>
83
84
85
                {% if student.user == request.user %}
                  <small>(<a href="{% url 'close_listing' listing.slug %}">Reopen</a>)</small>
                {% endif %}
86
87
88
89
90
              {% elif not listing.active %}
                <span class="label label-default">Closed</span>
              {% else %}
                {% if student.user == request.user %}
                  {% if listing.active %}
91
                    <a href="{% url 'close_listing' listing.slug %}">Mark Sold</a>
92
                  {% else %}
93
                    <a href="{% url 'update_listing' listing.slug %}">Reopen</a>
94
                  {% endif %}
95
                {% else %}
96
                  <span class="label label-success">Active</span>
97
                {% endif %}
98
              {% endif %}
99
            </h5></td>
100
          </tr>
101
102
103
104
        </tbody>
        {% endfor %}
      </table>
      {% if student.user == request.user %}
105
106
        <strong>Total Sales:</strong> {{ sales }} |
        <strong>Total Proceeds:</strong> ${{ proceeds }}
107
108
      {% endif %}
    </div>
109
    {% else %}
110
      {% if student.user == request.user %}
111
112
      You don't
      {% else %}
113
      {{ student.user.first_name }} doesn't
114
115
      {% endif %}
      have any listings posted yet.
116
117
118
      {% if student.user == request.user %}
      Consider listings your textbooks on SRCT Bookshare.
      {% endif %}
119
120
121
122
123
    {% endif %}
  </div>
</div>


124
{% if student.user == request.user %}
125
126
<div class="row">
  <div class="col-md-12">
127
128
129
    <legend><h3>Lookouts <small>(<a href="{% url 'create_lookout' %}">Create</a>)</small></h3></legend>
  </div>
</div>
130
{% endif %}
131

132
{% if lookouts %}
133
<div class="row">
134
135
136
137
  <div class="col-md-12">
    <div class="table-responsive">
      <table class="table table-bordered table-hover">
        <thead>
138
139
140
          <th class="col-md-2 text-center"><h4>ISBN</h4></th>
          <th class="col-md-8 text-center"><h4>Title</h4></th>
          <th class="col-md-2 text-center"><h4>Action</h4></th>
141
142
143
144
        </thead>
        <tbody>
        {% for lookout in lookouts %}
        <tr>
145
146
          <td class="text-center"><h5>{{ lookout.isbn }}</h5></td>
          <td class="text-center"><h5><a href="{{ lookout.get_absolute_url }}">{{ lookout.isbn|isbn_name }}<a/></h5></td>
147
148
149
150
151
          <td class="text-center"><h5><a href="{% url 'delete_lookout' lookout.slug %}">Delete</a></h5></td>
        {% endfor %}
        </tbody>
      </table>
    </div>
152
153
154
155
156
  </div>
</div>
{% endif %}

{% endblock %}