diff --git a/src/Repository/Modules/Notes/MyNotesCategoriesRepository.php b/src/Repository/Modules/Notes/MyNotesCategoriesRepository.php index 58f8dc1c..2feed0b9 100644 --- a/src/Repository/Modules/Notes/MyNotesCategoriesRepository.php +++ b/src/Repository/Modules/Notes/MyNotesCategoriesRepository.php @@ -199,7 +199,6 @@ public function getCategories(bool $only_categories_with_notes = false): array AND mnc.deleted = 0 GROUP BY mnc.name - ORDER BY -childrens_id DESC "; $statement = $connection->prepare($sql); diff --git a/src/Twig/GlobalVariables.php b/src/Twig/GlobalVariables.php index 698cd8e8..cc35a650 100755 --- a/src/Twig/GlobalVariables.php +++ b/src/Twig/GlobalVariables.php @@ -2,6 +2,7 @@ namespace App\Twig; +use App\Controller\Modules\Notes\MyNotesCategoriesController; use App\Controller\Modules\Notes\MyNotesController; use App\Controller\Utils\Application; use App\DTO\Settings\Finances\SettingsFinancesDTO; @@ -30,17 +31,21 @@ class GlobalVariables extends AbstractExtension { */ private $my_notes_controller; - public function __construct(Application $app, MyNotesController $my_notes_controller) { - $this->app = $app; - $this->my_notes_controller = $my_notes_controller; + private $my_notes_categories_controller; + + public function __construct(Application $app, MyNotesController $my_notes_controller, MyNotesCategoriesController $my_notes_categories_controller) { + $this->app = $app; + $this->my_notes_controller = $my_notes_controller; + $this->my_notes_categories_controller = $my_notes_categories_controller; } public function getFunctions() { return [ - new TwigFunction('getMyNotesCategories', [$this, 'getMyNotesCategories']), - new TwigFunction('getSchedulesTypes', [$this, 'getSchedulesTypes']), + new TwigFunction('getMyNotesCategories', [$this, 'getMyNotesCategories']), + new TwigFunction('getSchedulesTypes', [$this, 'getSchedulesTypes']), new TwigFunction('getSchedulesForNotifications', [$this, 'getSchedulesForNotifications']), - new TwigFunction('getFinancesCurrenciesDtos', [$this, 'getFinancesCurrenciesDtos']), + new TwigFunction('getFinancesCurrenciesDtos', [$this, 'getFinancesCurrenciesDtos']), + new TwigFunction('buildCategoriesDepths', [$this, 'buildCategoriesDepths']), ]; } @@ -77,6 +82,14 @@ public function getMyNotesCategories($filter = false) { return $new_results; } + /** + * @return array + */ + public function buildCategoriesDepths(): array { + $depths = $this->my_notes_categories_controller->buildCategoriesDepths(); + return $depths; + } + /** * @return MyScheduleType[] */ diff --git a/templates/modules/my-notes/components/note-edit-modal-body.html.twig b/templates/modules/my-notes/components/note-edit-modal-body.html.twig index 02f11619..9adf9a20 100644 --- a/templates/modules/my-notes/components/note-edit-modal-body.html.twig +++ b/templates/modules/my-notes/components/note-edit-modal-body.html.twig @@ -13,10 +13,21 @@