feature/layout-improvements #38
@ -53,18 +53,18 @@ 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;
 | 
				
			||||||
@ -74,9 +74,9 @@ class CommunityController implements IAuthenticationRequired
 | 
				
			|||||||
            'members' => $this->getMembers($community),
 | 
					            'members' => $this->getMembers($community),
 | 
				
			||||||
            'currencies' => $this->getCurrencies($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()
 | 
				
			||||||
 | 
				
			|||||||
@ -52,20 +52,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>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user