Добавлена ​​функция сохранения истории обработки территорий

This commit is contained in:
2025-09-13 01:24:33 +03:00
parent f3f13c073a
commit ff393417a1
15 changed files with 1393 additions and 379 deletions

View File

@@ -116,7 +116,7 @@ const Territory = {
const person = working
? `<span>Територію опрацьовує:</span> <p>${element.history.name === 'Групова' ? 'Група ' + element.history.group_id : element.history.name}</p>`
: `<span>Територія не опрацьовується</span>`;
return `
<div class="card">
<i style="background-image: url(https://sheep-service.com/cards/house/T${element.house.id}.webp);"></i>
@@ -248,5 +248,32 @@ const Territory = {
Territory.house.setHTML();
Territory.homestead.setHTML();
},
report: async () => {
const uuid = localStorage.getItem("uuid");
const url = `${CONFIG.api}generator/report/territories`;
await fetch(url, {
method: 'GET',
headers: {
"Content-Type": "application/json",
"Authorization": uuid
}
}).then(response => {
if (!response.ok) throw new Error('Network response was not ok');
return response.blob();
})
.then(blob => {
const link = document.createElement('a');
const url = window.URL.createObjectURL(blob);
link.href = url;
link.download = 'report.xlsx';
document.body.appendChild(link);
link.click();
link.remove();
window.URL.revokeObjectURL(url);
})
.catch(err => {
console.error('Fetch error:', err);
});
}
}