Spaces:
Sleeping
Sleeping
Upload 12 files
Browse files- static/elev-dashboard.html +16 -1
- static/profesor-dashboard.html +14 -1
static/elev-dashboard.html
CHANGED
|
@@ -189,11 +189,15 @@ async function loadFiles() {
|
|
| 189 |
</svg>${f.name}
|
| 190 |
</div>
|
| 191 |
<div class="file-size">${f.size ? (parseInt(f.size)/1024/1024).toFixed(1)+' MB' : '—'}</div>
|
| 192 |
-
<div>
|
| 193 |
<a href="/drive/download/${f.id}" class="btn-ghost" style="font-size:8px;padding:4px 8px;text-decoration:none;">
|
| 194 |
<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" style="vertical-align:middle;margin-right:3px;"><path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>
|
| 195 |
DESCARCĂ
|
| 196 |
</a>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
</div>`;
|
| 198 |
el.appendChild(row);
|
| 199 |
});
|
|
@@ -293,6 +297,17 @@ async function uploadFile(file) {
|
|
| 293 |
}
|
| 294 |
}
|
| 295 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 296 |
// ── Hide loader ──
|
| 297 |
await new Promise(r=>setTimeout(r,600));
|
| 298 |
document.getElementById('page-loader').classList.add('hide');
|
|
|
|
| 189 |
</svg>${f.name}
|
| 190 |
</div>
|
| 191 |
<div class="file-size">${f.size ? (parseInt(f.size)/1024/1024).toFixed(1)+' MB' : '—'}</div>
|
| 192 |
+
<div style="display:flex;gap:6px;align-items:center;">
|
| 193 |
<a href="/drive/download/${f.id}" class="btn-ghost" style="font-size:8px;padding:4px 8px;text-decoration:none;">
|
| 194 |
<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" style="vertical-align:middle;margin-right:3px;"><path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>
|
| 195 |
DESCARCĂ
|
| 196 |
</a>
|
| 197 |
+
<button onclick="deleteFile('${f.id}', this)" class="btn-ghost" style="font-size:8px;padding:4px 8px;color:#cc5555;border-color:rgba(200,80,80,0.3);">
|
| 198 |
+
<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" style="vertical-align:middle;margin-right:3px;"><polyline points="3 6 5 6 21 6"/><path d="M19 6l-1 14a2 2 0 01-2 2H8a2 2 0 01-2-2L5 6"/><path d="M10 11v6"/><path d="M14 11v6"/><path d="M9 6V4h6v2"/></svg>
|
| 199 |
+
ȘTERGE
|
| 200 |
+
</button>
|
| 201 |
</div>`;
|
| 202 |
el.appendChild(row);
|
| 203 |
});
|
|
|
|
| 297 |
}
|
| 298 |
}
|
| 299 |
|
| 300 |
+
// ── Ștergere fișier ──
|
| 301 |
+
window.deleteFile = async function(fileId, btn) {
|
| 302 |
+
if (!confirm('Ești sigur că vrei să ștergi acest fișier?')) return;
|
| 303 |
+
btn.disabled = true; btn.textContent = '...';
|
| 304 |
+
try {
|
| 305 |
+
const r = await fetch(`/drive/delete/${fileId}`, { method: 'DELETE' });
|
| 306 |
+
if (r.ok) { await loadFiles(); }
|
| 307 |
+
else { btn.disabled = false; btn.textContent = 'ȘTERGE'; alert('Eroare la ștergere.'); }
|
| 308 |
+
} catch(e) { btn.disabled = false; btn.textContent = 'ȘTERGE'; }
|
| 309 |
+
};
|
| 310 |
+
|
| 311 |
// ── Hide loader ──
|
| 312 |
await new Promise(r=>setTimeout(r,600));
|
| 313 |
document.getElementById('page-loader').classList.add('hide');
|
static/profesor-dashboard.html
CHANGED
|
@@ -303,13 +303,26 @@
|
|
| 303 |
</svg>
|
| 304 |
<span class="fr-name">${f.name}</span>
|
| 305 |
<span class="fr-meta">${f.size ? (parseInt(f.size)/1024/1024).toFixed(1)+' MB' : materie}</span>
|
| 306 |
-
<
|
|
|
|
|
|
|
|
|
|
| 307 |
body.appendChild(row);
|
| 308 |
});
|
| 309 |
} catch(e) { body.innerHTML = '<div class="no-files">Eroare la incarcare.</div>'; }
|
| 310 |
}
|
| 311 |
|
| 312 |
window.openDrawer = openDrawer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 313 |
</script>
|
| 314 |
<script>
|
| 315 |
function closeDrawer() { document.getElementById('drawer').classList.remove('show'); }
|
|
|
|
| 303 |
</svg>
|
| 304 |
<span class="fr-name">${f.name}</span>
|
| 305 |
<span class="fr-meta">${f.size ? (parseInt(f.size)/1024/1024).toFixed(1)+' MB' : materie}</span>
|
| 306 |
+
<div style="display:flex;gap:6px;">
|
| 307 |
+
<a href="/drive/download/${f.id}" class="btn-outline" style="font-size:9px;padding:4px 10px;text-decoration:none;">DESCARCĂ</a>
|
| 308 |
+
<button class="btn-outline" style="font-size:9px;padding:4px 10px;color:#cc5555;border-color:rgba(200,80,80,0.3);" onclick="deleteFileProf('${f.id}', this, '${elevId}', '${materieId}', '${materie}', '${elevNume}')">ȘTERGE</button>
|
| 309 |
+
</div>`;
|
| 310 |
body.appendChild(row);
|
| 311 |
});
|
| 312 |
} catch(e) { body.innerHTML = '<div class="no-files">Eroare la incarcare.</div>'; }
|
| 313 |
}
|
| 314 |
|
| 315 |
window.openDrawer = openDrawer;
|
| 316 |
+
|
| 317 |
+
window.deleteFileProf = async function(fileId, btn, elevId, materieId, materie, elevNume) {
|
| 318 |
+
if (!confirm(`Ștergi fișierul lui ${elevNume}?`)) return;
|
| 319 |
+
btn.disabled = true; btn.textContent = '...';
|
| 320 |
+
try {
|
| 321 |
+
const r = await fetch(`/drive/delete/${fileId}`, { method: 'DELETE' });
|
| 322 |
+
if (r.ok) { openDrawer(elevId, elevId, elevNume, materieId, materie); }
|
| 323 |
+
else { btn.disabled = false; btn.textContent = 'ȘTERGE'; alert('Eroare la ștergere.'); }
|
| 324 |
+
} catch(e) { btn.disabled = false; btn.textContent = 'ȘTERGE'; }
|
| 325 |
+
};
|
| 326 |
</script>
|
| 327 |
<script>
|
| 328 |
function closeDrawer() { document.getElementById('drawer').classList.remove('show'); }
|