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

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

Daniel W Bond's avatar
Daniel W Bond committed
125
<legend><h3><i class="fa fa-gift fa-fw"></i>  Bids</h3></legend>
126
127
<div class="row">
  <div class="col-md-12">
Daniel W Bond's avatar
Daniel W Bond committed
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
    {% if bids %}
    <div class="table-responsive">
      <table class="table table-bordered table-hover text-center">
        <thead>
          <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>Price</strong></h4></td>
        </thead>
        <tbody>
        {% for bid in bids %}
        {% if bid == bid.listing.winning_bid %}
        <tr class="success">
        {% else %}
        <tr>
        {% endif %}
          <td class="text-center"><h5>{{ bid.listing.isbn }}</h5></td>
Daniel W Bond's avatar
Daniel W Bond committed
144
          <td class="text-center"><h5><a href="{{ bid.listing.get_absolute_url }}">{{ bid.listing.isbn|isbn_name|title }}<a/></h5></td>
145
146
147
148
149
150
151
          <td class="text-center"><h5>
          {% if bid == bid.listing.winning_bid %}
            <small><span class="label label-success"><strong>Winning Bid</strong></span></small>
          {% else %}
          {% endif %}
          ${{ bid.price }}
          </h5></td>
Daniel W Bond's avatar
Daniel W Bond committed
152
153
154
155
156
157
158
159
        {% endfor %}
        </tbody>
      </table>
    </div>
  {% else %}
    {% if student.user == request.user %}
    You don't
    {% else %}
Daniel W Bond's avatar
Daniel W Bond committed
160
    {{ student.user.get_full_name }} doesn't
Daniel W Bond's avatar
Daniel W Bond committed
161
162
163
164
165
166
167
    {% 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 %}
168
169
  </div>
</div>
170

Daniel W Bond's avatar
Daniel W Bond committed
171
172
173
{% 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>

174
<div class="row">
175
  <div class="col-md-12">
Daniel W Bond's avatar
Daniel W Bond committed
176
  {% if lookouts %}
177
    <div class="table-responsive">
178
      <table class="table table-bordered table-hover text-center">
179
        <thead>
180
181
182
          <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>
183
184
185
186
        </thead>
        <tbody>
        {% for lookout in lookouts %}
        <tr>
187
          <td class="text-center"><h5>{{ lookout.isbn }}</h5></td>
Daniel W Bond's avatar
Daniel W Bond committed
188
          <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
189
          <td class="text-center"><h5><a href="{% url 'delete_lookout' lookout.slug %}"><span class="label label-danger">Delete</span></a></h5></td>
190
191
192
193
        {% endfor %}
        </tbody>
      </table>
    </div>
Daniel W Bond's avatar
Daniel W Bond committed
194
195
196
197
198
  {% 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 %}
199
200
201
202
203
  </div>
</div>
{% endif %}

{% endblock %}