@@ -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')), |
@@ -44,8 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | protected function getPool() |
| 46 | 46 | { |
| 47 | - $poolId = $this->target()->method() === 'home' ? $this->target()->args()[0] : |
|
| 48 | - (int)$this->bag('pool.round')->get('pool.id'); |
|
| 47 | + $poolId = $this->target()->method() === 'home' ? $this->target()->args()[0] : (int) $this->bag('pool.round')->get('pool.id'); |
|
| 49 | 48 | $this->pool = $this->poolService->getPool($poolId); |
| 50 | 49 | } |
| 51 | 50 | |
@@ -57,7 +56,7 @@ discard block |
||
| 57 | 56 | $this->response->html('pool-round-actions', $html); |
| 58 | 57 | $this->jq('#btn-pool-round-back')->click($this->cl(Pool::class)->rq()->home()); |
| 59 | 58 | $this->jq('#btn-pool-round-save')->click($this->rq()->saveRound(pm()->form('round-form'))); |
| 60 | - if($this->pool->pool_round) |
|
| 59 | + if ($this->pool->pool_round) |
|
| 61 | 60 | { |
| 62 | 61 | $this->jq('#btn-pool-round-delete')->click($this->rq()->deleteRound() |
| 63 | 62 | ->confirm(trans('tontine.pool_round.questions.delete'))); |
@@ -65,7 +64,7 @@ discard block |
||
| 65 | 64 | |
| 66 | 65 | $defaultLabel = trans('tontine.pool_round.labels.default'); |
| 67 | 66 | $startSession = !$this->pool->pool_round ? $defaultLabel : $this->pool->start_date; |
| 68 | - $endSession = !$this->pool->pool_round ? $defaultLabel : $this->pool->end_date; |
|
| 67 | + $endSession = !$this->pool->pool_round ? $defaultLabel : $this->pool->end_date; |
|
| 69 | 68 | $this->response->html('pool-round-start-session-title', |
| 70 | 69 | trans('tontine.pool_round.titles.start_session', ['session' => $startSession])); |
| 71 | 70 | $this->response->html('pool-round-end-session-title', |
@@ -75,12 +74,12 @@ discard block |
||
| 75 | 74 | private function getSessionPageNumber(SessionModel $session): int |
| 76 | 75 | { |
| 77 | 76 | $sessionCount = $this->sessionService->getTontineSessionCount($session, true, false); |
| 78 | - return (int)($sessionCount / $this->tenantService->getLimit()) + 1; |
|
| 77 | + return (int) ($sessionCount / $this->tenantService->getLimit()) + 1; |
|
| 79 | 78 | } |
| 80 | 79 | |
| 81 | 80 | public function home(int $poolId) |
| 82 | 81 | { |
| 83 | - if(!$this->pool) |
|
| 82 | + if (!$this->pool) |
|
| 84 | 83 | { |
| 85 | 84 | return $this->response; |
| 86 | 85 | } |
@@ -97,7 +96,7 @@ discard block |
||
| 97 | 96 | |
| 98 | 97 | $startPageNumber = 1; |
| 99 | 98 | $endPageNumber = 1; |
| 100 | - if($this->pool->pool_round !== null) |
|
| 99 | + if ($this->pool->pool_round !== null) |
|
| 101 | 100 | { |
| 102 | 101 | // Go to the pages of the round start and end sessions. |
| 103 | 102 | $startPageNumber = $this->getSessionPageNumber($this->pool->pool_round->start_session); |
@@ -172,7 +171,7 @@ discard block |
||
| 172 | 171 | |
| 173 | 172 | public function showStartSessionPage() |
| 174 | 173 | { |
| 175 | - if(!$this->pool->pool_round) |
|
| 174 | + if (!$this->pool->pool_round) |
|
| 176 | 175 | { |
| 177 | 176 | return $this->response; |
| 178 | 177 | } |
@@ -185,7 +184,7 @@ discard block |
||
| 185 | 184 | |
| 186 | 185 | public function showEndSessionPage() |
| 187 | 186 | { |
| 188 | - if(!$this->pool->pool_round) |
|
| 187 | + if (!$this->pool->pool_round) |
|
| 189 | 188 | { |
| 190 | 189 | return $this->response; |
| 191 | 190 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $this->response->html('section-title', trans('tontine.menus.planning')); |
| 51 | 51 | $this->response->html('content-home-sessions', $html); |
| 52 | 52 | |
| 53 | - if(!$round) |
|
| 53 | + if (!$round) |
|
| 54 | 54 | { |
| 55 | 55 | return $this->response; |
| 56 | 56 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | 'title' => trans('common.actions.cancel'), |
| 101 | 101 | 'class' => 'btn btn-tertiary', |
| 102 | 102 | 'click' => 'close', |
| 103 | - ],[ |
|
| 103 | + ], [ |
|
| 104 | 104 | 'title' => trans('common.actions.save'), |
| 105 | 105 | 'class' => 'btn btn-primary', |
| 106 | 106 | 'click' => $this->rq()->create(pm()->form('session-form')), |
@@ -131,11 +131,11 @@ discard block |
||
| 131 | 131 | 'title' => trans('common.actions.cancel'), |
| 132 | 132 | 'class' => 'btn btn-tertiary', |
| 133 | 133 | 'click' => 'close', |
| 134 | - ],[ |
|
| 134 | + ], [ |
|
| 135 | 135 | 'title' => trans('common.actions.year'), |
| 136 | 136 | 'class' => 'btn btn-primary', |
| 137 | 137 | 'click' => $this->rq()->years(), |
| 138 | - ],[ |
|
| 138 | + ], [ |
|
| 139 | 139 | 'title' => trans('common.actions.save'), |
| 140 | 140 | 'class' => 'btn btn-primary', |
| 141 | 141 | 'click' => $this->rq()->createList(pm()->form('session-list')), |
@@ -164,12 +164,12 @@ discard block |
||
| 164 | 164 | private function parseSessionList(string $sessions): array |
| 165 | 165 | { |
| 166 | 166 | $sessions = array_map(function($value) { |
| 167 | - if(!($value = trim($value, " \t\n\r;"))) |
|
| 167 | + if (!($value = trim($value, " \t\n\r;"))) |
|
| 168 | 168 | { |
| 169 | 169 | return []; |
| 170 | 170 | } |
| 171 | 171 | $values = explode(";", $value); |
| 172 | - if(count($values) !== 2) |
|
| 172 | + if (count($values) !== 2) |
|
| 173 | 173 | { |
| 174 | 174 | return []; // Todo: throw an exception |
| 175 | 175 | } |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | // Check uniqueness of session dates |
| 188 | 188 | $sessionDates = array_unique(array_map(fn($session) => $session['date'], $sessions)); |
| 189 | - if(count($sessions) !== count($sessionDates)) |
|
| 189 | + if (count($sessions) !== count($sessionDates)) |
|
| 190 | 190 | { |
| 191 | 191 | throw new MessageException(trans('tontine.session.errors.date_dup')); |
| 192 | 192 | } |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | 'title' => trans('common.actions.cancel'), |
| 220 | 220 | 'class' => 'btn btn-tertiary', |
| 221 | 221 | 'click' => 'close', |
| 222 | - ],[ |
|
| 222 | + ], [ |
|
| 223 | 223 | 'title' => trans('common.actions.save'), |
| 224 | 224 | 'class' => 'btn btn-primary', |
| 225 | 225 | 'click' => $this->rq()->update($session->id, pm()->form('session-form')), |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | 'title' => trans('common.actions.cancel'), |
| 258 | 258 | 'class' => 'btn btn-tertiary', |
| 259 | 259 | 'click' => 'close', |
| 260 | - ],[ |
|
| 260 | + ], [ |
|
| 261 | 261 | 'title' => trans('common.actions.save'), |
| 262 | 262 | 'class' => 'btn btn-primary', |
| 263 | 263 | 'click' => $this->rq()->saveVenue($session->id, pm()->form('session-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 | } |