src/Money/Module/Budget/Controller/Budget.php
public function ajaxModal()
    {
        if (!Server::getInstance()->isAjax() || !Server::getInstance()->isPost()) {
            throw new \RuntimeException();
        }

        $loadCategories = true;
        $loadBudgets    = true;

        $params =  $this->route->getParameterCollection();
        $modal  = ucfirst($params->getByName('modal_type')->getValue());

        $budgetMapper = new BudgetMapper(Database::get('money'));

        switch ($modal) {
            case 'Create':
                $budget    = $budgetMapper->newDataInstance();
                $accountId = $params->getByName('id')->getValue();
                $this->verifyAccount($accountId);
                break;
            case 'Edit':
                $budgetId  = $params->getByName('id')->getValue();
                $budget    = $budgetMapper->findById($budgetId);
                $accountId = $budget->getAccountId();
                $this->verifyAccount($accountId);

                $date = Post::getInstance()->get('currentDate');
                $date = \DateTimeImmutable::createFromFormat('d/m/Y', $date);

                $list = $budget->getAllBudgetCategory();
                $budgetCategories = array();
                foreach ($list as $budgetCategory) {
                    $budgetCategories[$budgetCategory->getCategoryId()] = $budgetCategory;
                }

                $budgetMonthMapper = new BudgetMonthMapper(Database::get('money'));
                $budgetMonth = $budgetMonthMapper->findByBudgetId($budgetId, $date);

                $this->dataCollection->add('budgetCategories', $budgetCategories);
                $this->dataCollection->add('budgetMonth', $budgetMonth);
                break;
            case 'Delete':
                $budgetId       = $params->getByName('id')->getValue();
                $budget         = $budgetMapper->findById($budgetId);
                $accountId      = $budget->getAccountId();

                $this->verifyAccount($accountId);

                $loadCategories = false;
                $loadBudgets    = false;
                break;
            case 'Transactions':
                $budgetId  = $params->getByName('id')->getValue();
                $budget    = $budgetMapper->findById($budgetId);
                $accountId = $budget->getAccountId();

                $this->verifyAccount($accountId);

                $date = Post::getInstance()->get('currentDate');
                $date = \DateTimeImmutable::createFromFormat('d/m/Y', $date);

                $this->dataCollection->add('transactions', $budget->getTransactions($date));
                $loadCategories = false;
                $loadBudgets    = false;
                break;
            default:
                throw new \Exception('Bad modal type!');
        }

        //~ Verify if account is for current user, else throw error 500
        $account = $this->verifyAccount($accountId);

        if ($loadCategories) {
            $categoryMapper = new CategoryMapper(Database::get('money'));
            $categories     = $categoryMapper->findAllByAccountId($accountId);
            $this->dataCollection->add('categories',  $categories);
        }

        if ($loadBudgets) {
            $budgets = $budgetMapper->findAllByAccountId($accountId);
            $this->dataCollection->add('budgets',  $budgets);
        }

        $this->dataCollection->add('date',       new \DateTimeImmutable());
        $this->dataCollection->add('budget',     $budget);
        $this->dataCollection->add('account',    $account);

        return $this->getResponse('Modal/' . $modal, true);
    }
public function ajaxModal()
    {
        if (!Server::getInstance()->isAjax() || !Server::getInstance()->isPost()) {
            throw new \RuntimeException();
        }

        $loadCategories = true;
        $loadBudgets    = true;

        $params =  $this->route->getParameterCollection();
        $modal  = ucfirst($params->getByName('modal_type')->getValue());

        $budgetMapper = new BudgetMapper(Database::get('money'));

        switch ($modal) {
            case 'Create':
                $budget    = $budgetMapper->newDataInstance();
                $accountId = $params->getByName('id')->getValue();
                $this->verifyAccount($accountId);
                break;
            case 'Edit':
                $budgetId  = $params->getByName('id')->getValue();
                $budget    = $budgetMapper->findById($budgetId);
                $accountId = $budget->getAccountId();
                $this->verifyAccount($accountId);

                $date = Post::getInstance()->get('currentDate');
                $date = \DateTimeImmutable::createFromFormat('d/m/Y', $date);

                $list = $budget->getAllBudgetCategory();
                $budgetCategories = array();
                foreach ($list as $budgetCategory) {
                    $budgetCategories[$budgetCategory->getCategoryId()] = $budgetCategory;
                }

                $budgetMonthMapper = new BudgetMonthMapper(Database::get('money'));
                $budgetMonth = $budgetMonthMapper->findByBudgetId($budgetId, $date);

                $this->dataCollection->add('budgetCategories', $budgetCategories);
                $this->dataCollection->add('budgetMonth', $budgetMonth);
                break;
            case 'Delete':
                $budgetId       = $params->getByName('id')->getValue();
                $budget         = $budgetMapper->findById($budgetId);
                $accountId      = $budget->getAccountId();

                $this->verifyAccount($accountId);

                $loadCategories = false;
                $loadBudgets    = false;
                break;
            case 'Transactions':
                $budgetId  = $params->getByName('id')->getValue();
                $budget    = $budgetMapper->findById($budgetId);
                $accountId = $budget->getAccountId();

                $this->verifyAccount($accountId);

                $date = Post::getInstance()->get('currentDate');
                $date = \DateTimeImmutable::createFromFormat('d/m/Y', $date);

                $this->dataCollection->add('transactions', $budget->getTransactions($date));
                $loadCategories = false;
                $loadBudgets    = false;
                break;
            default:
                throw new \Exception('Bad modal type!');
        }

        //~ Verify if account is for current user, else throw error 500
        $account = $this->verifyAccount($accountId);

        if ($loadCategories) {
            $categoryMapper = new CategoryMapper(Database::get('money'));
            $categories     = $categoryMapper->findAllByAccountId($accountId);
            $this->dataCollection->add('categories',  $categories);
        }

        if ($loadBudgets) {
            $budgets = $budgetMapper->findAllByAccountId($accountId);
            $this->dataCollection->add('budgets',  $budgets);
        }

        $this->dataCollection->add('date',       new \DateTimeImmutable());
        $this->dataCollection->add('budget',     $budget);
        $this->dataCollection->add('account',    $account);

        return $this->getResponse('Modal/' . $modal, true);
    }
Return html code for transaction modal edit / create

@return ResponseInterface
@throws \Exception