Files
scoutiq/resources/views/admin/organizations/index.php
2026-06-05 17:47:27 +03:00

148 lines
7.7 KiB
PHP

<div class="page-header">
<div>
<h1>المنظمات والجهات الاستثمارية</h1>
<p>إدارة صناديق الاستثمار، مسرعات الأعمال، الحاضنات والمستثمرين</p>
</div>
<a href="/admin/organizations/create" class="btn btn-primary">+ إضافة منظمة</a>
</div>
<?php if ($flashSuccess = $this->session->getFlash('success')): ?>
<div class="alert alert-success"><span><?= $this->escape($flashSuccess) ?></span></div>
<?php endif; ?>
<?php if ($flashError = $this->session->getFlash('error')): ?>
<div class="alert alert-error"><span><?= $this->escape($flashError) ?></span></div>
<?php endif; ?>
<!-- Filters -->
<div class="filters-bar">
<form method="GET" class="filters-form">
<input type="text" name="search" class="form-control" placeholder="البحث عن المنظمات..." value="<?= $this->escape($search) ?>">
<select name="type" class="form-control">
<option value="">جميع الأنواع</option>
<?php foreach ($types as $t_key): ?>
<?php
$trans = [
'vc' => 'رأس مال جريء',
'angel' => 'مستثمر ملائكي',
'accelerator' => 'مسرعة أعمال',
'incubator' => 'حاضنة أعمال',
'venture_studio' => 'استوديو مشاريع',
'partner' => 'شريك',
'other' => 'أخرى'
];
$transName = $trans[$t_key] ?? ucfirst($t_key);
?>
<option value="<?= $t_key ?>" <?= $type === $t_key ? 'selected' : '' ?>><?= $transName ?></option>
<?php endforeach; ?>
</select>
<button type="submit" class="btn btn-secondary">تصفية</button>
</form>
</div>
<!-- Stats Summary -->
<div class="metrics-grid" style="margin-bottom: 20px;">
<div class="glass-panel metric-card">
<span class="metric-title">إجمالي المنظمات والجهات</span>
<span class="metric-value"><?= $total ?></span>
</div>
</div>
<!-- Table -->
<div class="glass-panel" style="overflow-x: auto;">
<table class="data-table">
<thead>
<tr>
<th>الاسم</th>
<th>النوع</th>
<th>الدولة</th>
<th>حالة CRM</th>
<th>الفرص المرتبطة</th>
<th>آخر تحديث</th>
<th>إجراءات</th>
</tr>
</thead>
<tbody>
<?php if (empty($organizations)): ?>
<tr><td colspan="7" style="text-align: center; padding: 40px; color: var(--text-muted);">لا توجد منظمات أو جهات استثمارية حالياً. يرجى تشغيل جامع البيانات أو إضافة جهة يدوياً.</td></tr>
<?php else: ?>
<?php foreach ($organizations as $org): ?>
<?php
$trans = [
'vc' => 'رأس مال جريء',
'angel' => 'مستثمر ملائكي',
'accelerator' => 'مسرعة أعمال',
'incubator' => 'حاضنة أعمال',
'venture_studio' => 'استوديو مشاريع',
'partner' => 'شريك',
'other' => 'أخرى'
];
$transType = $trans[$org['type']] ?? $org['type'];
$crmTrans = [
'New' => 'جديد',
'Researching' => 'قيد البحث',
'Contacted' => 'تم التواصل',
'Invested' => 'تم الاستثمار',
'Rejected' => 'مرفوض'
];
$transCrmStatus = $crmTrans[$org['crm_status']] ?? $org['crm_status'];
?>
<tr>
<td>
<a href="/admin/organizations/<?= $org['id'] ?>" style="font-weight: 600;">
<?= $this->escape($org['name']) ?>
</a>
<?php if ($org['domain']): ?>
<br><small style="color: var(--text-muted);"><?= $this->escape($org['domain']) ?></small>
<?php endif; ?>
</td>
<td><span class="badge badge-<?= $org['type'] ?>"><?= $this->escape($transType) ?></span></td>
<td><?= $this->escape($org['country'] ?? '-') ?></td>
<td><span class="badge badge-status-<?= strtolower(str_replace(' ', '-', $org['crm_status'])) ?>"><?= $this->escape($transCrmStatus) ?></span></td>
<td><?= $org['opportunities_count'] ?? 0 ?></td>
<td><?= date('Y-m-d', strtotime($org['updated_at'])) ?></td>
<td>
<a href="/admin/organizations/<?= $org['id'] ?>" class="btn btn-sm btn-secondary">عرض</a>
<a href="/admin/organizations/<?= $org['id'] ?>/edit" class="btn btn-sm btn-secondary">تعديل</a>
<a href="/admin/contacts/create?organization_id=<?= $org['id'] ?>" class="btn btn-sm btn-secondary">+ جهة اتصال</a>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</div>
<!-- Pagination -->
<?php if ($total > $perPage): ?>
<div class="pagination">
<?php for ($i = 1; $i <= ceil($total / $perPage); $i++): ?>
<a href="?page=<?= $i ?>&type=<?= $type ?>&search=<?= urlencode($search) ?>" class="btn btn-sm <?= $i === $page ? 'btn-primary' : 'btn-secondary' ?>"><?= $i ?></a>
<?php endfor; ?>
</div>
<?php endif; ?>
<style>
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.filters-bar { margin-bottom: 20px; }
.filters-form { display: flex; gap: 12px; flex-wrap: wrap; }
.filters-form .form-control { min-width: 200px; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.data-table th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); font-weight: 600; }
.data-table tr:hover { background: rgba(255,255,255,0.02); }
.badge { display: inline-block; padding: 4px 10px; border-radius: 12px; font-size: 0.78rem; font-weight: 600; }
.badge-vc { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }
.badge-angel { background: rgba(251, 191, 36, 0.2); color: #fbbf24; }
.badge-accelerator { background: rgba(52, 211, 153, 0.2); color: #34d399; }
.badge-incubator { background: rgba(56, 189, 248, 0.2); color: #38bdf8; }
.badge-venture_studio { background: rgba(248, 113, 113, 0.2); color: #f87171; }
.badge-partner { background: rgba(167, 139, 250, 0.2); color: #a78bfa; }
.badge-status-new { background: rgba(96, 165, 250, 0.2); color: #60a5fa; }
.badge-status-researching { background: rgba(251, 191, 36, 0.2); color: #fbbf24; }
.badge-status-contacted { background: rgba(52, 211, 153, 0.2); color: #34d399; }
.badge-status-invested { background: rgba(34, 197, 94, 0.2); color: #22c55e; }
.badge-status-rejected { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.pagination { display: flex; gap: 8px; margin-top: 20px; justify-content: center; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
</style>