#6896 fix Order module problems #817

Merged
jon merged 18 commits from Fix_OrderModuleProblems into dev 2024-10-29 11:20:14 +00:00
9 changed files with 68 additions and 25 deletions

View File

@ -705,6 +705,8 @@ order:
quantity: Quantity quantity: Quantity
price: Price price: Price
amount: Amount amount: Amount
confirm: Confirm
confirmLines: Confirm lines
department: department:
pageTitles: pageTitles:
basicData: Basic data basicData: Basic data

View File

@ -681,13 +681,15 @@ order:
vat: IVA vat: IVA
state: Estado state: Estado
alias: Alias alias: Alias
items: Items items: Artículos
orderTicketList: Tickets del pedido orderTicketList: Tickets del pedido
details: Detalles details: Detalles
item: Item item: Item
quantity: Cantidad quantity: Cantidad
price: Precio price: Precio
amount: Monto amount: Monto
confirm: Confirmar
confirmLines: Confirmar lineas
shelving: shelving:
list: list:
parking: Parking parking: Parking

View File

@ -102,6 +102,7 @@ function extractValueTags(items) {
:key="row.id" :key="row.id"
:item="row" :item="row"
is-catalog is-catalog
class="fill-icon"
/> />
</div> </div>
</template> </template>

View File

@ -71,10 +71,6 @@ const getConfirmationValue = (isConfirmed) => {
}; };
const total = ref(null); const total = ref(null);
function ticketFilter(order) {
return JSON.stringify({ id: order.id });
}
</script> </script>
<template> <template>
@ -126,7 +122,11 @@ function ticketFilter(order) {
color="primary" color="primary"
:to="{ :to="{
name: 'TicketList', name: 'TicketList',
query: { table: ticketFilter(entity) }, query: {
table: JSON.stringify({
orderFk: entity.id,
}),
},
}" }"
> >
<QTooltip>{{ t('order.summary.orderTicketList') }}</QTooltip> <QTooltip>{{ t('order.summary.orderTicketList') }}</QTooltip>

View File

@ -23,8 +23,8 @@ function confirmRemove() {
.dialog({ .dialog({
component: VnConfirm, component: VnConfirm,
componentProps: { componentProps: {
title: t('globals.confirmDeletion'), title: t('You are going to delete this order'),
message: t('confirmDeletionMessage'), message: t('Continue anyway?'),
promise: remove, promise: remove,
}, },
}) })
@ -57,5 +57,6 @@ en:
es: es:
deleteOrder: Eliminar pedido deleteOrder: Eliminar pedido
confirmDeletionMessage: Seguro que quieres eliminar este pedido? confirmDeletionMessage: Seguro que quieres eliminar este pedido?
You are going to delete this order: El pedido se eliminará
Continue anyway?: ¿Continuar de todos modos?
</i18n> </i18n>

View File

@ -6,6 +6,7 @@ import { useQuasar } from 'quasar';
import axios from 'axios'; import axios from 'axios';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { useArrayData } from 'composables/useArrayData'; import { useArrayData } from 'composables/useArrayData';
import { confirm } from 'src/pages/Order/composables/confirmOrder';
import { toCurrency, toDate } from 'src/filters'; import { toCurrency, toDate } from 'src/filters';
import VnConfirm from 'components/ui/VnConfirm.vue'; import VnConfirm from 'components/ui/VnConfirm.vue';
@ -31,7 +32,6 @@ const orderSummary = ref({
}); });
const getTotalRef = ref(); const getTotalRef = ref();
const getVATRef = ref(); const getVATRef = ref();
const lineFilter = ref({ const lineFilter = ref({
include: [ include: [
{ {
@ -168,7 +168,7 @@ const columns = computed(() => [
name: 'tableActions', name: 'tableActions',
actions: [ actions: [
{ {
title: t('Delete'), title: t('Remove item'),
icon: 'delete', icon: 'delete',
show: (row) => !row.order.isConfirmed, show: (row) => !row.order.isConfirmed,
action: (row) => confirmRemove(row), action: (row) => confirmRemove(row),
@ -204,10 +204,11 @@ async function remove(item) {
getVATRef.value.fetch(); getVATRef.value.fetch();
} }
async function confirmOrder() { async function handleConfirm() {
await axios.post(`Orders/${route.params.id}/confirm`); const result = await confirm(route.params.id);
if (result) {
quasar.notify({ quasar.notify({
message: t('globals.confirm'), message: t('globals.dataSaved'),
type: 'positive', type: 'positive',
}); });
router.push({ router.push({
@ -216,8 +217,8 @@ async function confirmOrder() {
table: JSON.stringify({ clientFk: descriptorData.store.data.clientFk }), table: JSON.stringify({ clientFk: descriptorData.store.data.clientFk }),
}, },
}); });
}
} }
watch( watch(
() => router.currentRoute.value.params.id, () => router.currentRoute.value.params.id,
() => { () => {
@ -314,7 +315,7 @@ watch(
</template> </template>
</VnTable> </VnTable>
<QPageSticky :offset="[20, 20]" v-if="!order?.isConfirmed" style="z-index: 2"> <QPageSticky :offset="[20, 20]" v-if="!order?.isConfirmed" style="z-index: 2">
<QBtn fab icon="check" color="primary" @click="confirmOrder()" /> <QBtn fab icon="check" color="primary" @click="handleConfirm()" />
<QTooltip> <QTooltip>
{{ t('confirm') }} {{ t('confirm') }}
</QTooltip> </QTooltip>
@ -401,4 +402,5 @@ es:
confirmDeletion: Confirmar eliminación, confirmDeletion: Confirmar eliminación,
confirmDeletionMessage: Seguro que quieres eliminar este artículo? confirmDeletionMessage: Seguro que quieres eliminar este artículo?
confirm: Confirmar confirm: Confirmar
Remove item: Eliminar artículo
</i18n> </i18n>

View File

@ -2,7 +2,10 @@
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar';
import { dashIfEmpty, toCurrency, toDateHourMinSec } from 'src/filters'; import { dashIfEmpty, toCurrency, toDateHourMinSec } from 'src/filters';
import { useArrayData } from 'composables/useArrayData';
import { confirm } from 'src/pages/Order/composables/confirmOrder';
import VnLv from 'components/ui/VnLv.vue'; import VnLv from 'components/ui/VnLv.vue';
import CardSummary from 'components/ui/CardSummary.vue'; import CardSummary from 'components/ui/CardSummary.vue';
import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue';
@ -21,6 +24,9 @@ const $props = defineProps({
}); });
const entityId = computed(() => $props.id || route.params.id); const entityId = computed(() => $props.id || route.params.id);
const summary = ref();
const quasar = useQuasar();
const descriptorData = useArrayData('orderData');
const detailsColumns = ref([ const detailsColumns = ref([
{ {
name: 'item', name: 'item',
@ -49,6 +55,18 @@ const detailsColumns = ref([
field: (row) => toCurrency(row?.quantity * row?.price), field: (row) => toCurrency(row?.quantity * row?.price),
}, },
]); ]);
async function handleConfirm() {
const result = await confirm(route.params.id);
if (result) {
quasar.notify({
message: t('globals.dataSaved'),
type: 'positive',
});
summary.value.fetch({});
descriptorData.fetch({});
}
}
</script> </script>
<template> <template>
@ -62,6 +80,17 @@ const detailsColumns = ref([
{{ t('order.summary.basket') }} #{{ entity?.id }} - {{ t('order.summary.basket') }} #{{ entity?.id }} -
{{ entity?.client?.name }} ({{ entity?.clientFk }}) {{ entity?.client?.name }} ({{ entity?.clientFk }})
</template> </template>
<template #header-right>
<QBtn
flat
text-color="white"
:disabled="isConfirmed"
:label="t('order.summary.confirm')"
@click="handleConfirm()"
>
<QTooltip>{{ t('order.summary.confirmLines') }}</QTooltip>
</QBtn>
</template>
<template #body="{ entity }"> <template #body="{ entity }">
<QCard class="vn-one"> <QCard class="vn-one">
<VnTitle <VnTitle

View File

@ -0,0 +1,5 @@
import axios from 'axios';
export async function confirm(routeId) {
return await axios.post(`Orders/${routeId}/confirm`);
}
Review

No me acaba de convencer este archivo porque solo tenemos una función dentro, y a futuro no creo que escale
Yo lo he enfocado de esta manera
987c28e745/src/pages/Customer/composables/getClientRisk.js

No me acaba de convencer este archivo porque solo tenemos una función dentro, y a futuro no creo que escale Yo lo he enfocado de esta manera https://gitea.verdnatura.es/verdnatura/salix-front/src/commit/987c28e745fde447edb45b0223bc9e6a6c9f47e4/src/pages/Customer/composables/getClientRisk.js

View File

@ -56,6 +56,7 @@ const attendersOptions = ref([]);
v-model="data.price" v-model="data.price"
:label="t('purchaseRequest.price')" :label="t('purchaseRequest.price')"
type="number" type="number"
step="0.01"
min="0" min="0"
/> />
</VnRow> </VnRow>