Add temporary DCA client creation endpoint for testing and enhance quick deposit UI with new form for adding deposits. Clean up code formatting for consistency.
This commit is contained in:
parent
b3332e585a
commit
46b7a1450d
3 changed files with 182 additions and 124 deletions
|
|
@ -8,15 +8,15 @@ window.app = Vue.createApp({
|
||||||
dcaClients: [],
|
dcaClients: [],
|
||||||
deposits: [],
|
deposits: [],
|
||||||
totalDcaBalance: 0,
|
totalDcaBalance: 0,
|
||||||
|
|
||||||
// Table configurations
|
// Table configurations
|
||||||
clientsTable: {
|
clientsTable: {
|
||||||
columns: [
|
columns: [
|
||||||
{name: 'user_id', align: 'left', label: 'User ID', field: 'user_id'},
|
{ name: 'user_id', align: 'left', label: 'User ID', field: 'user_id' },
|
||||||
{name: 'wallet_id', align: 'left', label: 'Wallet ID', field: 'wallet_id'},
|
{ name: 'wallet_id', align: 'left', label: 'Wallet ID', field: 'wallet_id' },
|
||||||
{name: 'dca_mode', align: 'left', label: 'DCA Mode', field: 'dca_mode'},
|
{ name: 'dca_mode', align: 'left', label: 'DCA Mode', field: 'dca_mode' },
|
||||||
{name: 'fixed_mode_daily_limit', align: 'left', label: 'Daily Limit', field: 'fixed_mode_daily_limit'},
|
{ name: 'fixed_mode_daily_limit', align: 'left', label: 'Daily Limit', field: 'fixed_mode_daily_limit' },
|
||||||
{name: 'status', align: 'left', label: 'Status', field: 'status'}
|
{ name: 'status', align: 'left', label: 'Status', field: 'status' }
|
||||||
],
|
],
|
||||||
pagination: {
|
pagination: {
|
||||||
rowsPerPage: 10
|
rowsPerPage: 10
|
||||||
|
|
@ -24,18 +24,18 @@ window.app = Vue.createApp({
|
||||||
},
|
},
|
||||||
depositsTable: {
|
depositsTable: {
|
||||||
columns: [
|
columns: [
|
||||||
{name: 'client_id', align: 'left', label: 'Client', field: 'client_id'},
|
{ name: 'client_id', align: 'left', label: 'Client', field: 'client_id' },
|
||||||
{name: 'amount', align: 'left', label: 'Amount', field: 'amount'},
|
{ name: 'amount', align: 'left', label: 'Amount', field: 'amount' },
|
||||||
{name: 'currency', align: 'left', label: 'Currency', field: 'currency'},
|
{ name: 'currency', align: 'left', label: 'Currency', field: 'currency' },
|
||||||
{name: 'status', align: 'left', label: 'Status', field: 'status'},
|
{ name: 'status', align: 'left', label: 'Status', field: 'status' },
|
||||||
{name: 'created_at', align: 'left', label: 'Created', field: 'created_at'},
|
{ name: 'created_at', align: 'left', label: 'Created', field: 'created_at' },
|
||||||
{name: 'notes', align: 'left', label: 'Notes', field: 'notes'}
|
{ name: 'notes', align: 'left', label: 'Notes', field: 'notes' }
|
||||||
],
|
],
|
||||||
pagination: {
|
pagination: {
|
||||||
rowsPerPage: 10
|
rowsPerPage: 10
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Dialog states
|
// Dialog states
|
||||||
depositFormDialog: {
|
depositFormDialog: {
|
||||||
show: false,
|
show: false,
|
||||||
|
|
@ -48,30 +48,30 @@ window.app = Vue.createApp({
|
||||||
data: null,
|
data: null,
|
||||||
balance: null
|
balance: null
|
||||||
},
|
},
|
||||||
|
|
||||||
// Quick deposit form
|
// Quick deposit form
|
||||||
quickDepositForm: {
|
quickDepositForm: {
|
||||||
client_id: '',
|
client_id: '',
|
||||||
amount: null,
|
amount: null,
|
||||||
notes: ''
|
notes: ''
|
||||||
},
|
},
|
||||||
|
|
||||||
// Options
|
// Options
|
||||||
currencyOptions: [
|
currencyOptions: [
|
||||||
{label: 'GTQ', value: 'GTQ'},
|
{ label: 'GTQ', value: 'GTQ' },
|
||||||
{label: 'USD', value: 'USD'}
|
{ label: 'USD', value: 'USD' }
|
||||||
],
|
],
|
||||||
|
|
||||||
// Legacy data (keep for backward compatibility)
|
// Legacy data (keep for backward compatibility)
|
||||||
invoiceAmount: 10,
|
invoiceAmount: 10,
|
||||||
qrValue: 'lnurlpay',
|
qrValue: 'lnurlpay',
|
||||||
myex: [],
|
myex: [],
|
||||||
myexTable: {
|
myexTable: {
|
||||||
columns: [
|
columns: [
|
||||||
{name: 'id', align: 'left', label: 'ID', field: 'id'},
|
{ name: 'id', align: 'left', label: 'ID', field: 'id' },
|
||||||
{name: 'name', align: 'left', label: 'Name', field: 'name'},
|
{ name: 'name', align: 'left', label: 'Name', field: 'name' },
|
||||||
{name: 'wallet', align: 'left', label: 'Wallet', field: 'wallet'},
|
{ name: 'wallet', align: 'left', label: 'Wallet', field: 'wallet' },
|
||||||
{name: 'total', align: 'left', label: 'Total sent/received', field: 'total'}
|
{ name: 'total', align: 'left', label: 'Total sent/received', field: 'total' }
|
||||||
],
|
],
|
||||||
pagination: {
|
pagination: {
|
||||||
rowsPerPage: 10
|
rowsPerPage: 10
|
||||||
|
|
@ -96,19 +96,23 @@ window.app = Vue.createApp({
|
||||||
methods: {
|
methods: {
|
||||||
// Utility Methods
|
// Utility Methods
|
||||||
formatCurrency(amount) {
|
formatCurrency(amount) {
|
||||||
if (!amount) return 'Q 0.00'
|
if (!amount) return 'Q 0.00';
|
||||||
return `Q ${(amount / 100).toFixed(2)}`
|
|
||||||
|
return new Intl.NumberFormat('es-GT', {
|
||||||
|
style: 'currency',
|
||||||
|
currency: 'GTQ',
|
||||||
|
}).format(amount);
|
||||||
},
|
},
|
||||||
|
|
||||||
formatDate(dateString) {
|
formatDate(dateString) {
|
||||||
if (!dateString) return ''
|
if (!dateString) return ''
|
||||||
return new Date(dateString).toLocaleDateString()
|
return new Date(dateString).toLocaleDateString()
|
||||||
},
|
},
|
||||||
|
|
||||||
// DCA Client Methods
|
// DCA Client Methods
|
||||||
async getDcaClients() {
|
async getDcaClients() {
|
||||||
try {
|
try {
|
||||||
const {data} = await LNbits.api.request(
|
const { data } = await LNbits.api.request(
|
||||||
'GET',
|
'GET',
|
||||||
'/myextension/api/v1/dca/clients',
|
'/myextension/api/v1/dca/clients',
|
||||||
this.g.user.wallets[0].inkey
|
this.g.user.wallets[0].inkey
|
||||||
|
|
@ -118,7 +122,35 @@ window.app = Vue.createApp({
|
||||||
LNbits.utils.notifyApiError(error)
|
LNbits.utils.notifyApiError(error)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Test Client Creation (temporary for testing)
|
||||||
|
async createTestClient() {
|
||||||
|
try {
|
||||||
|
const testData = {
|
||||||
|
user_id: this.g.user.id,
|
||||||
|
wallet_id: this.g.user.wallets[0].id,
|
||||||
|
dca_mode: 'flow'
|
||||||
|
}
|
||||||
|
|
||||||
|
const { data: newClient } = await LNbits.api.request(
|
||||||
|
'POST',
|
||||||
|
'/myextension/api/v1/dca/clients',
|
||||||
|
this.g.user.wallets[0].adminkey,
|
||||||
|
testData
|
||||||
|
)
|
||||||
|
|
||||||
|
this.dcaClients.push(newClient)
|
||||||
|
|
||||||
|
this.$q.notify({
|
||||||
|
type: 'positive',
|
||||||
|
message: 'Test client created successfully!',
|
||||||
|
timeout: 5000
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
LNbits.utils.notifyApiError(error)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// Quick Deposit Methods
|
// Quick Deposit Methods
|
||||||
async sendQuickDeposit() {
|
async sendQuickDeposit() {
|
||||||
try {
|
try {
|
||||||
|
|
@ -128,23 +160,23 @@ window.app = Vue.createApp({
|
||||||
currency: 'GTQ',
|
currency: 'GTQ',
|
||||||
notes: this.quickDepositForm.notes
|
notes: this.quickDepositForm.notes
|
||||||
}
|
}
|
||||||
|
|
||||||
const {data: newDeposit} = await LNbits.api.request(
|
const { data: newDeposit } = await LNbits.api.request(
|
||||||
'POST',
|
'POST',
|
||||||
'/myextension/api/v1/dca/deposits',
|
'/myextension/api/v1/dca/deposits',
|
||||||
this.g.user.wallets[0].adminkey,
|
this.g.user.wallets[0].adminkey,
|
||||||
data
|
data
|
||||||
)
|
)
|
||||||
|
|
||||||
this.deposits.unshift(newDeposit)
|
this.deposits.unshift(newDeposit)
|
||||||
|
|
||||||
// Reset form
|
// Reset form
|
||||||
this.quickDepositForm = {
|
this.quickDepositForm = {
|
||||||
client_id: '',
|
client_id: '',
|
||||||
amount: null,
|
amount: null,
|
||||||
notes: ''
|
notes: ''
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$q.notify({
|
this.$q.notify({
|
||||||
type: 'positive',
|
type: 'positive',
|
||||||
message: 'Deposit created successfully',
|
message: 'Deposit created successfully',
|
||||||
|
|
@ -154,10 +186,10 @@ window.app = Vue.createApp({
|
||||||
LNbits.utils.notifyApiError(error)
|
LNbits.utils.notifyApiError(error)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async viewClientDetails(client) {
|
async viewClientDetails(client) {
|
||||||
try {
|
try {
|
||||||
const {data: balance} = await LNbits.api.request(
|
const { data: balance } = await LNbits.api.request(
|
||||||
'GET',
|
'GET',
|
||||||
`/myextension/api/v1/dca/clients/${client.id}/balance`,
|
`/myextension/api/v1/dca/clients/${client.id}/balance`,
|
||||||
this.g.user.wallets[0].inkey
|
this.g.user.wallets[0].inkey
|
||||||
|
|
@ -169,11 +201,11 @@ window.app = Vue.createApp({
|
||||||
LNbits.utils.notifyApiError(error)
|
LNbits.utils.notifyApiError(error)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Deposit Methods
|
// Deposit Methods
|
||||||
async getDeposits() {
|
async getDeposits() {
|
||||||
try {
|
try {
|
||||||
const {data} = await LNbits.api.request(
|
const { data } = await LNbits.api.request(
|
||||||
'GET',
|
'GET',
|
||||||
'/myextension/api/v1/dca/deposits',
|
'/myextension/api/v1/dca/deposits',
|
||||||
this.g.user.wallets[0].inkey
|
this.g.user.wallets[0].inkey
|
||||||
|
|
@ -183,7 +215,7 @@ window.app = Vue.createApp({
|
||||||
LNbits.utils.notifyApiError(error)
|
LNbits.utils.notifyApiError(error)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
addDepositDialog(client) {
|
addDepositDialog(client) {
|
||||||
this.depositFormDialog.data = {
|
this.depositFormDialog.data = {
|
||||||
client_id: client.id,
|
client_id: client.id,
|
||||||
|
|
@ -192,7 +224,7 @@ window.app = Vue.createApp({
|
||||||
}
|
}
|
||||||
this.depositFormDialog.show = true
|
this.depositFormDialog.show = true
|
||||||
},
|
},
|
||||||
|
|
||||||
async sendDepositData() {
|
async sendDepositData() {
|
||||||
try {
|
try {
|
||||||
const data = {
|
const data = {
|
||||||
|
|
@ -201,14 +233,14 @@ window.app = Vue.createApp({
|
||||||
currency: this.depositFormDialog.data.currency,
|
currency: this.depositFormDialog.data.currency,
|
||||||
notes: this.depositFormDialog.data.notes
|
notes: this.depositFormDialog.data.notes
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.depositFormDialog.data.id) {
|
if (this.depositFormDialog.data.id) {
|
||||||
// Update existing deposit (mainly for notes/status)
|
// Update existing deposit (mainly for notes/status)
|
||||||
const {data: updatedDeposit} = await LNbits.api.request(
|
const { data: updatedDeposit } = await LNbits.api.request(
|
||||||
'PUT',
|
'PUT',
|
||||||
`/myextension/api/v1/dca/deposits/${this.depositFormDialog.data.id}`,
|
`/myextension/api/v1/dca/deposits/${this.depositFormDialog.data.id}`,
|
||||||
this.g.user.wallets[0].adminkey,
|
this.g.user.wallets[0].adminkey,
|
||||||
{status: this.depositFormDialog.data.status, notes: data.notes}
|
{ status: this.depositFormDialog.data.status, notes: data.notes }
|
||||||
)
|
)
|
||||||
const index = this.deposits.findIndex(d => d.id === updatedDeposit.id)
|
const index = this.deposits.findIndex(d => d.id === updatedDeposit.id)
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
|
|
@ -216,7 +248,7 @@ window.app = Vue.createApp({
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Create new deposit
|
// Create new deposit
|
||||||
const {data: newDeposit} = await LNbits.api.request(
|
const { data: newDeposit } = await LNbits.api.request(
|
||||||
'POST',
|
'POST',
|
||||||
'/myextension/api/v1/dca/deposits',
|
'/myextension/api/v1/dca/deposits',
|
||||||
this.g.user.wallets[0].adminkey,
|
this.g.user.wallets[0].adminkey,
|
||||||
|
|
@ -224,7 +256,7 @@ window.app = Vue.createApp({
|
||||||
)
|
)
|
||||||
this.deposits.unshift(newDeposit)
|
this.deposits.unshift(newDeposit)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.closeDepositFormDialog()
|
this.closeDepositFormDialog()
|
||||||
this.$q.notify({
|
this.$q.notify({
|
||||||
type: 'positive',
|
type: 'positive',
|
||||||
|
|
@ -235,24 +267,24 @@ window.app = Vue.createApp({
|
||||||
LNbits.utils.notifyApiError(error)
|
LNbits.utils.notifyApiError(error)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
closeDepositFormDialog() {
|
closeDepositFormDialog() {
|
||||||
this.depositFormDialog.show = false
|
this.depositFormDialog.show = false
|
||||||
this.depositFormDialog.data = {
|
this.depositFormDialog.data = {
|
||||||
currency: 'GTQ'
|
currency: 'GTQ'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async confirmDeposit(deposit) {
|
async confirmDeposit(deposit) {
|
||||||
try {
|
try {
|
||||||
await LNbits.utils
|
await LNbits.utils
|
||||||
.confirmDialog('Confirm that this deposit has been physically placed in the ATM machine?')
|
.confirmDialog('Confirm that this deposit has been physically placed in the ATM machine?')
|
||||||
.onOk(async () => {
|
.onOk(async () => {
|
||||||
const {data: updatedDeposit} = await LNbits.api.request(
|
const { data: updatedDeposit } = await LNbits.api.request(
|
||||||
'PUT',
|
'PUT',
|
||||||
`/myextension/api/v1/dca/deposits/${deposit.id}/status`,
|
`/myextension/api/v1/dca/deposits/${deposit.id}/status`,
|
||||||
this.g.user.wallets[0].adminkey,
|
this.g.user.wallets[0].adminkey,
|
||||||
{status: 'confirmed', notes: 'Confirmed by admin - money placed in machine'}
|
{ status: 'confirmed', notes: 'Confirmed by admin - money placed in machine' }
|
||||||
)
|
)
|
||||||
const index = this.deposits.findIndex(d => d.id === deposit.id)
|
const index = this.deposits.findIndex(d => d.id === deposit.id)
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
|
|
@ -268,21 +300,21 @@ window.app = Vue.createApp({
|
||||||
LNbits.utils.notifyApiError(error)
|
LNbits.utils.notifyApiError(error)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
editDeposit(deposit) {
|
editDeposit(deposit) {
|
||||||
this.depositFormDialog.data = {...deposit}
|
this.depositFormDialog.data = { ...deposit }
|
||||||
this.depositFormDialog.show = true
|
this.depositFormDialog.show = true
|
||||||
},
|
},
|
||||||
|
|
||||||
// Export Methods
|
// Export Methods
|
||||||
async exportClientsCSV() {
|
async exportClientsCSV() {
|
||||||
await LNbits.utils.exportCSV(this.clientsTable.columns, this.dcaClients)
|
await LNbits.utils.exportCSV(this.clientsTable.columns, this.dcaClients)
|
||||||
},
|
},
|
||||||
|
|
||||||
async exportDepositsCSV() {
|
async exportDepositsCSV() {
|
||||||
await LNbits.utils.exportCSV(this.depositsTable.columns, this.deposits)
|
await LNbits.utils.exportCSV(this.depositsTable.columns, this.deposits)
|
||||||
},
|
},
|
||||||
|
|
||||||
// Legacy Methods (keep for backward compatibility)
|
// Legacy Methods (keep for backward compatibility)
|
||||||
async closeFormDialog() {
|
async closeFormDialog() {
|
||||||
this.formDialog.show = false
|
this.formDialog.show = false
|
||||||
|
|
@ -321,7 +353,7 @@ window.app = Vue.createApp({
|
||||||
},
|
},
|
||||||
|
|
||||||
async updateMyExtensionForm(tempId) {
|
async updateMyExtensionForm(tempId) {
|
||||||
const myextension = _.findWhere(this.myex, {id: tempId})
|
const myextension = _.findWhere(this.myex, { id: tempId })
|
||||||
this.formDialog.data = {
|
this.formDialog.data = {
|
||||||
...myextension
|
...myextension
|
||||||
}
|
}
|
||||||
|
|
@ -365,7 +397,7 @@ window.app = Vue.createApp({
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
async deleteMyExtension(tempId) {
|
async deleteMyExtension(tempId) {
|
||||||
var myextension = _.findWhere(this.myex, {id: tempId})
|
var myextension = _.findWhere(this.myex, { id: tempId })
|
||||||
const wallet = _.findWhere(this.g.user.wallets, {
|
const wallet = _.findWhere(this.g.user.wallets, {
|
||||||
id: myextension.wallet
|
id: myextension.wallet
|
||||||
})
|
})
|
||||||
|
|
@ -393,12 +425,12 @@ window.app = Vue.createApp({
|
||||||
await LNbits.utils.exportCSV(this.myexTable.columns, this.myex)
|
await LNbits.utils.exportCSV(this.myexTable.columns, this.myex)
|
||||||
},
|
},
|
||||||
async itemsArray(tempId) {
|
async itemsArray(tempId) {
|
||||||
const myextension = _.findWhere(this.myex, {id: tempId})
|
const myextension = _.findWhere(this.myex, { id: tempId })
|
||||||
return [...myextension.itemsMap.values()]
|
return [...myextension.itemsMap.values()]
|
||||||
},
|
},
|
||||||
async openformDialog(id) {
|
async openformDialog(id) {
|
||||||
const [tempId, itemId] = id.split(':')
|
const [tempId, itemId] = id.split(':')
|
||||||
const myextension = _.findWhere(this.myex, {id: tempId})
|
const myextension = _.findWhere(this.myex, { id: tempId })
|
||||||
if (itemId) {
|
if (itemId) {
|
||||||
const item = myextension.itemsMap.get(id)
|
const item = myextension.itemsMap.get(id)
|
||||||
this.formDialog.data = {
|
this.formDialog.data = {
|
||||||
|
|
@ -412,7 +444,7 @@ window.app = Vue.createApp({
|
||||||
this.formDialog.show = true
|
this.formDialog.show = true
|
||||||
},
|
},
|
||||||
async openUrlDialog(tempid) {
|
async openUrlDialog(tempid) {
|
||||||
this.urlDialog.data = _.findWhere(this.myex, {id: tempid})
|
this.urlDialog.data = _.findWhere(this.myex, { id: tempid })
|
||||||
this.qrValue = this.urlDialog.data.lnurlpay
|
this.qrValue = this.urlDialog.data.lnurlpay
|
||||||
|
|
||||||
// Connecting to our websocket fired in tasks.py
|
// Connecting to our websocket fired in tasks.py
|
||||||
|
|
@ -428,8 +460,8 @@ window.app = Vue.createApp({
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
///Simple call to the api to create an invoice/////
|
///Simple call to the api to create an invoice/////
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
myex = _.findWhere(this.myex, {id: tempid})
|
myex = _.findWhere(this.myex, { id: tempid })
|
||||||
const wallet = _.findWhere(this.g.user.wallets, {id: myex.wallet})
|
const wallet = _.findWhere(this.g.user.wallets, { id: myex.wallet })
|
||||||
const data = {
|
const data = {
|
||||||
myextension_id: tempid,
|
myextension_id: tempid,
|
||||||
amount: this.invoiceAmount,
|
amount: this.invoiceAmount,
|
||||||
|
|
@ -481,20 +513,20 @@ window.app = Vue.createApp({
|
||||||
this.getDcaClients(),
|
this.getDcaClients(),
|
||||||
this.getDeposits()
|
this.getDeposits()
|
||||||
])
|
])
|
||||||
|
|
||||||
// Calculate total DCA balance
|
// Calculate total DCA balance
|
||||||
this.calculateTotalDcaBalance()
|
this.calculateTotalDcaBalance()
|
||||||
|
|
||||||
// Legacy data loading
|
// Legacy data loading
|
||||||
await this.getMyExtensions()
|
await this.getMyExtensions()
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
deposits() {
|
deposits() {
|
||||||
this.calculateTotalDcaBalance()
|
this.calculateTotalDcaBalance()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
clientOptions() {
|
clientOptions() {
|
||||||
return this.dcaClients.map(client => ({
|
return this.dcaClients.map(client => ({
|
||||||
|
|
@ -502,7 +534,7 @@ window.app = Vue.createApp({
|
||||||
value: client.id
|
value: client.id
|
||||||
}))
|
}))
|
||||||
},
|
},
|
||||||
|
|
||||||
calculateTotalDcaBalance() {
|
calculateTotalDcaBalance() {
|
||||||
this.totalDcaBalance = this.deposits
|
this.totalDcaBalance = this.deposits
|
||||||
.filter(d => d.status === 'confirmed')
|
.filter(d => d.status === 'confirmed')
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,82 @@
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</q-card>
|
</q-card>
|
||||||
|
|
||||||
|
<!-- Quick Add Deposit Section -->
|
||||||
|
<q-card>
|
||||||
|
<q-card-section>
|
||||||
|
<h6 class="text-subtitle2 q-my-none">Quick Add Deposit</h6>
|
||||||
|
<p class="text-caption q-my-none">Add a new deposit for an existing client</p>
|
||||||
|
|
||||||
|
<div v-if="dcaClients.length === 0" class="q-mt-md">
|
||||||
|
<q-banner class="bg-orange-1 text-orange-9">
|
||||||
|
<template v-slot:avatar>
|
||||||
|
<q-icon name="info" color="orange" />
|
||||||
|
</template>
|
||||||
|
No DCA clients registered yet. Clients must first install and configure the DCA client extension.
|
||||||
|
<template v-slot:action>
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
|
color="orange"
|
||||||
|
label="Create Test Client"
|
||||||
|
@click="createTestClient"
|
||||||
|
size="sm"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</q-banner>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<q-form v-else @submit="sendQuickDeposit" class="q-gutter-md q-mt-md">
|
||||||
|
<div class="row q-gutter-md">
|
||||||
|
<div class="col">
|
||||||
|
<q-select
|
||||||
|
filled
|
||||||
|
dense
|
||||||
|
emit-value
|
||||||
|
v-model="quickDepositForm.client_id"
|
||||||
|
:options="clientOptions"
|
||||||
|
label="Select Client *"
|
||||||
|
option-label="label"
|
||||||
|
option-value="value"
|
||||||
|
></q-select>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<q-input
|
||||||
|
filled
|
||||||
|
dense
|
||||||
|
type="number"
|
||||||
|
v-model.number="quickDepositForm.amount"
|
||||||
|
label="Amount (GTQ) *"
|
||||||
|
placeholder="Amount in centavos (GTQ * 100)"
|
||||||
|
hint="Enter amount in centavos"
|
||||||
|
></q-input>
|
||||||
|
</div>
|
||||||
|
<div class="col-auto">
|
||||||
|
<q-btn
|
||||||
|
unelevated
|
||||||
|
color="primary"
|
||||||
|
type="submit"
|
||||||
|
:disable="!quickDepositForm.client_id || !quickDepositForm.amount"
|
||||||
|
>Add Deposit</q-btn
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<q-input
|
||||||
|
filled
|
||||||
|
dense
|
||||||
|
type="textarea"
|
||||||
|
v-model.trim="quickDepositForm.notes"
|
||||||
|
label="Notes (Optional)"
|
||||||
|
placeholder="Optional notes about this deposit"
|
||||||
|
rows="2"
|
||||||
|
></q-input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</q-form>
|
||||||
|
</q-card-section>
|
||||||
|
</q-card>
|
||||||
|
|
||||||
<!-- Deposits Management Section -->
|
<!-- Deposits Management Section -->
|
||||||
<q-card>
|
<q-card>
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
|
|
@ -262,65 +338,6 @@
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--/////////////////////////////////////////////////-->
|
|
||||||
<!--//////////////QUICK ADD DEPOSIT SECTION//////////-->
|
|
||||||
<!--/////////////////////////////////////////////////-->
|
|
||||||
|
|
||||||
<q-card v-if="dcaClients.length > 0">
|
|
||||||
<q-card-section>
|
|
||||||
<h6 class="text-subtitle2 q-my-none">Quick Add Deposit</h6>
|
|
||||||
<p class="text-caption q-my-none">Add a new deposit for an existing client</p>
|
|
||||||
<q-form @submit="sendQuickDeposit" class="q-gutter-md q-mt-md">
|
|
||||||
<div class="row q-gutter-md">
|
|
||||||
<div class="col">
|
|
||||||
<q-select
|
|
||||||
filled
|
|
||||||
dense
|
|
||||||
emit-value
|
|
||||||
v-model="quickDepositForm.client_id"
|
|
||||||
:options="clientOptions"
|
|
||||||
label="Select Client *"
|
|
||||||
option-label="label"
|
|
||||||
option-value="value"
|
|
||||||
></q-select>
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
<q-input
|
|
||||||
filled
|
|
||||||
dense
|
|
||||||
type="number"
|
|
||||||
v-model.number="quickDepositForm.amount"
|
|
||||||
label="Amount (GTQ) *"
|
|
||||||
placeholder="Amount in centavos (GTQ * 100)"
|
|
||||||
hint="Enter amount in centavos"
|
|
||||||
></q-input>
|
|
||||||
</div>
|
|
||||||
<div class="col-auto">
|
|
||||||
<q-btn
|
|
||||||
unelevated
|
|
||||||
color="primary"
|
|
||||||
type="submit"
|
|
||||||
:disable="!quickDepositForm.client_id || !quickDepositForm.amount"
|
|
||||||
>Add Deposit</q-btn
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col">
|
|
||||||
<q-input
|
|
||||||
filled
|
|
||||||
dense
|
|
||||||
type="textarea"
|
|
||||||
v-model.trim="quickDepositForm.notes"
|
|
||||||
label="Notes (Optional)"
|
|
||||||
placeholder="Optional notes about this deposit"
|
|
||||||
rows="2"
|
|
||||||
></q-input>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</q-form>
|
|
||||||
</q-card-section>
|
|
||||||
</q-card>
|
|
||||||
|
|
||||||
<!--/////////////////////////////////////////////////-->
|
<!--/////////////////////////////////////////////////-->
|
||||||
<!--//////////////DEPOSIT FORM DIALOG////////////////-->
|
<!--//////////////DEPOSIT FORM DIALOG////////////////-->
|
||||||
|
|
|
||||||
|
|
@ -223,6 +223,15 @@ async def api_get_dca_client(
|
||||||
# Note: Client creation/update/delete will be handled by the DCA client extension
|
# Note: Client creation/update/delete will be handled by the DCA client extension
|
||||||
# Admin extension only reads existing clients and manages their deposits
|
# Admin extension only reads existing clients and manages their deposits
|
||||||
|
|
||||||
|
# TEMPORARY: Test client creation endpoint (remove in production)
|
||||||
|
@myextension_api_router.post("/api/v1/dca/clients", status_code=HTTPStatus.CREATED)
|
||||||
|
async def api_create_test_dca_client(
|
||||||
|
data: CreateDcaClientData,
|
||||||
|
wallet: WalletTypeInfo = Depends(require_admin_key),
|
||||||
|
) -> DcaClient:
|
||||||
|
"""Create a test DCA client (temporary for testing)"""
|
||||||
|
return await create_dca_client(data)
|
||||||
|
|
||||||
|
|
||||||
@myextension_api_router.get("/api/v1/dca/clients/{client_id}/balance")
|
@myextension_api_router.get("/api/v1/dca/clients/{client_id}/balance")
|
||||||
async def api_get_client_balance(
|
async def api_get_client_balance(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue