upload z zjec z galerii + prettycode

This commit is contained in:
Mateusz Gruszczyński
2025-07-19 22:18:23 +02:00
parent 1df8e44e4d
commit 7a9042ffb2
2 changed files with 20 additions and 2 deletions

View File

@@ -89,3 +89,14 @@ if (!window.receiptUploaderInitialized) {
window.receiptUploaderInitialized = true;
}
document.addEventListener("DOMContentLoaded", function () {
const isMobile = /Mobi|Android|iPhone|iPad/i.test(navigator.userAgent);
const galleryBtn = document.getElementById("galleryBtn");
const galleryInput = document.getElementById("galleryInput");
if (!isMobile && galleryBtn && galleryInput) {
galleryBtn.style.display = "none";
galleryInput.disabled = true;
}
});

View File

@@ -130,21 +130,28 @@
<h5>📤 Dodaj zdjęcie paragonu</h5>
<form id="receiptForm" action="{{ url_for('upload_receipt', list_id=list.id) }}" method="post"
enctype="multipart/form-data" class="text-center">
<label for="cameraInput"
<!-- Zrób zdjęcie -->
<label for="cameraInput" id="cameraBtn"
class="btn btn-outline-light w-100 py-2 mb-2 d-flex align-items-center justify-content-center gap-2">
<i class="bi bi-camera"></i> 📸 Zrób zdjęcie
</label>
<input type="file" name="receipt" accept="image/*" capture="environment" class="d-none" id="cameraInput">
<label for="galleryInput"
<!-- Z galerii -->
<label for="galleryInput" id="galleryBtn"
class="btn btn-outline-light w-100 py-2 mb-2 d-flex align-items-center justify-content-center gap-2">
<i class="bi bi-image"></i> 🖼️ Z galerii
</label>
<input type="file" name="receipt" accept="image/*" class="d-none" id="galleryInput">
<div id="progressContainer" class="progress" style="height: 20px; display: none;">
<div id="progressBar" class="progress-bar bg-success fw-bold" role="progressbar" style="width: 0%;">0%</div>
</div>
<div id="receiptGallery" class="mt-3"></div>
</form>
{% endif %}
</div>