fix: use Salix to get the list of confirmed orders #124

Merged
jsegarra merged 7 commits from ldragan/hedera-web:taro/confirmed-orders into beta 2025-03-28 13:32:03 +00:00
1 changed files with 19 additions and 4 deletions
Showing only changes of commit 1698a85055 - Show all commits

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, inject } from 'vue';
import {ref, onMounted, inject, watch} from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
@ -12,6 +12,7 @@ import useNotify from 'src/composables/useNotify.js';
import { currency, formatDateTitle } from 'src/lib/filters.js';
import { tpvStore } from 'stores/tpv';
import { useAppStore } from 'stores/app';
import { useUserStore } from 'stores/user';
import { storeToRefs } from 'pinia';
const { t } = useI18n();
@ -20,6 +21,7 @@ const jApi = inject('jApi');
const api = inject('api');
const { notify } = useNotify();
const appStore = useAppStore();
const userStore = useUserStore();
const { isHeaderMounted } = storeToRefs(appStore);
const showAmountToPayDialog = ref(null);
@ -35,12 +37,14 @@ onMounted(async () => {
schema: 'hedera',
params: '[null, null]',
}));
orders.value = myTickets.data;
debt.value = await jApi.getValue('SELECT -myClient_getDebt(NULL)');
});
const getDebt = async (userId) => {
const myClientDebt = await api.get(`clients/${userId}/getDebt`);
debt.value = -myClientDebt.data;
}
const onPayClick = async () => {
showAmountToPayDialog.value = true;
@ -59,6 +63,17 @@ const onConfirmPay = async () => {
amountToPay.value = parseFloat(amount);
await tpv.pay(amountToPay.value);
};
watch(
() => userStore?.user?.id,
async userId => {
if (userId) {
await getDebt(userId);
}
},
{ immediate: true }
);
</script>
<template>