feature/layout-improvements #38
@ -53,18 +53,18 @@ class CommunityController implements IAuthenticationRequired
 | 
			
		||||
 | 
			
		||||
        $balanceCalculator = new BalanceCalculator($community);
 | 
			
		||||
        $debts = $balanceCalculator->calculate();
 | 
			
		||||
        $debtUsers = [];
 | 
			
		||||
        $debtItems = [];
 | 
			
		||||
        $debtBalance = 0.0;
 | 
			
		||||
        $outstandingUsers = [];
 | 
			
		||||
        $outstandingItems = [];
 | 
			
		||||
        $outstandingBalance = 0.0;
 | 
			
		||||
        foreach ($debts as $debt) {
 | 
			
		||||
            if ($debt['payer']->getId() === \Container::$request->user()->getUniqueId()) {
 | 
			
		||||
                $debtBalance += $debt['amount'];
 | 
			
		||||
                $debtUsers[] = $debt;
 | 
			
		||||
                $debtItems[] = $debt;
 | 
			
		||||
            }
 | 
			
		||||
            if ($debt['payee']->getId() === \Container::$request->user()->getUniqueId()) {
 | 
			
		||||
                $outstandingBalance += $debt['amount'];
 | 
			
		||||
                $outstandingUsers[] = $debt;
 | 
			
		||||
                $outstandingItems[] = $debt;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        $balance = $outstandingBalance - $debtBalance;
 | 
			
		||||
@ -74,9 +74,9 @@ class CommunityController implements IAuthenticationRequired
 | 
			
		||||
            'members' => $this->getMembers($community),
 | 
			
		||||
            'currencies' => $this->getCurrencies($community),
 | 
			
		||||
            'upcomingEvents' => [],
 | 
			
		||||
            'debtUsers' => $debtUsers,
 | 
			
		||||
            'debtItems' => $debtItems,
 | 
			
		||||
            'debtBalance' => $debtBalance,
 | 
			
		||||
            'outstandingUsers' => $outstandingUsers,
 | 
			
		||||
            'outstandingItems' => $outstandingItems,
 | 
			
		||||
            'outstandingBalance' => $outstandingBalance,
 | 
			
		||||
            'balance' => $balance,
 | 
			
		||||
            'editPermission' => $ownCommunityMember->getOwner()
 | 
			
		||||
 | 
			
		||||
@ -52,20 +52,20 @@
 | 
			
		||||
                    <td class="bold">You owe</td>
 | 
			
		||||
                    <td class="mono red" style="text-align: right;"><?= number_format($debtBalance, $mainCurrencyRoundDigits) ?> <?= $mainCurrencyCode ?></td>
 | 
			
		||||
                </tr>
 | 
			
		||||
                <?php foreach ($debtUsers as $owe): ?>
 | 
			
		||||
                <?php foreach ($debtItems as $item): ?>
 | 
			
		||||
                    <tr>
 | 
			
		||||
                        <td class="small"><?= $owe['payee']->getUser()->getDisplayName() ?></td>
 | 
			
		||||
                        <td class="small mono red" style="text-align: right;"><?= number_format($owe['amount'], $mainCurrencyRoundDigits) ?> <?= $mainCurrencyCode ?></td>
 | 
			
		||||
                        <td class="small"><?= $item['payee']->getUser()->getDisplayName() ?></td>
 | 
			
		||||
                        <td class="small mono red" style="text-align: right;"><?= number_format($item['amount'], $mainCurrencyRoundDigits) ?> <?= $mainCurrencyCode ?></td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                <?php endforeach; ?>
 | 
			
		||||
                <tr>
 | 
			
		||||
                    <td class="bold">You're owed</td>
 | 
			
		||||
                    <td class="mono green" style="text-align: right;"><?= number_format($outstandingBalance, $mainCurrencyRoundDigits) ?> <?= $mainCurrencyCode ?></td>
 | 
			
		||||
                </tr>
 | 
			
		||||
                <?php foreach ($outstandingUsers as $owe): ?>
 | 
			
		||||
                <?php foreach ($outstandingItems as $item): ?>
 | 
			
		||||
                    <tr>
 | 
			
		||||
                        <td class="small"><?= $owe['payer']->getUser()->getDisplayName() ?></td>
 | 
			
		||||
                        <td class="small mono green" style="text-align: right;"><?= number_format($owe['amount'], $mainCurrencyRoundDigits) ?> <?= $mainCurrencyCode ?></td>
 | 
			
		||||
                        <td class="small"><?= $item['payer']->getUser()->getDisplayName() ?></td>
 | 
			
		||||
                        <td class="small mono green" style="text-align: right;"><?= number_format($item['amount'], $mainCurrencyRoundDigits) ?> <?= $mainCurrencyCode ?></td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                <?php endforeach; ?>
 | 
			
		||||
                <tr>
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user