mirror of
https://github.com/Dvorinka/PPve.git
synced 2026-06-04 20:42:59 +00:00
d
This commit is contained in:
+13
-19
@@ -1070,10 +1070,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
<div class="mb-4">
|
<div class="form-group">
|
||||||
<label for="icon" class="block text-sm font-medium text-gray-700 mb-2">Ikona</label>
|
<label class="block text-sm font-medium text-gray-700 mb-2">Ikona</label>
|
||||||
<div class="flex items-center space-x-4">
|
<div class="flex items-center space-x-4">
|
||||||
<button type="button" class="btn btn-primary" onclick="openIconPicker()">Vybrat ikonu</button>
|
<input type="text" id="appIcon" name="appIcon" class="form-control w-full cursor-pointer" placeholder="Vyberte ikonu" readonly>
|
||||||
|
</div>
|
||||||
|
<div id="iconPreview" class="mt-2 flex items-center justify-center w-16 h-16 bg-gray-100 rounded-md overflow-hidden">
|
||||||
|
<i id="selectedIcon" class="fas fa-cube text-2xl text-gray-400"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -2609,15 +2612,13 @@ async function saveApp(event) {
|
|||||||
// Get form data
|
// Get form data
|
||||||
const formData = new FormData(document.getElementById('appForm'));
|
const formData = new FormData(document.getElementById('appForm'));
|
||||||
|
|
||||||
// Add icon class to form data
|
|
||||||
const iconClass = document.getElementById('appIcon').value;
|
|
||||||
if (iconClass) {
|
|
||||||
formData.append('iconClass', iconClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get app ID
|
// Get app ID
|
||||||
const appId = document.getElementById('appId').value;
|
const appId = document.getElementById('appId').value;
|
||||||
|
|
||||||
|
// Get icon class from the selected icon
|
||||||
|
const iconClass = document.getElementById('appIcon').value;
|
||||||
|
formData.append('iconClass', iconClass);
|
||||||
|
|
||||||
// Create request URL
|
// Create request URL
|
||||||
const url = appId ? `/api/apps/${appId}` : '/api/apps';
|
const url = appId ? `/api/apps/${appId}` : '/api/apps';
|
||||||
|
|
||||||
@@ -2628,29 +2629,22 @@ async function saveApp(event) {
|
|||||||
fetch(url, {
|
fetch(url, {
|
||||||
method: method,
|
method: method,
|
||||||
body: formData,
|
body: formData,
|
||||||
credentials: 'include',
|
credentials: 'include'
|
||||||
headers: {
|
|
||||||
'Content-Type': 'multipart/form-data'
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
// Try to get error message if available
|
throw new Error('Network response was not ok');
|
||||||
return response.json().catch(() => ({ message: 'Nastala chyba při ukládání aplikace' }));
|
|
||||||
}
|
}
|
||||||
return response.json();
|
return response.json();
|
||||||
})
|
})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
if (data.message) {
|
|
||||||
throw new Error(data.message);
|
|
||||||
}
|
|
||||||
showNotification('Aplikace byla úspěšně uložena', 'success');
|
showNotification('Aplikace byla úspěšně uložena', 'success');
|
||||||
loadApps();
|
loadApps();
|
||||||
closeAppModal();
|
closeAppModal();
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error('Error:', error);
|
console.error('Error:', error);
|
||||||
showNotification(error.message || 'Chyba při ukládání aplikace', 'error');
|
showNotification('Chyba při ukládání aplikace', 'error');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user