diff --git a/RoutesApp/js_views.py b/RoutesApp/js_views.py index 1b90049..517aaed 100644 --- a/RoutesApp/js_views.py +++ b/RoutesApp/js_views.py @@ -6,6 +6,9 @@ from django.conf import settings from django.shortcuts import render from uuid import uuid1 + +from twisted.web.http import stringToDatetime + from .models import * from django.contrib import auth from django.http import HttpResponse, Http404, JsonResponse @@ -195,7 +198,9 @@ def edit_route_ajax(request): print(msg) return JsonResponse({'errors': msg}) - html = render_to_string('blocks/profile/b_new_route.html', Dict, request=request) + tpl_name = f'v2/blocks/b_create_{ route.owner_type }_route.html' + + html = render_to_string(tpl_name, Dict, request=request) res_Dict = { 'html': html, 'btn_title': _('Сохранить изменения') diff --git a/static/v2/js/widgets/w_route_card.js b/static/v2/js/widgets/w_route_card.js index 5f069c3..b96dd5f 100644 --- a/static/v2/js/widgets/w_route_card.js +++ b/static/v2/js/widgets/w_route_card.js @@ -12,7 +12,8 @@ function changeRoute(el) { data: data, data_type: 'json', success: (res) => { - + if (!res.html) return; + $(".info_profile")[0].innerHTML = res.html; }, error: (res) => { } @@ -45,7 +46,7 @@ function deleteRoute(el) { } function raiseRoute(el) { - if (!el) return; + if (!el || el.dataset.actions_count === '0') return; let $parent = el.closest(".w_route_card") if (!$parent) return; @@ -68,7 +69,7 @@ function raiseRoute(el) { } function highlightRoute(el) { - if (!el) return; + if (!el || el.dataset.actions_count === '0') return; let $parent = el.closest(".w_route_card") if (!$parent) return; diff --git a/templates/v2/widgets/w_customer_route_card.html b/templates/v2/widgets/w_customer_route_card.html index 50269e3..508bc18 100644 --- a/templates/v2/widgets/w_customer_route_card.html +++ b/templates/v2/widgets/w_customer_route_card.html @@ -155,13 +155,13 @@
{% trans "Редактировать" %}
-
+
{% trans "Поднять" %}
-
Осталось поднятий: 2
+
Осталось поднятий: {{ used_route_rising_count }}
-
+
{% trans "Выделить цветом" %}
-
Осталось выделений: 0
+
Осталось выделений: {{ used_route_highlight_count }}
{% trans "Удалить" %}