01 Refactor currency handling to store amounts in GTQ: Removed currency conversion utilities, updated models and API endpoints to directly handle GTQ amounts, and modified transaction processing logic for consistency. Enhanced frontend to reflect these changes, ensuring accurate display and submission of GTQ values across the application.
Refactor GTQ storage migration: Moved the conversion logic for centavo amounts to GTQ into a new migration function, m004_convert_to_gtq_storage, ensuring proper data type changes and updates across relevant tables. This enhances clarity and maintains the integrity of the migration process.
This commit is contained in:
parent
aa71321c84
commit
c83ebf43ab
8 changed files with 157 additions and 162 deletions
|
|
@ -27,7 +27,7 @@ window.app = Vue.createApp({
|
|||
depositsTable: {
|
||||
columns: [
|
||||
{ name: 'client_id', align: 'left', label: 'Client', field: 'client_id' },
|
||||
{ name: 'amount_gtq', align: 'left', label: 'Amount', field: 'amount_gtq' },
|
||||
{ name: 'amount', align: 'left', label: 'Amount', field: 'amount' },
|
||||
{ name: 'currency', align: 'left', label: 'Currency', field: 'currency' },
|
||||
{ name: 'status', align: 'left', label: 'Status', field: 'status' },
|
||||
{ name: 'created_at', align: 'left', label: 'Created', field: 'created_at' },
|
||||
|
|
@ -130,11 +130,11 @@ window.app = Vue.createApp({
|
|||
///////////////////////////////////////////////////
|
||||
|
||||
methods: {
|
||||
// Utility Methods - Simplified since API handles conversion
|
||||
// Utility Methods
|
||||
formatCurrency(amount) {
|
||||
if (!amount) return 'Q 0.00';
|
||||
|
||||
// Amount is already in GTQ from API
|
||||
// Amount is now stored as GTQ directly in database
|
||||
return new Intl.NumberFormat('es-GT', {
|
||||
style: 'currency',
|
||||
currency: 'GTQ',
|
||||
|
|
@ -279,7 +279,7 @@ window.app = Vue.createApp({
|
|||
)
|
||||
return {
|
||||
...client,
|
||||
remaining_balance: balance.remaining_balance_gtq
|
||||
remaining_balance: balance.remaining_balance
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Error fetching balance for client ${client.id}:`, error)
|
||||
|
|
@ -303,7 +303,7 @@ window.app = Vue.createApp({
|
|||
try {
|
||||
const data = {
|
||||
client_id: this.quickDepositForm.selectedClient?.value,
|
||||
amount_gtq: this.quickDepositForm.amount, // Send GTQ directly - API handles conversion
|
||||
amount: this.quickDepositForm.amount, // Send GTQ directly - now stored as GTQ
|
||||
currency: 'GTQ',
|
||||
notes: this.quickDepositForm.notes
|
||||
}
|
||||
|
|
@ -376,7 +376,7 @@ window.app = Vue.createApp({
|
|||
try {
|
||||
const data = {
|
||||
client_id: this.depositFormDialog.data.client_id,
|
||||
amount_gtq: this.depositFormDialog.data.amount, // Send GTQ directly - API handles conversion
|
||||
amount: this.depositFormDialog.data.amount, // Send GTQ directly - now stored as GTQ
|
||||
currency: this.depositFormDialog.data.currency,
|
||||
notes: this.depositFormDialog.data.notes
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue