profile.html 8.2 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 }}
5
6
7
8
{% endblock %}

{% 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
      <h2><strong>{{ student.user.get_full_name }}</strong></h2>
21
    </div>
Daniel W Bond's avatar
Daniel W Bond committed
22
23
24
25
26
27
28
29
30
31
32
33
    <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 %}
34
35
        </h3></a>
      {% else %}
Daniel W Bond's avatar
Daniel W Bond committed
36
        <small>{{ student.user.first_name }} has no ratings yet.</small>
37
      {% endif %}
38
    </div>
Daniel W Bond's avatar
Daniel W Bond committed
39
    <div class="col-md-2 text-right">
40
      <h3><a href="mailto:{{ student.user.email }}"><i class="fa fa-envelope"></i> {{ student.user.username }}</a></h3>
41
42
    </div>
  </div>
43
  </legend>
44
45
</div>

46

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

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

Daniel W Bond's avatar
Daniel W Bond committed
127
<legend><h3><i class="fa fa-gift fa-fw"></i>  Bids</h3></legend>
128
129
<div class="row">
  <div class="col-md-12">
Daniel W Bond's avatar
Daniel W Bond committed
130
131
    {% if bids %}
    <div class="table-responsive">
132
      <table class="table table-bordered table-hover table-condensed text-center">
Daniel W Bond's avatar
Daniel W Bond committed
133
        <thead>
134
135
136
137
138
139
          <!-- 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
140
141
142
        </thead>
        <tbody>
        {% for bid in bids %}
143
        {% if bid.listing.winning_bid %}
Daniel W Bond's avatar
Daniel W Bond committed
144
145
146
147
        <tr class="success">
        {% else %}
        <tr>
        {% endif %}
148
          <td class="text-center"><h5>{{ bid.created|date:"m/d/y" }}</h5></td>
Daniel W Bond's avatar
Daniel W Bond committed
149
          <td class="text-center"><h5><a href="{{ bid.listing.get_absolute_url }}">{{ bid.listing.isbn|isbn_name|title }}<a/></h5></td>
150
          <td class="text-center"><h5>
151
152
            {% if bid.listing.exchanged %}
              <span class="label label-primary"><strong>Exchanged</strong></span>
153
154
155
156
157
158
159
            {% 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 %}
160
          </h5></td>
161
162
163
164
165
166
167
168
          <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
169
170
171
172
173
174
175
176
        {% endfor %}
        </tbody>
      </table>
    </div>
  {% else %}
    {% if student.user == request.user %}
    You don't
    {% else %}
Daniel W Bond's avatar
Daniel W Bond committed
177
    {{ student.user.get_first_name }} doesn't
Daniel W Bond's avatar
Daniel W Bond committed
178
179
180
181
182
183
184
    {% 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 %}
185
186
  </div>
</div>
187

Daniel W Bond's avatar
Daniel W Bond committed
188
189
190
{% 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>

191
<div class="row">
192
  <div class="col-md-12">
Daniel W Bond's avatar
Daniel W Bond committed
193
  {% if lookouts %}
194
    <div class="table-responsive">
195
      <table class="table table-bordered table-hover table-condensed text-center">
196
        <thead>
197
198
199
          <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>
200
201
202
203
        </thead>
        <tbody>
        {% for lookout in lookouts %}
        <tr>
204
          <td class="text-center"><h5>{{ lookout.isbn }}</h5></td>
Daniel W Bond's avatar
Daniel W Bond committed
205
          <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
206
          <td class="text-center"><h5><a href="{% url 'delete_lookout' lookout.slug %}"><span class="label label-danger">Delete</span></a></h5></td>
207
208
209
210
        {% endfor %}
        </tbody>
      </table>
    </div>
Daniel W Bond's avatar
Daniel W Bond committed
211
212
213
214
215
  {% 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 %}
216
217
218
219
220
  </div>
</div>
{% endif %}

{% endblock %}