]> git.agnieray.net Git - galette.git/blob - galette/includes/routes/contributions.routes.php
6754ede630cdb03b1c2850f4a5ccbf1a60b51a1c
[galette.git] / galette / includes / routes / contributions.routes.php
1 <?php
2
3 /**
4 * Copyright © 2003-2024 The Galette Team
5 *
6 * This file is part of Galette (https://galette.eu).
7 *
8 * Galette is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * Galette is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with Galette. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 use Galette\Controllers\GaletteController;
23 use Galette\Controllers\Crud;
24 use Galette\Controllers\CsvController;
25 use Galette\Controllers\PdfController;
26 use Galette\Entity\Contribution;
27
28 $app->get(
29 '/{type:transactions|contributions}/mine',
30 [Crud\ContributionsController::class, 'myList']
31 )->setName('myContributions')->add($authenticate);
32
33 $app->get(
34 '/{type:transactions|contributions}[/{option:page|order|member}/{value:\d+|all}]',
35 [Crud\ContributionsController::class, 'list']
36 )->setName('contributions')->add($authenticate);
37
38 $app->post(
39 '/{type:contributions|transactions}/filter',
40 [Crud\ContributionsController::class, 'filter']
41 )->setName('payments_filter')->add($authenticate);
42
43 $app->get(
44 '/contribution/{type:' . Contribution::TYPE_FEE . '|' . Contribution::TYPE_DONATION . '}/add',
45 [Crud\ContributionsController::class, 'add']
46 )->setName('addContribution')->add($authenticate);
47
48 $app->get(
49 '/contribution/{type:' . Contribution::TYPE_FEE . '|' . Contribution::TYPE_DONATION . '}/edit/{id:\d+}',
50 [Crud\ContributionsController::class, 'edit']
51 )->setName('editContribution')->add($authenticate);
52
53 $app->post(
54 '/contribution/{type:' . Contribution::TYPE_FEE . '|' . Contribution::TYPE_DONATION . '}/add',
55 [Crud\ContributionsController::class, 'doAdd']
56 )->setName('doAddContribution')->add($authenticate);
57
58 $app->post(
59 '/contribution/{type:' . Contribution::TYPE_FEE . '|' . Contribution::TYPE_DONATION . '}/edit/{id:\d+}',
60 [Crud\ContributionsController::class, 'doEdit']
61 )->setName('doEditContribution')->add($authenticate);
62
63 //Batch actions on contributions list
64 $app->post(
65 '/{type:contributions|transactions}/batch',
66 [Crud\ContributionsController::class, 'handleBatch']
67 )->setName('batch-contributionslist')->add($authenticate);
68
69 //contributions list CSV export
70 $app->map(
71 ['GET', 'POST'],
72 '/{type:contributions|transactions}/export/csv',
73 [CsvController::class, 'contributionsExport']
74 )->setName('csv-contributionslist')->add($authenticate);
75
76 $app->get(
77 '/transaction/add',
78 [Crud\TransactionsController::class, 'add']
79 )->setName('addTransaction')->add($authenticate);
80
81 $app->get(
82 '/transaction/edit/{id:\d+}',
83 [Crud\TransactionsController::class, 'edit']
84 )->setName('editTransaction')->add($authenticate);
85
86 $app->get(
87 '/transaction/{id}/attach/{cid}',
88 [Crud\TransactionsController::class, 'attach']
89 )->setName('attach_contribution')->add($authenticate);
90
91 $app->get(
92 '/transaction/{id}/detach/{cid}',
93 [Crud\TransactionsController::class, 'detach']
94 )->setName('detach_contribution')->add($authenticate);
95
96 $app->post(
97 '/transaction/add',
98 [Crud\TransactionsController::class, 'doAdd']
99 )->setName('doEditTransaction')->add($authenticate);
100
101 $app->post(
102 '/transaction/edit/{id:\d+}',
103 [Crud\TransactionsController::class, 'doEdit']
104 )->setName('doEditTransaction')->add($authenticate);
105
106 $app->get(
107 '/{type:contributions|transactions}/remove' . '/{id:\d+}',
108 [Crud\ContributionsController::class, 'confirmDelete']
109 )->setName('removeContribution')->add($authenticate);
110
111 $app->get(
112 '/{type:contributions|transactions}/batch/remove',
113 [Crud\ContributionsController::class, 'confirmDelete']
114 )->setName('removeContributions')->add($authenticate);
115
116 $app->post(
117 '/{type:contributions|transactions}/remove[/{id}]',
118 [Crud\ContributionsController::class, 'delete']
119 )->setName('doRemoveContribution')->add($authenticate);
120
121 //Contribution PDF
122 $app->get(
123 '/contribution/print/{id:\d+}',
124 [PdfController::class, 'contribution']
125 )->setName('printContribution')->add($authenticate);
126
127 $app->get(
128 '/document/download/{hash}',
129 [GaletteController::class, 'documentLink']
130 )->setName('directlink');
131
132 $app->post(
133 '/document/download/{hash}',
134 [PdfController::class, 'directlinkDocument']
135 )->setName('get-directlink');
136
137 $app->get(
138 '/contribution/mass-add/choose-type',
139 [Crud\ContributionsController::class, 'massAddChooseType']
140 )->setName('massAddContributionsChooseType')->add($authenticate);
141
142 $app->post(
143 '/contribution/mass-add',
144 [Crud\ContributionsController::class, 'massAddContributions']
145 )->setName('massAddContributions')->add($authenticate);
146
147 $app->post(
148 '/contribution/do-mass-add',
149 [Crud\ContributionsController::class, 'doMassAddContributions']
150 )->setName('doMassAddContributions')->add($authenticate);