Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Úpravy pro NSJ (přihlašování skupin) #876

Draft
wants to merge 41 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
cca3a58
nsj branch with deployment to dev
Sep 22, 2022
71a1686
php 8.1 image
jan-stanek Sep 22, 2022
48975fe
execute test for nsj/master (#887)
jan-stanek Oct 6, 2022
da8b12b
Úprava databázového modelu pro skupiny (#886)
jan-stanek Oct 15, 2022
a6f43a1
úpravy rolí (#888)
bojovyletoun Oct 19, 2022
21d5f76
Registrační formulář (#889)
jan-stanek Oct 27, 2022
a9796fc
Opravy registračního formuláře (#893)
jan-stanek Nov 1, 2022
3cdd7cc
Admin module prehledy - rebased (#895)
jan-stanek Nov 1, 2022
a5792c6
Update error message to be more descriptive (#896)
davidurban Nov 1, 2022
6be789e
opravy přehledů (#898)
bojovyletoun Nov 3, 2022
64eade7
copy menu file during deploy (#899)
jan-stanek Nov 3, 2022
ff4c390
Oprava přihlášky servis týmu (#900)
jan-stanek Nov 3, 2022
52dddd4
payment info in form, buttons hidden (#901)
jan-stanek Nov 8, 2022
ceb74ac
Nepovolení kombinace doprovodu a vedoucího družiny (#904)
jan-stanek Nov 8, 2022
f8af136
oprava počtu dospělých (#906)
bojovyletoun Nov 10, 2022
d4e7a80
Exporty (#903)
bojovyletoun Nov 10, 2022
2d329e1
srs-dev deployment fix
jan-stanek Nov 13, 2022
605dd09
Exporty (upravený formát data) (#907)
bojovyletoun Nov 27, 2022
21a7b7e
Párování plateb (#909)
jan-stanek Nov 27, 2022
9b480b2
Ruční akce pro párování nespárovaných plateb (#923)
jan-stanek Nov 27, 2022
aa2efe4
Potvrzení platby (#922)
jan-stanek Nov 28, 2022
fde5823
Oprava dokladů (#924)
jan-stanek Nov 28, 2022
5ea7c8d
limit only for attendees (#932)
jan-stanek Dec 2, 2022
65bf734
Oprava odstranění posledního člena (#934)
jan-stanek Dec 3, 2022
bb66136
login fix (#937)
jan-stanek Dec 13, 2022
8ad3f63
Filtrovani,razeni VS (#936)
bojovyletoun Dec 13, 2022
ad0775c
Oprava přihlášení pro přidané účastníky 2 (#939)
jan-stanek Dec 16, 2022
831968d
Detail skupiny (#940)
jan-stanek Dec 25, 2022
fa80ca9
Mazání skupin a družin (#941)
jan-stanek Dec 26, 2022
148463b
Skupinové role v tabulce uživatelů (#944)
jan-stanek Jan 10, 2023
78c0a72
remove troop fix (#947)
jan-stanek Jan 10, 2023
de81920
E-mail vedoucího skupiny (#948)
jan-stanek Jan 18, 2023
700b1f0
Načtení členství ze skautIS (#949)
jan-stanek Jan 21, 2023
1bd53da
Filtrování skupinových rolí (#951)
jan-stanek Jan 21, 2023
ecc6c58
Export troops, patrols to excel (#953)
jan-stanek Jan 31, 2023
b2387c0
Vypínatelná registrace (#958)
jan-stanek Mar 3, 2023
d6ef49e
Zapomenutá migrace (#959)
jan-stanek Mar 3, 2023
a072047
Oprava deploymentu (NSJ) (#964)
jan-stanek Apr 9, 2023
ab240b2
Export účastníků NSJ (#965)
jan-stanek Apr 11, 2023
71ac4bf
Export vlastních polí pro NSJ (#966)
jan-stanek Apr 12, 2023
3c7d3a4
Export skupin pro NSJ, deduplikace exportu uživatelů (#967)
jan-stanek Apr 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
deploy:
name: "Deploy to test-srs.skauting.cz"
environment: test-srs.skauting.cz
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
container:
image: skaut/lebeda:8.1
env:
Expand All @@ -39,6 +39,7 @@ jobs:
DEPLOY_SSH_USERNAME: ${{ secrets.DEPLOY_SSH_USERNAME }}
steps:
- uses: actions/checkout@v3
- run: git config --global --add safe.directory '*'
# Copy & paste from https://github.com/actions/cache/blob/master/examples.md#php---composer
- name: Get composer cache
id: composer-cache
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/deploy-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
deploy:
name: "Manual deploy to ${{ github.event.inputs.environment }}"
environment: ${{ github.event.inputs.environment }}
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
container:
image: skaut/lebeda:8.1
env:
Expand All @@ -42,6 +42,7 @@ jobs:
DEPLOY_SSH_USERNAME: ${{ secrets.DEPLOY_SSH_USERNAME }}
steps:
- uses: actions/checkout@v3
- run: git config --global --add safe.directory '*'
# Copy & paste from https://github.com/actions/cache/blob/master/examples.md#php---composer
- name: Get composer cache
id: composer-cache
Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/deploy-nsj-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: deploy-nsj-dev

on:
push:
branches: [nsj/master]

concurrency:
group: environment-nsj-dev

jobs:
deploy:
name: "Deploy to srs-dev.skauting.cz"
environment: srs-dev.skauting.cz
runs-on: ubuntu-22.04
container:
image: skaut/lebeda:8.1
env:
CONFIG_DATABASE_HOST: ${{ secrets.CONFIG_DATABASE_HOST }}
CONFIG_DATABASE_NAME: ${{ secrets.CONFIG_DATABASE_NAME }}
CONFIG_DATABASE_PASSWORD: ${{ secrets.CONFIG_DATABASE_PASSWORD }}
CONFIG_DATABASE_USER: ${{ secrets.CONFIG_DATABASE_USER }}
CONFIG_MAIL_HOST:
CONFIG_MAIL_PASSWORD:
CONFIG_MAIL_PORT: 0
CONFIG_MAIL_SECURE:
CONFIG_MAIL_SMTP: false
CONFIG_MAIL_USERNAME:
CONFIG_SKAUTIS_APPLICATION_ID: ${{ secrets.CONFIG_SKAUTIS_APPLICATION_ID }}
CONFIG_SKAUTIS_TEST_MODE: ${{ secrets.CONFIG_SKAUTIS_TEST_MODE }}
CONFIG_RECAPTCHA_SITE_KEY: ${{ secrets.CONFIG_RECAPTCHA_SITE_KEY }}
CONFIG_RECAPTCHA_SECRET_KEY: ${{ secrets.CONFIG_RECAPTCHA_SECRET_KEY }}
DEPLOY_DIRECTORY: ${{ secrets.DEPLOY_DIRECTORY }}
DEPLOY_LEBEDA: ${{ secrets.DEPLOY_LEBEDA }}
DEPLOY_SSH_HOST: ${{ secrets.DEPLOY_SSH_HOST }}
DEPLOY_SSH_IP: ${{ secrets.DEPLOY_SSH_IP }}
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
DEPLOY_SSH_PORT: ${{ secrets.DEPLOY_SSH_PORT }}
DEPLOY_SSH_USERNAME: ${{ secrets.DEPLOY_SSH_USERNAME }}
steps:
- uses: actions/checkout@v3
- run: git config --global --add safe.directory '*'
# Copy & paste from https://github.com/actions/cache/blob/master/examples.md#php---composer
- name: Get composer cache
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install yarn
run: |
apt-get update
apt-get install -y npm
npm install --global yarn
#Copy & paste from https://github.com/actions/cache/blob/master/examples.md#node---yarn
- name: Get yarn cache
id: yarn-cache
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Setup SSH key and deploy
run: |
mkdir -p /root/.ssh
ssh-keyscan -H "${DEPLOY_SSH_HOST}","${DEPLOY_SSH_IP}" >> /root/.ssh/known_hosts
eval `ssh-agent -s`
echo "${DEPLOY_SSH_KEY}" | tr -d '\r' | ssh-add -
phing deploy
3 changes: 2 additions & 1 deletion .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
deploy:
name: "Deploy to srs.skauting.cz"
environment: srs.skauting.cz
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
container:
image: skaut/lebeda:8.1
env:
Expand All @@ -38,6 +38,7 @@ jobs:
DEPLOY_SSH_USERNAME: ${{ secrets.DEPLOY_SSH_USERNAME }}
steps:
- uses: actions/checkout@v3
- run: git config --global --add safe.directory '*'
# Copy & paste from https://github.com/actions/cache/blob/master/examples.md#php---composer
- name: Get composer cache
id: composer-cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
package:
name: "Create release package"
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
container:
image: skaut/lebeda:8.1
steps:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: test

on:
push:
branches: [master]
branches: [master, nsj/master]
pull_request:
branches: [master]
branches: [master, nsj/master]

concurrency:
group: test-${{ github.ref }}
Expand All @@ -13,7 +13,7 @@ concurrency:
jobs:
workdir:
name: "Build"
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
container:
image: skaut/lebeda:8.1
steps:
Expand Down
34 changes: 34 additions & 0 deletions app/ActionModule/Presenters/PaymentPresenter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

declare(strict_types=1);

namespace App\ActionModule\Presenters;

use App\Model\Payment\Repositories\PaymentRepository;
use App\Services\ApplicationService;
use Nette\Application\Responses\TextResponse;
use Nette\DI\Attributes\Inject;

/**
* Presenter obsluhující párování nespárovaných přihlášek.
*/
class PaymentPresenter extends ActionBasePresenter
{
#[Inject]
public PaymentRepository $paymentRepository;

#[Inject]
public ApplicationService $applicationService;

public function actionPairPayments(): void
{
$notPairedPayments = $this->paymentRepository->findNotPairedVs();

foreach ($notPairedPayments as $payment) {
$this->applicationService->pairPayment($payment);
}

$response = new TextResponse(null);
$this->sendResponse($response);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
namespace App\AdminModule\ConfigurationModule\Forms;

use App\AdminModule\Forms\BaseFormFactory;
use App\Model\Settings\Commands\SetSettingBoolValue;
use App\Model\Settings\Commands\SetSettingDateValue;
use App\Model\Settings\Commands\SetSettingStringValue;
use App\Model\Settings\Queries\SettingBoolValueQuery;
use App\Model\Settings\Queries\SettingDateValueQuery;
use App\Model\Settings\Queries\SettingStringValueQuery;
use App\Model\Settings\Settings;
Expand Down Expand Up @@ -71,13 +73,16 @@ public function create(): Form
$seminarToDate->addRule([$this, 'validateSeminarToDate'], 'admin.configuration.seminar_to_date_before_from', [$seminarToDate, $seminarFromDate]);
$editRegistrationTo->addRule([$this, 'validateEditRegistrationTo'], 'admin.configuration.edit_registration_to_after_from', [$editRegistrationTo, $seminarFromDate]);

$form->addCheckbox('groupRegistrationAllowed', 'povolit registraci nových skupin');

$form->addSubmit('submit', 'admin.common.save');

$form->setDefaults([
'seminarName' => $this->queryBus->handle(new SettingStringValueQuery(Settings::SEMINAR_NAME)),
'seminarFromDate' => $this->queryBus->handle(new SettingDateValueQuery(Settings::SEMINAR_FROM_DATE)),
'seminarToDate' => $this->queryBus->handle(new SettingDateValueQuery(Settings::SEMINAR_TO_DATE)),
'editRegistrationTo' => $this->queryBus->handle(new SettingDateValueQuery(Settings::EDIT_REGISTRATION_TO)),
'groupRegistrationAllowed' => $this->queryBus->handle(new SettingBoolValueQuery(Settings::GROUP_REGISTRATION_ALLOWED)),
]);

$form->onSuccess[] = [$this, 'processForm'];
Expand All @@ -100,6 +105,7 @@ public function processForm(Form $form, stdClass $values): void
$this->commandBus->handle(new SetSettingDateValue(Settings::SEMINAR_FROM_DATE, $values->seminarFromDate));
$this->commandBus->handle(new SetSettingDateValue(Settings::SEMINAR_TO_DATE, $values->seminarToDate));
$this->commandBus->handle(new SetSettingDateValue(Settings::EDIT_REGISTRATION_TO, $values->editRegistrationTo));
$this->commandBus->handle(new SetSettingBoolValue(Settings::GROUP_REGISTRATION_ALLOWED, $values->groupRegistrationAllowed));
}

/**
Expand Down
3 changes: 3 additions & 0 deletions app/AdminModule/Forms/AddRoleFormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ public function processForm(Form $form, stdClass $values): void
$role->setFee($parent->getFee());
$role->setCapacity($parent->getCapacity());
$role->setMinimumAge($parent->getMinimumAge());
$role->setMaximumAge($parent->getMaximumAge());
$role->setMinimumAgeWarning($parent->getMinimumAgeWarning());
$role->setMaximumAgeWarning($parent->getMaximumAgeWarning());
$role->setApprovedAfterRegistration($parent->isApprovedAfterRegistration());
$role->setSyncedWithSkautIS($parent->isSyncedWithSkautIS());
$role->setRegisterable($parent->isRegisterable());
Expand Down
23 changes: 23 additions & 0 deletions app/AdminModule/Forms/EditRoleFormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,23 @@ public function create(int $id): Form
->addRule(Form::INTEGER, 'admin.acl.roles.minimum_age.error_format')
->addRule(Form::MIN, 'admin.acl.roles.minimum_age.error_low', 0);

$form->addText('minimumAgeMsg', 'admin.acl.roles.minimum_age.custom_msg_label')
->setHtmlAttribute('data-toggle', 'tooltip')
->setHtmlAttribute('data-placement', 'bottom')
->setHtmlAttribute('title', $form->getTranslator()->translate('admin.acl.roles.minimum_age.custom_msg_note'));

$form->addText('maximumAge', 'admin.acl.roles.maximum_age.label')
->setHtmlAttribute('data-toggle', 'tooltip')
->setHtmlAttribute('data-placement', 'bottom')
->setHtmlAttribute('title', $form->getTranslator()->translate('admin.acl.roles.maximum_age.note'))
->addRule(Form::INTEGER, 'admin.acl.roles.maximum_age.error_format')
->addRule(Form::MIN, 'admin.acl.roles.maximum_age.error_low', 0);

$form->addText('maximumAgeMsg', 'admin.acl.roles.maximum_age.custom_msg_label')
->setHtmlAttribute('data-toggle', 'tooltip')
->setHtmlAttribute('data-placement', 'bottom')
->setHtmlAttribute('title', $form->getTranslator()->translate('admin.acl.roles.maximum_age.custom_msg_note'));

$form->addMultiSelect('permissions', 'admin.acl.roles_permissions', $this->preparePermissionsOptions());

$pagesOptions = $this->pageRepository->getPagesOptions();
Expand Down Expand Up @@ -164,6 +181,9 @@ public function create(int $id): Form
'feeFromSubevents' => $this->role->getFee() === null,
'fee' => $this->role->getFee() ?? 0,
'minimumAge' => $this->role->getMinimumAge(),
'maximumAge' => $this->role->getMaximumAge(),
'minimumAgeMsg' => $this->role->getMinimumAgeWarning(),
'maximumAgeMsg' => $this->role->getMaximumAgeWarning(),
'permissions' => $this->permissionRepository->findPermissionsIds($this->role->getPermissions()),
'pages' => $this->pageRepository->findPagesSlugs($this->role->getPages()),
'redirectAfterLogin' => array_key_exists($redirectAfterLoginValue, $pagesOptions) ? $redirectAfterLoginValue : null,
Expand Down Expand Up @@ -197,6 +217,9 @@ public function processForm(Form $form, stdClass $values): void
$this->role->setCapacity($capacity);
$this->role->setApprovedAfterRegistration($values->approvedAfterRegistration);
$this->role->setMinimumAge($values->minimumAge);
$this->role->setMaximumAge($values->maximumAge);
$this->role->setMinimumAgeWarning($values->minimumAgeMsg);
$this->role->setMaximumAgeWarning($values->maximumAgeMsg);
$this->role->setPermissions($this->permissionRepository->findPermissionsByIds($values->permissions));
$this->role->setPages($this->pageRepository->findPagesBySlugs($values->pages));
$this->role->setRedirectAfterLogin($values->redirectAfterLogin);
Expand Down
14 changes: 10 additions & 4 deletions app/AdminModule/PaymentsModule/Components/PaymentsGridControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ public function createComponentPaymentsGrid(string $name): void

$grid->addColumnText('pairedApplications', 'admin.payments.payments.paired_applications', 'pairedValidApplicationsText');

$grid->addColumnText('pairedTroops', 'admin.payments.payments.paired_troops', 'pairedTroopsText');

$grid->addColumnText('state', 'admin.payments.payments.state')
->setRenderer(fn (Payment $payment) => $this->translator->translate('common.payment_state.' . $payment->getState()))
->setFilterMultiSelect($this->preparePaymentStatesOptions())
Expand Down Expand Up @@ -173,10 +175,14 @@ public function handleDelete(int $id): void
*/
public function handleGeneratePaymentProofBank(int $id): void
{
$this->session->getSection('srs')->applicationIds = Helpers::getIds(
$this->paymentRepository->findById($id)->getPairedApplications()
);
$this->presenter->redirect(':Export:IncomeProof:applications');
$payment = $this->paymentRepository->findById($id);

if (! $payment->getPairedApplications()->isEmpty()) {
$this->session->getSection('srs')->applicationIds = Helpers::getIds($payment->getPairedApplications());
$this->presenter->redirect(':Export:IncomeProof:applications');
} elseif (! $payment->getPairedTroops()->isEmpty()) {
$this->presenter->redirect(':Export:TroopIncomeProof:troop', ['id' => $payment->getPairedTroops()->get(0)->getId()]);
}
}

/**
Expand Down
29 changes: 21 additions & 8 deletions app/AdminModule/PaymentsModule/Forms/EditPaymentFormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use App\Model\Application\Repositories\ApplicationRepository;
use App\Model\Payment\Payment;
use App\Model\Payment\Repositories\PaymentRepository;
use App\Model\User\Repositories\TroopRepository;
use App\Model\User\Repositories\UserRepository;
use App\Services\ApplicationService;
use Nette;
Expand All @@ -33,6 +34,7 @@ public function __construct(
private PaymentRepository $paymentRepository,
private ApplicationRepository $applicationRepository,
private UserRepository $userRepository,
private TroopRepository $troopRepository,
private ApplicationService $applicationService
) {
}
Expand All @@ -44,6 +46,9 @@ public function create(int $id): Form
{
$this->payment = $this->paymentRepository->findById($id);

$pairedValidApplications = $this->payment->getPairedValidApplications();
$pairedTroops = $this->payment->getPairedTroops();

$form = $this->baseFormFactory->create();

$form->addHidden('id');
Expand All @@ -55,7 +60,19 @@ public function create(int $id): Form

$inputVariableSymbol = $form->addText('variableSymbol', 'admin.payments.payments.variable_symbol');

$inputPairedApplication = $form->addMultiSelect('pairedApplications', 'admin.payments.payments.paired_applications', $this->applicationRepository->getApplicationsVariableSymbolsOptions())
$form->addMultiSelect(
'pairedApplications',
'admin.payments.payments.paired_applications',
$this->applicationRepository->getWaitingForPaymentOrPairedApplicationsVariableSymbolsOptions($pairedValidApplications)
)
->setHtmlAttribute('class', 'datagrid-multiselect')
->setHtmlAttribute('data-live-search', 'true');

$form->addMultiSelect(
'pairedTroops',
'admin.payments.payments.paired_troops',
$this->troopRepository->getWaitingForPaymentOrPairedTroopsVariableSymbolsOptions($pairedTroops)
)
->setHtmlAttribute('class', 'datagrid-multiselect')
->setHtmlAttribute('data-live-search', 'true');

Expand All @@ -81,18 +98,13 @@ public function create(int $id): Form
$inputVariableSymbol->setDisabled();
}

$pairedValidApplications = $this->payment->getPairedValidApplications();

$inputPairedApplication->setItems(
$this->applicationRepository->getWaitingForPaymentOrPairedApplicationsVariableSymbolsOptions($pairedValidApplications)
);

$form->setDefaults([
'id' => $id,
'date' => $this->payment->getDate(),
'amount' => $this->payment->getAmount(),
'variableSymbol' => $this->payment->getVariableSymbol(),
'pairedApplications' => $this->applicationRepository->findApplicationsIds($pairedValidApplications),
'pairedTroops' => $this->troopRepository->findTroopsIds($pairedTroops),
]);

$form->onSuccess[] = [$this, 'processForm'];
Expand All @@ -111,8 +123,9 @@ public function processForm(Form $form, stdClass $values): void
$loggedUser = $this->userRepository->findById($form->getPresenter()->user->id);

$pairedApplications = $this->applicationRepository->findApplicationsByIds($values->pairedApplications);
$pairedTroops = $this->troopRepository->findTroopsByIds($values->pairedTroops);

$this->applicationService->updatePayment($this->payment, $values->date, $values->amount, $values->variableSymbol, $pairedApplications, $loggedUser);
$this->applicationService->updatePayment($this->payment, $values->date, $values->amount, $values->variableSymbol, $pairedApplications, $pairedTroops, $loggedUser);
}
}
}
Loading