MCPcopy Create free account
hub / github.com/error311/FileRise / attachPortalSubmissionsUI

Function attachPortalSubmissionsUI

public/js/adminPortals.js:2274–2369  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2272 }
2273
2274function attachPortalSubmissionsUI() {
2275 const body = document.getElementById('clientPortalsBody');
2276 if (!body) return;
2277
2278 body.querySelectorAll('.portal-card').forEach(card => {
2279 if (card.querySelector('.portal-submissions-block')) {
2280 return;
2281 }
2282
2283 const slug = card.getAttribute('data-portal-slug') || '';
2284 if (!slug) return;
2285
2286 const container = document.createElement('div');
2287 container.className = 'portal-submissions-block';
2288
2289 const headerRow = document.createElement('div');
2290 headerRow.className = 'd-flex align-items-center justify-content-between mb-1';
2291
2292 const title = document.createElement('strong');
2293 title.textContent = 'Submissions';
2294
2295 const buttonsWrap = document.createElement('div');
2296 buttonsWrap.className = 'd-flex align-items-center';
2297 buttonsWrap.style.gap = '6px';
2298
2299 const loadBtn = document.createElement('button');
2300 loadBtn.type = 'button';
2301 loadBtn.className = 'btn btn-sm btn-outline-secondary portal-submissions-load-btn';
2302 loadBtn.textContent = 'Load submissions';
2303 loadBtn.setAttribute('data-portal-action', 'load-submissions');
2304
2305 const exportBtn = document.createElement('button');
2306 exportBtn.type = 'button';
2307 exportBtn.className = 'btn btn-sm btn-outline-secondary portal-submissions-export-btn';
2308 exportBtn.textContent = 'Export CSV';
2309
2310 buttonsWrap.appendChild(loadBtn);
2311 buttonsWrap.appendChild(exportBtn);
2312
2313 headerRow.appendChild(title);
2314 headerRow.appendChild(buttonsWrap);
2315 container.appendChild(headerRow);
2316
2317 const countEl = document.createElement('small');
2318 countEl.className = 'text-muted portal-submissions-count';
2319 countEl.textContent = 'No submissions';
2320 container.appendChild(countEl);
2321
2322 const listEl = document.createElement('div');
2323 listEl.className = 'portal-submissions-list';
2324 container.appendChild(listEl);
2325
2326 const bodyEl = card.querySelector('.portal-card-body') || card;
2327 bodyEl.appendChild(container);
2328
2329 const loadSubmissions = async () => {
2330 countEl.textContent = 'Loading...';
2331 listEl.textContent = '';

Callers 1

loadClientPortalsListFunction · 0.85

Calls 4

loadSubmissionsFunction · 0.85
tFunction · 0.85
exportSubmissionsToCsvFunction · 0.85
showToastFunction · 0.70

Tested by

no test coverage detected