Commit c9556fdf authored by Mahmoud Aglan's avatar Mahmoud Aglan

feat: show pending/rejected org applications in profile view

Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent ff8fea4f
......@@ -380,11 +380,17 @@ async function loadOrgMembership(el) {
const content = el.querySelector('#org-membership-content');
if (!content) return;
try {
const memberships = await net.post('profile.php', { action: 'my-memberships' });
if (Array.isArray(memberships) && memberships.length > 0) {
const active = memberships.filter(m => m.status === 'active');
const [memberships, applications] = await Promise.all([
net.post('profile.php', { action: 'my-memberships' }),
net.post('profile.php', { action: 'my-applications' })
]);
let html = '';
// Show active memberships
const active = (Array.isArray(memberships) ? memberships : []).filter(m => m.status === 'active');
if (active.length > 0) {
content.innerHTML = active.map(m => {
html += active.map(m => {
const org = m.organizations;
const logoHtml = org && org.logo_url
? `<img src="${org.logo_url}" style="width:28px;height:28px;border-radius:6px;object-fit:contain;" alt="">`
......@@ -400,10 +406,34 @@ async function loadOrgMembership(el) {
</div>
`;
}).join('');
return;
}
// Show pending/rejected applications
const pending = (Array.isArray(applications) ? applications : []).filter(a => a.status === 'pending' || a.status === 'rejected');
if (pending.length > 0) {
html += pending.map(a => {
const org = a.organizations || a.el3ab_organizations;
const orgName = org ? org.name : 'منظمة';
const logoHtml = org && org.logo_url
? `<img src="${org.logo_url}" style="width:28px;height:28px;border-radius:6px;object-fit:contain;" alt="">`
: `<div style="width:28px;height:28px;border-radius:6px;background:var(--bg-elevated);display:flex;align-items:center;justify-content:center;">${emoji('building', '🏢', 14)}</div>`;
const statusBadge = a.status === 'pending'
? `<span style="background:#f59e0b;color:#000;font-size:10px;padding:2px 6px;border-radius:10px;">قيد المراجعة</span>`
: `<span style="background:var(--error);color:#fff;font-size:10px;padding:2px 6px;border-radius:10px;">مرفوض</span>`;
return `
<div style="display:flex;align-items:center;gap:var(--s-2);padding:var(--s-2) 0;">
${logoHtml}
<div style="flex:1;">
<div style="font-size:13px;font-weight:600;color:var(--text-primary);">${orgName}</div>
<div style="font-size:11px;color:var(--text-secondary);">طلب انضمام</div>
</div>
${statusBadge}
</div>
`;
}).join('');
}
content.innerHTML = `<div style="font-size:13px;color:var(--text-secondary);">لست عضواً في أي منظمة بعد</div>`;
content.innerHTML = html || `<div style="font-size:13px;color:var(--text-secondary);">لست عضواً في أي منظمة بعد</div>`;
} catch (e) {
content.innerHTML = `<div style="font-size:13px;color:var(--text-secondary);">لست عضواً في أي منظمة بعد</div>`;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment