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