🔥 Delete legacy register and deposit

♻ Replace facebook avatar related stuff with gravatars
♻ Replace format-strings with f-strings
✨ Add profile_images command
This commit is contained in:
Nikolai R Kristiansen committed 2022-02-10 09:42:57 +01:00
1 parent a9f81737d5
commit 9fa6cfe0ee
13 files changed
+52 -626

No files matched your search

-82
View File
@@ -1,82 +0,0 @@
{% extends "base.html" %}
{% block active_deposit %}active{% endblock %}
{% block content %}
<section id="deposit" class="row">
{% if messages %}
<section class="row">
<div class="col-xs-4">
{% for message in messages %}
<div {% if message.tags %} class="alert alert-{{ message.tags }}"{% endif %}>{{ message }}<a class="close" data-dismiss="alert">×</a></div>
{% endfor %}
</div>
</section>
{% endif %}
{% if not perms.main.can_add_transaction and limit_deposits %}
<section class="row">
<div class="col-xs-4">
<p class="alert alert-warning">Du har ikke tilgang til å sette inn penger.</p>
<p>Spør en av disse om de kan hjelpe deg:</p>
<ul>
{% for u in allowed_users %}
<li style="padding-bottom: 8px;"><img src="{{u.profile.image }}" />{{u.first_name }} {{u.last_name }}</li>
{% endfor %}
</ul>
</div>
</section>
{% else %}
<form id="order" method="post" class="form-stacked" autocomplete="off">
{% csrf_token %}
<section id="customer">
<div class="row">
<div class="col-md-12">
<h2>Hvem skal sette inn penger?</h2>
</div>
</div>
<div class="row">
<!-- Typeahead customer field -->
<div class="col-md-3">
<input name="customer_name" id="id_customer_typeahead" type="text" value="" data-provide="typeahead" data-source="{{users_js}}" class="form-control" /><br />
<!-- Actual customer select field (hidden) -->
<div style="display:none;">{{form.user }}</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<ul class="well">
{% for user in users %}
<li class="customer">{% spaceless %}
<img class="profile" src="{{ user.profile.profile_image_url }}" alt="Profile picture"/><br />
<span class="name">{{ user.first_name }} {{ user.last_name|slice:":1" }}</span><br />
<span class="balance">{{ user.profile.balance }}</span>
<span class="id" style="display:none;">{{ user.id }}</span>
{% endspaceless %}</li>
{% endfor %}
</ul>
</div>
</div>
</section>
<section id="amount">
<div class="row">
<div class="col-md-12">
<h2>Hvor mye?</h2>
</div>
</div>
<div class="row">
<div class="col-md-4">
{{form.amount }}
{{form.amount.errors}}<br />
</div>
</div>
</section>
<div class="row">
<div class="col-md-12">
<button type="submit" class="btn btn-lg btn-primary" name="submit_order">Sett inn</button>
<a href="{% url 'home' %}" class="btn btn-default">Avbryt</a>
</div>
</div>
</form>
{% endif %}
</section>
{% endblock %}
-102
View File
@@ -1,102 +0,0 @@
{% extends "base.html" %}
{% load static thumbnail %}
{% block active_register %}active{% endblock %}
{% block content %}
<section id="register" class="row">
{% if messages %}
<section class="row">
<div class="col-xs-4">
{% for message in messages %}
<div{% if message.tags %} class="alert alert-{{ message.tags }}"{% endif %}>{{ message }}<a class="close" data-dismiss="alert">×</a></div>
{% endfor %}
</div>
</section>
{% endif %}
<form id="order" class="form-stacked" method="post" autocomplete="off">
<fieldset>
{% csrf_token %}
<!-- Formset validation fields -->
<input type="hidden" name="form-TOTAL_FORMS" value="{{ products|length }}" id="id_form-TOTAL_FORMS" />
<input type="hidden" name="form-INITIAL_FORMS" value="{{ products|length }}" id="id_form-INITIAL_FORMS" />
<input type="hidden" name="form-MAX_NUM_FORMS" id="id_form-MAX_NUM_FORMS" />
<section id="customer">
{% if users %}
<div class="row">
<div class="col-md-12">
<h2 title="Sortert etter hvem som kjøpte noe sist.">Hvem kjøper?</h2>
</div>
</div>
<div class="row">
<div class="col-md-3">
<!-- Typeahead customer field -->
<input name="customer_name" type="text" id="id_customer_typeahead" value="" data-provide="typeahead" data-source="{{users_js}}" class="form-control" />
<!-- Actual customer select field (hidden) -->
<div style="display:none;">{{orderform.customer }}</div>
<br />
</div>
</div>
<div class="row">
<div class="col-md-12">
<ul class="well">
<li class="customer">{% spaceless %}
<img class="profile" src="{% static "dist/images/unknown_person.png" %}" alt="Profile picture" /><br />
<span class="name">Ekstern</span><br />
<span class="balance">&nbsp;</span>
{% endspaceless %}</li>
{% for user in users %}<li class="customer{% if user.profile.last_purchase_date < half_a_year_ago %} infrequent hidden{% endif %}">{% spaceless %}
<img class="profile" src="{{ user.profile.profile_image_url }}" alt="Profile picture" /><br />
<span class="name">{{ user.first_name }} {{ user.last_name|slice:":1"}}</span><br />
<span class="balance">{{ user.profile.balance }}</span>
<span class="id" style="display:none;">{{ user.id }}</span>
{% endspaceless %}</li>{% endfor %}
</ul>
<div class="users-description pull-right">
<small>Viser: De med minst <strong>{{ cheapest_product_price }}</strong> i saldo<span class="infrequent-users"> og mer enn ett kjøp siden <strong>{{ half_a_year_ago }}</strong></span>. <a href="#" class="toggle-infrequent-users">Vis alle</a></small>
</div>
</div>
</div>
{%else%}
<div class="row">
<div class="col-md-3">
<h2>Hvem kjøper?</h2>
<div class="alert alert-error">Ingen har positiv saldo i BBS.</div><a href="{% url 'deposit' %}" class="btn">Sett inn penger</a>
</div>
</div>
{%endif%}
</section>
<section id="products" class="row">
<div class="col-md-12">
<h2>Kjøper hva?</h2>
<ul class="well">
{% for product in products %}
<li id="form-{{forloop.counter0}}" class="product"><input type="hidden" name="form-{{ forloop.counter0 }}-product" value="{{product.id }}" />
<input type="hidden" id="form-{{ forloop.counter0 }}-amount" name="form-{{ forloop.counter0 }}-amount" value="0" class="span2" size="2" />
<input type="hidden" name="form-{{ forloop.counter0 }}-unit_price_int" value="{{product.sale_price_int }}" />
<input type="hidden" name="form-{{ forloop.counter0 }}-unit_price_ext" value="{{product.sale_price_ext }}" />
<span class="qty">0</span>
{% if product.image %}
<img class="product" src="{{ product.image|thumbnail_url:'product' }}" /><br />
{% else %}
<img class="product" src="{% static "dist/images/product.png" %}" /><br />
{% endif %}
<span class="name">{{ product.name }}</span><br>
<span class="sale_price_ext">{{product.sale_price_ext|floatformat:0}}</span>/<span class="sale_price_int">{{product.sale_price_int|floatformat:0}}</span>
</li>
{% endfor %}
</ul>
</div>
</section>
</fieldset>
<div class="form-actions">
<div class="col-xs-3 total">
<h2>Totalt: <span class="total_text"></span></h2>
</div>
  <button type="submit" class="btn btn-lg btn-primary" name="submit_order">Kjøp</button>
  <button type="reset" class="btn btn-default">Start på nytt</button>
</div>
</form>
</section>
{% endblock %}