-
diff --git a/web/lib/pages/territory/list/script.js b/web/lib/pages/territory/list/script.js
index 052ec4e..2a81e8c 100644
--- a/web/lib/pages/territory/list/script.js
+++ b/web/lib/pages/territory/list/script.js
@@ -39,6 +39,24 @@ const Territory_list = {
Territory_list.homestead.setHTML();
},
+ // Пошук
+ search: {
+ open: () => {
+ const sheepSearchForm = document.getElementById("page-territory-search");
+ const current = sheepSearchForm.dataset.state;
+ sheepSearchForm.dataset.state = current === 'open' ? 'closed' : 'open';
+ },
+ input: (value) => {
+ console.log(value);
+
+ search_value = value?.trim()?.toLowerCase() || "";
+ // Sheeps.sheeps_list.setHTML(search_value);
+
+ Territory_list.house.setHTML(search_value);
+ Territory_list.homestead.setHTML(search_value);
+ }
+ },
+
house: {
url: null,
list: [],
@@ -54,7 +72,7 @@ const Territory_list = {
Territory_list.house.list = await response.json();
return Territory_list.house.list;
},
- setHTML: async function () {
+ setHTML: async function (search_value = null) {
const block = document.getElementById('list-house');
const territory_entrances = localStorage.getItem('territory_list_entrances') === 'true';
const sort_mode = localStorage.getItem('territory_list_sort') ?? "1";
@@ -88,6 +106,11 @@ const Territory_list = {
(territory_list_filter === 2 && qty !== work && !territory_entrances) ||
(territory_list_filter === 2 && element.working === false);
+
+ if (search_value && !element.house.title.toLowerCase().includes(search_value)) {
+ continue; // пропустити, якщо ім'я не містить рядок пошуку
+ }
+
if (statusMatch) {
const card = document.createElement('app-territory-card');
@@ -161,7 +184,7 @@ const Territory_list = {
Territory_list.homestead.list = await response.json();
return Territory_list.homestead.list;
},
- setHTML: async function () {
+ setHTML: async function (search_value = null) {
const block = document.getElementById('list-homestead');
const sortMode = localStorage.getItem('territory_list_sort') ?? "1";
const territory_list_filter = Number(localStorage.getItem("territory_list_filter") ?? 0);
@@ -184,6 +207,10 @@ const Territory_list = {
(territory_list_filter === 1 && element.working) ||
(territory_list_filter === 2 && !element.working);
+ if (search_value && !element.title.toLowerCase().includes(search_value)) {
+ continue; // пропустити, якщо ім'я не містить рядок пошуку
+ }
+
if (statusMatch) {
const working = element.working;
diff --git a/web/lib/pages/territory/list/style.css b/web/lib/pages/territory/list/style.css
index 08576dc..d74485c 100644
--- a/web/lib/pages/territory/list/style.css
+++ b/web/lib/pages/territory/list/style.css
@@ -57,6 +57,7 @@
border-radius: var(--border-radius);
overflow: auto;
display: flex;
+ flex-wrap: wrap;
}
.page-territory>.list-controls select {
@@ -73,6 +74,58 @@
border-radius: calc(var(--border-radius) - 5px - 2px);
}
+.page-territory>.list-controls>button {
+ display: flex;
+ position: relative;
+ background: var(--ColorThemes3);
+ font-size: 18px;
+ cursor: pointer;
+ min-width: 30px;
+ height: 30px;
+ padding: 0;
+ margin-left: calc(100% - 220px);
+ align-items: center;
+ justify-content: center;
+ border-radius: calc(var(--border-radius) - 5px - 2px);
+ border: 1px solid var(--ColorThemes0);
+}
+
+.page-territory>.list-controls>button>svg {
+ width: 25px;
+ height: 25px;
+ fill: var(--ColorThemes0);
+}
+
+#page-territory-search {
+ width: 100%;
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ cursor: pointer;
+ position: relative;
+ z-index: 5;
+ max-height: 0;
+ overflow: hidden;
+ opacity: 0;
+ transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease, padding 0.3s ease;
+}
+
+#page-territory-search[data-state="open"] {
+ max-height: 60px;
+ padding: 15px 0 0 0;
+ opacity: 1;
+}
+
+#page-territory-search input {
+ width: 100%;
+ padding: 0 5px;
+ border-radius: calc(var(--border-radius) - 5px - 4px);
+ height: 30px;
+ background: var(--ColorThemes3);
+ color: var(--ColorThemes0);
+ font-size: var(--FontSize2);
+}
+
#page-territory-sort {
display: flex;
diff --git a/web/lib/pages/territory/manager/index.html b/web/lib/pages/territory/manager/index.html
index c1cf0a5..3afa22f 100644
--- a/web/lib/pages/territory/manager/index.html
+++ b/web/lib/pages/territory/manager/index.html
@@ -95,12 +95,8 @@
-
+
+