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 @@