Compare commits

...
Author SHA1 Message Date
bence 7f882f2e71 Merge pull request 'RVRNEXT-28 add further checks before manupulating db' (!44) from feature/RVRNEXT-28-check-foreign-key-constraints-before-db into master
rvr-nextgen/pipeline/head This commit looks good
Reviewed-on: #44
2023-05-02 02:58:35 +02:00
bence cb76cbb9b1 RVRNEXT-28 add further checks before manupulating db
rvr-nextgen/pipeline/pr-master This commit looks good
2023-05-02 02:56:16 +02:00
bence 1f32387f63 Merge pull request 'RVRNEXT-30 check if member already has associated transaction' (!43) from bugfix/RVRNEXT-29-prevent-deleting-member-who-has-transaction into master
rvr-nextgen/pipeline/head This commit looks good
Reviewed-on: #43
2023-05-02 02:51:02 +02:00
bence be93c75fe7 RVRNEXT-30 check if member already has associated transaction
rvr-nextgen/pipeline/pr-master This commit looks good
2023-05-02 02:40:27 +02:00
bence 38d18873b8 Merge pull request 'feature/RVRNEXT-30-replace-choices-to-tomselect' (!41) from feature/RVRNEXT-30-replace-choices-to-tomselect into master
rvr-nextgen/pipeline/head This commit looks good
Reviewed-on: #41
2023-05-02 02:24:40 +02:00
bence 5053d37388 RVRNEXT-30 initialize TomSelect in community_members.js
rvr-nextgen/pipeline/pr-master This commit looks good
2023-05-02 02:22:57 +02:00
bence c00be9a49d RVRNEXT-30 remove unnecessary css selector 2023-05-02 02:22:35 +02:00
bence 881280fa3e RVRNEXT-30 use tom-select assets in community_member view 2023-05-02 02:22:10 +02:00
bence 40eb8b5335 RVRNEXT-30 fix submit button name 2023-05-02 02:21:49 +02:00
bence 789e9e199f RVRNEXT-30 install tom-select instead of choices.js 2023-05-02 02:20:40 +02:00
bence be521a42ee Merge pull request 'RVRNEXT-26 show confirmation modal before deleting something' (!40) from feature/RVRNEXT-26-confirmation-before-delete into master
rvr-nextgen/pipeline/head This commit looks good
Reviewed-on: #40
2023-05-02 01:49:13 +02:00
bence 65424c2944 RVRNEXT-26 show confirmation modal before deleting something
rvr-nextgen/pipeline/pr-master This commit looks good
2023-05-02 01:03:39 +02:00
bence 490e48a87a Merge pull request 'rename routes' (!39) from feature/rename-routes into master
rvr-nextgen/pipeline/head This commit looks good
Reviewed-on: #39
2023-05-02 00:06:11 +02:00
bence b958a2f5b3 rename routes
rvr-nextgen/pipeline/pr-master This commit looks good
2023-05-02 00:02:38 +02:00
bence 2da0ccb09b Merge pull request 'feature/layout-improvements' (!38) from feature/layout-improvements into master
rvr-nextgen/pipeline/head This commit looks good
Reviewed-on: #38
2023-05-01 23:42:30 +02:00
bence 584fcaba39 make community layout clearer
rvr-nextgen/pipeline/pr-master This commit looks good
2023-05-01 23:37:30 +02:00
bence b5dc96f98b fix stupid variable names 2023-05-01 23:02:57 +02:00
24 changed files with 338 additions and 215 deletions

No files matched your search

+2 -4
View File
@@ -238,6 +238,7 @@ button.noRightRadius, a.button.noRightRadius {
button.gray, a.button.gray { button.gray, a.button.gray {
background-color: #808080; background-color: #808080;
color: #ffffff;
} }
button.gray:enabled:hover, button.gray:enabled:focus, a.button.gray:hover, a.button.gray:focus { button.gray:enabled:hover, button.gray:enabled:focus, a.button.gray:hover, a.button.gray:focus {
@@ -246,6 +247,7 @@ button.gray:enabled:hover, button.gray:enabled:focus, a.button.gray:hover, a.but
button.red, a.button.red { button.red, a.button.red {
background-color: #aa5e5e; background-color: #aa5e5e;
color: #ffffff;
} }
button.red:enabled:hover, button.red:enabled:focus, a.button.red:hover, a.button.red:focus { button.red:enabled:hover, button.red:enabled:focus, a.button.red:hover, a.button.red:focus {
@@ -526,10 +528,6 @@ p.paginateContainer > *:not(:last-child) {
border-right: solid #869ab9 1px; border-right: solid #869ab9 1px;
} }
.choices__inner {
box-sizing: border-box;
}
@media screen and (max-width: 424px) { @media screen and (max-width: 424px) {
div.gridContainer { div.gridContainer {
grid-template-columns: auto; grid-template-columns: auto;
@@ -1,17 +1,31 @@
(function () { (function () {
const element = document.getElementById('newMember').elements['user_id']; const element = document.getElementById('newMember').elements['user_id'];
const choices = new Choices(element, { const select = new TomSelect(element, {
noResultsText: 'No users found', placeholder: 'User',
noChoicesText: 'Start typing to search users' valueField: 'value',
labelField: 'label',
searchField: 'label',
loadThrottle: 300,
load: function (query, callback) {
var self = this;
RVR.httpRequest('GET', searchUserUrl.replace('QUERY', encodeURIComponent(query)), function () {
self.clearOptions();
callback(this.response.results);
});
},
}); });
element.addEventListener('search', RVR.debounce(async function (e) { select.on('change', function (value) {
RVR.httpRequest('GET', searchUserUrl.replace('QUERY', encodeURIComponent(e.detail.value)), function () { this.clearOptions();
choices.setChoices(this.response.results, 'value', 'label', true); });
});
}));
element.addEventListener('choice', function () { select.on('blur', function (value) {
choices.setChoices([], 'value', 'label', true); this.clearOptions();
});
select.on('type', function (value) {
if (value === '') {
this.clearOptions();
}
}); });
})(); })();
+28 -2
View File
@@ -88,6 +88,28 @@ var RVR = {
} }
}, },
setOnclickForFormConfirmation: function (button) {
button.onclick = function(e) {
e.preventDefault();
var self = this;
RVR.showModalWithContent('Confirmation', this.dataset.confirmation, [
{
type: 'button',
text: self.textContent,
classNames: ['red'],
onclick: function() {
var event = new Event('submit', {'bubbles': true, 'cancelable': true});
self.form.dispatchEvent(event);
RVR.hideModal();
}
}
]);
};
},
showModal: function (id) { showModal: function (id) {
document.getElementById(id).style.visibility = 'visible'; document.getElementById(id).style.visibility = 'visible';
document.getElementById('cover').style.visibility = 'visible'; document.getElementById('cover').style.visibility = 'visible';
@@ -174,7 +196,7 @@ var RVR = {
} }
} }
form.elements.submit.disabled = !anyChanged; form.elements['submit_button'].disabled = !anyChanged;
}, },
observeInputsInForm: function (form, observedInputs) { observeInputsInForm: function (form, observedInputs) {
@@ -197,7 +219,7 @@ var RVR = {
} }
form.onreset = function () { form.onreset = function () {
form.elements.submit.disabled = true; form.elements['submit_button'].disabled = true;
} }
}, },
@@ -234,6 +256,10 @@ var RVR = {
if (form.dataset.observeInputs) { if (form.dataset.observeInputs) {
RVR.observeInputsInForm(form, form.dataset.observeInputs.split(',')); RVR.observeInputsInForm(form, form.dataset.observeInputs.split(','));
} }
if (form.elements['submit_button'] && form.elements['submit_button'].dataset.confirmation) {
RVR.setOnclickForFormConfirmation(form.elements['submit_button']);
}
} }
document.getElementById('cover').onclick = function () { document.getElementById('cover').onclick = function () {
+15 -34
View File
@@ -2,33 +2,18 @@
"requires": true, "requires": true,
"lockfileVersion": 1, "lockfileVersion": 1,
"dependencies": { "dependencies": {
"@babel/runtime": { "@orchidjs/sifter": {
"version": "7.21.0", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.21.0.tgz", "resolved": "https://registry.npmjs.org/@orchidjs/sifter/-/sifter-1.0.3.tgz",
"integrity": "sha512-xwII0//EObnq89Ji5AKYQaRYiW/nZ3llSv29d49IuxPhKbtJoLP+9QUUZ4nVragQVtaVGeZrpB+ZtG/Pdy/POw==", "integrity": "sha512-zCZbwKegHytfsPm8Amcfh7v/4vHqTAaOu6xFswBYcn8nznBOuseu6COB2ON7ez0tFV0mKL0nRNnCiZZA+lU9/g==",
"requires": { "requires": {
"regenerator-runtime": "^0.13.11" "@orchidjs/unicode-variants": "^1.0.4"
} }
}, },
"choices.js": { "@orchidjs/unicode-variants": {
"version": "10.2.0", "version": "1.0.4",
"resolved": "https://registry.npmjs.org/choices.js/-/choices.js-10.2.0.tgz", "resolved": "https://registry.npmjs.org/@orchidjs/unicode-variants/-/unicode-variants-1.0.4.tgz",
"integrity": "sha512-8PKy6wq7BMjNwDTZwr3+Zry6G2+opJaAJDDA/j3yxvqSCnvkKe7ZIFfIyOhoc7htIWFhsfzF9tJpGUATcpUtPg==", "integrity": "sha512-NvVBRnZNE+dugiXERFsET1JlKZfM5lJDEpSMilKW4bToYJ7pxf0Zne78xyXB2ny2c2aHfJ6WLnz1AaTNHAmQeQ=="
"requires": {
"deepmerge": "^4.2.2",
"fuse.js": "^6.6.2",
"redux": "^4.2.0"
}
},
"deepmerge": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz",
"integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A=="
},
"fuse.js": {
"version": "6.6.2",
"resolved": "https://registry.npmjs.org/fuse.js/-/fuse.js-6.6.2.tgz",
"integrity": "sha512-cJaJkxCCxC8qIIcPBF9yGxY0W/tVZS3uEISDxhYIdtk8OL93pe+6Zj7LjCqVV4dzbqcriOZ+kQ/NE4RXZHsIGA=="
}, },
"leaflet": { "leaflet": {
"version": "1.9.3", "version": "1.9.3",
@@ -40,18 +25,14 @@
"resolved": "https://registry.npmjs.org/leaflet.markercluster/-/leaflet.markercluster-1.5.3.tgz", "resolved": "https://registry.npmjs.org/leaflet.markercluster/-/leaflet.markercluster-1.5.3.tgz",
"integrity": "sha512-vPTw/Bndq7eQHjLBVlWpnGeLa3t+3zGiuM7fJwCkiMFq+nmRuG3RI3f7f4N4TDX7T4NpbAXpR2+NTRSEGfCSeA==" "integrity": "sha512-vPTw/Bndq7eQHjLBVlWpnGeLa3t+3zGiuM7fJwCkiMFq+nmRuG3RI3f7f4N4TDX7T4NpbAXpR2+NTRSEGfCSeA=="
}, },
"redux": { "tom-select": {
"version": "4.2.1", "version": "2.2.2",
"resolved": "https://registry.npmjs.org/redux/-/redux-4.2.1.tgz", "resolved": "https://registry.npmjs.org/tom-select/-/tom-select-2.2.2.tgz",
"integrity": "sha512-LAUYz4lc+Do8/g7aeRa8JkyDErK6ekstQaqWQrNRW//MY1TvCEpMtpTWvlQ+FPbWCx+Xixu/6SHt5N0HR+SB4w==", "integrity": "sha512-igGah1yY6yhrnN2h/Ky8I5muw/nE/YQxIsEZoYu5qaA4bsRibvKto3s8QZZosKpOd0uO8fNYhRfAwgHB4IAYew==",
"requires": { "requires": {
"@babel/runtime": "^7.9.2" "@orchidjs/sifter": "^1.0.3",
"@orchidjs/unicode-variants": "^1.0.4"
} }
},
"regenerator-runtime": {
"version": "0.13.11",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
"integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg=="
} }
} }
} }
+1 -1
View File
@@ -2,6 +2,6 @@
"dependencies": { "dependencies": {
"leaflet": "^1.6.0", "leaflet": "^1.6.0",
"leaflet.markercluster": "^1.4.1", "leaflet.markercluster": "^1.4.1",
"choices.js": "^10.2.0" "tom-select": "^2.2.2"
} }
} }
+53 -8
View File
@@ -11,6 +11,7 @@ use RVR\Repository\CommunityRepository;
use RVR\Repository\CommunityMemberRepository; use RVR\Repository\CommunityMemberRepository;
use RVR\Repository\CurrencyExchangeRateRepository; use RVR\Repository\CurrencyExchangeRateRepository;
use RVR\Repository\CurrencyRepository; use RVR\Repository\CurrencyRepository;
use RVR\Repository\TransactionRepository;
use RVR\Repository\UserRepository; use RVR\Repository\UserRepository;
use SokoWeb\Interfaces\Authentication\IAuthenticationRequired; use SokoWeb\Interfaces\Authentication\IAuthenticationRequired;
use SokoWeb\Interfaces\Response\IContent; use SokoWeb\Interfaces\Response\IContent;
@@ -29,6 +30,8 @@ class CommunityController implements IAuthenticationRequired
private CurrencyExchangeRateRepository $currencyExchangeRatesRepository; private CurrencyExchangeRateRepository $currencyExchangeRatesRepository;
private TransactionRepository $transactionRepository;
public function __construct() public function __construct()
{ {
$this->userRepository = new UserRepository(); $this->userRepository = new UserRepository();
@@ -36,6 +39,7 @@ class CommunityController implements IAuthenticationRequired
$this->communityMemberRepository = new CommunityMemberRepository(); $this->communityMemberRepository = new CommunityMemberRepository();
$this->currencyRepository = new CurrencyRepository(); $this->currencyRepository = new CurrencyRepository();
$this->currencyExchangeRatesRepository = new CurrencyExchangeRateRepository(); $this->currencyExchangeRatesRepository = new CurrencyExchangeRateRepository();
$this->transactionRepository = new TransactionRepository();
} }
public function isAuthenticationRequired(): bool public function isAuthenticationRequired(): bool
@@ -53,36 +57,48 @@ class CommunityController implements IAuthenticationRequired
$balanceCalculator = new BalanceCalculator($community); $balanceCalculator = new BalanceCalculator($community);
$debts = $balanceCalculator->calculate(); $debts = $balanceCalculator->calculate();
$debtUsers = []; $debtItems = [];
$debtBalance = 0.0; $debtBalance = 0.0;
$outstandingUsers = []; $outstandingItems = [];
$outstandingBalance = 0.0; $outstandingBalance = 0.0;
foreach ($debts as $debt) { foreach ($debts as $debt) {
if ($debt['payer']->getId() === \Container::$request->user()->getUniqueId()) { if ($debt['payer']->getId() === \Container::$request->user()->getUniqueId()) {
$debtBalance += $debt['amount']; $debtBalance += $debt['amount'];
$debtUsers[] = $debt; $debtItems[] = $debt;
} }
if ($debt['payee']->getId() === \Container::$request->user()->getUniqueId()) { if ($debt['payee']->getId() === \Container::$request->user()->getUniqueId()) {
$outstandingBalance += $debt['amount']; $outstandingBalance += $debt['amount'];
$outstandingUsers[] = $debt; $outstandingItems[] = $debt;
} }
} }
$balance = $outstandingBalance - $debtBalance; $balance = $outstandingBalance - $debtBalance;
return new HtmlContent('communities/community', [ return new HtmlContent('communities/community', [
'community' => $community, 'community' => $community,
'members' => $this->getMembers($community),
'currencies' => $this->getCurrencies($community),
'upcomingEvents' => [], 'upcomingEvents' => [],
'debtUsers' => $debtUsers, 'debtItems' => $debtItems,
'debtBalance' => $debtBalance, 'debtBalance' => $debtBalance,
'outstandingUsers' => $outstandingUsers, 'outstandingItems' => $outstandingItems,
'outstandingBalance' => $outstandingBalance, 'outstandingBalance' => $outstandingBalance,
'balance' => $balance, 'balance' => $balance,
'editPermission' => $ownCommunityMember->getOwner() 'editPermission' => $ownCommunityMember->getOwner()
]); ]);
} }
public function getCommunitySettings(): ?IContent
{
if (!$this->checkPermission(\Container::$request->query('communityId'), false, $community, $ownCommunityMember)) {
return null;
}
return new HtmlContent('communities/community_settings', [
'community' => $community,
'members' => $this->getMembers($community),
'currencies' => $this->getCurrencies($community),
'editPermission' => $ownCommunityMember->getOwner()
]);
}
public function getCommunityNew(): IContent public function getCommunityNew(): IContent
{ {
return new HtmlContent('communities/community_edit'); return new HtmlContent('communities/community_edit');
@@ -183,7 +199,19 @@ class CommunityController implements IAuthenticationRequired
]); ]);
} }
} else { } else {
if ($this->transactionRepository->isAnyCommon()) {
return new JsonContent([
'error' => ['errorText' => 'There are transactions with common payee!']
]);
}
$user = $this->userRepository->getById(\Container::$request->post('user_id')); $user = $this->userRepository->getById(\Container::$request->post('user_id'));
if ($this->communityMemberRepository->getByCommunityAndUser($community, $user) !== null) {
return new JsonContent([
'error' => ['errorText' => 'This user is already a member of this community.']
]);
}
$communityMember = new CommunityMember(); $communityMember = new CommunityMember();
$communityMember->setCommunity($community); $communityMember->setCommunity($community);
$communityMember->setUser($user); $communityMember->setUser($user);
@@ -208,6 +236,13 @@ class CommunityController implements IAuthenticationRequired
]); ]);
} }
\Container::$persistentDataManager->loadRelationsFromDb($communityMember, false, ['user']);
if ($this->transactionRepository->isAnyForUser($communityMember->getUser())) {
return new JsonContent([
'error' => ['errorText' => 'There are transactions where the member is payer or payee!']
]);
}
\Container::$persistentDataManager->deleteFromDb($communityMember); \Container::$persistentDataManager->deleteFromDb($communityMember);
return new JsonContent(['success' => true]); return new JsonContent(['success' => true]);
@@ -272,6 +307,16 @@ class CommunityController implements IAuthenticationRequired
return null; return null;
} }
if ($this->transactionRepository->isAnyForCurrency($currency)) {
return new JsonContent([
'error' => ['errorText' => 'There are transactions with this currency!']
]);
}
foreach ($this->currencyExchangeRatesRepository->getAllByCurrency($currency) as $currencyExchangeRate) {
\Container::$persistentDataManager->deleteFromDb($currencyExchangeRate);
}
\Container::$persistentDataManager->deleteFromDb($currency); \Container::$persistentDataManager->deleteFromDb($currency);
return new JsonContent(['success' => true]); return new JsonContent(['success' => true]);
+7 -7
View File
@@ -53,7 +53,7 @@ class LoginController
$oAuth = new GoogleOAuth(new Request()); $oAuth = new GoogleOAuth(new Request());
$url = $oAuth->getDialogUrl( $url = $oAuth->getDialogUrl(
$state, $state,
\Container::$request->getBase() . \Container::$routeCollection->getRoute('login-google-action')->generateLink(), \Container::$request->getBase() . \Container::$routeCollection->getRoute('login.google-action')->generateLink(),
$nonce $nonce
); );
@@ -106,7 +106,7 @@ class LoginController
return new JsonContent([ return new JsonContent([
'error' => [ 'error' => [
'errorText' => 'No user found with the given email address / username or the given password is wrong. You can <a href="' . 'errorText' => 'No user found with the given email address / username or the given password is wrong. You can <a href="' .
\Container::$routeCollection->getRoute('password-requestReset')->generateLink(['email' => \Container::$request->post('email')]) . '" title="Request password reset">request password reset</a>!' \Container::$routeCollection->getRoute('password.requestReset')->generateLink(['email' => \Container::$request->post('email')]) . '" title="Request password reset">request password reset</a>!'
] ]
]); ]);
} }
@@ -119,7 +119,7 @@ class LoginController
public function loginWithGoogle() public function loginWithGoogle()
{ {
$defaultError = 'Authentication with Google failed. Please <a href="' . \Container::$routeCollection->getRoute('login-google')->generateLink() . '" title="Login with Google">try again</a>!'; $defaultError = 'Authentication with Google failed. Please <a href="' . \Container::$routeCollection->getRoute('login.google')->generateLink() . '" title="Login with Google">try again</a>!';
if (\Container::$request->user() !== null) { if (\Container::$request->user() !== null) {
$this->deleteRedirectUrl(); $this->deleteRedirectUrl();
@@ -133,7 +133,7 @@ class LoginController
$oAuth = new GoogleOAuth(new Request()); $oAuth = new GoogleOAuth(new Request());
$tokenData = $oAuth->getToken( $tokenData = $oAuth->getToken(
\Container::$request->query('code'), \Container::$request->query('code'),
\Container::$request->getBase() . \Container::$routeCollection->getRoute('login-google-action')->generateLink() \Container::$request->getBase() . \Container::$routeCollection->getRoute('login.google-action')->generateLink()
); );
if (!isset($tokenData['id_token'])) { if (!isset($tokenData['id_token'])) {
@@ -246,7 +246,7 @@ class LoginController
if ($resetter === null || $resetter->getExpiresDate() < new DateTime()) { if ($resetter === null || $resetter->getExpiresDate() < new DateTime()) {
return new JsonContent([ return new JsonContent([
'redirect' => [ 'redirect' => [
'target' => \Container::$routeCollection->getRoute('password-reset')->generateLink(['token' => $token]) 'target' => \Container::$routeCollection->getRoute('password.reset')->generateLink(['token' => $token])
] ]
]); ]);
} }
@@ -281,10 +281,10 @@ class LoginController
$mail = new Mail(); $mail = new Mail();
$mail->addRecipient($email); $mail->addRecipient($email);
$mail->setSubject($_ENV['APP_NAME'] . ' - Password reset'); $mail->setSubject($_ENV['APP_NAME'] . ' - Password reset');
$mail->setBodyFromTemplate('password-reset', [ $mail->setBodyFromTemplate('password.reset', [
'EMAIL' => $email, 'EMAIL' => $email,
'RESET_LINK' => \Container::$request->getBase() . 'RESET_LINK' => \Container::$request->getBase() .
\Container::$routeCollection->getRoute('password-reset')->generateLink(['token' => $token]), \Container::$routeCollection->getRoute('password.reset')->generateLink(['token' => $token]),
'EXPIRES' => $expires->format('Y-m-d H:i T') 'EXPIRES' => $expires->format('Y-m-d H:i T')
]); ]);
$mail->send(); $mail->send();
+4 -4
View File
@@ -104,10 +104,10 @@ class OAuthController
{ {
return new JsonContent([ return new JsonContent([
'issuer' => $_ENV['APP_URL'], 'issuer' => $_ENV['APP_URL'],
'authorization_endpoint' => \Container::$request->getBase() . \Container::$routeCollection->getRoute('oauth-auth')->generateLink(), 'authorization_endpoint' => \Container::$request->getBase() . \Container::$routeCollection->getRoute('oauth.auth')->generateLink(),
'token_endpoint' => \Container::$request->getBase() . \Container::$routeCollection->getRoute('oauth-token')->generateLink(), 'token_endpoint' => \Container::$request->getBase() . \Container::$routeCollection->getRoute('oauth.token')->generateLink(),
'userinfo_endpoint' => \Container::$request->getBase() . \Container::$routeCollection->getRoute('oauth-userinfo')->generateLink(), 'userinfo_endpoint' => \Container::$request->getBase() . \Container::$routeCollection->getRoute('oauth.userinfo')->generateLink(),
'jwks_uri' => \Container::$request->getBase() . \Container::$routeCollection->getRoute('oauth-certs')->generateLink(), 'jwks_uri' => \Container::$request->getBase() . \Container::$routeCollection->getRoute('oauth.certs')->generateLink(),
'response_types_supported' => 'response_types_supported' =>
[ [
'code', 'code',
+1
View File
@@ -86,6 +86,7 @@ class TransactionController implements IAuthenticationRequired, ISecured
'exchangeRateCalculator' => $exchangeRateCalculator, 'exchangeRateCalculator' => $exchangeRateCalculator,
'pages' => $pages, 'pages' => $pages,
'currentPage' => $currentPage, 'currentPage' => $currentPage,
'numberOfTransactions' => $numberOfTransactions,
'transactions' => $transactions 'transactions' => $transactions
]); ]);
} }
+28
View File
@@ -3,7 +3,9 @@
use Container; use Container;
use Generator; use Generator;
use RVR\PersistentData\Model\Community; use RVR\PersistentData\Model\Community;
use RVR\PersistentData\Model\Currency;
use RVR\PersistentData\Model\Transaction; use RVR\PersistentData\Model\Transaction;
use RVR\PersistentData\Model\User;
use SokoWeb\Database\Query\Select; use SokoWeb\Database\Query\Select;
class TransactionRepository class TransactionRepository
@@ -25,6 +27,32 @@ class TransactionRepository
return $this->selectAllByCommunity($community)->count(); return $this->selectAllByCommunity($community)->count();
} }
public function isAnyForUser(User $user): bool
{
$select = new Select(Container::$dbConnection, Transaction::getTable());
$select->where('payer_user_id', '=', $user->getId());
$select->orWhere('payee_user_id', '=', $user->getId());
$select->orWhere('payee_user_id', '=', null);
return $select->count() > 0;
}
public function isAnyCommon(): bool
{
$select = new Select(Container::$dbConnection, Transaction::getTable());
$select->where('payee_user_id', '=', null);
return $select->count() > 0;
}
public function isAnyForCurrency(Currency $currency): bool
{
$select = new Select(Container::$dbConnection, Transaction::getTable());
$select->where('currency_id', '=', $currency->getId());
return $select->count() > 0;
}
public function getPagedByCommunity(Community $community, int $start, int $limit, bool $useRelations = false, array $withRelations = []): Generator public function getPagedByCommunity(Community $community, int $start, int $limit, bool $useRelations = false, array $withRelations = []): Generator
{ {
$select = new Select(Container::$dbConnection); $select = new Select(Container::$dbConnection);
+1 -1
View File
@@ -34,7 +34,7 @@
<input type="text" class="text big fullWidth marginTop" name="id_number" placeholder="ID number" value="<?= $user['id_number'] ?>"> <input type="text" class="text big fullWidth marginTop" name="id_number" placeholder="ID number" value="<?= $user['id_number'] ?>">
<p id="accountFormError" class="formError justify marginTop"></p> <p id="accountFormError" class="formError justify marginTop"></p>
<div class="right marginTop"> <div class="right marginTop">
<button type="submit" name="submit" disabled>Save</button> <button type="submit" name="submit_button" disabled>Save</button>
</div> </div>
</form> </form>
</div> </div>
+14 -33
View File
@@ -1,35 +1,16 @@
@extends(templates/layout_normal) @extends(templates/layout_normal)
@section(main) @section(main)
<h2><?= $community->getName() ?> <span class="small">[<a href="<?= Container::$routeCollection->getRoute('community-edit')->generateLink(['communityId' => $community->getId()]) ?>">edit</a>]</span></h2> <h2>
<?= $community->getName() ?>
<?php if ($editPermission): ?>
<span class="small">[<a href="<?= Container::$routeCollection->getRoute('community.edit')->generateLink(['communityId' => $community->getId()]) ?>">edit</a>]</span>
<?php endif; ?>
</h2>
<p class="marginTop"><a href="<?= Container::$routeCollection->getRoute('community.settings')->generateLink(['communityId' => $community->getId()]) ?>">Settings</a></p>
<div class="gridContainer marginTop"> <div class="gridContainer marginTop">
<div>
<h3 class="marginBottom">Members</h3>
<?php foreach ($members as $member): ?>
<p><?= $member->getUser()->getDisplayName() ?></p>
<?php endforeach; ?>
<?php if ($editPermission): ?>
<hr>
<p><a href="<?= Container::$routeCollection->getRoute('community-members')->generateLink(['communityId' => $community->getId()]) ?>">Edit members</a></p>
<?php endif; ?>
</div>
<div>
<h3 class="marginBottom">Currencies</h3>
<?php foreach ($currencies as $currency): ?>
<p>
<?php if ($currency->getId() === $community->getMainCurrencyId()): ?>
<b><?= $currency->getCode() ?></b>
<?php else: ?>
<a href="<?= Container::$routeCollection->getRoute('community-currency-exchange-rates')->generateLink(['communityId' => $community->getId(), 'code' => $currency->getCode()]) ?>"><?= $currency->getCode() ?></a>
<?php endif; ?>
</p>
<?php endforeach; ?>
<?php if ($editPermission): ?>
<hr>
<p><a href="<?= Container::$routeCollection->getRoute('community-currencies')->generateLink(['communityId' => $community->getId()]) ?>">Edit currencies</a></p>
<?php endif; ?>
</div>
<div> <div>
<h3 class="marginBottom">Upcoming events</h3> <h3 class="marginBottom">Upcoming events</h3>
<?php if (count($upcomingEvents) > 0): ?> <?php if (count($upcomingEvents) > 0): ?>
@@ -52,20 +33,20 @@
<td class="bold">You owe</td> <td class="bold">You owe</td>
<td class="mono red" style="text-align: right;"><?= number_format($debtBalance, $mainCurrencyRoundDigits) ?> <?= $mainCurrencyCode ?></td> <td class="mono red" style="text-align: right;"><?= number_format($debtBalance, $mainCurrencyRoundDigits) ?> <?= $mainCurrencyCode ?></td>
</tr> </tr>
<?php foreach ($debtUsers as $owe): ?> <?php foreach ($debtItems as $item): ?>
<tr> <tr>
<td class="small"><?= $owe['payee']->getUser()->getDisplayName() ?></td> <td class="small"><?= $item['payee']->getUser()->getDisplayName() ?></td>
<td class="small mono red" style="text-align: right;"><?= number_format($owe['amount'], $mainCurrencyRoundDigits) ?> <?= $mainCurrencyCode ?></td> <td class="small mono red" style="text-align: right;"><?= number_format($item['amount'], $mainCurrencyRoundDigits) ?> <?= $mainCurrencyCode ?></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
<tr> <tr>
<td class="bold">You're owed</td> <td class="bold">You're owed</td>
<td class="mono green" style="text-align: right;"><?= number_format($outstandingBalance, $mainCurrencyRoundDigits) ?> <?= $mainCurrencyCode ?></td> <td class="mono green" style="text-align: right;"><?= number_format($outstandingBalance, $mainCurrencyRoundDigits) ?> <?= $mainCurrencyCode ?></td>
</tr> </tr>
<?php foreach ($outstandingUsers as $owe): ?> <?php foreach ($outstandingItems as $item): ?>
<tr> <tr>
<td class="small"><?= $owe['payer']->getUser()->getDisplayName() ?></td> <td class="small"><?= $item['payer']->getUser()->getDisplayName() ?></td>
<td class="small mono green" style="text-align: right;"><?= number_format($owe['amount'], $mainCurrencyRoundDigits) ?> <?= $mainCurrencyCode ?></td> <td class="small mono green" style="text-align: right;"><?= number_format($item['amount'], $mainCurrencyRoundDigits) ?> <?= $mainCurrencyCode ?></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
<tr> <tr>
+7 -6
View File
@@ -3,6 +3,7 @@
@section(main) @section(main)
<h2> <h2>
<a href="<?= Container::$routeCollection->getRoute('community')->generateLink(['communityId' => $community->getId()]) ?>"><?= $community->getName() ?></a> » <a href="<?= Container::$routeCollection->getRoute('community')->generateLink(['communityId' => $community->getId()]) ?>"><?= $community->getName() ?></a> »
<a href="<?= Container::$routeCollection->getRoute('community.settings')->generateLink(['communityId' => $community->getId()]) ?>">Settings</a> »
Edit currencies Edit currencies
</h2> </h2>
<div class="box compactBox"> <div class="box compactBox">
@@ -17,31 +18,31 @@
<?php foreach ($currencies as $currency): ?> <?php foreach ($currencies as $currency): ?>
<tr> <tr>
<td> <td>
<form id="editCurrency_<?= $currency->getId() ?>" action="<?= Container::$routeCollection->getRoute('community-currencies-edit')->generateLink(['communityId' => $community->getId(), 'currency_id' => $currency->getId()]) ?>" method="post" data-reload-on-success="true" data-observe-inputs="code,round_digits"></form> <form id="editCurrency_<?= $currency->getId() ?>" action="<?= Container::$routeCollection->getRoute('community.currencies.edit-action')->generateLink(['communityId' => $community->getId(), 'currency_id' => $currency->getId()]) ?>" method="post" data-reload-on-success="true" data-observe-inputs="code,round_digits"></form>
<form id="deleteCurrency_<?= $currency->getId() ?>" action="<?= Container::$routeCollection->getRoute('community-currencies-delete')->generateLink(['communityId' => $community->getId(), 'currency_id' => $currency->getId()]) ?>" method="post" data-reload-on-success="true"></form> <form id="deleteCurrency_<?= $currency->getId() ?>" action="<?= Container::$routeCollection->getRoute('community.currencies.delete-action')->generateLink(['communityId' => $community->getId(), 'currency_id' => $currency->getId()]) ?>" method="post" data-reload-on-success="true"></form>
<input type="text" form="editCurrency_<?= $currency->getId() ?>" class="text fullWidth" name="code" value="<?= $currency->getCode() ?>" maxlength="3" required> <input type="text" form="editCurrency_<?= $currency->getId() ?>" class="text fullWidth" name="code" value="<?= $currency->getCode() ?>" maxlength="3" required>
</td> </td>
<td> <td>
<input type="number" form="editCurrency_<?= $currency->getId() ?>" class="text fullWidth" name="round_digits" value="<?= $currency->getRoundDigits() ?>" min="0" max="9" required> <input type="number" form="editCurrency_<?= $currency->getId() ?>" class="text fullWidth" name="round_digits" value="<?= $currency->getRoundDigits() ?>" min="0" max="9" required>
</td> </td>
<td style="text-align: right; font-size: 0;"> <td style="text-align: right; font-size: 0;">
<button type="submit" form="editCurrency_<?= $currency->getId() ?>" name="submit" class="small" disabled>Save</button> <button type="submit" form="editCurrency_<?= $currency->getId() ?>" name="submit_button" class="small" disabled>Save</button>
<?php if ($currency->getId() !== $community->getMainCurrencyId()): ?> <?php if ($currency->getId() !== $community->getMainCurrencyId()): ?>
<button type="submit" form="deleteCurrency_<?= $currency->getId() ?>" class="small red marginLeft">Delete</button> <button type="submit" form="deleteCurrency_<?= $currency->getId() ?>" name="submit_button" data-confirmation="Are you sure you want to delete this currency?" class="small red marginLeft">Delete</button>
<?php endif; ?> <?php endif; ?>
</td> </td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
<tr> <tr>
<td> <td>
<form id="newCurrency" action="<?= Container::$routeCollection->getRoute('community-currencies-new')->generateLink(['communityId' => $community->getId()]) ?>" method="post" data-reload-on-success="true" data-observe-inputs="code,round_digits"></form> <form id="newCurrency" action="<?= Container::$routeCollection->getRoute('community.currencies.new-action')->generateLink(['communityId' => $community->getId()]) ?>" method="post" data-reload-on-success="true" data-observe-inputs="code,round_digits"></form>
<input type="text" form="newCurrency" class="text fullWidth" name="code" placeholder="Currency" maxlength="3" required> <input type="text" form="newCurrency" class="text fullWidth" name="code" placeholder="Currency" maxlength="3" required>
</td> </td>
<td> <td>
<input type="number" form="newCurrency" class="text fullWidth" name="round_digits" placeholder="Round digits" min="0" max="9" required> <input type="number" form="newCurrency" class="text fullWidth" name="round_digits" placeholder="Round digits" min="0" max="9" required>
</td> </td>
<td style="text-align: right;"> <td style="text-align: right;">
<button type="submit" form="newCurrency" name="submit" class="small" disabled>Add</button> <button type="submit" form="newCurrency" name="submit_button" class="small" disabled>Add</button>
</td> </td>
</tr> </tr>
</table> </table>
+3 -3
View File
@@ -12,8 +12,8 @@
<div class="box compactBox"> <div class="box compactBox">
<?php <?php
$formAction = isset($community) ? $formAction = isset($community) ?
Container::$routeCollection->getRoute('community-edit-action')->generateLink(['communityId' => $community->getId()]) : Container::$routeCollection->getRoute('community.edit-action')->generateLink(['communityId' => $community->getId()]) :
Container::$routeCollection->getRoute('community-new-action')->generateLink(); Container::$routeCollection->getRoute('community.new-action')->generateLink();
?> ?>
<form id="communityForm" action="<?= $formAction ?>" method="post" data-redirect-on-success="true"> <form id="communityForm" action="<?= $formAction ?>" method="post" data-redirect-on-success="true">
<input type="text" class="text big fullWidth" name="name" placeholder="Name" value="<?= isset($community) ? $community->getName() : '' ?>" required> <input type="text" class="text big fullWidth" name="name" placeholder="Name" value="<?= isset($community) ? $community->getName() : '' ?>" required>
@@ -23,7 +23,7 @@
<?php endif; ?> <?php endif; ?>
<p id="communityFormError" class="formError justify marginTop"></p> <p id="communityFormError" class="formError justify marginTop"></p>
<div class="right marginTop"> <div class="right marginTop">
<button type="submit" name="submit"><?= isset($community) ? 'Save' : 'Create' ?></button> <button type="submit" name="submit_button"><?= isset($community) ? 'Save' : 'Create' ?></button>
</div> </div>
</form> </form>
</div> </div>
+9 -8
View File
@@ -1,5 +1,5 @@
@css(node_modules/choices.js/public/assets/styles/choices.min.css) @css(/static/node_modules/tom-select/dist/css/tom-select.min.css)
@js(node_modules/choices.js/public/assets/scripts/choices.js) @js(/static/node_modules/tom-select/dist/js/tom-select.base.min.js)
@js(js/communities/community_members.js) @js(js/communities/community_members.js)
@extends(templates/layout_normal) @extends(templates/layout_normal)
@@ -7,6 +7,7 @@
@section(main) @section(main)
<h2> <h2>
<a href="<?= Container::$routeCollection->getRoute('community')->generateLink(['communityId' => $community->getId()]) ?>"><?= $community->getName() ?></a> » <a href="<?= Container::$routeCollection->getRoute('community')->generateLink(['communityId' => $community->getId()]) ?>"><?= $community->getName() ?></a> »
<a href="<?= Container::$routeCollection->getRoute('community.settings')->generateLink(['communityId' => $community->getId()]) ?>">Settings</a> »
Edit members Edit members
</h2> </h2>
<div class="box compactBox"> <div class="box compactBox">
@@ -22,8 +23,8 @@
<?php $editable = $member->getUserId() !== Container::$request->user()->getUniqueId(); ?> <?php $editable = $member->getUserId() !== Container::$request->user()->getUniqueId(); ?>
<tr> <tr>
<td> <td>
<form id="editMember_<?= $member->getId() ?>" action="<?= Container::$routeCollection->getRoute('community-members-edit')->generateLink(['communityId' => $community->getId(), 'community_member_id' => $member->getId()]) ?>" method="post" data-reload-on-success="true" data-observe-inputs="owner"></form> <form id="editMember_<?= $member->getId() ?>" action="<?= Container::$routeCollection->getRoute('community.members.edit-action')->generateLink(['communityId' => $community->getId(), 'community_member_id' => $member->getId()]) ?>" method="post" data-reload-on-success="true" data-observe-inputs="owner"></form>
<form id="deleteMember_<?= $member->getId() ?>" action="<?= Container::$routeCollection->getRoute('community-members-delete')->generateLink(['communityId' => $community->getId(), 'community_member_id' => $member->getId()]) ?>" method="post" data-reload-on-success="true"></form> <form id="deleteMember_<?= $member->getId() ?>" action="<?= Container::$routeCollection->getRoute('community.members.delete-action')->generateLink(['communityId' => $community->getId(), 'community_member_id' => $member->getId()]) ?>" method="post" data-reload-on-success="true"></form>
<?= $member->getUser()->getDisplayName() ?> <?= $member->getUser()->getDisplayName() ?>
</td> </td>
<td style="text-align: center;"> <td style="text-align: center;">
@@ -31,22 +32,22 @@
</td> </td>
<td style="text-align: right;"> <td style="text-align: right;">
<?php if ($editable): ?> <?php if ($editable): ?>
<button type="submit" form="editMember_<?= $member->getId() ?>" name="submit" class="small marginRight" disabled>Save</button><!-- <button type="submit" form="editMember_<?= $member->getId() ?>" name="submit_button" class="small marginRight" disabled>Save</button><!--
--><button type="submit" form="deleteMember_<?= $member->getId() ?>" class="small red">Delete</button> --><button type="submit" form="deleteMember_<?= $member->getId() ?>" name="submit_button" data-confirmation="Are you sure you want to delete this member?" class="small red">Delete</button>
<?php endif; ?> <?php endif; ?>
</td> </td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
<tr> <tr>
<td> <td>
<form id="newMember" action="<?= Container::$routeCollection->getRoute('community-members-new')->generateLink(['communityId' => $community->getId()]) ?>" method="post" data-reload-on-success="true" data-observe-inputs="user_id"></form> <form id="newMember" action="<?= Container::$routeCollection->getRoute('community.members.new-action')->generateLink(['communityId' => $community->getId()]) ?>" method="post" data-reload-on-success="true" data-observe-inputs="user_id"></form>
<select type="text" form="newMember" name="user_id"> <select type="text" form="newMember" name="user_id">
</td> </td>
<td style="text-align: center;"> <td style="text-align: center;">
<input type="checkbox" form="newMember" name="owner" /> <input type="checkbox" form="newMember" name="owner" />
</td> </td>
<td style="text-align: right;"> <td style="text-align: right;">
<button type="submit" form="newMember" name="submit" class="small" disabled>Add</button> <button type="submit" form="newMember" name="submit_button" class="small" disabled>Add</button>
</td> </td>
</tr> </tr>
</table> </table>
+39
View File
@@ -0,0 +1,39 @@
@extends(templates/layout_normal)
@section(main)
<h2>
<a href="<?= Container::$routeCollection->getRoute('community')->generateLink(['communityId' => $community->getId()]) ?>"><?= $community->getName() ?></a> »
Settings
</h2>
<div class="gridContainer marginTop">
<div>
<h3 class="marginBottom">
Members
<?php if ($editPermission): ?>
<span class="small">[<a href="<?= Container::$routeCollection->getRoute('community.members')->generateLink(['communityId' => $community->getId()]) ?>">edit</a>]</span>
<?php endif; ?>
</h3>
<?php foreach ($members as $member): ?>
<p><?= $member->getUser()->getDisplayName() ?></p>
<?php endforeach; ?>
</div>
<div>
<h3 class="marginBottom">
Currencies
<?php if ($editPermission): ?>
<span class="small">[<a href="<?= Container::$routeCollection->getRoute('community.currencies')->generateLink(['communityId' => $community->getId()]) ?>">edit</a>]</span>
<?php endif; ?>
</h3>
<?php foreach ($currencies as $currency): ?>
<p>
<?php if ($currency->getId() === $community->getMainCurrencyId()): ?>
<b><?= $currency->getCode() ?></b>
<?php else: ?>
<a href="<?= Container::$routeCollection->getRoute('community.currencyExchangeRates')->generateLink(['communityId' => $community->getId(), 'code' => $currency->getCode()]) ?>"><?= $currency->getCode() ?></a>
<?php endif; ?>
</p>
<?php endforeach; ?>
</div>
</div>
@endsection
@@ -3,6 +3,7 @@
@section(main) @section(main)
<h2> <h2>
<a href="<?= Container::$routeCollection->getRoute('community')->generateLink(['communityId' => $community->getId()]) ?>"><?= $community->getName() ?></a> » <a href="<?= Container::$routeCollection->getRoute('community')->generateLink(['communityId' => $community->getId()]) ?>"><?= $community->getName() ?></a> »
<a href="<?= Container::$routeCollection->getRoute('community.settings')->generateLink(['communityId' => $community->getId()]) ?>">Settings</a> »
Exchange rates for <?= $currency->getCode() ?> Exchange rates for <?= $currency->getCode() ?>
</h2> </h2>
<div class="box compactBox"> <div class="box compactBox">
@@ -23,16 +24,16 @@
<tr> <tr>
<?php if ($editPermission): ?> <?php if ($editPermission): ?>
<td> <td>
<form id="editExchangeRate_<?= $currencyExchangeRate->getId() ?>" action="<?= Container::$routeCollection->getRoute('community-currency-exchange-rates-edit')->generateLink(['communityId' => $community->getId(), 'code' => $currency->getCode(), 'currency_exchange_rate_id' => $currencyExchangeRate->getId()]) ?>" method="post" data-reload-on-success="true" data-observe-inputs="exchange_rate,valid_from"></form> <form id="editExchangeRate_<?= $currencyExchangeRate->getId() ?>" action="<?= Container::$routeCollection->getRoute('community.currencyExchangeRates.edit-action')->generateLink(['communityId' => $community->getId(), 'code' => $currency->getCode(), 'currency_exchange_rate_id' => $currencyExchangeRate->getId()]) ?>" method="post" data-reload-on-success="true" data-observe-inputs="exchange_rate,valid_from"></form>
<form id="deleteCurrency_<?= $currencyExchangeRate->getId() ?>" action="<?= Container::$routeCollection->getRoute('community-currency-exchange-rates-delete')->generateLink(['communityId' => $community->getId(), 'code' => $currency->getCode(), 'currency_exchange_rate_id' => $currencyExchangeRate->getId()]) ?>" method="post" data-reload-on-success="true"></form> <form id="deleteCurrency_<?= $currencyExchangeRate->getId() ?>" action="<?= Container::$routeCollection->getRoute('community.currencyExchangeRates.delete-action')->generateLink(['communityId' => $community->getId(), 'code' => $currency->getCode(), 'currency_exchange_rate_id' => $currencyExchangeRate->getId()]) ?>" method="post" data-reload-on-success="true"></form>
<input type="number" form="editExchangeRate_<?= $currencyExchangeRate->getId() ?>" class="text fullWidth" name="exchange_rate" value="<?= $currencyExchangeRate->getExchangeRate() ?>" min="0" step="0.000000001" required> <input type="number" form="editExchangeRate_<?= $currencyExchangeRate->getId() ?>" class="text fullWidth" name="exchange_rate" value="<?= $currencyExchangeRate->getExchangeRate() ?>" min="0" step="0.000000001" required>
</td> </td>
<td> <td>
<input type="datetime-local" form="editExchangeRate_<?= $currencyExchangeRate->getId() ?>" class="text fullWidth" name="valid_from" value="<?= $currencyExchangeRate->getValidFromDate()->format('Y-m-d\TH:i') ?>" required> <input type="datetime-local" form="editExchangeRate_<?= $currencyExchangeRate->getId() ?>" class="text fullWidth" name="valid_from" value="<?= $currencyExchangeRate->getValidFromDate()->format('Y-m-d\TH:i') ?>" required>
</td> </td>
<td style="text-align: right;"> <td style="text-align: right;">
<button type="submit" form="editExchangeRate_<?= $currencyExchangeRate->getId() ?>" name="submit" class="small marginRight" disabled>Save</button><!-- <button type="submit" form="editExchangeRate_<?= $currencyExchangeRate->getId() ?>" name="submit_button" class="small marginRight" disabled>Save</button><!--
--><button type="submit" form="deleteCurrency_<?= $currencyExchangeRate->getId() ?>" class="small red">Delete</button> --><button type="submit" form="deleteCurrency_<?= $currencyExchangeRate->getId() ?>" name="submit_button" data-confirmation="Are you sure you want to delete this exchange rate?" class="small red">Delete</button>
</td> </td>
<?php else: ?> <?php else: ?>
<td><?= $currencyExchangeRate->getExchangeRate() ?></td> <td><?= $currencyExchangeRate->getExchangeRate() ?></td>
@@ -43,14 +44,14 @@
<?php if ($editPermission): ?> <?php if ($editPermission): ?>
<tr> <tr>
<td> <td>
<form id="newExchangeRate" action="<?= Container::$routeCollection->getRoute('community-currency-exchange-rates-new')->generateLink(['communityId' => $community->getId(), 'code' => $currency->getCode()]) ?>" method="post" data-reload-on-success="true" data-observe-inputs="exchange_rate,valid_from"></form> <form id="newExchangeRate" action="<?= Container::$routeCollection->getRoute('community.currencyExchangeRates.new-action')->generateLink(['communityId' => $community->getId(), 'code' => $currency->getCode()]) ?>" method="post" data-reload-on-success="true" data-observe-inputs="exchange_rate,valid_from"></form>
<input type="number" form="newExchangeRate" class="text fullWidth" name="exchange_rate" placeholder="Exchange rate" min="0" step="0.000000001" required> <input type="number" form="newExchangeRate" class="text fullWidth" name="exchange_rate" placeholder="Exchange rate" min="0" step="0.000000001" required>
</td> </td>
<td> <td>
<input type="datetime-local" form="newExchangeRate" class="text fullWidth" name="valid_from" placeholder="Valid from" required> <input type="datetime-local" form="newExchangeRate" class="text fullWidth" name="valid_from" placeholder="Valid from" required>
</td> </td>
<td style="text-align: right;"> <td style="text-align: right;">
<button type="submit" form="newExchangeRate" name="submit" class="small" disabled>Add</button> <button type="submit" form="newExchangeRate" name="submit_button" class="small" disabled>Add</button>
</td> </td>
</tr> </tr>
<?php endif; ?> <?php endif; ?>
+3 -3
View File
@@ -41,13 +41,13 @@
<p class="formError justify marginTop"></p> <p class="formError justify marginTop"></p>
<div class="right marginTop" style="font-size: 0;"> <div class="right marginTop" style="font-size: 0;">
<?php if (isset($transaction)): ?> <?php if (isset($transaction)): ?>
<button type="submit" form="deleteTransaction" class="red marginRight">Delete</button> <button type="submit" form="deleteTransaction" name="submit_button" data-confirmation="Are you sure you want to delete this transaction?" class="red marginRight">Delete</button>
<?php endif; ?> <?php endif; ?>
<button type="submit" name="submit"><?= isset($transaction) ? 'Save' : 'Create' ?></button> <button type="submit" name="submit_button"><?= isset($transaction) ? 'Save' : 'Create' ?></button>
</div> </div>
</form> </form>
<?php if (isset($transaction)): ?> <?php if (isset($transaction)): ?>
<form id="deleteTransaction" action="<?= Container::$routeCollection->getRoute('community.transactions.delete')->generateLink(['communityId' => $community->getId(), 'transactionId' => $transaction->getId()]) ?>" method="post" data-redirect-on-success="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communityId' => $community->getId()]) ?>"></form> <form id="deleteTransaction" action="<?= Container::$routeCollection->getRoute('community.transactions.delete-action')->generateLink(['communityId' => $community->getId(), 'transactionId' => $transaction->getId()]) ?>" method="post" data-redirect-on-success="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communityId' => $community->getId()]) ?>"></form>
<?php endif; ?> <?php endif; ?>
</div> </div>
@endsection @endsection
+53 -47
View File
@@ -8,55 +8,61 @@
<p class="marginTop"><a href="<?= Container::$routeCollection->getRoute('community.transactions.new')->generateLink(['communityId' => $community->getId()]) ?>">New transaction</a></p> <p class="marginTop"><a href="<?= Container::$routeCollection->getRoute('community.transactions.new')->generateLink(['communityId' => $community->getId()]) ?>">New transaction</a></p>
<?php if ($pages > 1): ?> <?php if ($numberOfTransactions > 0): ?>
<p class="paginateContainer marginTop"> <?php if ($pages > 1): ?>
<a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communityId' => $community->getId(), 'page' => 0]) ?>">«</a> <p class="paginateContainer marginTop">
<a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communityId' => $community->getId(), 'page' => max(0, $currentPage - 1)]) ?>">‹</a> <a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communityId' => $community->getId(), 'page' => 0]) ?>">«</a>
<?php for ($i = 0; $i < $pages; $i++): ?> <a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communityId' => $community->getId(), 'page' => max(0, $currentPage - 1)]) ?>">‹</a>
<?php if ($currentPage == $i): ?> <?php for ($i = 0; $i < $pages; $i++): ?>
<span class="selected"><?= $i + 1 ?></span> <?php if ($currentPage == $i): ?>
<?php else: ?> <span class="selected"><?= $i + 1 ?></span>
<a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communityId' => $community->getId(), 'page' => $i]) ?>"><?= $i + 1 ?></a> <?php else: ?>
<?php endif; ?> <a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communityId' => $community->getId(), 'page' => $i]) ?>"><?= $i + 1 ?></a>
<?php endfor; ?> <?php endif; ?>
<a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communityId' => $community->getId(), 'page' => min($pages - 1, $currentPage + 1)]) ?>">›</a> <?php endfor; ?>
<a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communityId' => $community->getId(), 'page' => $pages - 1]) ?>">»</a> <a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communityId' => $community->getId(), 'page' => min($pages - 1, $currentPage + 1)]) ?>">›</a>
</p> <a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communityId' => $community->getId(), 'page' => $pages - 1]) ?>">»</a>
<?php endif; ?> </p>
<?php endif; ?>
<?php foreach ($transactions as $transaction): ?> <?php foreach ($transactions as $transaction): ?>
<a class="block" href="<?= Container::$routeCollection->getRoute('community.transactions.edit')->generateLink(['communityId' => $community->getId(), 'transactionId' => $transaction->getId()]) ?>"> <a class="block" href="<?= Container::$routeCollection->getRoute('community.transactions.edit')->generateLink(['communityId' => $community->getId(), 'transactionId' => $transaction->getId()]) ?>">
<div class="box transaction"> <div class="box transaction">
<div> <div>
<p style="font-weight: bold;"><?= $transaction->getDescription() ?></p> <p style="font-weight: bold;"><?= $transaction->getDescription() ?></p>
<p class="small"><?= $transaction->getPayerUser()->getDisplayName() ?> ► <?= $transaction->getPayeeUser() ? $transaction->getPayeeUser()->getDisplayName() : '[common]' ?></p> <p class="small"><?= $transaction->getPayerUser()->getDisplayName() ?> ► <?= $transaction->getPayeeUser() ? $transaction->getPayeeUser()->getDisplayName() : '[common]' ?></p>
<p class="small"><?= $transaction->getTimeDate()->format('Y-m-d H:i') ?></p> <p class="small"><?= $transaction->getTimeDate()->format('Y-m-d H:i') ?></p>
</div> </div>
<div style="text-align: right;"> <div style="text-align: right;">
<h3><?= number_format($exchangeRateCalculator->calculate($transaction->getSum(), $transaction->getCurrency(), $transaction->getTimeDate()), $community->getMainCurrency()->getRoundDigits()) ?> <?= $community->getMainCurrency()->getCode() ?></h3> <h3><?= number_format($exchangeRateCalculator->calculate($transaction->getSum(), $transaction->getCurrency(), $transaction->getTimeDate()), $community->getMainCurrency()->getRoundDigits()) ?> <?= $community->getMainCurrency()->getCode() ?></h3>
<?php if ($community->getMainCurrencyId() !== $transaction->getCurrencyId()): ?> <?php if ($community->getMainCurrencyId() !== $transaction->getCurrencyId()): ?>
<p style="color: #8e8e8e; font-weight: bold;"><?= number_format($transaction->getSum(), $transaction->getCurrency()->getRoundDigits()) ?> <?= $transaction->getCurrency()->getCode() ?></p> <p style="color: #8e8e8e; font-weight: bold;"><?= number_format($transaction->getSum(), $transaction->getCurrency()->getRoundDigits()) ?> <?= $transaction->getCurrency()->getCode() ?></p>
<?php endif; ?> <?php endif; ?>
</div>
</div> </div>
</a>
<?php endforeach; ?>
<?php if ($pages > 1): ?>
<p class="paginateContainer marginTop">
<a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communityId' => $community->getId(), 'page' => 0]) ?>">«</a>
<a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communityId' => $community->getId(), 'page' => max(0, $currentPage - 1)]) ?>">‹</a>
<?php for ($i = 0; $i < $pages; $i++): ?>
<?php if ($currentPage == $i): ?>
<span class="selected"><?= $i + 1 ?></span>
<?php else: ?>
<a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communityId' => $community->getId(), 'page' => $i]) ?>"><?= $i + 1 ?></a>
<?php endif; ?>
<?php endfor; ?>
<a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communityId' => $community->getId(), 'page' => min($pages - 1, $currentPage + 1)]) ?>">›</a>
<a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communityId' => $community->getId(), 'page' => $pages - 1]) ?>">»</a>
</p>
<?php endif; ?>
<p class="marginTop"><a href="<?= Container::$routeCollection->getRoute('community.transactions.new')->generateLink(['communityId' => $community->getId()]) ?>">New transaction</a></p>
<?php else: ?>
<div class="box">
<p>There are no transactions yet.</p>
</div> </div>
</a>
<?php endforeach; ?>
<?php if ($pages > 1): ?>
<p class="paginateContainer marginTop">
<a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communityId' => $community->getId(), 'page' => 0]) ?>">«</a>
<a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communityId' => $community->getId(), 'page' => max(0, $currentPage - 1)]) ?>">‹</a>
<?php for ($i = 0; $i < $pages; $i++): ?>
<?php if ($currentPage == $i): ?>
<span class="selected"><?= $i + 1 ?></span>
<?php else: ?>
<a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communityId' => $community->getId(), 'page' => $i]) ?>"><?= $i + 1 ?></a>
<?php endif; ?>
<?php endfor; ?>
<a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communityId' => $community->getId(), 'page' => min($pages - 1, $currentPage + 1)]) ?>">›</a>
<a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communityId' => $community->getId(), 'page' => $pages - 1]) ?>">»</a>
</p>
<?php endif; ?> <?php endif; ?>
<p class="marginTop"><a href="<?= Container::$routeCollection->getRoute('community.transactions.new')->generateLink(['communityId' => $community->getId()]) ?>">New transaction</a></p>
@endsection @endsection
+4 -3
View File
@@ -3,7 +3,10 @@
@section(main) @section(main)
<div class="gridContainer"> <div class="gridContainer">
<div> <div>
<h3 class="marginBottom">Communities</h3> <h3 class="marginBottom">
Communities
<span class="small">[<a href="<?= Container::$routeCollection->getRoute('community.new')->generateLink() ?>">new</a>]</span>
</h3>
<?php if (count($communities) > 0): ?> <?php if (count($communities) > 0): ?>
<?php foreach ($communities as $community): ?> <?php foreach ($communities as $community): ?>
<p><a href="<?= Container::$routeCollection->getRoute('community')->generateLink(['communityId' => $community->getId()]) ?>"><?= $community->getName() ?></a></p> <p><a href="<?= Container::$routeCollection->getRoute('community')->generateLink(['communityId' => $community->getId()]) ?>"><?= $community->getName() ?></a></p>
@@ -11,8 +14,6 @@
<?php else: ?> <?php else: ?>
<p>You have no community.</p> <p>You have no community.</p>
<?php endif; ?> <?php endif; ?>
<hr>
<p><a href="<?= Container::$routeCollection->getRoute('community-new')->generateLink() ?>">New community</a></p>
</div> </div>
<div> <div>
<h3 class="marginBottom">Upcoming events</h3> <h3 class="marginBottom">Upcoming events</h3>
+2 -2
View File
@@ -10,10 +10,10 @@
<div class="right marginTop"> <div class="right marginTop">
<button type="submit">Login</button> <button type="submit">Login</button>
</div> </div>
<p class="center marginTop"><a href="<?= Container::$routeCollection->getRoute('password-requestReset')->generateLink() ?>" title="Request password reset">Forgot your password?</a></p> <p class="center marginTop"><a href="<?= Container::$routeCollection->getRoute('password.requestReset')->generateLink() ?>" title="Request password reset">Forgot your password?</a></p>
<hr> <hr>
<div class="center"> <div class="center">
<a class="button yellow" href="<?= Container::$routeCollection->getRoute('login-google')->generateLink() ?>" title="Login with Google">Login with Google</a> <a class="button yellow" href="<?= Container::$routeCollection->getRoute('login.google')->generateLink() ?>" title="Login with Google">Login with Google</a>
</div> </div>
</form> </form>
</div> </div>
+1 -1
View File
@@ -5,7 +5,7 @@
@section(main) @section(main)
<h2>Request password reset</h2> <h2>Request password reset</h2>
<div class="box compactBox"> <div class="box compactBox">
<form id="passwordResetForm" action="<?= Container::$routeCollection->getRoute('password-requestReset-action')->generateLink() ?>" method="post" data-redirect-on-success="<?= Container::$routeCollection->getRoute('password-requestReset.success')->generateLink() ?>"> <form id="passwordResetForm" action="<?= Container::$routeCollection->getRoute('password.requestReset-action')->generateLink() ?>" method="post" data-redirect-on-success="<?= Container::$routeCollection->getRoute('password.requestReset.success')->generateLink() ?>">
<input type="email" class="text big fullWidth" name="email" placeholder="Email address" value="<?= isset($email) ? $email : '' ?>" required autofocus> <input type="email" class="text big fullWidth" name="email" placeholder="Email address" value="<?= isset($email) ? $email : '' ?>" required autofocus>
<?php if (!empty($_ENV['RECAPTCHA_SITEKEY'])): ?> <?php if (!empty($_ENV['RECAPTCHA_SITEKEY'])): ?>
<div class="marginTop"> <div class="marginTop">
+2 -2
View File
@@ -4,7 +4,7 @@
<h2>Reset password</h2> <h2>Reset password</h2>
<div class="box compactBox"> <div class="box compactBox">
<?php if ($success) : ?> <?php if ($success) : ?>
<form id="resetPasswordForm" action="<?= Container::$routeCollection->getRoute('password-reset.action')->generateLink(['token' => $token]) ?>"" method="post" data-redirect-on-success="<?= $redirectUrl ?>"> <form id="resetPasswordForm" action="<?= Container::$routeCollection->getRoute('password.reset-action')->generateLink(['token' => $token]) ?>"" method="post" data-redirect-on-success="<?= $redirectUrl ?>">
<input type="email" class="text big fullWidth" name="email" placeholder="Email address" value="<?= $email ?>" disabled> <input type="email" class="text big fullWidth" name="email" placeholder="Email address" value="<?= $email ?>" disabled>
<input type="password" class="text big fullWidth marginTop" name="password" placeholder="Password" required minlength="6" autofocus> <input type="password" class="text big fullWidth marginTop" name="password" placeholder="Password" required minlength="6" autofocus>
<input type="password" class="text big fullWidth marginTop" name="password_confirm" placeholder="Password confirmation" required minlength="6"> <input type="password" class="text big fullWidth marginTop" name="password_confirm" placeholder="Password confirmation" required minlength="6">
@@ -14,7 +14,7 @@
</div> </div>
</form> </form>
<?php else: ?> <?php else: ?>
<p class="error justify">Confirming your identity failed. Please check the link you entered, or retry <a href="<?= Container::$routeCollection->getRoute('password-requestReset')->generateLink() ?>" title="Request password reset">requesting password reset</a>!</p> <p class="error justify">Confirming your identity failed. Please check the link you entered, or retry <a href="<?= Container::$routeCollection->getRoute('password.requestReset')->generateLink() ?>" title="Request password reset">requesting password reset</a>!</p>
<?php endif; ?> <?php endif; ?>
</div> </div>
@endsection @endsection
+30 -30
View File
@@ -27,26 +27,25 @@ if (!empty($_ENV['DEV'])) {
Container::$routeCollection = new RouteCollection(); Container::$routeCollection = new RouteCollection();
Container::$routeCollection->get('home', '', [HomeController::class, 'getHome']); Container::$routeCollection->get('home', '', [HomeController::class, 'getHome']);
Container::$routeCollection->get('startSession', 'startSession.json', [HomeController::class, 'startSession']);
Container::$routeCollection->group('login', function (RouteCollection $routeCollection) { Container::$routeCollection->group('login', function (RouteCollection $routeCollection) {
$routeCollection->get('login', '', [LoginController::class, 'getLoginForm']); $routeCollection->get('login', '', [LoginController::class, 'getLoginForm']);
$routeCollection->post('login-action', '', [LoginController::class, 'login']); $routeCollection->post('login-action', '', [LoginController::class, 'login']);
$routeCollection->get('login-google', 'google', [LoginController::class, 'getGoogleLoginRedirect']); $routeCollection->get('login.google', 'google', [LoginController::class, 'getGoogleLoginRedirect']);
$routeCollection->get('login-google-action', 'google/code', [LoginController::class, 'loginWithGoogle']); $routeCollection->get('login.google-action', 'google/code', [LoginController::class, 'loginWithGoogle']);
}); });
Container::$routeCollection->group('oauth', function (RouteCollection $routeCollection) { Container::$routeCollection->group('oauth', function (RouteCollection $routeCollection) {
$routeCollection->get('oauth-auth', 'auth', [OAuthAuthController::class, 'auth']); $routeCollection->get('oauth.auth', 'auth', [OAuthAuthController::class, 'auth']);
$routeCollection->post('oauth-token', 'token', [OAuthController::class, 'getToken']); $routeCollection->post('oauth.token', 'token', [OAuthController::class, 'getToken']);
$routeCollection->get('oauth-userinfo', 'userinfo', [OAuthController::class, 'getUserInfo']); $routeCollection->get('oauth.userinfo', 'userinfo', [OAuthController::class, 'getUserInfo']);
$routeCollection->get('oauth-config', '.well-known/openid-configuration', [OAuthController::class, 'getConfig']); $routeCollection->get('oauth.config', '.well-known/openid-configuration', [OAuthController::class, 'getConfig']);
$routeCollection->get('oauth-certs', 'certs', [OAuthController::class, 'getCerts']); $routeCollection->get('oauth.certs', 'certs', [OAuthController::class, 'getCerts']);
}); });
Container::$routeCollection->group('password', function (RouteCollection $routeCollection) { Container::$routeCollection->group('password', function (RouteCollection $routeCollection) {
$routeCollection->get('password-requestReset', 'requestReset', [LoginController::class, 'getRequestPasswordResetForm']); $routeCollection->get('password.requestReset', 'requestReset', [LoginController::class, 'getRequestPasswordResetForm']);
$routeCollection->post('password-requestReset-action', 'requestReset', [LoginController::class, 'requestPasswordReset']); $routeCollection->post('password.requestReset-action', 'requestReset', [LoginController::class, 'requestPasswordReset']);
$routeCollection->get('password-requestReset.success', 'requestReset/success', [LoginController::class, 'getRequestPasswordResetSuccess']); $routeCollection->get('password.requestReset.success', 'requestReset/success', [LoginController::class, 'getRequestPasswordResetSuccess']);
$routeCollection->get('password-reset', 'reset/{token}', [LoginController::class, 'getResetPasswordForm']); $routeCollection->get('password.reset', 'reset/{token}', [LoginController::class, 'getResetPasswordForm']);
$routeCollection->post('password-reset.action', 'reset/{token}', [LoginController::class, 'resetPassword']); $routeCollection->post('password.reset-action', 'reset/{token}', [LoginController::class, 'resetPassword']);
}); });
Container::$routeCollection->get('logout', 'logout', [LoginController::class, 'logout']); Container::$routeCollection->get('logout', 'logout', [LoginController::class, 'logout']);
Container::$routeCollection->group('account', function (RouteCollection $routeCollection) { Container::$routeCollection->group('account', function (RouteCollection $routeCollection) {
@@ -57,25 +56,26 @@ Container::$routeCollection->group('account', function (RouteCollection $routeCo
}); });
Container::$routeCollection->get('searchUser', 'searchUser', [UserSearchController::class, 'searchUser']); Container::$routeCollection->get('searchUser', 'searchUser', [UserSearchController::class, 'searchUser']);
Container::$routeCollection->group('communities', function (RouteCollection $routeCollection) { Container::$routeCollection->group('communities', function (RouteCollection $routeCollection) {
$routeCollection->get('community-new', 'new', [CommunityController::class, 'getCommunityNew']); $routeCollection->get('community.new', 'new', [CommunityController::class, 'getCommunityNew']);
$routeCollection->post('community-new-action', 'new', [CommunityController::class, 'saveCommunity']); $routeCollection->post('community.new-action', 'new', [CommunityController::class, 'saveCommunity']);
$routeCollection->group('{communityId}', function (RouteCollection $routeCollection) { $routeCollection->group('{communityId}', function (RouteCollection $routeCollection) {
$routeCollection->get('community', '', [CommunityController::class, 'getCommunityHome']); $routeCollection->get('community', '', [CommunityController::class, 'getCommunityHome']);
$routeCollection->get('community-edit', 'edit', [CommunityController::class, 'getCommunityEdit']); $routeCollection->get('community.settings', 'settings', [CommunityController::class, 'getCommunitySettings']);
$routeCollection->post('community-edit-action', 'edit', [CommunityController::class, 'saveCommunity']); $routeCollection->get('community.edit', 'edit', [CommunityController::class, 'getCommunityEdit']);
$routeCollection->get('community-members', 'members', [CommunityController::class, 'getMembersEdit']); $routeCollection->post('community.edit-action', 'edit', [CommunityController::class, 'saveCommunity']);
$routeCollection->post('community-members-new', 'newMember', [CommunityController::class, 'saveMember']); $routeCollection->get('community.members', 'members', [CommunityController::class, 'getMembersEdit']);
$routeCollection->post('community-members-edit', 'editMember', [CommunityController::class, 'saveMember']); $routeCollection->post('community.members.new-action', 'members/new', [CommunityController::class, 'saveMember']);
$routeCollection->post('community-members-delete', 'deleteMember', [CommunityController::class, 'deleteMember']); $routeCollection->post('community.members.edit-action', 'members/edit', [CommunityController::class, 'saveMember']);
$routeCollection->get('community-currencies', 'currencies', [CommunityController::class, 'getCurrenciesEdit']); $routeCollection->post('community.members.delete-action', 'members/delete', [CommunityController::class, 'deleteMember']);
$routeCollection->post('community-currencies-new', 'newCurrency', [CommunityController::class, 'saveCurrency']); $routeCollection->get('community.currencies', 'currencies', [CommunityController::class, 'getCurrenciesEdit']);
$routeCollection->post('community-currencies-edit', 'editCurrency', [CommunityController::class, 'saveCurrency']); $routeCollection->post('community.currencies.new-action', 'currencies/new', [CommunityController::class, 'saveCurrency']);
$routeCollection->post('community-currencies-delete', 'deleteCurrency', [CommunityController::class, 'deleteCurrency']); $routeCollection->post('community.currencies.edit-action', 'currencies/edit', [CommunityController::class, 'saveCurrency']);
$routeCollection->post('community.currencies.delete-action', 'currencies/delete', [CommunityController::class, 'deleteCurrency']);
$routeCollection->group('currencyExchangeRates', function (RouteCollection $routeCollection) { $routeCollection->group('currencyExchangeRates', function (RouteCollection $routeCollection) {
$routeCollection->get('community-currency-exchange-rates', '{code}', [CommunityController::class, 'getCurrencyExchangeRates']); $routeCollection->get('community.currencyExchangeRates', '{code}', [CommunityController::class, 'getCurrencyExchangeRates']);
$routeCollection->post('community-currency-exchange-rates-new', '{code}/new', [CommunityController::class, 'saveCurrencyExchangeRate']); $routeCollection->post('community.currencyExchangeRates.new-action', '{code}/new', [CommunityController::class, 'saveCurrencyExchangeRate']);
$routeCollection->post('community-currency-exchange-rates-edit', '{code}/edit', [CommunityController::class, 'saveCurrencyExchangeRate']); $routeCollection->post('community.currencyExchangeRates.edit-action', '{code}/edit', [CommunityController::class, 'saveCurrencyExchangeRate']);
$routeCollection->post('community-currency-exchange-rates-delete', '{code}/delete', [CommunityController::class, 'deleteCurrencyExchangeRate']); $routeCollection->post('community.currencyExchangeRates.delete-action', '{code}/delete', [CommunityController::class, 'deleteCurrencyExchangeRate']);
}); });
$routeCollection->group('transactions', function (RouteCollection $routeCollection) { $routeCollection->group('transactions', function (RouteCollection $routeCollection) {
$routeCollection->get('community.transactions', '', [TransactionController::class, 'getTransactions']); $routeCollection->get('community.transactions', '', [TransactionController::class, 'getTransactions']);
@@ -83,7 +83,7 @@ Container::$routeCollection->group('communities', function (RouteCollection $rou
$routeCollection->post('community.transactions.new-action', 'new', [TransactionController::class, 'saveTransaction']); $routeCollection->post('community.transactions.new-action', 'new', [TransactionController::class, 'saveTransaction']);
$routeCollection->get('community.transactions.edit', '{transactionId}', [TransactionController::class, 'getTransactionEdit']); $routeCollection->get('community.transactions.edit', '{transactionId}', [TransactionController::class, 'getTransactionEdit']);
$routeCollection->post('community.transactions.edit-action', '{transactionId}', [TransactionController::class, 'saveTransaction']); $routeCollection->post('community.transactions.edit-action', '{transactionId}', [TransactionController::class, 'saveTransaction']);
$routeCollection->post('community.transactions.delete', '{transactionId}/delete', [TransactionController::class, 'deleteTransaction']); $routeCollection->post('community.transactions.delete-action', '{transactionId}/delete', [TransactionController::class, 'deleteTransaction']);
}); });
}); });
}); });