Adds per-user wallet configuration

Allows users to configure their own wallet ID, enabling
the system to track expenses and receivables on a per-user basis.

Introduces new database table, models, API endpoints, and UI elements
to manage user-specific wallet settings.
This commit is contained in:
padreug 2025-10-22 14:54:25 +02:00
parent 31344607c6
commit bb1dbcccd8
7 changed files with 236 additions and 6 deletions

View file

@ -16,9 +16,12 @@
<h5 class="q-my-none">🏰 Castle Accounting</h5>
<p class="q-mb-none">Track expenses, receivables, and balances for the collective</p>
</div>
<div class="col-auto" v-if="isSuperUser">
<q-btn flat round icon="settings" @click="showSettingsDialog">
<q-tooltip>Settings (Super User Only)</q-tooltip>
<div class="col-auto">
<q-btn flat round icon="account_balance_wallet" @click="showUserWalletDialog">
<q-tooltip>Configure Your Wallet</q-tooltip>
</q-btn>
<q-btn v-if="isSuperUser" flat round icon="settings" @click="showSettingsDialog">
<q-tooltip>Castle Settings (Super User Only)</q-tooltip>
</q-btn>
</div>
</div>
@ -47,6 +50,18 @@
</div>
</q-banner>
<q-banner v-if="castleWalletConfigured && !userWalletConfigured" class="bg-orange text-white" rounded>
<template v-slot:avatar>
<q-icon name="account_balance_wallet" color="white"></q-icon>
</template>
<div>
<strong>Wallet Setup Required:</strong> You must configure your wallet before using this extension.
</div>
<template v-slot:action>
<q-btn flat color="white" label="Configure Wallet" @click="showUserWalletDialog"></q-btn>
</template>
</q-banner>
<!-- User Balance Card -->
<q-card>
<q-card-section>
@ -91,12 +106,15 @@
<q-btn
color="primary"
@click="expenseDialog.show = true"
:disable="!castleWalletConfigured"
:disable="!castleWalletConfigured || !userWalletConfigured"
>
Add Expense
<q-tooltip v-if="!castleWalletConfigured">
Castle wallet must be configured first
</q-tooltip>
<q-tooltip v-if="castleWalletConfigured && !userWalletConfigured">
You must configure your wallet first
</q-tooltip>
</q-btn>
<q-btn color="secondary" @click="loadTransactions">
View Transactions
@ -317,4 +335,32 @@
</q-card>
</q-dialog>
<!-- User Wallet Dialog -->
<q-dialog v-model="userWalletDialog.show" position="top">
<q-card v-if="userWalletDialog.show" class="q-pa-lg q-pt-xl lnbits__dialog-card">
<q-form @submit="submitUserWallet" class="q-gutter-md">
<div class="text-h6 q-mb-md">Configure Your Wallet</div>
<q-input
filled
dense
v-model.trim="userWalletDialog.userWalletId"
label="Your Wallet ID *"
placeholder="Enter your wallet ID"
></q-input>
<div class="text-caption text-grey">
This is the wallet you'll use for Castle transactions. You can find your wallet ID in the LNbits wallet settings.
</div>
<div class="row q-mt-lg">
<q-btn unelevated color="primary" type="submit" :loading="userWalletDialog.loading">
Save Wallet
</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 %}