Merged PR 124: improve Donnation component and fix string format for the value in the wallet
improve Donnation component and fix string format for the value in the wallet
This commit is contained in:
@@ -26,13 +26,19 @@
|
||||
</div>
|
||||
|
||||
<v-card-text>
|
||||
<v-text-field v-model="tipAmount"
|
||||
class="p-2"
|
||||
label="Montant"
|
||||
density="comfortable"
|
||||
variant="outlined"
|
||||
hide-details
|
||||
clearable
|
||||
<v-text-field
|
||||
v-model="tipAmount"
|
||||
type="number"
|
||||
:min="0"
|
||||
class="p-2"
|
||||
label="Montant"
|
||||
density="comfortable"
|
||||
variant="outlined"
|
||||
hide-details
|
||||
clearable
|
||||
inputmode="numeric"
|
||||
@keydown="preventNonNumeric"
|
||||
prepend-inner-icon="mdi-currency-usd"
|
||||
></v-text-field>
|
||||
|
||||
<v-textarea v-model="tipMessage"
|
||||
@@ -139,7 +145,6 @@ function closeDialog() {
|
||||
checkout.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
async function goPay() {
|
||||
isPaymentDialogActive.value = true;
|
||||
|
||||
@@ -149,4 +154,13 @@ async function goPay() {
|
||||
|
||||
await checkout.mount('#checkout');
|
||||
}
|
||||
|
||||
function preventNonNumeric(event) {
|
||||
const key = event.key;
|
||||
const allowedKeys = ['Backspace', 'ArrowLeft', 'ArrowRight', 'Delete'];
|
||||
|
||||
if (!/^\d$/.test(key) && !allowedKeys.includes(key)) {
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -64,11 +64,8 @@ const formattedTransactions = computed(() => {
|
||||
});
|
||||
|
||||
const formattedBalance = computed(() => {
|
||||
const balanceStr = totalBalance.value.toString();
|
||||
const balanceParts = balanceStr.split(".");
|
||||
const integerPart = balanceParts[0]
|
||||
const decimalPart = balanceParts[1]
|
||||
return integerPart + ',' + decimalPart + ' $';
|
||||
const balance = totalBalance.value.toString();
|
||||
return `${balance} $`
|
||||
});
|
||||
|
||||
const transactionCount = computed(() => userTransactions.value.length);
|
||||
|
||||
Reference in New Issue
Block a user