add CRM module start

This commit is contained in:
root
2026-01-15 07:09:36 +03:00
parent b14f293a45
commit b810a17649
40 changed files with 3807 additions and 14 deletions
@@ -0,0 +1,55 @@
<?php
namespace App\Modules\CRM\Controllers;
use App\Controllers\BaseController;
use App\Modules\CRM\Models\DealModel;
use App\Modules\CRM\Models\DealStageModel;
use App\Modules\CRM\Models\ContactModel;
use App\Modules\Clients\Models\ClientModel;
class DashboardController extends BaseController
{
protected DealModel $dealModel;
protected DealStageModel $stageModel;
protected ContactModel $contactModel;
protected ClientModel $clientModel;
public function __construct()
{
$this->dealModel = new DealModel();
$this->stageModel = new DealStageModel();
$this->contactModel = new ContactModel();
$this->clientModel = new ClientModel();
}
/**
* Главная страница CRM - дашборд
*/
public function index()
{
$organizationId = $this->requireActiveOrg();
// Статистика по сделкам
$stats = $this->dealModel->getDealStats($organizationId);
// Количество контактов
$contactsCount = $this->contactModel->where('organization_id', $organizationId)->countAllResults();
// Количество клиентов
$clientsCount = $this->clientModel->where('organization_id', $organizationId)->countAllResults();
// Количество этапов
$stagesCount = $this->stageModel->where('organization_id', $organizationId)->countAllResults();
return $this->renderTwig('@CRM/dashboard', [
'title' => 'CRM - Панель управления',
'stats' => $stats,
'counts' => [
'contacts' => $contactsCount,
'clients' => $clientsCount,
'stages' => $stagesCount,
],
]);
}
}