Змінено директорії
Додано скрипти CRON Поліпшено механізм запису стендів та їх редагування
This commit is contained in:
@@ -27,6 +27,7 @@ const Auth = {
|
||||
localStorage.removeItem("uuid");
|
||||
Router.navigate(`/auth`);
|
||||
} else {
|
||||
Cloud.start();
|
||||
localStorage.setItem("uuid", uuid);
|
||||
Router.navigate(`/`, false);
|
||||
}
|
||||
@@ -42,8 +43,6 @@ const Auth = {
|
||||
if (USER.possibilities.can_manager_territory) document.getElementById("li-territory").style.display = "";
|
||||
if (USER.possibilities.can_view_stand) document.getElementById("li-stand").style.display = "";
|
||||
document.getElementById("li-options").style.display = "";
|
||||
|
||||
Cloud.start();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -6,12 +6,12 @@
|
||||
}
|
||||
|
||||
.page-home details {
|
||||
border-radius: 15px;
|
||||
border-radius: var(--border-radius);
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
margin-bottom: 20px;
|
||||
margin-bottom: 10px;
|
||||
background: var(--ColorThemes1);
|
||||
color: var(--ColorThemes3);
|
||||
border: 1px solid var(--ColorThemes2);
|
||||
@@ -30,20 +30,22 @@
|
||||
content: "";
|
||||
}
|
||||
|
||||
|
||||
.page-home summary {
|
||||
width: calc(100% - 40px);
|
||||
cursor: pointer;
|
||||
color: var(--ColorThemes3);
|
||||
border-radius: var(--border-radius);
|
||||
font-size: var(--FontSize5);
|
||||
font-weight: 300;
|
||||
padding: 20px;
|
||||
position: relative;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.page-home summary span {
|
||||
font-weight: 500;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,31 +68,36 @@
|
||||
width: 300px;
|
||||
height: 200px;
|
||||
background-color: var(--ColorThemes2);
|
||||
margin: 0px 10px 20px 10px;
|
||||
margin: 10px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
@media (max-width: 2300px) {
|
||||
.page-home .card {
|
||||
width: calc((100% / 5) - 30px);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1960px) {
|
||||
.page-home .card {
|
||||
width: calc((100% / 4) - 30px);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1640px) {
|
||||
.page-home .card {
|
||||
width: calc((100% / 3) - 30px);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1280px) {
|
||||
.page-home .card {
|
||||
width: calc((100% / 2) - 30px);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 650px) {
|
||||
.page-home .card {
|
||||
width: 100%;
|
||||
@@ -115,6 +122,7 @@
|
||||
background-position: center;
|
||||
background-color: var(--PrimaryColor);
|
||||
}
|
||||
|
||||
.page-home .card>a {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
@@ -168,6 +176,6 @@
|
||||
font-weight: 400;
|
||||
padding: 10px;
|
||||
z-index: 2;
|
||||
width: 100%;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
@@ -33,122 +33,127 @@ const SheepsEvents = {
|
||||
init() {
|
||||
if (this.initialized) return;
|
||||
|
||||
const sheepEditorForm = document.getElementById("sheep-editor");
|
||||
const sheepEditorButton = document.getElementById('sheep-editor-button');
|
||||
sheepEditorForm.addEventListener("submit", async (event) => {
|
||||
event.preventDefault();
|
||||
document.addEventListener('submit', async (e) => {
|
||||
const editorForm = e.target.closest('#sheep-editor');
|
||||
if (editorForm) {
|
||||
e.preventDefault();
|
||||
const sheepEditorButton = document.getElementById('sheep-editor-button');
|
||||
const form = event.target;
|
||||
const formData = new FormData(form);
|
||||
const uuidValue = form.elements["uuid"].value;
|
||||
const sheep = Sheeps.sheeps_list.list.find(item => item.uuid === uuidValue);
|
||||
|
||||
const form = event.target;
|
||||
const formData = new FormData(form);
|
||||
const uuidValue = form.elements["uuid"].value;
|
||||
const sheep = Sheeps.sheeps_list.list.find(item => item.uuid === uuidValue);
|
||||
if (!sheep) {
|
||||
console.error("Sheep not found for uuid:", uuidValue);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sheep) {
|
||||
console.error("Sheep not found for uuid:", uuidValue);
|
||||
sheep.name = form.elements["name"].value;
|
||||
sheep.group_id = Number(formData.get("group_id"));
|
||||
sheep.mode = formData.get("mode");
|
||||
sheep.mode_title = ["Користувач", "Модератор", "Адміністратор"][sheep.mode] || "Користувач";
|
||||
|
||||
const permKeys = [
|
||||
"can_view_sheeps",
|
||||
"can_view_schedule",
|
||||
"can_view_stand",
|
||||
"can_view_territory",
|
||||
"can_add_sheeps",
|
||||
"can_add_territory",
|
||||
"can_manager_territory",
|
||||
"can_add_stand",
|
||||
"can_manager_stand",
|
||||
"can_add_schedule"
|
||||
];
|
||||
for (const key of permKeys) {
|
||||
sheep.possibilities[key] = form.elements[key].checked;
|
||||
}
|
||||
|
||||
sheepEditorButton.innerText = "Зачекайте...";
|
||||
|
||||
try {
|
||||
const uuid = localStorage.getItem('uuid');
|
||||
const URL = `${CONFIG.api}sheep`;
|
||||
const response = await fetch(URL, {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": uuid
|
||||
},
|
||||
body: JSON.stringify(sheep)
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
sheepEditorButton.innerText = "Успішно збережено";
|
||||
const data = await response.json();
|
||||
console.log(data);
|
||||
|
||||
Sheeps.sheeps_list.list = [];
|
||||
await Sheeps.sheeps_list.setHTML();
|
||||
|
||||
setTimeout(() => {
|
||||
sheepEditorButton.innerText = "Зберегти";
|
||||
}, 3000);
|
||||
} else {
|
||||
console.error('Помилка збереження');
|
||||
sheepEditorButton.innerText = "Помилка збереження";
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
sheepEditorButton.innerText = "Помилка збереження";
|
||||
}
|
||||
|
||||
// тот же код, что был в _onSheepEditorSubmit, но обращаемся к editorForm
|
||||
return;
|
||||
}
|
||||
|
||||
sheep.name = form.elements["name"].value;
|
||||
sheep.group_id = Number(formData.get("group_id"));
|
||||
sheep.mode = formData.get("mode");
|
||||
sheep.mode_title = ["Користувач", "Модератор", "Адміністратор"][sheep.mode] || "Користувач";
|
||||
const addedsForm = e.target.closest('#sheep-addeds');
|
||||
if (addedsForm) {
|
||||
e.preventDefault();
|
||||
const sheepAddedsButton = document.getElementById('sheep-addeds-button');
|
||||
|
||||
const permKeys = [
|
||||
"can_view_sheeps",
|
||||
"can_view_schedule",
|
||||
"can_view_stand",
|
||||
"can_view_territory",
|
||||
"can_add_sheeps",
|
||||
"can_add_territory",
|
||||
"can_manager_territory",
|
||||
"can_add_stand",
|
||||
"can_manager_stand",
|
||||
"can_add_schedule"
|
||||
];
|
||||
for (const key of permKeys) {
|
||||
sheep.possibilities[key] = form.elements[key].checked;
|
||||
}
|
||||
const form = event.target;
|
||||
const formData = new FormData(form);
|
||||
const data = Object.fromEntries(formData.entries());
|
||||
|
||||
sheepEditorButton.innerText = "Зачекайте...";
|
||||
sheepAddedsButton.innerText = "Зачекайте...";
|
||||
|
||||
try {
|
||||
const uuid = localStorage.getItem('uuid');
|
||||
const URL = `${CONFIG.api}sheep`;
|
||||
const response = await fetch(URL, {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": uuid
|
||||
},
|
||||
body: JSON.stringify(sheep)
|
||||
});
|
||||
try {
|
||||
const uuid = localStorage.getItem('uuid');
|
||||
const URL = `${CONFIG.api}sheep`;
|
||||
const response = await fetch(URL, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": uuid
|
||||
},
|
||||
body: JSON.stringify(data)
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
sheepEditorButton.innerText = "Успішно збережено";
|
||||
const data = await response.json();
|
||||
console.log(data);
|
||||
if (response.ok) {
|
||||
sheepAddedsButton.innerText = "Вісника додано";
|
||||
const data = await response.json();
|
||||
console.log(data);
|
||||
|
||||
Sheeps.sheeps_list.list = [];
|
||||
await Sheeps.sheeps_list.setHTML();
|
||||
Sheeps.sheeps_list.list = [];
|
||||
|
||||
setTimeout(() => {
|
||||
sheepEditorButton.innerText = "Зберегти";
|
||||
}, 3000);
|
||||
} else {
|
||||
console.error('Помилка збереження');
|
||||
sheepEditorButton.innerText = "Помилка збереження";
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
sheepEditorButton.innerText = "Помилка збереження";
|
||||
}
|
||||
});
|
||||
const randomNumber = Math.floor(Math.random() * Sheeps_icon.length);
|
||||
|
||||
const sheepAddedsForm = document.getElementById("sheep-addeds");
|
||||
const sheepAddedsButton = document.getElementById('sheep-addeds-button');
|
||||
sheepAddedsForm.addEventListener("submit", async (event) => {
|
||||
event.preventDefault();
|
||||
Sheeps.addeds.close();
|
||||
await Sheeps.editor.setHTML(data.id, randomNumber);
|
||||
|
||||
const form = event.target;
|
||||
const formData = new FormData(form);
|
||||
const data = Object.fromEntries(formData.entries());
|
||||
|
||||
sheepAddedsButton.innerText = "Зачекайте...";
|
||||
|
||||
try {
|
||||
const uuid = localStorage.getItem('uuid');
|
||||
const URL = `${CONFIG.api}sheep`;
|
||||
const response = await fetch(URL, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": uuid
|
||||
},
|
||||
body: JSON.stringify(data)
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
sheepAddedsButton.innerText = "Вісника додано";
|
||||
const data = await response.json();
|
||||
console.log(data);
|
||||
|
||||
Sheeps.sheeps_list.list = [];
|
||||
|
||||
const randomNumber = Math.floor(Math.random() * Sheeps_icon.length);
|
||||
|
||||
Sheeps.addeds.close();
|
||||
await Sheeps.editor.setHTML(data.id, randomNumber);
|
||||
|
||||
setTimeout(() => {
|
||||
sheepAddedsButton.innerText = "Додати";
|
||||
}, 3000);
|
||||
} else {
|
||||
console.error('Помилка додавання');
|
||||
setTimeout(() => {
|
||||
sheepAddedsButton.innerText = "Додати";
|
||||
}, 3000);
|
||||
} else {
|
||||
console.error('Помилка додавання');
|
||||
sheepAddedsButton.innerText = "Помилка додавання";
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
sheepAddedsButton.innerText = "Помилка додавання";
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
sheepAddedsButton.innerText = "Помилка додавання";
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -469,7 +474,7 @@ const Sheeps = {
|
||||
const URL = `${CONFIG.api}house/list?mode=admin&sheep_id=${id}`;
|
||||
const list = await Sheeps.territory.loadAPI(URL);
|
||||
|
||||
if ((USER.possibilities.can_view_territory || USER.mode == 2) && list.length > 0){
|
||||
if ((USER.possibilities.can_view_territory || USER.mode == 2) && list.length > 0) {
|
||||
document.getElementById('editor-blocks-territory').style.display = "";
|
||||
Sheeps.territory.renderCards(list, "house");
|
||||
}
|
||||
@@ -479,7 +484,7 @@ const Sheeps = {
|
||||
const URL = `${CONFIG.api}homestead/list?mode=admin&sheep_id=${id}`;
|
||||
const list = await Sheeps.territory.loadAPI(URL);
|
||||
|
||||
if ((USER.possibilities.can_view_territory || USER.mode == 2) && list.length > 0){
|
||||
if ((USER.possibilities.can_view_territory || USER.mode == 2) && list.length > 0) {
|
||||
document.getElementById('editor-blocks-territory').style.display = "";
|
||||
Sheeps.territory.renderCards(list, "homestead");
|
||||
}
|
||||
|
||||
@@ -2,18 +2,57 @@
|
||||
<!-- <label for="dateSelect">Виберіть дату:</label>
|
||||
<select id="dateSelect"></select> -->
|
||||
|
||||
<details id="stand-info">
|
||||
<summary>Інформація про стенд</summary>
|
||||
<details id="stand-info" open>
|
||||
<summary>
|
||||
<span>Інформація про стенд</span>
|
||||
</summary>
|
||||
<div>
|
||||
<span>Розташування:</span>
|
||||
<p id="stand-info-title">--</p>
|
||||
<span>Розташування:</span>
|
||||
<p id="stand-info-title">--</p>
|
||||
</div>
|
||||
<div>
|
||||
<span>Геолокація:</span>
|
||||
<a id="stand-info-geo">--</a>
|
||||
<span>Геолокація:</span>
|
||||
<a id="stand-info-geo" target="_blank">--</a>
|
||||
</div>
|
||||
<img id="stand-info-image" src="" />
|
||||
</details>
|
||||
|
||||
<div id="stand-schedule"></div>
|
||||
<div id="stand-schedule">
|
||||
<div id="null-list" class="mess-list" data-visible="false">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128">
|
||||
<path
|
||||
d="M15,109.8l48,17c0,0,0,0,0,0c0.1,0,0.2,0.1,0.3,0.1c0.1,0,0.1,0,0.2,0c0.1,0,0.2,0,0.4,0c0,0,0.1,0,0.1,0c0.2,0,0.3,0,0.5,0 c0,0,0.1,0,0.1,0c0.1,0,0.2-0.1,0.3-0.1c0,0,0,0,0,0l48-17c1.2-0.4,2-1.6,2-2.8V73.4l10-3.5c0.8-0.3,1.5-1,1.8-1.8s0.2-1.8-0.3-2.6 l-12-20c0,0,0,0,0-0.1c0-0.1-0.1-0.1-0.1-0.2c0,0,0,0,0-0.1c0,0,0,0,0,0c0-0.1-0.1-0.1-0.1-0.2c0,0-0.1-0.1-0.1-0.1c0,0,0,0-0.1-0.1 c0,0,0,0-0.1,0c-0.1,0-0.1-0.1-0.2-0.1c0,0-0.1-0.1-0.1-0.1c0,0,0,0-0.1,0c0,0-0.1,0-0.1,0c-0.1,0-0.1-0.1-0.2-0.1 c-0.1,0-0.1,0-0.2-0.1c0,0,0,0-0.1,0c0,0,0,0,0,0l-48-17c-0.2-0.1-0.4-0.1-0.6-0.1c0,0-0.1,0-0.1,0c-0.2,0-0.3,0-0.5,0 c-0.1,0-0.1,0-0.2,0c-0.2,0-0.4,0.1-0.6,0.1l-48,17c0,0,0,0,0,0c0,0-0.1,0-0.1,0.1c0,0,0,0,0,0c-0.1,0.1-0.3,0.1-0.4,0.2 c0,0,0,0,0,0c0,0,0,0,0,0c-0.2,0.1-0.4,0.3-0.6,0.5l0,0c0,0-0.1,0.1-0.1,0.1c0,0,0,0,0,0c-0.1,0.1-0.1,0.2-0.2,0.2c0,0,0,0,0,0 c0,0,0,0-0.1,0.1l-12,20C1,66.2,0.9,67.2,1.2,68s1,1.5,1.8,1.8l10,3.5V107C13,108.3,13.8,109.4,15,109.8z M109,104.9l-42,14.9V95.7 c0-1.7-1.3-3-3-3s-3,1.3-3,3v24.1l-42-14.9V75.5l32,11.3c0.3,0.1,0.7,0.2,1,0.2c1,0,2-0.5,2.6-1.5L64,69.8l9.4,15.7 C74,86.5,75,87,76,87c0.3,0,0.7-0.1,1-0.2l32-11.3V104.9z M67,34.2L103,47L67,59.8V34.2z M77.3,80.4l-8.9-14.8l42.2-15l8.9,14.8 L77.3,80.4z M17.3,50.6l42.2,15l-8.9,14.8l-42.2-15L17.3,50.6z"
|
||||
/>
|
||||
</svg>
|
||||
<h3>Доступних днів поки немає</h3>
|
||||
</div>
|
||||
|
||||
<div id="load-list" class="mess-list" data-visible="true">
|
||||
<svg
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
version="1.0"
|
||||
width="64px"
|
||||
height="64px"
|
||||
viewBox="0 0 128 128"
|
||||
xml:space="preserve"
|
||||
>
|
||||
<g>
|
||||
<path
|
||||
d="M64 9.75A54.25 54.25 0 0 0 9.75 64H0a64 64 0 0 1 128 0h-9.75A54.25 54.25 0 0 0 64 9.75z"
|
||||
></path>
|
||||
<animateTransform
|
||||
attributeName="transform"
|
||||
type="rotate"
|
||||
from="0 64 64"
|
||||
to="360 64 64"
|
||||
dur="1400ms"
|
||||
repeatCount="indefinite"
|
||||
></animateTransform>
|
||||
</g>
|
||||
</svg>
|
||||
<h3>Зачекайте ...</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -114,44 +114,6 @@ const Stand_card = {
|
||||
}
|
||||
},
|
||||
|
||||
// update(msg) {
|
||||
// console.log(msg.type, msg.data.id);
|
||||
|
||||
// if (msg.type == "stand_locking") {
|
||||
// const id = msg.data.id;
|
||||
// const el = document.getElementById(`name-${id}`);
|
||||
|
||||
// if (msg.user.id != USER.id) {
|
||||
// el.disabled = true;
|
||||
// el.style.border = "2px solid var(--PrimaryColor);"
|
||||
// el.style.backgroundColor = "red"
|
||||
// }
|
||||
// } else if (msg.type == "stand_unlocking") {
|
||||
// const id = msg.data.id;
|
||||
// const el = document.getElementById(`name-${id}`);
|
||||
// if (msg.user.id != USER.id || !msg.data.sheep_id) {
|
||||
// el.style.border = "";
|
||||
// el.style.backgroundColor = ""
|
||||
// el.removeAttribute('disabled');
|
||||
// }
|
||||
// } else if (msg.type == "stand_update") {
|
||||
// const id = msg.data.id;
|
||||
// const el = document.getElementById(`name-${id}`);
|
||||
// if (msg.data.sheep_id == USER.id) {
|
||||
// el.innerHTML = `<option value=""></option><option selected value="${USER.id}">${USER.name}</option>`;
|
||||
// el.removeAttribute('disabled');
|
||||
// } else if (msg.data.sheep_id == "" || msg.data.sheep_id == null || msg.data.sheep_id == USER.id) {
|
||||
// el.innerHTML = `<option value=""></option><option value="${USER.id}">${USER.name}</option>`;
|
||||
// el.removeAttribute('disabled');
|
||||
// } else {
|
||||
// el.innerHTML = `<option value="${msg.data.sheep_id}">${msg.data.sheep_name}</option>`;
|
||||
// el.disabled = true;
|
||||
// }
|
||||
// el.style.border = "";
|
||||
// el.style.backgroundColor = ""
|
||||
// } else return;
|
||||
// },
|
||||
|
||||
mess: {
|
||||
locking({ id }) {
|
||||
const message = {
|
||||
@@ -235,13 +197,69 @@ const Stand_card = {
|
||||
|
||||
schedule: {
|
||||
list: [],
|
||||
|
||||
genNull() {
|
||||
return `
|
||||
<div id="null-list" class="mess-list" data-visible="false">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128">
|
||||
<path
|
||||
d="M15,109.8l48,17c0,0,0,0,0,0c0.1,0,0.2,0.1,0.3,0.1c0.1,0,0.1,0,0.2,0c0.1,0,0.2,0,0.4,0c0,0,0.1,0,0.1,0c0.2,0,0.3,0,0.5,0 c0,0,0.1,0,0.1,0c0.1,0,0.2-0.1,0.3-0.1c0,0,0,0,0,0l48-17c1.2-0.4,2-1.6,2-2.8V73.4l10-3.5c0.8-0.3,1.5-1,1.8-1.8s0.2-1.8-0.3-2.6 l-12-20c0,0,0,0,0-0.1c0-0.1-0.1-0.1-0.1-0.2c0,0,0,0,0-0.1c0,0,0,0,0,0c0-0.1-0.1-0.1-0.1-0.2c0,0-0.1-0.1-0.1-0.1c0,0,0,0-0.1-0.1 c0,0,0,0-0.1,0c-0.1,0-0.1-0.1-0.2-0.1c0,0-0.1-0.1-0.1-0.1c0,0,0,0-0.1,0c0,0-0.1,0-0.1,0c-0.1,0-0.1-0.1-0.2-0.1 c-0.1,0-0.1,0-0.2-0.1c0,0,0,0-0.1,0c0,0,0,0,0,0l-48-17c-0.2-0.1-0.4-0.1-0.6-0.1c0,0-0.1,0-0.1,0c-0.2,0-0.3,0-0.5,0 c-0.1,0-0.1,0-0.2,0c-0.2,0-0.4,0.1-0.6,0.1l-48,17c0,0,0,0,0,0c0,0-0.1,0-0.1,0.1c0,0,0,0,0,0c-0.1,0.1-0.3,0.1-0.4,0.2 c0,0,0,0,0,0c0,0,0,0,0,0c-0.2,0.1-0.4,0.3-0.6,0.5l0,0c0,0-0.1,0.1-0.1,0.1c0,0,0,0,0,0c-0.1,0.1-0.1,0.2-0.2,0.2c0,0,0,0,0,0 c0,0,0,0-0.1,0.1l-12,20C1,66.2,0.9,67.2,1.2,68s1,1.5,1.8,1.8l10,3.5V107C13,108.3,13.8,109.4,15,109.8z M109,104.9l-42,14.9V95.7 c0-1.7-1.3-3-3-3s-3,1.3-3,3v24.1l-42-14.9V75.5l32,11.3c0.3,0.1,0.7,0.2,1,0.2c1,0,2-0.5,2.6-1.5L64,69.8l9.4,15.7 C74,86.5,75,87,76,87c0.3,0,0.7-0.1,1-0.2l32-11.3V104.9z M67,34.2L103,47L67,59.8V34.2z M77.3,80.4l-8.9-14.8l42.2-15l8.9,14.8 L77.3,80.4z M17.3,50.6l42.2,15l-8.9,14.8l-42.2-15L17.3,50.6z"
|
||||
/>
|
||||
</svg>
|
||||
<h3>Доступних днів поки немає</h3>
|
||||
</div>
|
||||
|
||||
<div id="load-list" class="mess-list" data-visible="false">
|
||||
<svg
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
version="1.0"
|
||||
width="64px"
|
||||
height="64px"
|
||||
viewBox="0 0 128 128"
|
||||
xml:space="preserve"
|
||||
>
|
||||
<g>
|
||||
<path
|
||||
d="M64 9.75A54.25 54.25 0 0 0 9.75 64H0a64 64 0 0 1 128 0h-9.75A54.25 54.25 0 0 0 64 9.75z"
|
||||
></path>
|
||||
<animateTransform
|
||||
attributeName="transform"
|
||||
type="rotate"
|
||||
from="0 64 64"
|
||||
to="360 64 64"
|
||||
dur="1400ms"
|
||||
repeatCount="indefinite"
|
||||
></animateTransform>
|
||||
</g>
|
||||
</svg>
|
||||
<h3>Зачекайте ...</h3>
|
||||
</div>
|
||||
`
|
||||
},
|
||||
|
||||
async setHTML() {
|
||||
const block = document.getElementById('stand-schedule');
|
||||
block.innerHTML = '';
|
||||
block.innerHTML = this.genNull();
|
||||
|
||||
const null_list = document.getElementById('null-list');
|
||||
const load_list = document.getElementById('load-list');
|
||||
|
||||
null_list.setAttribute("data-visible", "false");
|
||||
load_list.setAttribute("data-visible", "true");
|
||||
|
||||
const url = `${CONFIG.api}stand/schedule/list/${Stand_card.id}`;
|
||||
this.list = Stand_card.grouped(await Stand_card.loadAPI(url));
|
||||
|
||||
if (this.list.length == 0) {
|
||||
null_list.setAttribute("data-visible", "true");
|
||||
load_list.setAttribute("data-visible", "false");
|
||||
} else {
|
||||
null_list.setAttribute("data-visible", "false");
|
||||
load_list.setAttribute("data-visible", "false");
|
||||
}
|
||||
|
||||
const fragment = document.createDocumentFragment();
|
||||
|
||||
const createSelect = (sheep) => {
|
||||
@@ -303,14 +321,19 @@ const Stand_card = {
|
||||
textContent: `${formattedDate(timestamp)} • ${formattedDayName(timestamp)}`
|
||||
}));
|
||||
|
||||
const step = day[1]?.[0]?.hour - day[0]?.[0]?.hour || 0.5; // крок між інтервалами
|
||||
|
||||
day.forEach((hour, hourIndex) => {
|
||||
const hourDiv = Object.assign(document.createElement("div"), {
|
||||
id: `hour-${dayIndex}-${hourIndex}`
|
||||
});
|
||||
|
||||
const start = hour[0].hour;
|
||||
const end = start + step;
|
||||
|
||||
hourDiv.appendChild(Object.assign(document.createElement("span"), {
|
||||
className: "time",
|
||||
textContent: `${Stand_card.formatTime(hour[0].hour)}-${Stand_card.formatTime(hour[0].hour + Stand_card.info.list.processing_time)}`
|
||||
textContent: `${Stand_card.formatTime(start)}-${Stand_card.formatTime(end)}`
|
||||
}));
|
||||
|
||||
hour.forEach(sheep => hourDiv.appendChild(createSelect(sheep)));
|
||||
@@ -320,7 +343,7 @@ const Stand_card = {
|
||||
fragment.appendChild(dayDiv);
|
||||
});
|
||||
|
||||
// кнопка добавления
|
||||
// кнопка додавання
|
||||
if (USER.possibilities.can_add_stand) {
|
||||
const btn = Object.assign(document.createElement("button"), {
|
||||
id: "stand-new-button",
|
||||
@@ -332,132 +355,6 @@ const Stand_card = {
|
||||
|
||||
block.appendChild(fragment);
|
||||
}
|
||||
// async setHTML() {
|
||||
// const block_schedule = document.getElementById('stand-schedule');
|
||||
// block_schedule.innerHTML = '';
|
||||
|
||||
// const url = `${CONFIG.api}stand/schedule/list/${Stand_card.id}`;
|
||||
// this.list = Stand_card.grouped(await Stand_card.loadAPI(url));
|
||||
|
||||
// let dayIndex = 0;
|
||||
// for (const day of this.list) {
|
||||
// const timestamp = day[0][0].date;
|
||||
|
||||
// const dayDiv = document.createElement("div");
|
||||
// dayDiv.className = "block-day";
|
||||
// dayDiv.id = `day-${dayIndex}`;
|
||||
|
||||
// const header = document.createElement("h3");
|
||||
// header.textContent = `${formattedDate(timestamp)} • ${formattedDayName(timestamp)}`;
|
||||
// dayDiv.appendChild(header);
|
||||
|
||||
// let hourIndex = 0;
|
||||
// for (const hour of day) {
|
||||
// const hourDiv = document.createElement("div");
|
||||
// hourDiv.id = `hour-${dayIndex}-${hourIndex}`;
|
||||
|
||||
// const span = document.createElement("span");
|
||||
// span.className = "time";
|
||||
// span.textContent = `${Stand_card.formatTime(hour[0].hour)}-${Stand_card.formatTime(hour[0].hour + Stand_card.info.list.processing_time)}`;
|
||||
// hourDiv.appendChild(span);
|
||||
|
||||
// for (const sheep of hour) {
|
||||
// const select = document.createElement("select");
|
||||
// select.id = `name-${sheep.id}`;
|
||||
|
||||
// const emptyOption = document.createElement("option");
|
||||
// emptyOption.value = "";
|
||||
// emptyOption.textContent = " ";
|
||||
// select.appendChild(emptyOption);
|
||||
|
||||
// if (sheep.sheep_id && sheep.sheep_id == USER.id) {
|
||||
// const opt = document.createElement("option");
|
||||
// opt.value = USER.id;
|
||||
// opt.textContent = USER.name;
|
||||
// opt.selected = true;
|
||||
// select.appendChild(opt);
|
||||
|
||||
// // --- Обработчики событий ---
|
||||
// select.addEventListener("focus", () => {
|
||||
// // пользователь начал взаимодействие → блокируем
|
||||
// Stand_card.cloud.mess.locking({ id: sheep.id });
|
||||
// });
|
||||
|
||||
// select.addEventListener("blur", () => {
|
||||
// // пользователь ушёл → разблокируем
|
||||
// Stand_card.cloud.mess.unlocking({ id: sheep.id });
|
||||
// });
|
||||
|
||||
// select.addEventListener("change", () => {
|
||||
// // пользователь выбрал что-то → обновляем
|
||||
// Stand_card.cloud.mess.update({ sheep_id: select.value, id: sheep.id });
|
||||
// });
|
||||
// } else if (sheep.sheep_id && sheep.sheep_id != USER.id) {
|
||||
// const opt = document.createElement("option");
|
||||
// opt.value = sheep.sheep_id;
|
||||
// opt.textContent = sheep.sheep_name;
|
||||
// opt.selected = true;
|
||||
// select.appendChild(opt);
|
||||
|
||||
// // --- Обработчики событий ---
|
||||
// select.addEventListener("focus", () => {
|
||||
// // пользователь начал взаимодействие → блокируем
|
||||
// Stand_card.cloud.mess.locking({ id: sheep.id });
|
||||
// });
|
||||
|
||||
// select.addEventListener("blur", () => {
|
||||
// // пользователь ушёл → разблокируем
|
||||
// Stand_card.cloud.mess.unlocking({ id: sheep.id });
|
||||
// });
|
||||
|
||||
// select.addEventListener("change", () => {
|
||||
// // пользователь выбрал что-то → обновляем
|
||||
// Stand_card.cloud.mess.update({ sheep_id: select.value, id: sheep.id });
|
||||
// });
|
||||
|
||||
// select.disabled = true;
|
||||
// } else {
|
||||
// const opt = document.createElement("option");
|
||||
// opt.value = USER.id;
|
||||
// opt.textContent = USER.name;
|
||||
// select.appendChild(opt);
|
||||
|
||||
// // --- Обработчики событий ---
|
||||
// select.addEventListener("focus", () => {
|
||||
// // пользователь начал взаимодействие → блокируем
|
||||
// Stand_card.cloud.mess.locking({ id: sheep.id });
|
||||
// });
|
||||
|
||||
// select.addEventListener("blur", () => {
|
||||
// // пользователь ушёл → разблокируем
|
||||
// Stand_card.cloud.mess.unlocking({ id: sheep.id });
|
||||
// });
|
||||
|
||||
// select.addEventListener("change", () => {
|
||||
// // пользователь выбрал что-то → обновляем
|
||||
// Stand_card.cloud.mess.update({ sheep_id: select.value, id: sheep.id });
|
||||
// });
|
||||
// }
|
||||
|
||||
// hourDiv.appendChild(select);
|
||||
// }
|
||||
|
||||
// dayDiv.appendChild(hourDiv);
|
||||
// hourIndex++;
|
||||
// }
|
||||
|
||||
// block_schedule.appendChild(dayDiv);
|
||||
// dayIndex++;
|
||||
// }
|
||||
|
||||
// if (USER.possibilities.can_add_stand) {
|
||||
// const btn = document.createElement("button");
|
||||
// btn.id = "stand-new-button";
|
||||
// btn.onclick = () => Stand_card.addStand();
|
||||
// btn.textContent = "Додати стенд(и)";
|
||||
// block_schedule.appendChild(btn);
|
||||
// }
|
||||
// }
|
||||
},
|
||||
|
||||
grouped(list) {
|
||||
|
||||
@@ -19,15 +19,28 @@
|
||||
box-shadow: var(--shadow-l1);
|
||||
}
|
||||
|
||||
.page-stand-card>details summary::-webkit-details-marker,
|
||||
.page-stand-card>details summary::marker {
|
||||
display: none;
|
||||
content: "";
|
||||
}
|
||||
|
||||
.page-stand-card summary {
|
||||
width: calc(100% - 40px);
|
||||
cursor: pointer;
|
||||
color: var(--ColorThemes3);
|
||||
border-radius: var(--border-radius);
|
||||
font-size: var(--FontSize5);
|
||||
font-weight: 300;
|
||||
padding: 20px;
|
||||
position: relative;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.page-stand-card summary span {
|
||||
font-weight: 500;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#stand-info div {
|
||||
@@ -35,7 +48,7 @@
|
||||
flex-direction: row;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
padding: 10px;
|
||||
padding: 0 20px 10px 20px;
|
||||
color: var(--ColorThemes3);
|
||||
align-items: center;
|
||||
}
|
||||
@@ -61,6 +74,7 @@
|
||||
height: auto;
|
||||
aspect-ratio: 16 / 9;
|
||||
background-color: #f2e5c9;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#stand-info img::before {
|
||||
@@ -87,6 +101,31 @@
|
||||
transition: all .2sease 0s;
|
||||
}
|
||||
|
||||
#stand-schedule>.mess-list {
|
||||
height: 200px;
|
||||
display: none;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
|
||||
#stand-schedule>.mess-list[data-visible="true"] {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
#stand-schedule>.mess-list>svg {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
fill: var(--ColorThemes3);
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
#stand-schedule>.mess-list>h3 {
|
||||
font-size: var(--FontSize5);
|
||||
color: var(--ColorThemes3);
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
#stand-schedule>.block-day {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -104,7 +143,7 @@
|
||||
}
|
||||
|
||||
#stand-schedule>.block-day h3 {
|
||||
font-size: 17px;
|
||||
font-size: var(--FontSize5);
|
||||
font-weight: 500;
|
||||
padding: 10px;
|
||||
text-transform: capitalize;
|
||||
@@ -123,8 +162,9 @@
|
||||
}
|
||||
|
||||
#stand-schedule>.block-day div span {
|
||||
min-width: 85px;
|
||||
padding: 0 5px;
|
||||
font-size: var(--FontSize4);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#stand-schedule>.block-day div select {
|
||||
@@ -136,7 +176,9 @@
|
||||
height: 30px;
|
||||
background-color: var(--ColorThemes0);
|
||||
color: var(--ColorThemes3);
|
||||
font-size: var(--FontSize4);
|
||||
}
|
||||
|
||||
#stand-schedule>.block-day div select:disabled {
|
||||
opacity: 0.9 !important;
|
||||
}
|
||||
@@ -150,7 +192,7 @@
|
||||
background-color: var(--ColorThemes2);
|
||||
}
|
||||
|
||||
#stand-schedule> #stand-new-button{
|
||||
#stand-schedule>#stand-new-button {
|
||||
border-radius: 6px;
|
||||
background: var(--PrimaryColor);
|
||||
color: var(--PrimaryColorText);
|
||||
|
||||
@@ -48,20 +48,18 @@
|
||||
<label>Локація розташування</label>
|
||||
<div class="geo-inputs">
|
||||
<input
|
||||
type="number"
|
||||
type="text"
|
||||
id="info-geo_lat"
|
||||
name="geo_lat"
|
||||
required
|
||||
placeholder="49.5601856455014",
|
||||
step="0.01"
|
||||
placeholder="49.5601856455014"
|
||||
/>
|
||||
<input
|
||||
type="number"
|
||||
type="text"
|
||||
id="info-geo_lng"
|
||||
name="geo_lng"
|
||||
required
|
||||
placeholder="25.625626212730406",
|
||||
step="0.01"
|
||||
placeholder="25.625626212730406"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
113
web/lib/pages/stand/editor/index.html
Normal file
113
web/lib/pages/stand/editor/index.html
Normal file
@@ -0,0 +1,113 @@
|
||||
<div class="page-stand-editor">
|
||||
<form id="stand-editor-form">
|
||||
<h1>Редагування місця розташування стенду</h1>
|
||||
|
||||
<div>
|
||||
<label for="info-title">Назва стенду</label>
|
||||
<input type="text" id="info-title" name="title" required />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="info-quantity_sheep"
|
||||
>Кількість вісників, що можуть стояти одночасно</label
|
||||
>
|
||||
<select id="info-quantity_sheep" name="quantity_sheep" required>
|
||||
<option value="2" selected>2 вісника</option>
|
||||
<option value="3">3 вісника</option>
|
||||
<option value="4">4 вісника</option>
|
||||
<option value="5">5 вісників</option>
|
||||
<option value="6">6 вісників</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label>Години початку та кінця служіння</label>
|
||||
<div class="geo-inputs">
|
||||
<input
|
||||
type="number"
|
||||
id="info-hour_start"
|
||||
name="hour_start"
|
||||
required
|
||||
placeholder="10"
|
||||
min="5",
|
||||
step="1"
|
||||
/>
|
||||
<input
|
||||
type="number"
|
||||
id="info-hour_end"
|
||||
name="hour_end"
|
||||
required
|
||||
placeholder="16"
|
||||
max="22",
|
||||
step="1"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label>Локація розташування</label>
|
||||
<div class="geo-inputs">
|
||||
<input
|
||||
type="text"
|
||||
id="info-geo_lat"
|
||||
name="geo_lat"
|
||||
required
|
||||
placeholder="49.5601856455014"
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
id="info-geo_lng"
|
||||
name="geo_lng"
|
||||
required
|
||||
placeholder="25.625626212730406"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="info-processing_time">Час тривалості зміни вісників</label>
|
||||
<select id="info-processing_time" name="processing_time" required>
|
||||
<option value="0.5">30 хвилин</option>
|
||||
<option value="1" selected>1 година</option>
|
||||
<option value="2">2 години</option>
|
||||
<option value="3">3 години</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label>Дні встановлення стенду</label>
|
||||
<div class="week-days">
|
||||
<div class="option checkbox">
|
||||
<input class="custom-checkbox" id="day-0" name="day-0" type="checkbox" />
|
||||
<label for="day-0""> Понеділок: </label>
|
||||
</div>
|
||||
<div class="option checkbox">
|
||||
<input class="custom-checkbox" id="day-1" name="day-1" type="checkbox" />
|
||||
<label for="day-1"> Вівторок: </label>
|
||||
</div>
|
||||
<div class="option checkbox">
|
||||
<input class="custom-checkbox" id="day-2" name="day-2" type="checkbox" />
|
||||
<label for="day-2"> Середа: </label>
|
||||
</div>
|
||||
<div class="option checkbox">
|
||||
<input class="custom-checkbox" id="day-3" name="day-3" type="checkbox" />
|
||||
<label for="day-3"> Четвер: </label>
|
||||
</div>
|
||||
<div class="option checkbox">
|
||||
<input class="custom-checkbox" id="day-4" name="day-4" type="checkbox" />
|
||||
<label for="day-4"> Пʼятниця: </label>
|
||||
</div>
|
||||
<div class="option checkbox">
|
||||
<input class="custom-checkbox" id="day-5" name="day-5" type="checkbox" />
|
||||
<label for="day-5"> Субота: </label>
|
||||
</div>
|
||||
<div class="option checkbox">
|
||||
<input class="custom-checkbox" id="day-6" name="day-6" type="checkbox" />
|
||||
<label for="day-6"> Неділя: </label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit" id="stand-editor-button">Зберегти</button>
|
||||
</form>
|
||||
</div>
|
||||
108
web/lib/pages/stand/editor/script.js
Normal file
108
web/lib/pages/stand/editor/script.js
Normal file
@@ -0,0 +1,108 @@
|
||||
const Stand_editor = {
|
||||
init: async (id) => {
|
||||
let html = await fetch('/lib/pages/stand/editor/index.html').then((response) => response.text());
|
||||
app.innerHTML = html;
|
||||
|
||||
const form = document.getElementById('stand-editor-form');
|
||||
|
||||
Stand_editor.setHTML(id);
|
||||
|
||||
form.addEventListener('submit', (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
let values = {
|
||||
"title": document.getElementById('info-title').value,
|
||||
"quantity_sheep": Number(document.getElementById('info-quantity_sheep').value),
|
||||
"hour_start": Number(document.getElementById('info-hour_start').value),
|
||||
"hour_end": Number(document.getElementById('info-hour_end').value),
|
||||
"geo": [Number(document.getElementById('info-geo_lat').value), Number(document.getElementById('info-geo_lng').value)],
|
||||
"processing_time": Number(document.getElementById('info-processing_time').value)
|
||||
};
|
||||
|
||||
const checkboxes = form.querySelectorAll('input[type="checkbox"][name^="day-"]');
|
||||
let week_days = () => {
|
||||
let a = [];
|
||||
for (const key in checkboxes) {
|
||||
const element = checkboxes[key];
|
||||
if(element.checked) a.push(Number((element.name).replace("day-", "")))
|
||||
}
|
||||
return a
|
||||
}
|
||||
values.week_days = week_days();
|
||||
|
||||
console.log(values);
|
||||
|
||||
Stand_editor.save(values, id);
|
||||
});
|
||||
},
|
||||
|
||||
// Отримання даних з API з авторизацією через UUID
|
||||
async loadAPI(URL) {
|
||||
let uuid = localStorage.getItem("uuid");
|
||||
return await fetch(URL, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": uuid
|
||||
}
|
||||
}).then((response) => response.json());
|
||||
},
|
||||
|
||||
// Встановлення HTML-контенту для редактора залежно від типу об'єкта
|
||||
async setHTML(id) {
|
||||
let list = await this.loadAPI(`${CONFIG.api}stand/${id}`);
|
||||
|
||||
document.getElementById('info-title').value = list.title;
|
||||
document.getElementById('info-quantity_sheep').value = list.quantity_sheep;
|
||||
document.getElementById('info-hour_start').value = list.hour_start;
|
||||
document.getElementById('info-hour_end').value = list.hour_end;
|
||||
document.getElementById('info-geo_lat').value = list.geo[0];
|
||||
document.getElementById('info-geo_lng').value = list.geo[1];
|
||||
document.getElementById('info-processing_time').value = list.processing_time;
|
||||
|
||||
for (let i = 0; i < list.week_days.length; i++) {
|
||||
const element = list.week_days[i];
|
||||
document.getElementById(`day-${element}`).checked = true;
|
||||
}
|
||||
},
|
||||
|
||||
async save(values, id) {
|
||||
const button = document.getElementById('stand-editor-button');
|
||||
|
||||
const uuid = localStorage.getItem('uuid');
|
||||
const URL = `${CONFIG.api}stand/${id}`;
|
||||
await fetch(URL, {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": uuid
|
||||
},
|
||||
body: JSON.stringify(values)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.status == 200) {
|
||||
console.log({ 'setPack': 'ok' });
|
||||
button.innerText = "Стенд відредаговано";
|
||||
|
||||
return response.json()
|
||||
} else {
|
||||
console.log('err');
|
||||
button.innerText = "Помилка при редагуванні";
|
||||
|
||||
return
|
||||
}
|
||||
})
|
||||
.then(data => {
|
||||
console.log(data);
|
||||
// Router.navigate(`/stand/card/${data.id}`);
|
||||
|
||||
setTimeout(() => {
|
||||
button.innerText = "Зберегти";
|
||||
}, 3000);
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
button.innerText = "Помилка при редагуванні";
|
||||
})
|
||||
}
|
||||
}
|
||||
120
web/lib/pages/stand/editor/style.css
Normal file
120
web/lib/pages/stand/editor/style.css
Normal file
@@ -0,0 +1,120 @@
|
||||
.page-stand-editor {
|
||||
width: calc(100% - 40px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
margin: 20px 20px 0 20px;
|
||||
}
|
||||
|
||||
.page-stand-editor>form {
|
||||
border-radius: 10px;
|
||||
width: calc(100% - 40px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
margin-bottom: 20px;
|
||||
background: var(--ColorThemes1);
|
||||
color: var(--ColorThemes3);
|
||||
border: 1px solid var(--ColorThemes2);
|
||||
box-shadow: var(--shadow-l1);
|
||||
padding: 0 20px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.page-stand-editor>form>h1 {
|
||||
width: calc(100% - 40px);
|
||||
color: var(--ColorThemes3);
|
||||
border-radius: var(--border-radius);
|
||||
font-size: var(--FontSize5);
|
||||
font-weight: 300;
|
||||
padding: 20px 0;
|
||||
position: relative;
|
||||
|
||||
}
|
||||
|
||||
.page-stand-editor>form>div {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
margin: 20px 0;
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.page-stand-editor>form>div>label {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
font-size: var(--FontSize1);
|
||||
font-weight: 500;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.page-stand-editor>form>div>select {
|
||||
width: 100%;
|
||||
min-width: 140px;
|
||||
padding: 0 5px;
|
||||
border-radius: calc(var(--border-radius) - 5px - 4px);
|
||||
height: 30px;
|
||||
background-color: var(--ColorThemes0);
|
||||
color: var(--ColorThemes3);
|
||||
}
|
||||
|
||||
.page-stand-editor>form>div>input,
|
||||
.page-stand-editor>form>div>div>input {
|
||||
width: calc(100% - 10px);
|
||||
min-width: 140px;
|
||||
padding: 0 5px;
|
||||
border-radius: 6px;
|
||||
height: 30px;
|
||||
background: var(--ColorThemes0);
|
||||
color: var(--ColorThemes3);
|
||||
font-size: var(--FontSize2);
|
||||
}
|
||||
|
||||
.page-stand-editor>form>div>.geo-inputs {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.page-stand-editor>form>div>.geo-inputs>input {
|
||||
width: calc(50% - 15px);
|
||||
}
|
||||
|
||||
.page-stand-editor>form>div>.week-days {
|
||||
background: var(--ColorThemes0);
|
||||
border-radius: calc(var(--border-radius) - 5px - 4px);
|
||||
width: calc(100% - 15px);
|
||||
padding: 0 5px 0 10px;
|
||||
}
|
||||
|
||||
.page-stand-editor>form>div>.week-days>div {
|
||||
margin: 10px 0;
|
||||
width: 100%;
|
||||
font-size: var(--FontSize3);
|
||||
}
|
||||
|
||||
.page-stand-editor>form>div>.week-days>div>.custom-checkbox+label {
|
||||
font-size: var(--FontSize4);
|
||||
font-weight: 400;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
user-select: none;
|
||||
flex-direction: row-reverse;
|
||||
justify-content: space-between;
|
||||
cursor: pointer;
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.page-stand-editor>form>button {
|
||||
border-radius: 6px;
|
||||
background: var(--PrimaryColor);
|
||||
color: var(--PrimaryColorText);
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
font-size: var(--FontSize3);
|
||||
font-weight: 400;
|
||||
margin: 20px 0;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
@@ -1,282 +0,0 @@
|
||||
<div class="page-stand">
|
||||
<!-- <label for="dateSelect">Виберіть дату:</label>
|
||||
<select id="dateSelect"></select> -->
|
||||
|
||||
<details id="stand-info">
|
||||
<summary>Інформація про стенд</summary>
|
||||
<div>
|
||||
<span>Розташування:</span>
|
||||
<p id="stand-info-title">Тест</p>
|
||||
</div>
|
||||
<div>
|
||||
<span>Геолокація:</span>
|
||||
<p id="stand-info-geo"></p>
|
||||
</div>
|
||||
<img id="stand-info-image" src="" />
|
||||
</details>
|
||||
|
||||
<div id="stand-schedule">
|
||||
<!-- <div class="block-day" id="day-0">
|
||||
<h3>08.08.2025 • Пʼятниця</h3>
|
||||
<div>
|
||||
<span id="time">09:00-10:00</span>
|
||||
<select id="name_1">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_2">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_3">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span id="time">10:00-11:00</span>
|
||||
<select id="name_1">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_2">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_3">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span id="time">11:00-12:00</span>
|
||||
<select id="name_1">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_2">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_3">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span id="time">12:00-13:00</span>
|
||||
<select id="name_1">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_2">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_3">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span id="time">14:00-15:00</span>
|
||||
<select id="name_1">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_2">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_3">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span id="time">15:00-16:00</span>
|
||||
<select id="name_1">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_2">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_3">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span id="time">16:00-17:00</span>
|
||||
<select id="name_1">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_2">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_3">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span id="time">17:00-18:00</span>
|
||||
<select id="name_1">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_2">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_3">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="block-day" id="day-1">
|
||||
<h3>11.08.2025 • Понеділок</h3>
|
||||
<div>
|
||||
<span id="time">09:00-10:00</span>
|
||||
<select id="name_1">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_2">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_3">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span id="time">10:00-11:00</span>
|
||||
<select id="name_1">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_2">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_3">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span id="time">11:00-12:00</span>
|
||||
<select id="name_1">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_2">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_3">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span id="time">12:00-13:00</span>
|
||||
<select id="name_1">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_2">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_3">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span id="time">14:00-15:00</span>
|
||||
<select id="name_1">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_2">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_3">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span id="time">15:00-16:00</span>
|
||||
<select id="name_1">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_2">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_3">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span id="time">16:00-17:00</span>
|
||||
<select id="name_1">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_2">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_3">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span id="time">17:00-18:00</span>
|
||||
<select id="name_1">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_2">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
<select id="name_3">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -20,6 +20,43 @@
|
||||
<span>Доступні стенди</span>
|
||||
</summary>
|
||||
|
||||
<div id="list"></div>
|
||||
<div id="list">
|
||||
<div id="null-list" class="mess-list" data-visible="false">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128">
|
||||
<path
|
||||
d="M15,109.8l48,17c0,0,0,0,0,0c0.1,0,0.2,0.1,0.3,0.1c0.1,0,0.1,0,0.2,0c0.1,0,0.2,0,0.4,0c0,0,0.1,0,0.1,0c0.2,0,0.3,0,0.5,0 c0,0,0.1,0,0.1,0c0.1,0,0.2-0.1,0.3-0.1c0,0,0,0,0,0l48-17c1.2-0.4,2-1.6,2-2.8V73.4l10-3.5c0.8-0.3,1.5-1,1.8-1.8s0.2-1.8-0.3-2.6 l-12-20c0,0,0,0,0-0.1c0-0.1-0.1-0.1-0.1-0.2c0,0,0,0,0-0.1c0,0,0,0,0,0c0-0.1-0.1-0.1-0.1-0.2c0,0-0.1-0.1-0.1-0.1c0,0,0,0-0.1-0.1 c0,0,0,0-0.1,0c-0.1,0-0.1-0.1-0.2-0.1c0,0-0.1-0.1-0.1-0.1c0,0,0,0-0.1,0c0,0-0.1,0-0.1,0c-0.1,0-0.1-0.1-0.2-0.1 c-0.1,0-0.1,0-0.2-0.1c0,0,0,0-0.1,0c0,0,0,0,0,0l-48-17c-0.2-0.1-0.4-0.1-0.6-0.1c0,0-0.1,0-0.1,0c-0.2,0-0.3,0-0.5,0 c-0.1,0-0.1,0-0.2,0c-0.2,0-0.4,0.1-0.6,0.1l-48,17c0,0,0,0,0,0c0,0-0.1,0-0.1,0.1c0,0,0,0,0,0c-0.1,0.1-0.3,0.1-0.4,0.2 c0,0,0,0,0,0c0,0,0,0,0,0c-0.2,0.1-0.4,0.3-0.6,0.5l0,0c0,0-0.1,0.1-0.1,0.1c0,0,0,0,0,0c-0.1,0.1-0.1,0.2-0.2,0.2c0,0,0,0,0,0 c0,0,0,0-0.1,0.1l-12,20C1,66.2,0.9,67.2,1.2,68s1,1.5,1.8,1.8l10,3.5V107C13,108.3,13.8,109.4,15,109.8z M109,104.9l-42,14.9V95.7 c0-1.7-1.3-3-3-3s-3,1.3-3,3v24.1l-42-14.9V75.5l32,11.3c0.3,0.1,0.7,0.2,1,0.2c1,0,2-0.5,2.6-1.5L64,69.8l9.4,15.7 C74,86.5,75,87,76,87c0.3,0,0.7-0.1,1-0.2l32-11.3V104.9z M67,34.2L103,47L67,59.8V34.2z M77.3,80.4l-8.9-14.8l42.2-15l8.9,14.8 L77.3,80.4z M17.3,50.6l42.2,15l-8.9,14.8l-42.2-15L17.3,50.6z"
|
||||
/>
|
||||
</svg>
|
||||
<h3>Доступних днів поки немає</h3>
|
||||
</div>
|
||||
|
||||
<div id="load-list" class="mess-list" data-visible="true">
|
||||
<svg
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
version="1.0"
|
||||
width="64px"
|
||||
height="64px"
|
||||
viewBox="0 0 128 128"
|
||||
xml:space="preserve"
|
||||
>
|
||||
<g>
|
||||
<path
|
||||
d="M64 9.75A54.25 54.25 0 0 0 9.75 64H0a64 64 0 0 1 128 0h-9.75A54.25 54.25 0 0 0 64 9.75z"
|
||||
></path>
|
||||
<animateTransform
|
||||
attributeName="transform"
|
||||
type="rotate"
|
||||
from="0 64 64"
|
||||
to="360 64 64"
|
||||
dur="1400ms"
|
||||
repeatCount="indefinite"
|
||||
></animateTransform>
|
||||
</g>
|
||||
</svg>
|
||||
<h3>Зачекайте ...</h3>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
|
||||
@@ -24,26 +24,56 @@ const Stand_list = {
|
||||
return Stand_list.list;
|
||||
},
|
||||
setHTML: async function () {
|
||||
const block_list = document.getElementById('list');
|
||||
const block = document.getElementById('list');
|
||||
const null_list = document.getElementById('null-list');
|
||||
const load_list = document.getElementById('load-list');
|
||||
|
||||
null_list.setAttribute("data-visible", "false");
|
||||
load_list.setAttribute("data-visible", "true");
|
||||
|
||||
|
||||
const url = `${CONFIG.api}stand/list`;
|
||||
let list = this.list.length > 0 ? this.list : await this.loadAPI(url);
|
||||
|
||||
let html = "";
|
||||
for (const element of list) {
|
||||
html += this.renderCard({ element });
|
||||
}
|
||||
if (list.length == 0) {
|
||||
null_list.setAttribute("data-visible", "true");
|
||||
load_list.setAttribute("data-visible", "false");
|
||||
|
||||
block_list.innerHTML = html;
|
||||
return;
|
||||
} else {
|
||||
null_list.setAttribute("data-visible", "false");
|
||||
load_list.setAttribute("data-visible", "false");
|
||||
|
||||
let html = "";
|
||||
for (const element of list) {
|
||||
html += this.renderCard({ element });
|
||||
}
|
||||
|
||||
block.innerHTML = html;
|
||||
}
|
||||
},
|
||||
renderCard: ({ element }) => {
|
||||
renderCard: ({ element, pack=0 }) => {
|
||||
const images = [
|
||||
['stand_1.png', 'stand_2.png', 'stand_3.png'],
|
||||
['stand_4.png', 'stand_5.png']
|
||||
];
|
||||
const randomImage = images[pack][Math.floor(Math.random() * images[pack].length)];
|
||||
|
||||
const editor = USER.possibilities.can_add_stand
|
||||
? `<a id="editor_button" class="button-edit" data-route title="Змінити графік" href="/stand/editor/${element.id}"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"><path d="M 22.828125 3 C 22.316375 3 21.804562 3.1954375 21.414062 3.5859375 L 19 6 L 24 11 L 26.414062 8.5859375 C 27.195062 7.8049375 27.195062 6.5388125 26.414062 5.7578125 L 24.242188 3.5859375 C 23.851688 3.1954375 23.339875 3 22.828125 3 z M 17 8 L 5.2597656 19.740234 C 5.2597656 19.740234 6.1775313 19.658 6.5195312 20 C 6.8615312 20.342 6.58 22.58 7 23 C 7.42 23.42 9.6438906 23.124359 9.9628906 23.443359 C 10.281891 23.762359 10.259766 24.740234 10.259766 24.740234 L 22 13 L 17 8 z M 4 23 L 3.0566406 25.671875 A 1 1 0 0 0 3 26 A 1 1 0 0 0 4 27 A 1 1 0 0 0 4.328125 26.943359 A 1 1 0 0 0 4.3378906 26.939453 L 4.3632812 26.931641 A 1 1 0 0 0 4.3691406 26.927734 L 7 26 L 5.5 24.5 L 4 23 z"></path></svg></a>`
|
||||
: ``;
|
||||
|
||||
return `
|
||||
<div class="card">
|
||||
<div class="contents">
|
||||
<div class="image">
|
||||
<img src="/img/${randomImage}">
|
||||
</div>
|
||||
<div class="info">
|
||||
<div>
|
||||
<p>${element.title}</p>
|
||||
</div>
|
||||
${editor}
|
||||
</div>
|
||||
</div>
|
||||
<a href="/stand/card/${element.id}" data-route></a>
|
||||
|
||||
@@ -98,14 +98,12 @@
|
||||
content: "";
|
||||
}
|
||||
|
||||
|
||||
.page-stand-list summary {
|
||||
width: calc(100% - 40px);
|
||||
cursor: pointer;
|
||||
color: var(--ColorThemes3);
|
||||
border-radius: var(--border-radius);
|
||||
font-size: var(--FontSize5);
|
||||
font-weight: 300;
|
||||
padding: 20px;
|
||||
position: relative;
|
||||
display: flex;
|
||||
@@ -113,6 +111,11 @@
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.page-stand-list summary span {
|
||||
font-weight: 500;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.page-stand-list #list {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
@@ -126,12 +129,37 @@
|
||||
transition: .3s ease;
|
||||
}
|
||||
|
||||
.page-stand-list #list>.mess-list {
|
||||
height: 200px;
|
||||
display: none;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
|
||||
.page-stand-list #list>.mess-list[data-visible="true"] {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.page-stand-list #list>.mess-list>svg {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
fill: var(--ColorThemes3);
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.page-stand-list #list>.mess-list>h3 {
|
||||
font-size: var(--FontSize5);
|
||||
color: var(--ColorThemes3);
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.page-stand-list .card {
|
||||
position: relative;
|
||||
width: 300px;
|
||||
height: 200px;
|
||||
background-color: var(--ColorThemes2);
|
||||
margin: 0px 10px 20px 10px;
|
||||
margin: 10px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
border-radius: calc(var(--border-radius) - 5px);
|
||||
@@ -196,7 +224,6 @@
|
||||
|
||||
.page-stand-list .card>.contents {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
background: rgb(64 64 64 / 0.7);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
@@ -209,9 +236,30 @@
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.page-stand-list .card>.contents>.image {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.page-stand-list .card>.contents>.image>img {
|
||||
width: 100%;
|
||||
height: 200px;
|
||||
object-fit: cover;
|
||||
filter: brightness(0.9) contrast(80%) saturate(110%) drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.page-stand-list .card>.contents>.image>img {
|
||||
filter: brightness(0.6) contrast(80%) saturate(110%) drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
|
||||
}
|
||||
}
|
||||
|
||||
.page-stand-list .card>.contents>.info {
|
||||
width: calc(100% - 20px);
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
margin: 10px;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.page-stand-list .card>.contents>.info>div {
|
||||
@@ -226,6 +274,7 @@
|
||||
border-radius: calc(var(--border-radius) - 5px - 4px);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
box-shadow: var(--shadow-l1);
|
||||
}
|
||||
|
||||
.page-stand-list .card>.contents>.info>div>span {
|
||||
@@ -241,4 +290,24 @@
|
||||
font-weight: 400;
|
||||
padding: 10px;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.page-stand-list .card>.contents>.info>.button-edit {
|
||||
min-width: 35px;
|
||||
height: 35px;
|
||||
border-radius: calc(var(--border-radius) - 5px - 4px);
|
||||
background: var(--PrimaryColor);
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-left: 10px;
|
||||
z-index: 20;
|
||||
box-shadow: var(--shadow-l1);
|
||||
}
|
||||
|
||||
.page-stand-list .card>.contents>.info>.button-edit>svg {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
fill: var(--PrimaryColorText);
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
const Stand = {
|
||||
schedule: [],
|
||||
init: async () => {
|
||||
let html = await fetch('/lib/pages/stand/index.html').then((response) => response.text());
|
||||
app.innerHTML = html;
|
||||
|
||||
let listDate = [1, 4];
|
||||
|
||||
function generateAvailableDates() {
|
||||
let select = document.getElementById("dateSelect");
|
||||
select.innerHTML = "";
|
||||
|
||||
let today = new Date();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
let months = [today.getMonth(), today.getMonth() + 1];
|
||||
let year = today.getFullYear();
|
||||
|
||||
months.forEach(month => {
|
||||
let date = new Date(year, month, 1);
|
||||
while (date.getMonth() === month) {
|
||||
if (date >= today) {
|
||||
let day = date.getDay();
|
||||
if (listDate.includes(day)) {
|
||||
let option = document.createElement("option");
|
||||
option.value = date.toISOString().split("T")[0];
|
||||
option.textContent = date.toLocaleDateString("uk-UA", {
|
||||
weekday: "long", year: "numeric", month: "long", day: "numeric"
|
||||
});
|
||||
select.appendChild(option);
|
||||
}
|
||||
}
|
||||
date.setDate(date.getDate() + 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// generateAvailableDates();
|
||||
Stand.generator();
|
||||
},
|
||||
generator: () => {
|
||||
let block_schedule = document.getElementById('stand-schedule');
|
||||
|
||||
let html = "";
|
||||
|
||||
let stand = {
|
||||
id: 1,
|
||||
title: "Універсам",
|
||||
geo: { lat: 0, lng: 0 },
|
||||
hour_start: 9,
|
||||
hour_end: 14,
|
||||
quantity_sheep: 2,
|
||||
week_days: [0, 2, 4, 6],
|
||||
processing_time: 0.5,
|
||||
updated_at: null
|
||||
}
|
||||
|
||||
Stand.schedule = [];
|
||||
|
||||
// Кількість годин служіння
|
||||
let stand_length = (stand.hour_end - stand.hour_start) / stand.processing_time;
|
||||
|
||||
for (let z = 0; z < stand.week_days.length; z++) {
|
||||
Stand.schedule.push([]);
|
||||
|
||||
let date = new Date();
|
||||
date.setDate(date.getDate() + stand.week_days[z]);
|
||||
let dayName = date.toLocaleDateString('uk-UA', { weekday: 'long' });
|
||||
|
||||
html += `
|
||||
<div class="block-day" id="day-${z}">
|
||||
<h3>${date.toLocaleDateString()} • ${dayName}</h3>
|
||||
`;
|
||||
|
||||
let stand_date = 1 + stand.week_days[z];
|
||||
|
||||
for (let i = 0; i < stand_length; i++) {
|
||||
let time_now = stand.hour_start + (stand.processing_time * i);
|
||||
let timeFormat = (a) => a > 9 ? a : `0${a}`;
|
||||
|
||||
function formatTime(hours) {
|
||||
let h = Math.floor(hours);
|
||||
let m = (hours % 1 === 0.5) ? "30" : "00";
|
||||
let hh = h.toString().padStart(2, "0");
|
||||
return `${hh}:${m}`;
|
||||
}
|
||||
|
||||
html += `
|
||||
<div id="hour-${z}-${i}">
|
||||
<span class="time">${formatTime(time_now)}-${formatTime(time_now + stand.processing_time)}</span>
|
||||
`;
|
||||
|
||||
for (let q = 0; q < stand.quantity_sheep; q++) {
|
||||
html += `
|
||||
<select id="name">
|
||||
<option value=""></option>
|
||||
<option value="Test">Test</option>
|
||||
</select>
|
||||
`;
|
||||
|
||||
Stand.schedule[z].push({
|
||||
id: (i + z) * stand.quantity_sheep + q,
|
||||
hour: stand.hour_start + (stand.processing_time * i),
|
||||
number_sheep: q,
|
||||
date: stand_date,
|
||||
sheep_id: null,
|
||||
stand_id: stand.id,
|
||||
updated_at: Date.now()
|
||||
});
|
||||
}
|
||||
|
||||
html += `</div>`; // закриваємо hour
|
||||
}
|
||||
|
||||
html += `</div>`; // закриваємо day
|
||||
}
|
||||
|
||||
document.getElementById('stand-info-title').innerText = stand.title;
|
||||
document.getElementById('stand-info-geo').innerHTML = '';
|
||||
document.getElementById('stand-info-image').setAttribute('src', '');
|
||||
|
||||
block_schedule.innerHTML = html;
|
||||
}
|
||||
}
|
||||
@@ -1,148 +0,0 @@
|
||||
.page-stand {
|
||||
width: calc(100% - 40px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin: 20px 20px 0 20px;
|
||||
}
|
||||
|
||||
.page-stand details {
|
||||
border-radius: var(--border-radius);
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
margin-bottom: 20px;
|
||||
background: var(--ColorThemes1);
|
||||
color: var(--ColorThemes3);
|
||||
border: 1px solid var(--ColorThemes2);
|
||||
box-shadow: var(--shadow-l1);
|
||||
}
|
||||
|
||||
.page-stand summary {
|
||||
width: calc(100% - 40px);
|
||||
cursor: pointer;
|
||||
color: var(--ColorThemes3);
|
||||
border-radius: var(--border-radius);
|
||||
font-size: var(--FontSize5);
|
||||
font-weight: 300;
|
||||
padding: 20px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#stand-info div {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
padding: 10px;
|
||||
color: var(--ColorThemes3);
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#stand-info div span {
|
||||
opacity: 0.8;
|
||||
font-weight: 400;
|
||||
font-size: var(--FontSize2);
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
#stand-info div p {
|
||||
font-weight: 300;
|
||||
font-size: var(--FontSize4);
|
||||
}
|
||||
|
||||
#stand-info img {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: calc(100% - 20px);
|
||||
border-radius: calc(var(--border-radius) - 8px);
|
||||
margin: 10px;
|
||||
height: auto;
|
||||
aspect-ratio: 16 / 9;
|
||||
background-color: #f2e5c9;
|
||||
}
|
||||
|
||||
#stand-info img::before {
|
||||
content: "Приклад розташування";
|
||||
display: block;
|
||||
color: #555;
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
#stand-schedule {
|
||||
width: 100%;
|
||||
min-height: calc(100vh - 40px - 50px);
|
||||
height: fit-content;
|
||||
margin: 0 10px 15px;
|
||||
border-radius: var(--border-radius);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
background: var(--ColorThemes1);
|
||||
color: var(--ColorThemes3);
|
||||
border: 1px solid var(--ColorThemes2);
|
||||
box-shadow: var(--shadow-l1);
|
||||
transition: all .2sease 0s;
|
||||
}
|
||||
|
||||
#stand-schedule>.block-day {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: calc(100% - 20px);
|
||||
margin: 10px;
|
||||
padding: 10px 0;
|
||||
border: 1px solid var(--PrimaryColor);
|
||||
background-color: var(--ColorThemes2);
|
||||
border: 1px solid var(--ColorThemes0);
|
||||
min-height: 100px;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
border-radius: calc(var(--border-radius) - 5px);
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
#stand-schedule>.block-day h3 {
|
||||
font-size: 17px;
|
||||
font-weight: 500;
|
||||
padding: 10px;
|
||||
text-transform: capitalize;
|
||||
width: calc(100% - 20px);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#stand-schedule>.block-day div {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
padding: 5px 0;
|
||||
margin: 0 10px;
|
||||
align-items: center;
|
||||
min-width: calc(100% - 20px);
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
#stand-schedule>.block-day div span {
|
||||
min-width: 85px;
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
#stand-schedule>.block-day div select {
|
||||
width: 100%;
|
||||
min-width: 140px;
|
||||
padding: 0 5px;
|
||||
margin: 0 5px;
|
||||
border-radius: calc(var(--border-radius) - 5px - 4px);
|
||||
height: 30px;
|
||||
background-color: var(--ColorThemes0);
|
||||
color: var(--ColorThemes3);
|
||||
}
|
||||
|
||||
#stand-schedule>.block-day div:nth-child(2n) {
|
||||
background: var(--ColorThemes0);
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
#stand-schedule>.block-day div:nth-child(2n) select {
|
||||
background-color: var(--ColorThemes2);
|
||||
}
|
||||
@@ -31,7 +31,7 @@ const Territory_card = {
|
||||
controls.style.display = "flex";
|
||||
|
||||
// Застосовуємо режим сортування
|
||||
this.sort(localStorage.getItem('sort_mode'), false);
|
||||
this.sort(localStorage.getItem('territory_card_sort'), false);
|
||||
this.getEntrances({ update: false });
|
||||
} else if (type === "homestead") {
|
||||
this.getHomestead.map({});
|
||||
@@ -249,14 +249,14 @@ const Territory_card = {
|
||||
const data = await res.json();
|
||||
this.listApartment[number] = data;
|
||||
|
||||
const sort_mode = localStorage.getItem('sort_mode') ?? "1";
|
||||
const territory_card_sort = localStorage.getItem('territory_card_sort') ?? "1";
|
||||
const sorters = {
|
||||
"1": (a, b) => a.apartment_number - b.apartment_number,
|
||||
"2": (a, b) => b.apartment_number - a.apartment_number,
|
||||
"3": (a, b) => a.updated_at - b.updated_at,
|
||||
"4": (a, b) => b.updated_at - a.updated_at,
|
||||
};
|
||||
data.sort(sorters[sort_mode] || sorters["1"]);
|
||||
data.sort(sorters[territory_card_sort] || sorters["1"]);
|
||||
|
||||
const container = document.getElementById(`apartments_${id}`);
|
||||
if (!update) container.innerHTML = "";
|
||||
@@ -493,7 +493,7 @@ const Territory_card = {
|
||||
['sort_1', 'sort_2', 'sort_3', 'sort_4'].forEach((id, i) => {
|
||||
document.getElementById(id)?.setAttribute('data-state', i + 1 === idx ? 'active' : '');
|
||||
});
|
||||
localStorage.setItem('sort_mode', idx);
|
||||
localStorage.setItem('territory_card_sort', idx);
|
||||
if (!load) this.getEntrances({ update: false });
|
||||
},
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ const Territory_list = {
|
||||
app.innerHTML = html;
|
||||
|
||||
let selectStatus = document.getElementById('list-controls-filter-status');
|
||||
let filterStatus = localStorage.getItem("filterStatus") ? Number(localStorage.getItem("filterStatus")) : 0;
|
||||
selectStatus.value = filterStatus;
|
||||
let territory_list_filter = localStorage.getItem("territory_list_filter") ? Number(localStorage.getItem("territory_list_filter")) : 0;
|
||||
selectStatus.value = territory_list_filter;
|
||||
|
||||
if (USER.mode == 2) {
|
||||
document.getElementById("buttons-list").style.display = "flex";
|
||||
@@ -17,10 +17,10 @@ const Territory_list = {
|
||||
}
|
||||
|
||||
// Застосовуємо режим сортування
|
||||
Territory_list.sort(localStorage.getItem('territory_sort_mode'));
|
||||
Territory_list.sort(localStorage.getItem('territory_list_sort'));
|
||||
|
||||
|
||||
if (localStorage.getItem('territory_entrances') == 'true') {
|
||||
if (localStorage.getItem('territory_list_entrances') == 'true') {
|
||||
document.getElementById('territory_entrances_true').setAttribute('data-state', '')
|
||||
document.getElementById('territory_entrances_false').setAttribute('data-state', 'active')
|
||||
} else {
|
||||
@@ -35,7 +35,7 @@ const Territory_list = {
|
||||
['sort_1', 'sort_2', 'sort_3', 'sort_4'].forEach((id, i) => {
|
||||
document.getElementById(id)?.setAttribute('data-state', i + 1 === idx ? 'active' : '');
|
||||
});
|
||||
localStorage.setItem('territory_sort_mode', idx);
|
||||
localStorage.setItem('territory_list_sort', idx);
|
||||
|
||||
Territory_list.house.setHTML();
|
||||
Territory_list.homestead.setHTML();
|
||||
@@ -57,9 +57,9 @@ const Territory_list = {
|
||||
},
|
||||
setHTML: async function () {
|
||||
const block_house = document.getElementById('list-house');
|
||||
const territory_entrances = localStorage.getItem('territory_entrances') === 'true';
|
||||
const sort_mode = localStorage.getItem('territory_sort_mode') ?? "1";
|
||||
const filterStatus = Number(localStorage.getItem("filterStatus") ?? 0);
|
||||
const territory_entrances = localStorage.getItem('territory_list_entrances') === 'true';
|
||||
const sort_mode = localStorage.getItem('territory_list_sort') ?? "1";
|
||||
const territory_list_filter = Number(localStorage.getItem("territory_list_filter") ?? 0);
|
||||
|
||||
const url = `${CONFIG.api}houses/list${territory_entrances ? '/entrances' : ''}`;
|
||||
let list = this.list.length > 0 ? this.list : await this.loadAPI(url);
|
||||
@@ -79,11 +79,11 @@ const Territory_list = {
|
||||
const work = element.entrance?.working ?? 0;
|
||||
|
||||
const statusMatch =
|
||||
filterStatus === 0 ||
|
||||
(filterStatus === 1 && qty === work && !territory_entrances) ||
|
||||
(filterStatus === 1 && element.working === true) ||
|
||||
(filterStatus === 2 && qty !== work && !territory_entrances) ||
|
||||
(filterStatus === 2 && element.working === false);
|
||||
territory_list_filter === 0 ||
|
||||
(territory_list_filter === 1 && qty === work && !territory_entrances) ||
|
||||
(territory_list_filter === 1 && element.working === true) ||
|
||||
(territory_list_filter === 2 && qty !== work && !territory_entrances) ||
|
||||
(territory_list_filter === 2 && element.working === false);
|
||||
|
||||
if (statusMatch) {
|
||||
html += this.renderCard({ element, territory_entrances });
|
||||
@@ -161,7 +161,7 @@ const Territory_list = {
|
||||
}
|
||||
},
|
||||
territoryType: (type) => {
|
||||
localStorage.setItem('territory_entrances', type);
|
||||
localStorage.setItem('territory_list_entrances', type);
|
||||
document.getElementById('territory_entrances_true').setAttribute('data-state', type === 'false' ? 'active' : '');
|
||||
document.getElementById('territory_entrances_false').setAttribute('data-state', type === 'true' ? 'active' : '');
|
||||
Territory_list.house.list = [];
|
||||
@@ -187,8 +187,8 @@ const Territory_list = {
|
||||
},
|
||||
setHTML: async function () {
|
||||
const block = document.getElementById('list-homestead');
|
||||
const sortMode = localStorage.getItem('territory_sort_mode') ?? "1";
|
||||
const filterStatus = Number(localStorage.getItem("filterStatus") ?? 0);
|
||||
const sortMode = localStorage.getItem('territory_list_sort') ?? "1";
|
||||
const territory_list_filter = Number(localStorage.getItem("territory_list_filter") ?? 0);
|
||||
|
||||
let list = this.list.length > 0 ? this.list : await this.loadAPI();
|
||||
|
||||
@@ -205,9 +205,9 @@ const Territory_list = {
|
||||
|
||||
for (const element of list) {
|
||||
const statusMatch =
|
||||
filterStatus === 0 ||
|
||||
(filterStatus === 1 && element.working) ||
|
||||
(filterStatus === 2 && !element.working);
|
||||
territory_list_filter === 0 ||
|
||||
(territory_list_filter === 1 && element.working) ||
|
||||
(territory_list_filter === 2 && !element.working);
|
||||
|
||||
if (statusMatch) {
|
||||
html += this.renderCard(element);
|
||||
@@ -244,7 +244,7 @@ const Territory_list = {
|
||||
filter: () => {
|
||||
let selectStatus = document.getElementById('list-controls-filter-status').value;
|
||||
|
||||
localStorage.setItem("filterStatus", selectStatus);
|
||||
localStorage.setItem("territory_list_filter", selectStatus);
|
||||
|
||||
|
||||
Territory_list.house.setHTML();
|
||||
|
||||
@@ -163,6 +163,7 @@
|
||||
|
||||
.page-territory summary span {
|
||||
font-weight: 500;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.page-territory summary>div>button {
|
||||
@@ -218,7 +219,7 @@
|
||||
width: 300px;
|
||||
height: 200px;
|
||||
background-color: var(--ColorThemes2);
|
||||
margin: 0px 10px 20px 10px;
|
||||
margin: 10px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
border-radius: calc(var(--border-radius) - 5px);
|
||||
|
||||
Reference in New Issue
Block a user