FinanceBuddy: card money badge on line 3 (v0.3.1)
This commit is contained in:
27
Template/board/task_money.php
Normal file
27
Template/board/task_money.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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>
|
||||
Reference in New Issue
Block a user