feat: remove org from deal — ⋯ menu on org card with Permissions + Remove from deal
This commit is contained in:
parent
8dfd8c8b1d
commit
875593c0c2
|
|
@ -1240,8 +1240,21 @@
|
|||
})()}</span>
|
||||
</div>
|
||||
</div>
|
||||
<button onclick="openPermModalById('${o.deal_org_id}')"
|
||||
class="px-3 py-1.5 rounded-lg text-xs font-medium transition shrink-0" style="background:var(--ds-hv);color:var(--ds-tx2)">Permissions</button>
|
||||
<div class="flex items-center gap-2 shrink-0">
|
||||
<button onclick="openPermModalById('${o.deal_org_id}')"
|
||||
class="px-3 py-1.5 rounded-lg text-xs font-medium transition" style="background:var(--ds-hv);color:var(--ds-tx2)">Permissions</button>
|
||||
<div class="relative" id="orgMenu_${o.deal_org_id}">
|
||||
<button onclick="toggleOrgMenu('${o.deal_org_id}')"
|
||||
class="px-2 py-1.5 rounded-lg text-sm font-medium transition" style="background:var(--ds-hv);color:var(--ds-tx2)" title="More options">⋯</button>
|
||||
<div id="orgMenuDrop_${o.deal_org_id}" class="hidden absolute right-0 top-full mt-1 rounded-lg shadow-xl z-30 py-1 min-w-[160px]" style="background:var(--ds-card);border:1px solid var(--ds-bd)">
|
||||
<button onclick="openPermModalById('${o.deal_org_id}');closeOrgMenu('${o.deal_org_id}')"
|
||||
class="w-full text-left px-4 py-2 text-sm transition hover:opacity-80" style="color:var(--ds-tx)">Permissions</button>
|
||||
<div style="height:1px;background:var(--ds-bd);margin:4px 0"></div>
|
||||
<button onclick="removeDealOrg('${o.deal_org_id}', '${escHtml(orgName)}')"
|
||||
class="w-full text-left px-4 py-2 text-sm transition hover:opacity-80" style="color:#ef4444">Remove from deal</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Members -->
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue