Додані повідомлення та перепрацьована структура застосунку та api

This commit is contained in:
2026-03-15 00:25:10 +02:00
parent 85483b85bb
commit 4bc9c11512
101 changed files with 5763 additions and 2546 deletions

View File

@@ -28,4 +28,12 @@
<div id="home-group-territory-list"></div>
</details>
<details id="details-joint-territory" open style="display: none">
<summary>
<span>Тимчасові території</span>
</summary>
<div id="home-joint-territory-list"></div>
</details>
</div>

View File

@@ -9,6 +9,8 @@ const Home = {
Home.group.house.setHTML();
Home.group.homestead.setHTML();
Home.joint.homestead.setHTML();
}
},
personal: {
@@ -119,6 +121,34 @@ const Home = {
}
}
},
joint: {
homestead: {
list: [],
loadAPI: async () => {
const uuid = localStorage.getItem("uuid");
const URL = `${CONFIG.api}homestead/list?mode=joint`;
const res = await fetch(URL, {
headers: {
"Content-Type": "application/json",
"Authorization": uuid
}
});
Home.joint.homestead.list = await res.json();
return Home.joint.homestead.list;
},
setHTML: async () => {
const list = Home.joint.homestead.list.length > 0
? Home.joint.homestead.list
: await Home.joint.homestead.loadAPI();
if (USER.possibilities.can_view_territory && list.length)
document.getElementById('details-joint-territory').style.display = "";
list.sort((a, b) => b.id - a.id);
Home.renderCards(list, "homestead", "joint");
}
}
},
renderCards: (list, type, block) => {
const container = document.getElementById(`home-${block}-territory-list`);
const fragment = document.createDocumentFragment();
@@ -126,7 +156,7 @@ const Home = {
for (const el of list) {
const card = document.createElement('app-territory-card');
card.image = `${CONFIG.web}cards/${type}/${type === "house" ? "T" : "H"}${el.id}.webp`;
card.address = `${el.title} ${el.number})`;
card.address = `${el.title} ${el.number}`;
card.link = `/territory/card/${type}/${el.id}`;
fragment.appendChild(card);
}

View File

@@ -91,8 +91,9 @@
.page-home #home-personal-territory-list,
.page-home #home-group-territory-list {
width: 100%;
.page-home #home-group-territory-list,
.page-home #home-joint-territory-list {
width: calc(100% - 20px);
margin: 0;
display: flex;
flex-wrap: wrap;