diff --git a/web/lib/pages/territory/list/style.css b/web/lib/pages/territory/list/style.css
index 5f8c4d5..91c27ed 100644
--- a/web/lib/pages/territory/list/style.css
+++ b/web/lib/pages/territory/list/style.css
@@ -15,7 +15,7 @@
box-shadow: var(--shadow-l1);
border-radius: var(--border-radius);
overflow: auto;
- display: none;
+ display: flex;
}
.page-territory>.buttons-list>button,
@@ -272,6 +272,7 @@
background-size: cover;
background-position: center;
background-color: var(--PrimaryColor);
+ border-radius: calc(var(--border-radius) - 5px);
}
.page-territory .card>a {
@@ -294,6 +295,7 @@
flex-direction: column;
align-items: stretch;
justify-content: space-between;
+ border-radius: calc(var(--border-radius) - 5px);
}
diff --git a/web/lib/pages/territory/manager/script.js b/web/lib/pages/territory/manager/script.js
index dc25727..4fc9534 100644
--- a/web/lib/pages/territory/manager/script.js
+++ b/web/lib/pages/territory/manager/script.js
@@ -175,22 +175,29 @@ const Territory_Manager = {
`;
- const renderFree = (element, i = 0) => `
-
-
-
${element.title ?? ''}
-
-
-
+ const renderFree = (element, i = 0) => {
+ let name = () => {
+ if(element.history.name == "Групова") return `Групова №${element.history.group_id}`
+ else return element.history.name ?? "..."
+ }
+
+ return `
+
+
+
${element.title ?? ''}
+
+
+
+
+
Територія не опрацьовується
+
Останнє опрацювання:
${formattedDate(element.history.date.end) ?? "..."} (${name()})
+
+
+
+
-
Територія не опрацьовується
-
Останнє опрацювання:
${formattedDate(element.history.date.end) ?? "..."}
-
-
-
-
-
- `;
+ `
+ };
let html = "";
diff --git a/web/lib/pages/territory/map/index.html b/web/lib/pages/territory/map/index.html
new file mode 100644
index 0000000..f3f4a00
--- /dev/null
+++ b/web/lib/pages/territory/map/index.html
@@ -0,0 +1,5 @@
+
+
+
diff --git a/web/lib/pages/territory/map/script.js b/web/lib/pages/territory/map/script.js
new file mode 100644
index 0000000..a007f0e
--- /dev/null
+++ b/web/lib/pages/territory/map/script.js
@@ -0,0 +1,183 @@
+let map_all;
+
+const Territory_Map = {
+ init: async () => {
+ let html = await fetch('/lib/pages/territory/map/index.html').then((response) => response.text());
+ app.innerHTML = html;
+
+ Territory_Map.map.init();
+ Territory_Map.info.setHTML();
+ },
+ info: {
+ loadAPI: async (url) => {
+ const uuid = localStorage.getItem("uuid");
+
+ const response = await fetch(url, {
+ method: 'GET',
+ headers: {
+ "Content-Type": "application/json",
+ "Authorization": uuid
+ }
+ });
+
+ return await response.json();
+ },
+
+ setHTML: async () => {
+ const houses = await Territory_Map.info.loadAPI(`${CONFIG.api}houses/list`);
+ const homestead = await Territory_Map.info.loadAPI(`${CONFIG.api}homestead/list`);
+
+ Territory_Map.map.added({ type: "houses", data: houses });
+ Territory_Map.map.added({ type: "homestead", data: homestead });
+ }
+ },
+ map: {
+ polygons: [],
+
+ init: () => {
+ if (map_all && map_all.remove) map_all.remove();
+
+ const mapElement = document.getElementById('map');
+ if (!mapElement) return;
+
+ let googleHybrid = L.tileLayer('http://{s}.google.com/vt/lyrs=s,h&x={x}&y={y}&z={z}', {
+ maxZoom: 20,
+ minZoom: 15,
+ subdomains: ['mt0', 'mt1', 'mt2', 'mt3']
+ });
+
+ let osm = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
+ });
+
+ let mytile = L.tileLayer('https://sheep-service.com/map/{z}/{x}/{y}.webp', {
+ maxZoom: 20,
+ minZoom: 15,
+ tms: true
+ });
+
+ map_all = L.map(mapElement, {
+ renderer: L.canvas(),
+ center: [49.5629016, 25.6145625],
+ zoom: 17,
+ zoomControl: false,
+ layers: [
+ googleHybrid,
+ osm,
+ mytile
+ ]
+ });
+
+ let baseMaps = {
+ "Google Hybrid": googleHybrid,
+ "OpenStreetMap": osm,
+ "Sheep Service Map": mytile,
+ };
+
+ let layerControl = L.control.layers(baseMaps, [], { position: 'bottomright' }).addTo(map_all);
+
+ map_all.pm.setLang("ua");
+ },
+
+ added: ({ type, data }) => {
+ for (let index = 0; index < data.length; index++) {
+ const element = data[index];
+ let posPersonal, posGroup;
+ let polygonOptions = type === "homestead" ? {
+ color: "#f2bd53",
+ radius: 500,
+ fillOpacity: 0.3,
+ dashArray: '20,15',
+ dashOffset: '20',
+ } : {
+ color: "#585858",
+ fillColor: "#f2bd53",
+ fillOpacity: 0.8
+ };
+
+ if (type === "homestead") {
+ posPersonal = Home.personal.homestead.list.map(e => e.id).indexOf(element.id);
+ posGroup = Home.group.homestead.list.map(e => e.id).indexOf(element.id);
+
+ if (posPersonal != -1 || posGroup != -1) {
+ polygonOptions = {
+ color: "#9a77c9",
+ fradius: 500,
+ fillOpacity: 0.3,
+ dashArray: '20,15',
+ dashOffset: '20',
+ }
+ }
+
+ } else {
+ posPersonal = Home.personal.house.list.map(e => e.id).indexOf(element.id);
+ posGroup = Home.group.house.list.map(e => e.id).indexOf(element.id);
+
+ if (posPersonal != -1 || posGroup != -1) {
+ polygonOptions = {
+ color: "#585858",
+ fillColor: "#9a77c9",
+ fillOpacity: 0.8
+ }
+ }
+ }
+
+ const polygon = L.polygon(element.points, polygonOptions).addTo(map_all);
+
+ polygon.bindPopup("");
+
+ // при открытии popup генерим div заново
+ polygon.on("popupopen", () => {
+ const div = document.createElement("div");
+ let text = () => {
+ if (posPersonal != -1) return "
Моя територія"
+ else if (posGroup != -1) return "
Групова територія"
+ return ""
+ }
+
+ div.innerHTML = `${text()} ${element.title} ${element.number}`;
+ div.className = "leaflet_drop"
+
+ polygon.setPopupContent(div);
+ });
+
+ // Territory_Map.map.polygons[type][element.id] = polygon; // сохраним ссылку на маркер
+ }
+ },
+
+ marker: ({ data, personal = false, group = false }) => {
+ console.log(data);
+
+ for (let index = 0; index < data.length; index++) {
+ const element = data[index];
+
+
+ console.log(element);
+
+ const redDot = L.divIcon({
+ className: "leaflet_drop",
+ html: `
`,
+ iconSize: [16, 16],
+ iconAnchor: [8, 8]
+ });
+
+ // создаём маркер
+ const marker = L.marker([element.geo.lat, element.geo.lng], { icon: redDot }).addTo(map_all);
+ marker.bindPopup("");
+
+ // при открытии popup генерим div заново
+ marker.on("popupopen", () => {
+ const div = document.createElement("div");
+ let text = () => {
+ if (personal) return "Моя територія"
+ else if (group) return "Групова територія"
+ return ""
+ }
+ div.innerHTML = text();
+
+ marker.setPopupContent(div);
+ });
+
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/web/lib/pages/territory/map/style.css b/web/lib/pages/territory/map/style.css
new file mode 100644
index 0000000..0ad68cb
--- /dev/null
+++ b/web/lib/pages/territory/map/style.css
@@ -0,0 +1,11 @@
+.page-territory_map {
+ width: 100%;
+ display: flex;
+ position: relative;
+}
+.page-territory_map>#map {
+ margin: 20px;
+ width: calc(100% - 40px);
+ height: calc(100% - 40px);
+ border-radius: calc(var(--border-radius) - 5px);
+}
\ No newline at end of file
diff --git a/web/lib/router/routes.js b/web/lib/router/routes.js
index 6c2aa76..8e734c3 100644
--- a/web/lib/router/routes.js
+++ b/web/lib/router/routes.js
@@ -3,6 +3,10 @@ Router
pageActive('');
Auth.init();;
})
+ .add('territory/map', function () {
+ pageActive();
+ Territory_Map.init();;
+ })
.add('territory/constructor', function () {
pageActive();
Territory_constructor.init();;
@@ -41,7 +45,7 @@ Router
})
.add('schedule', function () {
pageActive('schedule');
- Schedule.init();;
+ Schedule_list.init();;
})
.add('stand/constructor', function () {
pageActive();
diff --git a/web/map.html b/web/map.html
new file mode 100644
index 0000000..3a83865
--- /dev/null
+++ b/web/map.html
@@ -0,0 +1,199 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Картка плану території
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/web/screenshot.html b/web/screenshot.html
index c02b365..80f790f 100644
--- a/web/screenshot.html
+++ b/web/screenshot.html
@@ -145,7 +145,7 @@
zoom,
zoomControl: false,
});
- let layer = L.tileLayer("https://tm.rozenrod.com/webp/{z}/{x}/{y}.webp", {
+ let layer = L.tileLayer("https://sheep-service.com/map/{z}/{x}/{y}.webp", {
maxZoom: 20,
minZoom: 15,
tms: true,
diff --git a/web/sw.js b/web/sw.js
index 0a54b37..b6b93c2 100644
--- a/web/sw.js
+++ b/web/sw.js
@@ -1,4 +1,4 @@
-const STATIC_CACHE_NAME = 'v2.0.13';
+const STATIC_CACHE_NAME = 'v2.0.40';
const FILES_TO_CACHE = [
'/',
@@ -29,48 +29,67 @@ const FILES_TO_CACHE = [
"/lib/pages/auth/script.js",
"/lib/pages/auth/style.css",
+ "/lib/pages/auth/index.html",
"/lib/pages/home/script.js",
"/lib/pages/home/style.css",
+ "/lib/pages/home/index.html",
"/lib/pages/territory/list/script.js",
"/lib/pages/territory/list/style.css",
+ "/lib/pages/territory/list/index.html",
"/lib/pages/territory/manager/script.js",
"/lib/pages/territory/manager/style.css",
+ "/lib/pages/territory/manager/index.html",
+
+ "/lib/pages/territory/map/script.js",
+ "/lib/pages/territory/map/style.css",
+ "/lib/pages/territory/map/index.html",
"/lib/pages/territory/history/script.js",
"/lib/pages/territory/history/style.css",
+ "/lib/pages/territory/history/index.html",
"/lib/pages/territory/constructor/script.js",
"/lib/pages/territory/constructor/style.css",
+ "/lib/pages/territory/constructor/index.html",
"/lib/pages/territory/editor/script.js",
"/lib/pages/territory/editor/style.css",
+ "/lib/pages/territory/editor/index.html",
"/lib/pages/territory/editor/script.js",
"/lib/pages/territory/editor/style.css",
+ "/lib/pages/territory/editor/index.html",
"/lib/pages/territory/card/script.js",
"/lib/pages/territory/card/style.css",
+ "/lib/pages/territory/card/index.html",
"/lib/pages/options/script.js",
"/lib/pages/options/style.css",
+ "/lib/pages/options/index.html",
"/lib/pages/sheeps/script.js",
"/lib/pages/sheeps/style.css",
+ "/lib/pages/sheeps/index.html",
"/lib/pages/stand/list/script.js",
"/lib/pages/stand/list/style.css",
+ "/lib/pages/stand/list/index.html",
"/lib/pages/stand/card/script.js",
"/lib/pages/stand/card/style.css",
+ "/lib/pages/stand/card/index.html",
"/lib/pages/stand/constructor/script.js",
"/lib/pages/stand/constructor/style.css",
+ "/lib/pages/stand/constructor/index.html",
- "/lib/pages/schedule/script.js",
- "/lib/pages/schedule/style.css",
+ "/lib/pages/schedule/list/script.js",
+ "/lib/pages/schedule/list/style.css",
+ "/lib/pages/schedule/list/index.html",
"/lib/app.js"
];