forked from verdnatura/salix-front
Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 7172-fixClaimBasicData
This commit is contained in:
commit
acb4e2d98e
|
@ -421,12 +421,13 @@ setLogTree();
|
||||||
>
|
>
|
||||||
<div class="timeline">
|
<div class="timeline">
|
||||||
<div class="user-avatar">
|
<div class="user-avatar">
|
||||||
<VnUserLink :worker-id="userLog.user.id">
|
<VnUserLink :worker-id="userLog?.user?.id">
|
||||||
<template #link>
|
<template #link>
|
||||||
<VnAvatar
|
<VnAvatar
|
||||||
:class="{ 'cursor-pointer': userLog.user.id }"
|
:class="{ 'cursor-pointer': userLog?.user?.id }"
|
||||||
:worker-id="userLog.user.id"
|
:worker-id="userLog?.user?.id"
|
||||||
:title="userLog.user.nickname"
|
:title="userLog?.user?.nickname"
|
||||||
|
:show-letter="!userLog?.user"
|
||||||
size="lg"
|
size="lg"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -199,8 +199,9 @@ es:
|
||||||
templates:
|
templates:
|
||||||
pendingPayment: 'Su pedido está pendiente de pago.
|
pendingPayment: 'Su pedido está pendiente de pago.
|
||||||
Por favor, entre en la página web y efectue el pago con tarjeta. Muchas gracias.'
|
Por favor, entre en la página web y efectue el pago con tarjeta. Muchas gracias.'
|
||||||
minAmount: 'Es necesario un importe mínimo de 50€ (Sin IVA) en su pedido
|
minAmount: 'Te recordamos que tu pedido {orderId} es inferior a 50€.
|
||||||
{ orderId } con llegada { landing } para recibirlo sin portes adicionales.'
|
Te recomendamos amplíes para no generar costes extra, provocarán un incremento de tu tarifa.
|
||||||
|
¡Un saludo!'
|
||||||
orderChanges: 'Pedido {orderId} con llegada estimada día { landing }: { changes }'
|
orderChanges: 'Pedido {orderId} con llegada estimada día { landing }: { changes }'
|
||||||
en: Inglés
|
en: Inglés
|
||||||
es: Español
|
es: Español
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { ref, computed, onMounted } from 'vue';
|
import { ref, computed, onMounted } from 'vue';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useStateStore } from 'src/stores/useStateStore';
|
import { useStateStore } from 'src/stores/useStateStore';
|
||||||
import { toDate, toPercentage, toCurrency } from 'filters/index';
|
import { toDate, toPercentage, toCurrency } from 'filters/index';
|
||||||
|
@ -10,14 +10,13 @@ import { tMobile } from 'src/composables/tMobile';
|
||||||
import CrudModel from 'src/components/CrudModel.vue';
|
import CrudModel from 'src/components/CrudModel.vue';
|
||||||
import FetchData from 'src/components/FetchData.vue';
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||||
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
|
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
import { useArrayData } from 'composables/useArrayData';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
|
||||||
const stateStore = computed(() => useStateStore());
|
const stateStore = computed(() => useStateStore());
|
||||||
const claim = ref(null);
|
const claim = ref(null);
|
||||||
const claimRef = ref();
|
const claimRef = ref();
|
||||||
|
@ -41,7 +40,7 @@ const multiplicatorValue = ref();
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
name: 'Id',
|
name: 'id',
|
||||||
label: t('Id item'),
|
label: t('Id item'),
|
||||||
field: (row) => row.itemFk,
|
field: (row) => row.itemFk,
|
||||||
},
|
},
|
||||||
|
@ -292,6 +291,14 @@ async function importToNewRefundTicket() {
|
||||||
v-model:selected="selectedRows"
|
v-model:selected="selectedRows"
|
||||||
:grid="$q.screen.lt.md"
|
:grid="$q.screen.lt.md"
|
||||||
>
|
>
|
||||||
|
<template #body-cell-id="{ value }">
|
||||||
|
<QTd align="center">
|
||||||
|
<span class="link">
|
||||||
|
{{ value }}
|
||||||
|
<ItemDescriptorProxy :id="value" />
|
||||||
|
</span>
|
||||||
|
</QTd>
|
||||||
|
</template>
|
||||||
<template #body-cell-ticket="{ value }">
|
<template #body-cell-ticket="{ value }">
|
||||||
<QTd align="center">
|
<QTd align="center">
|
||||||
<span class="link">
|
<span class="link">
|
||||||
|
|
|
@ -39,15 +39,21 @@ const claimFilter = {
|
||||||
|
|
||||||
const claimStates = ref([]);
|
const claimStates = ref([]);
|
||||||
const claimStatesCopy = ref([]);
|
const claimStatesCopy = ref([]);
|
||||||
|
const optionsList = ref([]);
|
||||||
|
|
||||||
|
function setWorkers(data) {
|
||||||
|
workers.value = data;
|
||||||
|
workersCopy.value = data;
|
||||||
|
}
|
||||||
const workersOptions = ref([]);
|
const workersOptions = ref([]);
|
||||||
|
|
||||||
function setClaimStates(data) {
|
function setClaimStates(data) {
|
||||||
claimStates.value = data;
|
claimStates.value = data;
|
||||||
claimStatesCopy.value = data;
|
claimStatesCopy.value = data;
|
||||||
}
|
}
|
||||||
let optionsList;
|
|
||||||
async function getEnumValues() {
|
async function getEnumValues() {
|
||||||
optionsList = [{ id: null, description: t('claim.basicData.null') }];
|
optionsList.value = [{ id: null, description: t('claim.basicData.null') }];
|
||||||
const { data } = await axios.get(`Applications/get-enum-values`, {
|
const { data } = await axios.get(`Applications/get-enum-values`, {
|
||||||
params: {
|
params: {
|
||||||
schema: 'vn',
|
schema: 'vn',
|
||||||
|
@ -56,8 +62,9 @@ async function getEnumValues() {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
for (let value of data)
|
for (let value of data)
|
||||||
optionsList.push({ id: value, description: t(`claim.basicData.${value}`) });
|
optionsList.value.push({ id: value, description: t(`claim.basicData.${value}`) });
|
||||||
}
|
}
|
||||||
|
|
||||||
getEnumValues();
|
getEnumValues();
|
||||||
|
|
||||||
const statesFilter = {
|
const statesFilter = {
|
||||||
|
|
|
@ -45,20 +45,25 @@ async function onFetchClaim(data) {
|
||||||
|
|
||||||
const amount = ref();
|
const amount = ref();
|
||||||
const amountClaimed = ref();
|
const amountClaimed = ref();
|
||||||
async function onFetch(rows) {
|
async function onFetch(rows, newRows) {
|
||||||
|
if (newRows) rows = newRows;
|
||||||
amount.value = 0;
|
amount.value = 0;
|
||||||
amountClaimed.value = 0;
|
amountClaimed.value = 0;
|
||||||
if (!rows || !rows.length) return;
|
if (!rows || !rows.length) return;
|
||||||
|
|
||||||
amount.value = rows.reduce(
|
for (const row of rows) {
|
||||||
(accumulator, { sale }) => accumulator + sale.price * sale.quantity,
|
const { sale } = row;
|
||||||
0
|
amount.value = amount.value + totalRow(sale);
|
||||||
);
|
const price = row.quantity * sale.price;
|
||||||
|
const discount = (sale.discount * price) / 100;
|
||||||
|
amountClaimed.value = amountClaimed.value + (price - discount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
amountClaimed.value = rows.reduce(
|
function totalRow({ price, quantity, discount }) {
|
||||||
(accumulator, line) => accumulator + line.sale.price * line.quantity,
|
const amount = price * quantity;
|
||||||
0
|
const appliedDiscount = (discount * amount) / 100;
|
||||||
);
|
return amount - appliedDiscount;
|
||||||
}
|
}
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
|
@ -102,12 +107,7 @@ const columns = computed(() => [
|
||||||
{
|
{
|
||||||
name: 'total',
|
name: 'total',
|
||||||
label: t('Total'),
|
label: t('Total'),
|
||||||
field: ({ sale }) => {
|
field: ({ sale }) => totalRow(sale),
|
||||||
const amount = sale.price * sale.quantity;
|
|
||||||
const appliedDiscount = (sale.discount * amount) / 100;
|
|
||||||
|
|
||||||
return amount - appliedDiscount;
|
|
||||||
},
|
|
||||||
format: (value) => toCurrency(value),
|
format: (value) => toCurrency(value),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
},
|
},
|
||||||
|
@ -129,6 +129,7 @@ async function updateDiscount({ saleFk, discount, canceller }) {
|
||||||
await axios.post(query, body, {
|
await axios.post(query, body, {
|
||||||
signal: canceller.signal,
|
signal: canceller.signal,
|
||||||
});
|
});
|
||||||
|
await claimLinesForm.value.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onUpdateDiscount(response) {
|
function onUpdateDiscount(response) {
|
||||||
|
@ -151,8 +152,11 @@ function showImportDialog() {
|
||||||
.onOk(() => claimLinesForm.value.reload());
|
.onOk(() => claimLinesForm.value.reload());
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveWhenHasChanges() {
|
async function saveWhenHasChanges() {
|
||||||
claimLinesForm.value.getChanges().updates && claimLinesForm.value.onSubmit();
|
if (claimLinesForm.value.getChanges().updates) {
|
||||||
|
await claimLinesForm.value.onSubmit();
|
||||||
|
await claimLinesForm.value.reload();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
@ -188,7 +192,6 @@ function saveWhenHasChanges() {
|
||||||
save-url="ClaimBeginnings/crud"
|
save-url="ClaimBeginnings/crud"
|
||||||
:filter="linesFilter"
|
:filter="linesFilter"
|
||||||
@on-fetch="onFetch"
|
@on-fetch="onFetch"
|
||||||
@save-changes="onFetch"
|
|
||||||
v-model:selected="selected"
|
v-model:selected="selected"
|
||||||
:default-save="false"
|
:default-save="false"
|
||||||
:default-reset="false"
|
:default-reset="false"
|
||||||
|
|
|
@ -180,10 +180,13 @@ function handleLocation(data, location) {
|
||||||
:rules="validate('Worker.postcode')"
|
:rules="validate('Worker.postcode')"
|
||||||
:roles-allowed-to-create="['deliveryAssistant']"
|
:roles-allowed-to-create="['deliveryAssistant']"
|
||||||
:options="postcodesOptions"
|
:options="postcodesOptions"
|
||||||
v-model="data.location"
|
v-model="data.postalCode"
|
||||||
@update:model-value="(location) => handleLocation(data, location)"
|
@update:model-value="(location) => handleLocation(data, location)"
|
||||||
></VnLocation>
|
></VnLocation>
|
||||||
</div>
|
</div>
|
||||||
|
</VnRow>
|
||||||
|
|
||||||
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Agency')"
|
:label="t('Agency')"
|
||||||
|
@ -202,7 +205,6 @@ function handleLocation(data, location) {
|
||||||
<VnInput :label="t('Mobile')" clearable v-model="data.mobile" />
|
<VnInput :label="t('Mobile')" clearable v-model="data.mobile" />
|
||||||
</div>
|
</div>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
@ -229,7 +231,6 @@ function handleLocation(data, location) {
|
||||||
</VnSelectDialog>
|
</VnSelectDialog>
|
||||||
</div>
|
</div>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
|
||||||
<h4 class="q-mb-xs">{{ t('Notes') }}</h4>
|
<h4 class="q-mb-xs">{{ t('Notes') }}</h4>
|
||||||
<VnRow
|
<VnRow
|
||||||
:key="index"
|
:key="index"
|
||||||
|
|
Loading…
Reference in New Issue