diff --git a/app/AdminModule/Components/GroupsGridControl.php b/app/AdminModule/Components/GroupsGridControl.php deleted file mode 100644 index aa34f68c2..000000000 --- a/app/AdminModule/Components/GroupsGridControl.php +++ /dev/null @@ -1,235 +0,0 @@ -sessionSection = $session->getSection('srs'); - } - - /** - * Vykreslí komponentu. - */ - public function render(): void - { - $this->template->setFile(__DIR__ . '/templates/groups_grid.latte'); - $this->template->render(); - } - - /** - * Vytvoří komponentu. - * - * @throws Throwable - * @throws DataGridColumnStatusException - * @throws DataGridException - */ - public function createComponentPatrolsGrid(string $name): DataGrid - { - $grid = new DataGrid($this, $name); - $grid->setTranslator($this->translator); - $grid->setDataSource($this->repository->createQueryBuilder('p')); - $grid->setDefaultSort(['displayName' => 'ASC']); - $grid->setColumnsHideable(); - $grid->setItemsPerPageList([25, 50, 100, 250, 500]); - $grid->setStrictSessionFilterValues(false); - - $stamp = date(Helpers::DATE_FORMAT); - $grid->addExportCsv('admin.common.export_all', 'NSJ2023 Skupiny ' . $stamp . '.csv'); - $grid->addExportCsvFiltered('admin.common.export_filter', 'NSJ2023 Skupiny fi ' . $stamp . '.csv'); - - $grid->addGroupAction('Export seznamu skupin') - ->onSelect[] = [$this, 'groupExportUsers']; - - $grid->addColumnText('id', 'ID') - ->setSortable(); - - $grid->addColumnText('state', 'Stav')->setSortable() - ->setRenderer(fn ($t) => $this->translator->translate('common.application_state.' . $t->getState())) - ->setFilterText(); - - $grid->addColumnText('name', 'Název') - ->setSortable() - ->setFilterText(); - - $grid->addColumnText('variableSymbol', 'VS ', 'variableSymbolText') - ->setSortable() - ->setSortableCallback(static function (QueryBuilder $qb, array $sort): void { - $sortRev = $sort['variableSymbolText'] === 'DESC' ? 'ASC' : 'DESC'; - $qb->join('p.variableSymbol', 'VS') - ->orderBy('VS.variableSymbol', $sortRev); - }) - ->setFilterText() - ->setCondition(static function (QueryBuilder $qb, string $value): void { -// $qb->join('p.applications', 'uAVS') - $qb->join('p.variableSymbol', 'VS') - ->andWhere('VS.variableSymbol LIKE :variableSymbol') - ->setParameter(':variableSymbol', '%' . $value . '%'); - }); - - $grid->addColumnLink('leader', 'Vedoucí', ':detail', 'leader.displayName', ['id' => 'leader.id'])->setSortable() -// return Html::el('a')->setAttribute('href', $this->getPresenter()->link('detail', $leader->getId()))->setText($leader->getDisplayName()); - ->setFilterText(); - - $grid->addColumnDateTime('applicationDate', 'Datum založení') - ->setRenderer(static function (Troop $p) { - $date = $p->getApplicationDate(); - - return $date ? $date->format(Helpers::DATETIME_FORMAT) : ''; - }) - ->setSortable(); - - $grid->addColumnText('pairingCode', 'Kód Jamoddílu')->setFilterText(); - - $grid->addColumnText('fee', 'Cena getFee')->setSortable()->setFilterText(); - -// $grid->addColumnText('fee2', 'Cena countFee') -// ->setRenderer(static fn (Troop $t) => $t->countFee()); - - $grid->addColumnDateTime('paymentDate', 'Datum zaplacení') - ->setRenderer(static function (Troop $p) { - $date = $p->getPaymentDate(); - - return $date ? $date->format(Helpers::DATETIME_FORMAT) : ''; - }) - ->setSortable(); - - $grid->addColumnDateTime('maturityDate', 'Datum splatnosti') - ->setRenderer(static function (Troop $p) { - $date = $p->getmaturityDate(); - - return $date ? $date->format(Helpers::DATETIME_FORMAT) : ''; - }) - ->setSortable(); - -// $grid->addColumnText('troop', 'Oddíl - přidat link') -// ->setRenderer( function (Patrol $p) { $troop = $p->getTroop(); -// return Html::el("a")->setAttribute("href",$this->link("troopDetail",$troop->getId()))->setText($troop->getName()); - -//}); // link na oddíl - - $grid->addColumnText('numPersons', '# osob') -// ->setSortableCallback(static fn($qb,$vals) =>sort($vals)) - ->setRenderer(static fn (Troop $p) => $p->countUsersInRoles([Role::PATROL_LEADER, Role::LEADER, Role::ESCORT, Role::ATTENDEE])); - - $grid->addColumnText('numChilder', '# rádců') -// ->setSortableCallback(static fn($qb,$vals) =>sort($vals)) - ->setRenderer(static fn (Troop $p) => $p->countUsersInRoles([Role::PATROL_LEADER])); - - $grid->addColumnText('numAdults', '# dospělých') -// ->setSortableCallback(static fn($qb,$vals) =>sort($vals)) - ->setRenderer(static fn (Troop $p) => $p->countUsersInRoles([Role::LEADER, Role::ESCORT])); - - $grid->addColumnText('numPatrols', '# družin') -// ->setSortableCallback(static fn($qb,$vals) =>sort($vals)) - ->setRenderer(static fn (Troop $p) => count($p->getConfirmedPatrols())); - - $grid->addAction('generatePaymentProof', 'Stáhnout potvzrení o přijetí platby', 'generatePaymentProof'); - $grid->allowRowsAction('generatePaymentProof', static fn (Troop $troop) => $troop->getPaymentDate() !== null); - -// $grid->addAction('detail', 'admin.common.detail', 'Users:groupDetail') // destinace ,todo group_detail.latte -// ->setClass('btn btn-xs btn-primary'); - -// $grid->addAction('delete', '', 'delete!') -// ->setIcon('trash') -// ->setTitle('admin.common.delete') -// ->setClass('btn btn-xs btn-danger') -// ->addAttributes([ -// 'data-toggle' => 'confirmation', -// 'data-content' => $this->translator->translate('admin.users.users_delete_confirm'), -// ]); - - return $grid; - } - -// /** -// * Zpracuje odstranění externí skupiny. -// * -// * @throws AbortException -// */ -// public function handleDelete(int $id): void -// { -// $rec = $this->repository->findById($id); -// -// $this->repository->remove($rec); -// -// $p = $this->getPresenter(); -// $p->flashMessage('Skupina smazána.', 'success'); -// $p->redirect('this'); -// } - - /** - * Vygeneruje potvrzení o přijetí platby. - * - * @throws AbortException - */ - public function handleGeneratePaymentProof(int $id): void - { - $this->presenter->redirect(':Export:TroopIncomeProof:troop', ['id' => $id]); - } - - /** - * Hromadně vyexportuje seznam družin. - * - * @param int[] $ids - * - * @throws AbortException - */ - public function groupExportUsers(array $ids): void - { - $this->sessionSection->patrolIds = $ids; - $this->redirect('exportusers'); - } - - /** - * Zpracuje export seznamu družin. - * - * @throws AbortException - * @throws Exception - */ - public function handleExportUsers(): void - { - $ids = $this->session->getSection('srs')->patrolIds; - - $res = $this->repository->createQueryBuilder('p')->where('p.id IN (:ids)') // stejne se v teto class querybuilder pouziva - ->setParameter('ids', $ids)->getQuery()->getResult(); // otestovat , podivat se na vzor (export uzivatelu) - - $users = new ArrayCollection($res); - $response = $this->excelExportService->exportUsersList($users, 'seznam-uzivatelu.xlsx'); // nutna nova metoda - - $this->getPresenter()->sendResponse($response); - } -} diff --git a/app/AdminModule/Components/IGroupsGridControlFactory.php b/app/AdminModule/Components/IGroupsGridControlFactory.php deleted file mode 100644 index a05426e9c..000000000 --- a/app/AdminModule/Components/IGroupsGridControlFactory.php +++ /dev/null @@ -1,16 +0,0 @@ -sessionSection = $session->getSection('srs'); - } - - /** - * Vykreslí komponentu. - */ - public function render(): void - { - $this->template->setFile(__DIR__ . '/templates/patrols_grid.latte'); - $this->template->render(); - } - - /** - * Vytvoří komponentu. - * - * @throws Throwable - * @throws DataGridColumnStatusException - * @throws DataGridException - */ - public function createComponentPatrolsGrid(string $name): DataGrid - { - $grid = new DataGrid($this, $name); - $grid->setTranslator($this->translator); - $grid->setDataSource($this->repository->createQueryBuilder('p')->where('p.confirmed = true')); - $grid->setDefaultSort(['displayName' => 'ASC']); - $grid->setColumnsHideable(); - $grid->setItemsPerPageList([25, 50, 100, 250, 500]); - $grid->setStrictSessionFilterValues(false); - - $stamp = date(Helpers::DATE_FORMAT); - $grid->addExportCsv('admin.common.export_all', 'NSJ2023 Druziny ' . $stamp . '.csv'); - $grid->addExportCsvFiltered('admin.common.export_filter', 'NSJ2023 Druziny fi ' . $stamp . '.csv'); - - $grid->addGroupAction('Export seznamu družin') - ->onSelect[] = [$this, 'groupExportUsers']; - - $grid->addColumnText('id', 'ID') - ->setSortable(); - - $grid->addColumnText('name', 'Název') - ->setSortable() - ->setFilterText(); - -// $grid->addColumnText('leader', 'Vedoucí') -// ->setRenderer(static function (Patrol $p) { -// return $leader = $p->countUsersInRoles([Role::LEADER]); {{ todo -// -// }) -// ->setFilterText(); - - $grid->addColumnDateTime('created', 'Datum založení') - ->setRenderer(static function (Patrol $p) { - $date = $p->getTroop()->getApplicationDate(); - - return $date ? $date->format(Helpers::DATETIME_FORMAT) : ''; - }) - ->setSortable(); - - $grid->addColumnText('troop', 'Oddíl - přidat link') - ->setRenderer(function (Patrol $p) { - $troop = $p->getTroop(); - - return Html::el('a')->setAttribute('href', $this->link('troopDetail', $troop->getId()))->setText($troop->getName()); - }); // link na oddíl - - $grid->addColumnText('userRoles', 'Počet 1') - ->setRenderer(static fn (Patrol $p) => count($p->getUsersRoles())); // je to správné číslo? - -// $grid->addColumnText('notRegisteredMandatoryBlocksCount', 'admin.users.users_not_registered_mandatory_blocks') -// ->setRenderer(static function (User $user) { -// return Html::el('span') -// ->setAttribute('data-toggle', 'tooltip') -// ->setAttribute('title', $user->getNotRegisteredMandatoryBlocksText()) -// ->setText($user->getNotRegisteredMandatoryBlocksCount()); -// }) -// ->setSortable(); - - - $grid->addAction('detail', 'admin.common.detail', 'Users:detail') // destinace - ->setClass('btn btn-xs btn-primary'); - -// $grid->addAction('delete', '', 'delete!') -// ->setIcon('trash') -// ->setTitle('admin.common.delete') -// ->setClass('btn btn-xs btn-danger') -// ->addAttributes([ -// 'data-toggle' => 'confirmation', -// 'data-content' => $this->translator->translate('admin.users.users_delete_confirm'), -// ]); - - return $grid; - } - -// /** -// * Zpracuje odstranění externího uživatele. -// * -// * @throws AbortException -// */ -// public function handleDelete(int $id): void -// { -// $patrol = $this->repository->findById($id); -// -// $this->repository->remove($patrol); -// -// $p = $this->getPresenter(); -// $p->flashMessage('Družina smazána', 'success'); -// $p->redirect('this'); -// } - - /** - * Hromadně vyexportuje seznam družin. - * - * @param int[] $ids - * - * @throws AbortException - */ - public function groupExportUsers(array $ids): void - { - $this->sessionSection->patrolIds = $ids; - $this->redirect('exportusers'); - } - - /** - * Zpracuje export seznamu družin. - * - * @throws AbortException - * @throws Exception - */ - public function handleExportUsers(): void - { - $ids = $this->session->getSection('srs')->patrolIds; - - $res = $this->repository->createQueryBuilder('p')->where('p.id IN (:ids)') // stejne se v teto class querybuilder pouziva - ->setParameter('ids', $ids)->getQuery()->getResult(); // otestovat , podivat se na vzor (export uzivatelu) - - $users = new ArrayCollection($res); - $response = $this->excelExportService->exportUsersList($users, 'seznam-uzivatelu.xlsx'); // nutna nova metoda - - $this->getPresenter()->sendResponse($response); - } -} diff --git a/app/AdminModule/Presenters/templates/Dashboard/default.latte b/app/AdminModule/Presenters/templates/Dashboard/default.latte index 70d1d4822..eb825a122 100644 --- a/app/AdminModule/Presenters/templates/Dashboard/default.latte +++ b/app/AdminModule/Presenters/templates/Dashboard/default.latte @@ -67,18 +67,18 @@
{_admin.menu.users}
- +
{_admin.users.menu.persons}
- +
{_admin.users.menu.patrols}
- -
{_admin.users.menu.groups} +
+
{_admin.users.menu.troops}
diff --git a/app/AdminModule/Presenters/templates/includes/main_menu.latte b/app/AdminModule/Presenters/templates/includes/main_menu.latte index 68f22ea40..08f700d77 100644 --- a/app/AdminModule/Presenters/templates/includes/main_menu.latte +++ b/app/AdminModule/Presenters/templates/includes/main_menu.latte @@ -23,8 +23,11 @@ {_admin.menu.program} -
  • - {_admin.menu.users} +
  • + {_admin.menu.users}
  • diff --git a/app/AdminModule/ProgramModule/Components/ProgramAttendeesGridControl.php b/app/AdminModule/ProgramModule/Components/ProgramAttendeesGridControl.php index 32912a2ee..9a4f338ff 100644 --- a/app/AdminModule/ProgramModule/Components/ProgramAttendeesGridControl.php +++ b/app/AdminModule/ProgramModule/Components/ProgramAttendeesGridControl.php @@ -149,7 +149,7 @@ public function createComponentProgramAttendeesGrid(string $name): void $grid->setDefaultFilter(['attends' => 'yes'], false); if ($user->isAllowed(SrsResource::USERS, Permission::MANAGE)) { - $grid->addAction('detail', 'admin.common.detail', ':Admin:Users:detail') + $grid->addAction('detail', 'admin.common.detail', ':Admin:Users:Users:detail') ->setClass('btn btn-xs btn-primary') ->addAttributes(['target' => '_blank']); } diff --git a/app/AdminModule/Components/ApplicationsGridControl.php b/app/AdminModule/UsersModule/Components/ApplicationsGridControl.php similarity index 99% rename from app/AdminModule/Components/ApplicationsGridControl.php rename to app/AdminModule/UsersModule/Components/ApplicationsGridControl.php index 30488b6bd..45bfbb790 100644 --- a/app/AdminModule/Components/ApplicationsGridControl.php +++ b/app/AdminModule/UsersModule/Components/ApplicationsGridControl.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\AdminModule\Components; +namespace App\AdminModule\UsersModule\Components; use App\Model\Application\Application; use App\Model\Application\Repositories\ApplicationRepository; diff --git a/app/AdminModule/Components/IApplicationsGridControlFactory.php b/app/AdminModule/UsersModule/Components/IApplicationsGridControlFactory.php similarity index 82% rename from app/AdminModule/Components/IApplicationsGridControlFactory.php rename to app/AdminModule/UsersModule/Components/IApplicationsGridControlFactory.php index 827874ad0..41deaf012 100644 --- a/app/AdminModule/Components/IApplicationsGridControlFactory.php +++ b/app/AdminModule/UsersModule/Components/IApplicationsGridControlFactory.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\AdminModule\Components; +namespace App\AdminModule\UsersModule\Components; /** * Factory komponenty pro správu přihlášek. diff --git a/app/AdminModule/Components/IPatrolsGridControlFactory.php b/app/AdminModule/UsersModule/Components/IPatrolsGridControlFactory.php similarity index 81% rename from app/AdminModule/Components/IPatrolsGridControlFactory.php rename to app/AdminModule/UsersModule/Components/IPatrolsGridControlFactory.php index de8d1fbf5..9c77a6562 100644 --- a/app/AdminModule/Components/IPatrolsGridControlFactory.php +++ b/app/AdminModule/UsersModule/Components/IPatrolsGridControlFactory.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\AdminModule\Components; +namespace App\AdminModule\UsersModule\Components; /** * Factory komponenty pro správu družin. diff --git a/app/AdminModule/UsersModule/Components/ITroopsGridControlFactory.php b/app/AdminModule/UsersModule/Components/ITroopsGridControlFactory.php new file mode 100644 index 000000000..53f7a5420 --- /dev/null +++ b/app/AdminModule/UsersModule/Components/ITroopsGridControlFactory.php @@ -0,0 +1,16 @@ +template->setFile(__DIR__ . '/templates/patrols_grid.latte'); + $this->template->render(); + } + + /** + * Vytvoří komponentu. + * + * @throws Throwable + * @throws DataGridColumnStatusException + * @throws DataGridException + */ + public function createComponentPatrolsGrid(string $name): DataGrid + { + $grid = new DataGrid($this, $name); + $grid->setTranslator($this->translator); + $grid->setDataSource($this->repository->createQueryBuilder('p')->where('p.confirmed = true')); + $grid->setDefaultSort(['displayName' => 'ASC']); + $grid->setColumnsHideable(); + $grid->setItemsPerPageList([25, 50, 100, 250, 500]); + $grid->setStrictSessionFilterValues(false); + + $stamp = date(Helpers::DATE_FORMAT); + $grid->addExportCsv('admin.common.export_all', 'NSJ2023 Druziny ' . $stamp . '.csv'); + $grid->addExportCsvFiltered('admin.common.export_filter', 'NSJ2023 Druziny fi ' . $stamp . '.csv'); + + $grid->addColumnText('name', 'Název') + ->setSortable() + ->setFilterText(); + + $grid->addColumnText('troop', 'Skupina') + ->setRenderer(function (Patrol $p) { + $troop = $p->getTroop(); + + return Html::el('a')->setAttribute('href', $this->getPresenter()->link('Troops:detail', $troop->getId()))->setText($troop->getName()); + }); + + $grid->addColumnDateTime('created', 'Datum založení') + ->setRenderer(static function (Patrol $p) { + $date = $p->getTroop()->getApplicationDate(); + + return $date ? $date->format(Helpers::DATETIME_FORMAT) : ''; + }) + ->setSortable(); + + $grid->addColumnText('userRoles', 'Počet osob') + ->setRenderer(static fn (Patrol $p) => count($p->getUsersRoles())); // je to správné číslo? + +// $grid->addAction('detail', 'admin.common.detail', 'Patrols:detail') // destinace +// ->setClass('btn btn-xs btn-primary'); + +// $grid->addAction('delete', '', 'delete!') +// ->setIcon('trash') +// ->setTitle('admin.common.delete') +// ->setClass('btn btn-xs btn-danger') +// ->addAttributes([ +// 'data-toggle' => 'confirmation', +// 'data-content' => $this->translator->translate('admin.users.users_delete_confirm'), +// ]); + + return $grid; + } +} diff --git a/app/AdminModule/UsersModule/Components/TroopsGridControl.php b/app/AdminModule/UsersModule/Components/TroopsGridControl.php new file mode 100644 index 000000000..c64587342 --- /dev/null +++ b/app/AdminModule/UsersModule/Components/TroopsGridControl.php @@ -0,0 +1,175 @@ +template->setFile(__DIR__ . '/templates/troops_grid.latte'); + $this->template->render(); + } + + /** + * Vytvoří komponentu. + * + * @throws Throwable + * @throws DataGridColumnStatusException + * @throws DataGridException + */ + public function createComponentPatrolsGrid(string $name): DataGrid + { + $grid = new DataGrid($this, $name); + $grid->setTranslator($this->translator); + $grid->setDataSource($this->repository->createQueryBuilder('p')); + $grid->setDefaultSort(['displayName' => 'ASC']); + $grid->setColumnsHideable(); + $grid->setItemsPerPageList([25, 50, 100, 250, 500]); + $grid->setStrictSessionFilterValues(false); + + $stamp = date(Helpers::DATE_FORMAT); + $grid->addExportCsv('admin.common.export_all', 'NSJ2023 Skupiny ' . $stamp . '.csv'); + $grid->addExportCsvFiltered('admin.common.export_filter', 'NSJ2023 Skupiny fi ' . $stamp . '.csv'); + + $grid->addColumnText('name', 'Název') + ->setSortable() + ->setFilterText(); + + $grid->addColumnText('state', 'Stav') + ->setSortable() + ->setRenderer(fn ($t) => $this->translator->translate('common.application_state.' . $t->getState())) + ->setFilterText(); + + $grid->addColumnText('variableSymbol', 'Variabilní symbol', 'variableSymbolText') + ->setSortable() + ->setSortableCallback(static function (QueryBuilder $qb, array $sort): void { + $sortRev = $sort['variableSymbolText'] === 'DESC' ? 'DESC' : 'ASC'; + $qb->join('p.variableSymbol', 'pVS') + ->orderBy('pVS.variableSymbol', $sortRev); + }) + ->setFilterText() + ->setCondition(static function (QueryBuilder $qb, string $value): void { + $qb->join('p.variableSymbol', 'pVS') + ->andWhere('pVS.variableSymbol LIKE :variableSymbol') + ->setParameter(':variableSymbol', '%' . $value . '%'); + }); + + $grid->addColumnText('leader', 'Vedoucí') + ->setRenderer(function (Troop $t) { + $leader = $t->getLeader(); + + return Html::el('a')->setAttribute('href', $this->getPresenter()->link('Users:detail', $leader->getId()))->setText($leader->getDisplayName()); + }); + + $grid->addColumnDateTime('applicationDate', 'Datum založení') + ->setRenderer(static function (Troop $p) { + $date = $p->getApplicationDate(); + + return $date ? $date->format(Helpers::DATETIME_FORMAT) : ''; + }) + ->setSortable(); + + $grid->addColumnNumber('fee', 'Cena')->setSortable()->setFilterText(); + + $grid->addColumnDateTime('maturityDate', 'Datum splatnosti') + ->setFormat(Helpers::DATE_FORMAT) + ->setSortable(); + + $grid->addColumnDateTime('paymentDate', 'Datum platby') + ->setFormat(Helpers::DATE_FORMAT) + ->setSortable(); + + $grid->addColumnText('pairingCode', 'Kód jamoddílu') + ->setFilterText(); + + $grid->addColumnNumber('numPersons', '# osob') +// ->setSortableCallback(static fn($qb,$vals) =>sort($vals)) + ->setRenderer(static fn (Troop $p) => $p->countUsersInRoles([Role::PATROL_LEADER, Role::LEADER, Role::ESCORT, Role::ATTENDEE])); + + $grid->addColumnNumber('numChilder', '# rádců') +// ->setSortableCallback(static fn($qb,$vals) =>sort($vals)) + ->setRenderer(static fn (Troop $p) => $p->countUsersInRoles([Role::PATROL_LEADER])); + + $grid->addColumnNumber('numAdults', '# dospělých') +// ->setSortableCallback(static fn($qb,$vals) =>sort($vals)) + ->setRenderer(static fn (Troop $p) => $p->countUsersInRoles([Role::LEADER, Role::ESCORT])); + + $grid->addColumnNumber('numPatrols', '# družin') +// ->setSortableCallback(static fn($qb,$vals) =>sort($vals)) + ->setRenderer(static fn (Troop $p) => count($p->getConfirmedPatrols())); + + $grid->addAction('generatePaymentProof', 'Stáhnout potvzrení o přijetí platby', 'generatePaymentProof'); + $grid->allowRowsAction('generatePaymentProof', static fn (Troop $troop) => $troop->getPaymentDate() !== null); + + $grid->addAction('detail', 'admin.common.detail', 'Troops:detail') + ->setClass('btn btn-xs btn-primary'); + +// $grid->addAction('delete', '', 'delete!') +// ->setIcon('trash') +// ->setTitle('admin.common.delete') +// ->setClass('btn btn-xs btn-danger') +// ->addAttributes([ +// 'data-toggle' => 'confirmation', +// 'data-content' => $this->translator->translate('admin.users.users_delete_confirm'), +// ]); + + return $grid; + } + +// /** +// * Zpracuje odstranění externí skupiny. +// * +// * @throws AbortException +// */ +// public function handleDelete(int $id): void +// { +// $rec = $this->repository->findById($id); +// +// $this->repository->remove($rec); +// +// $p = $this->getPresenter(); +// $p->flashMessage('Skupina smazána.', 'success'); +// $p->redirect('this'); +// } + + /** + * Vygeneruje potvrzení o přijetí platby. + * + * @throws AbortException + */ + public function handleGeneratePaymentProof(int $id): void + { + $this->presenter->redirect(':Export:TroopIncomeProof:troop', ['id' => $id]); + } +} diff --git a/app/AdminModule/Components/UsersGridControl.php b/app/AdminModule/UsersModule/Components/UsersGridControl.php similarity index 99% rename from app/AdminModule/Components/UsersGridControl.php rename to app/AdminModule/UsersModule/Components/UsersGridControl.php index 1d8181ac8..d7b3c4b1d 100644 --- a/app/AdminModule/Components/UsersGridControl.php +++ b/app/AdminModule/UsersModule/Components/UsersGridControl.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\AdminModule\Components; +namespace App\AdminModule\UsersModule\Components; use App\Model\Acl\Repositories\RoleRepository; use App\Model\Acl\Role; diff --git a/app/AdminModule/Components/templates/applications_grid.latte b/app/AdminModule/UsersModule/Components/templates/applications_grid.latte similarity index 100% rename from app/AdminModule/Components/templates/applications_grid.latte rename to app/AdminModule/UsersModule/Components/templates/applications_grid.latte diff --git a/app/AdminModule/Components/templates/applications_grid_detail.latte b/app/AdminModule/UsersModule/Components/templates/applications_grid_detail.latte similarity index 100% rename from app/AdminModule/Components/templates/applications_grid_detail.latte rename to app/AdminModule/UsersModule/Components/templates/applications_grid_detail.latte diff --git a/app/AdminModule/Components/templates/patrols_grid.latte b/app/AdminModule/UsersModule/Components/templates/patrols_grid.latte similarity index 100% rename from app/AdminModule/Components/templates/patrols_grid.latte rename to app/AdminModule/UsersModule/Components/templates/patrols_grid.latte diff --git a/app/AdminModule/Components/templates/groups_grid.latte b/app/AdminModule/UsersModule/Components/templates/troops_grid.latte similarity index 100% rename from app/AdminModule/Components/templates/groups_grid.latte rename to app/AdminModule/UsersModule/Components/templates/troops_grid.latte diff --git a/app/AdminModule/Components/templates/users_grid.latte b/app/AdminModule/UsersModule/Components/templates/users_grid.latte similarity index 100% rename from app/AdminModule/Components/templates/users_grid.latte rename to app/AdminModule/UsersModule/Components/templates/users_grid.latte diff --git a/app/AdminModule/Forms/AddLectorFormFactory.php b/app/AdminModule/UsersModule/Forms/AddLectorFormFactory.php similarity index 98% rename from app/AdminModule/Forms/AddLectorFormFactory.php rename to app/AdminModule/UsersModule/Forms/AddLectorFormFactory.php index 9bbcbd9c1..73bfd9d90 100644 --- a/app/AdminModule/Forms/AddLectorFormFactory.php +++ b/app/AdminModule/UsersModule/Forms/AddLectorFormFactory.php @@ -2,8 +2,9 @@ declare(strict_types=1); -namespace App\AdminModule\Forms; +namespace App\AdminModule\UsersModule\Forms; +use App\AdminModule\Forms\BaseFormFactory; use App\Model\Acl\Repositories\RoleRepository; use App\Model\Acl\Role; use App\Model\User\Repositories\UserRepository; diff --git a/app/AdminModule/Forms/EditUserPersonalDetailsFormFactory.php b/app/AdminModule/UsersModule/Forms/EditUserPersonalDetailsFormFactory.php similarity index 98% rename from app/AdminModule/Forms/EditUserPersonalDetailsFormFactory.php rename to app/AdminModule/UsersModule/Forms/EditUserPersonalDetailsFormFactory.php index 27de00856..594cca030 100644 --- a/app/AdminModule/Forms/EditUserPersonalDetailsFormFactory.php +++ b/app/AdminModule/UsersModule/Forms/EditUserPersonalDetailsFormFactory.php @@ -2,8 +2,9 @@ declare(strict_types=1); -namespace App\AdminModule\Forms; +namespace App\AdminModule\UsersModule\Forms; +use App\AdminModule\Forms\BaseFormFactory; use App\Model\User\Repositories\UserRepository; use App\Model\User\User; use App\Services\FilesService; diff --git a/app/AdminModule/Forms/EditUserSeminarFormFactory.php b/app/AdminModule/UsersModule/Forms/EditUserSeminarFormFactory.php similarity index 99% rename from app/AdminModule/Forms/EditUserSeminarFormFactory.php rename to app/AdminModule/UsersModule/Forms/EditUserSeminarFormFactory.php index ce0683ba2..4ca83eb67 100644 --- a/app/AdminModule/Forms/EditUserSeminarFormFactory.php +++ b/app/AdminModule/UsersModule/Forms/EditUserSeminarFormFactory.php @@ -2,8 +2,9 @@ declare(strict_types=1); -namespace App\AdminModule\Forms; +namespace App\AdminModule\UsersModule\Forms; +use App\AdminModule\Forms\BaseFormFactory; use App\Model\Acl\Repositories\RoleRepository; use App\Model\Acl\Role; use App\Model\CustomInput\CustomCheckbox; diff --git a/app/AdminModule/UsersModule/Presenters/PatrolsPresenter.php b/app/AdminModule/UsersModule/Presenters/PatrolsPresenter.php new file mode 100644 index 000000000..33a14ef43 --- /dev/null +++ b/app/AdminModule/UsersModule/Presenters/PatrolsPresenter.php @@ -0,0 +1,26 @@ +patrolsGridControlFactory->create(); + } +} diff --git a/app/AdminModule/UsersModule/Presenters/TroopsPresenter.php b/app/AdminModule/UsersModule/Presenters/TroopsPresenter.php new file mode 100644 index 000000000..7cc7912c8 --- /dev/null +++ b/app/AdminModule/UsersModule/Presenters/TroopsPresenter.php @@ -0,0 +1,36 @@ +troopsGridControlFactory->create(); + } + + public function renderDetail(int $id): void + { + $troop = $this->troopRepository->findById($id); + $this->template->troop = $troop; + } +} diff --git a/app/AdminModule/UsersModule/Presenters/UsersBasePresenter.php b/app/AdminModule/UsersModule/Presenters/UsersBasePresenter.php new file mode 100644 index 000000000..033cbb365 --- /dev/null +++ b/app/AdminModule/UsersModule/Presenters/UsersBasePresenter.php @@ -0,0 +1,28 @@ +checkPermission(Permission::MANAGE); + } +} diff --git a/app/AdminModule/Presenters/UsersPresenter.php b/app/AdminModule/UsersModule/Presenters/UsersPresenter.php similarity index 83% rename from app/AdminModule/Presenters/UsersPresenter.php rename to app/AdminModule/UsersModule/Presenters/UsersPresenter.php index aaaaae822..eba13dff6 100644 --- a/app/AdminModule/Presenters/UsersPresenter.php +++ b/app/AdminModule/UsersModule/Presenters/UsersPresenter.php @@ -2,20 +2,15 @@ declare(strict_types=1); -namespace App\AdminModule\Presenters; - -use App\AdminModule\Components\ApplicationsGridControl; -use App\AdminModule\Components\GroupsGridControl; -use App\AdminModule\Components\IApplicationsGridControlFactory; -use App\AdminModule\Components\IGroupsGridControlFactory; -use App\AdminModule\Components\IPatrolsGridControlFactory; -use App\AdminModule\Components\IUsersGridControlFactory; -use App\AdminModule\Components\PatrolsGridControl; -use App\AdminModule\Components\UsersGridControl; -use App\AdminModule\Forms\AddLectorFormFactory; -use App\AdminModule\Forms\EditUserPersonalDetailsFormFactory; -use App\AdminModule\Forms\EditUserSeminarFormFactory; -use App\Model\Acl\Permission; +namespace App\AdminModule\UsersModule\Presenters; + +use App\AdminModule\UsersModule\Components\ApplicationsGridControl; +use App\AdminModule\UsersModule\Components\IApplicationsGridControlFactory; +use App\AdminModule\UsersModule\Components\IUsersGridControlFactory; +use App\AdminModule\UsersModule\Components\UsersGridControl; +use App\AdminModule\UsersModule\Forms\AddLectorFormFactory; +use App\AdminModule\UsersModule\Forms\EditUserPersonalDetailsFormFactory; +use App\AdminModule\UsersModule\Forms\EditUserSeminarFormFactory; use App\Model\Acl\Role; use App\Model\Acl\SrsResource; use App\Model\CustomInput\CustomInput; @@ -24,7 +19,6 @@ use App\Model\Enums\PaymentType; use App\Model\User\Queries\UserAttendsProgramsQuery; use App\Services\ApplicationService; -use App\Services\ExcelExportService; use Nette\Application\AbortException; use Nette\Application\UI\Form; use Nette\DI\Attributes\Inject; @@ -34,19 +28,13 @@ /** * Presenter obsluhující správu uživatelů. */ -class UsersPresenter extends AdminBasePresenter +class UsersPresenter extends UsersBasePresenter { protected string $resource = SrsResource::USERS; #[Inject] public IUsersGridControlFactory $usersGridControlFactory; - #[Inject] - public IPatrolsGridControlFactory $patrolsGridControlFactory; - - #[Inject] - public IGroupsGridControlFactory $GroupsGridControlFactory; - #[Inject] public AddLectorFormFactory $addLectorFormFactory; @@ -59,9 +47,6 @@ class UsersPresenter extends AdminBasePresenter #[Inject] public IApplicationsGridControlFactory $applicationsGridControlFactory; - #[Inject] - public ExcelExportService $excelExportService; - #[Inject] public CustomInputRepository $customInputRepository; @@ -75,8 +60,6 @@ public function startup(): void { parent::startup(); - $this->checkPermission(Permission::MANAGE); - $this->template->results = []; $this->template->editPersonalDetails = false; $this->template->editSeminar = false; @@ -189,16 +172,6 @@ protected function createComponentUsersGrid(): UsersGridControl return $this->usersGridControlFactory->create(); } - protected function createComponentPatrolsGrid(): PatrolsGridControl - { - return $this->patrolsGridControlFactory->create(); - } - - protected function createComponentGroupsGrid(): GroupsGridControl - { - return $this->GroupsGridControlFactory->create(); - } - protected function createComponentAddLectorForm(): Form { $form = $this->addLectorFormFactory->create(); diff --git a/app/AdminModule/UsersModule/Presenters/templates/@layout.latte b/app/AdminModule/UsersModule/Presenters/templates/@layout.latte new file mode 100644 index 000000000..1cc7452c7 --- /dev/null +++ b/app/AdminModule/UsersModule/Presenters/templates/@layout.latte @@ -0,0 +1,2 @@ +{layout '../../../Presenters/templates/@layout.latte'} +{import 'sidebar.latte'} \ No newline at end of file diff --git a/app/AdminModule/UsersModule/Presenters/templates/Patrols/default.latte b/app/AdminModule/UsersModule/Presenters/templates/Patrols/default.latte new file mode 100644 index 000000000..125f2de60 --- /dev/null +++ b/app/AdminModule/UsersModule/Presenters/templates/Patrols/default.latte @@ -0,0 +1,4 @@ +{block main} +

    {_admin.users.patrols.heading}

    + {control patrolsGrid} +{/block} \ No newline at end of file diff --git a/app/AdminModule/UsersModule/Presenters/templates/Troops/default.latte b/app/AdminModule/UsersModule/Presenters/templates/Troops/default.latte new file mode 100644 index 000000000..b355f1152 --- /dev/null +++ b/app/AdminModule/UsersModule/Presenters/templates/Troops/default.latte @@ -0,0 +1,4 @@ +{block main} +

    {_admin.users.troops.heading}

    + {control troopsGrid} +{/block} \ No newline at end of file diff --git a/app/AdminModule/UsersModule/Presenters/templates/Troops/detail.latte b/app/AdminModule/UsersModule/Presenters/templates/Troops/detail.latte new file mode 100644 index 000000000..464e8f240 --- /dev/null +++ b/app/AdminModule/UsersModule/Presenters/templates/Troops/detail.latte @@ -0,0 +1,93 @@ +{block main} +

    Detail skupiny: {$troop->getName()}

    + +

    Základní údaje

    +
    +
    +
    Stav
    +
    {_'common.application_state.' . $troop->getState()}
    +
    +
    +
    Variabilní symbol
    +
    {$troop->getVariableSymbolText()}
    +
    + +
    +
    Datum založení
    +
    {$troop->getApplicationDate()|date:'j. n. Y H:i'}
    +
    +
    +
    Cena
    +
    {$troop->getFee()}
    +
    +
    +
    Datum splatnosti
    +
    {$troop->getMaturityDate()|date:'j. n. Y'}
    +
    +
    +
    Datum platby
    +
    {$troop->getPaymentDate()|date:'j. n. Y'}
    +
    +
    +
    Kód jamooodílu
    +
    {$troop->getPairingCode()}
    +
    +
    + +

    Seznam členů

    + + + + + + + + + + + + + + + + + +
    JménoRoleDatum narozeníZdravotní údaje
    + + {$userRole->getUser()->getDisplayName()} + + {$userRole->getRole()->getName()}{$userRole->getUser()->getBirthdate()|date:"j. n. Y"}{$userRole->getUser()->getHealthInfo()}
    + +
    +

    Družina: {$patrol->getName()}

    + + + + + + + + + + + + + + + + + +
    JménoRoleDatum narozeníZdravotní údaje
    + + {$userRole->getUser()->getDisplayName()} + + {$userRole->getRole()->getName()}{$userRole->getUser()->getBirthdate()|date:"j. n. Y"}{$userRole->getUser()->getHealthInfo()}
    +
    +{/block} diff --git a/app/AdminModule/Presenters/templates/Users/add.latte b/app/AdminModule/UsersModule/Presenters/templates/Users/add.latte similarity index 100% rename from app/AdminModule/Presenters/templates/Users/add.latte rename to app/AdminModule/UsersModule/Presenters/templates/Users/add.latte diff --git a/app/AdminModule/Presenters/templates/Users/default.latte b/app/AdminModule/UsersModule/Presenters/templates/Users/default.latte similarity index 100% rename from app/AdminModule/Presenters/templates/Users/default.latte rename to app/AdminModule/UsersModule/Presenters/templates/Users/default.latte diff --git a/app/AdminModule/Presenters/templates/Users/detail.latte b/app/AdminModule/UsersModule/Presenters/templates/Users/detail.latte similarity index 100% rename from app/AdminModule/Presenters/templates/Users/detail.latte rename to app/AdminModule/UsersModule/Presenters/templates/Users/detail.latte diff --git a/app/AdminModule/Presenters/templates/Users/sidebar.latte b/app/AdminModule/UsersModule/Presenters/templates/Users/sidebar.latte similarity index 100% rename from app/AdminModule/Presenters/templates/Users/sidebar.latte rename to app/AdminModule/UsersModule/Presenters/templates/Users/sidebar.latte diff --git a/app/AdminModule/UsersModule/Presenters/templates/sidebar.latte b/app/AdminModule/UsersModule/Presenters/templates/sidebar.latte new file mode 100644 index 000000000..be6cca607 --- /dev/null +++ b/app/AdminModule/UsersModule/Presenters/templates/sidebar.latte @@ -0,0 +1,15 @@ +{block sidebar} +
    + +
    +{/block} \ No newline at end of file diff --git a/app/Router/RouterFactory.php b/app/Router/RouterFactory.php index 3997ce19a..7e02de8e0 100644 --- a/app/Router/RouterFactory.php +++ b/app/Router/RouterFactory.php @@ -58,6 +58,13 @@ public function createRouter(): RouteList 'id' => null, ]); + $router->addRoute('admin/users//[/]', [ + 'module' => 'Admin:Users', + 'presenter' => 'Users', + 'action' => 'default', + 'id' => null, + ]); + $router->addRoute('admin/payments//[/]', [ 'module' => 'Admin:Payments', 'presenter' => 'Payments', diff --git a/app/lang/admin.cs_CZ.neon b/app/lang/admin.cs_CZ.neon index 6da7e8570..310d570b9 100644 --- a/app/lang/admin.cs_CZ.neon +++ b/app/lang/admin.cs_CZ.neon @@ -387,8 +387,7 @@ program: users: menu: persons: "Osoby" - groups: "Skupiny" - troops: "Oddíly" + troops: "Skupiny" patrols: "Družiny" users_heading: "Uživatelé" @@ -515,6 +514,12 @@ users: users_detail_schedule: "Harmonogram" users_detail_birthdate_age: "%birthdate% (%age% let)" + troops: + heading: Skupiny + + patrols: + heading: Družiny + payments: payments: heading: "Platby" diff --git a/app/lang/common.cs_CZ.neon b/app/lang/common.cs_CZ.neon index 3b4a77a88..824208f48 100644 --- a/app/lang/common.cs_CZ.neon +++ b/app/lang/common.cs_CZ.neon @@ -119,7 +119,7 @@ application_state: canceled: "Zrušeno" paid: "Zaplaceno" paid_free: "Zaplaceno (zdarma)" - draft: "nepotvrzené (draft)" + draft: "Nepotvrzeno" calendar_view: timeGridSeminar: "Na výšku"