feat: add deposit edit and delete for pending deposits
Add PUT /api/v1/dca/deposits/{id} endpoint to update amount, currency,
and notes on pending deposits. Add DELETE endpoint to remove deposits
not yet inserted into the machine. Both endpoints reject confirmed
deposits. Frontend now shows edit/delete buttons only for pending rows.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
6eb076d5f6
commit
28241e70c3
5 changed files with 121 additions and 3 deletions
|
|
@ -389,12 +389,12 @@ window.app = Vue.createApp({
|
|||
}
|
||||
|
||||
if (this.depositFormDialog.data.id) {
|
||||
// Update existing deposit (mainly for notes/status)
|
||||
// Update existing pending deposit
|
||||
const { data: updatedDeposit } = await LNbits.api.request(
|
||||
'PUT',
|
||||
`/satmachineadmin/api/v1/dca/deposits/${this.depositFormDialog.data.id}`,
|
||||
null,
|
||||
{ status: this.depositFormDialog.data.status, notes: data.notes }
|
||||
{ amount: data.amount, currency: data.currency, notes: data.notes }
|
||||
)
|
||||
const index = this.deposits.findIndex(d => d.id === updatedDeposit.id)
|
||||
if (index !== -1) {
|
||||
|
|
@ -460,6 +460,28 @@ window.app = Vue.createApp({
|
|||
this.depositFormDialog.show = true
|
||||
},
|
||||
|
||||
async deleteDeposit(deposit) {
|
||||
try {
|
||||
await LNbits.utils
|
||||
.confirmDialog('Are you sure you want to delete this pending deposit?')
|
||||
.onOk(async () => {
|
||||
await LNbits.api.request(
|
||||
'DELETE',
|
||||
`/satmachineadmin/api/v1/dca/deposits/${deposit.id}`,
|
||||
null
|
||||
)
|
||||
this.deposits = this.deposits.filter(d => d.id !== deposit.id)
|
||||
this.$q.notify({
|
||||
type: 'positive',
|
||||
message: 'Deposit deleted successfully',
|
||||
timeout: 5000
|
||||
})
|
||||
})
|
||||
} catch (error) {
|
||||
LNbits.utils.notifyApiError(error)
|
||||
}
|
||||
},
|
||||
|
||||
// Export Methods
|
||||
async exportClientsCSV() {
|
||||
await LNbits.utils.exportCSV(this.clientsTable.columns, this.dcaClients)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue