Додана сторінка "Розклад зібрань"

Перероблен генератор карточок територій APІ
This commit is contained in:
2025-11-22 20:17:50 +02:00
parent 04f39da611
commit 4b96ef0806
50 changed files with 1486 additions and 494 deletions

View File

@@ -8,11 +8,9 @@ const Territory_list = {
selectStatus.value = territory_list_filter;
if (USER.mode == 2) {
document.getElementById("buttons-list").style.display = "flex";
document.getElementById("historyButton").style.display = "";
}
if (USER.possibilities.can_add_territory) {
document.getElementById("buttons-list").style.display = "flex";
document.getElementById("constructorButton").style.display = "";
}
@@ -64,11 +62,14 @@ const Territory_list = {
const url = `${CONFIG.api}houses/list${territory_entrances ? '/entrances' : ''}`;
let list = this.list.length > 0 ? this.list : await this.loadAPI(url);
const isEnd = territory_list_filter === "2";
const field = isEnd ? "end" : "start";
const compare = {
"1": (a, b) => this.compareAB(a, b, territory_entrances, 'asc'),
"2": (a, b) => this.compareAB(a, b, territory_entrances, 'desc'),
"3": (a, b) => a.history?.date?.start - b.history?.date?.start,
"4": (a, b) => b.history?.date?.start - a.history?.date?.start,
"3": (a, b) => (a.history?.date?.[field] ?? 0) - (b.history?.date?.[field] ?? 0),
"4": (a, b) => (b.history?.date?.[field] ?? 0) - (a.history?.date?.[field] ?? 0),
}[sort_mode] ?? ((a, b) => a.id - b.id);
list.sort(compare);
@@ -120,7 +121,7 @@ const Territory_list = {
return `
<div class="card">
<i style="background-image: url(https://sheep-service.com/cards/house/T${element.house.id}.webp);"></i>
<i style="background-image: url(${CONFIG.web}cards/house/T${element.house.id}.webp);"></i>
<div class="contents">
<div class="info">
<div>
@@ -140,7 +141,7 @@ const Territory_list = {
const progress = ((work / qty) * 100).toFixed(1);
return `
<div class="card">
<i style="background-image: url(https://sheep-service.com/cards/house/T${element.id}.webp);"></i>
<i style="background-image: url(${CONFIG.web}cards/house/T${element.id}.webp);"></i>
<div class="contents">
<div class="info">
<div>
@@ -225,7 +226,7 @@ const Territory_list = {
return `
<div class="card">
<i style="background-image: url(https://sheep-service.com/cards/homestead/H${element.id}.webp);"></i>
<i style="background-image: url(${CONFIG.web}cards/homestead/H${element.id}.webp);"></i>
<div class="contents">
<div class="info">
<div>