diff --git a/backend/requests_app/views_front.py b/backend/requests_app/views_front.py index a1c11e10..d5b8f847 100644 --- a/backend/requests_app/views_front.py +++ b/backend/requests_app/views_front.py @@ -185,13 +185,17 @@ class RequestsView(LoginRequiredMixin, TemplateView): # --- фильтры API --- params: Dict[str, Any] = {} - scope = (request.GET.get("view") or "").lower() + scope = (request.GET.get("view") or "").lower().strip() mine_raw = (request.GET.get("mine") or "").strip().lower() + if scope == "mine" or mine_raw in {"1", "true", "yes", "on"}: params["view"] = "mine" scope = "mine" + elif scope == "addressed": + params["addressed_to_me"] = "true" + scope = "addressed" else: - scope = "all" + scope = "" type_ = (request.GET.get("type") or "").strip() status_ = (request.GET.get("status") or "").strip() @@ -218,7 +222,11 @@ class RequestsView(LoginRequiredMixin, TemplateView): "count": None, "scope": scope, "can_process": _user_can_process_requests(request.user), - "filters": {"type": type_, "status": status_, "view": scope}, + "filters": { + "type": type_, + "status": status_, + "view": scope, + }, } ) return ctx @@ -233,7 +241,11 @@ class RequestsView(LoginRequiredMixin, TemplateView): "count": count, "scope": scope, "can_process": _user_can_process_requests(request.user), - "filters": {"type": type_, "status": status_, "view": scope}, + "filters": { + "type": type_, + "status": status_, + "view": scope, + }, } ) @@ -245,7 +257,12 @@ class RequestsView(LoginRequiredMixin, TemplateView): ) if ok_c: comments, _, _, _ = _parse_page_payload(data_c) - ctx.update({"comments_for": int(comments_for), "comments": comments}) + ctx.update( + { + "comments_for": int(comments_for), + "comments": comments, + } + ) else: messages.error( request, diff --git a/backend/static/css/components/request-list.css b/backend/static/css/components/request-list.css index 6d80a8e1..b9805397 100644 --- a/backend/static/css/components/request-list.css +++ b/backend/static/css/components/request-list.css @@ -176,8 +176,6 @@ /* Блок комментариев */ #reqList .comments-block { - border-top: 1px solid color-mix(in srgb, var(--bs-border-color), transparent 70%); - background: color-mix(in srgb, var(--bs-tertiary-bg), transparent 50%); margin: 0; padding: 1rem; margin-left: calc(48px + 0.75rem); /* Выравнивание с содержимым */ diff --git a/backend/static/js/components/requestCommentsHandler.js b/backend/static/js/components/requestCommentsHandler.js index 71564334..6e3137bf 100644 --- a/backend/static/js/components/requestCommentsHandler.js +++ b/backend/static/js/components/requestCommentsHandler.js @@ -35,15 +35,24 @@ export function initRequestCommentsHandler(options) { * @returns {string} HTML строка */ function renderComment(comment) { - const author = (comment.author && + const authorName = (comment.author && (comment.author.full_name || comment.author.display_name || comment.author.username)) || '—'; + const authorId = comment.author?.id; + const authorLink = authorId + ? `/employees/employee/${authorId}/` + : '#'; + const commentDate = esc(comment.created_at || ''); return `
- {{ obj.created_at|format_iso_date:"H:i" }} + {{ obj.created_at|format_iso_date:"d.m.Y" }} {% else %} — {% endif %} @@ -565,8 +564,8 @@ initRequestListPage({ apiListUrl: "{% url 'api:v1:request-list' %}", apiDetailBase: "{% url 'api:v1:request-list' %}", - commentsUrlTemplate: "{% url 'requests:request_comments' 0 %}", - addCommentUrlTemplate: "{% url 'requests:request_comment_add' 0 %}", + commentsUrlTemplate: "/api/v1/requests/0/comments/", + addCommentUrlTemplate: "/api/v1/requests/0/comments/", autoShowComments: {% if comments_for %}true{% else %}false{% endif %} });