profile.html 8.38 KB
Newer Older
1
2
3
{% extends 'layouts/base.html' %}

{% block title %}
Daniel W Bond's avatar
Daniel W Bond committed
4
SRCT Bookshare • {{ student.user.get_full_name }}
Daniel W Bond's avatar
Daniel W Bond committed
5
{% endblock title %}
6
7
8

{% block content %}

9
10
{% load gravatar %}

11
12
{% load trades_extras %}

13
<div class="page-header" id="banner">
14
  <legend>
15
  <div class="row">
16
17
18
    <div class="col-md-1">
      <img class="img-circle img-responsive" src="{% gravatar_url student.user.email 75 %}">
    </div>
Daniel W Bond's avatar
Daniel W Bond committed
19
    <div class="col-md-6">
Daniel W Bond's avatar
Daniel W Bond committed
20
21
22
23
24
      <h2><strong>{{ student.user.get_full_name }}</strong>
        {% if student.user == request.user %}
          <small><a href="{% url 'name_change' %}">(Edit)</a></small>
        {% endif %}
      </h2>
25
    </div>
Daniel W Bond's avatar
Daniel W Bond committed
26
27
28
29
30
31
32
33
34
35
36
37
    <div class="col-md-3 text-right">
      {% if avg_stars %}
        <h3><a href="{% url 'ratings' student.slug %}">
        {% for star in avg_stars|full_stars %}
          <i class="fa fa-star"></i>
        {% endfor %}
        {% if avg_stars|half_stars %}
          <i class="fa fa-star-half-o"></i>
        {% endif %}
        {% for star in avg_stars|empty_stars %}
          <i class="fa fa-star-o"></i>
        {% endfor %}
38
39
        </h3></a>
      {% else %}
Daniel W Bond's avatar
Daniel W Bond committed
40
        <small>{{ student.user.first_name }} has no ratings yet.</small>
41
      {% endif %}
42
    </div>
Daniel W Bond's avatar
Daniel W Bond committed
43
    <div class="col-md-2 text-right">
44
      <h3><a href="mailto:{{ student.user.email }}"><i class="fa fa-envelope"></i> {{ student.user.username }}</a></h3>
45
46
    </div>
  </div>
47
  </legend>
48
49
</div>

50

51
52
<div class="row">
  <div class="col-md-12">
53
    {% if student.user == request.user %}
Daniel W Bond's avatar
Daniel W Bond committed
54
    <legend><h3><i class="fa fa-book fa-fw"></i> Your Listings <small>(<a href="{% url 'create_listing' %}">Create</a>)</small></h3></legend>
55
    {% else %}
Daniel W Bond's avatar
Daniel W Bond committed
56
    <legend><h3><i class="fa fa-book fa-fw"></i> Listings</h3></legend>
57
58
59
    {% endif %}

    {% if listings %}
60
    <div class="table-responsive">
61
      <table class="table table-bordered table-hover table-condensed text-center">
62
        <thead>
63
          <td class="col-md-2"><h4><strong>ISBN</strong></h4></td>
64
          <td class="col-md-7"><h4><strong>Title</strong></h4></td>
65
          <td class="col-md-1"><h4><strong>Price</strong></h4></td>
66
          <td class="col-md-1"><h4><strong>Bids</strong></h4></td>
Daniel W Bond's avatar
Daniel W Bond committed
67
          <td class="col-md-1"><h4><strong>Status</strong></h4></td>
68
69
70
        </thead>
        {% for listing in listings %}
        <tbody>
71
          {% if listing.exchanged %}
Daniel W Bond's avatar
Daniel W Bond committed
72
73
          <tr class="success">
          {% else %}
74
          <tr>
Daniel W Bond's avatar
Daniel W Bond committed
75
          {% endif %}
76
            <td class="text-center"><h5>{{ listing.isbn }}</h5></td>
Daniel W Bond's avatar
Daniel W Bond committed
77
            <td class="text-center"><h5><a href="{{ listing.get_absolute_url }}">{{ listing.title|title }}</h5></a></td>
78
            <td class="text-center"><h5>
79
              {% if listing.exchanged %}
Daniel W Bond's avatar
Daniel W Bond committed
80
                ${{ listing.final_price }}
81
              {% else %}
82
                ${{ listing.price }}
83
              {% endif %}
84
            </h5></td>
85
            <td class="text-center"><h5>{{ listing.bids|length }}</h5></td>
86
            <td class="text-center"><h5>
87
88
              {% if listing.exchanged %}
                <span class="label label-primary"><strong>Exchanged</strong></span>
89
                {% if student.user == request.user %}
90
                  <small>(<a href="{% url 'unexchange_listing' listing.slug %}">Cancel Exchange</a>)</small>
Daniel W Bond's avatar
Daniel W Bond committed
91
92
93
94
95
                {% endif %}
              {% elif listing.cancelled %}
                <span class="label label-default"><strong>Cancelled</strong></span>
                {% if student.user == request.user %}
                  <small>(<a href="{% url 'reopen_listing' listing.slug %}">Reopen</a>)</small>
96
                {% endif %}
97
              {% elif not listing.active %}
Daniel W Bond's avatar
Daniel W Bond committed
98
                <span class="label label-warning"><strong>Inactive</strong></span>
99
              {% else %}
Daniel W Bond's avatar
Daniel W Bond committed
100
                <span class="label label-info"><strong>Active</strong></span>
101
                {% if student.user == request.user %}
Daniel W Bond's avatar
Daniel W Bond committed
102
                  <small>(<a href="{% url 'cancel_listing' listing.slug %}">Cancel</a>)</small>
103
                {% endif %}
104
              {% endif %}
105
            </h5></td>
106
          </tr>
107
108
109
110
        </tbody>
        {% endfor %}
      </table>
      {% if student.user == request.user %}
Daniel W Bond's avatar
Daniel W Bond committed
111
        <h4>
112
        <strong>Total Exchanges:</strong> {{ exchanges }} |
113
        <strong>Total Proceeds:</strong> ${{ proceeds|default_if_none:"0" }}
Daniel W Bond's avatar
Daniel W Bond committed
114
        </h4>
115
116
      {% endif %}
    </div>
117
    {% else %}
118
      {% if student.user == request.user %}
119
120
      You don't
      {% else %}
121
      {{ student.user.first_name }} doesn't
122
123
      {% endif %}
      have any listings posted yet.
124
      {% if student.user == request.user %}
Daniel W Bond's avatar
Daniel W Bond committed
125
      Consider putting your textbooks on SRCT Bookshare.
126
      {% endif %}
127
128
129
130
    {% endif %}
  </div>
</div>

Daniel W Bond's avatar
Daniel W Bond committed
131
<legend><h3><i class="fa fa-gift fa-fw"></i>  Bids</h3></legend>
132
133
<div class="row">
  <div class="col-md-12">
Daniel W Bond's avatar
Daniel W Bond committed
134
135
    {% if bids %}
    <div class="table-responsive">
136
      <table class="table table-bordered table-hover table-condensed text-center">
Daniel W Bond's avatar
Daniel W Bond committed
137
        <thead>
138
139
140
141
142
143
          <!-- the br's is a really shitty way of doing this -->
          <td class="col-md-1"><h4><strong>Date<br />Bid</strong></h4></td>
          <td class="col-md-8"><h4><strong><br />Title</strong></h4></td>
          <td class="col-md-1"><h4><strong>Listing Status</strong></h4></td>
          <td class="col-md-1"><h4><strong><br />Course</strong></h4></td>
          <td class="col-md-1"><h4><strong><br />Price</strong></h4></td>
Daniel W Bond's avatar
Daniel W Bond committed
144
145
146
        </thead>
        <tbody>
        {% for bid in bids %}
147
        {% if bid.listing.winning_bid %}
Daniel W Bond's avatar
Daniel W Bond committed
148
149
150
151
        <tr class="success">
        {% else %}
        <tr>
        {% endif %}
152
          <td class="text-center"><h5>{{ bid.created|date:"m/d/y" }}</h5></td>
Daniel W Bond's avatar
Daniel W Bond committed
153
          <td class="text-center"><h5><a href="{{ bid.listing.get_absolute_url }}">{{ bid.listing.isbn|isbn_name|title }}<a/></h5></td>
154
          <td class="text-center"><h5>
155
156
            {% if bid.listing.exchanged %}
              <span class="label label-primary"><strong>Exchanged</strong></span>
157
158
159
160
161
162
163
            {% elif bid.listing.cancelled %}
              <span class="label label-default"><strong>Cancelled</strong></span>
            {% elif not listing.active %}
              <span class="label label-warning"><strong>Inactive</strong></span>
            {% else %}
              <span class="label label-info"><strong>Active</strong></span>
            {% endif %}
164
          </h5></td>
165
166
167
168
169
170
171
172
          <td class="text-center"><h5>{{ bid.listing.course_abbr }}</h5></td>
          <td class="text-center"><h5>
          ${{ bid.price }}
          {% if bid == bid.listing.winning_bid %}
            <br /><small><span class="label label-success"><strong>Winning Bid</strong></span></small>
          {% else %}
          {% endif %}
          </h5></td>
Daniel W Bond's avatar
Daniel W Bond committed
173
174
175
176
177
178
179
180
        {% endfor %}
        </tbody>
      </table>
    </div>
  {% else %}
    {% if student.user == request.user %}
    You don't
    {% else %}
Daniel W Bond's avatar
Daniel W Bond committed
181
    {{ student.user.get_first_name }} doesn't
Daniel W Bond's avatar
Daniel W Bond committed
182
183
184
185
186
187
188
    {% endif %}
    have any have any bids yet.
    {% if student.user == request.user %}
    <a href="{% url 'list_listings' %}">Check out</a> the latest listings
    on SRCT Bookshare and see if there are any textbooks you need!
    {% endif %}
  {% endif %}
189
190
  </div>
</div>
191

Daniel W Bond's avatar
Daniel W Bond committed
192
193
194
{% if student.user == request.user %}
 <legend><h3><i class="fa fa-eye fa-fw"></i> Lookouts <small>(<a href="{% url 'create_lookout' %}">Create</a>)</small></h3></legend>

195
<div class="row">
196
  <div class="col-md-12">
Daniel W Bond's avatar
Daniel W Bond committed
197
  {% if lookouts %}
198
    <div class="table-responsive">
199
      <table class="table table-bordered table-hover table-condensed text-center">
200
        <thead>
201
202
203
          <td class="col-md-2"><h4><strong>ISBN</strong></h4></td>
          <td class="col-md-8"><h4><strong>Title</strong></h4></td>
          <td class="col-md-2"><h4><strong>Action</strong></h4></td>
204
205
206
207
        </thead>
        <tbody>
        {% for lookout in lookouts %}
        <tr>
208
          <td class="text-center"><h5>{{ lookout.isbn }}</h5></td>
Daniel W Bond's avatar
Daniel W Bond committed
209
          <td class="text-center"><h5><a href="{{ lookout.get_absolute_url }}">{{ lookout.isbn|isbn_name|title }}<a/></h5></td>
Daniel W Bond's avatar
Daniel W Bond committed
210
          <td class="text-center"><h5><a href="{% url 'delete_lookout' lookout.slug %}"><span class="label label-danger">Delete</span></a></h5></td>
211
212
213
214
        {% endfor %}
        </tbody>
      </table>
    </div>
Daniel W Bond's avatar
Daniel W Bond committed
215
216
217
218
219
  {% else %}
  You don't have any lookouts yet. Lookouts are automatic searches for books you
  have an eye out for. You can <a href="{% url 'create_lookout' %}">create some</a>,
  and we'll immediately let you know when a listing you want goes up.
  {% endif %}
220
221
222
223
  </div>
</div>
{% endif %}

Daniel W Bond's avatar
Daniel W Bond committed
224
{% endblock content %}