Adds receivable entry functionality

Implements the ability to record receivables (user owes the castle).

Adds API endpoint for creating receivable entries, which includes currency conversion to satoshis if fiat currency is provided.

Integrates a UI component (receivable dialog) for superusers to record debts owed by users, enhancing financial tracking capabilities.
This commit is contained in:
padreug 2025-10-22 16:16:36 +02:00
parent b7e4e05469
commit 2a14dd2e62
4 changed files with 250 additions and 3 deletions

View file

@ -153,6 +153,20 @@
You must configure your wallet first
</q-tooltip>
</q-btn>
<q-btn
v-if="isSuperUser"
color="orange"
@click="showReceivableDialog"
:disable="!castleWalletConfigured"
>
Add Receivable
<q-tooltip v-if="!castleWalletConfigured">
Castle wallet must be configured first
</q-tooltip>
<q-tooltip v-else>
Record when a user owes the Castle
</q-tooltip>
</q-btn>
<q-btn color="secondary" @click="loadTransactions">
View Transactions
</q-btn>
@ -410,4 +424,82 @@
</q-card>
</q-dialog>
<!-- Receivable Dialog -->
<q-dialog v-model="receivableDialog.show" position="top">
<q-card v-if="receivableDialog.show" class="q-pa-lg q-pt-xl lnbits__dialog-card">
<q-form @submit="submitReceivable" class="q-gutter-md">
<div class="text-h6 q-mb-md">Add Receivable</div>
<q-select
filled
dense
v-model="receivableDialog.selectedUser"
:options="userOptions"
option-label="label"
option-value="value"
emit-value
map-options
label="User *"
></q-select>
<q-input
filled
dense
v-model.trim="receivableDialog.description"
label="Description *"
placeholder="e.g., Room rental for 5 days"
></q-input>
<q-select
filled
dense
v-model="receivableDialog.currency"
:options="currencyOptions"
option-label="label"
option-value="value"
emit-value
map-options
label="Currency"
></q-select>
<q-input
filled
dense
v-model.number="receivableDialog.amount"
type="number"
:label="receivableAmountLabel"
min="0.01"
step="0.01"
></q-input>
<q-select
filled
dense
v-model="receivableDialog.revenueAccount"
:options="revenueAccounts"
option-label="name"
option-value="id"
emit-value
map-options
label="Revenue Category *"
></q-select>
<q-input
filled
dense
v-model.trim="receivableDialog.reference"
label="Reference (optional)"
placeholder="e.g., Invoice #456"
></q-input>
<div class="row q-mt-lg">
<q-btn unelevated color="primary" type="submit" :loading="receivableDialog.loading">
Submit Receivable
</q-btn>
<q-btn v-close-popup flat color="grey" class="q-ml-auto">Cancel</q-btn>
</div>
</q-form>
</q-card>
</q-dialog>
{% endblock %}