From f0f38f73bff55bde9bd07ff4ce3c7fef8f41bd84 Mon Sep 17 00:00:00 2001 From: padreug Date: Sat, 5 Jul 2025 17:35:11 +0200 Subject: [PATCH] Update currency handling in frontend and backend: Adjusted amount formatting to display GTQ instead of centavos in the UI. Modified data submission logic to convert GTQ to centavos for backend processing, ensuring consistency in currency representation across the application. --- static/js/index.js | 11 +++++++---- templates/satmachineadmin/index.html | 10 ++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/static/js/index.js b/static/js/index.js index b70f7d8..cb3e281 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -133,11 +133,14 @@ window.app = Vue.createApp({ // Utility Methods formatCurrency(amount) { if (!amount) return 'Q 0.00'; - + + // Convert centavos to GTQ for display + const gtqAmount = amount / 100; + return new Intl.NumberFormat('es-GT', { style: 'currency', currency: 'GTQ', - }).format(amount); + }).format(gtqAmount); }, formatDate(dateString) { @@ -302,7 +305,7 @@ window.app = Vue.createApp({ try { const data = { client_id: this.quickDepositForm.selectedClient?.value, - amount: this.quickDepositForm.amount, + amount: Math.round(this.quickDepositForm.amount * 100), // Convert GTQ to centavos currency: 'GTQ', notes: this.quickDepositForm.notes } @@ -375,7 +378,7 @@ window.app = Vue.createApp({ try { const data = { client_id: this.depositFormDialog.data.client_id, - amount: this.depositFormDialog.data.amount, + amount: Math.round(this.depositFormDialog.data.amount * 100), // Convert GTQ to centavos currency: this.depositFormDialog.data.currency, notes: this.depositFormDialog.data.notes } diff --git a/templates/satmachineadmin/index.html b/templates/satmachineadmin/index.html index 6555d55..61099ce 100644 --- a/templates/satmachineadmin/index.html +++ b/templates/satmachineadmin/index.html @@ -116,10 +116,11 @@ filled dense type="number" + step="0.01" v-model.number="quickDepositForm.amount" label="Amount (GTQ) *" - placeholder="Amount in centavos (GTQ * 100)" - hint="Enter amount in centavos" + placeholder="150.00" + hint="Enter amount in GTQ (e.g., 150.00)" >
@@ -379,10 +380,11 @@ filled dense type="number" + step="0.01" v-model.number="depositFormDialog.data.amount" label="Deposit Amount (GTQ) *" - placeholder="Amount in centavos (GTQ * 100)" - hint="Enter amount in centavos (1 GTQ = 100 centavos)" + placeholder="150.00" + hint="Enter amount in GTQ (e.g., 150.00)" >