28 lines
1.0 KiB
PHP
28 lines
1.0 KiB
PHP
<?php
|
|
// Line-3 money badge, rendered under the card title via the after-title hooks. Server-side, so
|
|
// it re-renders correctly on every board refresh. Nothing shows unless the board is enabled and
|
|
// the card has a positive amount.
|
|
if (empty($task['project_id']) || ! $this->FinanceHelper->isEnabled($task['project_id'])) {
|
|
return;
|
|
}
|
|
|
|
$fb = $this->FinanceHelper->get($task['id']);
|
|
|
|
if ($fb['amount'] === '' || (float) $fb['amount'] <= 0) {
|
|
return;
|
|
}
|
|
|
|
$credit = $fb['direction'] === 'credit';
|
|
$sign = $credit ? '+' : '-';
|
|
$total = $fb['installment_total'];
|
|
$current = $fb['installment_current'] !== '' ? $fb['installment_current'] : '1';
|
|
?>
|
|
<div class="fb-line">
|
|
<span class="fb-badge <?= $credit ? 'fb-badge-credit' : 'fb-badge-debit' ?>">
|
|
<?= $sign ?>R$<?= \Kanboard\Plugin\FinanceBuddy\Helper\FinanceHelper::money($fb['amount']) ?>
|
|
</span>
|
|
<?php if ($total !== ''): ?>
|
|
<span class="fb-installments">p<?= $this->text->e($current) ?>/<?= $this->text->e($total) ?></span>
|
|
<?php endif ?>
|
|
</div>
|