Змінено директорії
Додано скрипти CRON Поліпшено механізм запису стендів та їх редагування
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user