Skip to content

Commit

Permalink
fix: templates
Browse files Browse the repository at this point in the history
  • Loading branch information
francesco-filicetti committed Jun 7, 2024
1 parent 963dc00 commit fd5427e
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 3 deletions.
1 change: 1 addition & 0 deletions uniticket/uni_ticket/templatetags/uni_ticket_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ def uni_ticket_settings_value(name, **kwargs):

@register.simple_tag
def obj_get_attr(obj, attr, **kwargs):
if type(obj) == dict: return obj.get(attr, None)
return getattr(obj, attr, None)


Expand Down
7 changes: 4 additions & 3 deletions uniticket/uni_ticket/views/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from uni_ticket.forms import *
from uni_ticket.models import *
from uni_ticket.protocol_utils import ticket_protocol
from uni_ticket.settings import EMPLOYEE_ATTRIBUTE_NAME
from uni_ticket.utils import (
base_context,
custom_message,
Expand Down Expand Up @@ -489,7 +490,7 @@ def office_add_operator(request, structure_slug, office_slug, structure):
all_users = get_user_model().objects.filter(q_filter, is_active=True)\
.values("pk", "taxpayer_id",
"last_name", "first_name",
"email")
"email", EMPLOYEE_ATTRIBUTE_NAME)
paginator = Paginator(all_users, 20)
page = request.GET.get("page")
users = paginator.get_page(page)
Expand Down Expand Up @@ -940,7 +941,7 @@ def category_add_ticket_user(request, structure_slug, category_slug, structure):
all_users = get_user_model().objects.filter(q_filter, is_active=True)\
.values("pk", "taxpayer_id",
"last_name", "first_name",
"email")
"email", EMPLOYEE_ATTRIBUTE_NAME)
paginator = Paginator(all_users, 20)
page = request.GET.get("page")
users = paginator.get_page(page)
Expand Down Expand Up @@ -3195,7 +3196,7 @@ def manager_settings_add_manager(request, structure_slug, structure):
all_users = get_user_model().objects.filter(q_filter, is_active=True)\
.values("pk", "taxpayer_id",
"last_name", "first_name",
"email")
"email", EMPLOYEE_ATTRIBUTE_NAME)
paginator = Paginator(all_users, 20)
page = request.GET.get("page")
users = paginator.get_page(page)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

{% load i18n %}
{% load static %}
{% load uni_ticket_tags %}

{% block menu_links %}
{% include 'manager/main_menu.html' %}
Expand Down Expand Up @@ -41,6 +42,7 @@
<th>{% trans "Cognome" %}</th>
<th>{% trans "Nome" %}</th>
<th>{% trans "Email" %}</th>
<th>{% trans "Staff" %}</th>
</thead>
<tbody>
{% for user in users %}
Expand All @@ -53,6 +55,19 @@
<td>{{ user.last_name }}</td>
<td>{{ user.first_name }}</td>
<td>{{ user.email }}</td>
<td>
{% uni_ticket_settings_value "EMPLOYEE_ATTRIBUTE_NAME" as employee_attribute_name %}
{% obj_get_attr user employee_attribute_name as user_employee_attribute %}
{% if user_employee_attribute %}
<svg class="mr-2 icon icon-success icon-xs">
<use xlink:href="{% static 'svg/sprite.svg' %}#it-check-circle"></use>
</svg>
{% else %}
<svg class="mr-2 icon icon-danger icon-xs">
<use xlink:href="{% static 'svg/sprite.svg' %}#it-close-circle"></use>
</svg>
{% endif %}
</td>
</tr>
<form method="post">
<div class="modal fade" tabindex="-1" role="dialog" id="addUser{{ forloop.counter0 }}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

{% load i18n %}
{% load static %}
{% load uni_ticket_tags %}

{% block menu_links %}
{% include 'manager/main_menu.html' %}
Expand Down Expand Up @@ -41,6 +42,7 @@
<th>{% trans "Cognome" %}</th>
<th>{% trans "Nome" %}</th>
<th>{% trans "Email" %}</th>
<th>{% trans "Staff" %}</th>
</thead>
<tbody>
{% for user in users %}
Expand All @@ -53,6 +55,19 @@
<td>{{ user.last_name }}</td>
<td>{{ user.first_name }}</td>
<td>{{ user.email }}</td>
<td>
{% uni_ticket_settings_value "EMPLOYEE_ATTRIBUTE_NAME" as employee_attribute_name %}
{% obj_get_attr user employee_attribute_name as user_employee_attribute %}
{% if user_employee_attribute %}
<svg class="mr-2 icon icon-success icon-xs">
<use xlink:href="{% static 'svg/sprite.svg' %}#it-check-circle"></use>
</svg>
{% else %}
<svg class="mr-2 icon icon-danger icon-xs">
<use xlink:href="{% static 'svg/sprite.svg' %}#it-close-circle"></use>
</svg>
{% endif %}
</td>
</tr>
<form method="post">
<div class="modal fade" tabindex="-1" role="dialog" id="addUser{{ forloop.counter0 }}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

{% load i18n %}
{% load static %}
{% load uni_ticket_tags %}

{% block menu_links %}
{% include 'manager/main_menu.html' %}
Expand Down Expand Up @@ -47,6 +48,7 @@
<th>{% trans "Cognome" %}</th>
<th>{% trans "Nome" %}</th>
<th>{% trans "Email" %}</th>
<th>{% trans "Staff" %}</th>
</thead>
<tbody>
{% for user in users %}
Expand All @@ -59,6 +61,19 @@
<td>{{ user.last_name }}</td>
<td>{{ user.first_name }}</td>
<td>{{ user.email }}</td>
<td>
{% uni_ticket_settings_value "EMPLOYEE_ATTRIBUTE_NAME" as employee_attribute_name %}
{% obj_get_attr user employee_attribute_name as user_employee_attribute %}
{% if user_employee_attribute %}
<svg class="mr-2 icon icon-success icon-xs">
<use xlink:href="{% static 'svg/sprite.svg' %}#it-check-circle"></use>
</svg>
{% else %}
<svg class="mr-2 icon icon-danger icon-xs">
<use xlink:href="{% static 'svg/sprite.svg' %}#it-close-circle"></use>
</svg>
{% endif %}
</td>
</tr>
<form method="post">
<div class="modal fade" tabindex="-1" role="dialog" id="addUser{{ forloop.counter0 }}">
Expand Down

0 comments on commit fd5427e

Please sign in to comment.