Отображение количества тегов в зонах, вычисляется на сервере
This commit is contained in:
parent
66a9cd979b
commit
001f38ab76
@ -0,0 +1,31 @@
|
||||
# Generated by Django 4.2.19 on 2025-04-08 02:18
|
||||
|
||||
import django.contrib.gis.db.models.fields
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eps", "0004_basestation_active"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name="tag",
|
||||
name="alt",
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name="tag",
|
||||
name="lat",
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name="tag",
|
||||
name="lon",
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="tag",
|
||||
name="geo_point",
|
||||
field=django.contrib.gis.db.models.fields.PointField(null=True, srid=4326),
|
||||
),
|
||||
]
|
||||
@ -0,0 +1,27 @@
|
||||
# Generated by Django 4.2.19 on 2025-04-08 02:24
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eps", "0005_remove_tag_alt_remove_tag_lat_remove_tag_lon_and_more"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="tag",
|
||||
name="date_time",
|
||||
field=models.DateTimeField(
|
||||
blank=True, null=True, verbose_name="Время (3d)"
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="tag",
|
||||
name="date_time_street",
|
||||
field=models.DateTimeField(
|
||||
blank=True, null=True, verbose_name="Время (Улица)"
|
||||
),
|
||||
),
|
||||
]
|
||||
@ -2,8 +2,7 @@ from typing import Any
|
||||
|
||||
from apps.base.base_service import BaseService
|
||||
from apps.eps.models.zone.model_zones import Zone
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
from django.contrib.gis.db import models
|
||||
|
||||
|
||||
class Tag(models.Model):
|
||||
@ -31,20 +30,15 @@ class Tag(models.Model):
|
||||
y = models.FloatField(default=0.0, help_text="", verbose_name="y") # noqa: VNE001
|
||||
z = models.FloatField(default=0.0, help_text="", verbose_name="z") # noqa: VNE001
|
||||
# Уличные координаты
|
||||
lat = models.FloatField(default=0.0, verbose_name="lat")
|
||||
lon = models.FloatField(default=0.0, verbose_name="lon")
|
||||
alt = models.FloatField(default=0.0, verbose_name="alt")
|
||||
|
||||
geo_point = models.PointField(null=True)
|
||||
date_time = models.DateTimeField(
|
||||
auto_now=False,
|
||||
default=timezone.now,
|
||||
verbose_name="Время (3d)",
|
||||
null=True,
|
||||
blank=True,
|
||||
)
|
||||
date_time_street = models.DateTimeField(
|
||||
auto_now=False,
|
||||
default=timezone.now,
|
||||
verbose_name="Время (Улица)",
|
||||
null=True,
|
||||
blank=True,
|
||||
@ -77,6 +71,14 @@ class Tag(models.Model):
|
||||
else:
|
||||
return "Не назначен"
|
||||
|
||||
@property
|
||||
def lat(self) -> str:
|
||||
return self.geo_point.coords[1]
|
||||
|
||||
@property
|
||||
def lon(self) -> str:
|
||||
return self.geo_point.coords[0]
|
||||
|
||||
def to_dict(self) -> dict:
|
||||
return {
|
||||
"id": self.id,
|
||||
@ -84,7 +86,6 @@ class Tag(models.Model):
|
||||
"sn": self.sn,
|
||||
"lat": self.lat,
|
||||
"lon": self.lon,
|
||||
"alt": self.alt,
|
||||
"date_time": (
|
||||
BaseService.convert_to_local_time(self.date_time_street).strftime(
|
||||
"%d.%m.%Y %H:%M:%S"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from apps.main.models.model_building import Building
|
||||
from apps.main.models.model_zone import StreetZone
|
||||
from apps.main.models.model_street_zone import StreetZone
|
||||
from django.contrib.gis import admin
|
||||
from django.contrib.gis.admin import GISModelAdmin
|
||||
|
||||
|
||||
42
positioning/apps/main/migrations/0002_streetzone.py
Normal file
42
positioning/apps/main/migrations/0002_streetzone.py
Normal file
@ -0,0 +1,42 @@
|
||||
# Generated by Django 4.2.19 on 2025-04-07 09:12
|
||||
|
||||
import django.contrib.gis.db.models.fields
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("main", "0001_initial"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="StreetZone",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("name", models.CharField(max_length=128)),
|
||||
(
|
||||
"polygon",
|
||||
django.contrib.gis.db.models.fields.PolygonField(srid=4326),
|
||||
),
|
||||
("active", models.BooleanField(default=True)),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "уличная зона",
|
||||
"verbose_name_plural": "уличные зоны",
|
||||
"ordering": ["name"],
|
||||
"indexes": [
|
||||
models.Index(fields=["name"], name="main_street_name_1a1e69_idx")
|
||||
],
|
||||
},
|
||||
),
|
||||
]
|
||||
@ -8,8 +8,10 @@
|
||||
<link rel="stylesheet"
|
||||
href="{% static '/openLayers/theme/map-widgets.css' %}?ver={% settings_value 'APP_VERSION' %}">
|
||||
<link rel="stylesheet" href="{% static '/main/main.css' %}?ver={% settings_value 'APP_VERSION' %}">
|
||||
<link rel="stylesheet" href="{% static '/openLayers/ol-ext/ol-ext.min.css' %}?ver={% settings_value 'APP_VERSION' %}">
|
||||
<link rel="stylesheet" href="{% static '/openLayers/ol-ext/ol-layer-theme.css' %}?ver={% settings_value 'APP_VERSION' %}">
|
||||
<link rel="stylesheet"
|
||||
href="{% static '/openLayers/ol-ext/ol-ext.min.css' %}?ver={% settings_value 'APP_VERSION' %}">
|
||||
<link rel="stylesheet"
|
||||
href="{% static '/openLayers/ol-ext/ol-layer-theme.css' %}?ver={% settings_value 'APP_VERSION' %}">
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
@ -50,7 +52,8 @@
|
||||
|
||||
{% block script_footer %}
|
||||
<script>
|
||||
let polygonsLayer
|
||||
let buildingsLayer
|
||||
let streetZonesLayer
|
||||
let workerLayer
|
||||
let baseStationLayer
|
||||
document.addEventListener("DOMContentLoaded", async () => {
|
||||
@ -72,17 +75,29 @@
|
||||
|
||||
mapCore.addLayer(workerLayer, 'dynamic');
|
||||
|
||||
polygonsLayer = new ol.layer.Vector({
|
||||
buildingsLayer = new ol.layer.Vector({
|
||||
source: new ol.source.Vector({
|
||||
url: '{% url 'main:poligon_list_api' %}',
|
||||
url: '{% url 'main:building_list_api' %}',
|
||||
format: new ol.format.GeoJSON(),
|
||||
}),
|
||||
style: polygonBrownStyleFunction,
|
||||
});
|
||||
polygonsLayer.set('title', 'Здания')
|
||||
mapCore.addLayer(polygonsLayer, 'static')
|
||||
buildingsLayer.set('title', 'Здания')
|
||||
mapCore.addLayer(buildingsLayer, 'static')
|
||||
|
||||
let polygonCounts = {};
|
||||
let buildingCounts = {};
|
||||
|
||||
streetZonesLayer = new ol.layer.Vector({
|
||||
source: new ol.source.Vector({
|
||||
url: '{% url 'main:sz_list_api' %}',
|
||||
format: new ol.format.GeoJSON(),
|
||||
}),
|
||||
style: polygonGrayStyleFunction,
|
||||
});
|
||||
streetZonesLayer.set('title', 'Зоны')
|
||||
mapCore.addLayer(streetZonesLayer, 'static')
|
||||
|
||||
let streetZoneCounts = {};
|
||||
|
||||
// Кнопка возврата
|
||||
document.getElementById('toStart').addEventListener('click', () => {
|
||||
@ -96,6 +111,7 @@
|
||||
const baseStationManager = new MarkerManager(baseStationLayer, BaseStationStyleFunction);
|
||||
|
||||
mapCore.addLayer(baseStationLayer)
|
||||
|
||||
// Функция для обновления маркеров
|
||||
async function updateMarkers() {
|
||||
// Обновление работников
|
||||
@ -109,14 +125,24 @@
|
||||
workerManager.addMarker(worker.id, [worker.lon, worker.lat], worker);
|
||||
}
|
||||
});
|
||||
const workersInPolygonsData = await fetch('{% url "main:poligon_count_api" %}').then(r => r.json());
|
||||
workersInPolygonsData.items.forEach(item => {
|
||||
polygonCounts[item.id] = item.count;
|
||||
const workersInBuilding = await fetch('{% url "main:building_count_api" %}').then(r => r.json());
|
||||
workersInBuilding.items.forEach(item => {
|
||||
buildingCounts[item.id] = item.count;
|
||||
});
|
||||
polygonsLayer.getSource().forEachFeature(feature => {
|
||||
buildingsLayer.getSource().forEachFeature(feature => {
|
||||
feature.changed();
|
||||
});
|
||||
|
||||
const workersInStreetZones = await fetch('{% url "main:sz_count_api" %}').then(r => r.json());
|
||||
workersInStreetZones.items.forEach(item => {
|
||||
streetZoneCounts[item.id] = item.count;
|
||||
});
|
||||
buildingsLayer.getSource().forEachFeature(feature => {
|
||||
feature.changed();
|
||||
});
|
||||
|
||||
|
||||
|
||||
const baseStationsData = await fetch('{% url "eps:base_stations_list" %}').then(r => r.json());
|
||||
baseStationsData.items.forEach(worker => {
|
||||
if (baseStationManager.markers[worker.id]) {
|
||||
@ -151,6 +177,18 @@
|
||||
})
|
||||
}
|
||||
|
||||
function polygonGrayStyleFunction(feature, resolution) {
|
||||
return new ol.style.Style({
|
||||
stroke: new ol.style.Stroke({
|
||||
color: 'rgb(179,179,179)',
|
||||
width: 2,
|
||||
}),
|
||||
fill: new ol.style.Fill({
|
||||
color: 'rgba(202,202,202,0.6)',
|
||||
}),
|
||||
text: createStreetZoneTextStyle(feature, resolution)
|
||||
});
|
||||
}
|
||||
|
||||
function polygonBrownStyleFunction(feature, resolution) {
|
||||
return new ol.style.Style({
|
||||
@ -161,24 +199,44 @@
|
||||
fill: new ol.style.Fill({
|
||||
color: 'rgba(199,136,10, 0.6)',
|
||||
}),
|
||||
text: createTextStyle(feature, resolution)
|
||||
text: createBuildingTextStyle(feature, resolution)
|
||||
});
|
||||
}
|
||||
|
||||
function getPolygonText(feature) {
|
||||
function getBuildingText(feature) {
|
||||
const polygonId = feature.get('pk');
|
||||
const count = polygonCounts[polygonId] || 0;
|
||||
const count = buildingCounts[polygonId] || 0;
|
||||
return `${feature.get('name')} \n (${count})`;
|
||||
}
|
||||
function getStreetZoneText(feature) {
|
||||
const polygonId = feature.get('pk');
|
||||
const count = streetZoneCounts[polygonId] || 0;
|
||||
return `${feature.get('name')} \n (${count})`;
|
||||
}
|
||||
|
||||
function createTextStyle(feature, resolution) {
|
||||
function createBuildingTextStyle(feature, resolution) {
|
||||
const zoom = mapCore.map.getView().getZoom();
|
||||
const font = 'bold' + ' ' + zoom + 'px' + '/' + '1' + ' ' + 'Arial';
|
||||
return new ol.style.Text({
|
||||
textAlign: 'center',
|
||||
textBaseline: 'middle',
|
||||
font: font,
|
||||
text: getPolygonText(feature),
|
||||
text: getBuildingText(feature),
|
||||
fill: new ol.style.Fill({color: '#000'}),
|
||||
placement: 'point',
|
||||
scale: 1,
|
||||
overflow: 'false',
|
||||
});
|
||||
}
|
||||
|
||||
function createStreetZoneTextStyle(feature, resolution) {
|
||||
const zoom = mapCore.map.getView().getZoom();
|
||||
const font = 'bold' + ' ' + zoom + 'px' + '/' + '1' + ' ' + 'Arial';
|
||||
return new ol.style.Text({
|
||||
textAlign: 'center',
|
||||
textBaseline: 'middle',
|
||||
font: font,
|
||||
text: getStreetZoneText(feature),
|
||||
fill: new ol.style.Fill({color: '#000'}),
|
||||
placement: 'point',
|
||||
scale: 1,
|
||||
|
||||
@ -1,4 +1,9 @@
|
||||
from apps.main.views.views_api import PolygonsApiView, PolygonsTagsCountApiView
|
||||
from apps.main.views.views_api import (
|
||||
BuildingsApiView,
|
||||
BuildingsTagsCountApiView,
|
||||
StreetZoneApiView,
|
||||
StreetZoneTagsCountApiView,
|
||||
)
|
||||
from apps.main.views.views_page import MainIndexView
|
||||
from django.urls import path
|
||||
|
||||
@ -6,10 +11,16 @@ app_name = "main"
|
||||
|
||||
urlpatterns = [
|
||||
path("", MainIndexView.as_view(), name="main_index"),
|
||||
path("buildings/polygons/", PolygonsApiView.as_view(), name="poligon_list_api"),
|
||||
path("buildings/polygons/", BuildingsApiView.as_view(), name="building_list_api"),
|
||||
path(
|
||||
"buildings/polygons/count/",
|
||||
PolygonsTagsCountApiView.as_view(),
|
||||
name="poligon_count_api",
|
||||
BuildingsTagsCountApiView.as_view(),
|
||||
name="building_count_api",
|
||||
),
|
||||
path("street_zones/polygons/", StreetZoneApiView.as_view(), name="sz_list_api"),
|
||||
path(
|
||||
"street_zones/polygons/count/",
|
||||
StreetZoneTagsCountApiView.as_view(),
|
||||
name="sz_count_api",
|
||||
),
|
||||
]
|
||||
|
||||
@ -3,13 +3,15 @@ from datetime import timedelta
|
||||
|
||||
from apps.eps.models.tags.model_tags import Tag
|
||||
from apps.main.models.model_building import Building
|
||||
from apps.main.models.model_street_zone import StreetZone
|
||||
from django.core.serializers import serialize
|
||||
from django.db.models import Count, OuterRef, Subquery
|
||||
from django.http import HttpRequest, JsonResponse
|
||||
from django.utils import timezone
|
||||
from django.views import View
|
||||
|
||||
|
||||
class PolygonsApiView(View):
|
||||
class BuildingsApiView(View):
|
||||
def get(self, request: HttpRequest) -> JsonResponse:
|
||||
data = serialize(
|
||||
"geojson",
|
||||
@ -20,7 +22,7 @@ class PolygonsApiView(View):
|
||||
return JsonResponse(json.loads(data))
|
||||
|
||||
|
||||
class PolygonsTagsCountApiView(View):
|
||||
class BuildingsTagsCountApiView(View):
|
||||
def get(self, request: HttpRequest) -> JsonResponse:
|
||||
buildings = Building.objects.filter(active=True)
|
||||
items: list = []
|
||||
@ -38,3 +40,39 @@ class PolygonsTagsCountApiView(View):
|
||||
tags_count = tags.count()
|
||||
items.append({"id": building.id, "count": tags_count})
|
||||
return JsonResponse(res)
|
||||
|
||||
|
||||
class StreetZoneApiView(View):
|
||||
def get(self, request: HttpRequest) -> JsonResponse:
|
||||
data = serialize(
|
||||
"geojson",
|
||||
StreetZone.objects.filter(active=True),
|
||||
geometry_field="polygon",
|
||||
fields=["name", "pk"],
|
||||
)
|
||||
return JsonResponse(json.loads(data))
|
||||
|
||||
|
||||
class StreetZoneTagsCountApiView(View):
|
||||
def get(self, request: HttpRequest) -> JsonResponse:
|
||||
tags_in_zone = Tag.objects.filter(
|
||||
is_street=True,
|
||||
geo_point__isnull=False,
|
||||
geo_point__within=OuterRef("polygon"),
|
||||
)
|
||||
|
||||
zones_with_tag_counts = StreetZone.objects.annotate(
|
||||
tag_count=Count(Subquery(tags_in_zone.values("id")))
|
||||
)
|
||||
items: list = []
|
||||
|
||||
for zone in zones_with_tag_counts:
|
||||
items.append({"id": zone.id, "count": zone.tag_count})
|
||||
|
||||
res = {
|
||||
"error": "",
|
||||
"status": 0,
|
||||
"total": zones_with_tag_counts.count(),
|
||||
"items": items,
|
||||
}
|
||||
return JsonResponse(res)
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
from typing import Any
|
||||
|
||||
from apps.main.models.model_street_zone import StreetZone
|
||||
from apps.settings.models.model_settings import Settings
|
||||
from django.contrib.gis import forms
|
||||
|
||||
|
||||
class StreetZoneForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = StreetZone
|
||||
fields = ("name", "polygon", "active")
|
||||
labels = {
|
||||
"name": "Наименование",
|
||||
"polygon": "Местоположение",
|
||||
"active": "Активно",
|
||||
}
|
||||
widgets = {
|
||||
"name": forms.TextInput(attrs={"class": "form-control"}),
|
||||
"description": forms.TextInput(attrs={"class": "form-control"}),
|
||||
"polygon": forms.OSMWidget(
|
||||
attrs={
|
||||
"default_lat": Settings.get_settings("map_center_lat"),
|
||||
"default_lon": Settings.get_settings("map_center_lon"),
|
||||
"default_zoom": 16,
|
||||
}
|
||||
),
|
||||
}
|
||||
|
||||
def __init__(self, *args: Any, **kwargs: Any):
|
||||
super().__init__(*args, **kwargs)
|
||||
@ -9,6 +9,12 @@ from apps.management.subsystems.street_pos.views.views_buildings import (
|
||||
BuildingListView,
|
||||
BuildingUpdateView,
|
||||
)
|
||||
from apps.management.subsystems.street_pos.views.views_street_zones import (
|
||||
StreetZoneCreateView,
|
||||
StreetZoneDeleteView,
|
||||
StreetZoneListView,
|
||||
StreetZoneUpdateView,
|
||||
)
|
||||
from django.urls import path
|
||||
|
||||
app_name = "street_pos"
|
||||
@ -30,4 +36,21 @@ urlpatterns = [
|
||||
BuildingDeleteView.as_view(),
|
||||
name="building-delete",
|
||||
),
|
||||
# Уличные зоны
|
||||
path("street_zones/", StreetZoneListView.as_view(), name="sz-list"),
|
||||
path(
|
||||
"street_zones/create/",
|
||||
StreetZoneCreateView.as_view(),
|
||||
name="sz-create",
|
||||
),
|
||||
path(
|
||||
"street_zones/<int:pk>/update/",
|
||||
StreetZoneUpdateView.as_view(),
|
||||
name="sz-update",
|
||||
),
|
||||
path(
|
||||
"street_zones/<int:pk>/delete/",
|
||||
StreetZoneDeleteView.as_view(),
|
||||
name="sz-delete",
|
||||
),
|
||||
]
|
||||
|
||||
@ -0,0 +1,104 @@
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from apps.eps.models.tags.model_tags import Tag
|
||||
from apps.main.models.model_street_zone import StreetZone
|
||||
from apps.management.subsystems.forms.street_pos.street_zone_form import StreetZoneForm
|
||||
from django.contrib import messages
|
||||
from django.db.models import QuerySet
|
||||
from django.http.request import HttpRequest
|
||||
from django.http.response import HttpResponse, HttpResponseRedirect
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views.generic import CreateView, ListView
|
||||
from django.views.generic.edit import DeleteView, UpdateView
|
||||
from mixins.settings_context import SettingsContextMixin
|
||||
|
||||
logger = logging.getLogger("mfss")
|
||||
path_template = "management/street_pos/street_zones/"
|
||||
|
||||
|
||||
class StreetZoneListView(ListView):
|
||||
model: StreetZone = StreetZone
|
||||
template_name: str = f"{path_template}sz_list.html"
|
||||
context_object_name: str = "street_zones"
|
||||
paginate_by: int = 10
|
||||
|
||||
def get_queryset(self) -> QuerySet:
|
||||
queryset: QuerySet = super().get_queryset()
|
||||
search_query: str | None = self.request.GET.get("search")
|
||||
if search_query:
|
||||
queryset = queryset.filter(sn__icontains=search_query)
|
||||
return queryset
|
||||
|
||||
def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
|
||||
context: dict[str, Any] = super().get_context_data(**kwargs)
|
||||
try:
|
||||
context["total_count"] = self.get_queryset().count()
|
||||
context["search_query"] = self.request.GET.get("search", "")
|
||||
context["title"] = "Список уличных зон"
|
||||
context = SettingsContextMixin.update_context_data(context)
|
||||
except Exception as e: # noqa: B902
|
||||
logger.error(f"Ошибка загрузки данных: {str(e)}")
|
||||
messages.error(self.request, _("Ошибка при загрузке данных"))
|
||||
return context
|
||||
|
||||
|
||||
class StreetZoneCreateView(CreateView):
|
||||
model = StreetZone
|
||||
form_class = StreetZoneForm
|
||||
template_name = f"{path_template}sz_form.html"
|
||||
success_url = reverse_lazy("management:street_pos:sz-list")
|
||||
|
||||
def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
|
||||
context = super().get_context_data(**kwargs)
|
||||
context["title"] = _("Добавление новой уличной зоны")
|
||||
context = SettingsContextMixin.update_context_data(context)
|
||||
return context
|
||||
|
||||
|
||||
class StreetZoneUpdateView(UpdateView):
|
||||
model = StreetZone
|
||||
form_class = StreetZoneForm
|
||||
template_name = f"{path_template}sz_form.html"
|
||||
success_url = reverse_lazy("management:street_pos:sz-list")
|
||||
|
||||
def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
|
||||
context = super().get_context_data(**kwargs)
|
||||
context["title"] = _("Редактирование уличной зоны")
|
||||
context = SettingsContextMixin.update_context_data(context)
|
||||
return context
|
||||
|
||||
|
||||
class StreetZoneDeleteView(DeleteView):
|
||||
model = StreetZone
|
||||
template_name = f"{path_template}confirm_delete.html"
|
||||
success_url = reverse_lazy("management:street_pos:sz-list")
|
||||
|
||||
context_object_name = "street_zone"
|
||||
|
||||
def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
|
||||
context = super().get_context_data(**kwargs)
|
||||
context["title"] = _("Удаление уличной зоны")
|
||||
context = SettingsContextMixin.update_context_data(context)
|
||||
return context
|
||||
|
||||
def delete(
|
||||
self, request: HttpRequest, *args: Any, **kwargs: Any
|
||||
) -> HttpResponseRedirect | HttpResponse:
|
||||
try:
|
||||
tag: Tag = self.get_object()
|
||||
response: HttpResponseRedirect = super().delete(request, *args, **kwargs)
|
||||
logger.info(
|
||||
f"Удалена уличная зона: {tag.name} (ID: {tag.pk}) "
|
||||
f"пользователем: {request.user} (ID: {request.user.pk})"
|
||||
)
|
||||
messages.success(request, "Здания успешно удалено")
|
||||
return response
|
||||
except Exception as e: # noqa: B902
|
||||
logger.exception(
|
||||
f"Критическая ошибка при удалении уличной зоны: {str(e)} "
|
||||
f"Пользователь: {request.user} (ID: {request.user.pk})"
|
||||
)
|
||||
messages.error(request, "Произошла непредвиденная ошибка при удалении")
|
||||
return self.get(request, *args, **kwargs)
|
||||
@ -95,6 +95,12 @@
|
||||
<p>Список зданий</p>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="{% url 'management:street_pos:sz-list' %}" class="nav-link pl-1">
|
||||
<i class="far fa-circle nav-icon"></i>
|
||||
<p>Список уличных зон</p>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
<button type="submit" class="btn btn-danger">
|
||||
<i class="fas fa-trash mr-1"></i> Да, удалить
|
||||
</button>
|
||||
<a href="{% url 'management:eps_3d:tags-list' %}" class="btn btn-default float-right">
|
||||
<a href="{% url 'management:street_pos:bs-list' %}" class="btn btn-default float-right">
|
||||
<i class="fas fa-times mr-1"></i> Отмена
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@ -148,6 +148,19 @@
|
||||
});
|
||||
}
|
||||
|
||||
function polygonGrayStyleFunction(feature, resolution) {
|
||||
return new ol.style.Style({
|
||||
stroke: new ol.style.Stroke({
|
||||
color: 'rgb(179,179,179)',
|
||||
width: 2,
|
||||
}),
|
||||
fill: new ol.style.Fill({
|
||||
color: 'rgba(202,202,202,0.6)',
|
||||
}),
|
||||
text: createTextStyle(feature, resolution)
|
||||
});
|
||||
}
|
||||
|
||||
function getPolygonText(feature) {
|
||||
const polygonId = feature.get('pk');
|
||||
const count = polygonCounts[polygonId] || 0;
|
||||
@ -173,7 +186,7 @@
|
||||
window.Map_ = geodjango_polygon.map
|
||||
polygonsLayer = new ol.layer.Vector({
|
||||
source: new ol.source.Vector({
|
||||
url: '{% url 'main:poligon_list_api' %}',
|
||||
url: '{% url 'main:building_list_api' %}',
|
||||
format: new ol.format.GeoJSON(),
|
||||
}),
|
||||
style: polygonBrownStyleFunction,
|
||||
@ -181,7 +194,16 @@
|
||||
|
||||
window.Map_.getLayers().push(polygonsLayer)
|
||||
|
||||
{#mapCore.addLayer(polygonsLayer, 'static')#}
|
||||
streetZonesLayer = new ol.layer.Vector({
|
||||
source: new ol.source.Vector({
|
||||
url: '{% url 'main:sz_list_api' %}',
|
||||
format: new ol.format.GeoJSON(),
|
||||
}),
|
||||
style: polygonGrayStyleFunction,
|
||||
});
|
||||
|
||||
window.Map_.getLayers().push(streetZonesLayer)
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
<button type="submit" class="btn btn-danger">
|
||||
<i class="fas fa-trash mr-1"></i> Да, удалить
|
||||
</button>
|
||||
<a href="{% url 'management:eps_3d:tags-list' %}" class="btn btn-default float-right">
|
||||
<a href="{% url 'management:street_pos:building-list' %}" class="btn btn-default float-right">
|
||||
<i class="fas fa-times mr-1"></i> Отмена
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@ -0,0 +1,60 @@
|
||||
{% extends 'management/management_base.html' %}
|
||||
|
||||
{% block navbar_title %}
|
||||
{{ title|default:"Удаление здания" }}
|
||||
{% endblock navbar_title %}
|
||||
|
||||
{% block content %}
|
||||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1>Подтверждение удаления</h1>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="{% url 'management:index' %}">Главная</a></li>
|
||||
<li class="breadcrumb-item"><a href="{% url 'management:street_pos:sz-list' %}">Тэги</a></li>
|
||||
<li class="breadcrumb-item active">Удаление</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card card-danger">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Вы уверены, что хотите удалить зону "{{ street_zone.name }}"?</h3>
|
||||
</div>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<p><strong>Наименование:</strong> {{ street_zone.name }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="alert alert-warning mt-3">
|
||||
<i class="icon fas fa-exclamation-triangle"></i>
|
||||
Внимание! Это действие невозможно отменить.
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<button type="submit" class="btn btn-danger">
|
||||
<i class="fas fa-trash mr-1"></i> Да, удалить
|
||||
</button>
|
||||
<a href="{% url 'management:street_pos:sz-list' %}" class="btn btn-default float-right">
|
||||
<i class="fas fa-times mr-1"></i> Отмена
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock content %}
|
||||
@ -0,0 +1,246 @@
|
||||
{% extends 'management/management_base.html' %}
|
||||
{% load static %}
|
||||
{% load settings_tag %}
|
||||
{% block navbar_title %}
|
||||
{{ title|default:"Уличная зона" }}
|
||||
{% endblock navbar_title %}
|
||||
{% block header_link %}
|
||||
<link rel="stylesheet"
|
||||
href="{% static '/openLayers/theme/default/ol.css' %}?ver={% settings_value 'APP_VERSION' %}">
|
||||
<script src="{% static '/openLayers/lib/OpenLayers.js' %}?ver={% settings_value 'APP_VER' %}"></script>
|
||||
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1>{% if form.instance.pk %}Редактирование{% else %}Новая{% endif %} уличная зона</h1>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="{% url 'management:index' %}">Главная</a></li>
|
||||
<li class="breadcrumb-item"><a href="{% url 'management:street_pos:sz-list' %}">Список уличных
|
||||
зон</a></li>
|
||||
<li class="breadcrumb-item active">
|
||||
{% if form.instance.pk %}Редактирование{% else %}Создание{% endif %}
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="content">
|
||||
<form method="post" class="form-horizontal" novalidate id="bsForm">
|
||||
{% csrf_token %}
|
||||
{% if form.non_field_errors %}
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="alert alert-danger">
|
||||
{% for error in form.non_field_errors %}
|
||||
<p>{{ error }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<!-- Основные поля -->
|
||||
<div class="form-group row">
|
||||
<label for="{{ form.name.id_for_label }}" class="col-sm-2 col-form-label">
|
||||
Наименование <span class="text-danger">*</span>
|
||||
</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text"
|
||||
name="{{ form.name.name }}"
|
||||
id="{{ form.name.id_for_label }}"
|
||||
class="form-control"
|
||||
placeholder="Введите наименование"
|
||||
value="{{ form.name.value|default:'' }}"
|
||||
maxlength="60">
|
||||
<div class="d-flex justify-content-between align-items-center mt-1">
|
||||
<small class="form-text text-muted">
|
||||
Осталось: <span id="nameCounter">60</span>
|
||||
</small>
|
||||
</div>
|
||||
{% if form.name.errors %}
|
||||
<div class="invalid-feedback d-block">
|
||||
{% for error in form.name.errors %}
|
||||
<p>{{ error }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="{{ form.point.id_for_label }}" class="col-sm-2 col-form-label">
|
||||
Местоположение
|
||||
</label>
|
||||
<div class="col-sm-8">
|
||||
{# Под капотом тянется CDN. Если отвалится - беда в нем #}
|
||||
{{ form.media }}
|
||||
{{ form.polygon }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="{{ form.active.id_for_label }}" class="col-sm-2 col-form-label">
|
||||
Активно
|
||||
</label>
|
||||
<div class="col-sm-8">
|
||||
{{ form.active }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="fas fa-save mr-1"></i> Сохранить
|
||||
</button>
|
||||
<a href="{% url 'management:street_pos:sz-list' %}"
|
||||
class="btn btn-default ml-2">
|
||||
<i class="fas fa-times mr-1"></i> Отмена
|
||||
</a>
|
||||
</div>
|
||||
{% if form.instance.pk %}
|
||||
<div class="col-auto">
|
||||
<a href="{% url 'management:street_pos:sz-delete' form.instance.pk %}"
|
||||
class="btn btn-danger float-right">
|
||||
<i class="fas fa-trash mr-1"></i> Удалить
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
<script>
|
||||
let polygonCounts = {};
|
||||
|
||||
function polygonBrownStyleFunction(feature, resolution) {
|
||||
return new ol.style.Style({
|
||||
stroke: new ol.style.Stroke({
|
||||
color: 'rgb(199,136,10)',
|
||||
width: 2,
|
||||
}),
|
||||
fill: new ol.style.Fill({
|
||||
color: 'rgba(199,136,10, 0.6)',
|
||||
}),
|
||||
text: createTextStyle(feature, resolution)
|
||||
});
|
||||
}
|
||||
|
||||
function polygonGrayStyleFunction(feature, resolution) {
|
||||
return new ol.style.Style({
|
||||
stroke: new ol.style.Stroke({
|
||||
color: 'rgb(179,179,179)',
|
||||
width: 2,
|
||||
}),
|
||||
fill: new ol.style.Fill({
|
||||
color: 'rgba(202,202,202,0.6)',
|
||||
}),
|
||||
text: createTextStyle(feature, resolution)
|
||||
});
|
||||
}
|
||||
|
||||
function getPolygonText(feature) {
|
||||
const polygonId = feature.get('pk');
|
||||
const count = polygonCounts[polygonId] || 0;
|
||||
return feature.get('name');
|
||||
}
|
||||
|
||||
function createTextStyle(feature, resolution) {
|
||||
const zoom = window.Map_.getView().getZoom();
|
||||
const font = 'bold' + ' ' + zoom + 'px' + '/' + '1' + ' ' + 'Arial';
|
||||
return new ol.style.Text({
|
||||
textAlign: 'center',
|
||||
textBaseline: 'middle',
|
||||
font: font,
|
||||
text: getPolygonText(feature),
|
||||
fill: new ol.style.Fill({color: '#000'}),
|
||||
placement: 'point',
|
||||
scale: 1,
|
||||
overflow: 'false',
|
||||
});
|
||||
}
|
||||
|
||||
var geodjango_polygon
|
||||
window.Map_ = geodjango_polygon.map
|
||||
polygonsLayer = new ol.layer.Vector({
|
||||
source: new ol.source.Vector({
|
||||
url: '{% url 'main:building_list_api' %}',
|
||||
format: new ol.format.GeoJSON(),
|
||||
}),
|
||||
style: polygonBrownStyleFunction,
|
||||
});
|
||||
|
||||
window.Map_.getLayers().push(polygonsLayer)
|
||||
|
||||
streetZonesLayer = new ol.layer.Vector({
|
||||
source: new ol.source.Vector({
|
||||
url: '{% url 'main:sz_list_api' %}',
|
||||
format: new ol.format.GeoJSON(),
|
||||
}),
|
||||
style: polygonGrayStyleFunction,
|
||||
});
|
||||
|
||||
window.Map_.getLayers().push(streetZonesLayer)
|
||||
|
||||
{#mapCore.addLayer(polygonsLayer, 'static')#}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
// Поля формы
|
||||
const nameField = document.getElementById('{{ form.name.id_for_label }}');
|
||||
const nameCounter = document.getElementById('nameCounter');
|
||||
const form = document.getElementById('bsForm');
|
||||
// Максимальные длины
|
||||
const MAX_SN_LENGTH = 60;
|
||||
const MAX_NAME_LENGTH = 160;
|
||||
const MAX_DESCR_LENGTH = 100;
|
||||
|
||||
// Функция для подсчета символов
|
||||
function updateCounter(field, counter, maxLength) {
|
||||
const remaining = maxLength - field.value.length;
|
||||
counter.textContent = remaining;
|
||||
if (remaining < 0) {
|
||||
counter.classList.add('text-danger');
|
||||
counter.classList.remove('text-muted');
|
||||
} else {
|
||||
counter.classList.remove('text-danger');
|
||||
counter.classList.add('text-muted');
|
||||
}
|
||||
}
|
||||
|
||||
// Обработчики событий
|
||||
nameField.addEventListener('input', function () {
|
||||
updateCounter(nameField, nameCounter, MAX_NAME_LENGTH);
|
||||
});
|
||||
// Валидация перед отправкой
|
||||
form.addEventListener('submit', function (event) {
|
||||
let isValid = true;
|
||||
if (nameField.value.length > MAX_NAME_LENGTH) {
|
||||
alert('Превышена максимальная длина наименования (160 символов)');
|
||||
nameField.focus();
|
||||
isValid = false;
|
||||
}
|
||||
if (!isValid) {
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
// Инициализация счетчиков
|
||||
updateCounter(nameField, nameCounter, MAX_NAME_LENGTH);
|
||||
});
|
||||
</script>
|
||||
{% endblock content %}
|
||||
@ -0,0 +1,149 @@
|
||||
{% extends 'management/management_base.html' %}
|
||||
|
||||
{% block navbar_title %}
|
||||
{{ title|default:"Здания" }}
|
||||
{% endblock navbar_title %}
|
||||
|
||||
{% block content %}
|
||||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1>Список уличных зон</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{% url 'management:index' %}">Главная</a></li>
|
||||
<li class="breadcrumb-item active">Список уличных зон</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<a href="{% url 'management:street_pos:sz-create' %}"
|
||||
class="btn bg-gradient-primary">
|
||||
<i class="fas fa-plus mr-2"></i>Добавить
|
||||
</a>
|
||||
|
||||
<form method="get" class="form-inline">
|
||||
<div class="input-group input-group-sm">
|
||||
<input type="text"
|
||||
name="search"
|
||||
class="form-control"
|
||||
placeholder="Поиск по имени..."
|
||||
value="{{ search_query }}">
|
||||
<div class="input-group-append">
|
||||
<button type="submit" class="btn btn-default">
|
||||
<i class="fas fa-search"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body table-responsive p-0">
|
||||
<table class="table table-bordered table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Наименование</th>
|
||||
<th>Активность</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for street_zone in street_zones %}
|
||||
<tr>
|
||||
<td class="font-monospace">
|
||||
<a href="{% url 'management:street_pos:sz-update' street_zone.id %}"
|
||||
class="text-primary">
|
||||
{{ street_zone.name|default:"-" }}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
{% if street_zone.active %}
|
||||
<span class="badge badge-md bg-success">Активен</span>
|
||||
{% else %}
|
||||
<span class="badge badge-md bg-danger">Неактивен</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td colspan="7" class="text-center">Нет данных для отображения</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="card-footer clearfix">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div class="text-muted small">
|
||||
{% if page_obj %}
|
||||
Показано <strong>{{ page_obj.start_index }}-{{ page_obj.end_index }}</strong> из
|
||||
<strong>{{ page_obj.paginator.count }}</strong>
|
||||
{% else %}
|
||||
Всего: <strong>{{ tags|length }}</strong>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if page_obj %}
|
||||
<ul class="pagination pagination-sm m-0">
|
||||
{% if page_obj.has_previous %}
|
||||
<li class="page-item">
|
||||
<a class="page-link"
|
||||
href="?page={{ page_obj.previous_page_number }}{% if search_query %}&search={{ search_query }}{% endif %}">
|
||||
«
|
||||
</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="page-item disabled">
|
||||
<span class="page-link">«</span>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% for num in page_obj.paginator.page_range %}
|
||||
{% if page_obj.number == num %}
|
||||
<li class="page-item active">
|
||||
<span class="page-link">{{ num }}</span>
|
||||
</li>
|
||||
{% elif num > page_obj.number|add:'-3' and num < page_obj.number|add:'3' %}
|
||||
<li class="page-item">
|
||||
<a class="page-link"
|
||||
href="?page={{ num }}{% if search_query %}&search={{ search_query }}{% endif %}">
|
||||
{{ num }}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if page_obj.has_next %}
|
||||
<li class="page-item">
|
||||
<a class="page-link"
|
||||
href="?page={{ page_obj.next_page_number }}{% if search_query %}&search={{ search_query }}{% endif %}">
|
||||
»
|
||||
</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="page-item disabled">
|
||||
<span class="page-link">»</span>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{% endblock content %}
|
||||
@ -3,6 +3,7 @@ import datetime
|
||||
from apps.eps.models.tags.model_tagdates import TagDate
|
||||
from apps.eps.models.tags.model_tags import Tag
|
||||
from apps.eps.repositories.tag_repository import TagRepository
|
||||
from django.contrib.gis.geos import Point
|
||||
|
||||
|
||||
class ChirpstackTagsRepository(TagRepository):
|
||||
@ -13,10 +14,12 @@ class ChirpstackTagsRepository(TagRepository):
|
||||
:param rx_info:
|
||||
:return:
|
||||
"""
|
||||
tag.lat = rx_info["location"]["latitude"]
|
||||
tag.lon = rx_info["location"]["longitude"]
|
||||
tag.alt = rx_info["location"]["altitude"]
|
||||
|
||||
point = Point(
|
||||
x=rx_info["location"]["longitude"],
|
||||
y=rx_info["location"]["latitude"],
|
||||
srid=4326,
|
||||
)
|
||||
tag.geo_point = point
|
||||
tag.date_time_street = datetime.datetime.fromisoformat(rx_info["gwTime"])
|
||||
tag.save()
|
||||
self.create_tag_history(tag, rx_info)
|
||||
@ -30,12 +33,17 @@ class ChirpstackTagsRepository(TagRepository):
|
||||
date_time = datetime.datetime.fromisoformat(tag_dict["rxInfo"][0]["gwTime"])
|
||||
|
||||
rx_info = tag_dict["rxInfo"][0]
|
||||
|
||||
point = Point(
|
||||
x=rx_info["location"]["longitude"],
|
||||
y=rx_info["location"]["latitude"],
|
||||
srid=4326,
|
||||
)
|
||||
|
||||
tag = Tag.objects.create(
|
||||
name=tag_dict["deviceInfo"]["deviceName"],
|
||||
sn=tag_dict["deviceInfo"]["deviceName"],
|
||||
lat=rx_info["location"]["latitude"],
|
||||
lon=rx_info["location"]["longitude"],
|
||||
alt=rx_info["location"]["altitude"],
|
||||
geo_point=point,
|
||||
date_time_street=date_time,
|
||||
is_street=True,
|
||||
)
|
||||
@ -53,7 +61,6 @@ class ChirpstackTagsRepository(TagRepository):
|
||||
tag=tag,
|
||||
x=rx_info["location"]["latitude"],
|
||||
y=rx_info["location"]["longitude"],
|
||||
z=rx_info["location"]["altitude"],
|
||||
time=date_time,
|
||||
street=True,
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user