diff --git a/src/modules/parcel-sync/components/epay-tab.tsx b/src/modules/parcel-sync/components/epay-tab.tsx index 7cd3e26..1e16e65 100644 --- a/src/modules/parcel-sync/components/epay-tab.tsx +++ b/src/modules/parcel-sync/components/epay-tab.tsx @@ -179,6 +179,30 @@ export function EpayTab() { /* -- Filter ------------------------------------------------------ */ const [filterTab, setFilterTab] = useState("all"); + /* -- Selection (ordered — index = numbering in ZIP) -------------- */ + const [selectedIds, setSelectedIds] = useState([]); + const [downloadingSelection, setDownloadingSelection] = useState(false); + + const toggleSelect = (id: string) => { + setSelectedIds((prev) => + prev.includes(id) ? prev.filter((x) => x !== id) : [...prev, id], + ); + }; + + const handleDownloadSelection = async () => { + if (selectedIds.length === 0) return; + setDownloadingSelection(true); + try { + const ids = selectedIds.join(","); + const a = document.createElement("a"); + a.href = `/api/ancpi/download-zip?ids=${encodeURIComponent(ids)}`; + a.download = `Extrase_CF_selectie_${selectedIds.length}.zip`; + a.click(); + } finally { + setTimeout(() => setDownloadingSelection(false), 2000); + } + }; + /* -- Search ------------------------------------------------------ */ const [searchQuery, setSearchQuery] = useState(""); @@ -398,22 +422,57 @@ export function EpayTab() {
+ {/* Download selection */} + {selectedIds.length > 0 && ( + + + + + + + ZIP cu {selectedIds.length} extrase numerotate in ordinea selectarii + + + + )} {/* Download all valid */} {validCount > 0 && ( - + + + + + + + ZIP cu toate extrasele valabile + + + )}