profile.html 6.71 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
    {% if student.user == request.user %}
Daniel W Bond's avatar
Daniel W Bond committed
49
    <legend><h3><i class="fa fa-book fa-fw"></i> Your Listings <small>(<a href="{% url 'create_listing' %}">Create</a>)</small></h3></legend>
50
    {% else %}
Daniel W Bond's avatar
Daniel W Bond committed
51
    <legend><h3><i class="fa fa-book fa-fw"></i> Listings</h3></legend>
52
53
54
    {% endif %}

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

124
{% if student.user == request.user %}
Daniel W Bond's avatar
Daniel W Bond committed
125
<legend><h3><i class="fa fa-gift fa-fw"></i> Your 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
    {% 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>
          <td class="text-center"><h5><a href="{{ bid.listing.get_absolute_url }}">{{ bid.listing.isbn|isbn_name }}<a/></h5></td>
          <td class="text-center"><h5>${{ bid.price }}</h5></td>
        {% endfor %}
        </tbody>
      </table>
    </div>
  {% else %}
    {% if student.user == request.user %}
    You don't
    {% else %}
    {{ student.user.first_name }} doesn't
    {% 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 %}
162
163
  </div>
</div>
164
{% endif %}
165

Daniel W Bond's avatar
Daniel W Bond committed
166
167
168
{% 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>

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

Daniel W Bond's avatar
Daniel W Bond committed
193
194
{% endif %}

195
{% endblock %}