diff --git a/portal/templates/app/project.html b/portal/templates/app/project.html index b3dd0b6..38e8c21 100644 --- a/portal/templates/app/project.html +++ b/portal/templates/app/project.html @@ -1240,8 +1240,21 @@ })()} - +
+ +
+ + +
+
@@ -1847,6 +1860,36 @@ }); // ---- Permissions Modal ---- + // ---- Org card menu ---- + function toggleOrgMenu(dealOrgId) { + const drop = document.getElementById('orgMenuDrop_' + dealOrgId); + if (!drop) return; + const isHidden = drop.classList.contains('hidden'); + // Close all other open org menus + document.querySelectorAll('[id^="orgMenuDrop_"]').forEach(d => d.classList.add('hidden')); + if (isHidden) drop.classList.remove('hidden'); + } + + function closeOrgMenu(dealOrgId) { + const drop = document.getElementById('orgMenuDrop_' + dealOrgId); + if (drop) drop.classList.add('hidden'); + } + + document.addEventListener('click', e => { + if (!e.target.closest('[id^="orgMenu_"]')) { + document.querySelectorAll('[id^="orgMenuDrop_"]').forEach(d => d.classList.add('hidden')); + } + }); + + async function removeDealOrg(dealOrgId, orgName) { + if (!confirm('Remove ' + orgName + ' from this deal? Their access will be revoked.')) return; + try { + const res = await fetchAPI('/api/projects/' + projectID + '/entries/' + dealOrgId, { method: 'DELETE' }); + if (!res.ok) { const d = await res.json(); throw new Error(d.error || 'Failed to remove org'); } + loadOrgs(); + } catch(e) { alert(e.message); } + } + function openPermModalById(dealOrgId) { const o = _dealOrgsMap[dealOrgId]; if (!o) return;