Виправлення помилок.
Додан новий метод авторізації в застосунок.
This commit is contained in:
@@ -41,7 +41,7 @@ const SheepsEvents = {
|
||||
const form = event.target;
|
||||
const formData = new FormData(form);
|
||||
console.log(formData);
|
||||
|
||||
|
||||
const uuidValue = form.elements["uuid"].value;
|
||||
const sheep = Sheeps.sheeps_list.list.find(item => item.uuid === uuidValue);
|
||||
|
||||
@@ -88,20 +88,20 @@ const SheepsEvents = {
|
||||
|
||||
if (response.ok) {
|
||||
sheepEditorButton.innerText = "Зберегти";
|
||||
Notifier.success("Успішно збережено!", {timeout: 2000})
|
||||
Notifier.success("Успішно збережено!", { timeout: 2000 })
|
||||
const data = await response.json();
|
||||
console.log(data);
|
||||
|
||||
Sheeps.sheeps_list.list = [];
|
||||
await Sheeps.sheeps_list.setHTML();
|
||||
await Sheeps.sheeps_list.setHTML({});
|
||||
} else {
|
||||
sheepEditorButton.innerText = "Зберегти";
|
||||
console.error('Помилка збереження');
|
||||
Notifier.error("Помилка збереження!", {timeout: 3000});
|
||||
Notifier.error("Помилка збереження!", { timeout: 3000 });
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
Notifier.error("Помилка збереження!", {timeout: 3000});
|
||||
Notifier.error("Помилка збереження!", { timeout: 3000 });
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -143,11 +143,11 @@ const SheepsEvents = {
|
||||
} else {
|
||||
sheepEditorButton.innerText = "Додати";
|
||||
console.error('Помилка додавання');
|
||||
Notifier.error("Помилка додавання!", {timeout: 3000});
|
||||
Notifier.error("Помилка додавання!", { timeout: 3000 });
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
Notifier.error("Помилка додавання!", {timeout: 3000});
|
||||
Notifier.error("Помилка додавання!", { timeout: 3000 });
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -182,7 +182,7 @@ const Sheeps = {
|
||||
|
||||
return Sheeps.sheeps_list.list
|
||||
},
|
||||
setHTML: async ({search, filter}) => {
|
||||
setHTML: async ({ search, filter }) => {
|
||||
let block_sheep_list = document.getElementById('block-sheeps-list');
|
||||
let block_sheep_info = document.getElementById('block-sheep-info');
|
||||
block_sheep_list.style.display = "flex";
|
||||
@@ -270,7 +270,7 @@ const Sheeps = {
|
||||
continue; // пропустити, якщо ім'я не містить рядок пошуку
|
||||
}
|
||||
|
||||
if (filter && element.group_id !== Number(filter) && Number(filter) !== 0) {
|
||||
if (filter && element.group_id !== Number(filter) && Number(filter) !== 0) {
|
||||
continue; // пропустити, якщо ім'я не містить рядок пошуку
|
||||
}
|
||||
|
||||
@@ -354,7 +354,7 @@ const Sheeps = {
|
||||
let sheep_editor_can_add_territory = document.getElementById('sheep-editor-can_add_territory');
|
||||
let sheep_editor_can_manager_territory = document.getElementById('sheep-editor-can_manager_territory');
|
||||
let sheep_editor_can_joint_territory = document.getElementById('sheep-editor-can_joint_territory');
|
||||
|
||||
|
||||
let sheep_editor_can_add_stand = document.getElementById('sheep-editor-can_add_stand');
|
||||
let sheep_editor_can_manager_stand = document.getElementById('sheep-editor-can_manager_stand');
|
||||
let sheep_editor_can_add_schedule = document.getElementById('sheep-editor-can_add_schedule');
|
||||
@@ -366,7 +366,7 @@ const Sheeps = {
|
||||
|
||||
sheep_editor_uuid.value = sheep.uuid;
|
||||
sheep_editor_uuid_copy.innerText = sheep.uuid;
|
||||
sheep_editor_uuid_copy.setAttribute("onclick", `clipboard('https://sheep-service.com/?uuid=${sheep.uuid}')`);
|
||||
sheep_editor_uuid_copy.setAttribute("onclick", `clipboard('https://sheep-service.com/?uuid=${sheep.uuid}');Sheeps.editor.genQR('${sheep.uuid}');`);
|
||||
|
||||
sheep_editor_mode.value = sheep.mode;
|
||||
|
||||
@@ -379,7 +379,7 @@ const Sheeps = {
|
||||
sheep_editor_access_moder.style.display = "";
|
||||
editor_blocks_inputs_uuid_moder.style.display = "";
|
||||
sheep_editor_uuid_moder.innerText = sheep.uuid_manager;
|
||||
sheep_editor_uuid_moder.setAttribute("onclick", `clipboard('https://sheep-service.com/?uuid=${sheep.uuid_manager}')`);
|
||||
sheep_editor_uuid_moder.setAttribute("onclick", `clipboard('https://sheep-service.com/?uuid=${sheep.uuid_manager}');Sheeps.editor.genQR('${sheep.uuid_manager}');`);
|
||||
} else if (USER.mode == 2 && (sheep.mode == 0)) {
|
||||
sheep_editor_access_moder.style.display = "none";
|
||||
editor_blocks_inputs_uuid_moder.style.display = "none";
|
||||
@@ -405,6 +405,8 @@ const Sheeps = {
|
||||
sheep_editor_can_view_stand.checked = sheep.possibilities.can_view_stand;
|
||||
sheep_editor_can_view_territory.checked = sheep.possibilities.can_view_territory;
|
||||
|
||||
Sheeps.editor.genQR(sheep.uuid);
|
||||
|
||||
if (USER.possibilities.can_manager_territory) {
|
||||
document.getElementById('editor-blocks-territory').style.display = "none";
|
||||
document.getElementById(`editor-blocks-territory`).innerHTML = "<summary>Території вісника</summary>";
|
||||
@@ -437,6 +439,34 @@ const Sheeps = {
|
||||
}, 10);
|
||||
|
||||
Router.navigate(`sheeps`);
|
||||
},
|
||||
genQR: (hash) => {
|
||||
document.getElementById("qr-code").innerHTML = "";
|
||||
|
||||
const qrCode = new QRCodeStyling({
|
||||
width: 250,
|
||||
height: 250,
|
||||
type: "svg",
|
||||
data: `https://sheep-service.com/?uuid=${hash}`,
|
||||
backgroundOptions: {
|
||||
color: "#fbfbfb",
|
||||
},
|
||||
dotsOptions: {
|
||||
color: "#313131",
|
||||
type: "rounded"
|
||||
},
|
||||
cornersSquareOptions: {
|
||||
color: "#313131",
|
||||
type: "extra-rounded"
|
||||
},
|
||||
cornersDotOptions: {
|
||||
color: "#313131",
|
||||
type: "dot"
|
||||
},
|
||||
});
|
||||
|
||||
// 2. Відмальовуємо QR-код у вибраний контейнер
|
||||
qrCode.append(document.getElementById("qr-code"));
|
||||
}
|
||||
},
|
||||
addeds: {
|
||||
@@ -479,7 +509,7 @@ const Sheeps = {
|
||||
const sheepFilterForm = document.getElementById("block-sheeps-list-filter");
|
||||
const current = sheepFilterForm.dataset.state;
|
||||
|
||||
if(current === 'closed') Sheeps.search.close();
|
||||
if (current === 'closed') Sheeps.search.close();
|
||||
sheepFilterForm.dataset.state = current === 'open' ? 'closed' : 'open';
|
||||
},
|
||||
close: () => {
|
||||
@@ -490,7 +520,7 @@ const Sheeps = {
|
||||
console.log(value);
|
||||
|
||||
filter_value = value || "";
|
||||
Sheeps.sheeps_list.setHTML({filter: filter_value});
|
||||
Sheeps.sheeps_list.setHTML({ filter: filter_value });
|
||||
}
|
||||
},
|
||||
search: {
|
||||
@@ -498,7 +528,7 @@ const Sheeps = {
|
||||
const sheepSearchForm = document.getElementById("block-sheeps-list-search");
|
||||
const current = sheepSearchForm.dataset.state;
|
||||
|
||||
if(current === 'closed') Sheeps.filter.close();
|
||||
if (current === 'closed') Sheeps.filter.close();
|
||||
sheepSearchForm.dataset.state = current === 'open' ? 'closed' : 'open';
|
||||
},
|
||||
close: () => {
|
||||
@@ -509,7 +539,7 @@ const Sheeps = {
|
||||
console.log(value);
|
||||
|
||||
search_value = value?.trim()?.toLowerCase() || "";
|
||||
Sheeps.sheeps_list.setHTML({search: search_value});
|
||||
Sheeps.sheeps_list.setHTML({ search: search_value });
|
||||
}
|
||||
},
|
||||
territory: {
|
||||
|
||||
Reference in New Issue
Block a user