Reverts balance perspective to castle's view
Changes the displayed balance perspective to reflect the castle's point of view instead of the user's. This involves: - Displaying balances as positive when the user owes the castle - Displaying balances as negative when the castle owes the user. This change affects how balances are calculated and displayed in both the backend logic and the frontend templates.
This commit is contained in:
parent
0f24833e02
commit
5c1c7b1b05
2 changed files with 39 additions and 41 deletions
|
|
@ -182,7 +182,7 @@
|
|||
</template>
|
||||
<template v-slot:body-cell-balance="props">
|
||||
<q-td :props="props">
|
||||
<div :class="props.row.balance > 0 ? 'text-negative' : 'text-positive'">
|
||||
<div :class="props.row.balance > 0 ? 'text-positive' : 'text-negative'">
|
||||
{% raw %}{{ formatSats(Math.abs(props.row.balance)) }} sats{% endraw %}
|
||||
</div>
|
||||
<div v-if="props.row.fiat_balances && Object.keys(props.row.fiat_balances).length > 0" class="text-caption">
|
||||
|
|
@ -191,15 +191,15 @@
|
|||
</span>
|
||||
</div>
|
||||
<div class="text-caption text-grey">
|
||||
{% raw %}{{ props.row.balance > 0 ? 'You owe' : 'Owes you' }}{% endraw %}
|
||||
{% raw %}{{ props.row.balance > 0 ? 'Owes you' : 'You owe' }}{% endraw %}
|
||||
</div>
|
||||
</q-td>
|
||||
</template>
|
||||
<template v-slot:body-cell-actions="props">
|
||||
<q-td :props="props">
|
||||
<!-- User owes Castle (negative balance) - Castle receives payment -->
|
||||
<!-- User owes Castle (positive balance) - Castle receives payment -->
|
||||
<q-btn
|
||||
v-if="props.row.balance < 0"
|
||||
v-if="props.row.balance > 0"
|
||||
flat
|
||||
dense
|
||||
size="sm"
|
||||
|
|
@ -209,9 +209,9 @@
|
|||
>
|
||||
<q-tooltip>Settle receivable (user pays castle)</q-tooltip>
|
||||
</q-btn>
|
||||
<!-- Castle owes User (positive balance) - Castle pays user -->
|
||||
<!-- Castle owes User (negative balance) - Castle pays user -->
|
||||
<q-btn
|
||||
v-if="props.row.balance > 0"
|
||||
v-if="props.row.balance < 0"
|
||||
flat
|
||||
dense
|
||||
size="sm"
|
||||
|
|
@ -241,7 +241,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div v-if="balance !== null">
|
||||
<div class="text-h4" :class="isSuperUser ? (balance.balance >= 0 ? 'text-negative' : 'text-positive') : (balance.balance >= 0 ? 'text-positive' : 'text-negative')">
|
||||
<div class="text-h4" :class="isSuperUser ? (balance.balance >= 0 ? 'text-positive' : 'text-negative') : (balance.balance >= 0 ? 'text-negative' : 'text-positive')">
|
||||
{% raw %}{{ formatSats(Math.abs(balance.balance)) }} sats{% endraw %}
|
||||
</div>
|
||||
<div v-if="balance.fiat_balances && Object.keys(balance.fiat_balances).length > 0" class="text-h6 q-mt-sm">
|
||||
|
|
@ -250,21 +250,21 @@
|
|||
</span>
|
||||
</div>
|
||||
<div class="text-subtitle2" v-if="isSuperUser">
|
||||
{% raw %}{{ balance.balance > 0 ? 'Total you owe' : balance.balance < 0 ? 'Total owed to you' : 'No outstanding balances' }}{% endraw %}
|
||||
{% raw %}{{ balance.balance > 0 ? 'Total owed to you' : balance.balance < 0 ? 'Total you owe' : 'No outstanding balances' }}{% endraw %}
|
||||
</div>
|
||||
<div class="text-subtitle2" v-else>
|
||||
{% raw %}{{ balance.balance >= 0 ? 'Castle owes you' : 'You owe Castle' }}{% endraw %}
|
||||
{% raw %}{{ balance.balance >= 0 ? 'You owe Castle' : 'Castle owes you' }}{% endraw %}
|
||||
</div>
|
||||
<div class="q-mt-md q-gutter-sm">
|
||||
<q-btn
|
||||
v-if="balance.balance < 0 && !isSuperUser"
|
||||
v-if="balance.balance > 0 && !isSuperUser"
|
||||
color="primary"
|
||||
@click="showPayBalanceDialog"
|
||||
>
|
||||
Pay Balance
|
||||
</q-btn>
|
||||
<q-btn
|
||||
v-if="balance.balance > 0 && !isSuperUser"
|
||||
v-if="balance.balance < 0 && !isSuperUser"
|
||||
color="secondary"
|
||||
@click="showManualPaymentDialog"
|
||||
>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue