Show mana
gitea/salix-front/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2023-03-22 15:11:08 +01:00
parent dba094e840
commit e44da1c999
1 changed files with 31 additions and 3 deletions

View File

@ -19,7 +19,10 @@ const stateStore = useStateStore();
const arrayData = useArrayData('ClaimLines'); const arrayData = useArrayData('ClaimLines');
const store = arrayData.store; const store = arrayData.store;
const filter = { const claimFilter = {
fields: ['ticketFk'],
};
const linesFilter = {
include: { include: {
relation: 'sale', relation: 'sale',
scope: { scope: {
@ -31,6 +34,13 @@ const filter = {
}, },
}; };
const claim = ref(null);
async function onFetchClaim(data) {
claim.value = data;
fetchMana();
}
const amount = ref(0); const amount = ref(0);
const amountClaimed = ref(0); const amountClaimed = ref(0);
async function onFetch(rows) { async function onFetch(rows) {
@ -96,6 +106,13 @@ const columns = computed(() => [
}, },
]); ]);
const mana = ref(0);
async function fetchMana() {
const ticketId = claim.value.ticketFk;
const response = await axios.get(`Tickets/${ticketId}/getSalesPersonMana`);
mana.value = response.data;
}
async function updateQuantity({ id, quantity }) { async function updateQuantity({ id, quantity }) {
if (!id) return; if (!id) return;
await axios.patch(`ClaimBeginnings/${id}`, { quantity }); await axios.patch(`ClaimBeginnings/${id}`, { quantity });
@ -124,6 +141,9 @@ async function remove({ id }) {
message: t('globals.rowRemoved'), message: t('globals.rowRemoved'),
}); });
} }
const manaTitle = computed(() => `${t('Mana')} ${toCurrency(mana.value)}`);
const totalClaimed = 0;
</script> </script>
<template> <template>
<q-page-sticky position="top" :offset="[0, 0]" expand> <q-page-sticky position="top" :offset="[0, 0]" expand>
@ -141,12 +161,19 @@ async function remove({ id }) {
</q-toolbar-title> </q-toolbar-title>
</q-toolbar> </q-toolbar>
</q-page-sticky> </q-page-sticky>
<fetch-data
:url="`Claims/${route.params.id}`"
:filter="claimFilter"
@on-fetch="onFetchClaim"
auto-load
/>
<div class="column items-center"> <div class="column items-center">
<div class="list"> <div class="list">
<paginate <paginate
data-key="ClaimLines" data-key="ClaimLines"
:url="`Claims/${route.params.id}/lines`" :url="`Claims/${route.params.id}/lines`"
:filter="filter" :filter="linesFilter"
@on-fetch="onFetch" @on-fetch="onFetch"
auto-load auto-load
> >
@ -189,7 +216,7 @@ async function remove({ id }) {
<q-popup-edit <q-popup-edit
v-model="row.sale.discount" v-model="row.sale.discount"
v-slot="scope" v-slot="scope"
title="Discount" :title="manaTitle"
buttons buttons
> >
<q-input <q-input
@ -268,4 +295,5 @@ es:
Amount: Total Amount: Total
Amount Claimed: Cantidad reclamada Amount Claimed: Cantidad reclamada
Delete claimed sale: Eliminar venta reclamada Delete claimed sale: Eliminar venta reclamada
Mana: Maná
</i18n> </i18n>