@@ -16,7 +16,6 @@ |
||
16 | 16 | */ |
17 | 17 | public function scopePage(Builder $query, int $page, int $limit): Builder |
18 | 18 | { |
19 | - return $page < 1 || $limit < 1 ? $query : |
|
20 | - $query->take($limit)->skip($limit * ($page - 1)); |
|
19 | + return $page < 1 || $limit < 1 ? $query : $query->take($limit)->skip($limit * ($page - 1)); |
|
21 | 20 | } |
22 | 21 | } |
@@ -31,34 +31,34 @@ |
||
31 | 31 | ]); |
32 | 32 | $validator->after(function($validator) use($values) { |
33 | 33 | // No more check if there's already an error. |
34 | - if($validator->errors()->count() > 0) |
|
34 | + if ($validator->errors()->count() > 0) |
|
35 | 35 | { |
36 | 36 | return; |
37 | 37 | } |
38 | 38 | |
39 | - $startSession = $this->sessionService->getTontineSession((int)$values['start_session']); |
|
40 | - if(!$startSession) |
|
39 | + $startSession = $this->sessionService->getTontineSession((int) $values['start_session']); |
|
40 | + if (!$startSession) |
|
41 | 41 | { |
42 | 42 | $validator->errors()->add('start_session', trans('tontine.pool.errors.start_session')); |
43 | 43 | } |
44 | - $endSession = $this->sessionService->getTontineSession((int)$values['end_session']); |
|
45 | - if(!$endSession) |
|
44 | + $endSession = $this->sessionService->getTontineSession((int) $values['end_session']); |
|
45 | + if (!$endSession) |
|
46 | 46 | { |
47 | 47 | $validator->errors()->add('end_session', trans('tontine.pool.errors.end_session')); |
48 | 48 | } |
49 | - if($endSession->id === $startSession->id || $endSession->start_at <= $startSession->start_at) |
|
49 | + if ($endSession->id === $startSession->id || $endSession->start_at <= $startSession->start_at) |
|
50 | 50 | { |
51 | 51 | $validator->errors()->add('end_session', trans('tontine.pool.errors.session_dates')); |
52 | 52 | } |
53 | 53 | }); |
54 | - if($validator->fails()) |
|
54 | + if ($validator->fails()) |
|
55 | 55 | { |
56 | 56 | throw new ValidationException($validator); |
57 | 57 | } |
58 | 58 | |
59 | 59 | return [ |
60 | - 'start_session_id' => (int)$values['start_session'], |
|
61 | - 'end_session_id' => (int)$values['end_session'], |
|
60 | + 'start_session_id' => (int) $values['start_session'], |
|
61 | + 'end_session_id' => (int) $values['end_session'], |
|
62 | 62 | ]; |
63 | 63 | } |
64 | 64 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | 'title' => 'required|string|min:5', |
20 | 20 | 'notes' => 'nullable|string', |
21 | 21 | ]); |
22 | - if($validator->fails()) |
|
22 | + if ($validator->fails()) |
|
23 | 23 | { |
24 | 24 | throw new ValidationException($validator); |
25 | 25 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | ]); |
39 | 39 | $validator->after(function($validator) use($values) { |
40 | 40 | // The amount must be greater than 0 when the deposit property is set to fixed. |
41 | - if($values['properties']['deposit']['fixed'] && (float)$values['amount'] <= 0) |
|
41 | + if ($values['properties']['deposit']['fixed'] && (float) $values['amount'] <= 0) |
|
42 | 42 | { |
43 | 43 | $validator->errors()->add('principal', trans('validation.gt.numeric', [ |
44 | 44 | 'attribute' => 'amount', |
@@ -46,13 +46,13 @@ discard block |
||
46 | 46 | ])); |
47 | 47 | } |
48 | 48 | }); |
49 | - if($validator->fails()) |
|
49 | + if ($validator->fails()) |
|
50 | 50 | { |
51 | 51 | throw new ValidationException($validator); |
52 | 52 | } |
53 | 53 | |
54 | 54 | $validated = $validator->validated(); |
55 | - $validated['amount'] = $this->localeService->convertMoneyToInt((float)$validated['amount']); |
|
55 | + $validated['amount'] = $this->localeService->convertMoneyToInt((float) $validated['amount']); |
|
56 | 56 | return $validated; |
57 | 57 | } |
58 | 58 | } |
@@ -33,14 +33,13 @@ |
||
33 | 33 | 'payable' => 'required|integer|min:1', |
34 | 34 | 'auction' => 'required_if:remit_auction,1|regex:/^\d+(\.\d{1,2})?$/', |
35 | 35 | ]); |
36 | - if($validator->fails()) |
|
36 | + if ($validator->fails()) |
|
37 | 37 | { |
38 | 38 | throw new ValidationException($validator); |
39 | 39 | } |
40 | 40 | |
41 | 41 | $validated = $validator->validated(); |
42 | - $validated['auction'] = empty($validated['auction']) ? 0 : |
|
43 | - $this->localeService->convertMoneyToInt((float)$validated['auction']); |
|
42 | + $validated['auction'] = empty($validated['auction']) ? 0 : $this->localeService->convertMoneyToInt((float) $validated['auction']); |
|
44 | 43 | return $validated; |
45 | 44 | } |
46 | 45 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | 'title' => trans('common.actions.cancel'), |
79 | 79 | 'class' => 'btn btn-tertiary', |
80 | 80 | 'click' => 'close', |
81 | - ],[ |
|
81 | + ], [ |
|
82 | 82 | 'title' => trans('common.actions.next'), |
83 | 83 | 'class' => 'btn btn-primary', |
84 | 84 | 'click' => $this->rq()->showDepositFixed(), |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | 'title' => trans('common.actions.cancel'), |
102 | 102 | 'class' => 'btn btn-tertiary', |
103 | 103 | 'click' => 'close', |
104 | - ],[ |
|
104 | + ], [ |
|
105 | 105 | 'title' => trans('common.actions.next'), |
106 | 106 | 'class' => 'btn btn-primary', |
107 | 107 | 'click' => $this->rq()->saveDepositFixed(pm()->checked('pool_deposit_fixed')), |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $properties['deposit']['fixed'] = $fixed; |
118 | 118 | $this->bag('pool')->set('add', $properties); |
119 | 119 | |
120 | - if($fixed) |
|
120 | + if ($fixed) |
|
121 | 121 | { |
122 | 122 | return $this->showDepositLendable(); |
123 | 123 | } |
@@ -137,11 +137,11 @@ discard block |
||
137 | 137 | 'title' => trans('common.actions.cancel'), |
138 | 138 | 'class' => 'btn btn-tertiary', |
139 | 139 | 'click' => 'close', |
140 | - ],[ |
|
140 | + ], [ |
|
141 | 141 | 'title' => trans('common.actions.prev'), |
142 | 142 | 'class' => 'btn btn-primary', |
143 | 143 | 'click' => $this->rq()->showDepositFixed(), |
144 | - ],[ |
|
144 | + ], [ |
|
145 | 145 | 'title' => trans('common.actions.next'), |
146 | 146 | 'class' => 'btn btn-primary', |
147 | 147 | 'click' => $this->rq()->saveDepositLendable(pm()->checked('pool_deposit_lendable')), |
@@ -175,11 +175,11 @@ discard block |
||
175 | 175 | 'title' => trans('common.actions.cancel'), |
176 | 176 | 'class' => 'btn btn-tertiary', |
177 | 177 | 'click' => 'close', |
178 | - ],[ |
|
178 | + ], [ |
|
179 | 179 | 'title' => trans('common.actions.prev'), |
180 | 180 | 'class' => 'btn btn-primary', |
181 | 181 | 'click' => $prevAction, |
182 | - ],[ |
|
182 | + ], [ |
|
183 | 183 | 'title' => trans('common.actions.next'), |
184 | 184 | 'class' => 'btn btn-primary', |
185 | 185 | 'click' => $this->rq()->saveRemitPlanned(pm()->checked('pool_remit_planned')), |
@@ -211,11 +211,11 @@ discard block |
||
211 | 211 | 'title' => trans('common.actions.cancel'), |
212 | 212 | 'class' => 'btn btn-tertiary', |
213 | 213 | 'click' => 'close', |
214 | - ],[ |
|
214 | + ], [ |
|
215 | 215 | 'title' => trans('common.actions.prev'), |
216 | 216 | 'class' => 'btn btn-primary', |
217 | 217 | 'click' => $this->rq()->showRemitPlanned(), |
218 | - ],[ |
|
218 | + ], [ |
|
219 | 219 | 'title' => trans('common.actions.next'), |
220 | 220 | 'class' => 'btn btn-primary', |
221 | 221 | 'click' => $this->rq()->saveRemitAuction(pm()->checked('pool_remit_auction')), |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | 'title' => trans('common.actions.cancel'), |
247 | 247 | 'class' => 'btn btn-tertiary', |
248 | 248 | 'click' => 'close', |
249 | - ],[ |
|
249 | + ], [ |
|
250 | 250 | 'title' => trans('common.actions.save'), |
251 | 251 | 'class' => 'btn btn-primary', |
252 | 252 | 'click' => $this->rq()->create(pm()->form('pool-form')), |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | 'title' => trans('common.actions.cancel'), |
284 | 284 | 'class' => 'btn btn-tertiary', |
285 | 285 | 'click' => 'close', |
286 | - ],[ |
|
286 | + ], [ |
|
287 | 287 | 'title' => trans('common.actions.save'), |
288 | 288 | 'class' => 'btn btn-primary', |
289 | 289 | 'click' => $this->rq()->update($pool->id, pm()->form('pool-form')), |
@@ -47,8 +47,7 @@ discard block |
||
47 | 47 | $pools = $this->poolService->getRoundPools(); |
48 | 48 | $poolLabels = $pools->keyBy('id')->map(function($pool) { |
49 | 49 | return $pool->title . ' - ' . ($pool->deposit_fixed ? |
50 | - $this->localeService->formatMoney($pool->amount) : |
|
51 | - trans('tontine.labels.types.libre')); |
|
50 | + $this->localeService->formatMoney($pool->amount) : trans('tontine.labels.types.libre')); |
|
52 | 51 | }); |
53 | 52 | $html = $this->render('pages.planning.subscription.home', [ |
54 | 53 | 'pools' => $poolLabels, |
@@ -61,7 +60,7 @@ discard block |
||
61 | 60 | $this->jq('#btn-pool-select')->click($this->rq()->pool($selectPoolId)); |
62 | 61 | |
63 | 62 | $pool = $pools->firstWhere('id', $poolId) ?? ($pools->count() > 0 ? $pools[0] : null); |
64 | - if(($pool)) |
|
63 | + if (($pool)) |
|
65 | 64 | { |
66 | 65 | return $this->show($pool); |
67 | 66 | } |
@@ -93,7 +92,7 @@ discard block |
||
93 | 92 | public function planning(int $poolId) |
94 | 93 | { |
95 | 94 | $pool = $this->poolService->getPool($poolId); |
96 | - if(!$pool || !$pool->remit_planned) |
|
95 | + if (!$pool || !$pool->remit_planned) |
|
97 | 96 | { |
98 | 97 | return $this->response; |
99 | 98 | } |
@@ -118,7 +117,7 @@ discard block |
||
118 | 117 | public function beneficiaries(int $poolId) |
119 | 118 | { |
120 | 119 | $pool = $this->poolService->getPool($poolId); |
121 | - if(!$pool || !$pool->remit_planned) |
|
120 | + if (!$pool || !$pool->remit_planned) |
|
122 | 121 | { |
123 | 122 | return $this->response; |
124 | 123 | } |
@@ -150,12 +149,12 @@ discard block |
||
150 | 149 | int $currSubscriptionId) |
151 | 150 | { |
152 | 151 | $pool = $this->poolService->getPool($poolId); |
153 | - if(!$pool || !$pool->remit_planned || $pool->remit_auction) |
|
152 | + if (!$pool || !$pool->remit_planned || $pool->remit_auction) |
|
154 | 153 | { |
155 | 154 | return $this->response; |
156 | 155 | } |
157 | 156 | |
158 | - if(!$this->subscriptionService->saveBeneficiary($pool, $sessionId, |
|
157 | + if (!$this->subscriptionService->saveBeneficiary($pool, $sessionId, |
|
159 | 158 | $currSubscriptionId, $nextSubscriptionId)) |
160 | 159 | { |
161 | 160 | $message = trans('tontine.beneficiary.errors.cant_change'); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | public function showSession(int $sessionId) |
78 | 78 | { |
79 | - if(!($session = $this->sessionService->getSession($sessionId))) |
|
79 | + if (!($session = $this->sessionService->getSession($sessionId))) |
|
80 | 80 | { |
81 | 81 | return $this->response; |
82 | 82 | } |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | |
87 | 87 | public function showMember(int $sessionId, int $memberId) |
88 | 88 | { |
89 | - if(!($session = $this->sessionService->getSession($sessionId))) |
|
89 | + if (!($session = $this->sessionService->getSession($sessionId))) |
|
90 | 90 | { |
91 | 91 | return $this->response; |
92 | 92 | } |
93 | - if(!($member = $this->memberService->getMember($memberId))) |
|
93 | + if (!($member = $this->memberService->getMember($memberId))) |
|
94 | 94 | { |
95 | 95 | return $this->response; |
96 | 96 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $this->target()->args()[0] : $this->bag('meeting')->get('pool.id'); |
47 | 47 | $this->pool = $this->poolService->getPool($poolId); |
48 | 48 | |
49 | - if(!$this->session || !$this->pool || $this->session->disabled($this->pool)) |
|
49 | + if (!$this->session || !$this->pool || $this->session->disabled($this->pool)) |
|
50 | 50 | { |
51 | 51 | $this->notify->error(trans('tontine.session.errors.disabled'), trans('common.titles.error')); |
52 | 52 | $this->pool = null; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function addDeposit(int $receivableId) |
114 | 114 | { |
115 | - if($this->session->closed) |
|
115 | + if ($this->session->closed) |
|
116 | 116 | { |
117 | 117 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
118 | 118 | return $this->response; |
@@ -131,21 +131,20 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function editAmount(int $receivableId) |
133 | 133 | { |
134 | - if($this->session->closed) |
|
134 | + if ($this->session->closed) |
|
135 | 135 | { |
136 | 136 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
137 | 137 | return $this->response; |
138 | 138 | } |
139 | 139 | $receivable = $this->depositService->getReceivable($this->pool, $this->session, $receivableId); |
140 | - if(!$receivable || !$receivable->deposit) |
|
140 | + if (!$receivable || !$receivable->deposit) |
|
141 | 141 | { |
142 | 142 | return $this->page(); |
143 | 143 | } |
144 | 144 | |
145 | 145 | $html = $this->render('pages.meeting.deposit.libre.edit', [ |
146 | 146 | 'id' => $receivable->id, |
147 | - 'amount' => !$receivable->deposit ? '' : |
|
148 | - $this->localeService->getMoneyValue($receivable->deposit->amount), |
|
147 | + 'amount' => !$receivable->deposit ? '' : $this->localeService->getMoneyValue($receivable->deposit->amount), |
|
149 | 148 | ]); |
150 | 149 | $fieldId = 'receivable-' . $receivable->id; |
151 | 150 | $this->response->html($fieldId, $html); |
@@ -166,22 +165,21 @@ discard block |
||
166 | 165 | */ |
167 | 166 | public function saveAmount(int $receivableId, string $amount) |
168 | 167 | { |
169 | - if($this->session->closed) |
|
168 | + if ($this->session->closed) |
|
170 | 169 | { |
171 | 170 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
172 | 171 | return $this->response; |
173 | 172 | } |
174 | 173 | $amount = str_replace(',', '.', trim($amount)); |
175 | - if($amount !== '' && filter_var($amount, FILTER_VALIDATE_FLOAT) === false) |
|
174 | + if ($amount !== '' && filter_var($amount, FILTER_VALIDATE_FLOAT) === false) |
|
176 | 175 | { |
177 | 176 | $this->notify->error(trans('meeting.errors.amount.invalid', ['amount' => $amount])); |
178 | 177 | return $this->response; |
179 | 178 | } |
180 | - $amount = $amount === '' ? 0 : $this->localeService->convertMoneyToInt((float)$amount); |
|
179 | + $amount = $amount === '' ? 0 : $this->localeService->convertMoneyToInt((float) $amount); |
|
181 | 180 | |
182 | 181 | $amount > 0 ? |
183 | - $this->depositService->saveDepositAmount($this->pool, $this->session, $receivableId, $amount): |
|
184 | - $this->depositService->deleteDeposit($this->pool, $this->session, $receivableId); |
|
182 | + $this->depositService->saveDepositAmount($this->pool, $this->session, $receivableId, $amount) : $this->depositService->deleteDeposit($this->pool, $this->session, $receivableId); |
|
185 | 183 | |
186 | 184 | return $this->page(); |
187 | 185 | } |
@@ -193,7 +191,7 @@ discard block |
||
193 | 191 | */ |
194 | 192 | public function delDeposit(int $receivableId) |
195 | 193 | { |
196 | - if($this->session->closed) |
|
194 | + if ($this->session->closed) |
|
197 | 195 | { |
198 | 196 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
199 | 197 | return $this->response; |
@@ -209,12 +207,12 @@ discard block |
||
209 | 207 | */ |
210 | 208 | public function addAllDeposits() |
211 | 209 | { |
212 | - if($this->session->closed) |
|
210 | + if ($this->session->closed) |
|
213 | 211 | { |
214 | 212 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
215 | 213 | return $this->response; |
216 | 214 | } |
217 | - if(!$this->pool->deposit_fixed) |
|
215 | + if (!$this->pool->deposit_fixed) |
|
218 | 216 | { |
219 | 217 | return $this->response; |
220 | 218 | } |
@@ -229,12 +227,12 @@ discard block |
||
229 | 227 | */ |
230 | 228 | public function delAllDeposits() |
231 | 229 | { |
232 | - if($this->session->closed) |
|
230 | + if ($this->session->closed) |
|
233 | 231 | { |
234 | 232 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
235 | 233 | return $this->response; |
236 | 234 | } |
237 | - if(!$this->pool->deposit_fixed) |
|
235 | + if (!$this->pool->deposit_fixed) |
|
238 | 236 | { |
239 | 237 | return $this->response; |
240 | 238 | } |