mirror of
https://github.com/Dvorinka/PPve.git
synced 2026-06-04 12:32:59 +00:00
Add files via upload
This commit is contained in:
+9
-21
@@ -552,33 +552,21 @@
|
|||||||
try {
|
try {
|
||||||
showMessage('Odesílání záznamu...', 'info');
|
showMessage('Odesílání záznamu...', 'info');
|
||||||
|
|
||||||
const res = await fetch('/api/trips', {
|
const res = await fetch('/submit', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
});
|
});
|
||||||
|
|
||||||
const text = await res.text();
|
const result = await res.json();
|
||||||
|
showMessage(result.message, 'success');
|
||||||
|
|
||||||
// Validate JSON response
|
// Reset form but keep today's date
|
||||||
try {
|
form.reset();
|
||||||
const result = JSON.parse(text);
|
dateStart.value = todayStr;
|
||||||
if (res.ok) {
|
dateEnd.value = todayStr;
|
||||||
showMessage(result.message || 'Záznam úspěšně uložen', 'success');
|
totalDistance.textContent = '0 km';
|
||||||
|
totalTime.textContent = '0:00';
|
||||||
// Reset form but keep today's date
|
|
||||||
form.reset();
|
|
||||||
dateStart.value = todayStr;
|
|
||||||
dateEnd.value = todayStr;
|
|
||||||
totalDistance.textContent = '0 km';
|
|
||||||
totalTime.textContent = '0:00';
|
|
||||||
} else {
|
|
||||||
showMessage(result.error || 'Chyba při ukládání', 'error');
|
|
||||||
}
|
|
||||||
} catch (jsonError) {
|
|
||||||
console.error('Invalid JSON response:', text);
|
|
||||||
showMessage('Neplatná odpověď ze serveru', 'error');
|
|
||||||
}
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
showMessage('Nepodařilo se odeslat záznam. Zkontrolujte připojení k internetu.', 'error');
|
showMessage('Nepodařilo se odeslat záznam. Zkontrolujte připojení k internetu.', 'error');
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ type ContactData struct {
|
|||||||
var (
|
var (
|
||||||
currentData *ContactData
|
currentData *ContactData
|
||||||
dataFile = "data/contacts.json"
|
dataFile = "data/contacts.json"
|
||||||
xlsxFile = "TelefonniSeznamWeb.xlsx"
|
xlsxFile = "/mnt/telefony/TelefonniSeznamWeb.xlsx"
|
||||||
)
|
)
|
||||||
|
|
||||||
func startAutoReload() {
|
func startAutoReload() {
|
||||||
|
|||||||
Reference in New Issue
Block a user