diff --git a/AuthApp/js_views.py b/AuthApp/js_views.py index ae62516..770b269 100644 --- a/AuthApp/js_views.py +++ b/AuthApp/js_views.py @@ -41,11 +41,8 @@ def support_tickets_ajax(request): raise Http404 if request.user.is_staff: - from ChatServiceApp.funcs import get_tickets_for_manager, get_tickets_wo_manager - Dict = { - 'tickets_wo_manager': get_tickets_wo_manager(), - 'tickets_for_manager': get_tickets_for_manager(request.user), - } + from ChatServiceApp.funcs import get_ticketsDict_for_staff + Dict = get_ticketsDict_for_staff(request.user) tpl_name = 'blocks/profile/b_support_chat.html' else: from ChatServiceApp.models import MsgGroup diff --git a/ChatServiceApp/funcs.py b/ChatServiceApp/funcs.py index 6384bce..10b6572 100644 --- a/ChatServiceApp/funcs.py +++ b/ChatServiceApp/funcs.py @@ -1,5 +1,12 @@ from .models import * +def get_ticketsDict_for_staff(user): + Dict = { + 'tickets_wo_manager': get_tickets_wo_manager(), + 'tickets_for_manager': get_tickets_for_manager(user), + } + return Dict + def get_tickets_wo_manager(): tickets = MsgGroup.objects.filter(enable=True, manager=None) diff --git a/ChatServiceApp/js_views.py b/ChatServiceApp/js_views.py index a7a3d5a..8612e13 100644 --- a/ChatServiceApp/js_views.py +++ b/ChatServiceApp/js_views.py @@ -102,6 +102,7 @@ def support_show_chat_by_ticket_ajax(request): Dict = { 'ticket': obj } + Dict.update(get_ticketsDict_for_staff(request.user)) tpl_name = 'blocks/profile/b_support_chat.html' diff --git a/templates/blocks/profile/b_support_chat.html b/templates/blocks/profile/b_support_chat.html index a14ddb4..c21af92 100644 --- a/templates/blocks/profile/b_support_chat.html +++ b/templates/blocks/profile/b_support_chat.html @@ -9,50 +9,52 @@

Техническая поддержка

-
- {{ ticket.name }} -
-
- {% if user.is_staff or ticket.manager %} -
-
- - {{ ticket.manager.last_name }} {{ ticket.manager.first_name }} -
-
- - -
-
- {% endif %} -
- {% if not ticket.rel_messages_for_group.all %} - {% with text=ticket.text modifiedDT=ticket.modifiedDT %} - {% include "widgets/w_message.html" %} - {% endwith %} - {% else %} - {% for msg in ticket.rel_messages_for_group.all %} - {% with text=msg.text modifiedDT=msg.modifiedDT %} + {% if ticket %} +
+ {{ ticket.name }} +
+
+ {% if user.is_staff or ticket.manager %} +
+
+ + {{ ticket.manager.last_name }} {{ ticket.manager.first_name }} +
+
+ + +
+
+ {% endif %} + +
+ {% if not ticket.rel_messages_for_group.all %} + {% with text=ticket.text modifiedDT=ticket.modifiedDT %} {% include "widgets/w_message.html" %} {% endwith %} - {% endfor %} + {% else %} + {% for msg in ticket.rel_messages_for_group.all %} + {% with text=msg.text modifiedDT=msg.modifiedDT %} + {% include "widgets/w_message.html" %} + {% endwith %} + {% endfor %} + {% endif %} +
+ + {% if user.is_staff or ticket.manager %} + {% endif %}
- - {% if user.is_staff or ticket.manager %} - - {% endif %} - -
+ {% endif %} {% if user.is_staff %}
Неразобранные тикеты diff --git a/templates/widgets/w_message.html b/templates/widgets/w_message.html index d2fc8c5..70c22b7 100644 --- a/templates/widgets/w_message.html +++ b/templates/widgets/w_message.html @@ -1,6 +1,6 @@ {% load static %} -
+