Skip to content

Commit

Permalink
Added consumer user views
Browse files Browse the repository at this point in the history
  • Loading branch information
jjoseba committed Mar 11, 2024
1 parent ca9a457 commit 6d0ece8
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 24 deletions.
2 changes: 1 addition & 1 deletion authentication/models/preregister.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def send_email(self):
@staticmethod
def create_user_and_preregister(account):
if not account.owner:
account.owner = User.objects.create_user(email=account.email)
account.owner = User.objects.create_user(email=account.email, first_name=account.display_name)
account.save()

PreRegisteredUser.objects.create(
Expand Down
4 changes: 2 additions & 2 deletions templates/consumer/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ <h3 class="mb-0"><a href="{% market_url 'market:consumer_list' %}">Consumidoras<

<div class="container px-md-5 mt-4">

{% if request.user.is_staff %}
<div class="card detail-card">
<div class="card-body">
{% include "user/detail_card.html" with user=object.owner %}
</div>
</div>
{% endif %}

<div class="row mt-4">
<div class="col-md-4 col-lg-3">


<div class="file-field image-field d-inline-block mb-4" data-ref="#profile-image" data-ref-type="image">
{% include "account/profile_circle.html" with account=object %}
</div>
Expand Down
4 changes: 0 additions & 4 deletions templates/navbar/user.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
<div class="collapse navbar-collapse " id="navbar-menu">
<div class="container">
<ul class="nav nav-tabs nav-fill flex-column flex-md-row flex-lg-row">
<li class="nav-item">
<a class="nav-link {% if request.resolver_match.url_name == 'user_dashboard' %}active{% endif %}" href="{% url 'market:index' %}"><i class="material-icons-outlined mr-2">home</i> Inicio</a>
</li>

{% if global.account %}
{% with "navbar/user_"|add:global.account.template_prefix|add:"_menu.html" as template %}
{% include template with account=account %}
Expand Down
Empty file.
3 changes: 3 additions & 0 deletions templates/navbar/user_provider_menu.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<li class="nav-item">
<a class="nav-link {% if request.resolver_match.url_name == 'user_dashboard' %}active{% endif %}" href="{% url 'market:index' %}"><i class="material-icons-outlined mr-2">home</i> Inicio</a>
</li>
<li class="nav-item">
<a class="nav-link {% if request.resolver_match.url_name == 'provider_detail' %}active{% endif %}" href="{% url 'market:user_account' %}"><i class="material-icons-outlined mr-2">store</i> Mi entidad</a>
</li>
Expand Down
33 changes: 16 additions & 17 deletions templates/user/detail_card.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
{% load market_url %}
{% load settings_value %}


<label>Usuario:</label>
{% if not user %}
<label class="primary-title"></label>Aún no se ha creado usuario"<br>
<label class="primary-title">Enlace de pre-registro</label>
<a href="{% settings_value 'BASESITE_URL' %}{% url 'market:market_dashboard' object.id %}" style="color:blue;" target="_blank">
Preregistro</a><br>
<label class="primary-title"></label>Aún no se ha creado usuario<br>
<a class="btn btn-secondary btn-block mt-2" href="#"> <i class="material-icons mr-2">add</i>Crear usuario </a>
{% else %}
<a href="{% market_url 'auth:user_detail' user.pk %}">{% include "user/row_display.html" %} </a> <br>
<a href="{% market_url 'auth:user_detail' user.pk %}">{% include "user/row_display.html" %} </a> <br>
<label>Fecha de registro</label> {{user.created_at|date:'d/m/Y H:i'}}<br>
<label class="primary-title">Último acceso:</label> {% include "user/last_login.html" %}
{% endif %}
<label>Fecha de registro</label> {{user.created_at|date:'d/m/Y H:i'}}<br>
<label class="primary-title">Último acceso:</label>
{% include "user/last_login.html" %}


{% if user.is_preregistered %}
<hr>
<strong class="text-primary">Prerregistro</strong><br>
El usuario aún no hay completado el registro
<form class="pt-3" method="post" action="{% url 'auth:preregister_send_email' user.preregister.first.id %}">
{% csrf_token %}
<input type="hidden" name="next" value="{% market_url 'auth:user_detail' user.pk %}">
<a class="btn btn-secondary mb-2 copy-clipboard mr-2" href="#" data-clipboard-text="{% url 'auth:preregister' user.preregister.first.id %}"> <i class="material-icons mr-2">link</i>Copiar enlace </a>
<button type="submit" class="btn btn-primary mb-2 copy-clipboard"> <i class="material-icons mr-2">send</i>Reenviar email </button>
</form>
{% endif %}
<strong class="text-primary">Prerregistro</strong><br>
El usuario aún no hay completado el registro
<form class="pt-3" method="post" action="{% url 'auth:preregister_send_email' user.preregister.first.id %}">
{% csrf_token %}
<input type="hidden" name="next" value="{% market_url 'auth:user_detail' user.pk %}">
<a class="btn btn-secondary mb-2 copy-clipboard mr-2" href="#" data-clipboard-text="{% url 'auth:preregister' user.preregister.first.id %}"> <i class="material-icons mr-2">link</i>Copiar enlace </a>
<button type="submit" class="btn btn-primary mb-2 copy-clipboard"> <i class="material-icons mr-2">send</i>Reenviar email </button>
</form>
{% endif %}

0 comments on commit 6d0ece8

Please sign in to comment.